2

Do gktmm4 has macOS menubar integration? ​While googling, I found out that for GTK2/3 there is gtk-mac-integration, but what about gtkmm4?

I want my app to react on cmd+q and have working basic macOS menubar ( I mean item "App name" with about and quit items that every macOS app have).

Maybe there is a way to use objective-c code?

#import <Cocoa/Cocoa.h>

int menubarForm()
{
    [NSAutoreleasePool new];
    [NSApplication sharedApplication];
    [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
    id menubar = [[NSMenu new] autorelease];
    id appMenuItem = [[NSMenuItem new] autorelease];
    [menubar addItem:appMenuItem];
    [NSApp setMainMenu:menubar];
    id appMenu = [[NSMenu new] autorelease];
    id appName = [[NSProcessInfo processInfo] processName];
    id quitTitle = [@"Quit " stringByAppendingString:appName];
    id quitMenuItem = [[[NSMenuItem alloc] initWithTitle:quitTitle
        action:@selector(terminate:) keyEquivalent:@"q"] autorelease];
    [appMenu addItem:quitMenuItem];
    [appMenuItem setSubmenu:appMenu];

    return 0;
}

My app compiles if I change file extension to .mm, but it has no effect as this code doesn't know anything about gtkmm window...

0 Answers0