More uiGroup Windows work.
This commit is contained in:
parent
4f267d49c6
commit
9cca703b06
|
@ -27,14 +27,25 @@ static void onDestroy(void *data)
|
||||||
uiFree(g);
|
uiFree(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO get source
|
||||||
|
#define groupXMargin 6
|
||||||
|
#define groupYMarginTop 11 /* note this value /includes the groupbox label */
|
||||||
|
#define groupYMarginBottom 7
|
||||||
|
|
||||||
|
// unfortunately because the client area of a groupbox includes the frame and caption text, we have to apply some margins ourselves, even if we don't want "any"
|
||||||
|
// these were deduced by hand based on the standard DLU conversions; the X and Y top margins are the width and height, respectively, of one character cell
|
||||||
|
// they can be fine-tuned later
|
||||||
|
#define groupUnmarginedXMargin 4
|
||||||
|
#define groupUnmarginedYMarginTop 8
|
||||||
|
#define groupUnmarginedYMarginBottom 3
|
||||||
|
|
||||||
static void groupPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
|
static void groupPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
|
||||||
{
|
{
|
||||||
struct group *g = (struct group *) c;
|
struct group *g = (struct group *) c;
|
||||||
|
|
||||||
uiControlPreferredSize(uiControl(g->bin), d, width, height);
|
uiControlPreferredSize(uiControl(g->bin), d, width, height);
|
||||||
// TODO
|
*width += uiWindowsDlgUnitsToX(groupUnmarginedXMargin, d->Sys->BaseX) * 2;
|
||||||
*width += 20;
|
*height += uiWindowsDlgUnitsToY(groupUnmarginedYMarginTop, d->Sys->BaseY) + uiWindowsDlgUnitsToY(groupUnmarginedYMarginBottom, d->Sys->BaseY);
|
||||||
*height += 20;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void groupResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
|
static void groupResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
|
||||||
|
@ -45,11 +56,10 @@ static void groupResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, in
|
||||||
(*(g->baseResize))(uiControl(g), x, y, width, height, d);
|
(*(g->baseResize))(uiControl(g), x, y, width, height, d);
|
||||||
if (GetClientRect(g->hwnd, &r) == 0)
|
if (GetClientRect(g->hwnd, &r) == 0)
|
||||||
logLastError("error getting uiGroup client rect for bin resize in groupResize()");
|
logLastError("error getting uiGroup client rect for bin resize in groupResize()");
|
||||||
// TODO
|
r.left += uiWindowsDlgUnitsToX(groupUnmarginedXMargin, d->Sys->BaseX);
|
||||||
r.left += 10;
|
r.top += uiWindowsDlgUnitsToY(groupUnmarginedYMarginTop, d->Sys->BaseY);
|
||||||
r.right -= 10;
|
r.right -= uiWindowsDlgUnitsToX(groupUnmarginedXMargin, d->Sys->BaseX);
|
||||||
r.top += 10;
|
r.bottom -= uiWindowsDlgUnitsToY(groupUnmarginedYMarginBottom, d->Sys->BaseY);
|
||||||
r.bottom -= 10;
|
|
||||||
uiBinResizeRootAndUpdate(g->bin, r.left, r.top, r.right - r.left, r.bottom - r.top);
|
uiBinResizeRootAndUpdate(g->bin, r.left, r.top, r.right - r.left, r.bottom - r.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue