Gazebo Common

API Reference

5.7.0

Generic description of a mouse event. More...

#include <gz/common/MouseEvent.hh>

Public Types

enum  EventType {
  NO_EVENT , MOVE , PRESS , RELEASE ,
  SCROLL
}
 Mouse event types enumeration. More...
 
enum  MouseButton { NO_BUTTON = 0x0 , LEFT = 0x1 , MIDDLE = 0x2 , RIGHT = 0x4 }
 Standard mouse buttons enumeration. More...
 

Public Member Functions

 MouseEvent ()
 Constructor. More...
 
 MouseEvent (const MouseEvent &_other)
 Copy constructor. More...
 
virtual ~MouseEvent ()
 Destructor. More...
 
bool Alt () const
 Get the alt key press flag. More...
 
MouseEvent::MouseButton Button () const
 Get the button which caused this event. More...
 
unsigned int Buttons () const
 Get the state of the buttons when the event was generated. More...
 
bool Control () const
 Get the control key press flag. More...
 
bool Dragging () const
 Get the flag for mouse drag motion. More...
 
float MoveScale () const
 Get the scaling factor. More...
 
MouseEventoperator= (const MouseEvent &_other)
 Assignment operator. More...
 
math::Vector2i Pos () const
 Get mouse pointer position on the screen. More...
 
math::Vector2i PressPos () const
 Get the position of button press. More...
 
math::Vector2i PrevPos () const
 Get the previous position. More...
 
math::Vector2i Scroll () const
 Get the scroll position. More...
 
void SetAlt (bool _alt)
 Set the alt key press flag. More...
 
void SetButton (MouseEvent::MouseButton _button)
 Set the button which caused the event. More...
 
void SetButtons (unsigned int _buttons)
 Set the state of the buttons when the event was generated. More...
 
void SetControl (bool _control)
 Set the control key press flag. More...
 
void SetDragging (bool _dragging)
 Set the flag for mouse drag motion. More...
 
void SetMoveScale (float _scale)
 Set the scaling factor. More...
 
void SetPos (const math::Vector2i &_pos)
 Set mouse pointer position on the screen. More...
 
void SetPos (int _x, int _y)
 Set mouse pointer position on the screen. More...
 
void SetPressPos (const math::Vector2i &_pos)
 Set the position of button press. More...
 
void SetPressPos (int _x, int _y)
 Set the position of button press. More...
 
void SetPrevPos (const math::Vector2i &_pos)
 Set the previous position. More...
 
void SetPrevPos (int _x, int _y)
 Set the previous position. More...
 
void SetScroll (const math::Vector2i &_scroll)
 Set the scroll position. More...
 
void SetScroll (int _x, int _y)
 Set the scroll position. More...
 
void SetShift (bool _shift)
 Set the shift key press flag. More...
 
void SetType (MouseEvent::EventType _type)
 Set the event type. More...
 
bool Shift () const
 Get the shift key press flag. More...
 
EventType Type () const
 Get the event type. More...
 

Detailed Description

Generic description of a mouse event.

Member Enumeration Documentation

◆ EventType

enum EventType

Mouse event types enumeration.

Enumerator
NO_EVENT 

No event.

MOVE 

Move event.

PRESS 

Press event.

RELEASE 

Release event.

SCROLL 

Scroll event.

◆ MouseButton

Standard mouse buttons enumeration.

Enumerator
NO_BUTTON 

No button.

LEFT 

Left button.

MIDDLE 

Middle button.

RIGHT 

Right button.

Constructor & Destructor Documentation

◆ MouseEvent() [1/2]

Constructor.

◆ MouseEvent() [2/2]

MouseEvent ( const MouseEvent _other)

Copy constructor.

Parameters
[in]_otherOther mouse event

◆ ~MouseEvent()

virtual ~MouseEvent ( )
virtual

Destructor.

Member Function Documentation

◆ Alt()

bool Alt ( ) const

Get the alt key press flag.

Returns
True if the alt key is pressed.

◆ Button()

MouseEvent::MouseButton Button ( ) const

Get the button which caused this event.

Returns
The button which caused this event.

◆ Buttons()

unsigned int Buttons ( ) const

Get the state of the buttons when the event was generated.

Returns
The state of the buttons, which can be a bitwise combination of MouseEvent::MouseButton.

◆ Control()

bool Control ( ) const

Get the control key press flag.

Returns
True if the control key is pressed.

◆ Dragging()

bool Dragging ( ) const

Get the flag for mouse drag motion.

Returns
True if dragging, usually indicating a mouse move with mouse button pressed.

◆ MoveScale()

float MoveScale ( ) const

Get the scaling factor.

Returns
The move scaling factor.

◆ operator=()

MouseEvent& operator= ( const MouseEvent _other)

Assignment operator.

Parameters
[in]_otherOther mouse event
Returns
this

◆ Pos()

math::Vector2i Pos ( ) const

Get mouse pointer position on the screen.

Returns
Mouse pointer position on the screen.

◆ PressPos()

math::Vector2i PressPos ( ) const

Get the position of button press.

Returns
Screen position of a button press.

◆ PrevPos()

math::Vector2i PrevPos ( ) const

Get the previous position.

Returns
The previous mouse position.

◆ Scroll()

math::Vector2i Scroll ( ) const

Get the scroll position.

Returns
The scroll position.

◆ SetAlt()

void SetAlt ( bool  _alt)

Set the alt key press flag.

Parameters
[in]_altThe alt key flag.

◆ SetButton()

void SetButton ( MouseEvent::MouseButton  _button)

Set the button which caused the event.

Parameters
[in]_buttonThe button which caused this event.

◆ SetButtons()

void SetButtons ( unsigned int  _buttons)

Set the state of the buttons when the event was generated.

Parameters
[in]_buttonsThe state of the buttons, which can be a bitwise combination of MouseEvent::MouseButton.

◆ SetControl()

void SetControl ( bool  _control)

Set the control key press flag.

Parameters
[in]_controlThe control key flag.

◆ SetDragging()

void SetDragging ( bool  _dragging)

Set the flag for mouse drag motion.

Parameters
[in]_draggingThe dragging flag.

◆ SetMoveScale()

void SetMoveScale ( float  _scale)

Set the scaling factor.

Parameters
[in]_scaleThe move scaling factor.

◆ SetPos() [1/2]

void SetPos ( const math::Vector2i _pos)

Set mouse pointer position on the screen.

Parameters
[in]_posMouse pointer position on the screen.

◆ SetPos() [2/2]

void SetPos ( int  _x,
int  _y 
)

Set mouse pointer position on the screen.

Parameters
[in]_xMouse pointer X position on the screen.
[in]_yMouse pointer Y position on the screen.

◆ SetPressPos() [1/2]

void SetPressPos ( const math::Vector2i _pos)

Set the position of button press.

Parameters
[in]_posMouse pointer position on the screen.

◆ SetPressPos() [2/2]

void SetPressPos ( int  _x,
int  _y 
)

Set the position of button press.

Parameters
[in]_xMouse pointer X position on the screen.
[in]_yMouse pointer Y position on the screen.

◆ SetPrevPos() [1/2]

void SetPrevPos ( const math::Vector2i _pos)

Set the previous position.

Parameters
[in]_posPrevious mouse pointer position on the screen.

◆ SetPrevPos() [2/2]

void SetPrevPos ( int  _x,
int  _y 
)

Set the previous position.

Parameters
[in]_xPrevious mouse pointer X position on the screen.
[in]_yPrevious mouse pointer Y position on the screen.

◆ SetScroll() [1/2]

void SetScroll ( const math::Vector2i _scroll)

Set the scroll position.

Parameters
[in]_scrollScroll position.

◆ SetScroll() [2/2]

void SetScroll ( int  _x,
int  _y 
)

Set the scroll position.

Parameters
[in]_xScroll X position.
[in]_yScroll Y position.

◆ SetShift()

void SetShift ( bool  _shift)

Set the shift key press flag.

Parameters
[in]_shiftThe shift key press flag.

◆ SetType()

void SetType ( MouseEvent::EventType  _type)

Set the event type.

Parameters
[in]_typeThe EventType.

◆ Shift()

bool Shift ( ) const

Get the shift key press flag.

Returns
True if the shift key is pressed.

◆ Type()

EventType Type ( ) const

Get the event type.

Returns
The EventType.

The documentation for this class was generated from the following file: