xbmc
IConfigurationWindow.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 "games/controllers/ControllerTypes.h"
12 #include "input/InputTypes.h"
14 
15 #include <string>
16 #include <vector>
17 
18 class CEvent;
19 
39 namespace KODI
40 {
41 namespace GAME
42 {
43 class CPhysicalFeature;
44 
49 {
50 public:
51  virtual ~IControllerList() = default;
52 
58  virtual bool Initialize(void) = 0;
59 
63  virtual void Deinitialize(void) = 0;
64 
70  virtual bool Refresh(const std::string& controllerId) = 0;
71 
72  /*
73  * \brief The specified controller has been focused
74  * \param controllerIndex The index of the controller being focused
75  */
76  virtual void OnFocus(unsigned int controllerIndex) = 0;
77 
82  virtual void OnSelect(unsigned int controllerIndex) = 0;
83 
88  virtual int GetFocusedController() const = 0;
89 
93  virtual void ResetController(void) = 0;
94 };
95 
100 {
101 public:
102  virtual ~IFeatureList() = default;
103 
109  virtual bool Initialize(void) = 0;
110 
115  virtual void Deinitialize(void) = 0;
116 
122  virtual bool HasButton(JOYSTICK::FEATURE_TYPE type) const = 0;
123 
128  virtual void Load(const ControllerPtr& controller) = 0;
129 
134  virtual void OnFocus(unsigned int buttonIndex) = 0;
135 
140  virtual void OnSelect(unsigned int buttonIndex) = 0;
141 };
142 
147 {
148 public:
149  virtual ~IFeatureButton() = default;
150 
154  virtual const CPhysicalFeature& Feature(void) const = 0;
155 
160  virtual bool AllowWizard() const { return true; }
161 
170  virtual bool PromptForInput(CEvent& waitEvent) = 0;
171 
176  virtual bool IsFinished(void) const = 0;
177 
184  virtual INPUT::CARDINAL_DIRECTION GetCardinalDirection(void) const = 0;
185 
191  virtual JOYSTICK::WHEEL_DIRECTION GetWheelDirection(void) const = 0;
192 
198  virtual JOYSTICK::THROTTLE_DIRECTION GetThrottleDirection(void) const = 0;
199 
203  virtual bool NeedsKey() const { return false; }
204 
210  virtual void SetKey(const CPhysicalFeature& key) {}
211 
215  virtual void Reset(void) = 0;
216 };
217 
222 {
223 public:
224  virtual ~IConfigurationWizard() = default;
225 
231  virtual void Run(const std::string& strControllerId,
232  const std::vector<IFeatureButton*>& buttons) = 0;
233 
238  virtual void OnUnfocus(IFeatureButton* button) = 0;
239 
245  virtual bool Abort(bool bWait = true) = 0;
246 
254  virtual void RegisterKey(const CPhysicalFeature& key) = 0;
255 
259  virtual void UnregisterKeys() = 0;
260 };
261 } // namespace GAME
262 } // namespace KODI
This is an Event class built from a ConditionVariable.
Definition: Event.h:35
THROTTLE_DIRECTION
Directions on a throttle.
Definition: JoystickTypes.h:130
virtual void OnSelect(unsigned int controllerIndex)=0
The specified controller has been selected.
virtual void Deinitialize(void)=0
Deinitialize the resource.
virtual bool Initialize(void)=0
Initialize the resource.
A wizard to direct user input.
Definition: IConfigurationWindow.h:221
FEATURE_TYPE
Types of features used in the joystick library.
Definition: JoystickTypes.h:49
A list populated by the controller&#39;s features.
Definition: IConfigurationWindow.h:99
virtual bool Refresh(const std::string &controllerId)=0
Refresh the contents of the list.
A list populated by installed controllers.
Definition: IConfigurationWindow.h:48
A GUI button in a feature list.
Definition: IConfigurationWindow.h:146
WHEEL_DIRECTION
Directions on a wheel.
Definition: JoystickTypes.h:120
Controller configuration window.
Definition: AudioDecoder.h:18
virtual bool AllowWizard() const
Allow the wizard to include this feature in a list of buttons to map.
Definition: IConfigurationWindow.h:160
virtual void ResetController(void)=0
Reset the focused controller.
virtual int GetFocusedController() const =0
Get the index of the focused controller.
virtual void SetKey(const CPhysicalFeature &key)
Set the pressed key that the user will be prompted to map.
Definition: IConfigurationWindow.h:210
virtual bool NeedsKey() const
True if the button is waiting for a key press.
Definition: IConfigurationWindow.h:203
Definition: PhysicalFeature.h:24