#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>
[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
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