diff --git a/redo/windows/tab.c b/redo/windows/tab.c index 65806eed..6dcc0e86 100644 --- a/redo/windows/tab.c +++ b/redo/windows/tab.c @@ -60,7 +60,7 @@ static void tabCommitDestroy(uiControl *c) while (t->pages->len != 0) { page = ptrArrayIndex(t->pages, uiControl *, 0); ptrArrayDelete(t->pages, 0); - // TODO destroy control + tabPageDestroyChild(page); uiControlSetParent(page, NULL); uiControlDestroy(page); } diff --git a/redo/windows/tabpage.c b/redo/windows/tabpage.c index d12a5a60..b3ef8f5f 100644 --- a/redo/windows/tabpage.c +++ b/redo/windows/tabpage.c @@ -10,7 +10,7 @@ struct tabPage { uiControl c; HWND hwnd; - uiControl *control; // TODO rename child + uiControl *child; int margined; void (*baseResize)(uiControl *, intmax_t, intmax_t, intmax_t, intmax_t, uiSizing *); }; @@ -52,7 +52,7 @@ static void tabPageResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, // this rect is in client coordinates; we need toplevel window coordinates mapWindowRect(t->hwnd, dchild->Sys->CoordFrom, &r); - uiControlResize(t->control, r.left, r.top, r.right - r.left, r.bottom - r.top, dchild); + uiControlResize(t->child, r.left, r.top, r.right - r.left, r.bottom - r.top, dchild); uiFreeSizing(dchild); } @@ -90,8 +90,8 @@ uiControl *newTabPage(uiControl *child) // TODO split into separate functions uiControl(t)->Handle = tabPageHandle; - t->control = child; - uiControlSetParent(t->control, uiControl(t)); + t->child = child; + uiControlSetParent(t->child, uiControl(t)); t->baseResize = uiControl(t)->Resize; uiControl(t)->Resize = tabPageResize; @@ -112,3 +112,11 @@ void tabPageSetMargined(uiControl *c, int margined) t->margined = margined; } + +void tabPageDestroyChild(uiControl *c) +{ + struct tabPage *t = (struct tabPage *) c; + + uiControlSetParent(t->child, NULL); + uiControlDestroy(t->child); +} diff --git a/redo/windows/uipriv_windows.h b/redo/windows/uipriv_windows.h index e6a7490f..2e0281c4 100644 --- a/redo/windows/uipriv_windows.h +++ b/redo/windows/uipriv_windows.h @@ -118,3 +118,4 @@ extern void setSingleHWNDFuncs(uiControl *); extern uiControl *newTabPage(uiControl *); extern int tabPageMargined(uiControl *); extern void tabPageSetMargined(uiControl *, int); +extern void tabPageDestroyChild(uiControl *);