Skip to content
Browse files

Add in the remaining buttons.

  • Loading branch information...
1 parent e2960ca commit 5e411f4c13e4bd492bfa054b81523c30d0b682de @hlship committed Sep 4, 2009
Showing with 47 additions and 3 deletions.
  1. +47 −3 src/main/webapp/app/AppController.j
View
50 src/main/webapp/app/AppController.j
@@ -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.
Something went wrong with that request. Please try again.