* Added GetAppMenuBar

* Removed Show
* Labeled (Attach|Detach)MenuBar as virtual
* Added SetMenuBar
* Implement (Attach|Detach)MenuBar using the wxMenuBarManager


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott 2003-09-05 01:39:55 +00:00
parent af367f4640
commit 24c7767fc8
2 changed files with 18 additions and 18 deletions

View File

@ -50,6 +50,8 @@ protected:
// ------------------------------------------------------------------------
// Cocoa specifics
// ------------------------------------------------------------------------
public:
virtual wxMenuBar* GetAppMenuBar() { return GetMenuBar(); }
protected:
virtual void CocoaSetWxWindowSize(int width, int height);
@ -63,14 +65,14 @@ protected:
// Implementation
// ------------------------------------------------------------------------
public:
void AttachMenuBar(wxMenuBar *mbar);
void DetachMenuBar();
virtual void AttachMenuBar(wxMenuBar *mbar);
virtual void DetachMenuBar();
virtual void SetMenuBar(wxMenuBar *menubar);
// implementation only from now on
// -------------------------------
// override some more virtuals
virtual bool Show( bool show = true );
// get the origin of the client area (which may be different from (0, 0)
// if the frame has a toolbar) in client coordinates

View File

@ -20,6 +20,7 @@
#endif // WX_PRECOMP
#include "wx/cocoa/autorelease.h"
#include "wx/cocoa/mbarman.h"
#import <AppKit/NSWindow.h>
#import <AppKit/NSApplication.h>
@ -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