From c1f12896c2ffc31cb757a2ec1cbc6ae8cbe46dbb Mon Sep 17 00:00:00 2001 From: David Elliott Date: Mon, 6 Oct 2003 18:54:59 +0000 Subject: [PATCH] * Add bool parameter to WindowDidResignKey indicating whether the menu bar should be changed to the common menubar or remain installed. * Add back some assertions to ensure the code is working as intended. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/cocoa/mbarman.h | 2 +- src/cocoa/mbarman.mm | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/wx/cocoa/mbarman.h b/include/wx/cocoa/mbarman.h index f21dac7899..52a8c058c7 100644 --- a/include/wx/cocoa/mbarman.h +++ b/include/wx/cocoa/mbarman.h @@ -43,7 +43,7 @@ public: void SetMainMenuBar(wxMenuBar* menubar); void CocoaInternalIdle(); void WindowDidBecomeKey(wxTopLevelWindowNative *win); - void WindowDidResignKey(wxTopLevelWindowNative *win); + void WindowDidResignKey(wxTopLevelWindowNative *win, bool uninstallMenuBar = true); void WindowDidBecomeMain(wxTopLevelWindowNative *win); void WindowDidResignMain(wxTopLevelWindowNative *win); void UpdateWindowMenuBar(wxTopLevelWindowNative *win); diff --git a/src/cocoa/mbarman.mm b/src/cocoa/mbarman.mm index b2b916054d..ecdd3d3c16 100644 --- a/src/cocoa/mbarman.mm +++ b/src/cocoa/mbarman.mm @@ -161,21 +161,22 @@ void wxMenuBarManager::InstallMainMenu() void wxMenuBarManager::WindowDidBecomeKey(wxTopLevelWindowNative *win) { -// wxASSERT(!m_windowKey); + wxASSERT(!m_windowKey); m_windowKey = win; InstallMenuBarForWindow(win); } -void wxMenuBarManager::WindowDidResignKey(wxTopLevelWindowNative *win) +void wxMenuBarManager::WindowDidResignKey(wxTopLevelWindowNative *win, bool uninstallMenuBar) { wxASSERT(m_windowKey==win); m_windowKey = NULL; - SetMenuBar(NULL); + if(uninstallMenuBar) + SetMenuBar(NULL); } void wxMenuBarManager::WindowDidBecomeMain(wxTopLevelWindowNative *win) { -// wxASSERT(!m_windowMain); + wxASSERT(!m_windowMain); m_windowMain = win; }