Fixed some of the errors in the new tab page code.

This commit is contained in:
Pietro Gagliardi 2015-05-30 12:34:39 -04:00
parent 1a55d1fcb3
commit fe2e647fc4
2 changed files with 11 additions and 7 deletions

View File

@ -80,7 +80,7 @@ static void tabResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intm
{
struct tab *t = (struct tab *) c;
LRESULT n;
struct tabPage *page;
uiControl *page;
RECT r;
uiSizing *dchild;
@ -88,7 +88,7 @@ static void tabResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intm
n = curpage(t);
if (n == (LRESULT) (-1))
return;
page = ptrArrayIndex(t->pages, struct tabPage *, n);
page = ptrArrayIndex(t->pages, uiControl *, n);
dchild = uiControlSizing(uiControl(t));
@ -102,13 +102,15 @@ 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->control, r.left, r.top, r.right - r.left, r.bottom - r.top, dchild);
*/
uiControlResize(page, r.left, r.top, r.right - r.left, r.bottom - r.top, dchild);
uiFreeSizing(dchild);
}

View File

@ -1,5 +1,5 @@
// 30 may 2015
#include "uicontrol_windows.h"
#include "uipriv_windows.h"
// This is a special internal control type that handles tab pages.
// This doesn't use the container class, but rather a subclassed WC_DIALOG, as that supports tab textures properly.
@ -33,7 +33,7 @@ uiControl *newTabPage(uiControl *child)
t = (struct tabPage *) uiWindowsNewSingleHWNDControl(tabPageType());
t->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CONTROLPARENT,
WC_DIALOGW, L"",
WC_DIALOG, L"",
0,
hInstance, NULL,
FALSE);
@ -44,10 +44,12 @@ uiControl *newTabPage(uiControl *child)
// TODO subclass hwnd to handle events
// needs to be done here, otherwise the uiControlSetParent() below will crash
// TODO split into separate functions
uiControl(t)->Handle = tabPageHandle;
t->control = child;
uiControlSetParent(t->control, uiControl(t));
uiControl(t)->Handle = tabPageHandle;
return uiControl(t);
}