Some TODO resolution.

This commit is contained in:
Pietro Gagliardi 2015-09-01 13:51:25 -04:00
parent 9a3bffe566
commit 25208dcab4
2 changed files with 21 additions and 8 deletions

View File

@ -17,14 +17,15 @@ void uninitResizes(void)
void uiWindowsControlQueueRelayout(uiWindowsControl *c)
{
uiControl *cc;
uintmax_t i;
uiWindowsControl *d;
// resizing a control requires us to reocmpute the sizes of everything in the top-level window
// TODO use conversion
c = (uiWindowsControl *) toplevelOwning(uiControl(c));
if (c == NULL)
cc = toplevelOwning(uiControl(c));
if (cc == NULL)
return;
c = uiWindowsControl(cc);
// make sure we're only queued once
for (i = 0 ; i < resizes->len; i++) {
d = ptrArrayIndex(resizes, uiWindowsControl *, i);
@ -45,7 +46,7 @@ void doResizes(void)
ptrArrayDelete(resizes, 0);
hwnd = (HWND) uiControlHandle(uiControl(w));
if (GetClientRect(hwnd, &r) == 0)
logLastError("TODO write this");
logLastError("error getting uiWindow client rect in doResizes()");
(*(w->Relayout))(w, r.left, r.top, r.right - r.left, r.bottom - r.top);
// we used SWP_NOREDRAW; we need to queue a redraw ourselves
// force all controls to be redrawn; this fixes things like the date-time picker's up-down not showing up until hovered over (and bypasses complications caused by WS_CLIPCHILDREN and WS_CLIPSIBLINGS, which we don't use but other controls might)

View File

@ -24,19 +24,20 @@ uiWindowsDefineControlWithOnDestroy(
static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LONG_PTR ww;
uiWindow *w;
CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam;
WINDOWPOS *wp = (WINDOWPOS *) lParam;
LRESULT lResult;
// TODO change to our conversion syntax
w = (uiWindow *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
if (w == NULL) {
ww = GetWindowLongPtrW(hwnd, GWLP_USERDATA);
if (ww == 0) {
if (uMsg == WM_CREATE)
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) (cs->lpCreateParams));
// fall through to DefWindowProc() anyway
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
w = uiWindow((void *) ww);
if (handleParentMessages(hwnd, uMsg, wParam, lParam, &lResult) != FALSE)
return lResult;
switch (uMsg) {
@ -135,7 +136,18 @@ static void windowContainerUpdateState(uiControl *c)
static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height)
{
// TODO
uiWindow *w = uiWindow(c);
*width = 0;
*height = 0;
d = uiWindowsNewSizing(w->hwnd);
if (w->child != NULL)
childMinimumSize(w->child, d, width, height);
if (w->margined) {
*width += 2 * uiWindowsDlgUnitsToX(windowMargin, d->BaseX);
*height += 2 * uiWindowsDlgUnitsToY(windowMargin, d->BaseY);
}
uiWindowsFreeSizing(d);
}
static void windowRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)