Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
UppHub
Status & Roadmap
FAQ
Authors & License
Forums
Funding U++
Search on this site











SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo

MacOS menu support

 

U++ applications without changes to support MacOS application menu will run with menu inside the window.

 

To properly support MacOS menu, application needs to provide different code for MacOS (conditional compilation depending on PLATFORM_COCOA macro). Usually, the changes are minimal, e.g. in Uword application the only change is

 

#ifdef PLATFORM_COCOA

    SetMainMenu(THISBACK(MainMenu));

#else

    AddFrame(menubar);

#endif

 

replacing the call to AddFrame to add the main menu bar with the call to TopWindow::SetMainMenu.

 

Other possibility is to omit AddFrame when PLATFORM_COCOA is defined and change menu setting code (which is called on any main menu changes) to something like

 

#ifdef PLATFORM_COCOA

    SetMainMenu(THISBACK(MainMenu));

#else

    menubar.Set(THISBACK(MainMenu));

#endif

 

Another MacOS feature is the dock menu. This can be set using TopWindow::WhenDockMenu.

 

 

TopWindow members for MacOS style menu support

 

Event<Bar&WhenDockMenu

Represents application dock menu. Gets called if TopWindow is on top and user invokes the dock menu for application (e.g. by right-click on application icon).

 


 

void SetMainMenu(Event<Bar&menu)

Sets the main application menu. This menu will be active if given toplevel TopWindow is on the top.

 

Do you want to contribute?