if (m_listbox)
local_style = m_listbox->getLocalStyle();
- /* if we have a local background color set, use that. */
- if (local_style && local_style->m_background_color_set)
- painter.setBackgroundColor(local_style->m_background_color);
-
- /* same for foreground */
- if (local_style && local_style->m_foreground_color_set)
- painter.setForegroundColor(local_style->m_foreground_color);
+ if (local_style)
+ {
+ if (selected)
+ {
+ /* if we have a local background color set, use that. */
+ if (local_style->m_background_color_selected_set)
+ painter.setBackgroundColor(local_style->m_background_color_selected);
+ /* same for foreground */
+ if (local_style->m_foreground_color_selected_set)
+ painter.setForegroundColor(local_style->m_foreground_color_selected);
+ }
+ else
+ {
+ /* if we have a local background color set, use that. */
+ if (local_style->m_background_color_set)
+ painter.setBackgroundColor(local_style->m_background_color);
+ /* same for foreground */
+ if (local_style->m_foreground_color_set)
+ painter.setForegroundColor(local_style->m_foreground_color);
+ }
+ }
- /* if we have no transparent background */
+ /* if we have no transparent background */
if (!local_style || !local_style->m_transparent_background)
{
/* blit background picture, if available (otherwise, clear only) */
if (m_listbox)
local_style = m_listbox->getLocalStyle();
- /* if we have a local background color set, use that. */
- if (local_style && local_style->m_background_color_set)
- painter.setBackgroundColor(local_style->m_background_color);
-
- /* same for foreground */
- if (local_style && local_style->m_foreground_color_set)
- painter.setForegroundColor(local_style->m_foreground_color);
+ if (local_style)
+ {
+ if (selected)
+ {
+ /* if we have a local background color set, use that. */
+ if (local_style->m_background_color_selected_set)
+ painter.setBackgroundColor(local_style->m_background_color_selected);
+ /* same for foreground */
+ if (local_style->m_foreground_color_selected_set)
+ painter.setForegroundColor(local_style->m_foreground_color_selected);
+ }
+ else
+ {
+ /* if we have a local background color set, use that. */
+ if (local_style->m_background_color_set)
+ painter.setBackgroundColor(local_style->m_background_color);
+ /* same for foreground */
+ if (local_style->m_foreground_color_set)
+ painter.setForegroundColor(local_style->m_foreground_color);
+ }
+ }
if (!local_style || !local_style->m_transparent_background)
/* if we have no transparent background */
m_listbox->entryChanged(m_cursor);
}
-static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *local_style, ePyObject pforeColor, ePyObject pbackColor, ePyObject pbackColorSelected, int selected, gRegion &rc, eRect &sel_clip)
+static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *local_style, ePyObject pforeColor, ePyObject pforeColorSelected, ePyObject pbackColor, ePyObject pbackColorSelected, int selected, gRegion &rc, eRect &sel_clip)
{
if (selected && sel_clip.valid())
{
int color = PyInt_AsLong(pbackColorSelected);
painter.setBackgroundColor(gRGB(color));
}
+ else if (local_style && local_style->m_background_color_selected_set)
+ painter.setBackgroundColor(local_style->m_background_color_selected);
painter.clear();
painter.clippop();
}
int color = PyInt_AsLong(pbackColorSelected);
painter.setBackgroundColor(gRGB(color));
}
+ else if (local_style && local_style->m_background_color_selected_set)
+ painter.setBackgroundColor(local_style->m_background_color_selected);
painter.clear();
}
else
painter.clear();
}
}
- if (pforeColor)
+ if (selected)
{
- int color = PyInt_AsLong(pforeColor);
- painter.setForegroundColor(gRGB(color));
- }/* if we have a local foreground color set, use that. */
- else if (local_style && local_style->m_foreground_color_set)
- painter.setForegroundColor(local_style->m_foreground_color);
+ if (pforeColorSelected)
+ {
+ int color = PyInt_AsLong(pforeColor);
+ painter.setForegroundColor(gRGB(color));
+ }
+ /* if we have a local foreground color set, use that. */
+ else if (local_style && local_style->m_foreground_color_selected_set)
+ painter.setForegroundColor(local_style->m_foreground_color_selected);
+ }
+ else
+ {
+ if (pforeColor)
+ {
+ int color = PyInt_AsLong(pforeColor);
+ painter.setForegroundColor(gRGB(color));
+ }
+ /* if we have a local foreground color set, use that. */
+ else if (local_style && local_style->m_foreground_color_set)
+ painter.setForegroundColor(local_style->m_foreground_color);
+ }
}
void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
painter.clip(itemregion);
- clearRegion(painter, style, local_style, ePyObject(), ePyObject(), ePyObject(), selected, itemregion, sel_clip);
+ clearRegion(painter, style, local_style, ePyObject(), ePyObject(), ePyObject(), ePyObject(), selected, itemregion, sel_clip);
ePyObject items;
case TYPE_TEXT: // text
{
/*
- (0, x, y, width, height, fnt, flags, "bla" [, color, backColor, backColorSelected, borderWidth, borderColor] )
+ (0, x, y, width, height, fnt, flags, "bla" [, color, colorSelected, backColor, backColorSelected, borderWidth, borderColor] )
*/
ePyObject px = PyTuple_GET_ITEM(item, 1),
py = PyTuple_GET_ITEM(item, 2),
pfnt = PyTuple_GET_ITEM(item, 5),
pflags = PyTuple_GET_ITEM(item, 6),
pstring = PyTuple_GET_ITEM(item, 7),
- pforeColor, pbackColor, pbackColorSelected, pborderWidth, pborderColor;
+ pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, pborderWidth, pborderColor;
if (!(px && py && pwidth && pheight && pfnt && pflags && pstring))
{
}
if (size > 9)
{
- pbackColor = PyTuple_GET_ITEM(item, 9);
+ pforeColorSelected = PyTuple_GET_ITEM(item, 9);
+ if (pforeColorSelected == Py_None)
+ pforeColorSelected=ePyObject();
+ }
+ if (size > 10)
+ {
+ pbackColor = PyTuple_GET_ITEM(item, 10);
if (pbackColor == Py_None)
pbackColor=ePyObject();
}
- if (size > 10)
+ if (size > 11)
{
- pbackColorSelected = PyTuple_GET_ITEM(item, 10);
+ pbackColorSelected = PyTuple_GET_ITEM(item, 11);
if (pbackColorSelected == Py_None)
pbackColorSelected=ePyObject();
}
- if (size > 11)
- pborderWidth = PyTuple_GET_ITEM(item, 11);
if (size > 12)
- pborderColor = PyTuple_GET_ITEM(item, 12);
+ {
+ pborderWidth = PyTuple_GET_ITEM(item, 12);
+ if (pborderWidth == Py_None)
+ pborderWidth=ePyObject();
+ }
+ if (size > 13)
+ {
+ pborderColor = PyTuple_GET_ITEM(item, 13);
+ if (pborderColor == Py_None)
+ pborderColor=ePyObject();
+ }
const char *string = (PyString_Check(pstring)) ? PyString_AsString(pstring) : "<not-a-string>";
int x = PyInt_AsLong(px) + offset.x();
eRect rect(x+bwidth, y+bwidth, width-bwidth*2, height-bwidth*2);
painter.clip(rect);
- if (pbackColor || pbackColorSelected || pforeColor)
+ if (pbackColor || pbackColorSelected || pforeColor || pforeColorSelected)
{
gRegion rc(rect);
- clearRegion(painter, style, local_style, pforeColor, pbackColor, pbackColorSelected, selected, rc, sel_clip);
+ clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip);
reset_colors=true;
}
pwidth = PyTuple_GET_ITEM(item, 3),
pheight = PyTuple_GET_ITEM(item, 4),
pfilled_perc = PyTuple_GET_ITEM(item, 5),
- pborderWidth, pforeColor, pbackColor, pbackColorSelected;
+ pborderWidth, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected;
if (!(px && py && pwidth && pheight && pfilled_perc))
{
}
if (size > 6)
+ {
pborderWidth = PyTuple_GET_ITEM(item, 6);
+ if (pborderWidth == Py_None)
+ pborderWidth = ePyObject();
+ }
if (size > 7)
+ {
pforeColor = PyTuple_GET_ITEM(item, 7);
+ if (pforeColor == Py_None)
+ pforeColor = ePyObject();
+ }
if (size > 8)
{
- pbackColor = PyTuple_GET_ITEM(item, 8);
+ pforeColorSelected = PyTuple_GET_ITEM(item, 8);
+ if (pforeColorSelected == Py_None)
+ pforeColorSelected=ePyObject();
+ }
+ if (size > 9)
+ {
+ pbackColor = PyTuple_GET_ITEM(item, 9);
if (pbackColor == Py_None)
pbackColor=ePyObject();
}
- if (size > 9)
+ if (size > 10)
{
- pbackColorSelected = PyTuple_GET_ITEM(item, 9);
+ pbackColorSelected = PyTuple_GET_ITEM(item, 10);
if (pbackColorSelected == Py_None)
pbackColorSelected=ePyObject();
}
eRect rect(x, y, width, height);
painter.clip(rect);
- if (pbackColor || pbackColorSelected || pforeColor)
+ if (pbackColor || pbackColorSelected || pforeColor || pforeColorSelected)
{
gRegion rc(rect);
- clearRegion(painter, style, local_style, pforeColor, pbackColor, pbackColorSelected, selected, rc, sel_clip);
+ clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip);
reset_colors=true;
}
if (pbackColor || pbackColorSelected)
{
gRegion rc(rect);
- clearRegion(painter, style, local_style, ePyObject(), pbackColor, pbackColorSelected, selected, rc, sel_clip);
+ clearRegion(painter, style, local_style, ePyObject(), ePyObject(), pbackColor, pbackColorSelected, selected, rc, sel_clip);
reset_colors=true;
}
from enigma import eListboxPythonMultiContent, RT_HALIGN_LEFT, RT_VALIGN_TOP
-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 MultiContentEntryText(pos = (0, 0), size = (0, 0), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP, text = "", color = None, color_sel = None, backcolor = None, backcolor_sel = None, border_width = None, border_color = None):
+ return (eListboxPythonMultiContent.TYPE_TEXT, pos[0], pos[1], size[0], size[1], font, flags, text, color, color_sel, backcolor, backcolor_sel, border_width, border_color)
-def MultiContentEntryPixmap(pos = (0, 0), size = (0, 0), png = None):
- return (eListboxPythonMultiContent.TYPE_PIXMAP, pos[0], pos[1], size[0], size[1], png)
+def MultiContentEntryPixmap(pos = (0, 0), size = (0, 0), png = None, backcolor = None, backcolor_sel = None):
+ return (eListboxPythonMultiContent.TYPE_PIXMAP, pos[0], pos[1], size[0], size[1], png, backcolor, backcolor_sel)
-def MultiContentEntryPixmapAlphaTest(pos = (0, 0), size = (0, 0), png = None):
- return (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, pos[0], pos[1], size[0], size[1], png)
-
-
\ No newline at end of file
+def MultiContentEntryPixmapAlphaTest(pos = (0, 0), size = (0, 0), png = None, backcolor = None, backcolor_sel = None):
+ return (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, pos[0], pos[1], size[0], size[1], png, backcolor, backcolor_sel)
from Components.EpgList import Rect
from Components.Sources.Event import Event
from Components.Sources.Source import ObsoleteSource
+from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
from Screens.Screen import Screen
from Screens.EventView import EventViewSimple
from Screens.TimeDateInput import TimeDateInput
from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
from RecordTimer import RecordTimerEntry, parseEvent
from ServiceReference import ServiceReference
-from enigma import eEPGCache, eListbox, eListboxPythonMultiContent, gFont, loadPNG, \
+from enigma import eEPGCache, eListbox, gFont, loadPNG, eListboxPythonMultiContent, \
RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, eRect, eTimer
from time import localtime, time, strftime
self.event_rect = None
self.foreColor = None
+ self.foreColorSelected = None
self.borderColor = None
self.backColor = 0x586d88
self.backColorSelected = 0x808080
for (attrib, value) in self.skinAttributes:
if attrib == "EntryForegroundColor":
self.foreColor = parseColor(value).argb()
+ elif attrib == "EntryForegroundColorSelected":
+ self.foreColorSelected = parseColor(value).argb()
elif attrib == "EntryBorderColor":
self.borderColor = parseColor(value).argb()
elif attrib == "EntryBackgroundColor":
def buildEntry(self, service, service_name, events):
r1=self.service_rect
r2=self.event_rect
- res = [ None ] # no private data needed
- res.append((eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, service_name))
+ res = [ None, MultiContentEntryText(pos = (r1.left(),r1.top()), size = (r1.width(), r1.height()), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER, text = service_name) ]
if events:
start = self.time_base+self.offs*self.time_epoch*60
width = r2.width()
height = r2.height()
foreColor = self.foreColor
+ foreColorSelected = self.foreColorSelected
backColor = self.backColor
backColorSelected = self.backColorSelected
borderColor = self.borderColor
for ev in events: #(event_id, event_title, begin_time, duration)
rec=self.timer.isInTimer(ev[0], ev[2], ev[3], service) > ((ev[3]/10)*8)
xpos, ewidth = self.calcEntryPosAndWidthHelper(ev[2], ev[3], start, end, width)
- if self.borderColor is None:
- res.append((eListboxPythonMultiContent.TYPE_TEXT, left+xpos, top, ewidth, height, 1, RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, ev[1], foreColor, backColor, backColorSelected, 1))
- else:
- res.append((eListboxPythonMultiContent.TYPE_TEXT, left+xpos, top, ewidth, height, 1, RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, ev[1], foreColor, backColor, backColorSelected, 1, borderColor))
+ res.append(MultiContentEntryText(pos = (left+xpos, top), size = (ewidth, height), font = 1, flags = RT_HALIGN_CENTER | RT_VALIGN_CENTER | RT_WRAP, text = ev[1], color = foreColor, color_sel = foreColorSelected, backcolor = backColor, backcolor_sel = backColorSelected, border_width = 1, border_color = borderColor))
if rec and ewidth > 23:
- res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, left+xpos+ewidth-22, top+height-22, 21, 21, self.clock_pixmap, backColor, backColorSelected))
+ res.append(MultiContentEntryPixmapAlphaTest(pos = (left+xpos+ewidth-22, top+height-22), size = (21, 21), png = self.clock_pixmap, backcolor = backColor, backcolor_selected = backColorSelected))
return res
def selEntry(self, dir, visible=True):