More compiler issue fixing.
This commit is contained in:
parent
7e11274e3a
commit
099d15b638
|
@ -109,6 +109,9 @@ struct uiWindowsSizing {
|
|||
HWND CoordFrom;
|
||||
HWND CoordTo;
|
||||
};
|
||||
// Use these to create and destroy uiWindowsSizings.
|
||||
_UI_EXTERN uiWindowsSizing *uiWindowsNewSizing(HWND hwnd);
|
||||
_UI_EXTERN void uiWindowsFreeSizing(uiWindowsSizing *d);
|
||||
// Use these in your preferredSize() implementation with baseX and baseY.
|
||||
#define uiWindowsDlgUnitsToX(dlg, baseX) MulDiv((dlg), baseX, 4)
|
||||
#define uiWindowsDlgUnitsToY(dlg, baseY) MulDiv((dlg), baseY, 8)
|
||||
|
|
|
@ -108,7 +108,7 @@ static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width
|
|||
*/
|
||||
}
|
||||
|
||||
static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiWindowsSizing *d)
|
||||
static void boxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
|
||||
{
|
||||
/* TODO
|
||||
uibox *b = uiBox(c);
|
||||
|
@ -228,13 +228,13 @@ static void boxContainerUpdateState(uiControl *c)
|
|||
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
||||
{
|
||||
struct child *bc;
|
||||
/* TODO
|
||||
uintptr_t zorder;
|
||||
int dozorder;
|
||||
uintmax_t i;
|
||||
|
||||
// start the zorder with the *CURRENT* first child
|
||||
// this is in case we're adding a new first child
|
||||
/* TODO
|
||||
dozorder = 0;
|
||||
if (b->controls->len != 0) {
|
||||
dozorder = 1;
|
||||
|
@ -246,7 +246,7 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
|||
bc = newChild(c, uiControl(b), b->hwnd);
|
||||
ctrlSetStretchy(bc, stretchy);
|
||||
ptrArrayAppend(b->controls, bc);
|
||||
uiControlQueueResize(uiControl(b));
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(b));
|
||||
|
||||
/* TODO
|
||||
// and now update the zorder for all controls
|
||||
|
@ -265,7 +265,7 @@ void uiBoxDelete(uiBox *b, uintmax_t index)
|
|||
bc = ptrArrayIndex(b->controls, struct child *, index);
|
||||
ptrArrayDelete(b->controls, index);
|
||||
childRemove(bc);
|
||||
uiControlQueueResize(uiControl(b));
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(b));
|
||||
}
|
||||
|
||||
int uiBoxPadded(uiBox *b)
|
||||
|
@ -276,7 +276,7 @@ int uiBoxPadded(uiBox *b)
|
|||
void uiBoxSetPadded(uiBox *b, int padded)
|
||||
{
|
||||
b->padded = padded;
|
||||
uiControlQueueResize(uiControl(b));
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(b));
|
||||
}
|
||||
|
||||
static uiBox *finishNewBox(int vertical)
|
||||
|
@ -291,7 +291,8 @@ static uiBox *finishNewBox(int vertical)
|
|||
b->controls = newPtrArray();
|
||||
|
||||
uiWindowsFinishNewControl(b, uiBox);
|
||||
// TODO
|
||||
uiControl(b)->ContainerUpdateState = boxContainerUpdateState;
|
||||
uiWindowsControl(b)->Relayout = boxRelayout;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ void uiButtonSetText(uiButton *b, const char *text)
|
|||
{
|
||||
uiWindowsUtilSetText(b->hwnd, text);
|
||||
// changing the text might necessitate a change in the button's size
|
||||
uiControlQueueResize(uiControl(b));
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(b));
|
||||
}
|
||||
|
||||
void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *, void *), void *data)
|
||||
|
|
|
@ -60,7 +60,7 @@ void uiCheckboxSetText(uiCheckbox *c, const char *text)
|
|||
{
|
||||
uiWindowsUtilSetText(c->hwnd, text);
|
||||
// changing the text might necessitate a change in the checkbox's size
|
||||
uiControlQueueResize(uiControl(c));
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(c));
|
||||
}
|
||||
|
||||
void uiCheckboxOnToggled(uiCheckbox *c, void (*f)(uiCheckbox *, void *), void *data)
|
||||
|
|
|
@ -107,6 +107,11 @@ void childRelayout(struct child *c, intmax_t x, intmax_t y, intmax_t width, intm
|
|||
(*(wc->Relayout))(wc, x, y, width, height);
|
||||
}
|
||||
|
||||
void childQueueRelayout(struct child *c)
|
||||
{
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(c->c));
|
||||
}
|
||||
|
||||
void childUpdateState(struct child *c)
|
||||
{
|
||||
controlUpdateState(c->c);
|
||||
|
@ -125,7 +130,7 @@ int childMargined(struct child *c)
|
|||
void childSetMargined(struct child *c, int margined)
|
||||
{
|
||||
c->margined = margined;
|
||||
uiControlQueueResize(c->c);
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(c->c));
|
||||
}
|
||||
|
||||
int childFlag(struct child *c)
|
||||
|
|
|
@ -92,7 +92,7 @@ uiEntry *uiNewEntry(void)
|
|||
TRUE);
|
||||
|
||||
uiWindowsRegisterWM_COMMANDHandler(e->hwnd, onWM_COMMAND, uiControl(e));
|
||||
uiEntrySetOnChanged(e, defaultOnChanged, NULL);
|
||||
uiEntryOnChanged(e, defaultOnChanged, NULL);
|
||||
|
||||
uiWindowsFinishNewControl(e, uiEntry);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ static void groupRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t
|
|||
if (g->child == NULL)
|
||||
return;
|
||||
|
||||
d = uiWindowsGetSizing(g->hwnd);
|
||||
d = uiWindowsNewSizing(g->hwnd);
|
||||
if (g->margined) {
|
||||
x += uiWindowsDlgUnitsToX(groupXMargin, d->BaseX);
|
||||
y += uiWindowsDlgUnitsToY(groupYMarginTop, d->BaseY);
|
||||
|
@ -94,7 +94,7 @@ void uiGroupSetTitle(uiGroup *g, const char *text)
|
|||
{
|
||||
uiWindowsUtilSetText(g->hwnd, text);
|
||||
// changing the text might necessitate a change in the groupbox's size
|
||||
uiControlQueueResize(uiControl(g));
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(g));
|
||||
}
|
||||
|
||||
void uiGroupSetChild(uiGroup *g, uiControl *child)
|
||||
|
@ -103,7 +103,7 @@ void uiGroupSetChild(uiGroup *g, uiControl *child)
|
|||
childRemove(g->child);
|
||||
g->child = newChild(child, uiControl(g), g->hwnd);
|
||||
if (g->child != NULL)
|
||||
uiControlQueueResize(g->child);
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(g));
|
||||
}
|
||||
|
||||
int uiGroupMargined(uiGroup *g)
|
||||
|
@ -114,7 +114,7 @@ int uiGroupMargined(uiGroup *g)
|
|||
void uiGroupSetMargined(uiGroup *g, int margined)
|
||||
{
|
||||
g->margined = margined;
|
||||
uiControlQueueResize(uiControl(g));
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(g));
|
||||
}
|
||||
|
||||
uiGroup *uiNewGroup(const char *text)
|
||||
|
|
|
@ -31,7 +31,7 @@ void uiLabelSetText(uiLabel *l, const char *text)
|
|||
{
|
||||
uiWindowsUtilSetText(l->hwnd, text);
|
||||
// changing the text might necessitate a change in the label's size
|
||||
uiControlQueueResize(uiControl(l));
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(l));
|
||||
}
|
||||
|
||||
uiLabel *uiNewLabel(const char *text)
|
||||
|
|
|
@ -283,7 +283,6 @@ void runMenuEvent(WORD id, uiWindow *w)
|
|||
uiMenu *m;
|
||||
uiMenuItem *item;
|
||||
uintmax_t i, j;
|
||||
uiMenuItem *umi;
|
||||
|
||||
// this isn't optimal, but it works, and it should be just fine for most cases
|
||||
for (i = 0; i < len; i++) {
|
||||
|
|
|
@ -126,7 +126,7 @@ static void recreateUpDown(uiSpinbox *s)
|
|||
*/
|
||||
}
|
||||
|
||||
static void spinboxRelayout(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
|
||||
static void spinboxRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
|
||||
{
|
||||
/* TODO
|
||||
uiSpinbox *s = uiSpinbox(c);
|
||||
|
@ -210,6 +210,7 @@ uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
|
|||
s->inhibitChanged = FALSE;
|
||||
|
||||
uiWindowsFinishNewControl(s, uiSpinbox);
|
||||
uiWindowsControl(s)->Relayout = spinboxRelayout;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ static void showHidePage(uiTab *t, LRESULT which, int hide)
|
|||
else {
|
||||
ShowWindow(childTabPage(page), SW_SHOW);
|
||||
// we only resize the current page, so we have to do this here
|
||||
uiControlQueueResize(page);
|
||||
childQueueRelayout(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ static void onDestroy(uiTab *t)
|
|||
struct child *page;
|
||||
|
||||
while (t->pages->len != 0) {
|
||||
page = ptrArrayIndex(t->pages, uiControl *, 0);
|
||||
page = ptrArrayIndex(t->pages, struct child *, 0);
|
||||
ptrArrayDelete(t->pages, 0);
|
||||
childDestroy(page);
|
||||
}
|
||||
|
@ -83,8 +83,8 @@ static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width
|
|||
maxwid = 0;
|
||||
maxht = 0;
|
||||
for (i = 0; i < t->pages->len; i++) {
|
||||
page = ptrArrayIndex(t->pages, uiControl *, i);
|
||||
uiControlPreferredSize(page, d, &pagewid, &pageht);
|
||||
page = ptrArrayIndex(t->pages, struct child *, i);
|
||||
childMinimumSize(page, d, &pagewid, &pageht);
|
||||
if (maxwid < pagewid)
|
||||
maxwid = pagewid;
|
||||
if (maxht < pageht)
|
||||
|
@ -102,7 +102,7 @@ static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width
|
|||
*/
|
||||
}
|
||||
|
||||
static void tabRelayout(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
|
||||
static void tabRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
|
||||
{
|
||||
/* TODO
|
||||
uiTab *t = uiTab(c);
|
||||
|
@ -115,7 +115,7 @@ static void tabRelayout(uiControl *c, intmax_t x, intmax_t y, intmax_t width, in
|
|||
n = curpage(t);
|
||||
if (n == (LRESULT) (-1))
|
||||
return;
|
||||
page = ptrArrayIndex(t->pages, uiControl *, n);
|
||||
page = ptrArrayIndex(t->pages, struct child *, n);
|
||||
|
||||
dchild = uiControlSizing(uiControl(t));
|
||||
|
||||
|
@ -142,7 +142,7 @@ static void tabContainerUpdateState(uiControl *c)
|
|||
uintmax_t i;
|
||||
|
||||
for (i = 0; i < t->pages->len; i++) {
|
||||
page = ptrArrayIndex(t->pages, uiControl *, i);
|
||||
page = ptrArrayIndex(t->pages, struct child *, i);
|
||||
childUpdateState(page);
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ void uiTabDelete(uiTab *t, uintmax_t n)
|
|||
logLastError("error deleting uiTab tab in tabDelete()");
|
||||
|
||||
// now delete the page itself
|
||||
page = ptrArrayIndex(t->pages, uiControl *, n);
|
||||
page = ptrArrayIndex(t->pages, struct child *, n);
|
||||
ptrArrayDelete(t->pages, n);
|
||||
childRemove(page);
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ int uiTabMargined(uiTab *t, uintmax_t n)
|
|||
{
|
||||
struct child *page;
|
||||
|
||||
page = ptrArrayIndex(t->pages, uiControl *, n);
|
||||
page = ptrArrayIndex(t->pages, struct child *, n);
|
||||
return childMargined(page);
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ void uiTabSetMargined(uiTab *t, uintmax_t n, int margined)
|
|||
{
|
||||
struct child *page;
|
||||
|
||||
page = ptrArrayIndex(t->pages, uiControl *, n);
|
||||
page = ptrArrayIndex(t->pages, struct child *, n);
|
||||
childSetMargined(page, margined);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ extern void childDestroy(struct child *c);
|
|||
extern HWND childHWND(struct child *c);
|
||||
extern void childMinimumSize(struct child *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height);
|
||||
extern void childRelayout(struct child *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height);
|
||||
extern void childQueueRelayout(struct child *c);
|
||||
extern void childUpdateState(struct child *c);
|
||||
extern HWND childTabPage(struct child *c);
|
||||
extern int childMargined(struct child *c);
|
||||
|
|
|
@ -51,7 +51,7 @@ static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
|
|||
if ((wp->flags & SWP_NOSIZE) != 0)
|
||||
break;
|
||||
if (w->child != NULL)
|
||||
uiControlQueueResize(uiControl(w));
|
||||
childQueueRelayout(w->child);
|
||||
return 0;
|
||||
case WM_PRINTCLIENT:
|
||||
// we do no special painting; just erase the background
|
||||
|
@ -115,7 +115,7 @@ static void windowCommitShow(uiControl *c)
|
|||
}
|
||||
w->shownOnce = TRUE;
|
||||
// make sure the child is the correct size
|
||||
uiControlQueueResize(uiControl(w));
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(w));
|
||||
ShowWindow(w->hwnd, nCmdShow);
|
||||
if (UpdateWindow(w->hwnd) == 0)
|
||||
logLastError("error calling UpdateWindow() after showing uiWindow for the first time in windowShow()");
|
||||
|
@ -126,7 +126,12 @@ static void windowContainerUpdateState(uiControl *c)
|
|||
uiWindow *w = uiWindow(c);
|
||||
|
||||
if (w->child != NULL)
|
||||
childContainerUpdateState(w->child);
|
||||
childUpdateState(w->child);
|
||||
}
|
||||
|
||||
static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
char *uiWindowTitle(uiWindow *w)
|
||||
|
@ -152,7 +157,7 @@ void uiWindowSetChild(uiWindow *w, uiControl *child)
|
|||
childRemove(w->child);
|
||||
w->child = newChild(child, uiControl(w), w->hwnd);
|
||||
if (w->child != NULL)
|
||||
uiControlQueueResize(w->child);
|
||||
childQueueRelayout(w->child);
|
||||
}
|
||||
|
||||
int uiWindowMargined(uiWindow *w)
|
||||
|
@ -163,7 +168,7 @@ int uiWindowMargined(uiWindow *w)
|
|||
void uiWindowSetMargined(uiWindow *w, int margined)
|
||||
{
|
||||
w->margined = margined;
|
||||
uiControlQueueResize(uiControl(w));
|
||||
uiWindowsControlQueueRelayout(uiWindowsControl(w));
|
||||
}
|
||||
|
||||
// from https://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing
|
||||
|
@ -254,7 +259,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
|||
// and use the proper size
|
||||
setClientSize(w, width, height, hasMenubarBOOL, style, exstyle);
|
||||
|
||||
uiWindowSetOnClosing(w, defaultOnClosing, NULL);
|
||||
uiWindowOnClosing(w, defaultOnClosing, NULL);
|
||||
|
||||
uiWindowsFinishNewControl(w, uiWindow);
|
||||
uiControl(w)->CommitShow = windowCommitShow;
|
||||
|
|
Loading…
Reference in New Issue