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
This commit is contained in:
Robin Dunn
2002-07-19 19:36:53 +00:00
parent 24f5e003c2
commit 4b056ef54f

View File

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