xbmc
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 }
37 }
38 
44 {
45 public:
46  CGUIControlFactory(void);
47  virtual ~CGUIControlFactory(void);
48  CGUIControl* Create(int parentID, const CRect &rect, TiXmlElement* pControlNode, bool insideContainer = false);
49 
54  static CGUIControl::GUICONTROLTYPES TranslateControlType(const std::string &type);
55 
60  static std::string TranslateControlType(CGUIControl::GUICONTROLTYPES type);
61 
62  static bool GetAspectRatio(const TiXmlNode* pRootNode, const char* strTag, CAspectRatio &aspectRatio);
63  static bool GetInfoTexture(const TiXmlNode* pRootNode, const char* strTag, CTextureInfo &image, KODI::GUILIB::GUIINFO::CGUIInfoLabel &info, int parentID);
64  static bool GetTexture(const TiXmlNode* pRootNode, const char* strTag, CTextureInfo &image);
65  static bool GetAlignment(const TiXmlNode* pRootNode, const char* strTag, uint32_t& dwAlignment);
66  static bool GetAlignmentY(const TiXmlNode* pRootNode, const char* strTag, uint32_t& dwAlignment);
67  static bool GetAnimations(TiXmlNode *control, const CRect &rect, int context, std::vector<CAnimation> &animation);
68 
90  static float ParsePosition(const char* pos, const float parentSize);
91 
92  static bool GetInfoLabelFromElement(const TiXmlElement *element, KODI::GUILIB::GUIINFO::CGUIInfoLabel &infoLabel, int parentID);
93  static void GetInfoLabel(const TiXmlNode *pControlNode, const std::string &labelTag, KODI::GUILIB::GUIINFO::CGUIInfoLabel &infoLabel, int parentID);
94  static void GetInfoLabels(const TiXmlNode *pControlNode, const std::string &labelTag, std::vector<KODI::GUILIB::GUIINFO::CGUIInfoLabel> &infoLabels, int parentID);
95  static bool GetColor(const TiXmlNode* pRootNode, const char* strTag, UTILS::COLOR::Color& value);
96  static bool GetInfoColor(const TiXmlNode* pRootNode, const char* strTag, KODI::GUILIB::GUIINFO::CGUIInfoColor &value, int parentID);
97  static std::string FilterLabel(const std::string &label);
98  static bool GetConditionalVisibility(const TiXmlNode* control, std::string &condition);
99  static bool GetActions(const TiXmlNode* pRootNode, const char* strTag, CGUIAction& actions);
100  static void GetRectFromString(const std::string &string, CRect &rect);
101  static bool GetHitRect(const TiXmlNode* pRootNode, CRect &rect, const CRect &parentRect);
102  static bool GetScroller(const TiXmlNode *pControlNode, const std::string &scrollerTag, CScroller& scroller);
103 private:
104  static std::string GetType(const TiXmlElement *pControlNode);
105  static bool GetMovingSpeedConfig(const TiXmlNode* pRootNode,
106  const char* strTag,
107  UTILS::MOVING_SPEED::MapEventConfig& movingSpeedCfg);
108  static bool GetConditionalVisibility(const TiXmlNode* control, std::string &condition, std::string &allowHiddenFocus);
109  bool GetString(const TiXmlNode* pRootNode, const char* strTag, std::string& strString);
110  static bool GetFloatRange(const TiXmlNode* pRootNode, const char* strTag, float& iMinValue, float& iMaxValue, float& iIntervalValue);
111  static bool GetIntRange(const TiXmlNode* pRootNode, const char* strTag, int& iMinValue, int& iMaxValue, int& iIntervalValue);
112 
121  static bool GetPosition(const TiXmlNode *node, const char* tag, const float parentSize, float& value);
122 
137  static bool GetDimension(const TiXmlNode *node, const char* strTag, const float parentSize, float &value, float &min);
138 
156  static bool GetDimensions(const TiXmlNode *node, const char *leftTag, const char *rightTag, const char *centerLeftTag,
157  const char *centerRightTag, const char *widthTag, const float parentSize, float &left,
158  float &width, float &min_width);
159 };
160 
Definition: GUIInfoLabel.h:31
Base class for controls.
Definition: GUIControl.h:75
Class used to handle scrolling, allow using tweeners.
Definition: VisibleEffect.h:221
Definition: GUIControlFactory.h:43
Definition: GUITexture.h:28
Definition: GUITexture.h:51
Controller configuration window.
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