From: David Elliott Date: Thu, 4 Sep 2003 21:16:41 +0000 (+0000) Subject: * Added virtual GetAppMenuBar() which returns the app-wide menubar which X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/33faea0a0d17e22a771d96573576bf143fd56e54 * Added virtual GetAppMenuBar() which returns the app-wide menubar which would be appropriate for this window, or NULL if the manager should decide * Added Become/Resign Main handlers * For all Become/Resign Main/Key handlers, notify the menubar manager git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23385 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/cocoa/toplevel.h b/include/wx/cocoa/toplevel.h index 8fb7a4623a..516f8eb7c5 100644 --- a/include/wx/cocoa/toplevel.h +++ b/include/wx/cocoa/toplevel.h @@ -15,6 +15,8 @@ #include "wx/hashmap.h" #include "wx/cocoa/NSWindow.h" +class WXDLLEXPORT wxMenuBar; + // ======================================================================== // wxTopLevelWindowCocoa // ======================================================================== @@ -63,6 +65,9 @@ public: virtual bool CocoaDelegate_windowShouldClose(void); virtual void CocoaDelegate_windowDidBecomeKey(void); virtual void CocoaDelegate_windowDidResignKey(void); + virtual void CocoaDelegate_windowDidBecomeMain(void); + virtual void CocoaDelegate_windowDidResignMain(void); + virtual wxMenuBar* GetAppMenuBar() { return NULL; } protected: void SetNSWindow(WX_NSWindow cocoaNSWindow); WX_NSWindow m_cocoaNSWindow; diff --git a/src/cocoa/toplevel.mm b/src/cocoa/toplevel.mm index 7535026a54..39fa6a5b25 100644 --- a/src/cocoa/toplevel.mm +++ b/src/cocoa/toplevel.mm @@ -29,6 +29,7 @@ #endif //WX_PRECOMP #include "wx/cocoa/autorelease.h" +#include "wx/cocoa/mbarman.h" #import #import @@ -131,6 +132,7 @@ void wxTopLevelWindowCocoa::CocoaReplaceView(WX_NSView oldView, WX_NSView newVie void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeKey(void) { wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeKey",this); + wxMenuBarManager::GetInstance()->WindowDidBecomeKey(this); wxActivateEvent event(wxEVT_ACTIVATE, TRUE, GetId()); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); @@ -142,6 +144,19 @@ void wxTopLevelWindowCocoa::CocoaDelegate_windowDidResignKey(void) wxActivateEvent event(wxEVT_ACTIVATE, FALSE, GetId()); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); + wxMenuBarManager::GetInstance()->WindowDidResignKey(this); +} + +void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeMain(void) +{ + wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeMain",this); + wxMenuBarManager::GetInstance()->WindowDidBecomeMain(this); +} + +void wxTopLevelWindowCocoa::CocoaDelegate_windowDidResignMain(void) +{ + wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidResignMain",this); + wxMenuBarManager::GetInstance()->WindowDidResignMain(this); } void wxTopLevelWindowCocoa::Cocoa_close(void)