]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix for mousewheel events when it is set to page mode instead of lines.
authorRobin Dunn <robin@alldunn.com>
Fri, 19 Jul 2002 19:36:53 +0000 (19:36 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 19 Jul 2002 19:36:53 +0000 (19:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16211 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/scrlwing.cpp

index b36eace80ec1ca21002549d6ea46a30959cdaaf2..489db5bbf7a3332983442a1b8bf38540f9a230ea 100644 (file)
@@ -1084,6 +1084,10 @@ void wxScrollHelper::HandleOnMouseLeave(wxMouseEvent& event)
 
 #if wxUSE_MOUSEWHEEL
 
+#ifndef  WHEEL_PAGESCROLL
+#define WHEEL_PAGESCROLL  (UINT_MAX)   // signifies to scroll a page
+#endif
+
 void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event)
 {
     m_wheelRotation += event.GetWheelRotation();
@@ -1092,26 +1096,34 @@ void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event)
 
     if (lines != 0)
     {
-        lines *= event.GetLinesPerAction();
 
         wxScrollWinEvent newEvent;
 
         newEvent.SetPosition(0);
         newEvent.SetOrientation(wxVERTICAL);
         newEvent.m_eventObject = m_win;
-        if (lines > 0)
-            newEvent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
-        else
-            newEvent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
 
-        int times = abs(lines);
-        for (; times > 0; times --)
+        if (event.GetLinesPerAction() == WHEEL_PAGESCROLL)
+        {
+            if (lines > 0)
+                newEvent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
+            else
+                newEvent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
+
             m_win->GetEventHandler()->ProcessEvent(newEvent);
+        }
+        else
+        {
+            lines *= event.GetLinesPerAction();
+            if (lines > 0)
+                newEvent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
+            else
+                newEvent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
 
-        /* Old Way */
-        // int vsx, vsy;
-        // GetViewStart(&vsx, &vsy);
-        // Scroll(-1, vsy - lines);
+            int times = abs(lines);
+            for (; times > 0; times--)
+                m_win->GetEventHandler()->ProcessEvent(newEvent);
+        }
     }
 }