added mouse wheel support (patch 1696082)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45340 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-04-08 22:28:42 +00:00
parent 75722dbab8
commit 2cdb6fdb13
2 changed files with 20 additions and 0 deletions

View File

@@ -127,6 +127,10 @@ wxMSW:
- Fixed infinite loop in wxThread::Wait() in console applications. - Fixed infinite loop in wxThread::Wait() in console applications.
- Return the restored window size from GetSize() when window is minimized. - Return the restored window size from GetSize() when window is minimized.
wxX11:
- Added mouse wheel support (David Hart)
2.8.4 2.8.4
----- -----

View File

@@ -1463,6 +1463,22 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
eventType = wxEVT_RIGHT_DOWN; eventType = wxEVT_RIGHT_DOWN;
button = 3; button = 3;
} }
else if ( xevent->xbutton.button == Button4 ||
xevent->xbutton.button == Button5 )
{
// this is the same value as used under wxMSW
static const int WHEEL_DELTA = 120;
eventType = wxEVT_MOUSEWHEEL;
button = xevent->xbutton.button;
wxevent.m_linesPerAction = 3;
wxevent.m_wheelDelta = WHEEL_DELTA;
// Button 4 means mousewheel up, 5 means down
wxevent.m_wheelRotation = button == Button4 ? WHEEL_DELTA
: -WHEEL_DELTA;
}
// check for a double click // check for a double click
// TODO: where can we get this value from? // TODO: where can we get this value from?