]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/menu.cpp
don't crash when XIM is used under IRIX
[wxWidgets.git] / src / univ / menu.cpp
index ea1a95aa5be7360790231e4901eb1859d7d1551e..ae7eab4f2ac293d3919a9420607faafbb979045e 100644 (file)
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "univmenuitem.h"
-    #pragma implementation "univmenu.h"
-#endif
-
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
@@ -482,6 +477,8 @@ void wxPopupMenuWindow::Dismiss()
     }
 
     wxPopupTransientWindow::Dismiss();
+
+    ResetCurrent();
 }
 
 void wxPopupMenuWindow::OnDismiss()
@@ -491,19 +488,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 +866,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 +2477,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 +2510,7 @@ bool wxMenuBar::ReleaseMouseCapture()
 
         if ( had )
             ReleaseMouse();
-            
+
         capture->CaptureMouse();
 
         return had;