summaryrefslogtreecommitdiff
path: root/new/windows/entry.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-16 09:20:00 -0400
committerPietro Gagliardi <[email protected]>2015-04-16 09:20:00 -0400
commitf59341b6efb6d6a26a2bcbe1c07777c558fbefa2 (patch)
tree7bc507859f611b3e398ba6a22f3afe3062a2c7f8 /new/windows/entry.c
parente33465d1d44e48113755a50de03decf1e833a2dd (diff)
Migrated windows/entry.c and windows/label.c.
Diffstat (limited to 'new/windows/entry.c')
-rw-r--r--new/windows/entry.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/new/windows/entry.c b/new/windows/entry.c
index 2297c28..045e553 100644
--- a/new/windows/entry.c
+++ b/new/windows/entry.c
@@ -2,6 +2,7 @@
#include "uipriv_windows.h"
struct entry {
+ uiEntry e;
};
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
@@ -16,7 +17,7 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult)
static void onWM_DESTROY(uiControl *c)
{
- struct entry *e = (struct entry *) (c->data);
+ struct entry *e = (struct entry *) c;
uiFree(e);
}
@@ -31,12 +32,23 @@ static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *
*height = uiDlgUnitsToY(entryHeight, d->sys->baseY);
}
+static char *getText(uiEntry *e)
+{
+ return uiWindowsControlText(uiControl(e));
+}
+
+static void setText(uiEntry *e, const char *text)
+{
+ uiWindowsControlSetText(uiControl(e), text);
+}
+
uiControl *uiNewEntry(void)
{
- uiControl *c;
struct entry *e;
uiWindowsNewControlParams p;
+ e = uiNew(struct entry);
+
p.dwExStyle = WS_EX_CLIENTEDGE;
p.lpClassName = L"edit";
p.lpWindowName = L"";
@@ -46,22 +58,12 @@ uiControl *uiNewEntry(void)
p.onWM_COMMAND = onWM_COMMAND;
p.onWM_NOTIFY = onWM_NOTIFY;
p.onWM_DESTROY = onWM_DESTROY;
- c = uiWindowsNewControl(&p);
+ uiWindowsNewControl(uiControl(e), &p);
- c->preferredSize = preferredSize;
+ uiControl(e)->PreferredSize = preferredSize;
- e = uiNew(struct entry);
- c->data = e;
-
- return c;
-}
+ uiEntry(e)->Text = getText;
+ uiEntry(e)->SetText = setText;
-char *uiEntryText(uiControl *c)
-{
- return uiWindowsControlText(c);
-}
-
-void uiEntrySetText(uiControl *c, const char *text)
-{
- uiWindowsControlSetText(c, text);
+ return uiEntry(e);
}