+ Py_XDECREF(m_buildFunc);
+ Py_XDECREF(m_selectableFunc);
+}
+
+void eListboxPythonMultiContent::setSelectionClip(eRect &rect, bool update)
+{
+ m_selection_clip = rect;
+ if (m_listbox)
+ rect.moveBy(ePoint(0, m_listbox->getEntryTop()));
+ if (m_clip.valid())
+ m_clip |= rect;
+ else
+ m_clip = rect;
+ if (update && m_listbox)
+ 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)
+{
+ if (selected && sel_clip.valid())
+ {
+ bool clear=true;
+ painter.clip(rc-sel_clip);
+ if (pbackColor)
+ {
+ int color = PyInt_AsLong(pbackColor);
+ painter.setBackgroundColor(gRGB(color));
+ } // transparent background?
+ else if (local_style && local_style->m_transparent_background)
+ clear=false;
+ // if we have a local background color set, use that.
+ else if (local_style && local_style->m_background_color_set)
+ painter.setBackgroundColor(local_style->m_background_color);
+ else
+ style.setStyle(painter, eWindowStyle::styleListboxNormal);
+ if (clear)
+ painter.clear();
+ painter.clippop();
+ painter.clip(rc&sel_clip);
+ style.setStyle(painter, eWindowStyle::styleListboxSelected);
+ if (pbackColorSelected)
+ {
+ int color = PyInt_AsLong(pbackColorSelected);
+ painter.setBackgroundColor(gRGB(color));
+ }
+ painter.clear();
+ painter.clippop();
+ }
+ else
+ {
+ if (selected)
+ {
+ style.setStyle(painter, eWindowStyle::styleListboxSelected);
+ if (pbackColorSelected)
+ {
+ int color = PyInt_AsLong(pbackColorSelected);
+ painter.setBackgroundColor(gRGB(color));
+ }
+ painter.clear();
+ }
+ else
+ {
+ bool clear=true;
+ style.setStyle(painter, eWindowStyle::styleListboxNormal);
+ if (pbackColor)
+ {
+ int color = PyInt_AsLong(pbackColor);
+ painter.setBackgroundColor(gRGB(color));
+ }/* if we have a local background color set, use that. */
+ else if (local_style)
+ {
+ if (local_style->m_transparent_background)
+ clear=false;
+ else if (local_style->m_background_color_set)
+ painter.setBackgroundColor(local_style->m_background_color);
+ }
+ /* if we have no transparent background */
+ if (clear)
+ painter.clear();
+ }
+ }
+ 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);