add 'templates' in listboxcontent, to split the layout from actual data content
[enigma2.git] / lib / gui / elistboxcontent.h
index 6219cec6b59c1eea5cfeebb5e515c285cab1629d..646990138fbead63b49aeb4ab9ab835a4c46d6ba 100644 (file)
@@ -2,18 +2,31 @@
 #define __lib_gui_elistboxcontent_h
 
 #include <lib/python/python.h>
+#include <lib/gui/elistbox.h>
 
-class eListboxTestContent: public virtual iListboxContent
+class eListboxPythonStringContent: public virtual iListboxContent
 {
-       DECLARE_REF;
+       DECLARE_REF(eListboxPythonStringContent);
 public:
+       eListboxPythonStringContent();
+       ~eListboxPythonStringContent();
+
+       void setList(SWIG_PYOBJECT(ePyObject) list);
+       PyObject *getCurrentSelection();
+       int getCurrentSelectionIndex() { return m_cursor; }
+       void invalidateEntry(int index);
+       void invalidate();
+       eSize getItemSize() { return m_itemsize; }
+#ifndef SWIG
+protected:
        void cursorHome();
        void cursorEnd();
        int cursorMove(int count=1);
        int cursorValid();
        int cursorSet(int n);
        int cursorGet();
-       
+       virtual int currentCursorSelectable();
+               
        void cursorSave();
        void cursorRestore();
        int size();
@@ -24,83 +37,63 @@ public:
        void setSize(const eSize &size);
        
                /* the following functions always refer to the selected item */
-       void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
-private:
+       virtual void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
+       
+       int getItemHeight() { return m_itemheight; }
+
+protected:
+       ePyObject m_list;
        int m_cursor, m_saved_cursor;
-       eSize m_size;
+       eSize m_itemsize;
+       int m_itemheight;
+#endif
 };
 
-class eListboxStringContent: public virtual iListboxContent
+class eListboxPythonConfigContent: public eListboxPythonStringContent
 {
-       DECLARE_REF;
 public:
-       eListboxStringContent();
-       
-       void cursorHome();
-       void cursorEnd();
-       int cursorMove(int count=1);
-       int cursorValid();
-       int cursorSet(int n);
-       int cursorGet();
-       
-       void cursorSave();
-       void cursorRestore();
-       int size();
-       
-       RESULT connectItemChanged(const Slot0<void> &itemChanged, ePtr<eConnection> &connection);
-       
-       // void setOutputDevice ? (for allocating colors, ...) .. requires some work, though
-       void setSize(const eSize &size);
-       
-               /* the following functions always refer to the selected item */
        void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
-       
-       void setList(std::list<std::string> &list);
+       void setSeperation(int sep) { m_seperation = sep; }
+       int currentCursorSelectable();
 private:
-       typedef std::list<std::string> list;
-       
-       list m_list;
-       list::iterator m_cursor, m_saved_cursor;
-       
-       int m_cursor_number, m_saved_cursor_number;
-       int m_size;
-       
-       eSize m_itemsize;
+       int m_seperation;
 };
 
-class eListboxPythonStringContent: public virtual iListboxContent
+class eListboxPythonMultiContent: public eListboxPythonStringContent
 {
-       DECLARE_REF;
+       ePyObject m_buildFunc;
+       ePyObject m_selectableFunc;
+       ePyObject m_template;
+       eRect m_selection_clip;
+       gRegion m_clip, m_old_clip;
 public:
-       eListboxPythonStringContent();
-       ~eListboxPythonStringContent();
-       void cursorHome();
-       void cursorEnd();
-       int cursorMove(int count=1);
-       int cursorValid();
-       int cursorSet(int n);
-       int cursorGet();
-       
-       void cursorSave();
-       void cursorRestore();
-       int size();
-       
-       RESULT connectItemChanged(const Slot0<void> &itemChanged, ePtr<eConnection> &connection);
-       
-       // void setOutputDevice ? (for allocating colors, ...) .. requires some work, though
-       void setSize(const eSize &size);
-       
-               /* the following functions always refer to the selected item */
+       eListboxPythonMultiContent();
+       ~eListboxPythonMultiContent();
+       enum { TYPE_TEXT, TYPE_PROGRESS, TYPE_PIXMAP, TYPE_PIXMAP_ALPHATEST };
        void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
-       
-       void setList(PyObject *list);
-       
-       PyObject *getCurrentSelection();
-       
+       int currentCursorSelectable();
+       void setList(SWIG_PYOBJECT(ePyObject) list);
+       void setFont(int fnt, gFont *fnt);
+       void setBuildFunc(SWIG_PYOBJECT(ePyObject) func);
+       void setSelectableFunc(SWIG_PYOBJECT(ePyObject) func);
+       void setItemHeight(int height);
+       void setSelectionClip(eRect &rect, bool update=false);
+       void updateClip(gRegion &);
+       void entryRemoved(int idx);
+       void setTemplate(SWIG_PYOBJECT(ePyObject) tmplate);
 private:
-       PyObject *m_list;
-       int m_cursor, m_saved_cursor;
-       eSize m_itemsize;
+       std::map<int, ePtr<gFont> > m_font;
 };
 
+#ifdef SWIG
+#define RT_HALIGN_LEFT 0
+#define RT_HALIGN_RIGHT 1
+#define RT_HALIGN_CENTER 2
+#define RT_HALIGN_BLOCK 4
+#define RT_VALIGN_TOP 0
+#define RT_VALIGN_CENTER 8
+#define RT_VALIGN_BOTTOM 16
+#define RT_WRAP 32
+#endif // SWIG
+
 #endif