Alexander Afanasyev | 88f0b3a | 2013-09-24 23:52:08 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * @copyright See LICENCE for copyright and license information. |
| 4 | * |
| 5 | * @author Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 6 | * @author Ilya Moiseenko <iliamo@ucla.edu> |
| 7 | */ |
| 8 | |
| 9 | #import "menu-delegate.h" |
| 10 | |
| 11 | @implementation MenuDelegate |
| 12 | |
| 13 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification |
| 14 | { |
| 15 | // Insert code here to initialize your application |
| 16 | } |
| 17 | |
Alexander Afanasyev | 88f0b3a | 2013-09-24 23:52:08 -0700 | [diff] [blame] | 18 | -(void)awakeFromNib |
| 19 | { |
| 20 | statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; |
Alexander Afanasyev | 88f0b3a | 2013-09-24 23:52:08 -0700 | [diff] [blame] | 21 | [statusItem setMenu:statusMenu]; |
Ilya Moiseenko | 350b9b5 | 2013-09-25 16:38:41 -0700 | [diff] [blame^] | 22 | [statusItem setToolTip:@"NDN Control Center"]; |
| 23 | [statusItem setEnabled:YES]; |
| 24 | //[statusItem setTitle:@"Status"]; |
Alexander Afanasyev | 88f0b3a | 2013-09-24 23:52:08 -0700 | [diff] [blame] | 25 | [statusItem setHighlightMode:YES]; |
Ilya Moiseenko | 350b9b5 | 2013-09-25 16:38:41 -0700 | [diff] [blame^] | 26 | //[statusItem setTarget:self]; |
| 27 | |
| 28 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; |
| 29 | NSString *path = [bundle pathForResource:@"IconDisconnected" ofType:@"png"]; |
| 30 | menuIcon = [[NSImage alloc] initWithContentsOfFile:path]; |
| 31 | [statusItem setTitle:@""]; |
| 32 | [statusItem setImage:menuIcon]; |
| 33 | } |
| 34 | |
| 35 | -(IBAction)openDaemonStatus:(id)sender |
| 36 | { |
| 37 | [statusPopover showRelativeToRect:[[daemonStatus view] bounds] |
| 38 | ofView:[daemonStatus view] |
| 39 | preferredEdge:NSMinXEdge]; |
| 40 | |
| 41 | //[statusPopover showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge]; |
| 42 | } |
| 43 | |
| 44 | -(IBAction)openRoutingStatusPage:(id)sender |
| 45 | { |
| 46 | NSURL *pageURL = [NSURL URLWithString:@"http://netlab.cs.memphis.edu/script/htm/status.htm"]; |
| 47 | |
| 48 | [[NSWorkspace sharedWorkspace] openURL: pageURL]; |
| 49 | } |
| 50 | |
| 51 | -(IBAction)openTrafficMapPage:(id)sender |
| 52 | { |
| 53 | |
| 54 | NSURL *pageURL = [NSURL URLWithString:@"http://ndnmap.arl.wustl.edu"]; |
| 55 | |
| 56 | [[NSWorkspace sharedWorkspace] openURL: pageURL]; |
Alexander Afanasyev | 88f0b3a | 2013-09-24 23:52:08 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | @end |