[guilib] fix labelcontrols with auto width always being marked as dirty if they speci...
[vuplus_xbmc] / xbmc / guilib / GUIToggleButtonControl.h
1 /*!
2 \file GUIToggleButtonControl.h
3 \brief
4 */
5
6 #ifndef GUILIB_GUITOGGLEBUTTONCONTROL_H
7 #define GUILIB_GUITOGGLEBUTTONCONTROL_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 "GUIButtonControl.h"
32
33 /*!
34  \ingroup controls
35  \brief
36  */
37 class CGUIToggleButtonControl : public CGUIButtonControl
38 {
39 public:
40   CGUIToggleButtonControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus, const CTextureInfo& altTextureFocus, const CTextureInfo& altTextureNoFocus, const CLabelInfo &labelInfo);
41   virtual ~CGUIToggleButtonControl(void);
42   virtual CGUIToggleButtonControl *Clone() const { return new CGUIToggleButtonControl(*this); };
43
44   virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
45   virtual void Render();
46   virtual bool OnAction(const CAction &action);
47   virtual void AllocResources();
48   virtual void FreeResources(bool immediately = false);
49   virtual void DynamicResourceAlloc(bool bOnOff);
50   virtual void SetInvalid();
51   virtual void SetPosition(float posX, float posY);
52   virtual void SetWidth(float width);
53   virtual void SetHeight(float height);
54   void SetLabel(const std::string& strLabel);
55   void SetAltLabel(const std::string& label);
56   virtual CStdString GetDescription() const;
57   void SetToggleSelect(const CStdString &toggleSelect);
58   void SetAltClickActions(const CGUIAction &clickActions);
59
60 protected:
61   virtual bool UpdateColors();
62   virtual void OnClick();
63   CGUIButtonControl m_selectButton;
64   INFO::InfoPtr m_toggleSelect;
65 };
66 #endif