DlgUnit -> DlgUnits
This commit is contained in:
parent
e5e0f115f7
commit
d4271c8ceb
|
@ -52,7 +52,7 @@ static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *
|
|||
// 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(hwnd) + (2 * GetSystemMetrics(SM_CXEDGE));
|
||||
*height = uiDlgUnitToY(buttonHeight, d->sys->baseY);
|
||||
*height = uiDlgUnitsToY(buttonHeight, d->sys->baseY);
|
||||
}
|
||||
|
||||
static void defaultOnClicked(uiControl *c, void *data)
|
||||
|
|
|
@ -46,8 +46,8 @@ static void onWM_DESTROY(uiControl *c)
|
|||
|
||||
static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
|
||||
{
|
||||
*width = uiDlgUnitToX(checkboxXFromLeftOfBoxToLeftOfLabel, d->sys->baseX) + uiWindowsWindowTextWidth((HWND) uiControlHandle(c));
|
||||
*height = uiDlgUnitToY(checkboxHeight, d->sys->baseY);
|
||||
*width = uiDlgUnitsToX(checkboxXFromLeftOfBoxToLeftOfLabel, d->sys->baseX) + uiWindowsWindowTextWidth((HWND) uiControlHandle(c));
|
||||
*height = uiDlgUnitsToY(checkboxHeight, d->sys->baseY);
|
||||
}
|
||||
|
||||
static void defaultOnToggled(uiControl *c, void *data)
|
||||
|
|
|
@ -88,12 +88,12 @@ void resize(uiControl *control, HWND parent, RECT r, RECT margin)
|
|||
logLastError("error restoring previous font into device context in resize()");
|
||||
if (ReleaseDC(parent, dc) == 0)
|
||||
logLastError("error releasing DC in resize()");
|
||||
r.left += uiDlgUnitToX(margin.left, sys.baseX);
|
||||
r.top += uiDlgUnitToY(margin.top, sys.baseY);
|
||||
r.right -= uiDlgUnitToX(margin.right, sys.baseX);
|
||||
r.bottom -= uiDlgUnitToY(margin.bottom, sys.baseY);
|
||||
d.xPadding = uiDlgUnitToX(winXPadding, sys.baseX);
|
||||
d.yPadding = uiDlgUnitToY(winYPadding, sys.baseY);
|
||||
r.left += uiDlgUnitsToX(margin.left, sys.baseX);
|
||||
r.top += uiDlgUnitsToY(margin.top, sys.baseY);
|
||||
r.right -= uiDlgUnitsToX(margin.right, sys.baseX);
|
||||
r.bottom -= uiDlgUnitsToY(margin.bottom, sys.baseY);
|
||||
d.xPadding = uiDlgUnitsToX(winXPadding, sys.baseX);
|
||||
d.yPadding = uiDlgUnitsToY(winYPadding, sys.baseY);
|
||||
d.sys = &sys;
|
||||
uiControlResize(control, r.left, r.top, r.right - r.left, r.bottom - r.top, &d);
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ static void onWM_DESTROY(uiControl *c)
|
|||
|
||||
static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
|
||||
{
|
||||
*width = uiDlgUnitToX(entryWidth, d->sys->baseX);
|
||||
*height = uiDlgUnitToY(entryHeight, d->sys->baseY);
|
||||
*width = uiDlgUnitsToX(entryWidth, d->sys->baseX);
|
||||
*height = uiDlgUnitsToY(entryHeight, d->sys->baseY);
|
||||
}
|
||||
|
||||
uiControl *uiNewEntry(void)
|
||||
|
|
|
@ -39,9 +39,8 @@ struct uiSizingSys {
|
|||
LONG internalLeading;
|
||||
};
|
||||
// Use these in your preferredSize() implementation with baseX and baseY.
|
||||
// TODO rename to DlgUnits?
|
||||
#define uiDlgUnitToX(dlg, baseX) MulDiv((dlg), baseX, 4)
|
||||
#define uiDlgUnitToY(dlg, baseY) MulDiv((dlg), baseY, 8)
|
||||
#define uiDlgUnitsToX(dlg, baseX) MulDiv((dlg), baseX, 4)
|
||||
#define uiDlgUnitsToY(dlg, baseY) MulDiv((dlg), baseY, 8)
|
||||
|
||||
// and use this if you need the text of the window width
|
||||
// TODO really export?
|
||||
|
|
Loading…
Reference in New Issue