Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
KODI::GAME::CGUIGameControllerProvider Class Reference

Controller list provider for the IAgentList control in the Player Viewer (GameAgents) window. More...

#include <GUIGameControllerProvider.h>

Inheritance diagram for KODI::GAME::CGUIGameControllerProvider:
IListProvider

Public Member Functions

 CGUIGameControllerProvider (unsigned int portCount, int portIndex, const std::string &peripheralLocation, uint32_t alignment, int parentID)
 Construct a game controller provider for the player's controller list in the Player Viewer dialog.
 
 CGUIGameControllerProvider (const CGUIGameControllerProvider &other)
 
 ~CGUIGameControllerProvider () override
 
std::unique_ptr< IListProviderClone () override
 Create an instance of the derived class. Allows for polymorphic copies.
 
bool Update (bool forceRefresh) override
 Update the list content.
 
void Fetch (std::vector< std::shared_ptr< CGUIListItem > > &items) override
 Fetch the current list of items.
 
bool OnClick (const std::shared_ptr< CGUIListItem > &item) override
 Click event on an item.
 
bool OnInfo (const std::shared_ptr< CGUIListItem > &item) override
 Open the info dialog for an item provided by this IListProvider.
 
bool OnContextMenu (const std::shared_ptr< CGUIListItem > &item) override
 Open the context menu for an item provided by this IListProvider.
 
void SetDefaultItem (int item, bool always) override
 Set the default item to focus. For backwards compatibility.
 
int GetDefaultItem () const override
 The default item to focus.
 
bool AlwaysFocusDefaultItem () const override
 Whether to always focus the default item.
 
ControllerPtr GetControllerProfile () const
 
void SetControllerProfile (ControllerPtr controllerProfile)
 
unsigned int GetPortCount () const
 
void SetPortCount (unsigned int portCount)
 
int GetPortIndex () const
 
void SetPortIndex (int portIndex)
 
const std::string & GetPeripheralLocation () const
 
void SetPeripheralLocation (const std::string &peripheralLocation)
 
- Public Member Functions inherited from IListProvider
 IListProvider (int parentID)
 
 IListProvider (const IListProvider &other)=default
 
virtual ~IListProvider ()=default
 
virtual bool IsUpdating () const
 Check whether the list provider is updating content.
 
virtual void Reset ()
 Reset the current list of items. Derived classes may choose to ignore this.
 
virtual void FreeResources (bool immediately)
 Free all GUI resources allocated by the items.
 
virtual bool OnPlay (const std::shared_ptr< CGUIListItem > &item)
 Play event on an item.
 

Additional Inherited Members

- Static Public Member Functions inherited from IListProvider
static std::unique_ptr< IListProviderCreate (const TiXmlNode *parent, int parentID)
 Factory to create list providers.
 
static std::unique_ptr< IListProviderCreateSingle (const TiXmlNode *content, int parentID)
 Factory to create list providers. Cannot create a multi-provider.
 
- Protected Attributes inherited from IListProvider
int m_parentID
 

Detailed Description

Controller list provider for the IAgentList control in the Player Viewer (GameAgents) window.

This list provider populates a game controller list with items that show which emulator port a player's controller is connected to. Most items are empty to pad the controller to its correct position in the list.

The number of list items is determined by MAX_PORT_COUNT, plus an item for the "disconnected" icon. The list items are updated when the port count or port index changes.

An alignment can be specified to align the available ports to the left or right side of the list.

Constructor & Destructor Documentation

◆ CGUIGameControllerProvider() [1/2]

CGUIGameControllerProvider::CGUIGameControllerProvider ( unsigned int portCount,
int portIndex,
const std::string & peripheralLocation,
uint32_t alignment,
int parentID )

Construct a game controller provider for the player's controller list in the Player Viewer dialog.

Parameters
portCountThe number of open ports for the emulator
portIndexThe index of the port the controller is connected to
peripheralLocationThe location of the underlying peripheral providing input
alignmentThe alignment of the list items (XBFONT_LEFT or XBFONT_RIGHT)
parentIDThe ID of the parent window

◆ CGUIGameControllerProvider() [2/2]

CGUIGameControllerProvider::CGUIGameControllerProvider ( const CGUIGameControllerProvider & other)
explicit

◆ ~CGUIGameControllerProvider()

CGUIGameControllerProvider::~CGUIGameControllerProvider ( )
overridedefault

Member Function Documentation

◆ AlwaysFocusDefaultItem()

bool KODI::GAME::CGUIGameControllerProvider::AlwaysFocusDefaultItem ( ) const
inlineoverridevirtual

Whether to always focus the default item.

Returns
true if the default item should always be the one to receive focus.
See also
GetDefaultItem, SetDefaultItem

Reimplemented from IListProvider.

◆ Clone()

std::unique_ptr< IListProvider > CGUIGameControllerProvider::Clone ( )
overridevirtual

Create an instance of the derived class. Allows for polymorphic copies.

Implements IListProvider.

◆ Fetch()

void CGUIGameControllerProvider::Fetch ( std::vector< std::shared_ptr< CGUIListItem > > & items)
overridevirtual

Fetch the current list of items.

Parameters
items[out] the list to be filled.

Implements IListProvider.

◆ GetControllerProfile()

ControllerPtr KODI::GAME::CGUIGameControllerProvider::GetControllerProfile ( ) const
inline

◆ GetDefaultItem()

int KODI::GAME::CGUIGameControllerProvider::GetDefaultItem ( ) const
inlineoverridevirtual

The default item to focus.

Returns
the item to focus by default. -1 for none.
See also
SetDefaultItem, AlwaysFocusDefaultItem

Reimplemented from IListProvider.

◆ GetPeripheralLocation()

const std::string & KODI::GAME::CGUIGameControllerProvider::GetPeripheralLocation ( ) const
inline

◆ GetPortCount()

unsigned int KODI::GAME::CGUIGameControllerProvider::GetPortCount ( ) const
inline

◆ GetPortIndex()

int KODI::GAME::CGUIGameControllerProvider::GetPortIndex ( ) const
inline

◆ OnClick()

bool KODI::GAME::CGUIGameControllerProvider::OnClick ( const std::shared_ptr< CGUIListItem > & item)
inlineoverridevirtual

Click event on an item.

Parameters
itemthe item that was clicked.
Returns
true if the click was handled, false otherwise.

Implements IListProvider.

◆ OnContextMenu()

bool KODI::GAME::CGUIGameControllerProvider::OnContextMenu ( const std::shared_ptr< CGUIListItem > & item)
inlineoverridevirtual

Open the context menu for an item provided by this IListProvider.

Parameters
itemthe item that was clicked.
Returns
true if the click was handled, false otherwise.

Implements IListProvider.

◆ OnInfo()

bool KODI::GAME::CGUIGameControllerProvider::OnInfo ( const std::shared_ptr< CGUIListItem > & item)
inlineoverridevirtual

Open the info dialog for an item provided by this IListProvider.

Parameters
itemthe item that was clicked.
Returns
true if the dialog was shown, false otherwise.

Implements IListProvider.

◆ SetControllerProfile()

void CGUIGameControllerProvider::SetControllerProfile ( ControllerPtr controllerProfile)

◆ SetDefaultItem()

void KODI::GAME::CGUIGameControllerProvider::SetDefaultItem ( int item,
bool always )
inlineoverridevirtual

Set the default item to focus. For backwards compatibility.

Parameters
itemthe item to focus.
alwayswhether this item should always be used on first focus.
See also
GetDefaultItem, AlwaysFocusDefaultItem

Reimplemented from IListProvider.

◆ SetPeripheralLocation()

void CGUIGameControllerProvider::SetPeripheralLocation ( const std::string & peripheralLocation)

◆ SetPortCount()

void CGUIGameControllerProvider::SetPortCount ( unsigned int portCount)

◆ SetPortIndex()

void CGUIGameControllerProvider::SetPortIndex ( int portIndex)

◆ Update()

bool CGUIGameControllerProvider::Update ( bool forceRefresh)
overridevirtual

Update the list content.

Returns
true if the content has changed, false otherwise.

Implements IListProvider.


The documentation for this class was generated from the following files: