X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3bad8c39260b8bda7762b4aacd49346b46064a2a..88ff049184c77fd73b60c01f4f831860d2ec5cef:/src/common/menucmn.cpp diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 55daa81c38..e92a047041 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 26.10.99 -// RCS-ID: $Id$ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -643,7 +642,8 @@ bool wxMenuBase::SendEvent(int itemid, int checked) event.SetEventObject(this); event.SetInt(checked); - wxWindow * const win = GetWindow(); + wxWindow* const win = GetWindow(); + wxMenuBar* const mb = GetMenuBar(); // Try the menu's event handler first wxEvtHandler *handler = GetEventHandler(); @@ -653,16 +653,21 @@ bool wxMenuBase::SendEvent(int itemid, int checked) // event to another handler if it's not processed here to prevent it // from passing the event to wxTheApp: this will be done below if we do // have the associated window. - if ( win ) + if ( win || mb ) event.SetWillBeProcessedAgain(); if ( handler->SafelyProcessEvent(event) ) return true; } - // Try the window the menu was popped up from or its menu bar belongs to - if ( win && win->HandleWindowEvent(event) ) - return true; + // If this menu is part of the menu bar, process the event there: this will + // also propagate it upwards to the window containing the menu bar. + if ( mb ) + return mb->HandleWindowEvent(event); + + // Try the window the menu was popped up from. + if ( win ) + return win->HandleWindowEvent(event); // Not processed. return false; @@ -919,6 +924,7 @@ void wxMenuBarBase::Attach(wxFrame *frame) { wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") ); + SetParent(frame); m_menuBarFrame = frame; } @@ -927,6 +933,7 @@ void wxMenuBarBase::Detach() wxASSERT_MSG( IsAttached(), wxT("detaching unattached menubar") ); m_menuBarFrame = NULL; + SetParent(NULL); } // ----------------------------------------------------------------------------