-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBaseConsoleController.j
More file actions
55 lines (49 loc) · 1.95 KB
/
BaseConsoleController.j
File metadata and controls
55 lines (49 loc) · 1.95 KB
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
// (c) 2010-2011 by Anton Korenyushkin
@import "BasePresentationController.j"
@import "InfoView.j"
@import "ConsoleInputView.j"
@import "ConsoleOutputView.j"
@implementation BaseConsoleController : BasePresentationController
{
CPView view @accessors(readonly);
InfoView infoView;
ConsoleOutputView outputView;
ConsoleInputView inputView;
}
- (id)initWithApp:(App)anApp
buffer:(Buffer)aBuffer
infoBoxWidth:(unsigned)infoBoxWidth
message:(CPString)message
comment:(CPString)comment
inputButtonTitle:(CPString)inputButtonTitle // public
{
if (self = [super initWithApp:anApp buffer:aBuffer]) {
view = [CPView new];
var topFrame = CGRectMake(0, 0, 0, -61);
infoView = [[InfoView alloc] initWithFrame:topFrame boxWidth:infoBoxWidth message:message comment:comment];
[infoView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[view addSubview:infoView];
outputView = [[ConsoleOutputView alloc] initWithFrame:topFrame];
[outputView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[view addSubview:outputView];
inputView = [[ConsoleInputView alloc] initWithFrame:CGRectMake(0, -61, 0, 61)
target:self
action:@selector(removeInfoViewAndHandleInput:)
buttonTitle:inputButtonTitle];
[inputView setBackgroundColor:[CPColor colorWithPatternImage:[CPImage imageFromPath:"ConsoleInputViewBackground.png"]]];
[inputView setAutoresizingMask:CPViewWidthSizable | CPViewMinYMargin];
[view addSubview:inputView];
}
return self;
}
- (void)removeInfoViewAndHandleInput:(CPString)input // private
{
[infoView removeFromSuperview];
[inputView setAction:@selector(handleInput:)];
[self handleInput:input];
}
- (void)focus // public
{
[inputView focus];
}
@end