support for renderer
[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 eListboxPythonStringContent: public virtual iListboxContent
8 {
9         DECLARE_REF(eListboxPythonStringContent);
10 public:
11         eListboxPythonStringContent();
12         ~eListboxPythonStringContent();
13
14         void setList(PyObject *list);
15         PyObject *getCurrentSelection();
16         int getCurrentSelectionIndex() { return m_cursor; }
17         void invalidateEntry(int index);
18         void invalidate();
19         eSize getItemSize() { return m_itemsize; }
20 #ifndef SWIG
21 protected:
22         void cursorHome();
23         void cursorEnd();
24         int cursorMove(int count=1);
25         int cursorValid();
26         int cursorSet(int n);
27         int cursorGet();
28         virtual int currentCursorSelectable();
29                 
30         void cursorSave();
31         void cursorRestore();
32         int size();
33         
34         RESULT connectItemChanged(const Slot0<void> &itemChanged, ePtr<eConnection> &connection);
35         
36         // void setOutputDevice ? (for allocating colors, ...) .. requires some work, though
37         void setSize(const eSize &size);
38         
39                 /* the following functions always refer to the selected item */
40         virtual void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
41
42 protected:
43         PyObject *m_list;
44         int m_cursor, m_saved_cursor;
45         eSize m_itemsize;
46 #endif
47 };
48
49 class eListboxPythonConfigContent: public eListboxPythonStringContent
50 {
51 public:
52         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
53         void setSeperation(int sep) { m_seperation = sep; }
54         int currentCursorSelectable();
55 private:
56         int m_seperation;
57 };
58
59 class eListboxPythonMultiContent: public eListboxPythonStringContent
60 {
61         PyObject *m_buildFunc;
62 public:
63         eListboxPythonMultiContent();
64         ~eListboxPythonMultiContent();
65         enum { TYPE_TEXT, TYPE_PROGRESS, TYPE_PIXMAP, TYPE_PIXMAP_ALPHATEST };
66         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
67         int currentCursorSelectable();
68         
69         void setFont(int fnt, gFont *fnt);
70         void setBuildFunc(PyObject *func);
71 private:
72         std::map<int, ePtr<gFont> > m_font;
73 };
74
75 #endif