kodi
GUIMoverControl.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
16 #include "GUIControl.h"
17 #include "GUITexture.h"
18 #include "utils/MovingSpeed.h"
19 
20 #define ALLOWED_DIRECTIONS_ALL 0
21 #define ALLOWED_DIRECTIONS_UPDOWN 1
22 #define ALLOWED_DIRECTIONS_LEFTRIGHT 2
23 
29 {
30 public:
31  CGUIMoverControl(int parentID,
32  int controlID,
33  float posX,
34  float posY,
35  float width,
36  float height,
37  const CTextureInfo& textureFocus,
38  const CTextureInfo& textureNoFocus,
39  UTILS::MOVING_SPEED::MapEventConfig& movingSpeedCfg);
40 
41  ~CGUIMoverControl(void) override = default;
42  CGUIMoverControl* Clone() const override { return new CGUIMoverControl(*this); }
43 
44  void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) override;
45  void Render() override;
46  bool OnAction(const CAction &action) override;
47  void OnUp() 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; }
61 
62 protected:
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;
71  float m_fAnalogSpeed;
72  int m_iX1, m_iX2, m_iY1, m_iY2;
73  int m_iLocationX, m_iLocationY;
74 
75 private:
76  CGUIMoverControl(const CGUIMoverControl& control);
77 };
78 
Definition: GUIListItem.h:29
CGUIMoverControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo &textureFocus, const CTextureInfo &textureNoFocus, UTILS::MOVING_SPEED::MapEventConfig &movingSpeedCfg)
Definition: GUIMoverControl.cpp:21
Base class for controls.
Definition: GUIControl.h:83
EVENT_RESULT
Results of OnMouseEvent() Any value not equal to EVENT_RESULT_UNHANDLED indicates that the event was ...
Definition: GUIControl.h:68
Class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:21
Definition: GUITexture.h:51
Class to calculate the velocity for a motion effect. To ensure it works, the GetUpdatedDistance metho...
Definition: MovingSpeed.h:72
EVENT_RESULT OnMouseEvent(const CPoint &point, const KODI::MOUSE::CMouseEvent &event) override
Perform a mouse action.
Definition: GUIMoverControl.cpp:152
Simple class for mouse events.
Definition: MouseEvent.h:20
Definition: GUIMoverControl.h:28