Fixed very many compilation issues. There's a lot more left to fix, though...

This commit is contained in:
Pietro Gagliardi 2015-08-31 17:50:23 -04:00
parent 67e87f213a
commit 7e11274e3a
23 changed files with 88 additions and 84 deletions

View File

@ -101,6 +101,8 @@ _UI_EXTERN int uiWindowsUtilHasTabStops(HWND hwnd);
// InternalLeading is the standard control font's internal leading; labels in uiForms use this for correct Y positioning. // InternalLeading is the standard control font's internal leading; labels in uiForms use this for correct Y positioning.
// CoordFrom and CoordTo are the window handles to convert coordinates passed to uiControlResize() from and to (viaa MapWindowRect()) before passing to one of the Windows API resizing functions. // CoordFrom and CoordTo are the window handles to convert coordinates passed to uiControlResize() from and to (viaa MapWindowRect()) before passing to one of the Windows API resizing functions.
struct uiWindowsSizing { struct uiWindowsSizing {
intmax_t XPadding;
intmax_t YPadding;
int BaseX; int BaseX;
int BaseY; int BaseY;
LONG InternalLeading; LONG InternalLeading;

View File

@ -76,7 +76,7 @@ static void radiobuttonsCommitSetParent(uiControl *c, uiControl *parent)
// 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 radiobuttonXFromLeftOfBoxToLeftOfLabel 12 #define radiobuttonXFromLeftOfBoxToLeftOfLabel 12
static void radiobuttonsPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) static void radiobuttonsPreferredSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
struct radiobuttons *r = (struct radiobuttons *) c; struct radiobuttons *r = (struct radiobuttons *) c;
uintmax_t i; uintmax_t i;
@ -92,7 +92,7 @@ static void radiobuttonsPreferredSize(uiControl *c, uiSizing *d, intmax_t *width
*height = uiWindowsDlgUnitsToY(radiobuttonHeight, d->Sys->BaseY) * r->hwnds->len; *height = uiWindowsDlgUnitsToY(radiobuttonHeight, d->Sys->BaseY) * r->hwnds->len;
} }
static void radiobuttonsResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d) static void radiobuttonsResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiWindowsSizing *d)
{ {
struct radiobuttons *r = (struct radiobuttons *) c; struct radiobuttons *r = (struct radiobuttons *) c;
intmax_t height1; intmax_t height1;
@ -114,7 +114,7 @@ static void radiobuttonsResize(uiControl *c, intmax_t x, intmax_t y, intmax_t wi
} }
} }
static uiSizing *radiobuttonsSizing(uiControl *c) static uiWindowsSizing *radiobuttonsSizing(uiControl *c)
{ {
complain("attempt to call uiControlSizing() on uiRadioButtons %p", c); complain("attempt to call uiControlSizing() on uiRadioButtons %p", c);
return NULL; return NULL;

View File

@ -88,7 +88,7 @@ static void spinboxCommitSetParent(uiControl *c, uiControl *parent)
#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 spinboxPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) static void spinboxPreferredSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
*width = uiWindowsDlgUnitsToX(entryWidth, d->Sys->BaseX); *width = uiWindowsDlgUnitsToX(entryWidth, d->Sys->BaseX);
*height = uiWindowsDlgUnitsToY(entryHeight, d->Sys->BaseY); *height = uiWindowsDlgUnitsToY(entryHeight, d->Sys->BaseY);
@ -136,7 +136,7 @@ static void recreateUpDown(struct spinbox *s)
s->inhibitChanged = FALSE; s->inhibitChanged = FALSE;
} }
static void spinboxResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d) static void spinboxResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiWindowsSizing *d)
{ {
struct spinbox *s = (struct spinbox *) c; struct spinbox *s = (struct spinbox *) c;
@ -144,7 +144,7 @@ static void spinboxResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width,
recreateUpDown(s); recreateUpDown(s);
} }
static uiSizing *spinboxSizing(uiControl *c) static uiWindowsSizing *spinboxSizing(uiControl *c)
{ {
complain("attempt to call uiControlSizing() on uiSpinbox %p", c); complain("attempt to call uiControlSizing() on uiSpinbox %p", c);
return NULL; return NULL;

View File

@ -1,8 +1,7 @@
// 7 april 2015 // 7 april 2015
#include "out/ui.h" #include "uipriv_windows.h"
#include "uipriv.h"
struct box { struct uiBox {
uiWindowsControl c; uiWindowsControl c;
HWND hwnd; HWND hwnd;
struct ptrArray *controls; struct ptrArray *controls;
@ -31,14 +30,14 @@ static void onDestroy(uiBox *b)
struct child *bc; struct child *bc;
while (b->controls->len != 0) { while (b->controls->len != 0) {
bc = ptrArrayIndex(b->controls, struct boxControl *, 0); bc = ptrArrayIndex(b->controls, struct child *, 0);
ptrArrayDelete(b->controls, 0); ptrArrayDelete(b->controls, 0);
childDestroy(bc); childDestroy(bc);
} }
ptrArrayDestroy(b->controls); ptrArrayDestroy(b->controls);
} }
static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
/* TODO /* TODO
uiBox *b = uiBox(c); uiBox *b = uiBox(c);
@ -77,7 +76,7 @@ static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intma
maxStretchyWidth = 0; maxStretchyWidth = 0;
maxStretchyHeight = 0; maxStretchyHeight = 0;
for (i = 0; i < b->controls->len; i++) { for (i = 0; i < b->controls->len; i++) {
bc = ptrArrayIndex(b->controls, struct boxControl *, i); bc = ptrArrayIndex(b->controls, struct child *, i);
if (!uiControlContainerVisible(bc->c)) if (!uiControlContainerVisible(bc->c))
continue; continue;
uiControlPreferredSize(bc->c, d, &preferredWidth, &preferredHeight); uiControlPreferredSize(bc->c, d, &preferredWidth, &preferredHeight);
@ -109,17 +108,17 @@ static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intma
*/ */
} }
static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d) static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiWindowsSizing *d)
{ {
/* TODO /* TODO
uibox *b = uiBox(c); uibox *b = uiBox(c);
struct boxControl *bc; struct child *bc;
int xpadding, ypadding; int xpadding, ypadding;
uintmax_t nStretchy; uintmax_t nStretchy;
intmax_t stretchywid, stretchyht; intmax_t stretchywid, stretchyht;
uintmax_t i; uintmax_t i;
intmax_t preferredWidth, preferredHeight; intmax_t preferredWidth, preferredHeight;
uiSizing *dchild; uiWindowsSizing *dchild;
(*(b->baseResize))(uiControl(b), x, y, width, height, d); (*(b->baseResize))(uiControl(b), x, y, width, height, d);
@ -147,7 +146,7 @@ static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t wi
stretchyht = height; stretchyht = height;
nStretchy = 0; nStretchy = 0;
for (i = 0; i < b->controls->len; i++) { for (i = 0; i < b->controls->len; i++) {
bc = ptrArrayIndex(b->controls, struct boxControl *, i); bc = ptrArrayIndex(b->controls, struct child *, i);
if (!uiControlContainerVisible(bc->c)) if (!uiControlContainerVisible(bc->c))
continue; continue;
if (bc->stretchy) { if (bc->stretchy) {
@ -173,7 +172,7 @@ static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t wi
else else
stretchywid /= nStretchy; stretchywid /= nStretchy;
for (i = 0; i < b->controls->len; i++) { for (i = 0; i < b->controls->len; i++) {
bc = ptrArrayIndex(b->controls, struct boxControl *, i); bc = ptrArrayIndex(b->controls, struct child *, i);
if (!uiControlContainerVisible(bc->c)) if (!uiControlContainerVisible(bc->c))
continue; continue;
if (bc->stretchy) { if (bc->stretchy) {
@ -185,7 +184,7 @@ static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t wi
// 3) now we can position controls // 3) now we can position controls
dchild = uiControlSizing(uiControl(b)); dchild = uiControlSizing(uiControl(b));
for (i = 0; i < b->controls->len; i++) { for (i = 0; i < b->controls->len; i++) {
bc = ptrArrayIndex(b->controls, struct boxControl *, i); bc = ptrArrayIndex(b->controls, struct child *, i);
if (!uiControlContainerVisible(bc->c)) if (!uiControlContainerVisible(bc->c))
continue; continue;
uiControlResize(bc->c, x, y, bc->width, bc->height, dchild); uiControlResize(bc->c, x, y, bc->width, bc->height, dchild);
@ -201,12 +200,12 @@ static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t wi
/* TODO /* TODO
static int boxHasTabStops(uiControl *c) static int boxHasTabStops(uiControl *c)
{ {
struct box *b = (struct box *) c; uiBox *b = uiBox(c);
struct boxControl *bc; struct child *bc;
uintmax_t i; uintmax_t i;
for (i = 0; i < b->controls->len; i++) { for (i = 0; i < b->controls->len; i++) {
bc = ptrArrayIndex(b->controls, struct boxControl *, i); bc = ptrArrayIndex(b->controls, struct child *, i);
if (uiControlHasTabStops(bc->c)) if (uiControlHasTabStops(bc->c))
return 1; return 1;
} }
@ -216,7 +215,7 @@ static int boxHasTabStops(uiControl *c)
static void boxContainerUpdateState(uiControl *c) static void boxContainerUpdateState(uiControl *c)
{ {
struct box *b = (struct box *) c; uiBox *b = uiBox(c);
struct child *bc; struct child *bc;
uintmax_t i; uintmax_t i;
@ -239,12 +238,12 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
dozorder = 0; dozorder = 0;
if (b->controls->len != 0) { if (b->controls->len != 0) {
dozorder = 1; dozorder = 1;
bc = ptrArrayIndex(b->controls, struct boxControl *, 0); bc = ptrArrayIndex(b->controls, struct child *, 0);
zorder = uiControlStartZOrder(bc->c); zorder = uiControlStartZOrder(bc->c);
} }
*/ */
bc = newChild(child, uiControl(b), b->hwnd); bc = newChild(c, uiControl(b), b->hwnd);
ctrlSetStretchy(bc, stretchy); ctrlSetStretchy(bc, stretchy);
ptrArrayAppend(b->controls, bc); ptrArrayAppend(b->controls, bc);
uiControlQueueResize(uiControl(b)); uiControlQueueResize(uiControl(b));
@ -253,7 +252,7 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
// and now update the zorder for all controls // and now update the zorder for all controls
if (dozorder) if (dozorder)
for (i = 0; i < b->controls->len; i++) { for (i = 0; i < b->controls->len; i++) {
bc = ptrArrayIndex(b->controls, struct boxControl *, i); bc = ptrArrayIndex(b->controls, struct child *, i);
zorder = uiControlSetZOrder(bc->c, zorder); zorder = uiControlSetZOrder(bc->c, zorder);
} }
*/ */
@ -286,7 +285,7 @@ static uiBox *finishNewBox(int vertical)
b = (uiBox *) uiNewControl(uiBoxType()); b = (uiBox *) uiNewControl(uiBoxType());
b->hwnd = makeContainer(); b->hwnd = newContainer();
b->vertical = vertical; b->vertical = vertical;
b->controls = newPtrArray(); b->controls = newPtrArray();

View File

@ -28,7 +28,7 @@ static BOOL onWM_COMMAND(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult)
// 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 minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
uiButton *b = uiButton(c); uiButton *b = uiButton(c);
SIZE size; SIZE size;

View File

@ -38,7 +38,7 @@ static BOOL onWM_COMMAND(uiControl *cc, HWND hwnd, WORD code, LRESULT *lResult)
// 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 minimumSize(uiControl *cc, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *cc, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
uiCheckbox *c = uiCheckbox(cc); uiCheckbox *c = uiCheckbox(cc);

View File

@ -51,7 +51,7 @@ struct child *newChildWithTabPage(uiControl *child, uiControl *parent, HWND pare
void childRemove(struct child *c) void childRemove(struct child *c)
{ {
uiWindowsEnsureSetParent(c->hwnd, utilwin); uiWindowsEnsureSetParent(c->hwnd, utilWindow);
uiControlSetParent(c->c, NULL); uiControlSetParent(c->c, NULL);
if (c->tabpage != NULL) if (c->tabpage != NULL)
uiWindowsEnsureDestroyWindow(c->tabpage); uiWindowsEnsureDestroyWindow(c->tabpage);
@ -75,7 +75,7 @@ HWND childHWND(struct child *c)
void childMinimumSize(struct child *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) void childMinimumSize(struct child *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
uiWindowsControl *wc; uiWindowsControl *wc;
intmax_t left, top, right, bottom intmax_t left, top, right, bottom;
wc = uiWindowsControl(c->c); wc = uiWindowsControl(c->c);
(*(wc->MinimumSize))(wc, d, width, height); (*(wc->MinimumSize))(wc, d, width, height);
@ -122,7 +122,7 @@ int childMargined(struct child *c)
return c->margined; return c->margined;
} }
void childSetMargined(struct child *c) void childSetMargined(struct child *c, int margined)
{ {
c->margined = margined; c->margined = margined;
uiControlQueueResize(c->c); uiControlQueueResize(c->c);

View File

@ -17,7 +17,7 @@ uiWindowsDefineControl(
#define comboboxWidth 107 /* this is actually the shorter progress bar width, but Microsoft only indicates as wide as necessary */ #define comboboxWidth 107 /* this is actually the shorter progress bar width, but Microsoft only indicates as wide as necessary */
#define comboboxHeight 14 #define comboboxHeight 14
static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
*width = uiWindowsDlgUnitsToX(comboboxWidth, d->BaseX); *width = uiWindowsDlgUnitsToX(comboboxWidth, d->BaseX);
*height = uiWindowsDlgUnitsToY(comboboxHeight, d->BaseY); *height = uiWindowsDlgUnitsToY(comboboxHeight, d->BaseY);

View File

@ -110,16 +110,16 @@ static void setDateTimeFormat(HWND hwnd)
// 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 entryHeight 14 #define entryHeight 14
static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *dd, intmax_t *width, intmax_t *height)
{ {
uiDateTimePicker *d = uiDateTimePicker(c); uiDateTimePicker *d = uiDateTimePicker(c);
SIZE s; SIZE s;
s.cx = 0; s.cx = 0;
s.cy = 0; s.cy = 0;
SendMessageW(dd->hwnd, DTM_GETIDEALSIZE, 0, (LPARAM) (&s)); SendMessageW(d->hwnd, DTM_GETIDEALSIZE, 0, (LPARAM) (&s));
*width = s.cx; *width = s.cx;
*height = uiWindowsDlgUnitsToY(entryHeight, d->BaseY); *height = uiWindowsDlgUnitsToY(entryHeight, dd->BaseY);
} }
static uiDateTimePicker *finishNewDateTimePicker(DWORD style) static uiDateTimePicker *finishNewDateTimePicker(DWORD style)

View File

@ -32,7 +32,7 @@ static BOOL onWM_COMMAND(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult)
#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 minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
*width = uiWindowsDlgUnitsToX(entryWidth, d->BaseX); *width = uiWindowsDlgUnitsToX(entryWidth, d->BaseX);
*height = uiWindowsDlgUnitsToY(entryHeight, d->BaseY); *height = uiWindowsDlgUnitsToY(entryHeight, d->BaseY);
@ -83,7 +83,7 @@ uiEntry *uiNewEntry(void)
{ {
uiEntry *e; uiEntry *e;
e = (uiEntry *) uiWindowsNewSingleHWNDControl(uiNewControl()); e = (uiEntry *) uiNewControl(uiEntryType());
e->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE, e->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
L"edit", L"", L"edit", L"",

View File

@ -34,7 +34,7 @@ static void onDestroy(uiGroup *g)
#define groupUnmarginedYMarginTop 8 #define groupUnmarginedYMarginTop 8
#define groupUnmarginedYMarginBottom 3 #define groupUnmarginedYMarginBottom 3
static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
uiGroup *g = uiGroup(c); uiGroup *g = uiGroup(c);
@ -51,13 +51,12 @@ static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intma
} }
} }
static void groupRelayout(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height) static void groupRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
{ {
struct group *g = (struct group *) c; uiGroup *g = uiGroup(c);
uiSizing *d; uiWindowsSizing *d;
// TODO uiWindowsEnsureMoveWindow(g->hwnd, x, y, width, height);
(*(g->baseResize))(uiControl(g), x, y, width, height, d);
if (g->child == NULL) if (g->child == NULL)
return; return;
@ -136,8 +135,8 @@ uiGroup *uiNewGroup(const char *text)
// TODO subclass uiGroup to call parent.c functions // TODO subclass uiGroup to call parent.c functions
uiWindowsFinishNewControl(g, uiGroup); uiWindowsFinishNewControl(g, uiGroup);
uiControl(g)->Resize = groupRelayout;
uiControl(g)->ContainerUpdateState = groupContainerUpdateState; uiControl(g)->ContainerUpdateState = groupContainerUpdateState;
uiWindowsControl(g)->Relayout = groupRelayout;
return g; return g;
} }

View File

@ -14,7 +14,7 @@ uiWindowsDefineControl(
// 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 minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
uiLabel *l = uiLabel(c); uiLabel *l = uiLabel(c);

View File

@ -76,36 +76,36 @@ static void onQuitClicked(uiMenuItem *item, uiWindow *w, void *data)
void uiMenuItemEnable(uiMenuItem *i) void uiMenuItemEnable(uiMenuItem *i)
{ {
item->disabled = FALSE; i->disabled = FALSE;
sync(item); sync(i);
} }
void uiMenuItemDisable(uiMenuItem *i) void uiMenuItemDisable(uiMenuItem *i)
{ {
item->disabled = TRUE; i->disabled = TRUE;
sync(item); sync(i);
} }
void uiMenuItemOnClicked(uiMenuItem *i, void (*f)(uiMenuItem *, uiWindow *, void *), void *data) void uiMenuItemOnClicked(uiMenuItem *i, void (*f)(uiMenuItem *, uiWindow *, void *), void *data)
{ {
if (item->type == typeQuit) if (i->type == typeQuit)
complain("attempt to call uiMenuItemOnClicked() on a Quit item; use uiOnShouldQuit() instead"); complain("attempt to call uiMenuItemOnClicked() on a Quit item; use uiOnShouldQuit() instead");
item->onClicked = f; i->onClicked = f;
item->onClickedData = data; i->onClickedData = data;
} }
int uiMenuItemChecked(uiMenuItem *i) int uiMenuItemChecked(uiMenuItem *i)
{ {
return item->checked != FALSE; return i->checked != FALSE;
} }
void uiMenuItemSetChecked(uiMenuItem *i, int checked) void uiMenuItemSetChecked(uiMenuItem *i, int checked)
{ {
// use explicit values // use explicit values
item->checked = FALSE; i->checked = FALSE;
if (checked) if (checked)
item->checked = TRUE; i->checked = TRUE;
sync(item); sync(i);
} }
static uiMenuItem *newItem(uiMenu *m, int type, const char *name) static uiMenuItem *newItem(uiMenu *m, int type, const char *name)
@ -185,7 +185,7 @@ uiMenuItem *uiMenuAppendPreferencesItem(uiMenu *m)
return newItem(m, typePreferences, NULL); return newItem(m, typePreferences, NULL);
} }
uiMenuItem *uiMenuAppendAboutItem(uiMenu *mm) uiMenuItem *uiMenuAppendAboutItem(uiMenu *m)
{ {
if (hasAbout) if (hasAbout)
complain("attempt to add multiple About menu items"); complain("attempt to add multiple About menu items");

View File

@ -15,10 +15,10 @@ uiWindowsDefineControl(
#define pbarWidth 237 #define pbarWidth 237
#define pbarHeight 8 #define pbarHeight 8
static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
*width = uiWindowsDlgUnitsToX(pbarWidth, d->Sys->BaseX); *width = uiWindowsDlgUnitsToX(pbarWidth, d->BaseX);
*height = uiWindowsDlgUnitsToY(pbarHeight, d->Sys->BaseY); *height = uiWindowsDlgUnitsToY(pbarHeight, d->BaseY);
} }
// unfortunately, as of Vista progress bars have a forced animation on increase // unfortunately, as of Vista progress bars have a forced animation on increase

View File

@ -60,7 +60,7 @@ static void onDestroy(uiRadioButtons *r)
// 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 radiobuttonXFromLeftOfBoxToLeftOfLabel 12 #define radiobuttonXFromLeftOfBoxToLeftOfLabel 12
static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
uiRadioButtons *r = uiRadioButtons(c); uiRadioButtons *r = uiRadioButtons(c);
uintmax_t i; uintmax_t i;
@ -76,7 +76,7 @@ static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intma
*height = uiWindowsDlgUnitsToY(radiobuttonHeight, d->BaseY) * r->hwnds->len; *height = uiWindowsDlgUnitsToY(radiobuttonHeight, d->BaseY) * r->hwnds->len;
} }
static void radiobuttonsRelayout(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height) static void radiobuttonsRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
{ {
/* TODO /* TODO
struct radiobuttons *r = (struct radiobuttons *) c; struct radiobuttons *r = (struct radiobuttons *) c;
@ -176,7 +176,7 @@ uiRadioButtons *uiNewRadioButtons(void)
r->hwnds = newPtrArray(); r->hwnds = newPtrArray();
uiWindowsFinishNewControl(r, uiRadioButtons); uiWindowsFinishNewControl(r, uiRadioButtons);
uiControl(r)->Relayout = radiobuttonsRelayout; uiWindowsControl(r)->Relayout = radiobuttonsRelayout;
return r; return r;
} }

View File

@ -53,7 +53,7 @@ void doResizes(void)
} }
} }
void moveWindow(HWND hwnd, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d) void moveWindow(HWND hwnd, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiWindowsSizing *d)
{ {
RECT r; RECT r;
@ -61,7 +61,6 @@ void moveWindow(HWND hwnd, intmax_t x, intmax_t y, intmax_t width, intmax_t heig
r.top = y; r.top = y;
r.right = x + width; r.right = x + width;
r.bottom = y + height; r.bottom = y + height;
mapWindowRect(d->Sys->CoordFrom, d->Sys->CoordTo, &r);
if (SetWindowPos(hwnd, NULL, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOZORDER) == 0) if (SetWindowPos(hwnd, NULL, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOZORDER) == 0)
logLastError("error moving window in moveWindow()"); logLastError("error moving window in moveWindow()");
} }
@ -79,7 +78,7 @@ void setWindowInsertAfter(HWND hwnd, HWND insertAfter)
uiWindowsSizing *uiWindowsNewSizing(HWND hwnd) uiWindowsSizing *uiWindowsNewSizing(HWND hwnd)
{ {
uiSizing *d; uiWindowsSizing *d;
HDC dc; HDC dc;
HFONT prevfont; HFONT prevfont;
TEXTMETRICW tm; TEXTMETRICW tm;

View File

@ -18,10 +18,10 @@ uiWindowsDefineControl(
// via https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx // via https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx
#define separatorHeight 1 #define separatorHeight 1
static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
*width = 1; // TODO *width = 1; // TODO
*height = uiWindowsDlgUnitsToY(separatorHeight, d->Sys->BaseY); *height = uiWindowsDlgUnitsToY(separatorHeight, d->BaseY);
} }
uiSeparator *uiNewHorizontalSeparator(void) uiSeparator *uiNewHorizontalSeparator(void)

View File

@ -27,7 +27,7 @@ static BOOL onWM_HSCROLL(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult)
#define sliderWidth 107 /* this is actually the shorter progress bar width, but Microsoft doesn't indicate a width */ #define sliderWidth 107 /* this is actually the shorter progress bar width, but Microsoft doesn't indicate a width */
#define sliderHeight 15 #define sliderHeight 15
static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
*width = uiWindowsDlgUnitsToX(sliderWidth, d->BaseX); *width = uiWindowsDlgUnitsToX(sliderWidth, d->BaseX);
*height = uiWindowsDlgUnitsToY(sliderHeight, d->BaseY); *height = uiWindowsDlgUnitsToY(sliderHeight, d->BaseY);

View File

@ -76,7 +76,7 @@ static void onDestroy(uiSpinbox *s)
#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 minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
*width = uiWindowsDlgUnitsToX(entryWidth, d->BaseX); *width = uiWindowsDlgUnitsToX(entryWidth, d->BaseX);
*height = uiWindowsDlgUnitsToY(entryHeight, d->BaseY); *height = uiWindowsDlgUnitsToY(entryHeight, d->BaseY);

View File

@ -70,7 +70,7 @@ static void onDestroy(uiTab *t)
uiWindowsUnregisterWM_NOTIFYHandler(t->hwnd); uiWindowsUnregisterWM_NOTIFYHandler(t->hwnd);
} }
static void minimumSize(uiControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height) static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{ {
/* TODO /* TODO
uiTab *t = uiTab(c); uiTab *t = uiTab(c);
@ -109,7 +109,7 @@ static void tabRelayout(uiControl *c, intmax_t x, intmax_t y, intmax_t width, in
LRESULT n; LRESULT n;
uiControl *page; uiControl *page;
RECT r; RECT r;
uiSizing *dchild; uiWindowsSizing *dchild;
(*(t->baseResize))(uiControl(t), x, y, width, height, d); (*(t->baseResize))(uiControl(t), x, y, width, height, d);
n = curpage(t); n = curpage(t);
@ -149,7 +149,7 @@ static void tabContainerUpdateState(uiControl *c)
void uiTabAppend(uiTab *t, const char *name, uiControl *child) void uiTabAppend(uiTab *t, const char *name, uiControl *child)
{ {
uiTabInsertAt(tt, name, t->pages->len, child); uiTabInsertAt(t, name, t->pages->len, child);
} }
void uiTabInsertAt(uiTab *t, const char *name, uintmax_t n, uiControl *child) void uiTabInsertAt(uiTab *t, const char *name, uintmax_t n, uiControl *child)
@ -222,9 +222,9 @@ void uiTabSetMargined(uiTab *t, uintmax_t n, int margined)
uiTab *uiNewTab(void) uiTab *uiNewTab(void)
{ {
struct tab *t; uiTab *t;
t = (struct tab *) uiWindowsNewSingleHWNDControl(uiTypeTab()); t = (uiTab *) uiNewControl(uiTabType());
t->hwnd = uiWindowsEnsureCreateControlHWND(0, // don't set WS_EX_CONTROLPARENT yet; we do that dynamically in the message loop (see below) t->hwnd = uiWindowsEnsureCreateControlHWND(0, // don't set WS_EX_CONTROLPARENT yet; we do that dynamically in the message loop (see below)
WC_TABCONTROLW, L"", WC_TABCONTROLW, L"",

View File

@ -7,7 +7,7 @@
// 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 tabMargin 7 #define tabMargin 7
static void tabPageMargins(HWND hwnd, intmax_t *left, intmax_t *right, intmax_t *right, intmax_t *bottom) void tabPageMargins(HWND hwnd, intmax_t *left, intmax_t *top, intmax_t *right, intmax_t *bottom)
{ {
uiWindowsSizing *d; uiWindowsSizing *d;
@ -51,10 +51,10 @@ HWND newTabPage(void)
// unfortunately this needs to be a proper dialog for EnableThemeDialogTexture() to work; CreateWindowExW() won't suffice // unfortunately this needs to be a proper dialog for EnableThemeDialogTexture() to work; CreateWindowExW() won't suffice
hwnd = CreateDialogW(hInstance, MAKEINTRESOURCE(rcTabPageDialog), hwnd = CreateDialogW(hInstance, MAKEINTRESOURCE(rcTabPageDialog),
utilWindow, dlgproc); utilWindow, dlgproc);
if (t->hwnd == NULL) if (hwnd == NULL)
logLastError("error creating tab page in newTabPage()"); logLastError("error creating tab page in newTabPage()");
hr = EnableThemeDialogTexture(t->hwnd, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB); hr = EnableThemeDialogTexture(hwnd, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB);
if (hr != S_OK) if (hr != S_OK)
logHRESULT("error setting tab page background in newTabPage()", hr); logHRESULT("error setting tab page background in newTabPage()", hr);

View File

@ -1,6 +1,6 @@
// 6 january 2015 // 6 january 2015
#include "winapi.h" #include "winapi.h"
#include "../out/ui.h" #include "../ui.h"
#include "../ui_windows.h" #include "../ui_windows.h"
#include "../uipriv.h" #include "../uipriv.h"
#include "resources.h" #include "resources.h"
@ -106,8 +106,12 @@ extern void childRelayout(struct child *c, intmax_t x, intmax_t y, intmax_t widt
extern void childUpdateState(struct child *c); extern void childUpdateState(struct child *c);
extern HWND childTabPage(struct child *c); extern HWND childTabPage(struct child *c);
extern int childMargined(struct child *c); extern int childMargined(struct child *c);
extern void childSetMargined(struct child *c); extern void childSetMargined(struct child *c, int margined);
extern int childFlag(struct child *c); extern int childFlag(struct child *c);
extern void childSetFlag(struct child *c, int flag); extern void childSetFlag(struct child *c, int flag);
extern intmax_t childIntmax(struct child *c, int n); extern intmax_t childIntmax(struct child *c, int n);
extern void childSetIntmax(struct child *c, int n, intmax_t to); extern void childSetIntmax(struct child *c, int n, intmax_t to);
// tabpage.c
extern void tabPageMargins(HWND, intmax_t *, intmax_t *, intmax_t *, intmax_t *);
extern HWND newTabPage(void);

View File

@ -140,7 +140,7 @@ void uiWindowSetTitle(uiWindow *w, const char *title)
// don't queue resize; the caption isn't part of what affects layout and sizing of the client area (it'll be ellipsized if too long) // don't queue resize; the caption isn't part of what affects layout and sizing of the client area (it'll be ellipsized if too long)
} }
void uiWindowOnClosing(uiWindow *ww, int (*f)(uiWindow *, void *), void *data) void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *, void *), void *data)
{ {
w->onClosing = f; w->onClosing = f;
w->onClosingData = data; w->onClosingData = data;
@ -169,11 +169,11 @@ void uiWindowSetMargined(uiWindow *w, int margined)
// from https://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing // from https://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing
#define windowMargin 7 #define windowMargin 7
static void windowResizeChild(uiWindow *ww) /* TODO
static void windowResizeChild(uiWindow *w)
{ {
struct window *w = (struct window *) ww;
RECT r; RECT r;
uiSizing *d; uiWindowsSizing *d;
if (w->child == NULL) if (w->child == NULL)
return; return;
@ -189,6 +189,7 @@ static void windowResizeChild(uiWindow *ww)
uiControlResize(w->child, r.left, r.top, r.right - r.left, r.bottom - r.top, d); uiControlResize(w->child, r.left, r.top, r.right - r.left, r.bottom - r.top, d);
uiFreeSizing(d); uiFreeSizing(d);
} }
*/
// see http://blogs.msdn.com/b/oldnewthing/archive/2003/09/11/54885.aspx and http://blogs.msdn.com/b/oldnewthing/archive/2003/09/13/54917.aspx // see http://blogs.msdn.com/b/oldnewthing/archive/2003/09/11/54885.aspx and http://blogs.msdn.com/b/oldnewthing/archive/2003/09/13/54917.aspx
static void setClientSize(uiWindow *w, int width, int height, BOOL hasMenubar, DWORD style, DWORD exstyle) static void setClientSize(uiWindow *w, int width, int height, BOOL hasMenubar, DWORD style, DWORD exstyle)