X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/26785f01d0acdf59b292af52689d457fe4c02a66..cc6dd35581586950ebcf7ef4493166001ec5a645:/src/cocoa/frame.mm diff --git a/src/cocoa/frame.mm b/src/cocoa/frame.mm index d4b5fbfa83..9e529f1187 100644 --- a/src/cocoa/frame.mm +++ b/src/cocoa/frame.mm @@ -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 #import @@ -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