kodi
GUIResizeControl.h
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 
25 {
26 public:
27  CGUIResizeControl(int parentID,
28  int controlID,
29  float posX,
30  float posY,
31  float width,
32  float height,
33  const CTextureInfo& textureFocus,
34  const CTextureInfo& textureNoFocus,
35  UTILS::MOVING_SPEED::MapEventConfig& movingSpeedCfg);
36 
37  ~CGUIResizeControl() override = default;
38  CGUIResizeControl* Clone() const override { return new CGUIResizeControl(*this); }
39 
40  void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) override;
41  void Render() override;
42  bool OnAction(const CAction &action) override;
43  void OnUp() override;
44  void OnDown() override;
45  void OnLeft() override;
46  void OnRight() override;
47  void AllocResources() override;
48  void FreeResources(bool immediately = false) override;
49  void DynamicResourceAlloc(bool bOnOff) override;
50  void SetInvalid() override;
51  void SetPosition(float posX, float posY) override;
52  void SetLimits(float x1, float y1, float x2, float y2);
53  bool CanFocus() const override { return true; }
54 
55 protected:
56  EVENT_RESULT OnMouseEvent(const CPoint& point, const KODI::MOUSE::CMouseEvent& event) override;
57  bool UpdateColors(const CGUIListItem* item) override;
58  bool SetAlpha(unsigned char alpha);
59  void Resize(float x, float y);
60  std::unique_ptr<CGUITexture> m_imgFocus;
61  std::unique_ptr<CGUITexture> m_imgNoFocus;
62  unsigned int m_frameCounter;
64  float m_fAnalogSpeed;
65  float m_x1, m_x2, m_y1, m_y2;
66 
67 private:
68  CGUIResizeControl(const CGUIResizeControl& control);
69 };
70 
CGUIResizeControl(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo &textureFocus, const CTextureInfo &textureNoFocus, UTILS::MOVING_SPEED::MapEventConfig &movingSpeedCfg)
Definition: GUIResizeControl.cpp:20
Definition: GUIListItem.h:29
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
EVENT_RESULT OnMouseEvent(const CPoint &point, const KODI::MOUSE::CMouseEvent &event) override
Perform a mouse action.
Definition: GUIResizeControl.cpp:136
Class to calculate the velocity for a motion effect. To ensure it works, the GetUpdatedDistance metho...
Definition: MovingSpeed.h:72
Simple class for mouse events.
Definition: MouseEvent.h:20
Definition: GUIResizeControl.h:24