X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c55365891877331935a19931fd2d6f145748fa42..5f3565a2fb3d678b03cf8547f37e56b1efe786f5:/src/univ/menu.cpp diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index ac1b1a3e91..b6b0189e85 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -136,7 +136,7 @@ public: virtual void OnDismiss(); // called when a submenu is dismissed - void OnSubmenuDismiss() { m_hasOpenSubMenu = false; } + void OnSubmenuDismiss(bool dismissParent); // get the currently selected item (may be NULL) wxMenuItem *GetCurrentItem() const @@ -358,7 +358,7 @@ void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::compatibility_iterator nod if ( item->IsSubMenu() && item->GetSubMenu()->IsShown() ) { item->GetSubMenu()->Dismiss(); - OnSubmenuDismiss(); + OnSubmenuDismiss( false ); } RefreshItem(item); @@ -463,7 +463,7 @@ void wxPopupMenuWindow::Dismiss() wxCHECK_RET( win, _T("opened submenu is not opened?") ); win->Dismiss(); - OnSubmenuDismiss(); + OnSubmenuDismiss( false ); } wxPopupTransientWindow::Dismiss(); @@ -476,6 +476,15 @@ void wxPopupMenuWindow::OnDismiss() HandleDismiss(true); } +void wxPopupMenuWindow::OnSubmenuDismiss(bool dismissParent) +{ + m_hasOpenSubMenu = false; + + // we are closing whole menu so remove current highlight + if ( dismissParent ) + ResetCurrent(); +} + void wxPopupMenuWindow::HandleDismiss(bool dismissParent) { ResetCurrent(); @@ -958,7 +967,7 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key) default: // look for the menu item starting with this letter - if ( wxIsalnum(key) ) + if ( wxIsalnum((wxChar)key) ) { // we want to start from the item after this one because // if we're already on the item with the given accel we want to @@ -1307,7 +1316,7 @@ void wxMenu::OnDismiss(bool dismissParent) wxPopupMenuWindow *win = m_menuParent->m_popupMenu; if ( win ) { - win->OnSubmenuDismiss(); + win->OnSubmenuDismiss( true ); } else { @@ -2284,7 +2293,7 @@ void wxMenuBar::OnKeyDown(wxKeyEvent& event) int wxMenuBar::FindNextItemForAccel(int idxStart, int key, bool *unique) const { - if ( !wxIsalnum(key) ) + if ( !wxIsalnum((wxChar)key) ) { // we only support letters/digits as accels return -1;