Gazebo Common

API Reference

6.0.0~pre2

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

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: