// Author: Julian Smart
// Modified by: Vadim Zeitlin on 2008-11-04 to use the base classes
// Created: 04/01/98
-// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
// (c) 2008-2009 Vadim Zeitlin
// Licence: wxWindows licence
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);
MSWDefWindowProc(message, wParam, lParam);
processed = true;
}
- else // Not a system command.
- {
- // Menu (and toolbar) events should be sent to the active
- // child first and only be processed by the parent frame if
- // they're not handled there.
- if ( wxMDIChildFrame* child = GetActiveChild() )
- {
- processed = child->MSWHandleMessage(&rc,
- message,
- wParam,
- lParam);
- }
- }
}
break;