summaryrefslogtreecommitdiff
path: root/redo/containers_darwin.m
blob: c99e2758ab514b8a3bc97f27ab7e869351758c0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// 25 july 2014

#import "objc_darwin.h"
#import "_cgo_export.h"
#import <Cocoa/Cocoa.h>

#define toNSTabView(x) ((NSTabView *) (x))

@interface goTabView : NSTabView {
@public
	void *gotab;
}
@end

@implementation goTabView

- (void)setFrame:(NSRect)r
{
	NSRect content;

	[super setFrame:r];
	content = [self contentRect];
	tabResized(self->gotab, (intptr_t) content.size.width, (intptr_t) content.size.height);
}

@end

id newTab(void *gotab)
{
	goTabView *t;

	t = [[goTabView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
	setStandardControlFont((id) t);		// safe; same selector provided by NSTabView
	t->gotab = gotab;
	return (id) t;
}

id tabAppend(id t, char *name)
{
	NSTabViewItem *i;

	i = [[NSTabViewItem alloc] initWithIdentifier:nil];
	[i setLabel:[NSString stringWithUTF8String:name]];
	[toNSTabView(t) addTabViewItem:i];
	return (id) [i view];
}