diff --git a/ui_darwin.h b/ui_darwin.h index 0fa407d7..62cbb524 100644 --- a/ui_darwin.h +++ b/ui_darwin.h @@ -13,7 +13,7 @@ This file assumes that you have imported and "ui.h" beforehand. // The two onDestroy parameters define a function and its parameter to call when the widget is destroyed. extern void uiDarwinMakeControl(uiControl *c, Class class, BOOL inScrollView, BOOL scrollViewHasBorder, void (*onDestroy)(void *), void *onDestroyData); -// You can use this function from within your control implementations to return text strings that can be freed with uiTextFree(). +// You can use this function from within your control implementations to return text strings that can be freed with uiFreeText(). extern char *uiDarwinNSStringToText(NSString *); struct uiSizingSys { diff --git a/ui_windows.h b/ui_windows.h index b7f12c6c..5e93594e 100644 --- a/ui_windows.h +++ b/ui_windows.h @@ -43,8 +43,8 @@ struct uiSizingSys { LONG internalLeading; }; // Use these in your preferredSize() implementation with baseX and baseY. -#define uiDlgUnitsToX(dlg, baseX) MulDiv((dlg), baseX, 4) -#define uiDlgUnitsToY(dlg, baseY) MulDiv((dlg), baseY, 8) +#define uiWindowsDlgUnitsToX(dlg, baseX) MulDiv((dlg), baseX, 4) +#define uiWindowsDlgUnitsToY(dlg, baseY) MulDiv((dlg), baseY, 8) // and use this if you need the text of the window width extern intmax_t uiWindowsWindowTextWidth(HWND hwnd); diff --git a/windows/bin.c b/windows/bin.c index 359d0ab5..9023fb34 100644 --- a/windows/bin.c +++ b/windows/bin.c @@ -41,8 +41,8 @@ static void binPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_ return; } uiControlPreferredSize(b->mainControl, d, width, height); - marginX = uiDlgUnitsToX(b->marginLeft, d->sys->baseX) + uiDlgUnitsToX(b->marginRight, d->sys->baseX); - marginY = uiDlgUnitsToY(b->marginTop, d->sys->baseY) + uiDlgUnitsToY(b->marginBottom, d->sys->baseY); + marginX = uiWindowsDlgUnitsToX(b->marginLeft, d->sys->baseX) + uiWindowsDlgUnitsToX(b->marginRight, d->sys->baseX); + marginY = uiWindowsDlgUnitsToY(b->marginTop, d->sys->baseY) + uiWindowsDlgUnitsToY(b->marginBottom, d->sys->baseY); *width += marginX; *height += marginY; } @@ -62,12 +62,12 @@ static void binResizeChildren(uiContainer *c, intmax_t x, intmax_t y, intmax_t w if (b->mainControl == NULL) return; - marginLeft = uiDlgUnitsToX(b->marginLeft, d->sys->baseX); - marginTop = uiDlgUnitsToY(b->marginTop, d->sys->baseY); + marginLeft = uiWindowsDlgUnitsToX(b->marginLeft, d->sys->baseX); + marginTop = uiWindowsDlgUnitsToY(b->marginTop, d->sys->baseY); x += marginLeft; y += marginTop; - width -= marginLeft + uiDlgUnitsToX(b->marginRight, d->sys->baseX); - height -= marginTop + uiDlgUnitsToY(b->marginBottom, d->sys->baseY); + width -= marginLeft + uiWindowsDlgUnitsToX(b->marginRight, d->sys->baseX); + height -= marginTop + uiWindowsDlgUnitsToY(b->marginBottom, d->sys->baseY); uiControlResize(b->mainControl, x, y, width, height, d); } diff --git a/windows/button.c b/windows/button.c index 01202966..a7270170 100644 --- a/windows/button.c +++ b/windows/button.c @@ -52,7 +52,7 @@ static void buttonPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intm // Microsoft says to use a fixed width for all buttons; this isn't good enough // use the text width instead, with some edge padding *width = uiWindowsWindowTextWidth(b->hwnd) + (2 * GetSystemMetrics(SM_CXEDGE)); - *height = uiDlgUnitsToY(buttonHeight, d->sys->baseY); + *height = uiWindowsDlgUnitsToY(buttonHeight, d->sys->baseY); } static void defaultOnClicked(uiButton *b, void *data) diff --git a/windows/checkbox.c b/windows/checkbox.c index af57736b..d5e74ee3 100644 --- a/windows/checkbox.c +++ b/windows/checkbox.c @@ -48,8 +48,8 @@ static void checkboxPreferredSize(uiControl *cc, uiSizing *d, intmax_t *width, i { struct checkbox *c = (struct checkbox *) cc; - *width = uiDlgUnitsToX(checkboxXFromLeftOfBoxToLeftOfLabel, d->sys->baseX) + uiWindowsWindowTextWidth(c->hwnd); - *height = uiDlgUnitsToY(checkboxHeight, d->sys->baseY); + *width = uiWindowsDlgUnitsToX(checkboxXFromLeftOfBoxToLeftOfLabel, d->sys->baseX) + uiWindowsWindowTextWidth(c->hwnd); + *height = uiWindowsDlgUnitsToY(checkboxHeight, d->sys->baseY); } static void defaultOnToggled(uiCheckbox *c, void *data) diff --git a/windows/container.c b/windows/container.c index ae158886..e2106656 100644 --- a/windows/container.c +++ b/windows/container.c @@ -147,8 +147,8 @@ static HRESULT resize(uiContainer *cc, RECT *r) if (ReleaseDC(c->hwnd, dc) == 0) return logLastError("error releasing DC in resize()"); - d.xPadding = uiDlgUnitsToX(winXPadding, sys.baseX); - d.yPadding = uiDlgUnitsToY(winYPadding, sys.baseY); + d.xPadding = uiWindowsDlgUnitsToX(winXPadding, sys.baseX); + d.yPadding = uiWindowsDlgUnitsToY(winYPadding, sys.baseY); d.sys = &sys; uiContainerResizeChildren(cc, r->left, r->top, r->right - r->left, r->bottom - r->top, &d); return S_OK; diff --git a/windows/entry.c b/windows/entry.c index 422686ef..d351d391 100644 --- a/windows/entry.c +++ b/windows/entry.c @@ -37,8 +37,8 @@ static void onDestroy(void *data) static void entryPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) { - *width = uiDlgUnitsToX(entryWidth, d->sys->baseX); - *height = uiDlgUnitsToY(entryHeight, d->sys->baseY); + *width = uiWindowsDlgUnitsToX(entryWidth, d->sys->baseX); + *height = uiWindowsDlgUnitsToY(entryHeight, d->sys->baseY); } static void defaultOnChanged(uiEntry *e, void *data) diff --git a/windows/label.c b/windows/label.c index 4d811104..aada0228 100644 --- a/windows/label.c +++ b/windows/label.c @@ -31,7 +31,7 @@ static void labelPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intma struct label *l = (struct label *) c; *width = uiWindowsWindowTextWidth(l->hwnd); - *height = uiDlgUnitsToY(labelHeight, d->sys->baseY); + *height = uiWindowsDlgUnitsToY(labelHeight, d->sys->baseY); } static char *labelText(uiLabel *l) diff --git a/windows/tab.c b/windows/tab.c index bfafdff2..51f7cead 100644 --- a/windows/tab.c +++ b/windows/tab.c @@ -43,7 +43,7 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult) // and we're changing to a real page uiControlShow(uiControl(page->bin)); // because we only resize the current child on resize, we'll need to trigger an update here - // don't call uiParentUpdate(); doing that won't size the content area (so we'll still have a 0x0 content area, for instance) + // don't call uiContainerUpdate(); doing that won't size the content area (so we'll still have a 0x0 content area, for instance) SendMessageW(t->hwnd, msgUpdateChild, 0, 0); *lResult = 0; return TRUE; diff --git a/windows/window.c b/windows/window.c index bfbe0e77..c6459ee8 100644 --- a/windows/window.c +++ b/windows/window.c @@ -45,7 +45,7 @@ static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA // fall through case msgUpdateChild: if (GetClientRect(w->hwnd, &r) == 0) - logLastError("error getting window client rect for resize in uiWindowWndProc()"); + logLastError("error getting window client rect for resize in windowWndProc()"); binhwnd = (HWND) uiControlHandle(uiControl(w->bin)); if (MoveWindow(binhwnd, r.left, r.top, r.right - r.left, r.bottom - r.top, TRUE) == 0) logLastError("error resizing uiWindow box in windowWndProc()");