More work trying to get tab pages to work. There's something up with boxes, but there's also something up with theme dialog textures...
This commit is contained in:
parent
fe2e647fc4
commit
f6d9e1ea1e
|
@ -68,9 +68,6 @@ static uintptr_t tabHandle(uiControl *c)
|
|||
return (uintptr_t) (t->hwnd);
|
||||
}
|
||||
|
||||
// from http://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx
|
||||
#define tabMargin 7
|
||||
|
||||
static void tabPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
|
||||
{
|
||||
// TODO
|
||||
|
@ -102,14 +99,6 @@ static void tabResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intm
|
|||
SendMessageW(t->hwnd, TCM_ADJUSTRECT, (WPARAM) FALSE, (LPARAM) (&r));
|
||||
mapWindowRect(NULL, dchild->Sys->CoordFrom, &r);
|
||||
|
||||
/*TODO
|
||||
if (page->margined) {
|
||||
r.left += uiWindowsDlgUnitsToX(tabMargin, d->Sys->BaseX);
|
||||
r.top += uiWindowsDlgUnitsToY(tabMargin, d->Sys->BaseY);
|
||||
r.right -= uiWindowsDlgUnitsToX(tabMargin, d->Sys->BaseX);
|
||||
r.bottom -= uiWindowsDlgUnitsToY(tabMargin, d->Sys->BaseY);
|
||||
}
|
||||
*/
|
||||
uiControlResize(page, r.left, r.top, r.right - r.left, r.bottom - r.top, dchild);
|
||||
|
||||
uiFreeSizing(dchild);
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
struct tabPage {
|
||||
uiControl c;
|
||||
HWND hwnd;
|
||||
uiControl *control;
|
||||
uiControl *control; // TODO rename child
|
||||
int margined;
|
||||
void (*baseResize)(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *);
|
||||
};
|
||||
|
||||
uiDefineControlType(tabPage, tabPageType, struct tabPage)
|
||||
|
@ -25,6 +26,31 @@ static uintptr_t tabPageHandle(uiControl *c)
|
|||
return (uintptr_t) (t->hwnd);
|
||||
}
|
||||
|
||||
// from http://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx
|
||||
#define tabMargin 7
|
||||
|
||||
static void tabPageResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
|
||||
{
|
||||
struct tabPage *t = (struct tabPage *) c;
|
||||
RECT r;
|
||||
uiSizing *dchild;
|
||||
|
||||
(*(t->baseResize))(uiControl(t), x, y, width, height, d);
|
||||
|
||||
if (GetClientRect(t->hwnd, &r) == 0)
|
||||
logLastError("error getting tab page client rect in tabPageResize()");
|
||||
if (t->margined) {
|
||||
r.left += uiWindowsDlgUnitsToX(tabMargin, d->Sys->BaseX);
|
||||
r.top += uiWindowsDlgUnitsToY(tabMargin, d->Sys->BaseY);
|
||||
r.right -= uiWindowsDlgUnitsToX(tabMargin, d->Sys->BaseX);
|
||||
r.bottom -= uiWindowsDlgUnitsToY(tabMargin, d->Sys->BaseY);
|
||||
}
|
||||
|
||||
dchild = uiControlSizing(uiControl(t));
|
||||
//TODO uiControlResize(t->control, r.left, r.top, r.right - r.left, r.bottom - r.top, dchild);
|
||||
uiFreeSizing(dchild);
|
||||
}
|
||||
|
||||
uiControl *newTabPage(uiControl *child)
|
||||
{
|
||||
struct tabPage *t;
|
||||
|
@ -38,6 +64,7 @@ uiControl *newTabPage(uiControl *child)
|
|||
hInstance, NULL,
|
||||
FALSE);
|
||||
|
||||
// TODO figure out why this is not working
|
||||
hr = EnableThemeDialogTexture(t->hwnd, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB);
|
||||
if (hr != S_OK)
|
||||
logHRESULT("error setting tab page background in newTabPage()", hr);
|
||||
|
@ -51,5 +78,8 @@ uiControl *newTabPage(uiControl *child)
|
|||
t->control = child;
|
||||
uiControlSetParent(t->control, uiControl(t));
|
||||
|
||||
t->baseResize = uiControl(t)->Resize;
|
||||
uiControl(t)->Resize = tabPageResize;
|
||||
|
||||
return uiControl(t);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue