From 9e849c0044cbb66dc3cc9b75fa5b50512f1fa99c Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Wed, 17 Sep 2003 22:38:12 +0000 Subject: [PATCH] Implemented mouse wheel support. --- programs/winhelp/winhelp.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c index 9b717af86e5..fad343b2004 100644 --- a/programs/winhelp/winhelp.c +++ b/programs/winhelp/winhelp.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "windef.h" #include "winbase.h" @@ -811,6 +812,36 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam, if (!(winpos->flags & SWP_NOSIZE)) WINHELP_SetupText(hWnd); break; + case WM_MOUSEWHEEL: + { + int wheelDelta = 0; + UINT scrollLines = 3; + int curPos = GetScrollPos(hWnd, SB_VERT); + int min, max; + + GetScrollRange(hWnd, SB_VERT, &min, &max); + + SystemParametersInfo(SPI_GETWHEELSCROLLLINES,0, &scrollLines, 0); + if (wParam & (MK_SHIFT | MK_CONTROL)) + return DefWindowProc(hWnd, msg, wParam, lParam); + wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam); + if (abs(wheelDelta) >= WHEEL_DELTA && scrollLines) { + int dy; + + curPos += wheelDelta; + if (curPos > max) + curPos = max; + else if (curPos < min) + curPos = min; + + dy = GetScrollPos(hWnd, SB_VERT) - curPos; + SetScrollPos(hWnd, SB_VERT, curPos, TRUE); + ScrollWindow(hWnd, 0, dy, NULL, NULL); + UpdateWindow(hWnd); + } + } + break; + case WM_VSCROLL: { BOOL update = TRUE;