kodi
GUIControlFactory.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-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 
16 #include "GUIControl.h"
17 #include "utils/ColorUtils.h"
18 #include "utils/MovingSpeed.h"
19 
20 #include <string>
21 #include <vector>
22 
23 class CTextureInfo; // forward
24 class CAspectRatio;
25 class TiXmlNode;
26 class CGUIAction;
27 
28 namespace KODI
29 {
30 namespace GUILIB
31 {
32 namespace GUIINFO
33 {
34 class CGUIInfoLabel;
35 }
36 } // namespace GUILIB
37 } // namespace KODI
38 
44 {
45 public:
46  CGUIControlFactory(void);
47  virtual ~CGUIControlFactory(void);
48  CGUIControl* Create(int parentID,
49  const CRect& rect,
50  TiXmlElement* pControlNode,
51  bool insideContainer = false);
52 
57  static CGUIControl::GUICONTROLTYPES TranslateControlType(const std::string& type);
58 
63  static std::string TranslateControlType(CGUIControl::GUICONTROLTYPES type);
64 
65  static bool GetAspectRatio(const TiXmlNode* pRootNode,
66  const char* strTag,
67  CAspectRatio& aspectRatio);
68  static bool GetInfoTexture(const TiXmlNode* pRootNode,
69  const char* strTag,
70  CTextureInfo& image,
72  int parentID);
73  static bool GetTexture(const TiXmlNode* pRootNode, const char* strTag, CTextureInfo& image);
74  static bool GetAlignment(const TiXmlNode* pRootNode, const char* strTag, uint32_t& dwAlignment);
75  static bool GetAlignmentY(const TiXmlNode* pRootNode, const char* strTag, uint32_t& dwAlignment);
76  static bool GetAnimations(TiXmlNode* control,
77  const CRect& rect,
78  int context,
79  std::vector<CAnimation>& animation);
80 
102  static float ParsePosition(const char* pos, const float parentSize);
103 
104  static bool GetInfoLabelFromElement(const TiXmlElement* element,
106  int parentID);
107  static void GetInfoLabel(const TiXmlNode* pControlNode,
108  const std::string& labelTag,
110  int parentID);
111  static void GetInfoLabels(const TiXmlNode* pControlNode,
112  const std::string& labelTag,
113  std::vector<KODI::GUILIB::GUIINFO::CGUIInfoLabel>& infoLabels,
114  int parentID);
115  static bool GetColor(const TiXmlNode* pRootNode, const char* strTag, UTILS::COLOR::Color& value);
116  static bool GetInfoColor(const TiXmlNode* pRootNode,
117  const char* strTag,
119  int parentID);
120  static std::string FilterLabel(const std::string& label);
121  static bool GetConditionalVisibility(const TiXmlNode* control, std::string& condition);
122  static bool GetActions(const TiXmlNode* pRootNode, const char* strTag, CGUIAction& actions);
123  static void GetRectFromString(const std::string& string, CRect& rect);
124  static bool GetHitRect(const TiXmlNode* pRootNode, CRect& rect, const CRect& parentRect);
125  static bool GetScroller(const TiXmlNode* pControlNode,
126  const std::string& scrollerTag,
127  CScroller& scroller);
128 
129 private:
130  static std::string GetType(const TiXmlElement* pControlNode);
131  static bool GetMovingSpeedConfig(const TiXmlNode* pRootNode,
132  const char* strTag,
133  UTILS::MOVING_SPEED::MapEventConfig& movingSpeedCfg);
134  static bool GetConditionalVisibility(const TiXmlNode* control,
135  std::string& condition,
136  std::string& allowHiddenFocus);
137  bool GetString(const TiXmlNode* pRootNode, const char* strTag, std::string& strString);
138  static bool GetFloatRange(const TiXmlNode* pRootNode,
139  const char* strTag,
140  float& iMinValue,
141  float& iMaxValue,
142  float& iIntervalValue);
143  static bool GetIntRange(const TiXmlNode* pRootNode,
144  const char* strTag,
145  int& iMinValue,
146  int& iMaxValue,
147  int& iIntervalValue);
148 
157  static bool GetPosition(const TiXmlNode* node,
158  const char* tag,
159  const float parentSize,
160  float& value);
161 
176  static bool GetDimension(
177  const TiXmlNode* node, const char* strTag, const float parentSize, float& value, float& min);
178 
196  static bool GetDimensions(const TiXmlNode* node,
197  const char* leftTag,
198  const char* rightTag,
199  const char* centerLeftTag,
200  const char* centerRightTag,
201  const char* widthTag,
202  const float parentSize,
203  float& left,
204  float& width,
205  float& min_width);
206 };
Definition: GUIInfoLabel.h:31
Base class for controls.
Definition: GUIControl.h:83
Class used to handle scrolling, allow using tweeners.
Definition: VisibleEffect.h:221
Definition: GUIControlFactory.h:43
Definition: GUITexture.h:28
Definition: GUITexture.h:51
Definition: AudioDecoder.h:18
Definition: LibInputPointer.h:13
Definition: actions.py:1
Definition: GUIInfoColor.h:30
Class containing vector of condition->(action/navigation route) and handling its execution.
Definition: GUIAction.h:21