I would just like to know if it is safe to remove menus just after their creation on OSX.
My app has just 2 menu entries : Exit and About.
On OSX, these 2 menu items are handled by the osx-specific menu so I don't need the "File" and "Help" menus witch became empty.
But I have to create them in order to let the About and Exit entries created and affected to the specific menu.
So, here is what I've done :
Code: Select all
// Create the menu bar
wxMenuBar *menuBar = new wxMenuBar();
// File menu
wxMenu *fileMenu = new wxMenu();
fileMenu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT, wxSTOCK_WITH_MNEMONIC|wxSTOCK_WITH_ACCELERATOR), wxGetStockHelpString(wxID_EXIT));
menuBar->Append(fileMenu, wxGetStockLabel(wxID_FILE));
// Help menu
wxMenu* helpMenu = new wxMenu();
helpMenu->Append(wxID_ABOUT, wxGetStockLabel(wxID_ABOUT, wxSTOCK_WITH_MNEMONIC|wxSTOCK_WITH_ACCELERATOR), wxGetStockHelpString(wxID_ABOUT));
menuBar->Append(helpMenu, wxGetStockLabel(wxID_HELP));
SetMenuBar(menuBar);
#ifdef __WXMAC__
menuBar->Remove(1); // Remove the empty help menu
menuBar->Remove(0); // Remove the empty File menu
#endif // __WXMAC__
Regards
Xav'