From 4b056ef54f29582e2a5154bf148f7ebc5877b51b Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 19 Jul 2002 19:36:53 +0000 Subject: [PATCH] Fix for mousewheel events when it is set to page mode instead of lines. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16211 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/scrlwing.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index b36eace80e..489db5bbf7 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -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); + } } } -- 2.45.2