Support focus animation for listbox
[vuplus_dvbapp] / lib / service / listboxservice.cpp
index f8ac0ff..074b8cd 100644 (file)
@@ -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);
@@ -531,12 +573,15 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
                bool paintProgress = false;
                ePtr<eServiceEvent> evt;
 
+               bool serviceAvail = true;
+
                if (!marked && isPlayable && service_info && m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore))
                {
                        if (m_color_set[serviceNotAvail])
                                painter.setForegroundColor(m_color[serviceNotAvail]);
                        else
                                painter.setForegroundColor(gRGB(0xbbbbbb));
+                       serviceAvail = false;
                }
 
                if (selected && local_style && local_style->m_selection)
@@ -582,6 +627,9 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
                                {
                                        if (service_info)
                                                service_info->getName(*m_cursor, text);
+#ifdef USE_LIBVUGLES2
+                                       painter.setFlush(text == "<n/a>");
+#endif
                                        break;
                                }
                                case celServiceInfo:
@@ -592,6 +640,13 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
                                                if (!name.length())
                                                        continue;
                                                text = '(' + evt->getEventName() + ')';
+                                               if (serviceAvail)
+                                               {
+                                                       if (!selected && m_color_set[serviceDescriptionColor])
+                                                               painter.setForegroundColor(m_color[serviceDescriptionColor]);
+                                                       else if (selected && m_color_set[serviceDescriptionColorSelected])
+                                                               painter.setForegroundColor(m_color[serviceDescriptionColorSelected]);
+                                               }
                                        }
                                        else
                                                continue;