Fixed uiWindows window sizing issues.
This commit is contained in:
parent
c4103afb49
commit
d3d62c849c
|
@ -130,11 +130,32 @@ static void windowContainerUpdateState(uiControl *c)
|
||||||
childUpdateState(w->child);
|
childUpdateState(w->child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// from https://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing
|
||||||
|
#define windowMargin 7
|
||||||
|
|
||||||
static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
|
static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void windowRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
|
||||||
|
{
|
||||||
|
uiWindow *w = uiWindow(c);
|
||||||
|
uiWindowsSizing *d;
|
||||||
|
|
||||||
|
if (w->child == NULL)
|
||||||
|
return;
|
||||||
|
d = uiWindowsNewSizing(w->hwnd);
|
||||||
|
if (w->margined) {
|
||||||
|
x += uiWindowsDlgUnitsToX(windowMargin, d->BaseX);
|
||||||
|
y += uiWindowsDlgUnitsToY(windowMargin, d->BaseY);
|
||||||
|
width -= 2 * uiWindowsDlgUnitsToX(windowMargin, d->BaseX);
|
||||||
|
height -= 2 * uiWindowsDlgUnitsToY(windowMargin, d->BaseY);
|
||||||
|
}
|
||||||
|
childRelayout(w->child, x, y, width, height);
|
||||||
|
uiWindowsFreeSizing(d);
|
||||||
|
}
|
||||||
|
|
||||||
char *uiWindowTitle(uiWindow *w)
|
char *uiWindowTitle(uiWindow *w)
|
||||||
{
|
{
|
||||||
return uiWindowsUtilText(w->hwnd);
|
return uiWindowsUtilText(w->hwnd);
|
||||||
|
@ -172,31 +193,6 @@ void uiWindowSetMargined(uiWindow *w, int margined)
|
||||||
uiWindowsControlQueueRelayout(uiWindowsControl(w));
|
uiWindowsControlQueueRelayout(uiWindowsControl(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
// from https://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing
|
|
||||||
#define windowMargin 7
|
|
||||||
|
|
||||||
/* TODO
|
|
||||||
static void windowResizeChild(uiWindow *w)
|
|
||||||
{
|
|
||||||
RECT r;
|
|
||||||
uiWindowsSizing *d;
|
|
||||||
|
|
||||||
if (w->child == NULL)
|
|
||||||
return;
|
|
||||||
if (GetClientRect(w->hwnd, &r) == 0)
|
|
||||||
logLastError("error getting uiWindow client rect in windowComputeChildSize()");
|
|
||||||
d = uiControlSizing(uiControl(w));
|
|
||||||
if (w->margined) {
|
|
||||||
r.left += uiWindowsDlgUnitsToX(windowMargin, d->Sys->BaseX);
|
|
||||||
r.top += uiWindowsDlgUnitsToY(windowMargin, d->Sys->BaseY);
|
|
||||||
r.right -= uiWindowsDlgUnitsToX(windowMargin, d->Sys->BaseX);
|
|
||||||
r.bottom -= uiWindowsDlgUnitsToY(windowMargin, d->Sys->BaseY);
|
|
||||||
}
|
|
||||||
uiControlResize(w->child, r.left, r.top, r.right - r.left, r.bottom - r.top, d);
|
|
||||||
uiFreeSizing(d);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// see http://blogs.msdn.com/b/oldnewthing/archive/2003/09/11/54885.aspx and http://blogs.msdn.com/b/oldnewthing/archive/2003/09/13/54917.aspx
|
// see http://blogs.msdn.com/b/oldnewthing/archive/2003/09/11/54885.aspx and http://blogs.msdn.com/b/oldnewthing/archive/2003/09/13/54917.aspx
|
||||||
static void setClientSize(uiWindow *w, int width, int height, BOOL hasMenubar, DWORD style, DWORD exstyle)
|
static void setClientSize(uiWindow *w, int width, int height, BOOL hasMenubar, DWORD style, DWORD exstyle)
|
||||||
{
|
{
|
||||||
|
@ -265,6 +261,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||||
uiWindowsFinishNewControl(w, uiWindow);
|
uiWindowsFinishNewControl(w, uiWindow);
|
||||||
uiControl(w)->CommitShow = windowCommitShow;
|
uiControl(w)->CommitShow = windowCommitShow;
|
||||||
uiControl(w)->ContainerUpdateState = windowContainerUpdateState;
|
uiControl(w)->ContainerUpdateState = windowContainerUpdateState;
|
||||||
|
uiWindowsControl(w)->Relayout = windowRelayout;
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue