Made preferredSize function names consistent on Windows. Stale TODO cleanup.

This commit is contained in:
Pietro Gagliardi 2015-05-04 14:56:26 -04:00
parent c6229271cc
commit 854d1f49af
5 changed files with 8 additions and 11 deletions

View File

@ -34,7 +34,7 @@ static void onDestroy(void *data)
// from http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing // from http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing
#define buttonHeight 14 #define buttonHeight 14
static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) static void buttonPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
{ {
struct button *b = (struct button *) c; struct button *b = (struct button *) c;
SIZE size; SIZE size;
@ -104,7 +104,7 @@ uiButton *uiNewButton(const char *text)
b->onClicked = defaultOnClicked; b->onClicked = defaultOnClicked;
uiControl(b)->PreferredSize = preferredSize; uiControl(b)->PreferredSize = buttonPreferredSize;
uiButton(b)->Text = buttonText; uiButton(b)->Text = buttonText;
uiButton(b)->SetText = buttonSetText; uiButton(b)->SetText = buttonSetText;

View File

@ -44,7 +44,7 @@ static void onDestroy(void *data)
// from http://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx // from http://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx
#define checkboxXFromLeftOfBoxToLeftOfLabel 12 #define checkboxXFromLeftOfBoxToLeftOfLabel 12
static void preferredSize(uiControl *cc, uiSizing *d, intmax_t *width, intmax_t *height) static void checkboxPreferredSize(uiControl *cc, uiSizing *d, intmax_t *width, intmax_t *height)
{ {
struct checkbox *c = (struct checkbox *) cc; struct checkbox *c = (struct checkbox *) cc;
@ -119,7 +119,7 @@ uiCheckbox *uiNewCheckbox(const char *text)
c->onToggled = defaultOnToggled; c->onToggled = defaultOnToggled;
uiControl(c)->PreferredSize = preferredSize; uiControl(c)->PreferredSize = checkboxPreferredSize;
uiCheckbox(c)->Text = checkboxText; uiCheckbox(c)->Text = checkboxText;
uiCheckbox(c)->SetText = checkboxSetText; uiCheckbox(c)->SetText = checkboxSetText;

View File

@ -27,7 +27,7 @@ static void onDestroy(void *data)
#define entryWidth 107 /* this is actually the shorter progress bar width, but Microsoft only indicates as wide as necessary */ #define entryWidth 107 /* this is actually the shorter progress bar width, but Microsoft only indicates as wide as necessary */
#define entryHeight 14 #define entryHeight 14
static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) static void entryPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
{ {
*width = uiDlgUnitsToX(entryWidth, d->sys->baseX); *width = uiDlgUnitsToX(entryWidth, d->sys->baseX);
*height = uiDlgUnitsToY(entryHeight, d->sys->baseY); *height = uiDlgUnitsToY(entryHeight, d->sys->baseY);
@ -64,7 +64,7 @@ uiEntry *uiNewEntry(void)
e->hwnd = (HWND) uiControlHandle(uiControl(e)); e->hwnd = (HWND) uiControlHandle(uiControl(e));
uiControl(e)->PreferredSize = preferredSize; uiControl(e)->PreferredSize = entryPreferredSize;
uiEntry(e)->Text = entryText; uiEntry(e)->Text = entryText;
uiEntry(e)->SetText = entrySetText; uiEntry(e)->SetText = entrySetText;

View File

@ -26,7 +26,7 @@ static void onDestroy(void *data)
// via http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing // via http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing
#define labelHeight 8 #define labelHeight 8
static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) static void labelPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
{ {
struct label *l = (struct label *) c; struct label *l = (struct label *) c;
@ -70,7 +70,7 @@ uiLabel *uiNewLabel(const char *text)
l->hwnd = (HWND) uiControlHandle(uiControl(l)); l->hwnd = (HWND) uiControlHandle(uiControl(l));
uiControl(l)->PreferredSize = preferredSize; uiControl(l)->PreferredSize = labelPreferredSize;
uiLabel(l)->Text = labelText; uiLabel(l)->Text = labelText;
uiLabel(l)->SetText = labelSetText; uiLabel(l)->SetText = labelSetText;

View File

@ -1,8 +1,6 @@
// 12 april 2015 // 12 april 2015
#include "uipriv_windows.h" #include "uipriv_windows.h"
// TODO enable/disable
struct tab { struct tab {
uiTab t; uiTab t;
HWND hwnd; HWND hwnd;
@ -64,7 +62,6 @@ static void onDestroy(void *data)
uiFree(t); uiFree(t);
} }
// TODO rename all the other preferredSize overloads to this form
static void tabPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) static void tabPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
{ {
struct tab *t = (struct tab *) c; struct tab *t = (struct tab *) c;