Return to Snippet

Revision: 63850
at June 13, 2013 01:08 by iHaz3-Dev


Initial Code
//
//  Document.m
//
//  Created by Cubi-Development 26/5/2013.
//  Copyright (c) 2013 Cubi-Development Inc. All rights reserved.
//
//
//  ^^^___^^^^^^_^^^^^_^^^^^^^^^___^^^^^^^^^^^^^^^_^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^_^^^
//  ^^/^__\^^^_|^|__^(_)^^^^^^^/^^^\_____^^^_____|^|^___^^_^__^^_^__^___^^^___^_^__^|^|_^
//  ^/^/^|^|^|^|^'_^\|^|_____^/^/\^/^_^\^\^/^/^_^\^|/^_^\|^'_^\|^'_^`^_^\^/^_^\^'_^\|^__|
//  /^/__|^|_|^|^|_)^|^|_____/^/_//^^__/\^V^/^^__/^|^(_)^|^|_)^|^|^|^|^|^|^^__/^|^|^|^|_^
//  \____/\__,_|_.__/|_|^^^^/___,'^\___|^\_/^\___|_|\___/|^.__/|_|^|_|^|_|\___|_|^|_|\__|
//  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|_|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//


@interface Tray : NSObject <NSApplicationDelegate> {
	NSStatusItem *trayItem;
}
@end
 
@implementation Tray
 
- (IBAction)testAction:(id)sender;
{
	NSLog(@"Hello Babe");
}
 
- (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


//  Copyright (c) 2013 Cubi-Development Inc. All rights reserved.

Initial URL

                                

Initial Description

                                

Initial Title
Adding to OS X Status Tray

Initial Tags

                                

Initial Language
Objective C