Implemented uiTabInsertPageBefore() on OS X.

This commit is contained in:
Pietro Gagliardi 2015-05-06 14:46:50 -04:00
parent 7981c5e7da
commit c55ec89d19
1 changed files with 18 additions and 0 deletions

View File

@ -104,6 +104,23 @@ static void tabAppendPage(uiTab *tt, const char *name, uiControl *child)
[t->tabview addTabViewItem:i];
}
static void tabInsertPageBefore(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
{
struct tab *t = (struct tab *) tt;
uiContainer *page;
NSTabViewItem *i;
page = newBin();
binSetMainControl(page, child);
[t->pages insertObject:[NSValue valueWithPointer:page] atIndex:n];
[t->margined insertObject:[NSNumber numberWithInt:0] atIndex:n];
i = [[NSTabViewItem alloc] initWithIdentifier:nil];
[i setLabel:toNSString(name)];
[i setView:((NSView *) uiControlHandle(uiControl(page)))];
[t->tabview insertTabViewItem:i atIndex:n];
}
static void tabDeletePage(uiTab *tt, uintmax_t n)
{
struct tab *t = (struct tab *) tt;
@ -197,6 +214,7 @@ uiTab *uiNewTab(void)
uiControl(t)->SysFunc = tabSysFunc;
uiTab(t)->AppendPage = tabAppendPage;
uiTab(t)->InsertPageBefore = tabInsertPageBefore;
uiTab(t)->DeletePage = tabDeletePage;
uiTab(t)->NumPages = tabNumPages;
uiTab(t)->Margined = tabMargined;