xbmc
GUIFeatureButton.h
1 /*
2  * Copyright (C) 2016-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/input/PhysicalFeature.h"
12 #include "games/controllers/windows/IConfigurationWindow.h"
14 
15 #include <string>
16 
17 namespace KODI
18 {
19 namespace GAME
20 {
25 {
26 public:
27  CGUIFeatureButton(const CGUIButtonControl& buttonTemplate,
28  IConfigurationWizard* wizard,
29  const CPhysicalFeature& feature,
30  unsigned int index);
31 
32  ~CGUIFeatureButton() override = default;
33 
34  // implementation of CGUIControl via CGUIButtonControl
35  void OnUnFocus() override;
36 
37  // partial implementation of IFeatureButton
38  const CPhysicalFeature& Feature() const override { return m_feature; }
39  INPUT::CARDINAL_DIRECTION GetCardinalDirection() const override
40  {
41  return INPUT::CARDINAL_DIRECTION::NONE;
42  }
44  {
45  return JOYSTICK::WHEEL_DIRECTION::NONE;
46  }
48  {
49  return JOYSTICK::THROTTLE_DIRECTION::NONE;
50  }
51 
52 protected:
53  bool DoPrompt(const std::string& strPrompt,
54  const std::string& strWarn,
55  const std::string& strFeature,
56  CEvent& waitEvent);
57 
58  // FSM helper
59  template<typename T>
60  T GetNextState(T state)
61  {
62  return static_cast<T>(static_cast<int>(state) + 1);
63  }
64 
65  const CPhysicalFeature m_feature;
66 
67 private:
68  IConfigurationWizard* const m_wizard;
69 };
70 } // namespace GAME
71 } // 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
Definition: GUIButtonControl.h:27
A wizard to direct user input.
Definition: IConfigurationWindow.h:240
Definition: GUIFeatureButton.h:24
JOYSTICK::WHEEL_DIRECTION GetWheelDirection() const override
Get the direction of the next wheel prompt.
Definition: GUIFeatureButton.h:43
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
JOYSTICK::THROTTLE_DIRECTION GetThrottleDirection() const override
Get the direction of the next throttle prompt.
Definition: GUIFeatureButton.h:47
const CPhysicalFeature & Feature() const override
Get the feature represented by this button.
Definition: GUIFeatureButton.h:38
INPUT::CARDINAL_DIRECTION GetCardinalDirection() const override
Get the direction of the next analog stick or relative pointer prompt.
Definition: GUIFeatureButton.h:39
Definition: PhysicalFeature.h:30