diff options
Diffstat (limited to 'Nim/Cocoa/Menulet.m')
-rw-r--r-- | Nim/Cocoa/Menulet.m | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Nim/Cocoa/Menulet.m b/Nim/Cocoa/Menulet.m new file mode 100644 index 0000000..02615ac --- /dev/null +++ b/Nim/Cocoa/Menulet.m @@ -0,0 +1,32 @@ +#import "Menulet.h" + +@implementation Menulet + +- (void) dealloc { + [statusItem release]; + [super dealloc]; +} + +- (void) awakeFromNib { + statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength: NSVariableStatusItemLength] retain]; + [statusItem setHighlightMode: YES]; + [statusItem setTitle: [NSString stringWithFormat:@"%C",0x2295]]; + [statusItem setEnabled: YES]; + [statusItem setToolTip: @"Slimber"]; + [statusItem setMenu: statusMenu]; + + NSMenuItem* statusMenuItem = [[NSMenuItem alloc] initWithTitle: @"Online Users" action: NULL keyEquivalent:@""]; + [statusMenu addItem: statusMenuItem]; + [statusMenu addItem: [NSMenuItem separatorItem]]; + NSMenuItem* loggedInItem = [[NSMenuItem alloc] initWithTitle: @"You are not logged in" action: NULL keyEquivalent:@""]; + [statusMenu addItem: loggedInItem]; +} + +- (IBAction) updateStatus: (id) sender { + [statusItem setTitle: [NSString stringWithString:@"Boo"]]; + NSMenuItem* statusMenuItem = [[NSMenuItem alloc] initWithTitle: @"Foo" action: @selector(updateStatus:) keyEquivalent:@""]; + [statusMenuItem setTitle:[NSString stringWithString:@"Boo"]]; + [statusMenu insertItem: statusMenuItem atIndex:1]; +} + +@end
\ No newline at end of file |