X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2fc2d511d0f095ab5de3713cff6042832f886d15..e4f1a68ad1a4c145878a7595c06859d3d59fc6e7:/src/cocoa/frame.mm diff --git a/src/cocoa/frame.mm b/src/cocoa/frame.mm index 3c40bc0f66..f74bbf4a0a 100644 --- a/src/cocoa/frame.mm +++ b/src/cocoa/frame.mm @@ -20,6 +20,7 @@ #endif // WX_PRECOMP #include "wx/cocoa/autorelease.h" +#include "wx/cocoa/mbarman.h" #import #import @@ -58,29 +59,26 @@ wxFrame::~wxFrame() void wxFrame::AttachMenuBar(wxMenuBar *mbar) { wxFrameBase::AttachMenuBar(mbar); - if(m_frameMenuBar) - { - wxLogDebug("Attached menu"); - [m_cocoaNSWindow setMenu:m_frameMenuBar->GetNSMenu()]; - } + wxMenuBarManager::GetInstance()->UpdateWindowMenuBar(this); } void wxFrame::DetachMenuBar() { - if(m_frameMenuBar) - { - [m_cocoaNSWindow setMenu:nil]; - } wxFrameBase::DetachMenuBar(); + wxMenuBarManager::GetInstance()->UpdateWindowMenuBar(this); } -bool wxFrame::Show(bool show) +void wxFrame::SetMenuBar(wxMenuBar *menubar) { - wxAutoNSAutoreleasePool pool; - bool ret = wxFrameBase::Show(show); - if(show && GetMenuBar()) - [wxTheApp->GetNSApplication() setMenu:GetMenuBar()->GetNSMenu() ]; - return ret; + if ( menubar == GetMenuBar() ) + { + // nothing to do + return; + } + + wxFrameBase::DetachMenuBar(); + wxFrameBase::AttachMenuBar(menubar); + wxMenuBarManager::GetInstance()->UpdateWindowMenuBar(this); } wxPoint wxFrame::GetClientAreaOrigin() const @@ -99,6 +97,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