]> git.saurik.com Git - wxWidgets.git/commitdiff
wxPopupTransientWindow::Popup no longer captures the mouse, so do it in
authorMichael Wetherell <mike.wetherell@ntlworld.com>
Sat, 14 May 2005 15:49:19 +0000 (15:49 +0000)
committerMichael Wetherell <mike.wetherell@ntlworld.com>
Sat, 14 May 2005 15:49:19 +0000 (15:49 +0000)
wxPopupMenuWindow instead, and wxPopupTranientWindow::OnIdle also now disables
the capture when the cursor is inside the popup, so override that too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/univ/menu.cpp

index c5622fc30c51ff76bd75d3416a40a7e39e51ed23..11215d72a7b204f8934e44e77c3afdedfe54003d 100644 (file)
@@ -138,6 +138,13 @@ public:
     // called when a submenu is dismissed
     void OnSubmenuDismiss(bool dismissParent);
 
+    // the default wxMSW wxPopupTransientWindow::OnIdle disables the capture
+    // when the cursor is inside the popup, which dsables the menu tracking
+    // so override it to do nothing
+#ifdef __WXMSW__
+    void OnIdle(wxIdleEvent& event) { }
+#endif
+
     // get the currently selected item (may be NULL)
     wxMenuItem *GetCurrentItem() const
     {
@@ -282,6 +289,9 @@ BEGIN_EVENT_TABLE(wxPopupMenuWindow, wxPopupTransientWindow)
     EVT_LEFT_UP(wxPopupMenuWindow::OnLeftUp)
     EVT_MOTION(wxPopupMenuWindow::OnMouseMove)
     EVT_LEAVE_WINDOW(wxPopupMenuWindow::OnMouseLeave)
+#ifdef __WXMSW__
+    EVT_IDLE(wxPopupMenuWindow::OnIdle)
+#endif
 END_EVENT_TABLE()
 
 BEGIN_EVENT_TABLE(wxMenuBar, wxMenuBarBase)
@@ -428,6 +438,11 @@ void wxPopupMenuWindow::Popup(wxWindow *focus)
 
     wxPopupTransientWindow::Popup(focus);
 
+    // the base class no-longer captures the mouse automatically when Popup
+    // is called, so do it here to allow the menu tracking to work
+    if ( !HasCapture() )
+        CaptureMouse();
+
 #ifdef __WXMSW__
     // ensure that this window is really on top of everything: without using
     // SetWindowPos() it can be covered by its parent menu which is not