lxgui
include
lxgui
input_keys.hpp
1
#ifndef LXGUI_INPUT_KEYS_HPP
2
#define LXGUI_INPUT_KEYS_HPP
3
4
#include "lxgui/lxgui.hpp"
5
6
#include <cstdint>
7
#include <optional>
8
#include <string_view>
9
10
namespace
lxgui::input
{
11
12
enum class
mouse_button
: std::uint8_t {
left
= 0,
right
,
middle
};
13
14
enum class
mouse_button_event
: std::uint8_t {
up
= 0,
down
= 1,
double_click
= 2 };
15
16
enum class
key
: std::uint8_t {
17
k_unassigned
= 0x00,
18
k_escape
= 0x01,
19
k_1
= 0x02,
20
k_2
= 0x03,
21
k_3
= 0x04,
22
k_4
= 0x05,
23
k_5
= 0x06,
24
k_6
= 0x07,
25
k_7
= 0x08,
26
k_8
= 0x09,
27
k_9
= 0x0A,
28
k_0
= 0x0B,
29
k_minus
= 0x0C,
30
k_equals
= 0x0D,
31
k_back
= 0x0E,
32
k_tab
= 0x0F,
33
k_q
= 0x10,
34
k_w
= 0x11,
35
k_e
= 0x12,
36
k_r
= 0x13,
37
k_t
= 0x14,
38
k_y
= 0x15,
39
k_u
= 0x16,
40
k_i
= 0x17,
41
k_o
= 0x18,
42
k_p
= 0x19,
43
k_lbracket
= 0x1A,
44
k_rbracket
= 0x1B,
45
k_return
= 0x1C,
46
k_lcontrol
= 0x1D,
47
k_a
= 0x1E,
48
k_s
= 0x1F,
49
k_d
= 0x20,
50
k_f
= 0x21,
51
k_g
= 0x22,
52
k_h
= 0x23,
53
k_j
= 0x24,
54
k_k
= 0x25,
55
k_l
= 0x26,
56
k_semicolon
= 0x27,
57
k_apostrophe
= 0x28,
58
k_grave
= 0x29,
59
k_lshift
= 0x2A,
60
k_backslash
= 0x2B,
61
k_z
= 0x2C,
62
k_x
= 0x2D,
63
k_c
= 0x2E,
64
k_v
= 0x2F,
65
k_b
= 0x30,
66
k_n
= 0x31,
67
k_m
= 0x32,
68
k_comma
= 0x33,
69
k_period
= 0x34,
70
k_slash
= 0x35,
71
k_rshift
= 0x36,
72
k_multiply
= 0x37,
73
k_lmenu
= 0x38,
74
k_space
= 0x39,
75
k_capital
= 0x3A,
76
k_f1
= 0x3B,
77
k_f2
= 0x3C,
78
k_f3
= 0x3D,
79
k_f4
= 0x3E,
80
k_f5
= 0x3F,
81
k_f6
= 0x40,
82
k_f7
= 0x41,
83
k_f8
= 0x42,
84
k_f9
= 0x43,
85
k_f10
= 0x44,
86
k_numlock
= 0x45,
87
k_scroll
= 0x46,
88
k_numpad_7
= 0x47,
89
k_numpad_8
= 0x48,
90
k_numpad_9
= 0x49,
91
k_subtract
= 0x4A,
92
k_numpad_4
= 0x4B,
93
k_numpad_5
= 0x4C,
94
k_numpad_6
= 0x4D,
95
k_add
= 0x4E,
96
k_numpad_1
= 0x4F,
97
k_numpad_2
= 0x50,
98
k_numpad_3
= 0x51,
99
k_numpad_0
= 0x52,
100
k_decimal
= 0x53,
101
k_oem_102
= 0x56,
102
k_f11
= 0x57,
103
k_f12
= 0x58,
104
k_f13
= 0x64,
105
k_f14
= 0x65,
106
k_f15
= 0x66,
107
k_kana
= 0x70,
108
k_abnt_c1
= 0x73,
109
k_convert
= 0x79,
110
k_noconvert
= 0x7B,
111
k_yen
= 0x7D,
112
k_abnt_c2
= 0x7E,
113
k_numpadequals
= 0x8D,
114
k_prevtrack
= 0x90,
115
k_at
= 0x91,
116
k_colon
= 0x92,
117
k_underline
= 0x93,
118
k_kanji
= 0x94,
119
k_stop
= 0x95,
120
k_ax
= 0x96,
121
k_unlabeled
= 0x97,
122
k_nexttrack
= 0x99,
123
k_numpadenter
= 0x9C,
124
k_rcontrol
= 0x9D,
125
k_mute
= 0xA0,
126
k_calculator
= 0xA1,
127
k_playpause
= 0xA2,
128
k_mediastop
= 0xA4,
129
k_volumedown
= 0xAE,
130
k_volumeup
= 0xB0,
131
k_webhome
= 0xB2,
132
k_numpadcomma
= 0xB3,
133
k_divide
= 0xB5,
134
k_sysrq
= 0xB7,
135
k_rmenu
= 0xB8,
136
k_pause
= 0xC5,
137
k_home
= 0xC7,
138
k_up
= 0xC8,
139
k_pgup
= 0xC9,
140
k_left
= 0xCB,
141
k_right
= 0xCD,
142
k_end
= 0xCF,
143
k_down
= 0xD0,
144
k_pgdown
= 0xD1,
145
k_insert
= 0xD2,
146
k_delete
= 0xD3,
147
k_lwin
= 0xDB,
148
k_rwin
= 0xDC,
149
k_apps
= 0xDD,
150
k_power
= 0xDE,
151
k_sleep
= 0xDF,
152
k_wake
= 0xE3,
153
k_websearch
= 0xE5,
154
k_webfavorites
= 0xE6,
155
k_webrefresh
= 0xE7,
156
k_webstop
= 0xE8,
157
k_webforward
= 0xE9,
158
k_webback
= 0xEA,
159
k_mycomputer
= 0xEB,
160
k_mail
= 0xEC,
161
k_mediaselect
= 0xED,
162
k_maxkey
= 0xFF
163
};
164
173
std::string_view
get_mouse_button_codename
(
mouse_button
button_id);
174
182
std::string_view
get_localizable_mouse_button_name
(
mouse_button
button_id);
183
192
std::string_view
get_mouse_button_event_codename
(
mouse_button_event
button_event);
193
201
std::string_view
get_localizable_mouse_button_event_name
(
mouse_button_event
button_event);
202
212
std::string_view
213
get_mouse_button_and_event_codename
(
mouse_button
button_id,
mouse_button_event
button_event);
214
220
std::optional<std::pair<mouse_button, mouse_button_event>>
221
get_mouse_button_and_event_from_codename
(std::string_view button_and_event_name);
222
231
std::string_view
get_key_codename
(
key
key_id);
232
239
key
get_key_from_codename
(std::string_view key_name);
240
248
std::string_view
get_localizable_key_name
(
key
key_id);
249
250
constexpr std::size_t
mouse_button_number
= 3u;
251
constexpr std::size_t
key_number
=
static_cast<
std::size_t
>
(
key::k_maxkey
);
252
253
}
// namespace lxgui::input
254
255
#endif
lxgui::input
Definition:
input_dispatcher.cpp:13
lxgui::input::get_mouse_button_event_codename
std::string_view get_mouse_button_event_codename(mouse_button_event button_event)
Returns a standard English name for the provided mouse button event.
Definition:
input_keys.cpp:25
lxgui::input::get_localizable_mouse_button_name
std::string_view get_localizable_mouse_button_name(mouse_button button_id)
Returns the localizable name of the provided mouse button.
Definition:
input_keys.cpp:16
lxgui::input::get_mouse_button_and_event_from_codename
std::optional< std::pair< mouse_button, mouse_button_event > > get_mouse_button_and_event_from_codename(std::string_view button_and_event_name)
Returns a mouse button and a button event ID from a string formatted as "<button>:<event>".
Definition:
input_keys.cpp:72
lxgui::input::key
key
Definition:
input_keys.hpp:16
lxgui::input::key::k_convert
@ k_convert
/ ? on Portugese (Brazilian) keyboards
lxgui::input::key::k_webfavorites
@ k_webfavorites
Web Search.
lxgui::input::key::k_tab
@ k_tab
Backspace.
lxgui::input::key::k_abnt_c2
@ k_abnt_c2
(Japanese keyboard)
lxgui::input::key::k_f15
@ k_f15
(NEC PC98)
lxgui::input::key::k_semicolon
@ k_semicolon
lxgui::input::key::k_subtract
@ k_subtract
lxgui::input::key::k_apostrophe
@ k_apostrophe
lxgui::input::key::k_p
@ k_p
lxgui::input::key::k_space
@ k_space
Left Alt.
lxgui::input::key::k_pause
@ k_pause
Right Alt.
lxgui::input::key::k_q
@ k_q
lxgui::input::key::k_k
@ k_k
lxgui::input::key::k_e
@ k_e
lxgui::input::key::k_rwin
@ k_rwin
Left Windows key.
lxgui::input::key::k_apps
@ k_apps
Right Windows key.
lxgui::input::key::k_mail
@ k_mail
My Computer.
lxgui::input::key::k_o
@ k_o
lxgui::input::key::k_f7
@ k_f7
lxgui::input::key::k_h
@ k_h
lxgui::input::key::k_s
@ k_s
lxgui::input::key::k_f
@ k_f
lxgui::input::key::k_f5
@ k_f5
lxgui::input::key::k_pgup
@ k_pgup
UpArrow on arrow keypad.
lxgui::input::key::k_v
@ k_v
lxgui::input::key::k_4
@ k_4
lxgui::input::key::k_t
@ k_t
lxgui::input::key::k_end
@ k_end
RightArrow on arrow keypad.
lxgui::input::key::k_9
@ k_9
lxgui::input::key::k_left
@ k_left
PgUp on arrow keypad.
lxgui::input::key::k_i
@ k_i
lxgui::input::key::k_0
@ k_0
lxgui::input::key::k_delete
@ k_delete
Insert on arrow keypad.
lxgui::input::key::k_underline
@ k_underline
(NEC PC98)
lxgui::input::key::k_numlock
@ k_numlock
lxgui::input::key::k_sysrq
@ k_sysrq
/ on numeric keypad
lxgui::input::key::k_5
@ k_5
lxgui::input::key::k_backslash
@ k_backslash
lxgui::input::key::k_l
@ k_l
lxgui::input::key::k_prevtrack
@ k_prevtrack
= on numeric keypad (NEC PC98)
lxgui::input::key::k_1
@ k_1
lxgui::input::key::k_2
@ k_2
lxgui::input::key::k_numpadenter
@ k_numpadenter
Next Track.
lxgui::input::key::k_u
@ k_u
lxgui::input::key::k_webrefresh
@ k_webrefresh
Web Favorites.
lxgui::input::key::k_webstop
@ k_webstop
Web Refresh.
lxgui::input::key::k_numpad_8
@ k_numpad_8
lxgui::input::key::k_ax
@ k_ax
(NEC PC98)
lxgui::input::key::k_volumedown
@ k_volumedown
Media Stop.
lxgui::input::key::k_x
@ k_x
lxgui::input::key::k_return
@ k_return
lxgui::input::key::k_f6
@ k_f6
lxgui::input::key::k_oem_102
@ k_oem_102
. on numeric keypad
lxgui::input::key::k_kana
@ k_kana
(NEC PC98)
lxgui::input::key::k_home
@ k_home
Pause.
lxgui::input::key::k_7
@ k_7
lxgui::input::key::k_lwin
@ k_lwin
Delete on arrow keypad.
lxgui::input::key::k_sleep
@ k_sleep
System Power.
lxgui::input::key::k_r
@ k_r
lxgui::input::key::k_websearch
@ k_websearch
System Wake.
lxgui::input::key::k_w
@ k_w
lxgui::input::key::k_scroll
@ k_scroll
lxgui::input::key::k_kanji
@ k_kanji
(NEC PC98)
lxgui::input::key::k_numpad_5
@ k_numpad_5
lxgui::input::key::k_numpad_1
@ k_numpad_1
lxgui::input::key::k_g
@ k_g
lxgui::input::key::k_n
@ k_n
lxgui::input::key::k_a
@ k_a
lxgui::input::key::k_webforward
@ k_webforward
Web Stop.
lxgui::input::key::k_6
@ k_6
lxgui::input::key::k_add
@ k_add
lxgui::input::key::k_lcontrol
@ k_lcontrol
Enter on main keyboard.
lxgui::input::key::k_b
@ k_b
lxgui::input::key::k_insert
@ k_insert
PgDn on arrow keypad.
lxgui::input::key::k_down
@ k_down
End on arrow keypad.
lxgui::input::key::k_f10
@ k_f10
lxgui::input::key::k_numpad_6
@ k_numpad_6
lxgui::input::key::k_comma
@ k_comma
lxgui::input::key::k_mute
@ k_mute
lxgui::input::key::k_numpad_2
@ k_numpad_2
lxgui::input::key::k_unassigned
@ k_unassigned
lxgui::input::key::k_z
@ k_z
lxgui::input::key::k_mediastop
@ k_mediastop
Play / Pause.
lxgui::input::key::k_f9
@ k_f9
lxgui::input::key::k_equals
@ k_equals
lxgui::input::key::k_volumeup
@ k_volumeup
Volume -.
lxgui::input::key::k_playpause
@ k_playpause
Calculator.
lxgui::input::key::k_numpad_4
@ k_numpad_4
lxgui::input::key::k_j
@ k_j
lxgui::input::key::k_lmenu
@ k_lmenu
lxgui::input::key::k_m
@ k_m
lxgui::input::key::k_nexttrack
@ k_nexttrack
(J3100)
lxgui::input::key::k_wake
@ k_wake
System Sleep.
lxgui::input::key::k_d
@ k_d
lxgui::input::key::k_period
@ k_period
lxgui::input::key::k_right
@ k_right
LeftArrow on arrow keypad.
lxgui::input::key::k_stop
@ k_stop
(Japanese keyboard)
lxgui::input::key::k_webback
@ k_webback
Web Forward.
lxgui::input::key::k_minus
@ k_minus
lxgui::input::key::k_numpadcomma
@ k_numpadcomma
Web home.
lxgui::input::key::k_power
@ k_power
AppMenu key.
lxgui::input::key::k_calculator
@ k_calculator
Mute.
lxgui::input::key::k_abnt_c1
@ k_abnt_c1
(Japanese keyboard)
lxgui::input::key::k_up
@ k_up
Home on arrow keypad.
lxgui::input::key::k_rshift
@ k_rshift
/ on main keyboard
lxgui::input::key::k_f14
@ k_f14
(NEC PC98)
lxgui::input::key::k_numpad_3
@ k_numpad_3
lxgui::input::key::k_decimal
@ k_decimal
lxgui::input::key::k_slash
@ k_slash
. on main keyboard
lxgui::input::key::k_8
@ k_8
lxgui::input::key::k_lbracket
@ k_lbracket
lxgui::input::key::k_grave
@ k_grave
lxgui::input::key::k_pgdown
@ k_pgdown
DownArrow on arrow keypad.
lxgui::input::key::k_multiply
@ k_multiply
lxgui::input::key::k_f11
@ k_f11
< > | on UK/Germany keyboards
lxgui::input::key::k_numpad_9
@ k_numpad_9
lxgui::input::key::k_f12
@ k_f12
lxgui::input::key::k_f8
@ k_f8
lxgui::input::key::k_numpadequals
@ k_numpadequals
Numpad . on Portugese (Brazilian) keyboards.
lxgui::input::key::k_rcontrol
@ k_rcontrol
Enter on numeric keypad.
lxgui::input::key::k_yen
@ k_yen
(Japanese keyboard)
lxgui::input::key::k_unlabeled
@ k_unlabeled
(Japan AX)
lxgui::input::key::k_f2
@ k_f2
lxgui::input::key::k_rmenu
@ k_rmenu
lxgui::input::key::k_c
@ k_c
lxgui::input::key::k_escape
@ k_escape
lxgui::input::key::k_noconvert
@ k_noconvert
(Japanese keyboard)
lxgui::input::key::k_f1
@ k_f1
lxgui::input::key::k_at
@ k_at
Previous Track (K_CIRCUMFLEX on Japanese keyboard)
lxgui::input::key::k_y
@ k_y
lxgui::input::key::k_3
@ k_3
lxgui::input::key::k_webhome
@ k_webhome
Volume +.
lxgui::input::key::k_colon
@ k_colon
(NEC PC98)
lxgui::input::key::k_mediaselect
@ k_mediaselect
Mail.
lxgui::input::key::k_lshift
@ k_lshift
Accent.
lxgui::input::key::k_f4
@ k_f4
lxgui::input::key::k_back
@ k_back
lxgui::input::key::k_divide
@ k_divide
, on numeric keypad (NEC PC98)
lxgui::input::key::k_numpad_7
@ k_numpad_7
Scroll Lock.
lxgui::input::key::k_rbracket
@ k_rbracket
lxgui::input::key::k_maxkey
@ k_maxkey
Media Select.
lxgui::input::key::k_f3
@ k_f3
lxgui::input::key::k_f13
@ k_f13
lxgui::input::key::k_capital
@ k_capital
lxgui::input::key::k_mycomputer
@ k_mycomputer
Web Back.
lxgui::input::key::k_numpad_0
@ k_numpad_0
lxgui::input::mouse_button
mouse_button
Definition:
input_keys.hpp:12
lxgui::input::mouse_button::middle
@ middle
lxgui::input::mouse_button::right
@ right
lxgui::input::mouse_button::left
@ left
lxgui::input::get_localizable_key_name
std::string_view get_localizable_key_name(key key_id)
Returns the localizable name of the provided key.
Definition:
input_keys.cpp:251
lxgui::input::get_mouse_button_codename
std::string_view get_mouse_button_codename(mouse_button button_id)
Returns a standard English name for the provided mouse button.
Definition:
input_keys.cpp:7
lxgui::input::get_localizable_mouse_button_event_name
std::string_view get_localizable_mouse_button_event_name(mouse_button_event button_event)
Returns the localizable name of the provided mouse button event.
Definition:
input_keys.cpp:34
lxgui::input::get_key_from_codename
key get_key_from_codename(std::string_view key_name)
Returns the key code from the standard English name of a key.
Definition:
input_keys.cpp:240
lxgui::input::key_number
constexpr std::size_t key_number
Definition:
input_keys.hpp:251
lxgui::input::mouse_button_number
constexpr std::size_t mouse_button_number
Definition:
input_keys.hpp:250
lxgui::input::mouse_button_event
mouse_button_event
Definition:
input_keys.hpp:14
lxgui::input::mouse_button_event::up
@ up
lxgui::input::mouse_button_event::down
@ down
lxgui::input::mouse_button_event::double_click
@ double_click
lxgui::input::get_mouse_button_and_event_codename
std::string_view get_mouse_button_and_event_codename(mouse_button button_id, mouse_button_event button_event)
Returns a standard Engilsh name for the provided mouse button and event.
Definition:
input_keys.cpp:44
lxgui::input::get_key_codename
std::string_view get_key_codename(key key_id)
Returns a standard English name for the provided key.
Definition:
input_keys.cpp:105
Generated on Sun Oct 8 2023 09:07:52 for lxgui by
1.9.1