2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
12 \file GUIMoverControl.h
16 #include "GUIControl.h"
17 #include "GUITexture.h"
18 #include "utils/MovingSpeed.h"
20 #define ALLOWED_DIRECTIONS_ALL 0
21 #define ALLOWED_DIRECTIONS_UPDOWN 1
22 #define ALLOWED_DIRECTIONS_LEFTRIGHT 2
28 class CGUIMoverControl
: public CGUIControl
31 CGUIMoverControl(int parentID
,
37 const CTextureInfo
& textureFocus
,
38 const CTextureInfo
& textureNoFocus
,
39 KODI::UTILS::MOVING_SPEED::MapEventConfig
& movingSpeedCfg
);
41 ~CGUIMoverControl(void) override
= default;
42 CGUIMoverControl
* Clone() const override
{ return new CGUIMoverControl(*this); }
44 void Process(unsigned int currentTime
, CDirtyRegionList
&dirtyregions
) override
;
45 void Render() override
;
46 bool OnAction(const CAction
&action
) override
;
48 void OnDown() override
;
49 void OnLeft() override
;
50 void OnRight() override
;
51 void AllocResources() override
;
52 void FreeResources(bool immediately
= false) override
;
53 void DynamicResourceAlloc(bool bOnOff
) override
;
54 void SetInvalid() override
;
55 void SetPosition(float posX
, float posY
) override
;
56 void SetLimits(int iX1
, int iY1
, int iX2
, int iY2
);
57 void SetLocation(int iLocX
, int iLocY
, bool bSetPosition
= true);
58 int GetXLocation() const { return m_iLocationX
; }
59 int GetYLocation() const { return m_iLocationY
; }
60 bool CanFocus() const override
{ return true; }
63 EVENT_RESULT
OnMouseEvent(const CPoint
& point
, const KODI::MOUSE::CMouseEvent
& event
) override
;
64 bool UpdateColors(const CGUIListItem
* item
) override
;
65 bool SetAlpha(unsigned char alpha
);
66 void Move(int iX
, int iY
);
67 std::unique_ptr
<CGUITexture
> m_imgFocus
;
68 std::unique_ptr
<CGUITexture
> m_imgNoFocus
;
69 unsigned int m_frameCounter
;
70 KODI::UTILS::MOVING_SPEED::CMovingSpeed m_movingSpeed
;
72 int m_iX1
, m_iX2
, m_iY1
, m_iY2
;
73 int m_iLocationX
, m_iLocationY
;
76 CGUIMoverControl(const CGUIMoverControl
& control
);