X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6a57bd93ad118049af9a5b2c07e01254f625f6a2..66f75561893ea7b4bf429d1882d9cc0407ba932d:/src/osx/menu_osx.cpp diff --git a/src/osx/menu_osx.cpp b/src/osx/menu_osx.cpp index e251fa461d..9c0d904ae8 100644 --- a/src/osx/menu_osx.cpp +++ b/src/osx/menu_osx.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: menu.cpp 54129 2008-06-11 19:30:52Z SC $ +// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -440,6 +440,12 @@ bool wxMenu::HandleCommandProcess( wxMenuItem* item, wxWindow* senderWindow ) processed = true ; } } + + if(!processed && item) + { + processed = item->GetPeer()->DoDefault(); + } + return processed; } @@ -515,13 +521,46 @@ 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 ) + { + wxString aboutLabel(_("About")); + if ( wxTheApp ) + aboutLabel << ' ' << wxTheApp->GetAppDisplayName(); + else + aboutLabel << "..."; + m_appleMenu->Append( wxApp::s_macAboutMenuItemId, aboutLabel); + m_appleMenu->AppendSeparator(); + } + #if !wxOSX_USE_CARBON - m_appleMenu->Append( wxApp::s_macPreferencesMenuItemId, "Preferences..." ); + if ( wxApp::s_macPreferencesMenuItemId != wxID_NONE ) + { + m_appleMenu->Append( wxApp::s_macPreferencesMenuItemId, + _("Preferences...") + "\tCtrl+," ); + m_appleMenu->AppendSeparator(); + } + + // standard menu items, handled in wxMenu::HandleCommandProcess(), see above: + wxString hideLabel(_("Hide")); + if ( wxTheApp ) + hideLabel << ' ' << wxTheApp->GetAppDisplayName(); + hideLabel << "\tCtrl+H"; + m_appleMenu->Append( wxID_OSX_HIDE, hideLabel ); + m_appleMenu->Append( wxID_OSX_HIDEOTHERS, _("Hide Others")+"\tAlt+Ctrl+H" ); + m_appleMenu->Append( wxID_OSX_SHOWALL, _("Show All") ); m_appleMenu->AppendSeparator(); - m_appleMenu->Append( wxApp::s_macExitMenuItemId, "Quit\tCtrl+Q" ); -#endif + + // Do always add "Quit" item unconditionally however, it can't be disabled. + wxString quitLabel(_("Quit")); + if ( wxTheApp ) + quitLabel << ' ' << wxTheApp->GetAppDisplayName(); + quitLabel << "\tCtrl+Q"; + m_appleMenu->Append( wxApp::s_macExitMenuItemId, quitLabel ); +#endif // !wxOSX_USE_CARBON m_rootMenu->AppendSubMenu(m_appleMenu, "\x14") ; }