add support for event progressbar per service in channelselection
[enigma2.git] / lib / service / listboxservice.h
1 #ifndef __lib_service_listboxservice_h
2 #define __lib_service_listboxservice_h
3
4 #include <lib/gdi/gpixmap.h>
5 #include <lib/gui/elistbox.h>
6 #include <lib/service/iservice.h>
7 #include <set>
8
9 class eListboxServiceContent: public virtual iListboxContent
10 {
11         DECLARE_REF(eListboxServiceContent);
12 public:
13         eListboxServiceContent();
14
15         void addService(const eServiceReference &ref, bool beforeCurrent=false);
16         void removeCurrent();
17         void FillFinished();
18
19         void setIgnoreService( const eServiceReference &service );
20         void setRoot(const eServiceReference &ref, bool justSet=false);
21         void getCurrent(eServiceReference &ref);
22         
23         int getNextBeginningWithChar(char c);
24         int getPrevMarkerPos();
25         int getNextMarkerPos();
26         
27                 /* support for marked services */
28         void initMarked();
29         void addMarked(const eServiceReference &ref);
30         void removeMarked(const eServiceReference &ref);
31         int isMarked(const eServiceReference &ref);
32
33                 /* this is NOT thread safe! */
34         void markedQueryStart();
35         int markedQueryNext(eServiceReference &ref);
36
37         int lookupService(const eServiceReference &ref);
38         void setCurrent(const eServiceReference &ref);
39
40         enum {
41                 visModeSimple,
42                 visModeComplex
43         };
44         
45         void setVisualMode(int mode);
46         
47                 /* only in complex mode: */
48         enum {
49                 celServiceNumber,
50                 celMarkerPixmap,
51                 celFolderPixmap,
52                 celServiceEventProgressbar,
53                 celServiceName,
54                 celServiceTypePixmap,
55                 celServiceInfo, // "now" event
56                 celElements
57         };
58
59         enum {
60                 picDVB_S,
61                 picDVB_T,
62                 picDVB_C,
63                 picServiceGroup,
64                 picFolder,
65                 picMarker,
66                 picServiceEventProgressbar,
67                 picElements
68         };
69
70         void setElementPosition(int element, eRect where);
71         void setElementFont(int element, gFont *font);
72         void setPixmap(int type, ePtr<gPixmap> &pic);
73         
74         void sort();
75
76         int setCurrentMarked(bool);
77
78         void setNumberOffset(int offset) { m_numberoffset = offset; }
79         
80         int getItemHeight() { return m_itemheight; }
81         void setItemHeight(int height);
82
83         enum {
84                 markedForeground,
85                 markedForegroundSelected,
86                 markedBackground,
87                 markedBackgroundSelected,
88                 serviceNotAvail,
89                 serviceEventProgressbarColor,
90                 serviceEventProgressbarColorSelected,
91                 serviceEventProgressbarBorderColor,
92                 serviceEventProgressbarBorderColorSelected,
93                 colorElements
94         };
95         
96         void setColor(int color, gRGB &col);
97 protected:
98         void cursorHome();
99         void cursorEnd();
100         int cursorMove(int count=1);
101         int cursorValid();
102         int cursorSet(int n);
103         int cursorGet();
104
105         void cursorSave();
106         void cursorRestore();
107         int size();
108         
109         // void setOutputDevice ? (for allocating colors, ...) .. requires some work, though
110         void setSize(const eSize &size);
111         
112                 /* the following functions always refer to the selected item */
113         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
114         
115         int m_visual_mode;
116                 /* for complex mode */
117         eRect m_element_position[celElements];
118         ePtr<gFont> m_element_font[celElements];
119         ePtr<gPixmap> m_pixmaps[picElements];
120         gRGB m_color[colorElements];
121         bool m_color_set[colorElements];
122 private:
123         typedef std::list<eServiceReference> list;
124         
125         list m_list;
126         list::iterator m_cursor, m_saved_cursor;
127         
128         int m_cursor_number, m_saved_cursor_number;
129         int m_size;
130         
131         eSize m_itemsize;
132         ePtr<iServiceHandler> m_service_center;
133         ePtr<iListableService> m_lst;
134         
135         eServiceReference m_root;
136
137                 /* support for marked services */
138         std::set<eServiceReference> m_marked;
139         std::set<eServiceReference>::const_iterator m_marked_iterator;
140
141                 /* support for movemode */
142         bool m_current_marked;
143
144         int m_numberoffset;
145
146         eServiceReference m_is_playable_ignore;
147
148         int m_itemheight;
149 };
150
151 #endif