Basic User Interface is added
Change-Id: Ib2d972d320a6ac39fbba4b682845965f0ed3572d
diff --git a/osx/MainMenu.xib b/osx/MainMenu.xib
index c8a70f5..d470966 100644
--- a/osx/MainMenu.xib
+++ b/osx/MainMenu.xib
@@ -14,25 +14,71 @@
<customObject id="-3" userLabel="Application"/>
<customObject id="494" customClass="MenuDelegate">
<connections>
+ <outlet property="connectionStatus" destination="yhj-L6-nZL" id="v5Y-5B-2aW"/>
+ <outlet property="daemonStatus" destination="Tap-5m-ZRP" id="yrK-Nr-zKm"/>
+ <outlet property="routingStatus" destination="Vc8-fu-RAY" id="GVC-zB-uSO"/>
+ <outlet property="startstopButton" destination="TvT-OR-oT4" id="kEH-ls-jDL"/>
<outlet property="statusMenu" destination="ovl-jc-kIR" id="dlz-Qz-Ia0"/>
+ <outlet property="statusPopover" destination="eAA-vc-IW1" id="bD5-Rp-Syx"/>
+ <outlet property="trafficMap" destination="6tC-sG-tLM" id="rxz-Jt-3au"/>
</connections>
</customObject>
- <customObject id="420" customClass="NSFontManager"/>
<menu id="ovl-jc-kIR">
<items>
- <menuItem title="start" id="yhj-L6-nZL">
+ <menuItem title="Connected" id="yhj-L6-nZL">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
- <menuItem title="stop" id="TvT-OR-oT4">
+ <menuItem title="Stop" id="TvT-OR-oT4">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
- <menuItem title="ndnstatus" id="Tap-5m-ZRP">
+ <menuItem title="Status" id="Tap-5m-ZRP">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="openDaemonStatus:" target="494" id="EWq-Mc-qkx"/>
+ </connections>
+ </menuItem>
+ <menuItem id="E2p-41-2EY">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
- <menuItem title="Item" id="17X-uc-n9i">
+ <menuItem title="Routing Status" id="Vc8-fu-RAY">
<modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="openRoutingStatusPage:" target="494" id="Xzn-D8-pMm"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Traffic Map" id="6tC-sG-tLM">
+ <attributedString key="attributedTitle"/>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="openTrafficMapPage:" target="494" id="eae-R6-kYb"/>
+ </connections>
</menuItem>
</items>
</menu>
+ <viewController id="QoL-hX-ilM" userLabel="Popover View Controller">
+ <connections>
+ <outlet property="view" destination="pEE-BK-JGJ" id="aNk-Zu-Rlw"/>
+ </connections>
+ </viewController>
+ <popover id="eAA-vc-IW1">
+ <connections>
+ <outlet property="contentViewController" destination="QoL-hX-ilM" id="GKo-LB-19Q"/>
+ </connections>
+ </popover>
+ <customView id="pEE-BK-JGJ">
+ <rect key="frame" x="0.0" y="0.0" width="247" height="132"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <subviews>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="90x-3T-Z7e">
+ <rect key="frame" x="57" y="82" width="166" height="17"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="NDN Daemon Status" id="Di0-ug-aeg">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ </subviews>
+ </customView>
</objects>
-</document>
+</document>
\ No newline at end of file
diff --git a/osx/Resources/IconDisconnected.png b/osx/Resources/IconDisconnected.png
new file mode 100644
index 0000000..eb96e9c
--- /dev/null
+++ b/osx/Resources/IconDisconnected.png
Binary files differ
diff --git a/osx/menu-delegate.h b/osx/menu-delegate.h
index 6aa434f..429e6ea 100644
--- a/osx/menu-delegate.h
+++ b/osx/menu-delegate.h
@@ -10,8 +10,21 @@
@interface MenuDelegate : NSObject <NSApplicationDelegate>
{
- IBOutlet NSMenu *statusMenu;
- NSStatusItem * statusItem;
+ NSStatusItem *statusItem;
+ NSImage *menuIcon;
+
+ IBOutlet NSPopover *statusPopover;
+
+ IBOutlet NSMenu *statusMenu;
+ IBOutlet NSMenuItem *connectionStatus;
+ IBOutlet NSMenuItem *startstopButton;
+ IBOutlet NSMenuItem *daemonStatus;
+ IBOutlet NSMenuItem *routingStatus;
+ IBOutlet NSMenuItem *trafficMap;
}
-
+
+-(IBAction)openDaemonStatus:(id)sender;
+-(IBAction)openRoutingStatusPage:(id)sender;
+-(IBAction)openTrafficMapPage:(id)sender;
+
@end
diff --git a/osx/menu-delegate.mm b/osx/menu-delegate.mm
index 8418f6f..a425af2 100644
--- a/osx/menu-delegate.mm
+++ b/osx/menu-delegate.mm
@@ -15,18 +15,45 @@
// Insert code here to initialize your application
}
-// -(void)dealloc
-// {
-// [statusItem release];
-// [super dealloc];
-// }
-
-(void)awakeFromNib
{
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
- [statusItem setTitle:@"X"];
[statusItem setMenu:statusMenu];
+ [statusItem setToolTip:@"NDN Control Center"];
+ [statusItem setEnabled:YES];
+ //[statusItem setTitle:@"Status"];
[statusItem setHighlightMode:YES];
+ //[statusItem setTarget:self];
+
+ NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+ NSString *path = [bundle pathForResource:@"IconDisconnected" ofType:@"png"];
+ menuIcon = [[NSImage alloc] initWithContentsOfFile:path];
+ [statusItem setTitle:@""];
+ [statusItem setImage:menuIcon];
+}
+
+-(IBAction)openDaemonStatus:(id)sender
+{
+ [statusPopover showRelativeToRect:[[daemonStatus view] bounds]
+ ofView:[daemonStatus view]
+ preferredEdge:NSMinXEdge];
+
+ //[statusPopover showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge];
+}
+
+-(IBAction)openRoutingStatusPage:(id)sender
+{
+ NSURL *pageURL = [NSURL URLWithString:@"http://netlab.cs.memphis.edu/script/htm/status.htm"];
+
+ [[NSWorkspace sharedWorkspace] openURL: pageURL];
+}
+
+-(IBAction)openTrafficMapPage:(id)sender
+{
+
+ NSURL *pageURL = [NSURL URLWithString:@"http://ndnmap.arl.wustl.edu"];
+
+ [[NSWorkspace sharedWorkspace] openURL: pageURL];
}
@end