X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/524c47aa3adf2af11a3069fd5da035a604f08f66..b5a9b87e1620e52f1f13d2619b4677f2b365c93f:/src/osx/menu_osx.cpp diff --git a/src/osx/menu_osx.cpp b/src/osx/menu_osx.cpp index c2ac17c2e9..3ba608e8a6 100644 --- a/src/osx/menu_osx.cpp +++ b/src/osx/menu_osx.cpp @@ -18,6 +18,8 @@ #include "wx/wxprec.h" +#if wxUSE_MENUS + #include "wx/menu.h" #ifndef WX_PRECOMP @@ -163,7 +165,7 @@ void wxMenu::EndRadioGroup() wxMenuItem* wxMenu::DoAppend(wxMenuItem *item) { - wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") ); + wxCHECK_MSG( item, NULL, wxT("NULL item in wxMenu::DoAppend") ); bool check = false; @@ -195,7 +197,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item) } else { - wxFAIL_MSG( _T("where is the radio group start item?") ); + wxFAIL_MSG( wxT("where is the radio group start item?") ); } } } @@ -329,7 +331,7 @@ void wxMenu::DoRearrange() { // next (i.e. second as we must be first) item is // the separator to hide - wxASSERT_MSG( pos == 0, _T("should be the menu start") ); + wxASSERT_MSG( pos == 0, wxT("should be the menu start") ); sepToHide = next; } else if ( GetMenuItems().GetCount() == pos + 1 && @@ -501,20 +503,19 @@ void wxMenuBar::Init() { m_eventHandler = this; m_menuBarFrame = NULL; - m_invokingWindow = (wxWindow*) NULL; + m_invokingWindow = NULL; m_rootMenu = new wxMenu(); - wxMenu* applemenu = new wxMenu(); - applemenu->SetAllowRearrange(false); - applemenu->Append( wxApp::s_macAboutMenuItemId, "About..." ); - applemenu->AppendSeparator(); - applemenu->Append( wxApp::s_macPreferencesMenuItemId, "Preferences..." ); - applemenu->AppendSeparator(); - -#if ! wxOSX_USE_CARBON - applemenu->Append( wxApp::s_macExitMenuItemId, "Quit\tCtrl+Q" ); + m_appleMenu = new wxMenu(); + m_appleMenu->SetAllowRearrange(false); + m_appleMenu->Append( wxApp::s_macAboutMenuItemId, "About..." ); + m_appleMenu->AppendSeparator(); +#if !wxOSX_USE_CARBON + m_appleMenu->Append( wxApp::s_macPreferencesMenuItemId, "Preferences..." ); + m_appleMenu->AppendSeparator(); + m_appleMenu->Append( wxApp::s_macExitMenuItemId, "Quit\tCtrl+Q" ); #endif - m_rootMenu->AppendSubMenu(applemenu, "\x14") ; + m_rootMenu->AppendSubMenu(m_appleMenu, "\x14") ; } wxMenuBar::wxMenuBar() @@ -565,6 +566,7 @@ void wxMenuBar::MacInstallMenuBar() return ; m_rootMenu->GetPeer()->MakeRoot(); + // DisableMenuCommand( NULL , kHICommandPreferences ) ; #if 0 MenuBarHandle menubar = NULL ; @@ -890,7 +892,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) static void wxMenubarUnsetInvokingWindow( wxMenu *menu ) { - menu->SetInvokingWindow( (wxWindow*) NULL ); + menu->SetInvokingWindow( NULL ); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); while (node) @@ -921,7 +923,9 @@ static void wxMenubarSetInvokingWindow( wxMenu *menu, wxWindow *win ) void wxMenuBar::UnsetInvokingWindow() { - m_invokingWindow = (wxWindow*) NULL; + m_invokingWindow = NULL; + wxMenubarUnsetInvokingWindow(m_appleMenu); + wxMenu *menu; wxMenuList::compatibility_iterator node = m_menus.GetFirst(); @@ -937,6 +941,8 @@ void wxMenuBar::UnsetInvokingWindow() void wxMenuBar::SetInvokingWindow(wxFrame *frame) { m_invokingWindow = frame; + wxMenubarSetInvokingWindow(m_appleMenu, frame); + wxMenu *menu; wxMenuList::compatibility_iterator node = m_menus.GetFirst(); @@ -991,3 +997,5 @@ wxMenuItem *wxMenuBar::FindItem(int id, wxMenu **itemMenu) const return item; } + +#endif