15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2011 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef UI_BASE_WIN_MOUSE_WHEEL_UTIL_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define UI_BASE_WIN_MOUSE_WHEEL_UTIL_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <windows.h> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/ui_export.h" 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ui { 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ViewProp; 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Marks the passed |hwnd| as supporting mouse-wheel message rerouting. 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// We reroute the mouse wheel messages to such HWND when they are under the 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// mouse pointer (but are not the active window). Callers own the returned 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// object. 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)UI_EXPORT ViewProp* SetWindowSupportsRerouteMouseWheel(HWND hwnd); 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Forwards mouse wheel messages to the window under it. 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Windows sends mouse wheel messages to the currently active window. 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This causes a window to scroll even if it is not currently under the mouse 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// wheel. The following code gives mouse wheel messages to the window under the 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// mouse wheel in order to scroll that window. This is arguably a better user 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// experience. The returns value says whether the mouse wheel message was 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// successfully redirected. 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)UI_EXPORT bool RerouteMouseWheel(HWND window, WPARAM w_param, 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) LPARAM l_param); 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace ui 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // UI_BASE_WIN_MOUSE_WHEEL_UTIL_H_ 35