[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / games / ports / input / PortInput.h
blobd3c6524cce65898d05c1e5e56287d06ca63c9cfd
1 /*
2 * Copyright (C) 2017-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "input/KeymapEnvironment.h"
12 #include "input/joysticks/interfaces/IInputHandler.h"
14 #include <memory>
16 namespace KODI
18 namespace JOYSTICK
20 class CKeymapHandling;
21 class IInputProvider;
22 } // namespace JOYSTICK
24 namespace GAME
26 class CPortInput : public JOYSTICK::IInputHandler, public IKeymapEnvironment
28 public:
29 CPortInput(JOYSTICK::IInputHandler* gameInput);
30 ~CPortInput() override;
32 void RegisterInput(JOYSTICK::IInputProvider* provider);
33 void UnregisterInput(JOYSTICK::IInputProvider* provider);
35 JOYSTICK::IInputHandler* InputHandler() { return m_gameInput; }
37 // Implementation of IInputHandler
38 std::string ControllerID() const override;
39 bool HasFeature(const std::string& feature) const override { return true; }
40 bool AcceptsInput(const std::string& feature) const override;
41 bool OnButtonPress(const std::string& feature, bool bPressed) override;
42 void OnButtonHold(const std::string& feature, unsigned int holdTimeMs) override;
43 bool OnButtonMotion(const std::string& feature,
44 float magnitude,
45 unsigned int motionTimeMs) override;
46 bool OnAnalogStickMotion(const std::string& feature,
47 float x,
48 float y,
49 unsigned int motionTimeMs) override;
50 bool OnAccelerometerMotion(const std::string& feature, float x, float y, float z) override;
51 bool OnWheelMotion(const std::string& feature,
52 float position,
53 unsigned int motionTimeMs) override;
54 bool OnThrottleMotion(const std::string& feature,
55 float position,
56 unsigned int motionTimeMs) override;
57 void OnInputFrame() override {}
59 // Implementation of IKeymapEnvironment
60 int GetWindowID() const override;
61 void SetWindowID(int windowId) override {}
62 int GetFallthrough(int windowId) const override { return -1; }
63 bool UseGlobalFallthrough() const override { return false; }
64 bool UseEasterEgg() const override { return false; }
66 private:
67 // Construction parameters
68 JOYSTICK::IInputHandler* const m_gameInput;
70 // Handles input to Kodi
71 std::unique_ptr<JOYSTICK::CKeymapHandling> m_appInput;
73 // Prevents input falling through to Kodi when not handled by the game
74 std::unique_ptr<JOYSTICK::IInputHandler> m_inputSink;
76 } // namespace GAME
77 } // namespace KODI