]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/menu.cpp
Fix for the fix for wxChoice selection.
[wxWidgets.git] / src / univ / menu.cpp
index ac1b1a3e9176cd1f370e6d587f82f2298bb46662..b6b0189e85cc2ee828c477762717a48cbc48cab5 100644 (file)
@@ -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;