Revision: 54147
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 12, 2011 13:23 by CreativeNerds
Initial Code
@interface Tray : NSObject <NSApplicationDelegate> { NSStatusItem *trayItem; } @end @implementation Tray - (IBAction)testAction:(id)sender; { NSLog(@"Hello World"); } - (IBAction)quitAction:(id)sender; { [NSApp terminate:sender]; } - (void)applicationDidFinishLaunching:(NSNotification *)note; { NSZone *zone = [NSMenu menuZone]; NSMenu *menu = [[[NSMenu allocWithZone:zone] init] autorelease]; NSMenuItem *item; item = [menu addItemWithTitle:@"Testing" action:@selector(testAction:) keyEquivalent:@""]; [item setTarget:self]; item = [menu addItemWithTitle:@"Quit" action:@selector(quitAction:) keyEquivalent:@""]; [item setTarget:self]; trayItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; [trayItem setMenu:menu]; [trayItem setHighlightMode:YES]; [trayItem setTitle:@"HERE"]; } - (void)dealloc; { [trayItem release]; [super dealloc]; } @end
Initial URL
Initial Description
Initial Title
Adding to OS X Status Tray
Initial Tags
Development
Initial Language
Objective C