[guilib] fix labelcontrols with auto width always being marked as dirty if they speci...
[vuplus_xbmc] / xbmc / guilib / GUIResizeControl.h
1 /*!
2 \file GUIRESIZEControl.h
3 \brief
4 */
5
6 #ifndef GUILIB_GUIRESIZECONTROL_H
7 #define GUILIB_GUIRESIZECONTROL_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 "GUIControl.h"
33
34 #define DIRECTION_NONE 0
35 #define DIRECTION_UP 1
36 #define DIRECTION_DOWN 2
37 #define DIRECTION_LEFT 3
38 #define DIRECTION_RIGHT 4
39
40 /*!
41  \ingroup controls
42  \brief
43  */
44 class CGUIResizeControl : public CGUIControl
45 {
46 public:
47   CGUIResizeControl(int parentID, int controlID,
48                     float posX, float posY, float width, float height,
49                     const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus);
50
51   virtual ~CGUIResizeControl(void);
52   virtual CGUIResizeControl *Clone() const { return new CGUIResizeControl(*this); };
53
54   virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
55   virtual void Render();
56   virtual bool OnAction(const CAction &action);
57   virtual void OnUp();
58   virtual void OnDown();
59   virtual void OnLeft();
60   virtual void OnRight();
61   virtual void AllocResources();
62   virtual void FreeResources(bool immediately = false);
63   virtual void DynamicResourceAlloc(bool bOnOff);
64   virtual void SetInvalid();
65   virtual void SetPosition(float posX, float posY);
66   void SetLimits(float x1, float y1, float x2, float y2);
67   virtual bool CanFocus() const { return true; };
68
69 protected:
70   virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event);
71   virtual bool UpdateColors();
72   bool SetAlpha(unsigned char alpha);
73   void UpdateSpeed(int nDirection);
74   void Resize(float x, float y);
75   CGUITexture m_imgFocus;
76   CGUITexture m_imgNoFocus;
77   unsigned int m_frameCounter;
78   unsigned int m_lastMoveTime;
79   int m_nDirection;
80   float m_fSpeed;
81   float m_fAnalogSpeed;
82   float m_fMaxSpeed;
83   float m_fAcceleration;
84   float m_x1, m_x2, m_y1, m_y2;
85 };
86 #endif