KeyEvent Class Reference
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. | |
KeyEvent & | operator= (const KeyEvent &_other) |
Assignment operator. | |
KeyEvent & | operator= (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 |
Constructor & Destructor Documentation
◆ KeyEvent() [1/3]
KeyEvent | ( | ) |
Constructor.
◆ KeyEvent() [2/3]
◆ KeyEvent() [3/3]
◆ ~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]
Assignment operator.
- Parameters
-
[in] _other Other key event
- Returns
- this
◆ operator=() [2/2]
Move assignment operator.
- Parameters
-
[in] _other Other key event
- Returns
- this
◆ SetAlt()
void SetAlt | ( | bool | _alt | ) |
Set whether the alt key was held during this key event.
- Parameters
-
[in] _alt Status of the alt key
◆ SetControl()
void SetControl | ( | bool | _control | ) |
Set whether the control key was held during this key event.
- Parameters
-
[in] _control Status of the control key
◆ SetKey()
void SetKey | ( | int | _key | ) |
Set the key.
- Parameters
-
[in] _key The key number
◆ SetShift()
void SetShift | ( | bool | _shift | ) |
Set whether the shift key was held during this key event.
- Parameters
-
[in] _shift Status of the shift key
◆ SetText()
void SetText | ( | const std::string & | _text | ) |
Set the formatted string of the key pressed.
- Parameters
-
[in] _text Formatted string of the key pressed.
◆ SetType()
◆ 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: