aboutsummaryrefslogtreecommitdiffstats
path: root/systray_darwin.m
diff options
context:
space:
mode:
Diffstat (limited to 'systray_darwin.m')
-rw-r--r--systray_darwin.m32
1 files changed, 32 insertions, 0 deletions
diff --git a/systray_darwin.m b/systray_darwin.m
index 03a21ef..3a28c73 100644
--- a/systray_darwin.m
+++ b/systray_darwin.m
@@ -108,6 +108,28 @@
}
}
+- (void) hide_menu_item:(NSNumber*) menuId
+{
+ NSMenuItem* menuItem;
+ int existedMenuIndex = [menu indexOfItemWithRepresentedObject: menuId];
+ if (existedMenuIndex == -1) {
+ return;
+ }
+ menuItem = [menu itemAtIndex: existedMenuIndex];
+ [menuItem setHidden:TRUE];
+}
+
+- (void) show_menu_item:(NSNumber*) menuId
+{
+ NSMenuItem* menuItem;
+ int existedMenuIndex = [menu indexOfItemWithRepresentedObject: menuId];
+ if (existedMenuIndex == -1) {
+ return;
+ }
+ menuItem = [menu itemAtIndex: existedMenuIndex];
+ [menuItem setHidden:FALSE];
+}
+
- (void) quit
{
[NSApp terminate:self];
@@ -156,6 +178,16 @@ void add_or_update_menu_item(int menuId, char* title, char* tooltip, short disab
runInMainThread(@selector(add_or_update_menu_item:), (id)item);
}
+void hide_menu_item(int menuId) {
+ NSNumber *mId = [NSNumber numberWithInt:menuId];
+ runInMainThread(@selector(hide_menu_item:), (id)mId);
+}
+
+void show_menu_item(int menuId) {
+ NSNumber *mId = [NSNumber numberWithInt:menuId];
+ runInMainThread(@selector(show_menu_item:), (id)mId);
+}
+
void quit() {
runInMainThread(@selector(quit), nil);
}