aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2007-08-20 22:20:22 +0000
committerFelix Domke <tmbinc@elitedvb.net>2007-08-20 22:20:22 +0000
commit7e6f15005ac50206ace23e1d3496e8c6550c14f5 (patch)
tree5dc9dc239159f78b816f74581fcc994302394799
parent98b0d9a3feea2b97671a232ea6efdf65ed0bf969 (diff)
downloadenigma2-7e6f15005ac50206ace23e1d3496e8c6550c14f5.tar.gz
enigma2-7e6f15005ac50206ace23e1d3496e8c6550c14f5.zip
make local listbox styles working for text lists
-rw-r--r--lib/gui/elistbox.cpp5
-rw-r--r--lib/gui/elistbox.h4
-rw-r--r--lib/gui/elistboxcontent.cpp42
-rw-r--r--skin.py11
4 files changed, 49 insertions, 13 deletions
diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp
index c3b202cb..b7b1e3ff 100644
--- a/lib/gui/elistbox.cpp
+++ b/lib/gui/elistbox.cpp
@@ -8,6 +8,7 @@ eListbox::eListbox(eWidget *parent) :
m_content_changed(false), m_enabled_wrap_around(false), m_top(0), m_selected(0), m_itemheight(25),
m_items_per_page(0), m_selection_enabled(1), m_scrollbar(NULL)
{
+ memset(&m_style, 0, sizeof(m_style));
// setContent(new eListboxStringContent());
ePtr<eActionMap> ptr;
@@ -484,12 +485,12 @@ void eListbox::setForegroundColor(gRGB &col)
m_style.m_foreground_color_set = 1;
}
-void eListbox::setBackgroundPicture(gPixmap *pm)
+void eListbox::setBackgroundPicture(ePtr<gPixmap> &pm)
{
m_style.m_background = pm;
}
-void eListbox::setSelectionPicture(gPixmap *pm)
+void eListbox::setSelectionPicture(ePtr<gPixmap> &pm)
{
m_style.m_selection = pm;
}
diff --git a/lib/gui/elistbox.h b/lib/gui/elistbox.h
index ace41898..1cadf74b 100644
--- a/lib/gui/elistbox.h
+++ b/lib/gui/elistbox.h
@@ -120,8 +120,8 @@ public:
void setBackgroundColor(gRGB &col);
void setForegroundColor(gRGB &col);
- void setBackgroundPicture(gPixmap *pm);
- void setSelectionPicture(gPixmap *pm);
+ void setBackgroundPicture(ePtr<gPixmap> &pixmap);
+ void setSelectionPicture(ePtr<gPixmap> &pixmap);
struct eListboxStyle *getLocalStyle(void);
#ifndef SWIG
diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp
index b397ddca..0378aefc 100644
--- a/lib/gui/elistboxcontent.cpp
+++ b/lib/gui/elistboxcontent.cpp
@@ -140,7 +140,34 @@ void eListboxPythonStringContent::paint(gPainter &painter, eWindowStyle &style,
ePtr<gFont> fnt = new gFont("Regular", 20);
painter.clip(eRect(offset, m_itemsize));
style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);
- painter.clear();
+
+ eListboxStyle *local_style = 0;
+
+ /* get local listbox style, if present */
+ 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.setBackgroundColor(local_style->m_foreground_color);
+
+ /* if we have no transparent background */
+ if (!local_style || !local_style->m_transparent_background)
+ {
+ /* blit background picture, if available (otherwise, clear only) */
+ if (local_style && local_style->m_background)
+ painter.blit(local_style->m_background, offset, eRect(), 0);
+ else
+ painter.clear();
+ } else
+ {
+ if (local_style && local_style->m_background)
+ painter.blit(local_style->m_background, offset, eRect(), gPainter::BT_ALPHATEST);
+ }
if (m_list && cursorValid())
{
@@ -155,11 +182,14 @@ void eListboxPythonStringContent::paint(gPainter &painter, eWindowStyle &style,
gray = 1;
item = PyTuple_GET_ITEM(item, 0);
}
-
+
+ if (selected && local_style && local_style->m_selection)
+ painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST);
+
if (item == Py_None)
{
+ /* seperator */
int half_height = m_itemsize.height() / 2;
-
painter.fill(eRect(offset.x() + half_height, offset.y() + half_height - 2, m_itemsize.width() - m_itemsize.height(), 4));
} else
{
@@ -169,11 +199,11 @@ void eListboxPythonStringContent::paint(gPainter &painter, eWindowStyle &style,
painter.setForegroundColor(gRGB(0x808080));
painter.renderText(eRect(text_offset, m_itemsize), string);
}
-
- if (selected)
+
+ if (selected && (!local_style || !local_style->m_selection))
style.drawFrame(painter, eRect(offset, m_itemsize), eWindowStyle::frameListboxEntry);
}
-
+
painter.clippop();
}
diff --git a/skin.py b/skin.py
index 07213915..3b448127 100644
--- a/skin.py
+++ b/skin.py
@@ -88,7 +88,7 @@ def collectAttributes(skinAttributes, node, skin_path_prefix=None, ignore=[]):
# TODO: localization? as in e1?
value = a.value.encode("utf-8")
- if attrib in ["pixmap", "pointer", "seek_pointer"]:
+ if attrib in ["pixmap", "pointer", "seek_pointer", "backgroundPixmap", "selectionPixmap"]:
value = resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix)
if attrib not in ignore:
@@ -115,10 +115,15 @@ def applySingleAttribute(guiObject, desktop, attrib, value):
guiObject.setFont(parseFont(value))
elif attrib == 'zPosition':
guiObject.setZPosition(int(value))
- elif attrib == "pixmap":
+ elif attrib in ["pixmap", "backgroundPixmap", "selectionPixmap"]:
ptr = loadPixmap(value) # this should already have been filename-resolved.
desktop.makeCompatiblePixmap(ptr)
- guiObject.setPixmap(ptr)
+ if attrib == "pixmap":
+ guiObject.setPixmap(ptr)
+ elif attrib == "backgroundPixmap":
+ guiObject.setBackgroundPicture(ptr)
+ elif attrib == "selectionPixmap":
+ guiObject.setSelectionPicture(ptr)
# guiObject.setPixmapFromFile(value)
elif attrib == "alphatest": # used by ePixmap
guiObject.setAlphatest(