7#include "keyboard_modifiers.hpp"
8#include "../utility/utility.hpp"
9#include "../macros.hpp"
10#include <unordered_map>
16hi_export_module(hikogui.GUI : keyboard_virtual_key_intf);
18hi_export
namespace hi::inline
v1 {
20enum class keyboard_virtual_key : uint8_t {
73 open_parentheses =
'(',
74 close_parentheses =
')',
161constexpr auto keyboard_virtual_key_metadata = enum_metadata{
162 keyboard_virtual_key::nul,
"nul",
163 keyboard_virtual_key::A,
"a",
164 keyboard_virtual_key::B,
"b",
165 keyboard_virtual_key::C,
"c",
166 keyboard_virtual_key::D,
"d",
167 keyboard_virtual_key::E,
"e",
168 keyboard_virtual_key::F,
"f",
169 keyboard_virtual_key::G,
"g",
170 keyboard_virtual_key::H,
"h",
171 keyboard_virtual_key::I,
"i",
172 keyboard_virtual_key::J,
"j",
173 keyboard_virtual_key::K,
"k",
174 keyboard_virtual_key::L,
"l",
175 keyboard_virtual_key::M,
"m",
176 keyboard_virtual_key::N,
"n",
177 keyboard_virtual_key::O,
"o",
178 keyboard_virtual_key::P,
"p",
179 keyboard_virtual_key::Q,
"q",
180 keyboard_virtual_key::R,
"r",
181 keyboard_virtual_key::S,
"s",
182 keyboard_virtual_key::T,
"t",
183 keyboard_virtual_key::U,
"u",
184 keyboard_virtual_key::V,
"v",
185 keyboard_virtual_key::W,
"w",
186 keyboard_virtual_key::X,
"x",
187 keyboard_virtual_key::Y,
"y",
188 keyboard_virtual_key::Z,
"z",
189 keyboard_virtual_key::_0,
"0",
190 keyboard_virtual_key::_1,
"1",
191 keyboard_virtual_key::_2,
"2",
192 keyboard_virtual_key::_3,
"3",
193 keyboard_virtual_key::_4,
"4",
194 keyboard_virtual_key::_5,
"5",
195 keyboard_virtual_key::_6,
"6",
196 keyboard_virtual_key::_7,
"7",
197 keyboard_virtual_key::_8,
"8",
198 keyboard_virtual_key::_9,
"9",
199 keyboard_virtual_key::plus,
"plus",
200 keyboard_virtual_key::minus,
"-",
201 keyboard_virtual_key::star,
"*",
202 keyboard_virtual_key::slash,
"/",
203 keyboard_virtual_key::percent,
"%",
204 keyboard_virtual_key::tilde,
"~",
205 keyboard_virtual_key::ampersant,
"&",
206 keyboard_virtual_key::pipe,
"|",
207 keyboard_virtual_key::caret,
"^",
208 keyboard_virtual_key::less,
"<",
209 keyboard_virtual_key::equal,
"=",
210 keyboard_virtual_key::greater,
">",
211 keyboard_virtual_key::open_parentheses,
"(",
212 keyboard_virtual_key::close_parentheses,
")",
213 keyboard_virtual_key::open_bracket,
"[",
214 keyboard_virtual_key::close_bracket,
"]",
215 keyboard_virtual_key::open_brace,
"{",
216 keyboard_virtual_key::close_brace,
"}",
217 keyboard_virtual_key::period,
".",
218 keyboard_virtual_key::comma,
",",
219 keyboard_virtual_key::colon,
":",
220 keyboard_virtual_key::semi_colon,
";",
221 keyboard_virtual_key::bang,
"!",
222 keyboard_virtual_key::question,
"?",
223 keyboard_virtual_key::space,
"space",
224 keyboard_virtual_key::tab,
"tab",
225 keyboard_virtual_key::enter,
"enter",
226 keyboard_virtual_key::backtick,
"`",
227 keyboard_virtual_key::quote,
"quote",
228 keyboard_virtual_key::double_quote,
"dquote",
229 keyboard_virtual_key::at,
"@",
230 keyboard_virtual_key::hash,
"#",
231 keyboard_virtual_key::dollar,
"$",
232 keyboard_virtual_key::underscore,
"_",
233 keyboard_virtual_key::backslash,
"backslash",
234 keyboard_virtual_key::F1,
"f1",
235 keyboard_virtual_key::F2,
"f2",
236 keyboard_virtual_key::F3,
"f3",
237 keyboard_virtual_key::F4,
"f4",
238 keyboard_virtual_key::F5,
"f5",
239 keyboard_virtual_key::F6,
"f6",
240 keyboard_virtual_key::F7,
"f7",
241 keyboard_virtual_key::F8,
"f8",
242 keyboard_virtual_key::F9,
"f9",
243 keyboard_virtual_key::F10,
"f10",
244 keyboard_virtual_key::F11,
"f11",
245 keyboard_virtual_key::F12,
"f12",
246 keyboard_virtual_key::F13,
"f13",
247 keyboard_virtual_key::F14,
"f14",
248 keyboard_virtual_key::F15,
"f15",
249 keyboard_virtual_key::F16,
"f16",
250 keyboard_virtual_key::F17,
"f17",
251 keyboard_virtual_key::F18,
"f18",
252 keyboard_virtual_key::F19,
"f19",
253 keyboard_virtual_key::F20,
"f20",
254 keyboard_virtual_key::F21,
"f21",
255 keyboard_virtual_key::F22,
"f22",
256 keyboard_virtual_key::F23,
"f23",
257 keyboard_virtual_key::F24,
"f24",
258 keyboard_virtual_key::home,
"home",
259 keyboard_virtual_key::end,
"end",
260 keyboard_virtual_key::backspace,
"backspace",
261 keyboard_virtual_key::clear,
"clear",
262 keyboard_virtual_key::insert,
"insert",
263 keyboard_virtual_key::escape,
"escape",
264 keyboard_virtual_key::_delete,
"delete",
265 keyboard_virtual_key::left,
"left",
266 keyboard_virtual_key::right,
"right",
267 keyboard_virtual_key::up,
"up",
268 keyboard_virtual_key::down,
"down",
269 keyboard_virtual_key::page_up,
"page-up",
270 keyboard_virtual_key::page_down,
"page-down",
271 keyboard_virtual_key::menu,
"menu",
272 keyboard_virtual_key::sysmenu,
"sysmenu",
273 keyboard_virtual_key::print_screen,
"print-screen",
274 keyboard_virtual_key::pause_break,
"pause-break",
275 keyboard_virtual_key::media_next_track,
"media-next",
276 keyboard_virtual_key::media_prev_track,
"media-prev",
277 keyboard_virtual_key::media_stop,
"media-stop",
278 keyboard_virtual_key::media_play_pause,
"media-play",
279 keyboard_virtual_key::volume_mute,
"volume-mute",
280 keyboard_virtual_key::volume_up,
"volume-up",
281 keyboard_virtual_key::volume_down,
"volume-down",
282 keyboard_virtual_key::browser_back,
"browser-back",
283 keyboard_virtual_key::browser_forward,
"browser-forward",
284 keyboard_virtual_key::browser_home,
"browser-home",
285 keyboard_virtual_key::browser_refresh,
"browser-refresh",
286 keyboard_virtual_key::browser_stop,
"browser-stop",
287 keyboard_virtual_key::browser_search,
"browser-search",
288 keyboard_virtual_key::browser_favorites,
"browser-favorites"
292constexpr keyboard_virtual_key to_keyboard_virtual_key(std::string_view s)
294 return keyboard_virtual_key_metadata[s];
297[[nodiscard]]
constexpr keyboard_virtual_key to_keyboard_virtual_key(
int key_code,
bool extended, keyboard_modifiers modifiers)
noexcept;
299constexpr std::string_view to_string_view(keyboard_virtual_key key)
noexcept
301 return keyboard_virtual_key_metadata[key];
311 return lhs << to_string_view(rhs);
326struct std::formatter<
hi::keyboard_virtual_key, char> : std::formatter<std::string_view, char> {
327 auto format(hi::keyboard_virtual_key
const& t,
auto& fc)
const
329 return std::formatter<std::string_view, char>{}.format(hi::to_string_view(t), fc);
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
@ menu
A menu item in a popup overlay Menu item widget accepts keyboard focus from the up/down cursor keys.