|
utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
|
Keyboard event representation. More...
#include <headers/utility/event/keyboard_event.hpp>


Classes | |
| class | Factory |
| Factory for creating KeyboardEvent instances. More... | |
Public Types | |
| enum class | ScanCode : std::uint16_t { Unknown = 0 , A = 4 , B = 5 , C = 6 , D = 7 , E = 8 , F = 9 , G = 10 , H = 11 , I = 12 , J = 13 , K = 14 , L = 15 , M = 16 , N = 17 , O = 18 , P = 19 , Q = 20 , R = 21 , S = 22 , T = 23 , U = 24 , V = 25 , W = 26 , X = 27 , Y = 28 , Z = 29 , Num1 = 30 , Num2 = 31 , Num3 = 32 , Num4 = 33 , Num5 = 34 , Num6 = 35 , Num7 = 36 , Num8 = 37 , Num9 = 38 , Num0 = 39 , Return = 40 , Escape = 41 , Backspace = 42 , Tab = 43 , Space = 44 , Minus = 45 , Equals = 46 , LeftBracket = 47 , RightBracket = 48 , Backslash , NonUsHash = 50 , Semicolon = 51 , Apostrophe = 52 , Grave = 53 , Comma = 54 , Period = 55 , Slash = 56 , CapsLock = 57 , F1 = 58 , F2 = 59 , F3 = 60 , F4 = 61 , F5 = 62 , F6 = 63 , F7 = 64 , F8 = 65 , F9 = 66 , F10 = 67 , F11 = 68 , F12 = 69 , PrintScreen = 70 , ScrollLock = 71 , Pause = 72 , Insert = 73 , Home = 74 , PageUp = 75 , Delete = 76 , End = 77 , PageDown = 78 , Right = 79 , Left = 80 , Down = 81 , Up = 82 , NumLockClear = 83 , KeyPadDivide = 84 , KeyPadMultiply = 85 , KeyPadMinus = 86 , KeyPadPlus = 87 , KeyPadEnter = 88 , KeyPad1 = 89 , KeyPad2 = 90 , KeyPad3 = 91 , KeyPad4 = 92 , KeyPad5 = 93 , KeyPad6 = 94 , KeyPad7 = 95 , KeyPad8 = 96 , KeyPad9 = 97 , KeyPad0 = 98 , KeyPadPeriod = 99 , NonUsBackslash , Application = 101 , Power = 102 , KeyPadEquals = 103 , F13 = 104 , F14 = 105 , F15 = 106 , F16 = 107 , F17 = 108 , F18 = 109 , F19 = 110 , F20 = 111 , F21 = 112 , F22 = 113 , F23 = 114 , F24 = 115 , Execute = 116 , Help = 117 , Menu = 118 , Select = 119 , Stop = 120 , Again = 121 , Undo = 122 , Cut = 123 , Copy = 124 , Paste = 125 , Find = 126 , Mute = 127 , VolumeUp = 128 , VolumeDown = 129 , KeyPadComma = 133 , KeyPadEqualsAs400 = 134 , International1 = 135 , International2 = 136 , International3 = 137 , International4 = 138 , International5 = 139 , International6 = 140 , International7 = 141 , International8 = 142 , International9 = 143 , Lang1 = 144 , Lang2 = 145 , Lang3 = 146 , Lang4 = 147 , Lang5 = 148 , Lang6 = 149 , Lang7 = 150 , Lang8 = 151 , Lang9 = 152 , Alterase = 153 , Sysreq = 154 , Cancel = 155 , Clear = 156 , Prior = 157 , Return2 = 158 , Separator = 159 , Out = 160 , Oper = 161 , ClearAgain = 162 , Crsel = 163 , Exsel = 164 , KeyPad00 = 176 , KeyPad000 = 177 , ThousandsSeparator = 178 , DecimalSeparator = 179 , CurrencyUnit = 180 , CurrencySubunit = 181 , KeyPadLeftParen = 182 , KeyPadRightParen = 183 , KeyPadLeftBrace = 184 , KeyPadRightBrace = 185 , KeyPadTab = 186 , KeyPadBackspace = 187 , KeyPadA = 188 , KeyPadB = 189 , KeyPadC = 190 , KeyPadD = 191 , KeyPadE = 192 , KeyPadF = 193 , KeyPadXor = 194 , KeyPadPower = 195 , KeyPadPercent = 196 , KeyPadLess = 197 , KeyPadGreater = 198 , KeyPadAmpersand = 199 , KeyPadDoubleAmpersand = 200 , KeyPadVerticalbar = 201 , KeyPadDoubleVerticalBar , KeyPadColon = 203 , KeyPadHash = 204 , KeyPadSpace = 205 , KeyPadAt = 206 , KeyPadExclam = 207 , KeyPadMemoryStore = 208 , KeyPadMemoryRecall = 209 , KeyPadMemoryClear = 210 , KeyPadMemoryAdd = 211 , KeyPadMemorySubtract = 212 , KeyPadMemoryMultiply = 213 , KeyPadMemoryDivide = 214 , KeyPadPlusMinus = 215 , KeyPadClear = 216 , KeyPadClearEntry = 217 , KeyPadBinary = 218 , KeyPadOctal = 219 , KeyPadDecimal = 220 , KeyPadHexadecimal = 221 , LeftControl = 224 , LeftShift = 225 , LeftAlt = 226 , LeftGui = 227 , RightControl = 228 , RightShift = 229 , RightAlt = 230 , RightGui = 231 , Mode = 257 , Sleep = 258 , Wake = 259 , ChannelIncrement = 260 , ChannelDecrement = 261 , MediaPlay = 262 , MediaPause = 263 , MediaRecord = 264 , MediaFastForward = 265 , MediaRewind = 266 , MediaNextTrack = 267 , MediaPreviousTrack = 268 , MediaStop = 269 , MediaEject = 270 , MediaPlayPause = 271 , MediaSelect = 272 , AcNew = 273 , AcOpen = 274 , AcClose = 275 , AcExit = 276 , AcSave = 277 , AcPrint = 278 , AcProperties = 279 , AcSearch = 280 , AcHome = 281 , AcBack = 282 , AcForward = 283 , AcStop = 284 , AcRefresh = 285 , AcBookmarks = 286 , SoftLeft = 287 , SoftRight = 288 , Call = 289 , EndCall = 290 , Reserved = 400 , Count = 512 } |
| Key scan codes. More... | |
| enum class | KeyCode : std::int32_t { Unknown = -0x00000001 , Space = 0x00000020u , Apostrophe = 0x00000027u , Comma = 0x0000002Cu , Minus = 0x0000002Du , Period = 0x0000002Eu , Slash = 0x0000002Fu , Num0 = 0x00000030u , Num1 = 0x00000031u , Num2 = 0x00000032u , Num3 = 0x00000033u , Num4 = 0x00000034u , Num5 = 0x00000035u , Num6 = 0x00000036u , Num7 = 0x00000037u , Num8 = 0x00000038u , Num9 = 0x00000039u , Semicolon = 0x0000003Bu , Equals = 0x0000003Du , A = 0x00000041u , B = 0x00000042u , C = 0x00000043u , D = 0x00000044u , E = 0x00000045u , F = 0x00000046u , G = 0x00000047u , H = 0x00000048u , I = 0x00000049u , J = 0x0000004Au , K = 0x0000004Bu , L = 0x0000004Cu , M = 0x0000004Du , N = 0x0000004Eu , O = 0x0000004Fu , P = 0x00000050u , Q = 0x00000051u , R = 0x00000052u , S = 0x00000053u , T = 0x00000054u , U = 0x00000055u , V = 0x00000056u , W = 0x00000057u , X = 0x00000058u , Y = 0x00000059u , Z = 0x0000005Au , LeftBracket = 0x0000005Bu , Backslash = 0x0000005Cu , RightBracket = 0x0000005Du , Grave = 0x00000060u , Escape = 0x00000100u , Enter = 0x00000101u , Tab = 0x00000102u , Backspace = 0x00000103u , Insert = 0x00000104u , Delete = 0x00000105u , Right = 0x00000106u , Left = 0x00000107u , Down = 0x00000108u , Up = 0x00000109u , PageUp = 0x0000010Au , PageDown = 0x0000010Bu , Home = 0x0000010Cu , End = 0x0000010Du , CapsLock = 0x00000118u , ScrollLock = 0x00000119u , NumLockClear = 0x0000011Au , PrintScreen = 0x0000011Bu , Pause = 0x0000011Cu , F1 = 0x00000122u , F2 = 0x00000123u , F3 = 0x00000124u , F4 = 0x00000125u , F5 = 0x00000126u , F6 = 0x00000127u , F7 = 0x00000128u , F8 = 0x00000129u , F9 = 0x0000012Au , F10 = 0x0000012Bu , F11 = 0x0000012Cu , F12 = 0x0000012Du , F13 = 0x0000012Eu , F14 = 0x0000012Fu , F15 = 0x00000130u , F16 = 0x00000131u , F17 = 0x00000132u , F18 = 0x00000133u , F19 = 0x00000134u , F20 = 0x00000135u , F21 = 0x00000136u , F22 = 0x00000137u , F23 = 0x00000138u , F24 = 0x00000139u , KeyPad0 = 0x00000140u , KeyPad1 = 0x00000141u , KeyPad2 = 0x00000142u , KeyPad3 = 0x00000143u , KeyPad4 = 0x00000144u , KeyPad5 = 0x00000145u , KeyPad6 = 0x00000146u , KeyPad7 = 0x00000147u , KeyPad8 = 0x00000148u , KeyPad9 = 0x00000149u , KeyPadPeriod = 0x0000014Au , KeyPadDivide = 0x0000014Bu , KeyPadMultiply = 0x0000014Cu , KeyPadMinus = 0x0000014Du , KeyPadPlus = 0x0000014Eu , KeyPadEnter = 0x0000014Fu , KeyPadEquals = 0x00000150u , LeftShift = 0x00000154u , LeftControl = 0x00000155u , LeftAlt = 0x00000156u , LeftGui = 0x00000157u , RightShift = 0x00000158u , RightControl = 0x00000159u , RightAlt = 0x0000015Au , RightGui = 0x0000015Bu } |
| Virtual key codes derived from keyboard scancodes. More... | |
| enum class | KeyModifiers : std::uint16_t { Unknown = 0x0000u , LeftShift = 0x0001u , RightShift = 0x0002u , Level5Shift = 0x0004u , LeftCtrl = 0x0040u , RightCtrl = 0x0080u , LeftAlt = 0x0100u , RightAlt = 0x0200u , LeftGUI = 0x0400u , RightGUI = 0x0800u , NumLock = 0x1000u , CapsLock = 0x2000u , AltGr = 0x4000u , ScrollLock = 0x8000u , Ctrl = LeftCtrl | RightCtrl , Shift = LeftShift | RightShift , Alt = LeftAlt | RightAlt , Gui = LeftGUI | RightGUI } |
| Key modifier flags. More... | |
Public Member Functions | |
| KeyboardEvent (void) | |
| Default constructor. | |
| ~KeyboardEvent (void) override | |
| Default destructor. | |
| ScanCode | getScancode (void) const noexcept |
| Get the keyboard scancode. | |
| KeyboardEvent & | setScancode (const ScanCode scancode) noexcept |
| Set the keyboard scancode. | |
| KeyboardEvent & | setKeycode (const KeyCode keycode) noexcept |
| Set the virtual key code. | |
| KeyCode | getKeycode (void) const noexcept |
| Get the virtual key code. | |
| KeyboardEvent & | setModifiers (const KeyModifiers modifiers) noexcept |
| Set the key modifiers. | |
| bool | isModifierSet (const KeyModifiers modifier) const noexcept |
| Check if a specific key modifier is set. | |
| KeyboardEvent & | setIsDownEvent (const bool isDown) noexcept |
| Set whether the event is a key down event. | |
| bool | getIsDownEvent (void) const noexcept |
| Check if the event is a key down event. | |
| KeyboardEvent & | setIsRepeatEvent (const bool isRepeat) noexcept |
| Set whether the event is a key repeat event. | |
| bool | getIsRepeatEvent (void) const noexcept |
| Check if the event is a key repeat event. | |
Public Member Functions inherited from utility::event::Event | |
| Event (void)=default | |
| Default constructor. | |
| virtual | ~Event (void)=default |
| Virtual destructor. | |
Keyboard event representation.
Represents keyboard events, including key codes and modifier states.
Definition at line 39 of file keyboard_event.hpp.
|
strong |
Virtual key codes derived from keyboard scancodes.
Virtual key codes represent actual keys pressed on the keyboard, including printable characters and special function keys.
Definition at line 367 of file keyboard_event.hpp.
|
strong |
Key modifier flags.
Key modifiers represent the state of modifier keys (like Shift, Ctrl, Alt) during keyboard events.
Definition at line 493 of file keyboard_event.hpp.
|
strong |
Key scan codes.
Definition at line 45 of file keyboard_event.hpp.
|
noexcept |
Check if the event is a key down event.
Definition at line 91 of file keyboard_event.cpp.
|
noexcept |
Check if the event is a key repeat event.
Definition at line 102 of file keyboard_event.cpp.
|
noexcept |
Get the virtual key code.
Definition at line 62 of file keyboard_event.cpp.
|
noexcept |
Get the keyboard scancode.
Definition at line 45 of file keyboard_event.cpp.
|
noexcept |
Check if a specific key modifier is set.
| modifier | The key modifier to check. |
Definition at line 76 of file keyboard_event.cpp.
|
noexcept |
Set whether the event is a key down event.
| isDown | True if the event is a key down event, false otherwise. |
Definition at line 85 of file keyboard_event.cpp.
|
noexcept |
Set whether the event is a key repeat event.
| isRepeat | True if the event is a key repeat event, false otherwise. |
Definition at line 96 of file keyboard_event.cpp.
|
noexcept |
Set the virtual key code.
| keycode | The virtual key code to set. |
Definition at line 56 of file keyboard_event.cpp.
|
noexcept |
Set the key modifiers.
| modifiers | The key modifiers to set. |
Definition at line 68 of file keyboard_event.cpp.
|
noexcept |
Set the keyboard scancode.
| scancode | The keyboard scancode to set. |
Definition at line 50 of file keyboard_event.cpp.