summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Slimber/Cocoa/CocoaMenulet.mm')
-rw-r--r--Slimber/Cocoa/CocoaMenulet.mm10
1 files changed, 10 insertions, 0 deletions
diff --git a/Slimber/Cocoa/CocoaMenulet.mm b/Slimber/Cocoa/CocoaMenulet.mm
index c159aa8..f9981e0 100644
--- a/Slimber/Cocoa/CocoaMenulet.mm
+++ b/Slimber/Cocoa/CocoaMenulet.mm
@@ -3,6 +3,7 @@
using namespace Swift;
CocoaMenulet::CocoaMenulet() {
+ delegate = [[CocoaMenuletDelegate alloc] initWithMenulet: this];
menu = [[NSMenu alloc] init];
statusItem = [[[NSStatusBar systemStatusBar]
@@ -14,8 +15,10 @@ CocoaMenulet::CocoaMenulet() {
}
CocoaMenulet::~CocoaMenulet() {
+ [delegate release];
[statusItem release];
[menu release];
+ [delegate release];
}
void CocoaMenulet::setIcon(const String& icon) {
@@ -54,6 +57,13 @@ void CocoaMenulet::addAboutItem() {
[item release];
}
+void CocoaMenulet::addRestartItem() {
+ NSMenuItem* item = [[NSMenuItem alloc] initWithTitle: @"Restart" action: @selector(handleRestartClicked:) keyEquivalent: @""];
+ [item setTarget: delegate];
+ [menu addItem: item];
+ [item release];
+}
+
void CocoaMenulet::addExitItem() {
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle: @"Exit" action: @selector(terminate:) keyEquivalent: @""];
[item setTarget: [NSApplication sharedApplication]];