diff --git a/modules/highgui/include/opencv2/highgui.hpp b/modules/highgui/include/opencv2/highgui.hpp index eb4ee8c03a86e4c5e06c1d836a8e267abb24007c..00e1ce4270a2dc54c854dd78180d78942a672941 100644 --- a/modules/highgui/include/opencv2/highgui.hpp +++ b/modules/highgui/include/opencv2/highgui.hpp @@ -76,7 +76,9 @@ enum { EVENT_MOUSEMOVE = 0, EVENT_MBUTTONUP = 6, EVENT_LBUTTONDBLCLK = 7, EVENT_RBUTTONDBLCLK = 8, - EVENT_MBUTTONDBLCLK = 9 + EVENT_MBUTTONDBLCLK =9, + EVENT_MOUSEWHEEL =10, + EVENT_MOUSEHWHEEL =11 }; enum { EVENT_FLAG_LBUTTON = 1, @@ -137,6 +139,8 @@ CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id); //! assigns callback for mouse events CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0); +CV_EXPORTS int getMouseWheelDelta(int flags); + CV_EXPORTS int createTrackbar(const String& trackbarname, const String& winname, int* value, int count, TrackbarCallback onChange = 0, diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h index d1aa93b027dbe012fe80eb25a1d943ba01c499ed..ac12625859fbdd8058f1c8f73d2af6902213bcb6 100644 --- a/modules/highgui/include/opencv2/highgui/highgui_c.h +++ b/modules/highgui/include/opencv2/highgui/highgui_c.h @@ -186,9 +186,7 @@ enum }; -#define CV_GET_WHEEL_DELTA(event) ((short)((event >> 16) & 0xffff)) // upper 16 bits -#define CV_GET_MOUSEWHEEL_EVENT(event) (event & 0xffff) // lower 16 bits - +#define CV_GET_WHEEL_DELTA(flags) ((short)((flags >> 16) & 0xffff)) // upper 16 bits typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param); diff --git a/modules/highgui/src/window.cpp b/modules/highgui/src/window.cpp index 428ef51ef5320e4ca648c8d10b7797f7adfb5717..03ff988d7b4ae1b75709d9f10a4c80c0956e1cc4 100644 --- a/modules/highgui/src/window.cpp +++ b/modules/highgui/src/window.cpp @@ -216,6 +216,11 @@ void cv::setMouseCallback( const String& windowName, MouseCallback onMouse, void cvSetMouseCallback(windowName.c_str(), onMouse, param); } +int cv::getMouseWheelDelta( int flags ) +{ + return CV_GET_WHEEL_DELTA(flags); +} + int cv::startWindowThread() { return cvStartWindowThread(); diff --git a/modules/highgui/src/window_w32.cpp b/modules/highgui/src/window_w32.cpp index 70a29d40216499e288f365be81bb2b382e446560..bb47047957d229dc4223f924c0f4e40629885c1b 100644 --- a/modules/highgui/src/window_w32.cpp +++ b/modules/highgui/src/window_w32.cpp @@ -1392,7 +1392,7 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) // Set the wheel delta of mouse wheel to be in the upper word of 'event' int delta = GET_WHEEL_DELTA_WPARAM(wParam); - event |= (delta << 16); + flags |= (delta << 16); POINT pt; {