unsigned int MouseEventManager::getButtonFlags(wxMouseEvent& ev) { if (ev.LeftDown() || ev.LeftDClick() || ev.LeftUp()) return 1; if (ev.MiddleDown() || ev.MiddleDClick() || ev.MiddleUp()) return 2; if (ev.RightDown() || ev.RightDClick() || ev.RightUp()) return 3; if (ev.Aux1Down() || ev.Aux1DClick() || ev.Aux1Up()) return 4; if (ev.Aux2Down() || ev.Aux2DClick() || ev.Aux2Up()) return 5; return 0; }
void Helium::ConvertEvent( wxMouseEvent& event, MouseButtonInputEvent& input ) { new (&input) MouseButtonInputEvent (); ConvertMouseEvent( event, input ); if ( event.LeftUp() ) { input.SetEvent( MouseButtonEvents::Up ); input.SetButton( MouseButtons::Left ); } if ( event.MiddleUp() ) { input.SetEvent( MouseButtonEvents::Up ); input.SetButton( MouseButtons::Middle ); } if ( event.RightUp() ) { input.SetEvent( MouseButtonEvents::Up ); input.SetButton( MouseButtons::Right ); } if ( event.Aux1Up() ) { input.SetEvent( MouseButtonEvents::Up ); input.SetButton( MouseButtons::Forward ); } if ( event.Aux2Up() ) { input.SetEvent( MouseButtonEvents::Up ); input.SetButton( MouseButtons::Backward ); } if ( event.LeftDown() ) { input.SetEvent( MouseButtonEvents::Down ); input.SetButton( MouseButtons::Left ); } if ( event.MiddleDown() ) { input.SetEvent( MouseButtonEvents::Down ); input.SetButton( MouseButtons::Middle ); } if ( event.RightDown() ) { input.SetEvent( MouseButtonEvents::Down ); input.SetButton( MouseButtons::Right ); } if ( event.Aux1Down() ) { input.SetEvent( MouseButtonEvents::Down ); input.SetButton( MouseButtons::Forward ); } if ( event.Aux2Down() ) { input.SetEvent( MouseButtonEvents::Down ); input.SetButton( MouseButtons::Backward ); } if ( event.LeftDClick() ) { input.SetEvent( MouseButtonEvents::DoubleClick ); input.SetButton( MouseButtons::Left ); } if ( event.MiddleDClick() ) { input.SetEvent( MouseButtonEvents::DoubleClick ); input.SetButton( MouseButtons::Middle ); } if ( event.RightDClick() ) { input.SetEvent( MouseButtonEvents::DoubleClick ); input.SetButton( MouseButtons::Right ); } if ( event.Aux1DClick() ) { input.SetEvent( MouseButtonEvents::DoubleClick ); input.SetButton( MouseButtons::Forward ); } if ( event.Aux2DClick() ) { input.SetEvent( MouseButtonEvents::DoubleClick ); input.SetButton( MouseButtons::Backward ); } }
/* MapCanvas::onMouseDown * Called when a mouse button is pressed within the canvas *******************************************************************/ void MapCanvas::onMouseDown(wxMouseEvent& e) { using namespace MapEditor; // Send to editor context bool skip = true; context_->input().updateKeyModifiersWx(e.GetModifiers()); if (e.LeftDown()) skip = context_->input().mouseDown(Input::MouseButton::Left); else if (e.LeftDClick()) skip = context_->input().mouseDown(Input::MouseButton::Left, true); else if (e.RightDown()) skip = context_->input().mouseDown(Input::MouseButton::Right); else if (e.RightDClick()) skip = context_->input().mouseDown(Input::MouseButton::Right, true); else if (e.MiddleDown()) skip = context_->input().mouseDown(Input::MouseButton::Middle); else if (e.MiddleDClick()) skip = context_->input().mouseDown(Input::MouseButton::Middle, true); else if (e.Aux1Down()) skip = context_->input().mouseDown(Input::MouseButton::Mouse4); else if (e.Aux1DClick()) skip = context_->input().mouseDown(Input::MouseButton::Mouse4, true); else if (e.Aux2Down()) skip = context_->input().mouseDown(Input::MouseButton::Mouse5); else if (e.Aux2DClick()) skip = context_->input().mouseDown(Input::MouseButton::Mouse5, true); if (skip) { // Set focus SetFocus(); e.Skip(); } }