Added uiControlHandle() and fixed other uiButton issues.
This commit is contained in:
parent
5b36956ecb
commit
978e9b5e94
|
@ -38,6 +38,7 @@ uiControl *uiNewButton(const char *text)
|
||||||
struct button *b;
|
struct button *b;
|
||||||
uiWindowsNewControlParams p;
|
uiWindowsNewControlParams p;
|
||||||
WCHAR *wtext;
|
WCHAR *wtext;
|
||||||
|
HWND hwnd;
|
||||||
|
|
||||||
b = uiNew(struct button);
|
b = uiNew(struct button);
|
||||||
|
|
||||||
|
@ -52,9 +53,12 @@ uiControl *uiNewButton(const char *text)
|
||||||
p.data = b;
|
p.data = b;
|
||||||
b->c = uiWindowsNewControl(&p);
|
b->c = uiWindowsNewControl(&p);
|
||||||
|
|
||||||
|
hwnd = (HWND) uiControlHandle(b->c);
|
||||||
wtext = toUTF16(text);
|
wtext = toUTF16(text);
|
||||||
// TODO set text
|
if (SetWindowTextW(hwnd, wtext) == 0)
|
||||||
|
logLastError("error setting button text in uiNewButton()");
|
||||||
uiFree(wtext);
|
uiFree(wtext);
|
||||||
|
SendMessageW(hwnd, WM_SETFONT, (WPARAM) hMessageFont, (LPARAM) TRUE);
|
||||||
|
|
||||||
b->onClicked = defaultOnClicked;
|
b->onClicked = defaultOnClicked;
|
||||||
|
|
||||||
|
|
|
@ -54,3 +54,9 @@ void uiQuit(void)
|
||||||
{
|
{
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO move somewhere else
|
||||||
|
uintptr_t uiControlHandle(uiControl *c)
|
||||||
|
{
|
||||||
|
return (*(c->handle))(c);
|
||||||
|
}
|
||||||
|
|
1
ui.h
1
ui.h
|
@ -16,6 +16,7 @@ void uiMain(void);
|
||||||
void uiQuit(void);
|
void uiQuit(void);
|
||||||
|
|
||||||
typedef struct uiControl uiControl;
|
typedef struct uiControl uiControl;
|
||||||
|
uintptr_t uiControlHandle(uiControl *);
|
||||||
|
|
||||||
typedef struct uiWindow uiWindow;
|
typedef struct uiWindow uiWindow;
|
||||||
uiWindow *uiNewWindow(char *, int, int);
|
uiWindow *uiNewWindow(char *, int, int);
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
// 6 april 2015
|
// 6 april 2015
|
||||||
#include "uipriv_windows.h"
|
#include "uipriv_windows.h"
|
||||||
|
|
||||||
|
// TODOs:
|
||||||
|
// - child not set to fit initial size
|
||||||
|
|
||||||
struct uiWindow {
|
struct uiWindow {
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
uiControl *child;
|
uiControl *child;
|
||||||
|
|
Loading…
Reference in New Issue