| 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" |
| 13 |
#include "guilib/GUIButtonControl.h" |
| 14 |
|
| 15 |
#include <string> |
| 16 |
|
| 17 |
namespace KODI |
| 18 |
{ |
| 19 |
namespace GAME |
| 20 |
{ |
| 21 |
/*! |
| 22 |
* \ingroup games |
| 23 |
*/ |
| 24 |
class CGUIFeatureButton : public CGUIButtonControl, public IFeatureButton |
| 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 |
} |
| 43 |
JOYSTICK::WHEEL_DIRECTION GetWheelDirection() const override |
| 44 |
{ |
| 45 |
return JOYSTICK::WHEEL_DIRECTION::NONE; |
| 46 |
} |
| 47 |
JOYSTICK::THROTTLE_DIRECTION GetThrottleDirection() const override |
| 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 |