]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/frame.mm
reSWIGed
[wxWidgets.git] / src / cocoa / frame.mm
index d4b5fbfa8387d24585dddf996e47557f3fb0647b..9e529f118713fe831ff6a366687339581c145d3f 100644 (file)
@@ -19,9 +19,8 @@
     #include "wx/statusbr.h"
 #endif // WX_PRECOMP
 
-#include "wx/menuitem.h"
-
 #include "wx/cocoa/autorelease.h"
+#include "wx/cocoa/mbarman.h"
 
 #import <AppKit/NSWindow.h>
 #import <AppKit/NSApplication.h>
@@ -57,37 +56,36 @@ wxFrame::~wxFrame()
     [m_frameNSView release];
 }
 
-void wxFrame::Cocoa_wxMenuItemAction(wxMenuItem& item)
-{
-    Command(item.GetId());
-}
-
 void wxFrame::AttachMenuBar(wxMenuBar *mbar)
 {
     wxFrameBase::AttachMenuBar(mbar);
-    if(m_frameMenuBar)
-    {
-        wxLogDebug("Attached menu");
-        [m_cocoaNSWindow setMenu:m_frameMenuBar->GetNSMenu()];
-    }
+    wxMenuBarManager::GetInstance()->UpdateMenuBar();
 }
 
 void wxFrame::DetachMenuBar()
 {
-    if(m_frameMenuBar)
+    wxFrameBase::DetachMenuBar();
+    wxMenuBarManager::GetInstance()->UpdateMenuBar();
+}
+
+void wxFrame::SetMenuBar(wxMenuBar *menubar)
+{
+    if ( menubar == GetMenuBar() )
     {
-        [m_cocoaNSWindow setMenu:nil];
+        // nothing to do
+        return;
     }
+
     wxFrameBase::DetachMenuBar();
+    wxFrameBase::AttachMenuBar(menubar);
+    wxMenuBarManager::GetInstance()->UpdateMenuBar();
 }
 
-bool wxFrame::Show(bool show)
+wxMenuBar* wxFrame::GetAppMenuBar(wxCocoaNSWindow *win)
 {
-    wxAutoNSAutoreleasePool pool;
-    bool ret = wxFrameBase::Show(show);
-    if(show && GetMenuBar())
-        [wxTheApp->GetNSApplication() setMenu:GetMenuBar()->GetNSMenu() ];
-    return ret;
+    if(GetMenuBar())
+        return GetMenuBar();
+    return wxFrameBase::GetAppMenuBar(win);
 }
 
 wxPoint wxFrame::GetClientAreaOrigin() const
@@ -106,6 +104,13 @@ void wxFrame::CocoaSetWxWindowSize(int width, int height)
     wxTopLevelWindow::CocoaSetWxWindowSize(width,height);
 }
 
+WX_NSView wxFrame::GetNonClientNSView()
+{
+    if(m_frameNSView)
+        return m_frameNSView;
+    return GetNSViewForSuperview();
+}
+
 void wxFrame::CocoaReplaceView(WX_NSView oldView, WX_NSView newView)
 {
     // If we have the additional toolbar/statbar view, then the