add comment for python-lists
[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 #ifndef SWIG
89 protected:
90         void cursorHome();
91         void cursorEnd();
92         int cursorMove(int count=1);
93         int cursorValid();
94         int cursorSet(int n);
95         int cursorGet();
96         
97         void cursorSave();
98         void cursorRestore();
99         int size();
100         
101         RESULT connectItemChanged(const Slot0<void> &itemChanged, ePtr<eConnection> &connection);
102         
103         // void setOutputDevice ? (for allocating colors, ...) .. requires some work, though
104         void setSize(const eSize &size);
105         
106                 /* the following functions always refer to the selected item */
107         virtual void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
108
109 protected:
110         PyObject *m_list;
111         int m_cursor, m_saved_cursor;
112         eSize m_itemsize;
113 #endif
114 };
115
116 class eListboxPythonConfigContent: public eListboxPythonStringContent
117 {
118 public:
119         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
120         void setSeperation(int sep) { m_seperation = sep; }
121 private:
122         int m_seperation;
123 };
124
125 class eListboxPythonMultiContent: public eListboxPythonStringContent
126 {
127 public:
128         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
129         
130         void setFont(int fnt, gFont *fnt);
131 private:
132         std::map<int, ePtr<gFont> > m_font;
133 };
134
135 #endif