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;
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;
}
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
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())
{
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
{
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();
}
# 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:
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(