add position gauge
[enigma2.git] / lib / gui / elistboxcontent.h
1 #ifndef __lib_gui_elistboxcontent_h
2 #define __lib_gui_elistboxcontent_h
3
4 #include <lib/python/python.h>
5 #include <lib/gui/elistbox.h>
6
7 class eListboxTestContent: public virtual iListboxContent
8 {
9         DECLARE_REF(eListboxTestContent);
10 public:
11
12 #ifndef SWIG
13 protected:
14         void cursorHome();
15         void cursorEnd();
16         int cursorMove(int count=1);
17         int cursorValid();
18         int cursorSet(int n);
19         int cursorGet();
20         
21         void cursorSave();
22         void cursorRestore();
23         int size();
24         
25         RESULT connectItemChanged(const Slot0<void> &itemChanged, ePtr<eConnection> &connection);
26         
27         // void setOutputDevice ? (for allocating colors, ...) .. requires some work, though
28         void setSize(const eSize &size);
29         
30                 /* the following functions always refer to the selected item */
31         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
32 private:
33         int m_cursor, m_saved_cursor;
34         eSize m_size;
35 #endif
36 };
37
38 class eListboxStringContent: public virtual iListboxContent
39 {
40         DECLARE_REF(eListboxStringContent);
41 public:
42         eListboxStringContent();
43         void setList(std::list<std::string> &list);
44 #ifndef SWI
45 protected:
46         
47         void cursorHome();
48         void cursorEnd();
49         int cursorMove(int count=1);
50         int cursorValid();
51         int cursorSet(int n);
52         int cursorGet();
53         
54         void cursorSave();
55         void cursorRestore();
56         int size();
57         
58         // void setOutputDevice ? (for allocating colors, ...) .. requires some work, though
59         void setSize(const eSize &size);
60         
61                 /* the following functions always refer to the selected item */
62         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
63 private:
64         typedef std::list<std::string> list;
65         
66         list m_list;
67         list::iterator m_cursor, m_saved_cursor;
68         
69         int m_cursor_number, m_saved_cursor_number;
70         int m_size;
71         
72         eSize m_itemsize;
73 #endif
74 };
75
76 class eListboxPythonStringContent: public virtual iListboxContent
77 {
78         DECLARE_REF(eListboxPythonStringContent);
79 public:
80         eListboxPythonStringContent();
81         ~eListboxPythonStringContent();
82
83         void setList(PyObject *list);
84         PyObject *getCurrentSelection();
85         int getCurrentSelectionIndex() { return m_cursor; }
86         void invalidateEntry(int index);
87         void invalidate();
88         eSize getItemSize() { return m_itemsize; }
89 #ifndef SWIG
90 protected:
91         void cursorHome();
92         void cursorEnd();
93         int cursorMove(int count=1);
94         int cursorValid();
95         int cursorSet(int n);
96         int cursorGet();
97         
98         void cursorSave();
99         void cursorRestore();
100         int size();
101         
102         RESULT connectItemChanged(const Slot0<void> &itemChanged, ePtr<eConnection> &connection);
103         
104         // void setOutputDevice ? (for allocating colors, ...) .. requires some work, though
105         void setSize(const eSize &size);
106         
107                 /* the following functions always refer to the selected item */
108         virtual void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
109
110 protected:
111         PyObject *m_list;
112         int m_cursor, m_saved_cursor;
113         eSize m_itemsize;
114 #endif
115 };
116
117 class eListboxPythonConfigContent: public eListboxPythonStringContent
118 {
119 public:
120         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
121         void setSeperation(int sep) { m_seperation = sep; }
122 private:
123         int m_seperation;
124 };
125
126 class eListboxPythonMultiContent: public eListboxPythonStringContent
127 {
128 public:
129         enum { TYPE_TEXT, TYPE_PROGRESS, TYPE_PIXMAP, TYPE_PIXMAP_ALPHATEST };
130         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
131         
132         void setFont(int fnt, gFont *fnt);
133 private:
134         std::map<int, ePtr<gFont> > m_font;
135 };
136
137 #endif