1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cocoa/frame.mm
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
14 #include "wx/menuitem.h"
18 #import <AppKit/NSWindow.h>
19 #import <AppKit/NSApplication.h>
23 BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
26 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
32 bool wxFrame::Create(wxWindow *parent,
34 const wxString& title,
40 bool rt = wxTopLevelWindow::Create(parent,winid,title,pos,size,style,name);
49 void wxFrame::Cocoa_wxMenuItemAction(wxMenuItem& item)
51 Command(item.GetId());
54 void wxFrame::AttachMenuBar(wxMenuBar *mbar)
56 wxFrameBase::AttachMenuBar(mbar);
59 wxLogDebug("Attached menu");
60 [m_cocoaNSWindow setMenu:m_frameMenuBar->GetNSMenu()];
64 void wxFrame::DetachMenuBar()
68 [m_cocoaNSWindow setMenu:nil];
70 wxFrameBase::DetachMenuBar();
73 bool wxFrame::Show(bool show)
75 bool ret = wxFrameBase::Show(show);
76 if(show && GetMenuBar())
77 [wxTheApp->GetNSApplication() setMenu:GetMenuBar()->GetNSMenu() ];
81 wxPoint wxFrame::GetClientAreaOrigin() const