]> 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 730f6923c583fd0c5c1cb7da5961ea173b61dc2d..b6b0189e85cc2ee828c477762717a48cbc48cab5 100644 (file)
@@ -136,7 +136,7 @@ public:
     virtual void OnDismiss();
 
     // called when a submenu is dismissed
     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
 
     // 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();
             if ( item->IsSubMenu() && item->GetSubMenu()->IsShown() )
             {
                 item->GetSubMenu()->Dismiss();
-                OnSubmenuDismiss();
+                OnSubmenuDismiss( false );
             }
 
             RefreshItem(item);
             }
 
             RefreshItem(item);
@@ -463,7 +463,7 @@ void wxPopupMenuWindow::Dismiss()
         wxCHECK_RET( win, _T("opened submenu is not opened?") );
 
         win->Dismiss();
         wxCHECK_RET( win, _T("opened submenu is not opened?") );
 
         win->Dismiss();
-        OnSubmenuDismiss();
+        OnSubmenuDismiss( false );
     }
 
     wxPopupTransientWindow::Dismiss();
     }
 
     wxPopupTransientWindow::Dismiss();
@@ -476,6 +476,15 @@ void wxPopupMenuWindow::OnDismiss()
     HandleDismiss(true);
 }
 
     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();
 void wxPopupMenuWindow::HandleDismiss(bool dismissParent)
 {
     ResetCurrent();
@@ -1307,7 +1316,7 @@ void wxMenu::OnDismiss(bool dismissParent)
         wxPopupMenuWindow *win = m_menuParent->m_popupMenu;
         if ( win )
         {
         wxPopupMenuWindow *win = m_menuParent->m_popupMenu;
         if ( win )
         {
-            win->OnSubmenuDismiss();
+            win->OnSubmenuDismiss( true );
         }
         else
         {
         }
         else
         {