/ Published in: Objective C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// // Document.m // // Created by Cubi-Development 26/5/2013. // Copyright (c) 2013 Cubi-Development Inc. All rights reserved. // // // ^^^___^^^^^^_^^^^^_^^^^^^^^^___^^^^^^^^^^^^^^^_^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^_^^^ // ^^/^__\^^^_|^|__^(_)^^^^^^^/^^^\_____^^^_____|^|^___^^_^__^^_^__^___^^^___^_^__^|^|_^ // ^/^/^|^|^|^|^'_^\|^|_____^/^/\^/^_^\^\^/^/^_^\^|/^_^\|^'_^\|^'_^`^_^\^/^_^\^'_^\|^__| // /^/__|^|_|^|^|_)^|^|_____/^/_//^^__/\^V^/^^__/^|^(_)^|^|_)^|^|^|^|^|^|^^__/^|^|^|^|_^ // \____/\__,_|_.__/|_|^^^^/___,'^\___|^\_/^\___|_|\___/|^.__/|_|^|_|^|_|\___|_|^|_|\__| // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|_|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // NSStatusItem *trayItem; } @end @implementation Tray - (IBAction)testAction:(id)sender; { NSLog(@"Hello Babe"); } - (IBAction)quitAction:(id)sender; { [NSApp terminate:sender]; } { 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 setMenu:menu]; [trayItem setHighlightMode:YES]; [trayItem setTitle:@"HERE"]; } - (void)dealloc; { [trayItem release]; [super dealloc]; } @end // Copyright (c) 2013 Cubi-Development Inc. All rights reserved.