LuciadCPillar 2023.1.04
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
 
std::optional< CoordinategetLastKnownLocation () const
 
ModifierKeys getModifierKeys () const noexcept
 
ButtonState getState () const
 
- 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.

◆ 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, expressed in screen coordinates (px) with top-left corner of the map being the (0,0) position.

◆ getModifierKeys()

ModifierKeys luciad::KeyEvent::getModifierKeys ( ) const
inlinenoexcept
Returns
the modifiers of the event.

◆ getState()

ButtonState luciad::KeyEvent::getState ( ) const
inline
Returns
the state of the key.