1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/*
* Copyright (C) 2019 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
/*!
\file GUIRangesControl.h
\brief
*/
#include "GUIControl.h"
#include "GUITexture.h"
#include <utility>
#include <vector>
/*!
\ingroup controls
\brief
*/
class CGUIRangesControl : public CGUIControl
{
class CGUIRange
{
public:
CGUIRange(float fPosX, float fPosY, float fWidth, float fHeight,
const CTextureInfo& lowerTextureInfo, const CTextureInfo& fillTextureInfo,
const CTextureInfo& upperTextureInfo, const std::pair<float, float>& percentages);
CGUIRange(const CGUIRange& range);
void AllocResources();
void FreeResources(bool bImmediately);
void DynamicResourceAlloc(bool bOnOff);
void SetInvalid();
bool SetDiffuseColor(const KODI::GUILIB::GUIINFO::CGUIInfoColor& color);
bool Process(unsigned int iCurrentTime);
void Render();
bool UpdateLayout(float fBackgroundTextureHeight, float fPosX, float fPosY, float fWidth, float fScaleX, float fScaleY);
private:
std::unique_ptr<CGUITexture> m_guiLowerTexture;
std::unique_ptr<CGUITexture> m_guiFillTexture;
std::unique_ptr<CGUITexture> m_guiUpperTexture;
std::pair<float,float> m_percentValues;
};
public:
CGUIRangesControl(int iParentID, int iControlID, float fPosX, float fPosY,
float fWidth, float fHeight, const CTextureInfo& backGroundTexture,
const CTextureInfo& leftTexture, const CTextureInfo& midTexture,
const CTextureInfo& rightTexture, const CTextureInfo& overlayTexture,
int iInfo);
~CGUIRangesControl() override = default;
CGUIRangesControl* Clone() const override { return new CGUIRangesControl(*this); }
void Process(unsigned int iCurrentTime, CDirtyRegionList& dirtyregions) override;
void Render() override;
bool CanFocus() const override;
void AllocResources() override;
void FreeResources(bool bImmediately = false) override;
void DynamicResourceAlloc(bool bOnOff) override;
void SetInvalid() override;
void SetPosition(float fPosX, float fPosY) override;
void UpdateInfo(const CGUIListItem* item = nullptr) override;
protected:
void SetRanges(const std::vector<std::pair<float, float>>& ranges);
void ClearRanges();
bool UpdateColors(const CGUIListItem* item) override;
bool UpdateLayout();
std::unique_ptr<CGUITexture> m_guiBackground;
std::unique_ptr<CGUITexture> m_guiOverlay;
const CTextureInfo m_guiLowerTextureInfo;
const CTextureInfo m_guiFillTextureInfo;
const CTextureInfo m_guiUpperTextureInfo;
std::vector<CGUIRange> m_ranges;
int m_iInfoCode = 0;
std::string m_prevRanges;
private:
CGUIRangesControl(const CGUIRangesControl& control);
};
|