Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
KeyPress Class Reference

#include <keycode.h>

Public Member Functions

 KeyPress ()=default
 
 KeyPress (const std::string &name)
 
 KeyPress (const SEvent::SKeyInput &in)
 
std::string sym () const
 
std::string name () const
 
EKEY_CODE getKeycode () const
 
wchar_t getKeychar () const
 
u32 getScancode () const
 
bool operator== (KeyPress o) const
 
bool operator!= (KeyPress o) const
 
bool operator< (KeyPress o) const
 
 operator bool () const
 

Static Public Member Functions

static KeyPress getSpecialKey (const std::string &name)
 

Private Types

using value_type = std::variant<u32, EKEY_CODE>
 

Private Member Functions

bool loadFromScancode (const std::string &name)
 
void loadFromKey (EKEY_CODE keycode, wchar_t keychar)
 
std::string formatScancode () const
 

Private Attributes

value_type scancode = KEY_UNKNOWN
 

Member Typedef Documentation

◆ value_type

using KeyPress::value_type = std::variant<u32, EKEY_CODE>
private

Constructor & Destructor Documentation

◆ KeyPress() [1/3]

KeyPress::KeyPress ( )
default

Referenced by getSpecialKey().

+ Here is the caller graph for this function:

◆ KeyPress() [2/3]

KeyPress::KeyPress ( const std::string & name)

References loadFromKey(), loadFromScancode(), lookup_keyname(), and name().

+ Here is the call graph for this function:

◆ KeyPress() [3/3]

KeyPress::KeyPress ( const SEvent::SKeyInput & in)

References scancode.

Member Function Documentation

◆ formatScancode()

std::string KeyPress::formatScancode ( ) const
private

References scancode.

Referenced by sym().

+ Here is the caller graph for this function:

◆ getKeychar()

wchar_t KeyPress::getKeychar ( ) const

References table_key::Char, lookup_scancode(), and scancode.

Referenced by TouchControls::emitKeyboardEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getKeycode()

EKEY_CODE KeyPress::getKeycode ( ) const

References table_key::Key, lookup_scancode(), and scancode.

Referenced by TouchControls::emitKeyboardEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScancode()

u32 KeyPress::getScancode ( ) const
inline

References scancode.

Referenced by TouchControls::emitKeyboardEvent(), and name().

+ Here is the caller graph for this function:

◆ getSpecialKey()

KeyPress KeyPress::getSpecialKey ( const std::string & name)
static

References KeyPress(), name(), and specialKeyCache.

+ Here is the call graph for this function:

◆ loadFromKey()

void KeyPress::loadFromKey ( EKEY_CODE keycode,
wchar_t keychar )
private

References RenderingEngine::get_raw_device(), and scancode.

Referenced by KeyPress().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFromScancode()

bool KeyPress::loadFromScancode ( const std::string & name)
private

References name(), p(), scancode, and str_starts_with().

Referenced by KeyPress().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ name()

std::string KeyPress::name ( ) const

References fmtgettext(), getScancode(), table_key::LangName, lookup_scancode(), name(), scancode, and strgettext().

Referenced by KeyPress(), GUIButtonKey::cancelCapture(), getSpecialKey(), ModApiMenuCommon::l_get_key_description(), loadFromScancode(), name(), GUIButtonKey::setKey(), and sym().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator bool()

KeyPress::operator bool ( ) const
inline

References scancode.

◆ operator!=()

bool KeyPress::operator!= ( KeyPress o) const
inline

◆ operator<()

bool KeyPress::operator< ( KeyPress o) const
inline

References scancode.

◆ operator==()

bool KeyPress::operator== ( KeyPress o) const
inline

References scancode.

◆ sym()

std::string KeyPress::sym ( ) const

References formatScancode(), lookup_scancode(), table_key::Name, name(), and scancode.

Referenced by GUIButtonKey::setKey().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ scancode


The documentation for this class was generated from the following files: