Debian Codegraph @

xbmc/games/ports/windows/IPortList.h

raw
1 /*
2 * Copyright (C) 2021 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/GameTypes.h"
12
13 namespace KODI
14 {
15 namespace GAME
16 {
17 /*!
18 * \ingroup games
19 *
20 * \brief A list populated by controller ports for the port setup window
21 *
22 * The port setup window presents a list of ports and their attached
23 * controllers.
24 *
25 * The label2 of each port is the currently-connected controller. The user
26 * selects from all controllers that the port accepts (as given by the
27 * game-addon's <b>`topology.xml`</b> file).
28 *
29 * The controller topology is stored as a generic tree. Here we apply game logic
30 * to simplify controller selection.
31 */
32 class IPortList
33 {
34 public:
35 virtual ~IPortList() = default;
36
37 /*!
38 * \brief Callback when the GUI window is loaded
39 */
40 virtual void OnWindowLoaded() = 0;
41
42 /*!
43 * \brief Callback when the GUI window is unloaded
44 */
45 virtual void OnWindowUnload() = 0;
46
47 /*!
48 * \brief Initialize resources
49 *
50 * \param gameClient The game client providing the ports
51 *
52 * \return True if the resource is initialized and can be used, false if the
53 * resource failed to initialize and must not be used
54 */
55 virtual bool Initialize(GameClientPtr gameClient) = 0;
56
57 /*!
58 * \brief Deinitialize resources
59 */
60 virtual void Deinitialize() = 0;
61
62 /*!
63 * \brief Query if a control with the given ID belongs to this list
64 */
65 virtual bool HasControl(int controlId) = 0;
66
67 /*!
68 * \brief Query the ID of the current control in this list
69 *
70 * \return The control ID, or -1 if no control is currently active
71 */
72 virtual int GetCurrentControl() = 0;
73
74 /*!
75 * \brief Refresh the contents of the list
76 */
77 virtual void Refresh() = 0;
78
79 /*!
80 * \brief Callback when a frame is rendered by the GUI
81 */
82 virtual void FrameMove() = 0;
83
84 /*!
85 * \brief The port list has been focused in the GUI
86 */
87 virtual void SetFocused() = 0;
88
89 /*!
90 * \brief The port list has been selected
91 *
92 * \brief True if a control was active, false of all controls were inactive
93 */
94 virtual bool OnSelect() = 0;
95
96 /*!
97 * \brief Reset the ports to their game add-on's default configuration
98 */
99 virtual void ResetPorts() = 0;
100 };
101 } // namespace GAME
102 } // namespace KODI