Skip to content

Commit

Permalink
Add in the remaining buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
hlship committed Sep 4, 2009
1 parent e2960ca commit 5e411f4
Showing 1 changed file with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions src/main/webapp/app/AppController.j
Expand Up @@ -7,20 +7,64 @@
*/

@import <Foundation/CPObject.j>
@import <AppKit/CPTextField.j>


@implementation AppController : CPObject
{

CPView _contentView;
CPTextField _display;
}

- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask];

_contentView = [theWindow contentView];

_display = [CPTextField labelWithTitle:"(placeholder)"];
[_display setFrame:CGRectMake(5, 5, 180, 30)]
[_display setBezeled:YES];

[self add:_display];

[self makeButton:7 at:CGRectMake(5, 35, 40, 25)];
[self makeButton:8 at:CGRectMake(50, 35, 40, 25)];
[self makeButton:9 at:CGRectMake(95, 35, 40, 25)];
[self makeButton:"*" at:CGRectMake(140, 35, 40, 25)];

[self makeButton:4 at:CGRectMake(5, 65, 40, 25)];
[self makeButton:5 at:CGRectMake(50, 65, 40, 25)];
[self makeButton:6 at:CGRectMake(95, 65, 40, 25)];
[self makeButton:"-" at:CGRectMake(140, 65, 40, 25)];

[self makeButton:1 at:CGRectMake(5, 95, 40, 25)];
[self makeButton:2 at:CGRectMake(50, 95, 40, 25)];
[self makeButton:3 at:CGRectMake(95, 95, 40, 25)];
[self makeButton:"+" at:CGRectMake(140, 95, 40, 25)];

[self makeButton:0 at:CGRectMake(5, 125, 85, 25)];
[self makeButton:"." at:CGRectMake(95, 125, 40, 25)];
[self makeButton:"=" at:CGRectMake(140, 125, 40, 25)];


[theWindow orderFront:self];
}

- (void)add:(CPView)subview
{
[_contentView addSubview:subview];
}

- (CPButton)makeButton:value at:(CGRect)frame
{
var button = [[CPButton alloc] initWithFrame:frame];

[button setTitle:value.toString()];

[self add:button];

return button;
}

@end

0 comments on commit 5e411f4

Please sign in to comment.