Added uiControlHandle() and fixed other uiButton issues.
This commit is contained in:
parent
a7293951f7
commit
3b52095ab0
|
@ -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;
|
||||
|
||||
|
|
|
@ -54,3 +54,9 @@ void uiQuit(void)
|
|||
{
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
|
||||
// TODO move somewhere else
|
||||
uintptr_t uiControlHandle(uiControl *c)
|
||||
{
|
||||
return (*(c->handle))(c);
|
||||
}
|
||||
|
|
1
new/ui.h
1
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue