add needed functions
[enigma2.git] / lib / gui / elistbox.cpp
index 013a31036eb618d5835187368666094415be4c1c..bfa09b88844a649a5147226c92b529b0fd5b5376 100644 (file)
@@ -20,6 +20,9 @@ eListbox::eListbox(eWidget *parent)
 
 eListbox::~eListbox()
 {
+       if (m_scrollbar)
+               delete m_scrollbar;
+       
        ePtr<eActionMap> ptr;
        eActionMap::getInstance(ptr);
        ptr->unbindAction(this, 0);
@@ -156,9 +159,19 @@ void eListbox::moveSelection(int dir)
 
 void eListbox::moveSelectionTo(int index)
 {
-       m_content->cursorHome();
-       m_content->cursorMove(index);
-       moveSelection(justCheck);
+       if ( m_content )
+       {
+               m_content->cursorHome();
+               m_content->cursorMove(index);
+               moveSelection(justCheck);
+       }
+}
+
+int eListbox::getCurrentIndex()
+{
+       if ( m_content && m_content->cursorValid() )
+               return m_content->cursorGet();
+       return 0;
 }
 
 void eListbox::updateScrollBar()