X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fservice%2Flistboxservice.cpp;h=79445036b752b0c0413bd38aeaf795a40a8c4c40;hp=cc8c32b50e64c6123fd4f58761f0f6eea059b9e9;hb=27e06ba9c8b055c20ea8c70a405deb0e4019edc5;hpb=a302e0a778e1ea30b76956fd7469cf554eb0fc20 diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp index cc8c32b..7944503 100644 --- a/lib/service/listboxservice.cpp +++ b/lib/service/listboxservice.cpp @@ -99,6 +99,48 @@ void eListboxServiceContent::getCurrent(eServiceReference &ref) ref = eServiceReference(); } +void eListboxServiceContent::getPrev(eServiceReference &ref) +{ + if (cursorValid()) + { + list::iterator cursor(m_cursor); + if (cursor == m_list.begin()) + { + cursor = m_list.end(); + } + ref = *(--cursor); + } + else + ref = eServiceReference(); +} + +void eListboxServiceContent::getNext(eServiceReference &ref) +{ + if (cursorValid()) + { + list::iterator cursor(m_cursor); + cursor++; + if (cursor == m_list.end()) + { + cursor = m_list.begin(); + } + ref = *(cursor); + } + else + ref = eServiceReference(); +} + +PyObject *eListboxServiceContent::getList() +{ + ePyObject result = PyList_New(m_list.size()); + int pos=0; + for (list::iterator it(m_list.begin()); it != m_list.end(); ++it) + { + PyList_SET_ITEM(result, pos++, NEW_eServiceReference(*it)); + } + return result; +} + int eListboxServiceContent::getNextBeginningWithChar(char c) { // printf("Char: %c\n", c);