[guilib] fix labelcontrols with auto width always being marked as dirty if they speci...
[vuplus_xbmc] / xbmc / guilib / GUICheckMarkControl.h
1 /*!
2 \file GUICheckMarkControl.h
3 \brief
4 */
5
6 #ifndef CGUILIB_GUICHECKMARK_CONTROL_H
7 #define CGUILIB_GUICHECKMARK_CONTROL_H
8
9 #pragma once
10
11 /*
12  *      Copyright (C) 2005-2013 Team XBMC
13  *      http://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, see
27  *  <http://www.gnu.org/licenses/>.
28  *
29  */
30
31 #include "GUITexture.h"
32 #include "GUILabel.h"
33 #include "GUIControl.h"
34
35 /*!
36  \ingroup controls
37  \brief
38  */
39 class CGUICheckMarkControl: public CGUIControl
40 {
41 public:
42   CGUICheckMarkControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& textureCheckMark, const CTextureInfo& textureCheckMarkNF, float checkWidth, float checkHeight, const CLabelInfo &labelInfo);
43   virtual ~CGUICheckMarkControl(void);
44   virtual CGUICheckMarkControl *Clone() const { return new CGUICheckMarkControl(*this); };
45
46   virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
47   virtual void Render();
48   virtual bool OnAction(const CAction &action) ;
49   virtual bool OnMessage(CGUIMessage& message);
50   virtual void AllocResources();
51   virtual void FreeResources(bool immediately = false);
52   virtual void DynamicResourceAlloc(bool bOnOff);
53   virtual void SetInvalid();
54
55   void SetLabel(const std::string& strLabel);
56   const std::string GetLabel() const { return m_strLabel; };
57   const CLabelInfo& GetLabelInfo() const { return m_label.GetLabelInfo(); };
58   void SetSelected(bool bOnOff);
59   bool GetSelected() const;
60
61   void PythonSetLabel(const CStdString &strFont, const std::string &strText, color_t textColor);
62   void PythonSetDisabledColor(color_t disabledColor);
63
64 protected:
65   virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event);
66   virtual bool UpdateColors();
67   CGUILabel::COLOR GetTextColor() const;
68   
69   CGUITexture m_imgCheckMark;
70   CGUITexture m_imgCheckMarkNoFocus;
71
72   CGUILabel  m_label;
73   std::string m_strLabel;
74   bool m_bSelected;
75 };
76 #endif