Merge pull request #1356 from fetzerch/bugfix-isostack
[vuplus_xbmc] / xbmc / guilib / GUILabelControl.h
1 /*!
2 \file GUILabelControl.h
3 \brief
4 */
5
6 #ifndef GUILIB_GUILABELCONTROL_H
7 #define GUILIB_GUILABELCONTROL_H
8
9 #pragma once
10
11 /*
12  *      Copyright (C) 2005-2008 Team XBMC
13  *      http://www.xbmc.org
14  *
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)
18  *  any later version.
19  *
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.
24  *
25  *  You should have received a copy of the GNU General Public License
26  *  along with XBMC; see the file COPYING.  If not, write to
27  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28  *  http://www.gnu.org/copyleft/gpl.html
29  *
30  */
31
32 #include "GUIControl.h"
33 #include "GUILabel.h"
34
35 /*!
36  \ingroup controls
37  \brief
38  */
39 class CGUILabelControl :
40       public CGUIControl
41 {
42 public:
43   CGUILabelControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, bool wrapMultiLine, bool bHasPath);
44   virtual ~CGUILabelControl(void);
45   virtual CGUILabelControl *Clone() const { return new CGUILabelControl(*this); };
46
47   virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
48   virtual void Render();
49   virtual void UpdateInfo(const CGUIListItem *item = NULL);
50   virtual bool CanFocus() const;
51   virtual bool OnMessage(CGUIMessage& message);
52   virtual CStdString GetDescription() const;
53   virtual float GetWidth() const;
54   virtual void SetWidth(float width);
55   virtual CRect CalcRenderRegion() const;
56  
57   const CLabelInfo& GetLabelInfo() const { return m_label.GetLabelInfo(); };
58   void SetLabel(const std::string &strLabel);
59   void ShowCursor(bool bShow = true);
60   void SetCursorPos(int iPos);
61   int GetCursorPos() const { return m_iCursorPos;};
62   void SetInfo(const CGUIInfoLabel&labelInfo);
63   void SetWidthControl(float minWidth, bool bScroll);
64   void SetAlignment(uint32_t align);
65   void SetHighlight(unsigned int start, unsigned int end);
66
67 protected:
68   bool UpdateColors();
69   CStdString ShortenPath(const CStdString &path);
70
71   CGUILabel m_label;
72
73   bool m_bHasPath;
74   bool m_bShowCursor;
75   int m_iCursorPos;
76   unsigned int m_dwCounter;
77
78   // stuff for autowidth
79   float m_minWidth;
80
81   // multi-info stuff
82   CGUIInfoLabel m_infoLabel;
83
84   unsigned int m_startHighlight;
85   unsigned int m_endHighlight;
86 };
87 #endif