コード例 #1
0
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;
}
コード例 #2
0
ファイル: MapCanvas.cpp プロジェクト: Talon1024/SLADE
/* MapCanvas::onMouseUp
 * Called when a mouse button is released within the canvas
 *******************************************************************/
void MapCanvas::onMouseUp(wxMouseEvent& e)
{
	using namespace MapEditor;

	// Send to editor context
	bool skip = true;
	context_->input().updateKeyModifiersWx(e.GetModifiers());
	if (e.LeftUp())
		skip = context_->input().mouseUp(Input::MouseButton::Left);
	else if (e.RightUp())
		skip = context_->input().mouseUp(Input::MouseButton::Right);
	else if (e.MiddleUp())
		skip = context_->input().mouseUp(Input::MouseButton::Middle);
	else if (e.Aux1Up())
		skip = context_->input().mouseUp(Input::MouseButton::Mouse4);
	else if (e.Aux2Up())
		skip = context_->input().mouseUp(Input::MouseButton::Mouse5);

	if (skip)
		e.Skip();
}
コード例 #3
0
ファイル: Input.cpp プロジェクト: HeliumProject/Helium
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 ); }
}