Allow setting Mac-specific menu item ids to wxID_NONE to suppress them.
If s_macAboutMenuItemId or s_macPreferencesMenuItemId was explicitly set to wxID_NONE by the application, don't add them to the standard menu at all, otherwise they would be present there but be always disabled and useless. This is still not documented because we really need a better API for this but it at least provides a temporary workaround for having useless menu items under OS X. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65560 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -515,13 +515,26 @@ void wxMenuBar::Init()
|
||||
|
||||
m_appleMenu = new wxMenu();
|
||||
m_appleMenu->SetAllowRearrange(false);
|
||||
m_appleMenu->Append( wxApp::s_macAboutMenuItemId, "About..." );
|
||||
m_appleMenu->AppendSeparator();
|
||||
|
||||
// Create standard items unless the application explicitly disabled this by
|
||||
// setting the corresponding ids to wxID_NONE: although this is not
|
||||
// recommended, sometimes these items really don't make sense.
|
||||
if ( wxApp::s_macAboutMenuItemId != wxID_NONE )
|
||||
{
|
||||
m_appleMenu->Append( wxApp::s_macAboutMenuItemId, "About..." );
|
||||
m_appleMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
#if !wxOSX_USE_CARBON
|
||||
m_appleMenu->Append( wxApp::s_macPreferencesMenuItemId, "Preferences..." );
|
||||
m_appleMenu->AppendSeparator();
|
||||
if ( wxApp::s_macPreferencesMenuItemId != wxID_NONE )
|
||||
{
|
||||
m_appleMenu->Append( wxApp::s_macPreferencesMenuItemId, "Preferences..." );
|
||||
m_appleMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
// Do always add "Quit" item unconditionally however, it can't be disabled.
|
||||
m_appleMenu->Append( wxApp::s_macExitMenuItemId, "Quit\tCtrl+Q" );
|
||||
#endif
|
||||
#endif // !wxOSX_USE_CARBON
|
||||
|
||||
m_rootMenu->AppendSubMenu(m_appleMenu, "\x14") ;
|
||||
}
|
||||
|
Reference in New Issue
Block a user