Skip to content

Instantly share code, notes, and snippets.

@cacaodev
Created December 3, 2009 13:41
Show Gist options
  • Save cacaodev/248163 to your computer and use it in GitHub Desktop.
Save cacaodev/248163 to your computer and use it in GitHub Desktop.
@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