LuciadCPillar 2024.0.08
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
luciad::KeyEvent Class Referencefinal

Implementation of luciad::IInputEvent that represents keyboard input. More...

#include <luciad/input/IInputEvent.h>

Inheritance diagram for luciad::KeyEvent:
luciad::IInputEvent

Public Member Functions

 KeyEvent (ButtonState state, KeyCode key, ModifierKeys modifierKeys)
 Creates a key event. More...
 
 KeyEvent (ButtonState state, KeyCode key, ModifierKeys modifierKeys, Coordinate lastKnownLocation)
 Creates a key event. More...
 
KeyCode getKey () const noexcept
 Returns the key of the event. More...
 
std::optional< CoordinategetLastKnownLocation () const
 Returns the last know location of the input device (for example the mouse cursor) when this event occurred. More...
 
ModifierKeys getModifierKeys () const noexcept
 Returns the modifiers of the event. More...
 
ButtonState getState () const
 Returns the state of the key. More...
 
- Public Member Functions inherited from luciad::IInputEvent
virtual ~IInputEvent ()=default
 

Detailed Description

Implementation of luciad::IInputEvent that represents keyboard input.

This class contains the button state, the key and the modifiers if any.

Since
2020.1

Constructor & Destructor Documentation

◆ KeyEvent() [1/2]

luciad::KeyEvent::KeyEvent ( ButtonState  state,
KeyCode  key,
ModifierKeys  modifierKeys 
)
inline

Creates a key event.

Parameters
stateThe state of the key.
keyThe key of the event.
modifierKeysThe modifiers of the event.

◆ KeyEvent() [2/2]

luciad::KeyEvent::KeyEvent ( ButtonState  state,
KeyCode  key,
ModifierKeys  modifierKeys,
Coordinate  lastKnownLocation 
)
inline

Creates a key event.

Parameters
stateThe state of the key.
keyThe key of the event.
modifierKeysThe modifiers of the event.
lastKnownLocationThe last known location of the mouse

Member Function Documentation

◆ getKey()

KeyCode luciad::KeyEvent::getKey ( ) const
inlinenoexcept

Returns the key of the event.

Returns
the key of the event.

◆ getLastKnownLocation()

std::optional< Coordinate > luciad::KeyEvent::getLastKnownLocation ( ) const
inline

Returns the last know location of the input device (for example the mouse cursor) when this event occurred.

It is expressed in screen coordinates (px) with top-left corner of the map being the (0,0) position.

Returns
the last know location of the input device when this event occurred.

◆ getModifierKeys()

ModifierKeys luciad::KeyEvent::getModifierKeys ( ) const
inlinenoexcept

Returns the modifiers of the event.

Returns
the modifiers of the event.

◆ getState()

ButtonState luciad::KeyEvent::getState ( ) const
inline

Returns the state of the key.

Returns
the state of the key.