Gazebo Common

API Reference

5.7.0

Generic description of a keyboard event. More...

#include <gz/common/KeyEvent.hh>

Public Types

enum  EventType { NO_EVENT , PRESS , RELEASE }
 Key event types enumeration. More...
 

Public Member Functions

 KeyEvent ()
 Constructor. More...
 
 KeyEvent (const KeyEvent &_other)
 Copy constructor. More...
 
 KeyEvent (KeyEvent &&_other)
 
 ~KeyEvent ()
 Destructor. More...
 
bool Alt () const
 Get whether the alt key was held during this key event. More...
 
bool Control () const
 Get whether the control key was held during this key event. More...
 
int Key () const
 Get the key number. More...
 
KeyEventoperator= (const KeyEvent &_other)
 Assignment operator. More...
 
KeyEventoperator= (KeyEvent &&other)
 Move assignment operator. More...
 
void SetAlt (bool _alt)
 Set whether the alt key was held during this key event. More...
 
void SetControl (bool _control)
 Set whether the control key was held during this key event. More...
 
void SetKey (int _key)
 Set the key. More...
 
void SetShift (bool _shift)
 Set whether the shift key was held during this key event. More...
 
void SetText (const std::string &_text)
 Set the formatted string of the key pressed. More...
 
void SetType (EventType _type)
 Set the event type. More...
 
bool Shift () const
 Get whether the shift key was held during this key event. More...
 
std::string Text () const
 Get the formatted string of the key pressed (could be uppercase). More...
 
EventType Type () const
 Get the event type. More...
 

Detailed Description

Generic description of a keyboard event.

Member Enumeration Documentation

◆ EventType

enum EventType

Key event types enumeration.

Enumerator
NO_EVENT 
PRESS 
RELEASE 

Constructor & Destructor Documentation

◆ KeyEvent() [1/3]

KeyEvent ( )

Constructor.

◆ KeyEvent() [2/3]

KeyEvent ( const KeyEvent _other)

Copy constructor.

Parameters
[in]_otherOther key event

◆ KeyEvent() [3/3]

KeyEvent ( KeyEvent &&  _other)
Parameters
[in]_otherOther key event

◆ ~KeyEvent()

~KeyEvent ( )

Destructor.

Member Function Documentation

◆ Alt()

bool Alt ( ) const

Get whether the alt key was held during this key event.

Returns
True if the alt key was pressed

◆ Control()

bool Control ( ) const

Get whether the control key was held during this key event.

Returns
True if the control key was pressed

◆ Key()

int Key ( ) const

Get the key number.

Returns
The key number

◆ operator=() [1/2]

KeyEvent& operator= ( const KeyEvent _other)

Assignment operator.

Parameters
[in]_otherOther key event
Returns
this

◆ operator=() [2/2]

KeyEvent& operator= ( KeyEvent &&  other)

Move assignment operator.

Parameters
[in]_otherOther key event
Returns
this

◆ SetAlt()

void SetAlt ( bool  _alt)

Set whether the alt key was held during this key event.

Parameters
[in]_altStatus of the alt key

◆ SetControl()

void SetControl ( bool  _control)

Set whether the control key was held during this key event.

Parameters
[in]_controlStatus of the control key

◆ SetKey()

void SetKey ( int  _key)

Set the key.

Parameters
[in]_keyThe key number

◆ SetShift()

void SetShift ( bool  _shift)

Set whether the shift key was held during this key event.

Parameters
[in]_shiftStatus of the shift key

◆ SetText()

void SetText ( const std::string _text)

Set the formatted string of the key pressed.

Parameters
[in]_textFormatted string of the key pressed.

◆ SetType()

void SetType ( EventType  _type)

Set the event type.

Parameters
[in]_typeEvent type

◆ Shift()

bool Shift ( ) const

Get whether the shift key was held during this key event.

Returns
True if the shift key was pressed

◆ Text()

std::string Text ( ) const

Get the formatted string of the key pressed (could be uppercase).

Returns
The formatted string of the key pressed.

◆ Type()

EventType Type ( ) const

Get the event type.

Returns
The key event type

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