Instead of m_menuBar use GetMenuBar() which will be modified (with next patch)
to traverse up the menu hierarchy to return the menu bar. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26476 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -124,7 +124,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
|||||||
wxASSERT_MSG( pSubMenu->m_hMenu != NULL , wxT("invalid submenu added"));
|
wxASSERT_MSG( pSubMenu->m_hMenu != NULL , wxT("invalid submenu added"));
|
||||||
pSubMenu->m_menuParent = this ;
|
pSubMenu->m_menuParent = this ;
|
||||||
|
|
||||||
if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar)
|
if (wxMenuBar::MacGetInstalledMenuBar() == GetMenuBar())
|
||||||
{
|
{
|
||||||
pSubMenu->MacBeforeDisplay( true ) ;
|
pSubMenu->MacBeforeDisplay( true ) ;
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
|||||||
// if we're already attached to the menubar, we must update it
|
// if we're already attached to the menubar, we must update it
|
||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
m_menuBar->Refresh();
|
GetMenuBar()->Refresh();
|
||||||
}
|
}
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
|||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
// otherwise, the change won't be visible
|
// otherwise, the change won't be visible
|
||||||
m_menuBar->Refresh();
|
GetMenuBar()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
// and from internal data structures
|
// and from internal data structures
|
||||||
@@ -303,8 +303,8 @@ wxWindow *wxMenu::GetWindow() const
|
|||||||
{
|
{
|
||||||
if ( m_invokingWindow != NULL )
|
if ( m_invokingWindow != NULL )
|
||||||
return m_invokingWindow;
|
return m_invokingWindow;
|
||||||
else if ( m_menuBar != NULL)
|
else if ( GetMenuBar() != NULL)
|
||||||
return (wxWindow *) m_menuBar->GetFrame();
|
return (wxWindow *) GetMenuBar()->GetFrame();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -124,7 +124,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
|||||||
wxASSERT_MSG( pSubMenu->m_hMenu != NULL , wxT("invalid submenu added"));
|
wxASSERT_MSG( pSubMenu->m_hMenu != NULL , wxT("invalid submenu added"));
|
||||||
pSubMenu->m_menuParent = this ;
|
pSubMenu->m_menuParent = this ;
|
||||||
|
|
||||||
if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar)
|
if (wxMenuBar::MacGetInstalledMenuBar() == GetMenuBar())
|
||||||
{
|
{
|
||||||
pSubMenu->MacBeforeDisplay( true ) ;
|
pSubMenu->MacBeforeDisplay( true ) ;
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
|||||||
// if we're already attached to the menubar, we must update it
|
// if we're already attached to the menubar, we must update it
|
||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
m_menuBar->Refresh();
|
GetMenuBar()->Refresh();
|
||||||
}
|
}
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
|||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
// otherwise, the change won't be visible
|
// otherwise, the change won't be visible
|
||||||
m_menuBar->Refresh();
|
GetMenuBar()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
// and from internal data structures
|
// and from internal data structures
|
||||||
@@ -303,8 +303,8 @@ wxWindow *wxMenu::GetWindow() const
|
|||||||
{
|
{
|
||||||
if ( m_invokingWindow != NULL )
|
if ( m_invokingWindow != NULL )
|
||||||
return m_invokingWindow;
|
return m_invokingWindow;
|
||||||
else if ( m_menuBar != NULL)
|
else if ( GetMenuBar() != NULL)
|
||||||
return (wxWindow *) m_menuBar->GetFrame();
|
return (wxWindow *) GetMenuBar()->GetFrame();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -119,7 +119,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *pItem)
|
|||||||
if (m_menuWidget)
|
if (m_menuWidget)
|
||||||
{
|
{
|
||||||
// this is a dynamic Append
|
// this is a dynamic Append
|
||||||
pItem->CreateItem(m_menuWidget, m_menuBar, m_topLevelMenu);
|
pItem->CreateItem(m_menuWidget, GetMenuBar(), m_topLevelMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pItem->IsSubMenu() )
|
if ( pItem->IsSubMenu() )
|
||||||
|
@@ -321,7 +321,7 @@ void wxMenu::UpdateAccel(wxMenuItem *item)
|
|||||||
|
|
||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
m_menuBar->RebuildAccelTable();
|
GetMenuBar()->RebuildAccelTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else: it is a separator, they can't have accels, nothing to do
|
//else: it is a separator, they can't have accels, nothing to do
|
||||||
@@ -419,9 +419,9 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
|||||||
#endif // __WIN32__
|
#endif // __WIN32__
|
||||||
|
|
||||||
// if we're already attached to the menubar, we must update it
|
// if we're already attached to the menubar, we must update it
|
||||||
if ( IsAttached() && m_menuBar->IsAttached() )
|
if ( IsAttached() && GetMenuBar()->IsAttached() )
|
||||||
{
|
{
|
||||||
m_menuBar->Refresh();
|
GetMenuBar()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -532,10 +532,10 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
|||||||
wxLogLastError(wxT("RemoveMenu"));
|
wxLogLastError(wxT("RemoveMenu"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( IsAttached() && m_menuBar->IsAttached() )
|
if ( IsAttached() && GetMenuBar()->IsAttached() )
|
||||||
{
|
{
|
||||||
// otherwise, the chane won't be visible
|
// otherwise, the chane won't be visible
|
||||||
m_menuBar->Refresh();
|
GetMenuBar()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
// and from internal data structures
|
// and from internal data structures
|
||||||
@@ -662,8 +662,8 @@ wxWindow *wxMenu::GetWindow() const
|
|||||||
{
|
{
|
||||||
if ( m_invokingWindow != NULL )
|
if ( m_invokingWindow != NULL )
|
||||||
return m_invokingWindow;
|
return m_invokingWindow;
|
||||||
else if ( m_menuBar != NULL)
|
else if ( GetMenuBar() != NULL)
|
||||||
return m_menuBar->GetFrame();
|
return GetMenuBar()->GetFrame();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -226,7 +226,7 @@ void wxMenu::UpdateAccel(
|
|||||||
|
|
||||||
if (IsAttached())
|
if (IsAttached())
|
||||||
{
|
{
|
||||||
m_menuBar->RebuildAccelTable();
|
GetMenuBar()->RebuildAccelTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // wxMenu::UpdateAccel
|
} // wxMenu::UpdateAccel
|
||||||
@@ -354,9 +354,9 @@ bool wxMenu::DoInsertOrAppend(
|
|||||||
//
|
//
|
||||||
// If we're already attached to the menubar, we must update it
|
// If we're already attached to the menubar, we must update it
|
||||||
//
|
//
|
||||||
if (IsAttached() && m_menuBar->IsAttached())
|
if (IsAttached() && GetMenuBar()->IsAttached())
|
||||||
{
|
{
|
||||||
m_menuBar->Refresh();
|
GetMenuBar()->Refresh();
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -497,12 +497,12 @@ wxMenuItem* wxMenu::DoRemove(
|
|||||||
,MPFROM2SHORT(pItem->GetId(), TRUE)
|
,MPFROM2SHORT(pItem->GetId(), TRUE)
|
||||||
,(MPARAM)0
|
,(MPARAM)0
|
||||||
);
|
);
|
||||||
if (IsAttached() && m_menuBar->IsAttached())
|
if (IsAttached() && GetMenuBar()->IsAttached())
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Otherwise, the chane won't be visible
|
// Otherwise, the chane won't be visible
|
||||||
//
|
//
|
||||||
m_menuBar->Refresh();
|
GetMenuBar()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -615,8 +615,8 @@ wxWindow* wxMenu::GetWindow() const
|
|||||||
{
|
{
|
||||||
if (m_invokingWindow != NULL)
|
if (m_invokingWindow != NULL)
|
||||||
return m_invokingWindow;
|
return m_invokingWindow;
|
||||||
else if ( m_menuBar != NULL)
|
else if ( GetMenuBar() != NULL)
|
||||||
return m_menuBar->GetFrame();
|
return GetMenuBar()->GetFrame();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
} // end of wxMenu::GetWindow
|
} // end of wxMenu::GetWindow
|
||||||
|
@@ -1235,10 +1235,10 @@ void wxMenu::Detach()
|
|||||||
|
|
||||||
wxWindow *wxMenu::GetRootWindow() const
|
wxWindow *wxMenu::GetRootWindow() const
|
||||||
{
|
{
|
||||||
if ( m_menuBar )
|
if ( GetMenuBar() )
|
||||||
{
|
{
|
||||||
// simple case - a normal menu attached to the menubar
|
// simple case - a normal menu attached to the menubar
|
||||||
return m_menuBar;
|
return GetMenuBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're a popup menu but the trouble is that only the top level popup menu
|
// we're a popup menu but the trouble is that only the top level popup menu
|
||||||
|
Reference in New Issue
Block a user