+void eListboxServiceContent::initMarked()
+{
+ m_marked.clear();
+}
+
+void eListboxServiceContent::addMarked(const eServiceReference &ref)
+{
+ m_marked.insert(ref);
+ if (m_listbox)
+ m_listbox->entryChanged(lookupService(ref));
+}
+
+void eListboxServiceContent::removeMarked(const eServiceReference &ref)
+{
+ m_marked.erase(ref);
+ if (m_listbox)
+ m_listbox->entryChanged(lookupService(ref));
+}
+
+int eListboxServiceContent::isMarked(const eServiceReference &ref)
+{
+ return m_marked.find(ref) != m_marked.end();
+}
+
+void eListboxServiceContent::markedQueryStart()
+{
+ m_marked_iterator = m_marked.begin();
+}
+
+int eListboxServiceContent::markedQueryNext(eServiceReference &ref)
+{
+ if (m_marked_iterator == m_marked.end())
+ return -1;
+ ref = *m_marked_iterator++;
+ return 0;
+}
+
+int eListboxServiceContent::lookupService(const eServiceReference &ref)
+{
+ /* shortcut for cursor */
+ if (ref == *m_cursor)
+ return m_cursor_number;
+ /* otherwise, search in the list.. */
+ int index = 0;
+ for (list::const_iterator i(m_list.begin()); i != m_list.end(); ++i, ++index);
+
+ /* this is ok even when the index was not found. */
+ return index;
+}
+
+void eListboxServiceContent::setVisualMode(int mode)
+{
+ m_visual_mode = mode;
+
+ if (m_visual_mode == visModeSimple)
+ {
+ m_element_position[celServiceName] = eRect(ePoint(0, 0), m_itemsize);
+ m_element_font[celServiceName] = new gFont("Arial", 14);
+ m_element_position[celServiceNumber] = eRect();
+ m_element_font[celServiceNumber] = 0;
+ m_element_position[celIcon] = eRect();
+ m_element_position[celServiceInfo] = eRect();
+ m_element_font[celServiceInfo] = 0;
+ }
+}
+
+void eListboxServiceContent::setElementPosition(int element, eRect where)
+{
+ if ((element >= 0) && (element < celElements))
+ m_element_position[element] = where;
+}
+
+void eListboxServiceContent::setElementFont(int element, gFont *font)
+{
+ if ((element >= 0) && (element < celElements))
+ m_element_font[element] = font;
+}
+
+void eListboxServiceContent::sort()
+{
+ ePtr<iListableService> lst;
+ if (!m_service_center->list(m_root, lst))
+ {
+ m_list.sort(iListableServiceCompare(lst));
+ /* FIXME: is this really required or can we somehow keep the current entry? */
+ cursorHome();
+ if (m_listbox)
+ m_listbox->entryReset();
+ }
+}
+