6 #ifndef GUILIB_GUIINFOTYPES_H
7 #define GUILIB_GUIINFOTYPES_H
12 * Copyright (C) 2005-2013 Team XBMC
15 * This Program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
20 * This Program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with XBMC; see the file COPYING. If not, see
27 * <http://www.gnu.org/licenses/>.
31 #include "utils/StdString.h"
32 #include "interfaces/info/InfoBool.h"
39 CGUIInfoBool(bool value = false);
40 virtual ~CGUIInfoBool();
42 operator bool() const { return m_value; };
44 void Update(const CGUIListItem *item = NULL);
45 void Parse(const CStdString &expression, int context);
51 typedef uint32_t color_t;
56 CGUIInfoColor(color_t color = 0);
58 CGUIInfoColor& operator=(const CGUIInfoColor &color);
59 CGUIInfoColor& operator=(color_t color);
60 operator color_t() const { return m_color; };
63 void Parse(const CStdString &label, int context);
66 color_t GetColor() const;
75 CGUIInfoLabel(const CStdString &label, const CStdString &fallback = "", int context = 0);
77 void SetLabel(const CStdString &label, const CStdString &fallback, int context = 0);
80 \brief Gets a label (or image) for a given window context from the info manager.
81 \param contextWindow the context in which to evaluate the expression.
82 \param preferImage caller is specifically wanting an image rather than a label. Defaults to false.
83 \param fallback if non-NULL, is set to an alternate value to use should the actual value be not appropriate. Defaults to NULL.
84 \return label (or image).
86 CStdString GetLabel(int contextWindow, bool preferImage = false, CStdString *fallback = NULL) const;
89 \brief Gets a label (or image) for a given listitem from the info manager.
90 \param item listitem in question.
91 \param preferImage caller is specifically wanting an image rather than a label. Defaults to false.
92 \param fallback if non-NULL, is set to an alternate value to use should the actual value be not appropriate. Defaults to NULL.
93 \return label (or image).
95 CStdString GetItemLabel(const CGUIListItem *item, bool preferImage = false, CStdString *fallback = NULL) const;
97 bool IsConstant() const;
100 const CStdString GetFallback() const { return m_fallback; };
102 static CStdString GetLabel(const CStdString &label, int contextWindow = 0, bool preferImage = false);
105 \brief Replaces instances of $LOCALIZE[number] with the appropriate localized string
106 \param label text to replace
107 \return text with any localized strings filled in.
109 static CStdString ReplaceLocalize(const CStdString &label);
112 \brief Replaces instances of $ADDON[id number] with the appropriate localized addon string
113 \param label text to replace
114 \return text with any localized strings filled in.
116 static CStdString ReplaceAddonStrings(const CStdString &label);
119 void Parse(const CStdString &label, int context);
124 CInfoPortion(int info, const CStdString &prefix, const CStdString &postfix, bool escaped = false);
125 CStdString GetLabel(const CStdString &info) const;
128 CStdString m_postfix;
133 CStdString m_fallback;
134 std::vector<CInfoPortion> m_info;