wxMenuBase changes:
1. GetMenuBar() tries GetParent()->GetMenuBar() first (traverse up hierarchy). 2. IsAttached() returns true if GetMenuBar() returns a menubar. 3. AddSubMenu() does not call Attach() on added submenus. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -272,15 +272,15 @@ public:
|
|||||||
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL);
|
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL);
|
||||||
|
|
||||||
// get the menu bar this menu is attached to (may be NULL, always NULL for
|
// get the menu bar this menu is attached to (may be NULL, always NULL for
|
||||||
// popup menus)
|
// popup menus). Traverse up the menu hierarchy to find it.
|
||||||
wxMenuBar *GetMenuBar() const { return m_menuBar; }
|
wxMenuBar *GetMenuBar() const;
|
||||||
|
|
||||||
// called when the menu is attached/detached to/from a menu bar
|
// called when the menu is attached/detached to/from a menu bar
|
||||||
virtual void Attach(wxMenuBarBase *menubar);
|
virtual void Attach(wxMenuBarBase *menubar);
|
||||||
virtual void Detach();
|
virtual void Detach();
|
||||||
|
|
||||||
// is the menu attached to a menu bar (or is it a popup one)?
|
// is the menu attached to a menu bar (or is it a popup one)?
|
||||||
bool IsAttached() const { return m_menuBar != NULL; }
|
bool IsAttached() const { return GetMenuBar() != NULL; }
|
||||||
|
|
||||||
// set/get the parent of this menu
|
// set/get the parent of this menu
|
||||||
void SetParent(wxMenu *parent) { m_menuParent = parent; }
|
void SetParent(wxMenu *parent) { m_menuParent = parent; }
|
||||||
|
@@ -310,11 +310,6 @@ void wxMenuBase::AddSubMenu(wxMenu *submenu)
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( submenu, _T("can't add a NULL submenu") );
|
wxCHECK_RET( submenu, _T("can't add a NULL submenu") );
|
||||||
|
|
||||||
if ( m_menuBar )
|
|
||||||
{
|
|
||||||
submenu->Attach(m_menuBar);
|
|
||||||
}
|
|
||||||
|
|
||||||
submenu->SetParent((wxMenu *)this);
|
submenu->SetParent((wxMenu *)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,6 +624,13 @@ bool wxMenuBase::SendEvent(int id, int checked)
|
|||||||
// wxMenu attaching/detaching to/from menu bar
|
// wxMenu attaching/detaching to/from menu bar
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxMenuBar* wxMenuBase::GetMenuBar() const
|
||||||
|
{
|
||||||
|
if(GetParent())
|
||||||
|
return GetParent()->GetMenuBar();
|
||||||
|
return m_menuBar;
|
||||||
|
}
|
||||||
|
|
||||||
void wxMenuBase::Attach(wxMenuBarBase *menubar)
|
void wxMenuBase::Attach(wxMenuBarBase *menubar)
|
||||||
{
|
{
|
||||||
// use Detach() instead!
|
// use Detach() instead!
|
||||||
|
Reference in New Issue
Block a user