summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-07 04:12:03 -0400
committerPietro Gagliardi <[email protected]>2015-04-07 04:12:03 -0400
commit3b52095ab08fdb749d454698721300351eb49ffa (patch)
tree22c7999591fca116055d16d0fd3ad1bac59709da
parenta7293951f75d92a80d4d986ec7dda3fa25ab640b (diff)
Added uiControlHandle() and fixed other uiButton issues.
-rw-r--r--new/button_windows.c6
-rw-r--r--new/main_windows.c6
-rw-r--r--new/ui.h1
-rw-r--r--new/window_windows.c3
4 files changed, 15 insertions, 1 deletions
diff --git a/new/button_windows.c b/new/button_windows.c
index a66490d..d7921ad 100644
--- a/new/button_windows.c
+++ b/new/button_windows.c
@@ -38,6 +38,7 @@ uiControl *uiNewButton(const char *text)
struct button *b;
uiWindowsNewControlParams p;
WCHAR *wtext;
+ HWND hwnd;
b = uiNew(struct button);
@@ -52,9 +53,12 @@ uiControl *uiNewButton(const char *text)
p.data = b;
b->c = uiWindowsNewControl(&p);
+ hwnd = (HWND) uiControlHandle(b->c);
wtext = toUTF16(text);
- // TODO set text
+ if (SetWindowTextW(hwnd, wtext) == 0)
+ logLastError("error setting button text in uiNewButton()");
uiFree(wtext);
+ SendMessageW(hwnd, WM_SETFONT, (WPARAM) hMessageFont, (LPARAM) TRUE);
b->onClicked = defaultOnClicked;
diff --git a/new/main_windows.c b/new/main_windows.c
index bd973b7..9c8132a 100644
--- a/new/main_windows.c
+++ b/new/main_windows.c
@@ -54,3 +54,9 @@ void uiQuit(void)
{
PostQuitMessage(0);
}
+
+// TODO move somewhere else
+uintptr_t uiControlHandle(uiControl *c)
+{
+ return (*(c->handle))(c);
+}
diff --git a/new/ui.h b/new/ui.h
index cc10300..b698c85 100644
--- a/new/ui.h
+++ b/new/ui.h
@@ -16,6 +16,7 @@ void uiMain(void);
void uiQuit(void);
typedef struct uiControl uiControl;
+uintptr_t uiControlHandle(uiControl *);
typedef struct uiWindow uiWindow;
uiWindow *uiNewWindow(char *, int, int);
diff --git a/new/window_windows.c b/new/window_windows.c
index 3f2abb2..b4d0163 100644
--- a/new/window_windows.c
+++ b/new/window_windows.c
@@ -1,6 +1,9 @@
// 6 april 2015
#include "uipriv_windows.h"
+// TODOs:
+// - child not set to fit initial size
+
struct uiWindow {
HWND hwnd;
uiControl *child;