Automatic message catalog update
[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(SWIG_PYOBJECT(ePyObject) 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         int getItemHeight() { return m_itemheight; }
43
44 protected:
45         ePyObject m_list;
46         int m_cursor, m_saved_cursor;
47         eSize m_itemsize;
48         int m_itemheight;
49 #endif
50 };
51
52 class eListboxPythonConfigContent: public eListboxPythonStringContent
53 {
54 public:
55         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
56         void setSeperation(int sep) { m_seperation = sep; }
57         int currentCursorSelectable();
58 private:
59         int m_seperation;
60 };
61
62 class eListboxPythonMultiContent: public eListboxPythonStringContent
63 {
64         ePyObject m_buildFunc;
65         ePyObject m_selectableFunc;
66         ePyObject m_template;
67         eRect m_selection_clip;
68         gRegion m_clip, m_old_clip;
69 public:
70         eListboxPythonMultiContent();
71         ~eListboxPythonMultiContent();
72         enum { TYPE_TEXT, TYPE_PROGRESS, TYPE_PIXMAP, TYPE_PIXMAP_ALPHATEST, TYPE_PIXMAP_ALPHABLEND };
73         void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
74         int currentCursorSelectable();
75         void setList(SWIG_PYOBJECT(ePyObject) list);
76         void setFont(int fnt, gFont *font);
77         void setBuildFunc(SWIG_PYOBJECT(ePyObject) func);
78         void setSelectableFunc(SWIG_PYOBJECT(ePyObject) func);
79         void setItemHeight(int height);
80         void setSelectionClip(eRect &rect, bool update=false);
81         void updateClip(gRegion &);
82         void entryRemoved(int idx);
83         void setTemplate(SWIG_PYOBJECT(ePyObject) tmplate);
84 private:
85         std::map<int, ePtr<gFont> > m_font;
86 };
87
88 #ifdef SWIG
89 #define RT_HALIGN_LEFT 0
90 #define RT_HALIGN_RIGHT 1
91 #define RT_HALIGN_CENTER 2
92 #define RT_HALIGN_BLOCK 4
93 #define RT_VALIGN_TOP 0
94 #define RT_VALIGN_CENTER 8
95 #define RT_VALIGN_BOTTOM 16
96 #define RT_WRAP 32
97 #endif // SWIG
98
99 #endif