diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-09 17:46:26 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-09 17:46:26 -0400 |
| commit | cba301abbc9af3b3a8d005c5e716349cdf877cc1 (patch) | |
| tree | ed448f6f3975b9dd6665ccfbd58d1bd77c27946d /new/entry_windows.c | |
| parent | 5c06fc512b3a62ba5f01286e2363339886228cf9 (diff) | |
More Windows conversion. Not done yet.
Diffstat (limited to 'new/entry_windows.c')
| -rw-r--r-- | new/entry_windows.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/new/entry_windows.c b/new/entry_windows.c index f147d5d..506df77 100644 --- a/new/entry_windows.c +++ b/new/entry_windows.c @@ -2,11 +2,8 @@ #include "uipriv_windows.h" struct entry { - uiControl *c; }; -#define E(x) ((struct entry *) (x)) - static BOOL onWM_COMMAND(uiControl *c, WPARAM wParam, LPARAM lParam, void *data, LRESULT *lResult) { return FALSE; @@ -17,9 +14,9 @@ static BOOL onWM_NOTIFY(uiControl *c, WPARAM wParam, LPARAM lParam, void *data, return FALSE; } -static void onWM_DESTROY(uiControl *c, void *data) +static void onWM_DESTROY(uiControl *c) { - struct entry *e = (struct entry *) data; + struct entry *e = (struct entry *) (c->data); uiFree(e); } @@ -28,20 +25,19 @@ static void onWM_DESTROY(uiControl *c, void *data) #define entryWidth 107 /* this is actually the shorter progress bar width, but Microsoft only indicates as wide as necessary */ #define entryHeight 14 -static void preferredSize(uiControl *c, int baseX, int baseY, LONG internalLeading, intmax_t *width, intmax_t *height) +static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) { - *width = uiDlgUnitToX(entryWidth, baseX); - *height = uiDlgUnitToY(entryHeight, baseY); + *width = uiDlgUnitToX(entryWidth, d->sys->baseX); + *height = uiDlgUnitToY(entryHeight, d->sys->baseY); } uiControl *uiNewEntry(void) { + uiControl *c; struct entry *e; uiWindowsNewControlParams p; HWND hwnd; - e = uiNew(struct entry); - p.dwExStyle = WS_EX_CLIENTEDGE; p.lpClassName = L"edit"; p.lpWindowName = L""; @@ -51,15 +47,17 @@ uiControl *uiNewEntry(void) p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; p.onWM_DESTROY = onWM_DESTROY; - p.onCommandNotifyDestroyData = e; - p.preferredSize = preferredSize; - p.data = e; - e->c = uiWindowsNewControl(&p); + c = uiWindowsNewControl(&p); + + c->preferredSize = preferredSize; - hwnd = (HWND) uiControlHandle(e->c); + hwnd = (HWND) uiControlHandle(c); SendMessageW(hwnd, WM_SETFONT, (WPARAM) hMessageFont, (LPARAM) TRUE); - return e->c; + e = uiNew(struct entry); + c->data = e; + + return c; } char *uiEntryText(uiControl *c) |
