Created
December 3, 2009 13:41
-
-
Save cacaodev/248163 to your computer and use it in GitHub Desktop.
This file contains 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
@implementation AppController : CPObject | |
{ | |
var theWindow; | |
var menu; | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
{ | |
theWindow = [[MyWindow alloc] initWithContentRect:CGRectMake(50,50,500,500) styleMask:CPResizableWindowMask], | |
contentView = [theWindow contentView]; | |
menu = [[CPMenu alloc] init]; | |
[menu addItemWithTitle:"toto" action:nil keyEquivalent:@""]; | |
[menu addItemWithTitle:"tata" action:nil keyEquivalent:@""]; | |
[theWindow orderFront:self]; | |
} | |
-(CPMenu)menu | |
{ | |
return menu; | |
} | |
@end | |
@implementation MyWindow : CPWindow | |
{ | |
} | |
- (void)mouseDown:(CPEvent)event | |
{ | |
CPLogConsole(_cmd); | |
[CPMenu popUpContextMenu:[[CPApp delegate] menu] withEvent:event forView:nil]; | |
CPLogConsole(_cmd); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment