xbmc
GUIControllerList.h
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 "addons/AddonEvents.h"
13 #include "games/GameTypes.h"
14 #include "games/controllers/ControllerTypes.h"
15 
16 #include <set>
17 #include <string>
18 
19 class CGUIButtonControl;
21 class CGUIWindow;
22 
23 namespace KODI
24 {
25 namespace GAME
26 {
27 class CGUIControllerWindow;
28 
30 {
31 public:
32  CGUIControllerList(CGUIWindow* window, IFeatureList* featureList, GameClientPtr gameClient);
33  ~CGUIControllerList() override { Deinitialize(); }
34 
35  // implementation of IControllerList
36  bool Initialize() override;
37  void Deinitialize() override;
38  bool Refresh(const std::string& controllerId) override;
39  void OnFocus(unsigned int controllerIndex) override;
40  void OnSelect(unsigned int controllerIndex) override;
41  int GetFocusedController() const override { return m_focusedController; }
42  void ResetController() override;
43 
44 private:
45  bool RefreshControllers(void);
46 
47  void CleanupButtons(void);
48  void OnEvent(const ADDON::AddonEvent& event);
49 
50  // GUI stuff
51  CGUIWindow* const m_guiWindow;
52  IFeatureList* const m_featureList;
53  CGUIControlGroupList* m_controllerList;
54  CGUIButtonControl* m_controllerButton;
55 
56  // Game stuff
57  ControllerVector m_controllers;
58  int m_focusedController;
59  GameClientPtr m_gameClient;
60 };
61 } // namespace GAME
62 } // namespace KODI
bool Refresh(const std::string &controllerId) override
Refresh the contents of the list.
Definition: GUIControllerList.cpp:81
Definition: GUIButtonControl.h:27
Definition: GUIControllerList.h:29
A list populated by the controller&#39;s features.
Definition: IConfigurationWindow.h:99
list of controls that is scrollable
Definition: GUIControlGroupList.h:22
int GetFocusedController() const override
Get the index of the focused controller.
Definition: GUIControllerList.h:41
A list populated by installed controllers.
Definition: IConfigurationWindow.h:48
Controller configuration window.
Definition: AudioDecoder.h:18
Definition: AddonEvents.h:18
void OnSelect(unsigned int controllerIndex) override
The specified controller has been selected.
Definition: GUIControllerList.cpp:143
void OnFocus(unsigned int controllerIndex) override
Definition: GUIControllerList.cpp:121
Definition: GUIWindow.h:58
void Deinitialize() override
Deinitialize the resource.
Definition: GUIControllerList.cpp:71
bool Initialize() override
Initialize the resource.
Definition: GUIControllerList.cpp:55
void ResetController() override
Reset the focused controller.
Definition: GUIControllerList.cpp:148