X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/dba614edd2aad3c17e244914eaef3809d8300cb1..3af66122574386a2856e83ba9c5d73d27a6f3710:/lib/service/listboxservice.cpp diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp index 647dbdb9..db4f6b86 100644 --- a/lib/service/listboxservice.cpp +++ b/lib/service/listboxservice.cpp @@ -30,6 +30,43 @@ void eListboxServiceContent::getCurrent(eServiceReference &ref) ref = eServiceReference(); } +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(); +} + +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; +} + DEFINE_REF(eListboxServiceContent); eListboxServiceContent::eListboxServiceContent() @@ -118,7 +155,10 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const { ePtr fnt = new gFont("Arial", 14); painter.clip(eRect(offset, m_itemsize)); - style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal); + if (cursorValid() && isMarked(*m_cursor)) + style.setStyle(painter, eWindowStyle::styleListboxMarked); + else + style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal); painter.clear(); if (cursorValid())