Implement horizontal mouse wheel events support for wxMSW.

Handle WM_MOUSEHWHEEL messages and translate them to the corresponding
wxMouseEvents.

Closes #14105.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70962 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-03-22 00:27:02 +00:00
parent 41469c9e5e
commit b9e52a19e6
4 changed files with 16 additions and 4 deletions

View File

@ -513,6 +513,7 @@ MSW:
- Add wxActiveXContainer::QueryClientSiteInterface and implement it in
wxWebViewIE to improve the default behaviour (Allonii).
- Update stretchable spaces in wxToolBar after tool removal (Catalin Raceanu).
- Add support for horizontal mouse wheel events (Lauri Nurmi).
OSX:

View File

@ -77,6 +77,9 @@
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
#ifndef WHEEL_DELTA
#define WHEEL_DELTA 120
#endif

View File

@ -345,7 +345,8 @@ public:
bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags);
bool HandleMouseMove(int x, int y, WXUINT flags);
bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam);
bool HandleMouseWheel(wxMouseWheelAxis axis,
WXWPARAM wParam, WXLPARAM lParam);
bool HandleChar(WXWPARAM wParam, WXLPARAM lParam);
bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam);

View File

@ -2898,9 +2898,13 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
#if wxUSE_MOUSEWHEEL
case WM_MOUSEWHEEL:
processed = HandleMouseWheel(wParam, lParam);
processed = HandleMouseWheel(wxMOUSE_WHEEL_VERTICAL, wParam, lParam);
break;
#endif
case WM_MOUSEHWHEEL:
processed = HandleMouseWheel(wxMOUSE_WHEEL_HORIZONTAL, wParam, lParam);
break;
#endif // wxUSE_MOUSEWHEEL
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
@ -5551,7 +5555,9 @@ bool wxWindowMSW::HandleMouseMove(int x, int y, WXUINT flags)
}
bool wxWindowMSW::HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam)
bool
wxWindowMSW::HandleMouseWheel(wxMouseWheelAxis axis,
WXWPARAM wParam, WXLPARAM lParam)
{
#if wxUSE_MOUSEWHEEL
// notice that WM_MOUSEWHEEL position is in screen coords (as it's
@ -5564,6 +5570,7 @@ bool wxWindowMSW::HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam)
InitMouseEvent(event, pt.x, pt.y, LOWORD(wParam));
event.m_wheelRotation = (short)HIWORD(wParam);
event.m_wheelDelta = WHEEL_DELTA;
event.m_wheelAxis = axis;
static int s_linesPerRotation = -1;
if ( s_linesPerRotation == -1 )