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