More TODO resolution.

This commit is contained in:
Pietro Gagliardi 2015-09-01 16:10:29 -04:00
parent 25208dcab4
commit e46822a9b1
3 changed files with 33 additions and 14 deletions

View File

@ -22,7 +22,7 @@ static BOOL onWM_COMMAND(uiControl *cc, HWND hwnd, WORD code, LRESULT *lResult)
if (code != BN_CLICKED)
return FALSE;
// we didn't use BS_AUTOCHECKBOX (TODO get link) so we have to manage the check state ourselves
// we didn't use BS_AUTOCHECKBOX (http://blogs.msdn.com/b/oldnewthing/archive/2014/05/22/10527522.aspx) so we have to manage the check state ourselves
check = BST_CHECKED;
if (SendMessage(c->hwnd, BM_GETCHECK, 0, 0) == BST_CHECKED)
check = BST_UNCHECKED;

View File

@ -117,6 +117,21 @@ void uiGroupSetMargined(uiGroup *g, int margined)
uiWindowsControlQueueRelayout(uiWindowsControl(g));
}
static LRESULT CALLBACK groupSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
LRESULT lResult;
if (handleParentMessages(hwnd, uMsg, wParam, lParam, &lResult) != FALSE)
return lResult;
switch (uMsg) {
case WM_NCDESTROY:
if (RemoveWindowSubclass(hwnd, groupSubProc, uIdSubclass) == FALSE)
logLastError("error removing groupbox subclass in groupSubProc()");
break;
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
uiGroup *uiNewGroup(const char *text)
{
uiGroup *g;
@ -132,7 +147,8 @@ uiGroup *uiNewGroup(const char *text)
TRUE);
uiFree(wtext);
// TODO subclass uiGroup to call parent.c functions
if (SetWindowSubclass(g->hwnd, groupSubProc, 0, (DWORD_PTR) g) == FALSE)
logLastError("error subclassing groupbox to handle parent messages in uiNewGroup()");
uiWindowsFinishNewControl(g, uiGroup);
uiControl(g)->ContainerUpdateState = groupContainerUpdateState;

View File

@ -78,31 +78,34 @@ static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width
static void radiobuttonsRelayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
{
/* TODO
struct radiobuttons *r = (struct radiobuttons *) c;
uiRadioButtons *r = uiRadioButtons(c);
uiWindowsSizing *d;
intmax_t height1;
intmax_t h;
uintmax_t i;
HWND hwnd;
// TODO resize the main hwnd
uiWindowsEnsureMoveWindow(r->hwnd, x, y, width, height);
height1 = uiWindowsDlgUnitsToY(radiobuttonHeight, d->Sys->BaseY);
x = 0;
y = 0;
d = uiWindowsNewSizing(r->hwnd);
height1 = uiWindowsDlgUnitsToY(radiobuttonHeight, d->BaseY);
uiWindowsFreeSizing(d);
for (i = 0; i < r->hwnds->len; i++) {
hwnd = ptrArrayIndex(r->hwnds, HWND, i);
h = height1;
if (h > height) // clip to height
h = height;
moveWindow(hwnd, x, y, width, h, d);
uiWindowsEnsureMoveWindow(hwnd, x, y, width, h);
y += height1;
height -= height1;
if (height <= 0) // clip to height
break;
}
*/
}
// TODO container update state
// TODO commit enable/disable
/* TODO
static uintptr_t radiobuttonsStartZOrder(uiControl *c)
@ -137,10 +140,9 @@ static int radiobuttonsHasTabStops(uiControl *c)
void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
{
/* TODO
HWND hwnd;
WCHAR *wtext;
HWND after;
//TODO HWND after;
wtext = toUTF16(text);
hwnd = uiWindowsEnsureCreateControlHWND(0,
@ -149,9 +151,10 @@ void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
hInstance, NULL,
TRUE);
uiFree(wtext);
uiWindowsUtilSetParent(hwnd, r->parent);
uiWindowsEnsureSetParent(hwnd, r->hwnd);
uiWindowsRegisterWM_COMMANDHandler(hwnd, onWM_COMMAND, uiControl(r));
/* TODO
// maintain z-order
if (r->hwnds->len == 0) // first item
uiWindowsUtilSetZOrder(hwnd, r->insertAfter);
@ -159,10 +162,10 @@ void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
after = ptrArrayIndex(r->hwnds, HWND, r->hwnds->len - 1);
uiWindowsUtilSetZOrder(hwnd, (uintptr_t) after);
}
*/
ptrArrayAppend(r->hwnds, hwnd);
uiControlQueueResize(uiControl(r));
*/
uiWindowsControlQueueRelayout(uiWindowsControl(r));
}
uiRadioButtons *uiNewRadioButtons(void)