From 8b3b0c4baac106e5c85ca74a87fdd84248690b2d Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 18 May 2015 15:11:59 -0400 Subject: [PATCH] Reimplemented uiTabDelete()... kinda. --- redo/windows/tab.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/redo/windows/tab.c b/redo/windows/tab.c index 0324eebf..45d2e8a3 100644 --- a/redo/windows/tab.c +++ b/redo/windows/tab.c @@ -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)