Reimplemented uiTabDelete()... kinda.

This commit is contained in:
Pietro Gagliardi 2015-05-18 15:11:59 -04:00
parent 3ec28551e6
commit 8b3b0c4baa
1 changed files with 17 additions and 1 deletions

View File

@ -3,6 +3,7 @@
// TODO
// - comctl5 on real windows: tabs get drawn behind checkbox
// - moving page 1 out doesn't actually move it out
struct tab {
uiTab t;
@ -152,7 +153,22 @@ static void tabInsertAt(uiTab *tt, const char *name, uintmax_t n, uiControl *chi
static void tabDelete(uiTab *tt, uintmax_t n)
{
// TODO
struct tab *t = (struct tab *) tt;
struct tabPage *page;
// first delete the tab from the tab control
// if this is the current tab, no tab will be selected, which is good
if (SendMessageW(t->hwnd, TCM_DELETEITEM, (WPARAM) n, 0) == FALSE)
logLastError("error deleting uiTab tab in tabDelete()");
// now delete the page itself
page = ptrArrayIndex(t->pages, struct tabPage *, n);
ptrArrayDelete(t->pages, n);
// and keep the page control alive
uiControlSetParent(page->control, NULL);
uiFree(page);
}
static uintmax_t tabNumPages(uiTab *tt)