Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CGUIControlFactory Class Reference

#include <GUIControlFactory.h>

Inheritance diagram for CGUIControlFactory:
CGFTestable

Public Member Functions

 CGUIControlFactory (void)
 
virtual ~CGUIControlFactory (void)
 
CGUIControlCreate (int parentID, const CRect &rect, TiXmlElement *pControlNode, bool insideContainer=false)
 

Static Public Member Functions

static CGUIControl::GUICONTROLTYPES TranslateControlType (const std::string &type)
 translate from control name to control type
 
static std::string TranslateControlType (CGUIControl::GUICONTROLTYPES type)
 translate from control type to control name
 
static bool GetAspectRatio (const TiXmlNode *pRootNode, const char *strTag, CAspectRatio &aspectRatio)
 
static bool GetInfoTexture (const TiXmlNode *pRootNode, const char *strTag, CTextureInfo &image, KODI::GUILIB::GUIINFO::CGUIInfoLabel &info, int parentID)
 
static bool GetTexture (const TiXmlNode *pRootNode, const char *strTag, CTextureInfo &image)
 
static bool GetAlignment (const TiXmlNode *pRootNode, const char *strTag, uint32_t &dwAlignment)
 
static bool GetAlignmentY (const TiXmlNode *pRootNode, const char *strTag, uint32_t &dwAlignment)
 
static bool GetAnimations (TiXmlNode *control, const CRect &rect, int context, std::vector< CAnimation > &animation)
 
static float ParsePosition (const char *pos, const float parentSize)
 Create an info label from an XML element Processes XML elements of the form <xmltag fallback="fallback_value">info_value</xmltag> where info_value may use $INFO[], $LOCALIZE[], $NUMBER[] etc. If either the fallback_value or info_value are natural numbers they are interpreted as ids for lookup in strings.po. The fallback attribute is optional.
 
static bool GetInfoLabelFromElement (const TiXmlElement *element, KODI::GUILIB::GUIINFO::CGUIInfoLabel &infoLabel, int parentID)
 
static void GetInfoLabel (const TiXmlNode *pControlNode, const std::string &labelTag, KODI::GUILIB::GUIINFO::CGUIInfoLabel &infoLabel, int parentID)
 
static void GetInfoLabels (const TiXmlNode *pControlNode, const std::string &labelTag, std::vector< KODI::GUILIB::GUIINFO::CGUIInfoLabel > &infoLabels, int parentID)
 
static bool GetColor (const TiXmlNode *pRootNode, const char *strTag, KODI::UTILS::COLOR::Color &value)
 
static bool GetInfoColor (const TiXmlNode *pRootNode, const char *strTag, KODI::GUILIB::GUIINFO::CGUIInfoColor &value, int parentID)
 
static std::string FilterLabel (const std::string &label)
 
static bool GetConditionalVisibility (const TiXmlNode *control, std::string &condition)
 
static bool GetActions (const TiXmlNode *pRootNode, const char *strTag, CGUIAction &actions)
 
static void GetRectFromString (const std::string &string, CRect &rect)
 
static bool GetHitRect (const TiXmlNode *pRootNode, CRect &rect, const CRect &parentRect)
 
static bool GetScroller (const TiXmlNode *pControlNode, const std::string &scrollerTag, CScroller &scroller)
 

Static Protected Member Functions

static std::string GetType (const TiXmlElement *pControlNode)
 
static bool GetMovingSpeedConfig (const TiXmlNode *pRootNode, const char *strTag, KODI::UTILS::MOVING_SPEED::MapEventConfig &movingSpeedCfg)
 
static bool GetConditionalVisibility (const TiXmlNode *control, std::string &condition, std::string &allowHiddenFocus)
 
static bool GetString (const TiXmlNode *pRootNode, const char *strTag, std::string &strString)
 
static bool GetFloatRange (const TiXmlNode *pRootNode, const char *strTag, float &iMinValue, float &iMaxValue, float &iIntervalValue)
 
static bool GetIntRange (const TiXmlNode *pRootNode, const char *strTag, int &iMinValue, int &iMaxValue, int &iIntervalValue)
 
static bool GetPosition (const TiXmlNode *node, const char *tag, const float parentSize, float &value)
 Get the value of a position tag from XML Handles both absolute and relative values.
 
static bool GetDimension (const TiXmlNode *node, const char *strTag, const float parentSize, float &value, float &min)
 grab a dimension out of the XML
 
static bool GetDimensions (const TiXmlNode *node, const char *leftTag, const char *rightTag, const char *centerLeftTag, const char *centerRightTag, const char *widthTag, const float parentSize, float &left, float &width, float &min_width)
 Retrieve the dimensions for a control.
 

Constructor & Destructor Documentation

◆ CGUIControlFactory()

CGUIControlFactory::CGUIControlFactory ( void )
default

◆ ~CGUIControlFactory()

CGUIControlFactory::~CGUIControlFactory ( void )
virtualdefault

Member Function Documentation

◆ Create()

CGUIControl * CGUIControlFactory::Create ( int parentID,
const CRect & rect,
TiXmlElement * pControlNode,
bool insideContainer = false )
Todo
Perhaps we should check here whether id is valid for focusable controls such as buttons etc. For labels/fadelabels/images it does not matter

◆ FilterLabel()

std::string CGUIControlFactory::FilterLabel ( const std::string & label)
static

◆ GetActions()

bool CGUIControlFactory::GetActions ( const TiXmlNode * pRootNode,
const char * strTag,
CGUIAction & actions )
static

◆ GetAlignment()

bool CGUIControlFactory::GetAlignment ( const TiXmlNode * pRootNode,
const char * strTag,
uint32_t & dwAlignment )
static

◆ GetAlignmentY()

bool CGUIControlFactory::GetAlignmentY ( const TiXmlNode * pRootNode,
const char * strTag,
uint32_t & dwAlignment )
static

◆ GetAnimations()

bool CGUIControlFactory::GetAnimations ( TiXmlNode * control,
const CRect & rect,
int context,
std::vector< CAnimation > & animation )
static

◆ GetAspectRatio()

bool CGUIControlFactory::GetAspectRatio ( const TiXmlNode * pRootNode,
const char * strTag,
CAspectRatio & aspectRatio )
static

◆ GetColor()

bool CGUIControlFactory::GetColor ( const TiXmlNode * pRootNode,
const char * strTag,
KODI::UTILS::COLOR::Color & value )
static

◆ GetConditionalVisibility() [1/2]

bool CGUIControlFactory::GetConditionalVisibility ( const TiXmlNode * control,
std::string & condition )
static

◆ GetConditionalVisibility() [2/2]

bool CGUIControlFactory::GetConditionalVisibility ( const TiXmlNode * control,
std::string & condition,
std::string & allowHiddenFocus )
staticprotected

◆ GetDimension()

bool CGUIControlFactory::GetDimension ( const TiXmlNode * node,
const char * strTag,
const float parentSize,
float & value,
float & min )
staticprotected

grab a dimension out of the XML

Supports plain reading of a number (or constant) and, in addition allows "auto" as the value for the dimension, whereby value is set to the max attribute (if it exists) and min is set the min attribute (if it exists) or 1. Auto values are thus detected by min != 0.

Parameters
nodethe <control> XML node to read
strTagtag within node to read
parentSizethe size of the parent for relative sizing.
valuevalue to set, or maximum value if using auto
minminimum value - set != 0 if auto is used.
Returns
true if we found and read the tag.
See also
GetPosition, GetDimensions, ParsePosition.

◆ GetDimensions()

bool CGUIControlFactory::GetDimensions ( const TiXmlNode * node,
const char * leftTag,
const char * rightTag,
const char * centerLeftTag,
const char * centerRightTag,
const char * widthTag,
const float parentSize,
float & left,
float & width,
float & min_width )
staticprotected

Retrieve the dimensions for a control.

Handles positioning based on at least 2 of left/right/center/width.

Parameters
nodethe <control> node describing the control.
leftTagthe tag that holds the left field.
rightTagthe tag that holds the right field.
centerLeftTagthe tag that holds the center left field.
centerRightTagthe tag that holds the center right field.
widthTagthe tag holding the width.
parentSizethe size of the parent, for relative sizing.
pos[out] the discovered position.
width[out] the discovered width.
min_width[out] the discovered minimum width.
Returns
true if we can successfully derive the position and size, false otherwise.
See also
GetDimension, GetPosition, ParsePosition.

◆ GetFloatRange()

bool CGUIControlFactory::GetFloatRange ( const TiXmlNode * pRootNode,
const char * strTag,
float & iMinValue,
float & iMaxValue,
float & iIntervalValue )
staticprotected

◆ GetHitRect()

bool CGUIControlFactory::GetHitRect ( const TiXmlNode * pRootNode,
CRect & rect,
const CRect & parentRect )
static

◆ GetInfoColor()

bool CGUIControlFactory::GetInfoColor ( const TiXmlNode * pRootNode,
const char * strTag,
KODI::GUILIB::GUIINFO::CGUIInfoColor & value,
int parentID )
static

◆ GetInfoLabel()

void CGUIControlFactory::GetInfoLabel ( const TiXmlNode * pControlNode,
const std::string & labelTag,
KODI::GUILIB::GUIINFO::CGUIInfoLabel & infoLabel,
int parentID )
static

◆ GetInfoLabelFromElement()

bool CGUIControlFactory::GetInfoLabelFromElement ( const TiXmlElement * element,
KODI::GUILIB::GUIINFO::CGUIInfoLabel & infoLabel,
int parentID )
static

◆ GetInfoLabels()

void CGUIControlFactory::GetInfoLabels ( const TiXmlNode * pControlNode,
const std::string & labelTag,
std::vector< KODI::GUILIB::GUIINFO::CGUIInfoLabel > & infoLabels,
int parentID )
static

◆ GetInfoTexture()

bool CGUIControlFactory::GetInfoTexture ( const TiXmlNode * pRootNode,
const char * strTag,
CTextureInfo & image,
KODI::GUILIB::GUIINFO::CGUIInfoLabel & info,
int parentID )
static

◆ GetIntRange()

bool CGUIControlFactory::GetIntRange ( const TiXmlNode * pRootNode,
const char * strTag,
int & iMinValue,
int & iMaxValue,
int & iIntervalValue )
staticprotected

◆ GetMovingSpeedConfig()

bool CGUIControlFactory::GetMovingSpeedConfig ( const TiXmlNode * pRootNode,
const char * strTag,
KODI::UTILS::MOVING_SPEED::MapEventConfig & movingSpeedCfg )
staticprotected

◆ GetPosition()

bool CGUIControlFactory::GetPosition ( const TiXmlNode * node,
const char * tag,
const float parentSize,
float & value )
staticprotected

Get the value of a position tag from XML Handles both absolute and relative values.

Parameters
nodethe <control> XML node.
tagthe XML node to parse.
parentSizethe size of the parent, for relative positioning.
value[out] the returned value.
See also
ParsePosition, GetDimension, GetDimensions.

◆ GetRectFromString()

void CGUIControlFactory::GetRectFromString ( const std::string & string,
CRect & rect )
static

◆ GetScroller()

bool CGUIControlFactory::GetScroller ( const TiXmlNode * pControlNode,
const std::string & scrollerTag,
CScroller & scroller )
static

◆ GetString()

bool CGUIControlFactory::GetString ( const TiXmlNode * pRootNode,
const char * strTag,
std::string & strString )
staticprotected

◆ GetTexture()

bool CGUIControlFactory::GetTexture ( const TiXmlNode * pRootNode,
const char * strTag,
CTextureInfo & image )
static

◆ GetType()

std::string CGUIControlFactory::GetType ( const TiXmlElement * pControlNode)
staticprotected

◆ ParsePosition()

float CGUIControlFactory::ParsePosition ( const char * pos,
const float parentSize )
static

Create an info label from an XML element Processes XML elements of the form <xmltag fallback="fallback_value">info_value</xmltag> where info_value may use $INFO[], $LOCALIZE[], $NUMBER[] etc. If either the fallback_value or info_value are natural numbers they are interpreted as ids for lookup in strings.po. The fallback attribute is optional.

Parameters
elementXML element to process
infoLabelReturned infoLabel
parentIDThe parent id
Returns
true if a valid info label was read, false otherwise

Parse a position string Handles strings of the form

number of pixels

r number of pixels measured from the right

% percentage of parent size

Parameters
posthe string to parse.
parentSizethe size of the parent.
See also
GetPosition

◆ TranslateControlType() [1/2]

std::string CGUIControlFactory::TranslateControlType ( CGUIControl::GUICONTROLTYPES type)
static

translate from control type to control name

Parameters
typetype of the control
Returns
name of control

◆ TranslateControlType() [2/2]

CGUIControl::GUICONTROLTYPES CGUIControlFactory::TranslateControlType ( const std::string & type)
static

translate from control name to control type

Parameters
typename of the control
Returns
type of control

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