diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-15 18:49:45 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-15 18:49:45 -0400 |
| commit | 518a5ddbf15d50a254c732a80d5907ef8878abe0 (patch) | |
| tree | 48cf259f98994e4570e65c389fcd9824272884ad /new/tab_darwin.m | |
| parent | 50ae3ca045e7f5f5744043df0a4506e2f6930bb1 (diff) | |
Split all OS backends into their own folders.
Diffstat (limited to 'new/tab_darwin.m')
| -rw-r--r-- | new/tab_darwin.m | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/new/tab_darwin.m b/new/tab_darwin.m deleted file mode 100644 index c36181e..0000000 --- a/new/tab_darwin.m +++ /dev/null @@ -1,67 +0,0 @@ -// 12 april 2015 -#import "uipriv_darwin.h" - -// TODO -// - verify margins against extra space around the tab -// - free child containers properly - -@interface uiNSTabView : NSTabView -@property uiControl *uiC; -@end - -@implementation uiNSTabView - -- (void)viewDidMoveToSuperview -{ - // TODO free all tabs explicitly - if (uiDarwinControlFreeWhenAppropriate(self.uiC, [self superview])) - self.uiC = NULL; - [super viewDidMoveToSuperview]; -} - -@end - -// the default new control implementation uses -sizeToFit, which we don't have with NSTabView -// fortunately, we do have -minimumSize -static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) -{ - uiNSTabView *tv; - NSSize s; - - tv = (uiNSTabView *) uiControlHandle(c); - s = [tv minimumSize]; - *width = (intmax_t) (s.width); - *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) -{ - uiNSTabView *tv; - uiParent *content; - NSTabViewItem *i; - - content = uiNewParent(0); - uiParentSetChild(content, child); - - i = [[NSTabViewItem alloc] initWithIdentifier:nil]; - [i setLabel:toNSString(name)]; - [i setView:((NSView *) uiParentHandle(content))]; - tv = (uiNSTabView *) uiControlHandle(c); - [tv addTabViewItem:i]; -} |
