summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-15 07:43:08 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-15 07:43:08 +0300
commite1b14547b139a00b2bf10232c1918792e6cb1aff (patch)
treecb68592e8b0bfa7137f741c554a931c571662bdb /src
parentf01dd9cf06774173194fe4fcc5fcad1f6d87d2d9 (diff)
macOS: Inserting menus
Diffstat (limited to 'src')
-rw-r--r--src/ui/macos.h2
-rw-r--r--src/ui/macos.m5
2 files changed, 3 insertions, 4 deletions
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 @@
5/* Platform-specific functionality for macOS */ 5/* Platform-specific functionality for macOS */
6 6
7void setupApplication_MacOS (void); 7void setupApplication_MacOS (void);
8void insertMenuItems_MacOS (const char *menuLabel, const iMenuItem *items, size_t count); 8void insertMenuItems_MacOS (const char *menuLabel, int atIndex, const iMenuItem *items, size_t count);
9void handleCommand_MacOS (const char *cmd); 9void 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) {
358 windowCloseItem.action = @selector(closeTab); 358 windowCloseItem.action = @selector(closeTab);
359} 359}
360 360
361void insertMenuItems_MacOS(const char *menuLabel, const iMenuItem *items, size_t count) { 361void insertMenuItems_MacOS(const char *menuLabel, int atIndex, const iMenuItem *items, size_t count) {
362 NSApplication *app = [NSApplication sharedApplication]; 362 NSApplication *app = [NSApplication sharedApplication];
363 MyDelegate *myDel = (MyDelegate *) app.delegate; 363 MyDelegate *myDel = (MyDelegate *) app.delegate;
364 NSMenu *appMenu = [app mainMenu]; 364 NSMenu *appMenu = [app mainMenu];
365 NSMenuItem *mainItem = [appMenu insertItemWithTitle:[NSString stringWithUTF8String:menuLabel] 365 NSMenuItem *mainItem = [appMenu insertItemWithTitle:[NSString stringWithUTF8String:menuLabel]
366 action:nil 366 action:nil
367 keyEquivalent:@"" 367 keyEquivalent:@""
368 atIndex:(iCmpStr(menuLabel, "File") == 0 ? 1 : 368 atIndex:atIndex];
369 iCmpStr(menuLabel, "Edit") == 0 ? 2 : 3)];
370 NSMenu *menu = [[NSMenu alloc] initWithTitle:[NSString stringWithUTF8String:menuLabel]]; 369 NSMenu *menu = [[NSMenu alloc] initWithTitle:[NSString stringWithUTF8String:menuLabel]];
371 for (size_t i = 0; i < count; ++i) { 370 for (size_t i = 0; i < count; ++i) {
372 const char *label = items[i].label; 371 const char *label = items[i].label;