Debian Codegraph @

xbmc/games/controllers/windows/GUIControllerList.h

raw
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;
20 class CGUIControlGroupList;
21 class CGUIWindow;
22
23 namespace KODI
24 {
25 namespace GAME
26 {
27 class CGUIControllerWindow;
28
29 /*!
30 * \ingroup games
31 */
32 class CGUIControllerList : public IControllerList
33 {
34 public:
35 /*!
36 * \brief Create a GUI controller list
37 *
38 * \param window The GUI window handle
39 * \param featureList The controller interface for the feature list
40 * \param gameClient A gameclient used to filter controllers
41 * \param controllerId A controller ID used to filter controllers (only the
42 * specified controller will be shown, or the default
43 * controller if the specified controller isn't installed)
44 */
45 CGUIControllerList(CGUIWindow* window,
46 IFeatureList* featureList,
47 GameClientPtr gameClient,
48 std::string controllerId);
49 ~CGUIControllerList() override { Deinitialize(); }
50
51 // implementation of IControllerList
52 bool Initialize() override;
53 void Deinitialize() override;
54 bool Refresh(const std::string& controllerId) override;
55 void OnFocus(unsigned int controllerIndex) override;
56 void OnSelect(unsigned int controllerIndex) override;
57 int GetFocusedController() const override { return m_focusedController; }
58 void ResetController() override;
59
60 private:
61 bool RefreshControllers(void);
62
63 void CleanupButtons(void);
64 void OnEvent(const ADDON::AddonEvent& event);
65
66 // GUI stuff
67 CGUIWindow* const m_guiWindow;
68 IFeatureList* const m_featureList;
69 CGUIControlGroupList* m_controllerList = nullptr;
70 CGUIButtonControl* m_controllerButton = nullptr;
71
72 // Game stuff
73 ControllerVector m_controllers;
74 int m_focusedController = -1; // Initially unfocused
75 GameClientPtr m_gameClient;
76 std::string m_controllerId;
77 };
78 } // namespace GAME
79 } // namespace KODI