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 
20 namespace KODI
21 {
22 namespace GAME
23 {
24 class CPhysicalFeature;
25 
48 {
49 public:
50  virtual ~IControllerList() = default;
51 
58  virtual bool Initialize(void) = 0;
59 
63  virtual void Deinitialize(void) = 0;
64 
72  virtual bool Refresh(const std::string& controllerId) = 0;
73 
74  /*
75  * \brief The specified controller has been focused
76  *
77  * \param controllerIndex The index of the controller being focused
78  */
79  virtual void OnFocus(unsigned int controllerIndex) = 0;
80 
86  virtual void OnSelect(unsigned int controllerIndex) = 0;
87 
93  virtual int GetFocusedController() const = 0;
94 
98  virtual void ResetController(void) = 0;
99 };
100 
111 {
112 public:
113  virtual ~IFeatureList() = default;
114 
120  virtual bool Initialize(void) = 0;
121 
126  virtual void Deinitialize(void) = 0;
127 
133  virtual bool HasButton(JOYSTICK::FEATURE_TYPE type) const = 0;
134 
139  virtual void Load(const ControllerPtr& controller) = 0;
140 
145  virtual void OnFocus(unsigned int buttonIndex) = 0;
146 
151  virtual void OnSelect(unsigned int buttonIndex) = 0;
152 };
153 
160 {
161 public:
162  virtual ~IFeatureButton() = default;
163 
167  virtual const CPhysicalFeature& Feature(void) const = 0;
168 
173  virtual bool AllowWizard() const { return true; }
174 
183  virtual bool PromptForInput(CEvent& waitEvent) = 0;
184 
189  virtual bool IsFinished(void) const = 0;
190 
197  virtual INPUT::CARDINAL_DIRECTION GetCardinalDirection(void) const = 0;
198 
204  virtual JOYSTICK::WHEEL_DIRECTION GetWheelDirection(void) const = 0;
205 
211  virtual JOYSTICK::THROTTLE_DIRECTION GetThrottleDirection(void) const = 0;
212 
216  virtual bool NeedsKey() const { return false; }
217 
223  virtual void SetKey(const CPhysicalFeature& key) {}
224 
228  virtual void Reset(void) = 0;
229 };
230 
241 {
242 public:
243  virtual ~IConfigurationWizard() = default;
244 
250  virtual void Run(const std::string& strControllerId,
251  const std::vector<IFeatureButton*>& buttons) = 0;
252 
257  virtual void OnUnfocus(IFeatureButton* button) = 0;
258 
264  virtual bool Abort(bool bWait = true) = 0;
265 
273  virtual void RegisterKey(const CPhysicalFeature& key) = 0;
274 
278  virtual void UnregisterKeys() = 0;
279 };
280 } // namespace GAME
281 } // 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:240
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:110
virtual bool Refresh(const std::string &controllerId)=0
Refresh the contents of the list.
A list populated by installed controllers for the controller configuration window.
Definition: IConfigurationWindow.h:47
A GUI button in a feature list (IFeatureList)
Definition: IConfigurationWindow.h:159
WHEEL_DIRECTION
Directions on a wheel.
Definition: JoystickTypes.h:120
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:173
std::shared_ptr< CController > ControllerPtr
Smart pointer to a game controller (CController)
Definition: ControllerTypes.h:25
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:223
virtual bool NeedsKey() const
True if the button is waiting for a key press.
Definition: IConfigurationWindow.h:216
Definition: PhysicalFeature.h:30