| 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 "IConfigurationWindow.h" |
| 12 |
#include "games/GameTypes.h" |
| 13 |
#include "games/controllers/ControllerTypes.h" |
| 14 |
#include "games/controllers/input/PhysicalFeature.h" |
| 15 |
#include "input/joysticks/JoystickTypes.h" |
| 16 |
|
| 17 |
class CGUIButtonControl; |
| 18 |
class CGUIControlGroupList; |
| 19 |
class CGUIImage; |
| 20 |
class CGUILabelControl; |
| 21 |
class CGUIWindow; |
| 22 |
|
| 23 |
namespace KODI |
| 24 |
{ |
| 25 |
namespace GAME |
| 26 |
{ |
| 27 |
/*! |
| 28 |
* \ingroup games |
| 29 |
*/ |
| 30 |
class CGUIFeatureList : public IFeatureList |
| 31 |
{ |
| 32 |
public: |
| 33 |
CGUIFeatureList(CGUIWindow* window, GameClientPtr gameClient); |
| 34 |
~CGUIFeatureList() override; |
| 35 |
|
| 36 |
// implementation of IFeatureList |
| 37 |
bool Initialize() override; |
| 38 |
void Deinitialize() override; |
| 39 |
bool HasButton(JOYSTICK::FEATURE_TYPE type) const override; |
| 40 |
void Load(const ControllerPtr& controller) override; |
| 41 |
void OnFocus(unsigned int buttonIndex) override {} |
| 42 |
void OnSelect(unsigned int buttonIndex) override; |
| 43 |
|
| 44 |
private: |
| 45 |
IFeatureButton* GetButtonControl(unsigned int buttonIndex); |
| 46 |
|
| 47 |
void CleanupButtons(void); |
| 48 |
|
| 49 |
// Helper functions |
| 50 |
struct FeatureGroup |
| 51 |
{ |
| 52 |
std::string groupName; |
| 53 |
std::vector<CPhysicalFeature> features; |
| 54 |
/*! |
| 55 |
* True if this group is a button that allows the user to map a key of |
| 56 |
* their choosing. |
| 57 |
*/ |
| 58 |
bool bIsVirtualKey = false; |
| 59 |
}; |
| 60 |
std::vector<FeatureGroup> GetFeatureGroups(const std::vector<CPhysicalFeature>& features) const; |
| 61 |
std::vector<CGUIButtonControl*> GetButtons(const std::vector<CPhysicalFeature>& features, |
| 62 |
unsigned int startIndex); |
| 63 |
CGUIButtonControl* GetSelectKeyButton(const std::vector<CPhysicalFeature>& features, |
| 64 |
unsigned int buttonIndex); |
| 65 |
|
| 66 |
// GUI stuff |
| 67 |
CGUIWindow* const m_window; |
| 68 |
unsigned int m_buttonCount = 0; |
| 69 |
CGUIControlGroupList* m_guiList = nullptr; |
| 70 |
CGUIButtonControl* m_guiButtonTemplate = nullptr; |
| 71 |
CGUILabelControl* m_guiGroupTitle = nullptr; |
| 72 |
CGUIImage* m_guiFeatureSeparator = nullptr; |
| 73 |
|
| 74 |
// Game window stuff |
| 75 |
GameClientPtr m_gameClient; |
| 76 |
ControllerPtr m_controller; |
| 77 |
IConfigurationWizard* m_wizard; |
| 78 |
}; |
| 79 |
} // namespace GAME |
| 80 |
} // namespace KODI |