void eListboxPythonStringContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
{
- ePtr<gFont> fnt = new gFont("Regular", 20);
+ ePtr<gFont> fnt;
painter.clip(eRect(offset, m_itemsize));
style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);
if (local_style)
{
+ fnt = local_style->m_font;
if (selected)
{
/* if we have a local background color set, use that. */
painter.setForegroundColor(local_style->m_foreground_color);
}
}
+ if (!fnt) fnt = new gFont("Regular", 20);
/* if we have no transparent background */
if (!local_style || !local_style->m_transparent_background)
void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
{
- ePtr<gFont> fnt = new gFont("Regular", 20);
- ePtr<gFont> fnt2 = new gFont("Regular", 16);
+ ePtr<gFont> fnt;
+ ePtr<gFont> fnt2;
eRect itemrect(offset, m_itemsize);
eListboxStyle *local_style = 0;
bool cursorValid = this->cursorValid();
if (local_style)
{
+ fnt = local_style->m_font;
if (selected)
{
/* if we have a local background color set, use that. */
}
}
+ if (fnt)
+ {
+ fnt2 = new gFont(fnt->family, fnt->pointSize - fnt->pointSize/5);
+ }
+ else
+ {
+ fnt = new gFont("Regular", 20);
+ fnt2 = new gFont("Regular", 16);
+ }
+
if (!local_style || !local_style->m_transparent_background)
/* if we have no transparent background */
{
if (PyTuple_Check(item))
{
/* handle left part. get item from tuple, convert to string, display. */
-
text = PyTuple_GET_ITEM(item, 0);
text = PyObject_Str(text); /* creates a new object - old object was borrowed! */
const char *string = (text && PyString_Check(text)) ? PyString_AsString(text) : "<not-a-string>";
int value_alignment_left = !*string;
/* now, handle the value. get 2nd part from tuple*/
- value = PyTuple_GET_ITEM(item, 1);
+ if (PyTuple_Size(item) >= 2) // when no 2nd entry is in tuple this is a non selectable entry without config part
+ value = PyTuple_GET_ITEM(item, 1);
+
if (value)
{
ePyObject args = PyTuple_New(1);
}
}
/* type is borrowed */
- } else
+ } else if (value)
eWarning("eListboxPythonConfigContent: second value of tuple is not a tuple.");
if (value)
Py_DECREF(value);
{
Py_XDECREF(m_buildFunc);
Py_XDECREF(m_selectableFunc);
+ Py_XDECREF(m_template);
}
void eListboxPythonMultiContent::setSelectionClip(eRect &rect, bool update)
if ((icolor & 0xFF000000) == 0xFF000000)
{
int index = icolor & 0xFFFFFF;
- eDebug("[eListboxPythonMultiContent] template color index: %d", index);
+ if (PyTuple_GetItem(data, index) == Py_None)
+ return ePyObject();
return PyTuple_GetItem(data, index);
}
if (ppixmap)
{
ePtr<gPixmap> pixmap;
+ if (PyInt_Check(ppixmap) && data) /* if the pixmap is in fact a number, it refers to the data list */
+ ppixmap = PyTuple_GetItem(data, PyInt_AsLong(ppixmap));
+
if (SwigFromPython(pixmap, ppixmap))
{
eDebug("eListboxPythonMultiContent (Pixmap) get pixmap failed");
void eListboxPythonMultiContent::setTemplate(ePyObject tmplate)
{
+ Py_XDECREF(m_template);
m_template = tmplate;
+ Py_XINCREF(m_template);
}