Some TODO resolution.
This commit is contained in:
parent
9a3bffe566
commit
25208dcab4
|
@ -17,14 +17,15 @@ void uninitResizes(void)
|
||||||
|
|
||||||
void uiWindowsControlQueueRelayout(uiWindowsControl *c)
|
void uiWindowsControlQueueRelayout(uiWindowsControl *c)
|
||||||
{
|
{
|
||||||
|
uiControl *cc;
|
||||||
uintmax_t i;
|
uintmax_t i;
|
||||||
uiWindowsControl *d;
|
uiWindowsControl *d;
|
||||||
|
|
||||||
// resizing a control requires us to reocmpute the sizes of everything in the top-level window
|
// resizing a control requires us to reocmpute the sizes of everything in the top-level window
|
||||||
// TODO use conversion
|
cc = toplevelOwning(uiControl(c));
|
||||||
c = (uiWindowsControl *) toplevelOwning(uiControl(c));
|
if (cc == NULL)
|
||||||
if (c == NULL)
|
|
||||||
return;
|
return;
|
||||||
|
c = uiWindowsControl(cc);
|
||||||
// make sure we're only queued once
|
// make sure we're only queued once
|
||||||
for (i = 0 ; i < resizes->len; i++) {
|
for (i = 0 ; i < resizes->len; i++) {
|
||||||
d = ptrArrayIndex(resizes, uiWindowsControl *, i);
|
d = ptrArrayIndex(resizes, uiWindowsControl *, i);
|
||||||
|
@ -45,7 +46,7 @@ void doResizes(void)
|
||||||
ptrArrayDelete(resizes, 0);
|
ptrArrayDelete(resizes, 0);
|
||||||
hwnd = (HWND) uiControlHandle(uiControl(w));
|
hwnd = (HWND) uiControlHandle(uiControl(w));
|
||||||
if (GetClientRect(hwnd, &r) == 0)
|
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);
|
(*(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
|
// 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)
|
// 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)
|
||||||
|
|
|
@ -24,19 +24,20 @@ uiWindowsDefineControlWithOnDestroy(
|
||||||
|
|
||||||
static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
LONG_PTR ww;
|
||||||
uiWindow *w;
|
uiWindow *w;
|
||||||
CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam;
|
CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam;
|
||||||
WINDOWPOS *wp = (WINDOWPOS *) lParam;
|
WINDOWPOS *wp = (WINDOWPOS *) lParam;
|
||||||
LRESULT lResult;
|
LRESULT lResult;
|
||||||
|
|
||||||
// TODO change to our conversion syntax
|
ww = GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
||||||
w = (uiWindow *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
if (ww == 0) {
|
||||||
if (w == NULL) {
|
|
||||||
if (uMsg == WM_CREATE)
|
if (uMsg == WM_CREATE)
|
||||||
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) (cs->lpCreateParams));
|
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) (cs->lpCreateParams));
|
||||||
// fall through to DefWindowProc() anyway
|
// fall through to DefWindowProc() anyway
|
||||||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
w = uiWindow((void *) ww);
|
||||||
if (handleParentMessages(hwnd, uMsg, wParam, lParam, &lResult) != FALSE)
|
if (handleParentMessages(hwnd, uMsg, wParam, lParam, &lResult) != FALSE)
|
||||||
return lResult;
|
return lResult;
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
|
@ -135,7 +136,18 @@ static void windowContainerUpdateState(uiControl *c)
|
||||||
|
|
||||||
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
|
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)
|
static void windowRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
|
||||||
|
|
Loading…
Reference in New Issue