summaryrefslogtreecommitdiff
path: root/menuitem.h
blob: a7e62dcb7f0d32bf5c99d3a0d3a5c19a14b917a5 (plain)
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
208
209
210
211
212
213
214
215
216
217
218
219
#ifndef __NOPACITY_MENUITEM_H
#define __NOPACITY_MENUITEM_H

class cNopacityMenuItem : public cListObject, public cThread {
protected:
    cOsd *osd;
    cPixmap *pixmap;
    cPixmap *pixmapIcon;
    cPixmap *pixmapTextScroller;
    int *handleBackgrounds;
    const char *Text;
    bool selectable;
    bool current;
    bool wasCurrent;
    bool scrollable;
    bool drawn;
    cFont *font;
    cFont *fontSmall;
    cFont *fontEPGWindow;
    cFont *fontEPGWindowLarge;
    int width, height;
    int top, left;
    int spaceMenu;
    int textLeft;
    int index;
    cString *itemTabs;
    int *tabWidth;
    int numTabs;
    cRect *textWindow;
    cNopacityTextWindow *infoTextWindow;
    virtual void SetTextFull(void) {};
    virtual void SetTextShort(void) {};
    void DrawDelimiter(const char *del, const char *icon, int handleBgrd);
    void DrawRoundedCorners(tColor borderColor);
    virtual void Action(void);
    void DoSleep(int duration);
public:
    cNopacityMenuItem(cOsd *osd, const char *text, bool sel);
    virtual ~cNopacityMenuItem(void);
    void CreatePixmap();
    void CreatePixmapIcon(void);
    virtual void CreatePixmapTextScroller(int totalWidth);
    void SetGeometry(int index, int top, int left, int width, int height, int spaceMenu);
    void SetFont(cFont *font) {this->font = font;}
    void SetFontSmall(cFont *fontSmall) {this->fontSmall = fontSmall;}
    void SetFontEPGWindow(cFont *font) {this->fontEPGWindow = font;}
    void SetFontEPGWindowLarge(cFont *font) {this->fontEPGWindowLarge = font;}
    void SetCurrent(bool cur); 
    void SetAlpha(int alpha) {this->pixmap->SetAlpha(alpha);}
    void SetAlphaIcon(int alpha) {if (pixmapIcon) this->pixmapIcon->SetAlpha(alpha);}
    void SetAlphaText(int alpha) {if (pixmapTextScroller) this->pixmapTextScroller->SetAlpha(alpha);}
    void SetTabs(cString *tabs, int *tabWidths, int numtabs);
    void SetBackgrounds(int *handleBackgrounds);
    void SetTextWindow(cRect *window) {textWindow = window;};
    virtual void CreateText(void) {};
    virtual void SetPoster(void) {};
    virtual int CheckScrollable(bool hasIcon) {return 0;};
    virtual void Render() = 0;
};

class cNopacityMainMenuItem : public cNopacityMenuItem {
private:
    bool isSetup;
    cString menuNumber;
    cString menuEntry;
    std::string strEntry;
    std::string strEntryFull;
    static std::string items[16];
    cString GetIconName();
    void DrawBackground(void);
    void SetTextFull(void);
    void SetTextShort(void);
public:
    cNopacityMainMenuItem(cOsd *osd, const char *text, bool sel, bool setup);
    ~cNopacityMainMenuItem(void);
    void CreatePixmapTextScroller(int totalWidth);
    void CreateText(void);
    int CheckScrollable(bool hasIcon);
    void Render();
};

class cNopacityScheduleMenuItem : public cNopacityMenuItem {
private:
    eMenuCategory category;
    const cEvent *Event;
    const cChannel *Channel;
    eTimerMatch TimerMatch;
    cRect *vidWin;
    std::string strDateTime;
    std::string strTitle;
    std::string strSubTitle;
    std::string strTitleFull;
    std::string strSubTitleFull;
    bool scrollTitle;
    bool scrollSubTitle;
    int titleY;
    void DrawBackground(int textLeft);
    void DrawLogo(int logoWidth, int logoHeight);
    void DrawRemaining(int x, int y, int width);
    void SetTextFull(void);
    void SetTextShort(void);
public:
    cNopacityScheduleMenuItem(cOsd *osd, const cEvent *Event, const cChannel *Channel, eTimerMatch TimerMatch, bool sel, eMenuCategory category, cRect *vidWin);
    ~cNopacityScheduleMenuItem(void);
    void CreatePixmapTextScroller(int totalWidth);
    void CreateText(void);
    int CheckScrollable(bool hasIcon);
    void Render();
};

class cNopacityChannelMenuItem : public cNopacityMenuItem {
private:
    const cChannel *Channel;
    std::string strEntry;
    std::string strEntryFull;
    cString strChannelSource;
    cString strChannelInfo;
    std::string strEpgInfo;
    std::string strEpgInfoFull;
    std::string strTimeInfo;
    cRect *vidWin;
    void SetTextFull(void);
    void SetTextShort(void);
    void DrawBackground(void);
    void readCurrentEPG(void);
    std::string readEPG(void);
public:
    cNopacityChannelMenuItem(cOsd *osd, const cChannel *Channel, bool sel, cRect *vidWin);
    ~cNopacityChannelMenuItem(void);
    void CreatePixmapTextScroller(int totalWidth);
    void CreateText(void);
    int CheckScrollable(bool hasIcon);
    void Render();
};

class cNopacityTimerMenuItem : public cNopacityMenuItem {
private:
    const cTimer *Timer;
    std::string strEntry;
    std::string strEntryFull;
    std::string strDateTime;
    void SetTextFull(void);
    void SetTextShort(void);
    void DrawBackground(int textLeft);
    void DrawLogo(int logoWidth, int logoHeight);
    std::string CreateDate(void);
public:
    cNopacityTimerMenuItem(cOsd *osd, const cTimer *Timer, bool sel);
    ~cNopacityTimerMenuItem(void);
    void CreatePixmapTextScroller(int totalWidth);
    void CreateText(void);
    int CheckScrollable(bool hasIcon);
    void Render();
};

class cNopacityRecordingMenuItem : public cNopacityMenuItem {
private:
    const cRecording *Recording;
    bool isFolder;
    bool hasManualPoster;
    cString manualPosterPath;
    bool hasPoster;
    int posterWidth, posterHeight;
    TVScraperGetPoster poster;
    int Level, Total, New;
    cRect *vidWin;
    std::string strRecName;
    std::string strRecNameFull;
    void SetTextFull(void);
    void SetTextShort(void);
    void SetTextFullFolder(void);
    void SetTextShortFolder(void);
    void SetTextFullRecording(void);
    void SetTextShortRecording(void);
    void DrawBackground(void);
    int DrawRecordingNewIcon(void);
    int DrawRecordingEditedIcon(int startLeft);
    void DrawFolderIcon(void);
    void DrawRecDateTime(void);
    void DrawFolderNewSeen(void);
    void DrawPoster(void);
    int CheckScrollableRecording(void);
    int CheckScrollableFolder(void);
public:
    cNopacityRecordingMenuItem(cOsd *osd, const cRecording *Recording, bool sel, bool isFolder, int Level, int Total, int New, cRect *vidWin);
    ~cNopacityRecordingMenuItem(void);
    void CreatePixmapTextScroller(int totalWidth);
    void CreateText(void);
    void SetPoster(void);
    int CheckScrollable(bool hasIcon);
    void Render();
};

class cNopacityDefaultMenuItem : public cNopacityMenuItem {
private:
    bool CheckProgressBar(const char *text);
    void DrawBackground(void);
    void DrawProgressBar(int x, int width, const char *bar, tColor color);
    bool DrawHeaderElement(void);
    std::string strEntry;
    std::string strEntryFull;
    int scrollCol;
    void SetTextFull(void);
    void SetTextShort(void);
public:
    cNopacityDefaultMenuItem(cOsd *osd, const char *text, bool sel);
    ~cNopacityDefaultMenuItem(void);
    int CheckScrollable(bool hasIcon);
    void Render();
};

class cNopacityTrackMenuItem : public cNopacityMenuItem {
private:
public:
    cNopacityTrackMenuItem(cOsd *osd, const char *text);
    ~cNopacityTrackMenuItem(void);
    void Render();
};
#endif //__NOPACITY_MENUITEM_H