| 1 |
/* |
| 2 |
* Copyright (C) 2022-2023 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 |
#include "guilib/GUIControl.h" |
| 13 |
#include "guilib/GUIListContainer.h" |
| 14 |
#include "peripherals/PeripheralTypes.h" |
| 15 |
|
| 16 |
#include <memory> |
| 17 |
#include <stdint.h> |
| 18 |
#include <string> |
| 19 |
#include <vector> |
| 20 |
|
| 21 |
class CScroller; |
| 22 |
|
| 23 |
namespace KODI |
| 24 |
{ |
| 25 |
namespace GAME |
| 26 |
{ |
| 27 |
/*! |
| 28 |
* \ingroup games |
| 29 |
*/ |
| 30 |
class CGUIGameControllerList : public CGUIListContainer |
| 31 |
{ |
| 32 |
public: |
| 33 |
CGUIGameControllerList(int parentID, |
| 34 |
int controlID, |
| 35 |
float posX, |
| 36 |
float posY, |
| 37 |
float width, |
| 38 |
float height, |
| 39 |
ORIENTATION orientation, |
| 40 |
uint32_t alignment, |
| 41 |
const CScroller& scroller); |
| 42 |
explicit CGUIGameControllerList(const CGUIGameControllerList& other); |
| 43 |
|
| 44 |
~CGUIGameControllerList() override = default; |
| 45 |
|
| 46 |
// Implementation of CGUIControl via CGUIListContainer |
| 47 |
CGUIGameControllerList* Clone() const override; |
| 48 |
void UpdateInfo(const CGUIListItem* item) override; |
| 49 |
|
| 50 |
// Game properties |
| 51 |
void SetGameClient(GameClientPtr gameClient); |
| 52 |
void ClearGameClient(); |
| 53 |
|
| 54 |
// GUI properties |
| 55 |
uint32_t GetAlignment() const { return m_alignment; } |
| 56 |
|
| 57 |
private: |
| 58 |
void UpdatePort(int itemNumber, const std::vector<std::string>& inputPorts); |
| 59 |
void UpdatePortIndex(const PERIPHERALS::PeripheralPtr& agentPeripheral, |
| 60 |
const std::vector<std::string>& inputPorts); |
| 61 |
void UpdatePeripheral(const PERIPHERALS::PeripheralPtr& agentPeripheral); |
| 62 |
|
| 63 |
static std::string GetPortAddress(const PERIPHERALS::PeripheralPtr& agentPeripheral); |
| 64 |
|
| 65 |
// Game properties |
| 66 |
GameClientPtr m_gameClient; |
| 67 |
unsigned int m_portCount{0}; |
| 68 |
int m_portIndex{-1}; // Not connected |
| 69 |
std::string m_peripheralLocation; |
| 70 |
|
| 71 |
// GUI properties |
| 72 |
const uint32_t m_alignment; |
| 73 |
}; |
| 74 |
} // namespace GAME |
| 75 |
} // namespace KODI |