Fixed public/private namespace clobbering in the Windows backend and a wrong name in ui_darwin.h.
This commit is contained in:
parent
91f7096257
commit
38a5341603
|
@ -13,7 +13,7 @@ This file assumes that you have imported <Cocoa/Cocoa.h> and "ui.h" beforehand.
|
||||||
// The two onDestroy parameters define a function and its parameter to call when the widget is destroyed.
|
// 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);
|
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 *);
|
extern char *uiDarwinNSStringToText(NSString *);
|
||||||
|
|
||||||
struct uiSizingSys {
|
struct uiSizingSys {
|
||||||
|
|
|
@ -43,8 +43,8 @@ struct uiSizingSys {
|
||||||
LONG internalLeading;
|
LONG internalLeading;
|
||||||
};
|
};
|
||||||
// Use these in your preferredSize() implementation with baseX and baseY.
|
// Use these in your preferredSize() implementation with baseX and baseY.
|
||||||
#define uiDlgUnitsToX(dlg, baseX) MulDiv((dlg), baseX, 4)
|
#define uiWindowsDlgUnitsToX(dlg, baseX) MulDiv((dlg), baseX, 4)
|
||||||
#define uiDlgUnitsToY(dlg, baseY) MulDiv((dlg), baseY, 8)
|
#define uiWindowsDlgUnitsToY(dlg, baseY) MulDiv((dlg), baseY, 8)
|
||||||
|
|
||||||
// and use this if you need the text of the window width
|
// and use this if you need the text of the window width
|
||||||
extern intmax_t uiWindowsWindowTextWidth(HWND hwnd);
|
extern intmax_t uiWindowsWindowTextWidth(HWND hwnd);
|
||||||
|
|
|
@ -41,8 +41,8 @@ static void binPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uiControlPreferredSize(b->mainControl, d, width, height);
|
uiControlPreferredSize(b->mainControl, d, width, height);
|
||||||
marginX = uiDlgUnitsToX(b->marginLeft, d->sys->baseX) + uiDlgUnitsToX(b->marginRight, d->sys->baseX);
|
marginX = uiWindowsDlgUnitsToX(b->marginLeft, d->sys->baseX) + uiWindowsDlgUnitsToX(b->marginRight, d->sys->baseX);
|
||||||
marginY = uiDlgUnitsToY(b->marginTop, d->sys->baseY) + uiDlgUnitsToY(b->marginBottom, d->sys->baseY);
|
marginY = uiWindowsDlgUnitsToY(b->marginTop, d->sys->baseY) + uiWindowsDlgUnitsToY(b->marginBottom, d->sys->baseY);
|
||||||
*width += marginX;
|
*width += marginX;
|
||||||
*height += marginY;
|
*height += marginY;
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,12 @@ static void binResizeChildren(uiContainer *c, intmax_t x, intmax_t y, intmax_t w
|
||||||
|
|
||||||
if (b->mainControl == NULL)
|
if (b->mainControl == NULL)
|
||||||
return;
|
return;
|
||||||
marginLeft = uiDlgUnitsToX(b->marginLeft, d->sys->baseX);
|
marginLeft = uiWindowsDlgUnitsToX(b->marginLeft, d->sys->baseX);
|
||||||
marginTop = uiDlgUnitsToY(b->marginTop, d->sys->baseY);
|
marginTop = uiWindowsDlgUnitsToY(b->marginTop, d->sys->baseY);
|
||||||
x += marginLeft;
|
x += marginLeft;
|
||||||
y += marginTop;
|
y += marginTop;
|
||||||
width -= marginLeft + uiDlgUnitsToX(b->marginRight, d->sys->baseX);
|
width -= marginLeft + uiWindowsDlgUnitsToX(b->marginRight, d->sys->baseX);
|
||||||
height -= marginTop + uiDlgUnitsToY(b->marginBottom, d->sys->baseY);
|
height -= marginTop + uiWindowsDlgUnitsToY(b->marginBottom, d->sys->baseY);
|
||||||
uiControlResize(b->mainControl, x, y, width, height, d);
|
uiControlResize(b->mainControl, x, y, width, height, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
// Microsoft says to use a fixed width for all buttons; this isn't good enough
|
||||||
// use the text width instead, with some edge padding
|
// use the text width instead, with some edge padding
|
||||||
*width = uiWindowsWindowTextWidth(b->hwnd) + (2 * GetSystemMetrics(SM_CXEDGE));
|
*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)
|
static void defaultOnClicked(uiButton *b, void *data)
|
||||||
|
|
|
@ -48,8 +48,8 @@ static void checkboxPreferredSize(uiControl *cc, uiSizing *d, intmax_t *width, i
|
||||||
{
|
{
|
||||||
struct checkbox *c = (struct checkbox *) cc;
|
struct checkbox *c = (struct checkbox *) cc;
|
||||||
|
|
||||||
*width = uiDlgUnitsToX(checkboxXFromLeftOfBoxToLeftOfLabel, d->sys->baseX) + uiWindowsWindowTextWidth(c->hwnd);
|
*width = uiWindowsDlgUnitsToX(checkboxXFromLeftOfBoxToLeftOfLabel, d->sys->baseX) + uiWindowsWindowTextWidth(c->hwnd);
|
||||||
*height = uiDlgUnitsToY(checkboxHeight, d->sys->baseY);
|
*height = uiWindowsDlgUnitsToY(checkboxHeight, d->sys->baseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void defaultOnToggled(uiCheckbox *c, void *data)
|
static void defaultOnToggled(uiCheckbox *c, void *data)
|
||||||
|
|
|
@ -147,8 +147,8 @@ static HRESULT resize(uiContainer *cc, RECT *r)
|
||||||
if (ReleaseDC(c->hwnd, dc) == 0)
|
if (ReleaseDC(c->hwnd, dc) == 0)
|
||||||
return logLastError("error releasing DC in resize()");
|
return logLastError("error releasing DC in resize()");
|
||||||
|
|
||||||
d.xPadding = uiDlgUnitsToX(winXPadding, sys.baseX);
|
d.xPadding = uiWindowsDlgUnitsToX(winXPadding, sys.baseX);
|
||||||
d.yPadding = uiDlgUnitsToY(winYPadding, sys.baseY);
|
d.yPadding = uiWindowsDlgUnitsToY(winYPadding, sys.baseY);
|
||||||
d.sys = &sys;
|
d.sys = &sys;
|
||||||
uiContainerResizeChildren(cc, r->left, r->top, r->right - r->left, r->bottom - r->top, &d);
|
uiContainerResizeChildren(cc, r->left, r->top, r->right - r->left, r->bottom - r->top, &d);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -37,8 +37,8 @@ static void onDestroy(void *data)
|
||||||
|
|
||||||
static void entryPreferredSize(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 = uiWindowsDlgUnitsToX(entryWidth, d->sys->baseX);
|
||||||
*height = uiDlgUnitsToY(entryHeight, d->sys->baseY);
|
*height = uiWindowsDlgUnitsToY(entryHeight, d->sys->baseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void defaultOnChanged(uiEntry *e, void *data)
|
static void defaultOnChanged(uiEntry *e, void *data)
|
||||||
|
|
|
@ -31,7 +31,7 @@ static void labelPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intma
|
||||||
struct label *l = (struct label *) c;
|
struct label *l = (struct label *) c;
|
||||||
|
|
||||||
*width = uiWindowsWindowTextWidth(l->hwnd);
|
*width = uiWindowsWindowTextWidth(l->hwnd);
|
||||||
*height = uiDlgUnitsToY(labelHeight, d->sys->baseY);
|
*height = uiWindowsDlgUnitsToY(labelHeight, d->sys->baseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *labelText(uiLabel *l)
|
static char *labelText(uiLabel *l)
|
||||||
|
|
|
@ -43,7 +43,7 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult)
|
||||||
// and we're changing to a real page
|
// and we're changing to a real page
|
||||||
uiControlShow(uiControl(page->bin));
|
uiControlShow(uiControl(page->bin));
|
||||||
// because we only resize the current child on resize, we'll need to trigger an update here
|
// 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);
|
SendMessageW(t->hwnd, msgUpdateChild, 0, 0);
|
||||||
*lResult = 0;
|
*lResult = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -45,7 +45,7 @@ static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
|
||||||
// fall through
|
// fall through
|
||||||
case msgUpdateChild:
|
case msgUpdateChild:
|
||||||
if (GetClientRect(w->hwnd, &r) == 0)
|
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));
|
binhwnd = (HWND) uiControlHandle(uiControl(w->bin));
|
||||||
if (MoveWindow(binhwnd, r.left, r.top, r.right - r.left, r.bottom - r.top, TRUE) == 0)
|
if (MoveWindow(binhwnd, r.left, r.top, r.right - r.left, r.bottom - r.top, TRUE) == 0)
|
||||||
logLastError("error resizing uiWindow box in windowWndProc()");
|
logLastError("error resizing uiWindow box in windowWndProc()");
|
||||||
|
|
Loading…
Reference in New Issue