diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-16 14:50:05 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-16 14:50:05 -0400 |
| commit | e2ffe78e8708b3c8514c2804cbe77fdf3e63938c (patch) | |
| tree | 3505f1c82309c7e5b47c93c77068ff096acc51d7 /new/darwin/tab.m | |
| parent | 0660104659c17852035233617ce9885339c93d7c (diff) | |
Migrated darwin/tab.m and darwin/window.m. Now to test.
Diffstat (limited to 'new/darwin/tab.m')
| -rw-r--r-- | new/darwin/tab.m | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/new/darwin/tab.m b/new/darwin/tab.m index c36181e..98dd733 100644 --- a/new/darwin/tab.m +++ b/new/darwin/tab.m @@ -6,7 +6,7 @@ // - free child containers properly @interface uiNSTabView : NSTabView -@property uiControl *uiC; +@property uiTab *uiT; @end @implementation uiNSTabView @@ -14,7 +14,7 @@ - (void)viewDidMoveToSuperview { // TODO free all tabs explicitly - if (uiDarwinControlFreeWhenAppropriate(self.uiC, [self superview])) + if (uiDarwinControlFreeWhenAppropriate(uiControl(self.uiT), [self superview])) self.uiC = NULL; [super viewDidMoveToSuperview]; } @@ -34,23 +34,7 @@ static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t * *height = (intmax_t) (s.height); } -uiControl *uiNewTab(void) -{ - uiControl *c; - uiNSTabView *t; - - c = uiDarwinNewControl([uiNSTabView class], NO, NO); - c->preferredSize = preferredSize; - t = (uiNSTabView *) uiControlHandle(c); - t.uiC = c; - - // also good for NSTabView (same selector and everything) - setStandardControlFont((NSControl *) t); - - return c; -} - -void uiTabAddPage(uiControl *c, const char *name, uiControl *child) +static void tabAddPage(uiTab *t, const char *name, uiControl *child) { uiNSTabView *tv; uiParent *content; @@ -62,6 +46,26 @@ void uiTabAddPage(uiControl *c, const char *name, uiControl *child) i = [[NSTabViewItem alloc] initWithIdentifier:nil]; [i setLabel:toNSString(name)]; [i setView:((NSView *) uiParentHandle(content))]; - tv = (uiNSTabView *) uiControlHandle(c); + tv = (uiNSTabView *) uiControlHandle(uiControl(t)); [tv addTabViewItem:i]; } + +uiTab *uiNewTab(void) +{ + uiTab *t; + uiNSTabView *tv; + + uiDarwinNewControl(uiControl(t), [uiNSTabView class], NO, NO); + tv = (uiNSTabView *) uiControlHandle(c); + + // also good for NSTabView (same selector and everything) + setStandardControlFont((NSControl *) tv); + + uiControl(t)->PreferredSize = preferredSize; + + uiTab(t)->AddPage = tabAddPage; + + tv.uiT = t; + + return tv.uiT; +} |
