Created
December 26, 2009 20:23
-
-
Save lsinger/264033 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import <Foundation/CPObject.j> | |
@implementation AppController : CPObject | |
{ | |
CPView _contentView; | |
CPTextField _nicknameTextField; | |
CPPanel _nicknameHUD; | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
{ | |
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask]; | |
_contentView = [theWindow contentView]; | |
var bounds = [_contentView bounds]; | |
_messages = []; | |
[_contentView setBackgroundColor:[CPColor colorWithHexString:@"A8C0D1"]]; | |
var _nicknameHUD = [[CPPanel alloc] initWithContentRect:CGRectMake(185, 200, 225, 125) styleMask:CPHUDBackgroundWindowMask]; | |
[_nicknameHUD setTitle:@"Please enter a nickname"]; | |
[_nicknameHUD setFloatingPanel:YES]; | |
[_nicknameHUD orderFront:self]; | |
var panelContentView = [_nicknameHUD contentView], | |
centerX = (CGRectGetWidth([panelContentView bounds]) - 135.0) / 2.0; | |
// add the nickname textfield | |
_nicknameTextField = [CPTextField roundedTextFieldWithStringValue:@"" placeholder:@"Nickname" width:150.0]; | |
[_nicknameTextField setFrameOrigin:CGPointMake(37, 20)]; | |
[_nicknameTextField setAction:@selector(saveNickname)]; | |
[panelContentView addSubview:_nicknameTextField]; | |
// add the save nickname button | |
var saveNicknameButton = [[CPButton alloc] initWithFrame:CGRectMake(85, 60, 50, 24)]; | |
[saveNicknameButton setTitle:@"OK"]; | |
[saveNicknameButton setTarget:self]; | |
[saveNicknameButton setAction:@selector(saveNickname)]; | |
[panelContentView addSubview:saveNicknameButton]; | |
[theWindow makeFirstResponder: _nicknameTextField]; | |
[theWindow orderFront: self]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment