+ /*
+ (1, x, y, width, height, filled_percent [, borderWidth, foreColor, backColor, backColorSelected] )
+ */
+ ePyObject px = PyTuple_GET_ITEM(item, 1),
+ py = PyTuple_GET_ITEM(item, 2),
+ pwidth = PyTuple_GET_ITEM(item, 3),
+ pheight = PyTuple_GET_ITEM(item, 4),
+ pfilled_perc = PyTuple_GET_ITEM(item, 5),
+ ppixmap, pborderWidth, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected;
+ int idx = 6;
+ if (type == TYPE_PROGRESS)
+ {
+ if (!(px && py && pwidth && pheight && pfilled_perc))
+ {
+ eDebug("eListboxPythonMultiContent received too small tuple (must be (TYPE_PROGRESS, x, y, width, height, filled percent [,border width, foreColor, backColor, backColorSelected]))");
+ goto error_out;
+ }
+ }
+ else
+ {
+ ppixmap = PyTuple_GET_ITEM(item, idx++);
+ if (ppixmap == Py_None)
+ continue;
+ if (!(px && py && pwidth && pheight && pfilled_perc, ppixmap))
+ {
+ eDebug("eListboxPythonMultiContent received too small tuple (must be (TYPE_PROGRESS_PIXMAP, x, y, width, height, filled percent, pixmap, [,border width, foreColor, backColor, backColorSelected]))");
+ goto error_out;
+ }
+ }
+
+ if (size > idx)
+ {
+ pborderWidth = PyTuple_GET_ITEM(item, idx++);
+ if (pborderWidth == Py_None)
+ pborderWidth = ePyObject();
+ }
+ if (size > idx)
+ {
+ pforeColor = PyTuple_GET_ITEM(item, idx++);
+ if (pforeColor == Py_None)
+ pforeColor = ePyObject();
+ }
+ if (size > idx)
+ {
+ pforeColorSelected = PyTuple_GET_ITEM(item, idx++);
+ if (pforeColorSelected == Py_None)
+ pforeColorSelected=ePyObject();
+ }
+ if (size > idx)
+ {
+ pbackColor = PyTuple_GET_ITEM(item, idx++);
+ if (pbackColor == Py_None)
+ pbackColor=ePyObject();
+ }
+ if (size > idx)
+ {
+ pbackColorSelected = PyTuple_GET_ITEM(item, idx++);
+ if (pbackColorSelected == Py_None)
+ pbackColorSelected=ePyObject();
+ }
+
+ int x = PyInt_AsLong(px) + offset.x();
+ int y = PyInt_AsLong(py) + offset.y();
+ int width = PyInt_AsLong(pwidth);
+ int height = PyInt_AsLong(pheight);
+ int filled = PyInt_AsLong(pfilled_perc);
+
+ if ((filled < 0) && data) /* if the string is in a negative number, it refers to the 'data' list. */
+ filled = PyInt_AsLong(PyTuple_GetItem(data, -filled));
+
+ /* don't do anything if percent out of range */
+ if ((filled < 0) || (filled > 100))
+ continue;
+
+ int bwidth = pborderWidth ? PyInt_AsLong(pborderWidth) : 2;
+
+ eRect rect(x, y, width, height);
+ painter.clip(rect);
+
+ {
+ gRegion rc(rect);
+ clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip, offset, cursorValid);
+ }
+
+ // border
+ rect.setRect(x, y, width, bwidth);
+ painter.fill(rect);
+
+ rect.setRect(x, y+bwidth, bwidth, height-bwidth);
+ painter.fill(rect);
+
+ rect.setRect(x+bwidth, y+height-bwidth, width-bwidth, bwidth);
+ painter.fill(rect);
+
+ rect.setRect(x+width-bwidth, y+bwidth, bwidth, height-bwidth);
+ painter.fill(rect);
+
+ rect.setRect(x+bwidth, y+bwidth, (width-bwidth*2) * filled / 100, height-bwidth*2);
+
+ // progress
+ if (ppixmap)
+ {
+ ePtr<gPixmap> pixmap;
+ if (SwigFromPython(pixmap, ppixmap))
+ {
+ eDebug("eListboxPythonMultiContent (Pixmap) get pixmap failed");
+ painter.clippop();
+ continue;
+ }
+ painter.blit(pixmap, rect.topLeft(), rect, 0);
+ }
+ else
+ painter.fill(rect);
+