Created
July 9, 2010 18:16
-
-
Save jerodsanto/469817 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 | |
{ | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
{ | |
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], | |
contentView = [theWindow contentView]; | |
var button = [[TestButton alloc] initWithFrame:CGRectMake(0,0,100,24)]; | |
[button addItemWithTitle:@"one"]; | |
[button addItemWithTitle:@"two"]; | |
[button addItemWithTitle:@"three"]; | |
[button setCenter:[contentView center]]; | |
[contentView addSubview:button]; | |
[theWindow orderFront:self]; | |
} | |
@end | |
@implementation TestButton : CPPopUpButton | |
{ | |
} | |
- (void)menuDidChangeItem:(CPNotification)aNotification | |
{ | |
var index = [[aNotification userInfo] objectForKey:@"CPMenuItemIndex"]; | |
console.log('menu did change, index = ', index); | |
if ([self pullsDown] && index != 0) | |
return; | |
if (![self pullsDown] && index != _selectedIndex) | |
return; | |
[self synchronizeTitleAndSelectedItem]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment