From: David Elliott <dfe@tgwbd.org>
Date: Thu, 6 Nov 2003 20:37:16 +0000 (+0000)
Subject: Add wxCocoaNSWindow* parameter to GetAppMenuBar so implementations can
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8ded703ddca4c6657625af80afa66a2dddd13dae

Add wxCocoaNSWindow* parameter to GetAppMenuBar so implementations can
return an alternate menubar based on the window which needs it


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24431 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/include/wx/cocoa/NSWindow.h b/include/wx/cocoa/NSWindow.h
index b7b51e8d0f..3bf28f62e0 100644
--- a/include/wx/cocoa/NSWindow.h
+++ b/include/wx/cocoa/NSWindow.h
@@ -34,7 +34,7 @@ public:
     virtual void CocoaDelegate_windowDidResignKey(void) { }
     virtual void CocoaDelegate_windowDidBecomeMain(void) { }
     virtual void CocoaDelegate_windowDidResignMain(void) { }
-    virtual wxMenuBar* GetAppMenuBar();
+    virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win);
 protected:
     static struct objc_object *sm_cocoaDelegate;
 };
diff --git a/include/wx/cocoa/frame.h b/include/wx/cocoa/frame.h
index 9d0fcc3a41..9851356a08 100644
--- a/include/wx/cocoa/frame.h
+++ b/include/wx/cocoa/frame.h
@@ -51,7 +51,7 @@ protected:
 // Cocoa specifics
 // ------------------------------------------------------------------------
 public:
-    virtual wxMenuBar* GetAppMenuBar();
+    virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win);
     // Returns the NSView for non-client drawing
     virtual WX_NSView GetNonClientNSView();
 protected:
diff --git a/include/wx/cocoa/toplevel.h b/include/wx/cocoa/toplevel.h
index 8e5f44bd97..ae5e610a11 100644
--- a/include/wx/cocoa/toplevel.h
+++ b/include/wx/cocoa/toplevel.h
@@ -67,7 +67,7 @@ public:
     virtual void CocoaDelegate_windowDidResignKey(void);
     virtual void CocoaDelegate_windowDidBecomeMain(void);
     virtual void CocoaDelegate_windowDidResignMain(void);
-    virtual wxMenuBar* GetAppMenuBar();
+    virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win);
 protected:
     void SetNSWindow(WX_NSWindow cocoaNSWindow);
     WX_NSWindow m_cocoaNSWindow;
diff --git a/src/cocoa/NSWindow.mm b/src/cocoa/NSWindow.mm
index e54df93101..aef1f0ead5 100644
--- a/src/cocoa/NSWindow.mm
+++ b/src/cocoa/NSWindow.mm
@@ -124,7 +124,7 @@ void wxCocoaNSWindow::DisassociateNSWindow(WX_NSWindow cocoaNSWindow)
     }
 }
 
-wxMenuBar* wxCocoaNSWindow::GetAppMenuBar()
+wxMenuBar* wxCocoaNSWindow::GetAppMenuBar(wxCocoaNSWindow *win)
 {
     return NULL;
 }
diff --git a/src/cocoa/frame.mm b/src/cocoa/frame.mm
index e7ed47ceef..b37aaa181f 100644
--- a/src/cocoa/frame.mm
+++ b/src/cocoa/frame.mm
@@ -81,11 +81,11 @@ void wxFrame::SetMenuBar(wxMenuBar *menubar)
     wxMenuBarManager::GetInstance()->UpdateWindowMenuBar(this);
 }
 
-wxMenuBar* wxFrame::GetAppMenuBar()
+wxMenuBar* wxFrame::GetAppMenuBar(wxCocoaNSWindow *win)
 {
     if(GetMenuBar())
         return GetMenuBar();
-    return wxFrameBase::GetAppMenuBar();
+    return wxFrameBase::GetAppMenuBar(win);
 }
 
 wxPoint wxFrame::GetClientAreaOrigin() const
diff --git a/src/cocoa/mbarman.mm b/src/cocoa/mbarman.mm
index f6c52d21be..e672517182 100644
--- a/src/cocoa/mbarman.mm
+++ b/src/cocoa/mbarman.mm
@@ -272,7 +272,7 @@ void wxMenuBarManager::InstallMenuBarForWindow(wxCocoaNSWindow *win)
 {
     wxASSERT(win);
     m_windowCurrent = win;
-    wxMenuBar *menubar = win->GetAppMenuBar();
+    wxMenuBar *menubar = win->GetAppMenuBar(win);
     wxLogDebug("Found menubar=%p for window=%p.",menubar,win);
     SetMenuBar(menubar);
 }
diff --git a/src/cocoa/toplevel.mm b/src/cocoa/toplevel.mm
index 121c6ffdba..de8ad02661 100644
--- a/src/cocoa/toplevel.mm
+++ b/src/cocoa/toplevel.mm
@@ -134,11 +134,11 @@ wxTopLevelWindowCocoa::~wxTopLevelWindowCocoa()
 // wxTopLevelWindowCocoa Cocoa Specifics
 // ----------------------------------------------------------------------------
 
-wxMenuBar* wxTopLevelWindowCocoa::GetAppMenuBar()
+wxMenuBar* wxTopLevelWindowCocoa::GetAppMenuBar(wxCocoaNSWindow *win)
 {
     wxTopLevelWindowCocoa *parent = wxDynamicCast(GetParent(),wxTopLevelWindow);
     if(parent)
-        return parent->GetAppMenuBar();
+        return parent->GetAppMenuBar(win);
     return NULL;
 }