]> git.saurik.com Git - wxWidgets.git/commitdiff
* Added virtual GetAppMenuBar() which returns the app-wide menubar which
authorDavid Elliott <dfe@tgwbd.org>
Thu, 4 Sep 2003 21:16:41 +0000 (21:16 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Thu, 4 Sep 2003 21:16:41 +0000 (21:16 +0000)
  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

include/wx/cocoa/toplevel.h
src/cocoa/toplevel.mm

index 8fb7a4623aee1dacde4408a78719f5b67f9f781c..516f8eb7c5c08f31e056a1210dac990955d5ec5b 100644 (file)
@@ -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;
index 7535026a54b737e61ed669079326284868c60e22..39fa6a5b2555dd16f47c4a5b83481ec2948757e5 100644 (file)
@@ -29,6 +29,7 @@
 #endif //WX_PRECOMP
 
 #include "wx/cocoa/autorelease.h"
+#include "wx/cocoa/mbarman.h"
 
 #import <AppKit/NSView.h>
 #import <AppKit/NSWindow.h>
@@ -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)