Permalink
Browse files

Add an empty Twitter panel with matching button

  • Loading branch information...
1 parent e1ab582 commit 804cc0b5bf5f6a96811b17b9d72bb2826d2916b0 @hlship committed Sep 7, 2009
Showing with 40 additions and 0 deletions.
  1. +11 −0 src/main/webapp/app/AppController.j
  2. +29 −0 src/main/webapp/app/TwitterController.j
@@ -9,10 +9,12 @@
@import <Foundation/CPObject.j>
@import <AppKit/CPButton.j>
@import "CalcController.j"
+@import "TwitterController.j"
@implementation AppController : CPObject
{
CalcController _calcController;
+ TwitterController _twitController;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
@@ -21,6 +23,7 @@
contentView = [window contentView];
[contentView addSubview:[self makeButton:@"Calculator" row:0 action:@selector(raiseCalculatorPanel:)]];
+ [contentView addSubview:[self makeButton:@"Twitter" row:1 action:@selector(raiseTwitterPanel:)]];
[window orderFront:self];
}
@@ -45,4 +48,12 @@
[_calcController show];
}
+-(void)raiseTwitterPanel:(id)sender
+{
+ if (_twitController == nil)
+ _twitController = [[TwitterController alloc] init];
+
+ [_twitController show];
+}
+
@end
@@ -0,0 +1,29 @@
+@import <Foundation/CPObject.j>
+@import <AppKit/CPPanel.j>
+
+@implementation TwitterController : CPObject
+{
+ CPPanel _panel;
+}
+
+- (id)init
+{
+ self = [super init];
+
+ if (self)
+ {
+ _panel = [[CPPanel alloc] initWithContentRect:CGRectMake(20, 30, 184, 184)
+ styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask | CPResizableWindowMask];
+
+ [_panel setTitle:@"Twitter"];
+ }
+
+ return self;
+}
+
+- (void)show
+{
+ [_panel orderFront:self];
+}
+
+@end

0 comments on commit 804cc0b

Please sign in to comment.