Migrated windows/entry.c and windows/label.c.

This commit is contained in:
Pietro Gagliardi 2015-04-17 11:13:42 -04:00
parent 292ea9db7a
commit 1ed80a8609
2 changed files with 17 additions and 9 deletions

View File

@ -3,6 +3,7 @@
struct entry {
uiEntry e;
HWND hwnd;
};
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
@ -32,12 +33,12 @@ static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *
*height = uiDlgUnitsToY(entryHeight, d->sys->baseY);
}
static char *getText(uiEntry *e)
static char *entryText(uiEntry *e)
{
return uiWindowsControlText(uiControl(e));
}
static void setText(uiEntry *e, const char *text)
static void entrySetText(uiEntry *e, const char *text)
{
uiWindowsControlSetText(uiControl(e), text);
}
@ -60,10 +61,12 @@ uiEntry *uiNewEntry(void)
p.onWM_DESTROY = onWM_DESTROY;
uiWindowsNewControl(uiControl(e), &p);
e->hwnd = HWND(e);
uiControl(e)->PreferredSize = preferredSize;
uiEntry(e)->Text = getText;
uiEntry(e)->SetText = setText;
uiEntry(e)->Text = entryText;
uiEntry(e)->SetText = entrySetText;
return uiEntry(e);
}

View File

@ -3,6 +3,7 @@
struct label {
uiLabel l;
HWND hwnd;
};
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
@ -27,16 +28,18 @@ static void onWM_DESTROY(uiControl *c)
static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
{
*width = uiWindowsWindowTextWidth(uiControlHWND(c));
struct label *l = (struct label *) c;
*width = uiWindowsWindowTextWidth(l->hwnd);
*height = uiDlgUnitsToY(labelHeight, d->sys->baseY);
}
static char *getText(uiLabel *l)
static char *labelText(uiLabel *l)
{
return uiWindowsControlText(uiControl(l));
}
static void setText(uiLabel *l, const char *text)
static void labelSetText(uiLabel *l, const char *text)
{
uiWindowsControlSetText(uiControl(l), text);
}
@ -64,10 +67,12 @@ uiLabel *uiNewLabel(const char *text)
uiWindowsNewControl(uiControl(l), &p);
uiFree(wtext);
l->hwnd = HWND(l);
uiControl(l)->PreferredSize = preferredSize;
uiLabel(l)->Text = getText;
uiLabel(l)->SetText = setText;
uiLabel(l)->Text = labelText;
uiLabel(l)->SetText = labelSetText;
return uiLabel(l);
}