Fix keymap.
[vuplus_xbmc] / xbmc / guilib / GUIStaticItem.h
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #pragma once
22
23 /*!
24  \file GUIStaticItem.h
25  \brief
26  */
27
28 #include "GUIInfoTypes.h"
29 #include "xbmc/FileItem.h"
30 #include "GUIAction.h"
31
32 class TiXmlElement;
33
34 /*!
35  \ingroup lists,items
36  \brief wrapper class for a static item in a list container
37  
38  A wrapper class for the items in a container specified via the <content>
39  flag.  Handles constructing items from XML and updating item labels, icons
40  and properties.
41  
42  \sa CFileItem, CGUIBaseContainer
43  */
44 class CGUIStaticItem : public CFileItem
45 {
46 public:
47   /*! \brief constructor
48    Construct an item based on an XML description:
49      <item>
50        <label>$INFO[MusicPlayer.Artist]</label>
51        <label2>$INFO[MusicPlayer.Album]</label2>
52        <thumb>bar.png</thumb>
53        <icon>foo.jpg</icon>
54        <onclick>ActivateWindow(Home)</onclick>
55      </item>
56    
57    \param element XML element to construct from
58    \param contextWindow window context to use for any info labels
59    */
60   CGUIStaticItem(const TiXmlElement *element, int contextWindow);
61   CGUIStaticItem(const CFileItem &item); // for python
62   virtual ~CGUIStaticItem() {};
63   virtual CGUIListItem *Clone() const { return new CGUIStaticItem(*this); };
64   
65   /*! \brief update any infolabels in the items properties
66    Runs through all the items properties, updating any that should be
67    periodically recomputed
68    \param contextWindow window context to use for any info labels
69    */
70   void UpdateProperties(int contextWindow);
71
72   /*! \brief update visibility of this item
73    \param contextWindow window context to use for any info labels
74    \return true if visible state has changed, false otherwise
75    */
76   bool UpdateVisibility(int contextWindow);
77
78   /*! \brief whether this item is visible or not
79    */
80   bool IsVisible() const;
81
82   /*! \brief set a visible condition for this item.
83    \param condition the condition to use.
84    \param context the context for the condition (typically a window id).
85    */
86   void SetVisibleCondition(const std::string &condition, int context);
87
88   const CGUIAction &GetClickActions() const { return m_clickActions; };
89 private:
90   typedef std::vector< std::pair<CGUIInfoLabel, CStdString> > InfoVector;
91   InfoVector m_info;
92   INFO::InfoPtr m_visCondition;
93   bool m_visState;
94   CGUIAction m_clickActions;
95 };
96
97 typedef boost::shared_ptr<CGUIStaticItem> CGUIStaticItemPtr;