Ignition Common

API Reference

4.5.0

Generic description of a keyboard event. More...

#include <ignition/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 (const bool _alt)
 Set whether the alt key was held during this key event. More...
 
void SetControl (const bool _control)
 Set whether the control key was held during this key event. More...
 
void SetKey (const int _key)
 Set the key. More...
 
void SetShift (const 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 (const 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 ( const bool  _alt)

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

Parameters
[in]_altStatus of the alt key

◆ SetControl()

void SetControl ( const bool  _control)

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

Parameters
[in]_controlStatus of the control key

◆ SetKey()

void SetKey ( const int  _key)

Set the key.

Parameters
[in]_keyThe key number

◆ SetShift()

void SetShift ( const 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 ( const 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: