2 \file GUIMoverControl.h
6 #ifndef GUILIB_GUIMoverCONTROL_H
7 #define GUILIB_GUIMoverCONTROL_H
12 * Copyright (C) 2005-2013 Team XBMC
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)
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.
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/>.
31 #include "GUITexture.h"
32 #include "GUIControl.h"
34 #define ALLOWED_DIRECTIONS_ALL 0
35 #define ALLOWED_DIRECTIONS_UPDOWN 1
36 #define ALLOWED_DIRECTIONS_LEFTRIGHT 2
38 #define DIRECTION_NONE 0
39 #define DIRECTION_UP 1
40 #define DIRECTION_DOWN 2
41 #define DIRECTION_LEFT 3
42 #define DIRECTION_RIGHT 4
44 // normal alignment is TOP LEFT 0 = topleft, 1 = topright
46 #define ALIGN_BOTTOM 2
52 class CGUIMoverControl : public CGUIControl
55 CGUIMoverControl(int parentID, int controlID,
56 float posX, float posY, float width, float height,
57 const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus);
59 virtual ~CGUIMoverControl(void);
60 virtual CGUIMoverControl *Clone() const { return new CGUIMoverControl(*this); };
62 virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
63 virtual void Render();
64 virtual bool OnAction(const CAction &action);
66 virtual void OnDown();
67 virtual void OnLeft();
68 virtual void OnRight();
69 virtual void AllocResources();
70 virtual void FreeResources(bool immediately = false);
71 virtual void DynamicResourceAlloc(bool bOnOff);
72 virtual void SetInvalid();
73 virtual void SetPosition(float posX, float posY);
74 void SetLimits(int iX1, int iY1, int iX2, int iY2);
75 void SetLocation(int iLocX, int iLocY, bool bSetPosition = true);
76 int GetXLocation() const { return m_iLocationX;};
77 int GetYLocation() const { return m_iLocationY;};
78 virtual bool CanFocus() const { return true; };
81 virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event);
82 virtual bool UpdateColors();
83 bool SetAlpha(unsigned char alpha);
84 void UpdateSpeed(int nDirection);
85 void Move(int iX, int iY);
86 CGUITexture m_imgFocus;
87 CGUITexture m_imgNoFocus;
88 unsigned int m_frameCounter;
89 unsigned int m_lastMoveTime;
94 float m_fAcceleration;
95 int m_iX1, m_iX2, m_iY1, m_iY2;
96 int m_iLocationX, m_iLocationY;