+ 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 pforeColorSelected, ePyObject pbackColor, ePyObject pbackColorSelected, int selected, gRegion &rc, eRect &sel_clip)
+{
+ if (selected && sel_clip.valid())
+ {
+ gRegion part = rc - sel_clip;
+ if (!part.empty())
+ {
+ painter.clip(part);
+ style.setStyle(painter, eWindowStyle::styleListboxNormal);
+ if (pbackColor)
+ {
+ int color = PyInt_AsLong(pbackColor);
+ painter.setBackgroundColor(gRGB(color));
+ } // transparent background?
+ // 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);
+ if (!pbackColor && local_style && local_style->m_transparent_background)
+ ;
+ else
+ painter.clear();
+ painter.clippop();
+ selected = 0;
+ }
+ part = rc & sel_clip;
+ if (!part.empty())
+ {
+ painter.clip(part);
+ style.setStyle(painter, eWindowStyle::styleListboxSelected);
+ if (pbackColorSelected)
+ {
+ int color = PyInt_AsLong(pbackColorSelected);
+ painter.setBackgroundColor(gRGB(color));
+ }
+ else if (local_style && local_style->m_background_color_selected_set)
+ painter.setBackgroundColor(local_style->m_background_color_selected);
+ painter.clear();
+ painter.clippop();
+ selected = 1;
+ }
+ }
+ else
+ {
+ if (selected)
+ {
+ style.setStyle(painter, eWindowStyle::styleListboxSelected);
+ if (pbackColorSelected)
+ {
+ int color = PyInt_AsLong(pbackColorSelected);
+ painter.setBackgroundColor(gRGB(color));
+ }
+ else if (local_style && local_style->m_background_color_selected_set)
+ painter.setBackgroundColor(local_style->m_background_color_selected);
+ painter.clear();
+ }
+ else
+ {
+ 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 && local_style->m_background_color_set)
+ painter.setBackgroundColor(local_style->m_background_color);
+ /* if we have no transparent background */
+ if (!pbackColor && local_style && local_style->m_transparent_background)
+ ;
+ else
+ painter.clear();
+ }
+ }
+ if (selected)
+ {
+ if (pforeColorSelected)
+ {
+ int color = PyInt_AsLong(pforeColorSelected);
+ painter.setForegroundColor(gRGB(color));
+ }
+ /* if we have a local foreground color set, use that. */
+ else if (local_style && local_style->m_foreground_color_selected_set)
+ painter.setForegroundColor(local_style->m_foreground_color_selected);
+ }
+ else
+ {
+ 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);
+ }