Debian Codegraph @

xbmc/input/keyboard/XBMC_keytable.h

raw
1 /*
2 * Copyright (C) 2007-2024 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #pragma once
10
11 #include <stdint.h>
12 #include <string>
13
14 namespace KODI
15 {
16 namespace KEYBOARD
17 {
18 /// \ingroup keyboard
19 /// \{
20
21 struct XBMCKEYTABLE
22 {
23 // The sym is a value that identifies which key was pressed. Note
24 // that it specifies the key not the character so it is unaffected by
25 // shift, control, etc.
26 uint16_t sym;
27
28 // If the keypress generates a printing character the unicode and
29 // ascii member variables contain the character generated. If the
30 // key is a non-printing character, e.g. a function or arrow key,
31 // the unicode and ascii member variables are zero.
32 uint16_t unicode;
33 char ascii;
34
35 // The following two member variables are used to specify the
36 // action/function assigned to a key.
37 // The keynames are used as tags in keyboard.xml. When reading keyboard.xml
38 // TranslateKeyboardString uses the keyname to look up the vkey, and
39 // this is used in the mapping table.
40 uint32_t vkey;
41 const char* keyname;
42 };
43
44 struct KeyTable
45 {
46 static bool LookupName(std::string keyname, XBMCKEYTABLE* keytable);
47 static bool LookupSym(uint16_t sym, XBMCKEYTABLE* keytable);
48 static bool LookupUnicode(uint16_t unicode, XBMCKEYTABLE* keytable);
49 static bool LookupSymAndUnicode(uint16_t sym, uint16_t unicode, XBMCKEYTABLE* keytable);
50 static bool LookupVKeyName(uint32_t vkey, XBMCKEYTABLE* keytable);
51 };
52
53 /// \}
54 } // namespace KEYBOARD
55 } // namespace KODI