Add items app section in native menu

Is there a way I can add items to the section right next to the apple menu, the one that has the ‘Hide Others’ and ‘Quit App’ entries?

You have to create the PopupMenu before calling MenuBarModel::setMacMainMenu just like this:

PopupMenu extra_menu;
extra_menu.addItem (kShowAbout, T("About Your App"));
extra_menu.addSeparator();
extra_menu.addCommandItem(mApplicationCommandManager, kShowAudioPreferences, T("Preferences..."));
MenuBarModel::setMacMainMenu (this, &extra_menu);

I uses the addCommandItem combined with an ApplicationCommandManager to add shortcut to the Preferences item (“cmd + ,” like standard Mac OS app).

Cheers,
Kevin

awesome. That worked. Thank you.

How is this done in the Juce 2.0?

I tried this from my application’s initialization routine:

#if JUCE_MAC
PopupMenu pop;
pop.addItem(123, “Preferences…”);
MenuBarModel::setMacMainMenu(MenuBarModel::getMacMainMenu(), &pop);
#endif

Nothing appears in the Apple (application) menu.

Yeah, it does work. I just checked by inserting that code in the introjucer, and it works just fine.

Then there’s something a-miss with my application, which was generated from Introjucer. I’ve barely modified it.

I ended up having to make my own MenuBarModel instead of using MenuBarModel::getMacMainMenu()

Same here, only working with a custom MenuBarModel.