xbmc
AddonButtonMapping.h
1 /*
2  * Copyright (C) 2014-2018 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 
37 {
38 public:
40  CPeripheral* peripheral,
42 
43  ~CAddonButtonMapping(void) override;
44 
45  // implementation of IDriverHandler
46  bool OnButtonMotion(unsigned int buttonIndex, bool bPressed) override;
47  bool OnHatMotion(unsigned int hatIndex, KODI::JOYSTICK::HAT_STATE state) override;
48  bool OnAxisMotion(unsigned int axisIndex,
49  float position,
50  int center,
51  unsigned int range) override;
52  void OnInputFrame(void) override;
53 
54  // implementation of IKeyboardDriverHandler
55  bool OnKeyPress(const CKey& key) override;
56  void OnKeyRelease(const CKey& key) override;
57 
58  // implementation of IMouseDriverHandler
59  bool OnPosition(int x, int y) override;
60  bool OnButtonPress(KODI::MOUSE::BUTTON_ID button) override;
61  void OnButtonRelease(KODI::MOUSE::BUTTON_ID button) override;
62 
63  // implementation of IButtonMapCallback
64  void SaveButtonMap() override;
65  void ResetIgnoredPrimitives() override;
66  void RevertButtonMap() override;
67 
68 private:
69  std::unique_ptr<KODI::JOYSTICK::CButtonMapping> m_buttonMapping;
70  std::unique_ptr<KODI::JOYSTICK::IButtonMap> m_buttonMap;
71 };
72 } // namespace PERIPHERALS
Interface for classes that can map buttons to Kodi actions.
Definition: IButtonMapper.h:16
Definition: RetroPlayerInput.h:15
Interface defining methods to handle joystick events for raw driver elements (buttons, hats, axes)
Definition: IDriverHandler.h:21
Controller configuration window.
Definition: AudioDecoder.h:18
Interface for handling mouse driver events.
Definition: IMouseDriverHandler.h:21
Button mapper interface to assign the driver&#39;s raw button/hat/axis elements to physical joystick feat...
Definition: IButtonMapper.h:33
Interface for handling keyboard events.
Definition: IKeyboardDriverHandler.h:21
Interface for handling button maps.
Definition: IButtonMapCallback.h:18
Definition: AddonButtonMapping.h:33
Definition: Peripheral.h:62
Definition: Key.h:135
Definition: Peripherals.h:49