summaryrefslogtreecommitdiff
path: root/new/windows/label.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/label.c
parente33465d1d44e48113755a50de03decf1e833a2dd (diff)
Migrated windows/entry.c and windows/label.c.
Diffstat (limited to 'new/windows/label.c')
-rw-r--r--new/windows/label.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/new/windows/label.c b/new/windows/label.c
index 3d8a5cc..1c4ef01 100644
--- a/new/windows/label.c
+++ b/new/windows/label.c
@@ -2,6 +2,7 @@
#include "uipriv_windows.h"
struct label {
+ uiLabel l;
};
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 label *l = (struct label *) (c->data);
+ struct label *l = (struct label *) c;
uiFree(l);
}
@@ -30,13 +31,24 @@ static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *
*height = uiDlgUnitsToY(labelHeight, d->sys->baseY);
}
+static char *getText(uiLabel *l)
+{
+ return uiWindowsControlText(uiControl(l));
+}
+
+static void setText(uiLabel *l, const char *text)
+{
+ uiWindowsControlSetText(uiControl(l), text);
+}
+
uiControl *uiNewLabel(const char *text)
{
- uiControl *c;
struct label *l;
uiWindowsNewControlParams p;
WCHAR *wtext;
+ l = uiNew(struct label);
+
p.dwExStyle = 0;
p.lpClassName = L"static";
wtext = toUTF16(text);
@@ -49,23 +61,13 @@ uiControl *uiNewLabel(const char *text)
p.onWM_COMMAND = onWM_COMMAND;
p.onWM_NOTIFY = onWM_NOTIFY;
p.onWM_DESTROY = onWM_DESTROY;
- c = uiWindowsNewControl(&p);
+ uiWindowsNewControl(uiControl(l), &p);
uiFree(wtext);
- c->preferredSize = preferredSize;
+ uiControl(l)->PreferredSize = preferredSize;
- l = uiNew(struct label);
- c->data = l;
-
- return c;
-}
+ uiLabel(l)->Text = getText;
+ uiLabel(l)->SetText = setText;
-char *uiLabelText(uiControl *c)
-{
- return uiWindowsControlText(c);
-}
-
-void uiLabelSetText(uiControl *c, const char *text)
-{
- uiWindowsControlSetText(c, text);
+ return uiLabel(l);
}