diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-02-27 20:53:16 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-02-27 20:53:16 +0000 |
| commit | 19e1b120e85f3cf3906c640af47c5084b09dd3be (patch) | |
| tree | b7c9be810b49dd74c398b17903342edd353b4403 /lib | |
| parent | fdac98ca30eff200afaa92b7cd0464186fa8db88 (diff) | |
| download | enigma2-19e1b120e85f3cf3906c640af47c5084b09dd3be.tar.gz enigma2-19e1b120e85f3cf3906c640af47c5084b09dd3be.zip | |
ability to set color in multi content lists
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gui/elistboxcontent.cpp | 34 | ||||
| -rw-r--r-- | lib/python/Components/MultiContent.py | 7 |
2 files changed, 35 insertions, 6 deletions
diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index fdb270f8..cce9b614 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -409,12 +409,12 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c goto error_out; } - PyObject *px = 0, *py = 0, *pwidth = 0, *pheight = 0, *pfnt = 0, *pstring = 0, *pflags = 0; + PyObject *px = 0, *py = 0, *pwidth = 0, *pheight = 0, *pfnt = 0, *pstring = 0, *pflags = 0, *pcolor = 0; /* we have a list of tuples: - (0, x, y, width, height, fnt, flags, "bla" ), + (0, x, y, width, height, fnt, flags, "bla"[, color] ), or, for a progress: (1, x, y, width, height, filled_percent ) @@ -453,6 +453,8 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c pflags = PyTuple_GET_ITEM(item, 6); pstring = PyTuple_GET_ITEM(item, 7); } + if (size > 8) + pcolor = PyTuple_GET_ITEM(item, 8); } switch (type) @@ -461,7 +463,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c { if (!(px && py && pwidth && pheight && pfnt && pstring)) { - eDebug("eListboxPythonMultiContent received too small tuple (must be (TYPE_TEXT, x, y, width, height, fnt, flags, string[, ...])"); + eDebug("eListboxPythonMultiContent received too small tuple (must be (TYPE_TEXT, x, y, width, height, fnt, flags, string, [color, ]...])"); goto error_out; } @@ -473,6 +475,12 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c int flags = PyInt_AsLong(pflags); int fnt = PyInt_AsLong(pfnt); + if (pcolor) + { + int color = PyInt_AsLong(pcolor); + painter.setForegroundColor(gRGB(color)); + } + if (m_font.find(fnt) == m_font.end()) { eDebug("eListboxPythonMultiContent: specified font %d was not found!", fnt); @@ -569,6 +577,9 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c eWarning("eListboxPythonMultiContent received unknown type (%d)", type); goto error_out; } + + if (pcolor) + style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal); } } @@ -581,7 +592,22 @@ error_out: int eListboxPythonMultiContent::currentCursorSelectable() { - return eListboxPythonStringContent::currentCursorSelectable(); + if (m_list && cursorValid()) + { + PyObject *item = PyList_GET_ITEM(m_list, m_cursor); + + if (PyList_Check(item)) + { + item = PyList_GET_ITEM(item, 0); + if (PyTuple_Check(item)) + { + item = PyTuple_GET_ITEM(item, 0); + if (item != Py_None) + return 1; + } + } + } + return 0; } void eListboxPythonMultiContent::setFont(int fnt, gFont *font) diff --git a/lib/python/Components/MultiContent.py b/lib/python/Components/MultiContent.py index dab096d3..691152b4 100644 --- a/lib/python/Components/MultiContent.py +++ b/lib/python/Components/MultiContent.py @@ -11,8 +11,11 @@ RT_WRAP = 32 from enigma import eListboxPythonMultiContent -def MultiContentEntryText(pos = (0, 0), size = (0, 0), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP, text = ""): - return (eListboxPythonMultiContent.TYPE_TEXT, pos[0], pos[1], size[0], size[1], font, flags, text) +def MultiContentEntryText(pos = (0, 0), size = (0, 0), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP, text = "", color = None): + add = () + if color is not None: + add = (color, ) + return (eListboxPythonMultiContent.TYPE_TEXT, pos[0], pos[1], size[0], size[1], font, flags, text) + add def MultiContentEntryPixmap(pos = (0, 0), size = (0, 0), png = None): return (eListboxPythonMultiContent.TYPE_PIXMAP, pos[0], pos[1], size[0], size[1], png) |
