Debian Codegraph @

xbmc/input/keyboard/interfaces/IKeyboardInputHandler.h

raw
1 /*
2 * Copyright (C) 2017-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 "input/keyboard/KeyboardTypes.h"
12
13 #include <stdint.h>
14 #include <string>
15
16 namespace KODI
17 {
18 namespace KEYBOARD
19 {
20 /*!
21 * \ingroup keyboard
22 *
23 * \brief Interface for handling input events for keyboards
24 *
25 * Input events are an abstraction over driver events. Keys are identified by
26 * the name defined in the keyboard's controller profile.
27 */
28 class IKeyboardInputHandler
29 {
30 public:
31 virtual ~IKeyboardInputHandler() = default;
32
33 /*!
34 * \brief The add-on ID of the keyboard's controller profile
35 *
36 * \return The ID of the controller profile add-on
37 */
38 virtual std::string ControllerID() const = 0;
39
40 /*!
41 * \brief Return true if the input handler accepts the given key
42 *
43 * \param key A key belonging to the controller specified by ControllerID()
44 *
45 * \return True if the key is used for input, false otherwise
46 */
47 virtual bool HasKey(const KeyName& key) const = 0;
48
49 /*!
50 * \brief A key has been pressed
51 *
52 * \param key A key belonging to the controller specified by ControllerID()
53 * \param mod A combination of modifiers
54 * \param unicode The unicode value associated with the key, or 0 if unknown
55 *
56 * \return True if the event was handled, false otherwise
57 */
58 virtual bool OnKeyPress(const KeyName& key, Modifier mod, uint32_t unicode) = 0;
59
60 /*!
61 * \brief A key has been released
62 *
63 * \param key A key belonging to the controller specified by ControllerID()
64 * \param mod A combination of modifiers
65 * \param unicode The unicode value associated with the key, or 0 if unknown
66 */
67 virtual void OnKeyRelease(const KeyName& key, Modifier mod, uint32_t unicode) = 0;
68 };
69 } // namespace KEYBOARD
70 } // namespace KODI