From 287561cce53f526fbae117ab8245a778623092b1 Mon Sep 17 00:00:00 2001 From: Peter Urbanec Date: Fri, 11 Apr 2008 17:19:58 +1000 Subject: [PATCH] comctl32: Mousewheel support for updown control. --- dlls/comctl32/updown.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index 74a96f652dd..a62e22134bd 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -469,6 +469,28 @@ static LRESULT UPDOWN_KeyPressed(UPDOWN_INFO *infoPtr, int key) return 0; } +/*********************************************************************** + * UPDOWN_MouseWheel + * + * Handle mouse wheel scrolling + */ +static LRESULT UPDOWN_MouseWheel(UPDOWN_INFO *infoPtr, WPARAM wParam) +{ + int iWheelDelta = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA; + + if (wParam & (MK_SHIFT | MK_CONTROL)) + return 0; + + if (iWheelDelta != 0) + { + UPDOWN_GetBuddyInt(infoPtr); + UPDOWN_DoAction(infoPtr, abs(iWheelDelta), iWheelDelta > 0 ? FLAG_INCR : FLAG_DECR); + } + + return 1; +} + + /*********************************************************************** * UPDOWN_Buddy_SubclassProc used to handle messages sent to the buddy * control. @@ -486,6 +508,11 @@ UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam); } + else if (uMsg == WM_MOUSEWHEEL) { + HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND); + + UPDOWN_MouseWheel(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam); + } return CallWindowProcW( superClassWndProc, hwnd, uMsg, wParam, lParam); } @@ -929,6 +956,10 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L UPDOWN_HandleMouseEvent (infoPtr, message, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); break; + case WM_MOUSEWHEEL: + UPDOWN_MouseWheel(infoPtr, wParam); + break; + case WM_KEYDOWN: if((infoPtr->dwStyle & UDS_ARROWKEYS) && UPDOWN_IsEnabled(infoPtr)) return UPDOWN_KeyPressed(infoPtr, (int)wParam);