summaryrefslogtreecommitdiff
path: root/new/darwin/tab.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-16 20:33:28 -0400
committerPietro Gagliardi <[email protected]>2015-04-16 20:33:28 -0400
commite34c561ed5bedeb180437ec165882b98d70d38c1 (patch)
treed095e5db16d7a23e883526c8c1d3c524639c97cf /new/darwin/tab.m
parentde9d72299fb89a8b6cdc8963cd6b6ae708a81e80 (diff)
Split the rewrite into a new repository.
Diffstat (limited to 'new/darwin/tab.m')
-rw-r--r--new/darwin/tab.m73
1 files changed, 0 insertions, 73 deletions
diff --git a/new/darwin/tab.m b/new/darwin/tab.m
deleted file mode 100644
index b84ee9a..0000000
--- a/new/darwin/tab.m
+++ /dev/null
@@ -1,73 +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 uiTab *uiT;
-@end
-
-@implementation uiNSTabView
-
-- (void)viewDidMoveToSuperview
-{
- // TODO free all tabs explicitly
- if (uiDarwinControlFreeWhenAppropriate(uiControl(self.uiT), [self superview]))
- self.uiT = 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);
-}
-
-static void tabAddPage(uiTab *t, 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(uiControl(t));
- [tv addTabViewItem:i];
-}
-
-uiTab *uiNewTab(void)
-{
- uiTab *t;
- uiNSTabView *tv;
-
- t = uiNew(uiTab);
-
- uiDarwinNewControl(uiControl(t), [uiNSTabView class], NO, NO);
- tv = (uiNSTabView *) uiControlHandle(uiControl(t));
-
- // 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;
-}