X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6524e8f0ee026f11c2a36e72fe8cb9425deb8e89..b28a58d71c645a11d5ccacecbff78bfe58683105:/src/mac/carbon/menu.cpp diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index 490a71deec..a2df94bd84 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -37,10 +37,8 @@ // ---------------------- #include -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler) IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler) -#endif // the (popup) menu title has this special id static const int idMenuTitle = -3; @@ -248,7 +246,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) } } // if we're already attached to the menubar, we must update it - if ( IsAttached() ) + if ( IsAttached() && GetMenuBar()->IsAttached() ) { GetMenuBar()->Refresh(); } @@ -344,7 +342,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) ::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1); - if ( IsAttached() ) + if ( IsAttached() && GetMenuBar()->IsAttached() ) { // otherwise, the change won't be visible GetMenuBar()->Refresh(); @@ -569,6 +567,8 @@ auto-merge for MDI in case this will be necessary wxMenuBar* wxMenuBar::s_macInstalledMenuBar = NULL ; wxMenuBar* wxMenuBar::s_macCommonMenuBar = NULL ; +bool wxMenuBar::s_macAutoWindowMenu = true ; +WXHMENU wxMenuBar::s_macWindowMenuHandle = NULL ; void wxMenuBar::Init() { @@ -653,7 +653,7 @@ void wxMenuBar::MacInstallMenuBar() MacInsertMenu( appleMenu , 0 ) ; // clean-up the help menu before adding new items - MenuHandle mh = NULL ; + static MenuHandle mh = NULL ; if ( mh != NULL ) { @@ -777,6 +777,14 @@ void wxMenuBar::MacInstallMenuBar() UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ; } } + if ( GetAutoWindowMenu() ) + { + if ( MacGetWindowMenuHMenu() == NULL ) + { + CreateStandardWindowMenu( 0 , (MenuHandle*) &s_macWindowMenuHandle ) ; + } + InsertMenu( (MenuHandle) MacGetWindowMenuHMenu() , 0 ) ; + } ::DrawMenuBar() ; s_macInstalledMenuBar = this; }