wxMenuBarManager::InstallMenuBarForWindow no longer looks for a menubar
attached to the parent of a window without one. Instead, it is now up to the GetAppMenuBar() function to do so. The new implementation in wxTopLevelWindow does just that. The wxFrame implementation now calls the base class version if it does not have a menubar. Also, it is now invalid to call the function with a NULL window (it is internal anyway). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24424 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -51,7 +51,7 @@ protected:
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual wxMenuBar* GetAppMenuBar() { return GetMenuBar(); }
|
||||
virtual wxMenuBar* GetAppMenuBar();
|
||||
// Returns the NSView for non-client drawing
|
||||
virtual WX_NSView GetNonClientNSView();
|
||||
protected:
|
||||
|
@@ -67,7 +67,7 @@ public:
|
||||
virtual void CocoaDelegate_windowDidResignKey(void);
|
||||
virtual void CocoaDelegate_windowDidBecomeMain(void);
|
||||
virtual void CocoaDelegate_windowDidResignMain(void);
|
||||
virtual wxMenuBar* GetAppMenuBar() { return NULL; }
|
||||
virtual wxMenuBar* GetAppMenuBar();
|
||||
protected:
|
||||
void SetNSWindow(WX_NSWindow cocoaNSWindow);
|
||||
WX_NSWindow m_cocoaNSWindow;
|
||||
|
@@ -81,6 +81,13 @@ void wxFrame::SetMenuBar(wxMenuBar *menubar)
|
||||
wxMenuBarManager::GetInstance()->UpdateWindowMenuBar(this);
|
||||
}
|
||||
|
||||
wxMenuBar* wxFrame::GetAppMenuBar()
|
||||
{
|
||||
if(GetMenuBar())
|
||||
return GetMenuBar();
|
||||
return wxFrameBase::GetAppMenuBar();
|
||||
}
|
||||
|
||||
wxPoint wxFrame::GetClientAreaOrigin() const
|
||||
{
|
||||
return wxPoint(0,0);
|
||||
|
@@ -188,19 +188,15 @@ void wxMenuBarManager::WindowDidResignMain(wxTopLevelWindowNative *win)
|
||||
|
||||
void wxMenuBarManager::InstallMenuBarForWindow(wxTopLevelWindowNative *win)
|
||||
{
|
||||
wxMenuBar *menubar = NULL;
|
||||
for(wxTopLevelWindowNative *destwin = win;
|
||||
!menubar && destwin;
|
||||
destwin = wxDynamicCast(destwin->GetParent(), wxTopLevelWindow))
|
||||
{
|
||||
menubar = destwin->GetAppMenuBar();
|
||||
}
|
||||
wxASSERT(win);
|
||||
wxMenuBar *menubar = win->GetAppMenuBar();
|
||||
SetMenuBar(menubar);
|
||||
}
|
||||
|
||||
void wxMenuBarManager::UpdateWindowMenuBar(wxTopLevelWindowNative *win)
|
||||
{
|
||||
InstallMenuBarForWindow(m_windowKey);
|
||||
if(m_windowKey)
|
||||
InstallMenuBarForWindow(m_windowKey);
|
||||
}
|
||||
|
||||
#endif // wxUSE_MENUS
|
||||
|
@@ -134,6 +134,14 @@ wxTopLevelWindowCocoa::~wxTopLevelWindowCocoa()
|
||||
// wxTopLevelWindowCocoa Cocoa Specifics
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxMenuBar* wxTopLevelWindowCocoa::GetAppMenuBar()
|
||||
{
|
||||
wxTopLevelWindowCocoa *parent = wxDynamicCast(GetParent(),wxTopLevelWindow);
|
||||
if(parent)
|
||||
return parent->GetAppMenuBar();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxTopLevelWindowCocoa::SetNSWindow(WX_NSWindow cocoaNSWindow)
|
||||
{
|
||||
bool need_debug = cocoaNSWindow || m_cocoaNSWindow;
|
||||
|
Reference in New Issue
Block a user