From d8809820cc7aa3a38355b65cd4cb1d4040cfb499 Mon Sep 17 00:00:00 2001 From: Michael Wetherell Date: Wed, 18 May 2005 21:36:13 +0000 Subject: [PATCH] Let the menubar see a menu's keyboard events, and reset menus on dismiss. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34146 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/univ/menu.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index ea1a95aa5b..5909f4eb64 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -482,6 +482,8 @@ void wxPopupMenuWindow::Dismiss() } wxPopupTransientWindow::Dismiss(); + + ResetCurrent(); } void wxPopupMenuWindow::OnDismiss() @@ -491,19 +493,13 @@ void wxPopupMenuWindow::OnDismiss() HandleDismiss(true); } -void wxPopupMenuWindow::OnSubmenuDismiss(bool dismissParent) +void wxPopupMenuWindow::OnSubmenuDismiss(bool WXUNUSED(dismissParent)) { m_hasOpenSubMenu = false; - - // we are closing whole menu so remove current highlight - if ( dismissParent ) - ResetCurrent(); } void wxPopupMenuWindow::HandleDismiss(bool dismissParent) { - ResetCurrent(); - m_menu->OnDismiss(dismissParent); } @@ -875,7 +871,13 @@ void wxPopupMenuWindow::OnMouseLeave(wxMouseEvent& event) void wxPopupMenuWindow::OnKeyDown(wxKeyEvent& event) { - if ( !ProcessKeyDown(event.GetKeyCode()) ) + wxMenuBar *menubar = m_menu->GetMenuBar(); + + if ( menubar ) + { + menubar->ProcessEvent(event); + } + else if ( !ProcessKeyDown(event.GetKeyCode()) ) { event.Skip(); } @@ -2480,7 +2482,7 @@ void wxMenuBar::OnDismiss() { if ( ReleaseMouseCapture() ) wxLogTrace(_T("mousecapture"), _T("Releasing mouse from wxMenuBar::OnDismiss")); - + if ( m_current != -1 ) { size_t current = m_current; @@ -2513,7 +2515,7 @@ bool wxMenuBar::ReleaseMouseCapture() if ( had ) ReleaseMouse(); - + capture->CaptureMouse(); return had;