Use child MDI frame menu items in preference to the parent frame ones.

Look for the item with the given ID in the child frame menu bar first, before
looking in the parent frame menu bar. This ensures that if an item is disabled
by the parent frame but then reenabled by the child one, it still generates
commands as expected instead of being completely ignored.

See #14314.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-06-23 13:08:18 +00:00
parent dcb16c298b
commit 57b708aebd

View File

@@ -428,11 +428,14 @@ void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu)
wxMenuItem *wxMDIParentFrame::FindItemInMenuBar(int menuId) const
{
wxMenuItem *item = wxFrame::FindItemInMenuBar(menuId);
if ( !item && GetActiveChild() )
{
item = GetActiveChild()->FindItemInMenuBar(menuId);
}
// We must look in the child menu first: if it has an item with the same ID
// as in our own menu bar, the child item should be used to determine
// whether it's currently enabled.
wxMenuItem *item = GetActiveChild()
? GetActiveChild()->FindItemInMenuBar(menuId)
: NULL;
if ( !item )
item = wxFrame::FindItemInMenuBar(menuId);
if ( !item && m_windowMenu )
item = m_windowMenu->FindItem(menuId);