| 1 |
/* |
| 2 |
* Copyright (C) 2017-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 "GUIFeatureButton.h" |
| 12 |
#include "games/controllers/input/PhysicalFeature.h" |
| 13 |
|
| 14 |
namespace KODI |
| 15 |
{ |
| 16 |
namespace GAME |
| 17 |
{ |
| 18 |
/*! |
| 19 |
* \ingroup games |
| 20 |
*/ |
| 21 |
class CGUISelectKeyButton : public CGUIFeatureButton |
| 22 |
{ |
| 23 |
public: |
| 24 |
CGUISelectKeyButton(const CGUIButtonControl& buttonTemplate, |
| 25 |
IConfigurationWizard* wizard, |
| 26 |
unsigned int index); |
| 27 |
|
| 28 |
~CGUISelectKeyButton() override = default; |
| 29 |
|
| 30 |
// implementation of IFeatureButton |
| 31 |
const CPhysicalFeature& Feature(void) const override; |
| 32 |
bool AllowWizard() const override { return false; } |
| 33 |
bool PromptForInput(CEvent& waitEvent) override; |
| 34 |
bool IsFinished() const override; |
| 35 |
bool NeedsKey() const override { return m_state == STATE::NEED_KEY; } |
| 36 |
void SetKey(const CPhysicalFeature& key) override; |
| 37 |
void Reset() override; |
| 38 |
|
| 39 |
private: |
| 40 |
static CPhysicalFeature GetFeature(); |
| 41 |
|
| 42 |
enum class STATE |
| 43 |
{ |
| 44 |
NEED_KEY, |
| 45 |
NEED_INPUT, |
| 46 |
FINISHED, |
| 47 |
}; |
| 48 |
|
| 49 |
STATE m_state = STATE::NEED_KEY; |
| 50 |
|
| 51 |
CPhysicalFeature m_selectedKey; |
| 52 |
}; |
| 53 |
} // namespace GAME |
| 54 |
} // namespace KODI |