Added wxWidgets mouse wheel support
This commit is contained in:
parent
18922fa1a3
commit
495dd21691
@ -243,6 +243,7 @@ void MyPanel::ToggleMouse(bool fromToolbar)
|
||||
void MyPanel::OnMouse(wxMouseEvent& event)
|
||||
{
|
||||
long x,y;
|
||||
int wheel = 0;
|
||||
|
||||
if (theFrame->GetSimThread() == NULL)
|
||||
return;
|
||||
@ -279,7 +280,10 @@ void MyPanel::OnMouse(wxMouseEvent& event)
|
||||
buttons = event.LeftIsDown() ? 1 : 0;
|
||||
buttons |= event.RightIsDown() ? 2 : 0;
|
||||
buttons |= event.MiddleIsDown() ? 4 : 0;
|
||||
if (x==mouseSavedX && y==mouseSavedY && !event.IsButton ()) {
|
||||
if (event.GetWheelRotation() != 0) {
|
||||
wheel = event.GetWheelRotation() / event.GetWheelDelta();
|
||||
}
|
||||
if ((x == mouseSavedX) && (y == mouseSavedY) && !event.IsButton() && (wheel == 0)) {
|
||||
// nothing happened. This could have been generated by the WarpPointer.
|
||||
return;
|
||||
} else {
|
||||
@ -296,7 +300,7 @@ void MyPanel::OnMouse(wxMouseEvent& event)
|
||||
event_queue[num_events].u.mouse.dx = dx;
|
||||
event_queue[num_events].u.mouse.dy = -dy;
|
||||
}
|
||||
// TODO: handle mouse wheel
|
||||
event_queue[num_events].u.mouse.dz = wheel;
|
||||
event_queue[num_events].u.mouse.buttons = buttons;
|
||||
num_events++;
|
||||
mouseSavedX = x;
|
||||
|
Loading…
Reference in New Issue
Block a user