From e1b14547b139a00b2bf10232c1918792e6cb1aff Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 15 Aug 2020 07:43:08 +0300 Subject: macOS: Inserting menus --- src/ui/macos.h | 2 +- src/ui/macos.m | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ui/macos.h b/src/ui/macos.h index bb991a61..a491e721 100644 --- a/src/ui/macos.h +++ b/src/ui/macos.h @@ -5,5 +5,5 @@ /* Platform-specific functionality for macOS */ void setupApplication_MacOS (void); -void insertMenuItems_MacOS (const char *menuLabel, const iMenuItem *items, size_t count); +void insertMenuItems_MacOS (const char *menuLabel, int atIndex, const iMenuItem *items, size_t count); void handleCommand_MacOS (const char *cmd); diff --git a/src/ui/macos.m b/src/ui/macos.m index dcae94e6..9ff2f96e 100644 --- a/src/ui/macos.m +++ b/src/ui/macos.m @@ -358,15 +358,14 @@ void setupApplication_MacOS(void) { windowCloseItem.action = @selector(closeTab); } -void insertMenuItems_MacOS(const char *menuLabel, const iMenuItem *items, size_t count) { +void insertMenuItems_MacOS(const char *menuLabel, int atIndex, const iMenuItem *items, size_t count) { NSApplication *app = [NSApplication sharedApplication]; MyDelegate *myDel = (MyDelegate *) app.delegate; NSMenu *appMenu = [app mainMenu]; NSMenuItem *mainItem = [appMenu insertItemWithTitle:[NSString stringWithUTF8String:menuLabel] action:nil keyEquivalent:@"" - atIndex:(iCmpStr(menuLabel, "File") == 0 ? 1 : - iCmpStr(menuLabel, "Edit") == 0 ? 2 : 3)]; + atIndex:atIndex]; NSMenu *menu = [[NSMenu alloc] initWithTitle:[NSString stringWithUTF8String:menuLabel]]; for (size_t i = 0; i < count; ++i) { const char *label = items[i].label; -- cgit v1.2.3