static void uiWindowMinimumSizeChanged(uiWindowsControl *c) { uiWindow *w = uiWindow(c); if (uiWindowsControlTooSmall(uiWindowsControl(w))) { // TODO figure out what to do with this function // maybe split it into two so WM_GETMINMAXINFO can use it? ensureMinimumWindowSize(w); return; } // otherwise we only need to re-layout everything windowRelayout(w); }
static void uiWindowShow(uiControl *c) { uiWindow *w = uiWindow(c); w->visible = 1; // just in case the window's minimum size wasn't recalculated already ensureMinimumWindowSize(w); if (w->shownOnce) { ShowWindow(w->hwnd, SW_SHOW); return; } w->shownOnce = TRUE; // make sure the child is the correct size uiWindowsControlMinimumSizeChanged(uiWindowsControl(w)); ShowWindow(w->hwnd, nCmdShow); if (UpdateWindow(w->hwnd) == 0) logLastError(L"error calling UpdateWindow() after showing uiWindow for the first time"); }
void doResizes(void) { uiWindowsControl *w; HWND hwnd; RECT r; while (resizes->len != 0) { w = ptrArrayIndex(resizes, uiWindowsControl *, 0); ptrArrayDelete(resizes, 0); // don't clip content if content dynamically changed (tab page changed, etc.) ensureMinimumWindowSize(uiWindow(w)); hwnd = (HWND) uiControlHandle(uiControl(w)); if (GetClientRect(hwnd, &r) == 0) 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) if (RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN) == 0) logLastError("error redrawing controls after a resize in doResizes()"); } }