-
Notifications
You must be signed in to change notification settings - Fork 0
/
InspectorView.j
116 lines (70 loc) · 2.24 KB
/
InspectorView.j
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
@import <AppKit/CPSegmentedControl.j>
@implementation InspectorView : CPView
{
CPSegmentedControl _tabControl;
CPView _attributesView;
CPView _sizeView;
CPView _connectionsView;
CPView _classView;
}
-(id) initWithFrame:(CGRect)aFrame
{
self = [super initWithFrame:aFrame];
if( self )
{
_tabControl = [[CPSegmentedControl alloc] initWithFrame:CGRectMake(0,1, aFrame.size.width+1, 28)];
[_tabControl setSegmentCount:4];
[_tabControl setSegmentStyle:CPSegmentStyleSquare];
[_tabControl setLabel:@"Attributes" forSegment:0];
[_tabControl setWidth:80 forSegment:0];
[_tabControl setLabel:@"Size" forSegment:1];
[_tabControl setWidth:50 forSegment:1];
[_tabControl setLabel:@"Connections" forSegment:2];
[_tabControl setWidth:aFrame.size.width-200 forSegment:2];
[_tabControl setLabel:@"Class" forSegment:3];
[_tabControl setSelected:YES forSegment:0];
[_tabControl setTarget:self];
[_tabControl setAction:@selector(onTabChange:)];
[self addSubview:_tabControl];
var frame = CGRectMake(0, 28, aFrame.size.width, aFrame.size.height-28),
mask = CPViewWidthSizable|CPViewHeightSizable;
_attributesView = [[CPView alloc] initWithFrame:frame];
[_attributesView setAutoresizingMask:mask];
_sizeView = [[CPView alloc] initWithFrame:frame];
[_sizeView setAutoresizingMask:mask];
[self addSubview:_sizeView];
_connectionsView = [[CPView alloc] initWithFrame:frame];
[_connectionsView setAutoresizingMask:mask];
[self addSubview:_connectionsView];
_classView = [[CPView alloc] initWithFrame:frame];
[_classView setAutoresizingMask:mask];
[self addSubview:_classView];
[self addSubview:_attributesView];
[self setBackgroundColor:[CPColor colorWithHexString:@"dfedfa"]];
}
return self;
}
-(void) onTabChange:(id)sender
{
var selectedTab = [[sender selectedSegments] firstIndex];
[_attributesView setHidden:YES];
[_sizeView setHidden:YES];
[_connectionsView setHidden:YES];
[_classView setHidden:YES];
switch(selectedTab)
{
case 0 :
[_attributesView setHidden:NO];
break;
case 1:
[_sizeView setHidden:NO];
break;
case 2:
[_connectionsView setHidden:NO];
break;
case 3:
[_classView setHidden:NO];
break;
}
}
@end