summaryrefslogtreecommitdiff
path: root/displaymenu.h
blob: 721617c0849cea38c46d2ffb7cd29369409d9a16 (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
#pragma once

#include "baserender.h"
#include "complexcontent.h"
#include <vdr/menu.h>
#include <vdr/tools.h>
#include <list>
#include <ctype.h>
#include <iostream>
#include <sstream>
#include <iomanip>
using namespace std;

class cFlatDisplayMenu : public cFlatBaseRender,  public cSkinDisplayMenu {
    private:
        cPixmap *menuPixmap;
        cPixmap *menuIconsPixmap;
        cPixmap *menuIconsBGPixmap;

        int menuTop, menuWidth;
        int menuItemWidth;
        int menuItemLastHeight;
        bool MenuFullOsdIsDrawn;

        eMenuCategory menuCategory;
        int VideoDiskUsageState;

        int LastTimerCount, LastTimerActiveCount;
        cString LastTitle;

        int chLeft, chTop, chWidth, chHeight;
        cPixmap *contentHeadPixmap;
        cPixmap *contentHeadIconsPixmap;

        int cLeft, cTop, cWidth, cHeight;

        cPixmap *scrollbarPixmap;
        int scrollBarTop, scrollBarWidth, scrollBarHeight;

        int itemHeight, itemChannelHeight, itemTimerHeight, itemEventHeight, itemRecordingHeight;

        std::list<sDecorBorder> ItemsBorder;
        sDecorBorder EventBorder, RecordingBorder, TextBorder;

        bool isScrolling;
        bool ShowEvent, ShowRecording, ShowText;

        cComplexContent ComplexContent;

        // Content for Widgets
        cComplexContent contentWidget;

        // TextScroller
        cTextScrollers menuItemScroller;

        cString ItemEventLastChannelName;

        std::string RecFolder, LastRecFolder;
        int LastItemRecordingLevel;

        // Icons
        cImage *iconTimerFull;
        cImage *iconTimerPartial;
        cImage *iconArrowTurn;
        cImage *iconRec;
        cImage *iconVps;
        cImage *iconNew;
        // Icons

        void ItemBorderInsertUnique(sDecorBorder ib);
        void ItemBorderDrawAllWithScrollbar(void);
        void ItemBorderDrawAllWithoutScrollbar(void);
        void ItemBorderClear(void);

        static std::string items[16];
        std::string MainMenuText(std::string Text);
        cString GetIconName(std::string element);

        const char * GetRecordingName(const cRecording *Recording, int Level, bool isFolder);
        string xml_substring(string source, const char* str_start, const char* str_end);

        const char* GetGenreIcon(uchar genre);

        time_t GetLastRecTimeFromFolder(const cRecording *Recording, int Level);

        void DrawScrollbar(int Total, int Offset, int Shown, int Top, int Height, bool CanScrollUp, bool CanScrollDown, bool isContent = false);
        int ItemsHeight(void);
        bool CheckProgressBar(const char *text);
        void DrawProgressBarFromText(cRect rec, cRect recBg, const char *bar, tColor ColorFg, tColor ColorBarFg, tColor ColorBg);

        static cBitmap bmCNew, bmCRec, bmCArrowTurn, bmCHD, bmCVPS;
        void DrawItemExtraEvent(const cEvent *Event, cString EmptyText);
        void DrawItemExtraRecording(const cRecording *Recording, cString EmptyText);
        void DrawMainMenuWidgets(void);
        int DrawMainMenuWidgetDVBDevices(int wLeft, int wWidth, int ContentTop);
        int DrawMainMenuWidgetActiveTimers(int wLeft, int wWidth, int ContentTop);
        int DrawMainMenuWidgetLastRecordings(int wLeft, int wWidth, int ContentTop);
        int DrawMainMenuWidgetTimerConflicts(int wLeft, int wWidth, int ContentTop);
        int DrawMainMenuWidgetSystemInformation(int wLeft, int wWidth, int ContentTop);
        int DrawMainMenuWidgetSystemUpdates(int wLeft, int wWidth, int ContentTop);
        int DrawMainMenuWidgetTemperaturs(int wLeft, int wWidth, int ContentTop);
        int DrawMainMenuWidgetCommand(int wLeft, int wWidth, int ContentTop);
        int DrawMainMenuWidgetWeather(int wLeft, int wWidth, int ContentTop);

    public:
        cFlatDisplayMenu(void);
        virtual ~cFlatDisplayMenu();
        virtual void Scroll(bool Up, bool Page);
        virtual int MaxItems(void);
        virtual void Clear(void);

        virtual void SetMenuCategory(eMenuCategory MenuCategory);
        //virtual void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0);

        virtual void SetTitle(const char *Title);
        virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
        virtual void SetMessage(eMessageType Type, const char *Text);
        virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable);

        virtual bool SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch);
        virtual bool SetItemTimer(const cTimer *Timer, int Index, bool Current, bool Selectable);
        virtual bool SetItemChannel(const cChannel *Channel, int Index, bool Current, bool Selectable, bool WithProvider);
        virtual bool SetItemRecording(const cRecording *Recording, int Index, bool Current, bool Selectable, int Level, int Total, int New);

        virtual void SetMenuSortMode(eMenuSortMode MenuSortMode);

        virtual void SetScrollbar(int Total, int Offset);
        virtual void SetEvent(const cEvent *Event);
        virtual void SetRecording(const cRecording *Recording);
        virtual void SetText(const char *Text, bool FixedFont);
        virtual int GetTextAreaWidth(void) const;
        virtual const cFont *GetTextAreaFont(bool FixedFont) const;
        virtual void Flush(void);

        void PreLoadImages(void);
};