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
|
// Cocoa specifics
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
public:
|
public:
|
||||||
virtual wxMenuBar* GetAppMenuBar() { return GetMenuBar(); }
|
virtual wxMenuBar* GetAppMenuBar();
|
||||||
// Returns the NSView for non-client drawing
|
// Returns the NSView for non-client drawing
|
||||||
virtual WX_NSView GetNonClientNSView();
|
virtual WX_NSView GetNonClientNSView();
|
||||||
protected:
|
protected:
|
||||||
|
@@ -67,7 +67,7 @@ public:
|
|||||||
virtual void CocoaDelegate_windowDidResignKey(void);
|
virtual void CocoaDelegate_windowDidResignKey(void);
|
||||||
virtual void CocoaDelegate_windowDidBecomeMain(void);
|
virtual void CocoaDelegate_windowDidBecomeMain(void);
|
||||||
virtual void CocoaDelegate_windowDidResignMain(void);
|
virtual void CocoaDelegate_windowDidResignMain(void);
|
||||||
virtual wxMenuBar* GetAppMenuBar() { return NULL; }
|
virtual wxMenuBar* GetAppMenuBar();
|
||||||
protected:
|
protected:
|
||||||
void SetNSWindow(WX_NSWindow cocoaNSWindow);
|
void SetNSWindow(WX_NSWindow cocoaNSWindow);
|
||||||
WX_NSWindow m_cocoaNSWindow;
|
WX_NSWindow m_cocoaNSWindow;
|
||||||
|
@@ -81,6 +81,13 @@ void wxFrame::SetMenuBar(wxMenuBar *menubar)
|
|||||||
wxMenuBarManager::GetInstance()->UpdateWindowMenuBar(this);
|
wxMenuBarManager::GetInstance()->UpdateWindowMenuBar(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxMenuBar* wxFrame::GetAppMenuBar()
|
||||||
|
{
|
||||||
|
if(GetMenuBar())
|
||||||
|
return GetMenuBar();
|
||||||
|
return wxFrameBase::GetAppMenuBar();
|
||||||
|
}
|
||||||
|
|
||||||
wxPoint wxFrame::GetClientAreaOrigin() const
|
wxPoint wxFrame::GetClientAreaOrigin() const
|
||||||
{
|
{
|
||||||
return wxPoint(0,0);
|
return wxPoint(0,0);
|
||||||
|
@@ -188,19 +188,15 @@ void wxMenuBarManager::WindowDidResignMain(wxTopLevelWindowNative *win)
|
|||||||
|
|
||||||
void wxMenuBarManager::InstallMenuBarForWindow(wxTopLevelWindowNative *win)
|
void wxMenuBarManager::InstallMenuBarForWindow(wxTopLevelWindowNative *win)
|
||||||
{
|
{
|
||||||
wxMenuBar *menubar = NULL;
|
wxASSERT(win);
|
||||||
for(wxTopLevelWindowNative *destwin = win;
|
wxMenuBar *menubar = win->GetAppMenuBar();
|
||||||
!menubar && destwin;
|
|
||||||
destwin = wxDynamicCast(destwin->GetParent(), wxTopLevelWindow))
|
|
||||||
{
|
|
||||||
menubar = destwin->GetAppMenuBar();
|
|
||||||
}
|
|
||||||
SetMenuBar(menubar);
|
SetMenuBar(menubar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenuBarManager::UpdateWindowMenuBar(wxTopLevelWindowNative *win)
|
void wxMenuBarManager::UpdateWindowMenuBar(wxTopLevelWindowNative *win)
|
||||||
{
|
{
|
||||||
InstallMenuBarForWindow(m_windowKey);
|
if(m_windowKey)
|
||||||
|
InstallMenuBarForWindow(m_windowKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
|
@@ -134,6 +134,14 @@ wxTopLevelWindowCocoa::~wxTopLevelWindowCocoa()
|
|||||||
// wxTopLevelWindowCocoa Cocoa Specifics
|
// wxTopLevelWindowCocoa Cocoa Specifics
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxMenuBar* wxTopLevelWindowCocoa::GetAppMenuBar()
|
||||||
|
{
|
||||||
|
wxTopLevelWindowCocoa *parent = wxDynamicCast(GetParent(),wxTopLevelWindow);
|
||||||
|
if(parent)
|
||||||
|
return parent->GetAppMenuBar();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void wxTopLevelWindowCocoa::SetNSWindow(WX_NSWindow cocoaNSWindow)
|
void wxTopLevelWindowCocoa::SetNSWindow(WX_NSWindow cocoaNSWindow)
|
||||||
{
|
{
|
||||||
bool need_debug = cocoaNSWindow || m_cocoaNSWindow;
|
bool need_debug = cocoaNSWindow || m_cocoaNSWindow;
|
||||||
|
Reference in New Issue
Block a user