2014-07-25 22:11:41 -05:00
|
|
|
// 25 july 2014
|
|
|
|
|
|
|
|
#import "objc_darwin.h"
|
|
|
|
#import "_cgo_export.h"
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
|
|
|
#define toNSTabView(x) ((NSTabView *) (x))
|
2014-08-04 16:03:07 -05:00
|
|
|
#define toNSView(x) ((NSView *) (x))
|
2014-07-25 22:11:41 -05:00
|
|
|
|
2014-08-04 16:07:06 -05:00
|
|
|
id newTab(void)
|
2014-07-25 22:11:41 -05:00
|
|
|
{
|
2014-08-04 16:07:06 -05:00
|
|
|
NSTabView *t;
|
2014-07-25 22:11:41 -05:00
|
|
|
|
2014-08-05 21:02:57 -05:00
|
|
|
t = [[NSTabView alloc] initWithFrame:NSZeroRect];
|
2014-07-26 09:05:18 -05:00
|
|
|
setStandardControlFont((id) t); // safe; same selector provided by NSTabView
|
2014-07-25 22:11:41 -05:00
|
|
|
return (id) t;
|
|
|
|
}
|
|
|
|
|
2014-08-04 16:03:07 -05:00
|
|
|
void tabAppend(id t, char *name, id view)
|
2014-07-25 22:11:41 -05:00
|
|
|
{
|
|
|
|
NSTabViewItem *i;
|
|
|
|
|
|
|
|
i = [[NSTabViewItem alloc] initWithIdentifier:nil];
|
|
|
|
[i setLabel:[NSString stringWithUTF8String:name]];
|
2014-08-04 16:03:07 -05:00
|
|
|
[i setView:toNSView(view)];
|
2014-07-25 22:11:41 -05:00
|
|
|
[toNSTabView(t) addTabViewItem:i];
|
|
|
|
}
|
2014-08-09 20:34:56 -05:00
|
|
|
|
|
|
|
struct xsize tabPreferredSize(id control)
|
|
|
|
{
|
|
|
|
NSTabView *tv;
|
|
|
|
NSSize s;
|
|
|
|
struct xsize t;
|
|
|
|
|
|
|
|
tv = toNSTabView(control);
|
|
|
|
s = [tv minimumSize];
|
|
|
|
t.width = (intptr_t) s.width;
|
|
|
|
t.height = (intptr_t) s.height;
|
|
|
|
return t;
|
|
|
|
}
|