Debian Codegraph @

xbmc/peripherals/addons/AddonButtonMapping.h

raw
1 /*
2 * Copyright (C) 2014-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/joysticks/interfaces/IButtonMapCallback.h"
12 #include "input/joysticks/interfaces/IDriverHandler.h"
13 #include "input/keyboard/interfaces/IKeyboardDriverHandler.h"
14 #include "input/mouse/interfaces/IMouseDriverHandler.h"
15
16 #include <memory>
17
18 namespace KODI
19 {
20 namespace JOYSTICK
21 {
22 class CButtonMapping;
23 class IButtonMap;
24 class IButtonMapper;
25 } // namespace JOYSTICK
26 } // namespace KODI
27
28 namespace PERIPHERALS
29 {
30 class CPeripheral;
31 class CPeripherals;
32
33 /*!
34 * \ingroup peripherals
35 */
36 class CAddonButtonMapping : public KODI::JOYSTICK::IDriverHandler,
37 public KODI::KEYBOARD::IKeyboardDriverHandler,
38 public KODI::MOUSE::IMouseDriverHandler,
39 public KODI::JOYSTICK::IButtonMapCallback
40 {
41 public:
42 CAddonButtonMapping(CPeripherals& manager,
43 CPeripheral* peripheral,
44 KODI::JOYSTICK::IButtonMapper* mapper);
45
46 ~CAddonButtonMapping(void) override;
47
48 // implementation of IDriverHandler
49 bool OnButtonMotion(unsigned int buttonIndex, bool bPressed) override;
50 bool OnHatMotion(unsigned int hatIndex, KODI::JOYSTICK::HAT_STATE state) override;
51 bool OnAxisMotion(unsigned int axisIndex,
52 float position,
53 int center,
54 unsigned int range) override;
55 void OnInputFrame(void) override;
56
57 // implementation of IKeyboardDriverHandler
58 bool OnKeyPress(const CKey& key) override;
59 void OnKeyRelease(const CKey& key) override;
60
61 // implementation of IMouseDriverHandler
62 bool OnPosition(int x, int y) override;
63 bool OnButtonPress(KODI::MOUSE::BUTTON_ID button) override;
64 void OnButtonRelease(KODI::MOUSE::BUTTON_ID button) override;
65
66 // implementation of IButtonMapCallback
67 void SaveButtonMap() override;
68 void ResetIgnoredPrimitives() override;
69 void RevertButtonMap() override;
70
71 private:
72 std::unique_ptr<KODI::JOYSTICK::CButtonMapping> m_buttonMapping;
73 std::unique_ptr<KODI::JOYSTICK::IButtonMap> m_buttonMap;
74 };
75 } // namespace PERIPHERALS