forked from MegaV0lt/vdr-plugin-skinflatplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
baserender.h
207 lines (170 loc) · 8.2 KB
/
baserender.h
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*
* Skin flatPlus: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id$
*/
#pragma once
#include <list>
#include "./imageloader.h"
#include "./flat.h"
#include "./textscroller.h"
#include "./complexcontent.h"
enum eBorder {
BorderMenuItem,
BorderRecordJump,
BorderMenuRecord,
BorderMessage,
BorderButton,
BorderContent,
BorderTVSPoster,
BorderSetRecording,
BorderMMWidget
};
struct sDecorBorder {
int Left, Top, Width, Height, Size, Type;
tColor ColorFg, ColorBg;
int From;
};
template<class T> inline T MyMax(T a, T b) { return a >= b ? a : b; }
class cFlatBaseRender {
protected:
cOsd *m_Osd {nullptr};
int m_OsdLeft {0}, m_OsdTop {0}, m_OsdWidth {0}, m_OsdHeight {0};
int m_MarginItem {5};
// Standard fonts
cFont *m_Font {nullptr};
cFont *m_FontSml {nullptr};
cFont *m_FontFixed {nullptr};
int m_FontHeight {0};
int m_FontSmlHeight {0};
int m_FontFixedHeight {0};
// Font for main menu weather widget
cFont *m_FontTempSml {nullptr};
// TopBar
cPixmap *TopBarPixmap {nullptr};
cPixmap *TopBarIconPixmap {nullptr};
cPixmap *TopBarIconBgPixmap {nullptr};
cFont *m_TopBarFont {nullptr}, *m_TopBarFontSml {nullptr}, *m_TopBarFontClock {nullptr};
int m_TopBarFontHeight {0}, m_TopBarFontSmlHeight {0}, m_TopBarFontClockHeight {0};
cString m_TopBarTitle{""};
cString m_TopBarTitleExtra1{""}, m_TopBarTitleExtra2{""};
cString m_TopBarExtraIcon{""};
bool m_TopBarExtraIconSet = false;
cString m_TopBarMenuIcon{""};
bool m_TopBarMenuIconSet = false;
cString m_TopBarMenuIconRight{""};
bool m_TopBarMenuIconRightSet = false;
cString m_TopBarMenuLogo{""};
bool m_TopBarMenuLogoSet = false;
bool m_TopBarUpdateTitle = false;
cString m_TopBarLastDate{""};
int m_TopBarHeight {0};
int m_VideoDiskUsageState {-1};
// Progressbar
cPixmap *ProgressBarPixmap {nullptr};
cPixmap *ProgressBarPixmapBg {nullptr};
int m_ProgressBarHeight {0}, m_ProgressBarTop {0}, m_ProgressBarWidth {0};
int m_ProgressBarMarginHor {0}, m_ProgressBarMarginVer {0};
int m_ProgressType {0};
bool m_ProgressBarSetBackground = false;
bool m_ProgressBarIsSignal = false;
tColor m_ProgressBarColorFg {0}, m_ProgressBarColorBarFg {0};
tColor m_ProgressBarColorBarCurFg {0}, m_ProgressBarColorBg {0};
tColor m_ProgressBarColorMark {0}, m_ProgressBarColorMarkCurrent {0};
// Scrollbar
int m_ScrollBarWidth {0};
// Buttons red, green, yellow, blue
cPixmap *ButtonsPixmap {nullptr};
int m_ButtonsWidth {0}, m_ButtonsHeight {0}, m_ButtonsTop {0};
int m_MarginButtonColor {0}, m_ButtonColorHeight {0};
bool m_ButtonsDrawn = false;
// Message
cPixmap *MessagePixmap {nullptr}, *MessageIconPixmap {nullptr};
int /* m_MessageWidth {0}, */ m_MessageHeight {0}; // m_MessageWidth is unused
cTextScrollers MessageScroller;
// Multiline content with scrollbar
// cPixmap *ContentPixmap; //* Content* is unused
// cPixmap *ContentEpgImagePixmap;
// int ContentLeft, ContentTop, ContentHeight, ContentWidth;
// int ContentDrawPortHeight; // Complete high of text
// int ContentTextHeight;
// bool ContentHasScrollbar;
// bool ContentShown;
// int ContentFontType;
// int ContentEventType;
// int ContentEventHeight;
// int ContentEventPosterWidth, ContentEventPosterHeight;
// tColor ContentColorFg, ContentColorBg;
// cTextWrapper ContentWrapper;
// cTextWrapper ContentWrapperPoster;
// const cEvent *ContentEvent;
cComplexContent WeatherWidget;
cPixmap *DecorPixmap {nullptr};
std::list<sDecorBorder> Borders; // For clearing specific borders (Clear only 'MenuItems' and not 'TopBar')
/* void ContentDraw(void); // Unused
void ContentEventDraw(void); */
double ScrollbarSize(void);
void ProgressBarDrawMark(int PosMark, int PosMarkLast, int PosCurrent, bool Start, bool IsCurrent);
int ProgressBarMarkPos(int P, int Total);
void DecorDrawGlowRectHor(cPixmap *pixmap, int Left, int Top, int Width, int Height, tColor ColorBg);
void DecorDrawGlowRectVer(cPixmap *pixmap, int Left, int Top, int Width, int Height, tColor ColorBg);
void DecorDrawGlowRectTL(cPixmap *pixmap, int Left, int Top, int Width, int Height, tColor ColorBg);
void DecorDrawGlowRectTR(cPixmap *pixmap, int Left, int Top, int Width, int Height, tColor ColorBg);
void DecorDrawGlowRectBL(cPixmap *pixmap, int Left, int Top, int Width, int Height, tColor ColorBg);
void DecorDrawGlowRectBR(cPixmap *pixmap, int Left, int Top, int Width, int Height, tColor ColorBg);
void DecorDrawGlowEllipseTL(cPixmap *pixmap, int Left, int Top, int Width, int Height,
tColor ColorBg, int type);
void DecorDrawGlowEllipseTR(cPixmap *pixmap, int Left, int Top, int Width, int Height,
tColor ColorBg, int type);
void DecorDrawGlowEllipseBL(cPixmap *pixmap, int Left, int Top, int Width, int Height,
tColor ColorBg, int type);
void DecorDrawGlowEllipseBR(cPixmap *pixmap, int Left, int Top, int Width, int Height,
tColor ColorBg, int type);
void TopBarEnableDiskUsage(void);
// tColor Multiply(tColor Color, uint8_t Alpha);
tColor SetAlpha(tColor Color, double am);
public:
cImageLoader ImgLoader;
cFlatBaseRender(void);
~cFlatBaseRender(void);
void CreateFullOsd(void);
void CreateOsd(int Left, int Top, int Width, int Height);
void TopBarCreate(void);
void TopBarSetTitle(cString title);
void TopBarSetTitleWithoutClear(cString title);
void TopBarSetTitleExtra(cString Extra1, cString Extra2);
void TopBarSetMenuIcon(cString icon);
void TopBarSetMenuIconRight(cString icon);
void TopBarClearMenuIconRight(void);
void TopBarSetMenuLogo(cString icon);
void TopBarSetExtraIcon(cString icon);
void TopBarUpdate(void);
void ButtonsCreate(void);
void ButtonsSet(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
bool ButtonsDrawn(void);
void MessageCreate(void);
void MessageSet(eMessageType Type, const char *Text);
void MessageClear(void);
void ProgressBarDrawRaw(cPixmap *Pixmap, cPixmap *PixmapBg, cRect rec, cRect recBg, int Current, int Total,
tColor ColorFg, tColor ColorBarFg, tColor ColorBg,
int Type, bool SetBackground, bool IsSignal = false);
void ProgressBarCreate(int Left, int Top, int Width, int Height, int MarginHor, int MarginVer,
tColor ColorFg, tColor ColorBarFg, tColor ColorBg, int Type,
bool SetBackground = false, bool IsSignal = false);
void ProgressBarDrawBgColor(void);
void ProgressBarDraw(int Current, int Total);
void ProgressBarDrawMarks(int Current, int Total, const cMarks *Marks, tColor Color, tColor ColorCurrent);
void ScrollbarDraw(cPixmap *Pixmap, int Left, int Top, int Height, int Total, int Offset,
int Shown, bool CanScrollUp, bool CanScrollDown);
int ScrollBarWidth(void);
void DecorBorderDraw(int Left, int Top, int Width, int Height, int Size, int Type,
tColor ColorFg, tColor ColorBg, int From = 0, bool Store = true);
void DecorBorderClear(int Left, int Top, int Width, int Height, int Size);
void DecorBorderClearAll(void);
void DecorBorderRedrawAll(void);
void DecorBorderClearByFrom(int From);
int GetFontAscender(const char *Name, int CharHeight, int CharWidth = 0);
void DrawWidgetWeather(void);
};