- work on timers
[vuplus_dvbapp] / lib / gui / elistbox.cpp
index 2c2525c..4598fa0 100644 (file)
@@ -9,6 +9,8 @@ eListbox::eListbox(eWidget *parent): eWidget(parent)
        ePtr<eActionMap> ptr;
        eActionMap::getInstance(ptr);
        
+       m_itemheight = 20;
+       
        ptr->bindAction("ListboxActions", 0, 0, this);
 }
 
@@ -107,7 +109,6 @@ int eListbox::event(int event, void *data, void *data2)
                if (!m_content)
                        return eWidget::event(event, data, data2);
                assert(m_content);
-               recalcSize(); // move to event
                
                getStyle(style);
                
@@ -129,6 +130,10 @@ int eListbox::event(int event, void *data, void *data2)
                
                return 0;
        }
+       case evtChangedSize:
+               recalcSize();
+               return eWidget::event(event, data, data2);
+               
        case evtAction:
                if (isVisible())
                {
@@ -143,11 +148,19 @@ int eListbox::event(int event, void *data, void *data2)
 
 void eListbox::recalcSize()
 {
-       m_itemheight = 20;
        m_content->setSize(eSize(size().width(), m_itemheight));
        m_items_per_page = size().height() / m_itemheight;
 }
 
+void eListbox::setItemHeight(int h)
+{
+       if (h)
+               m_itemheight = h;
+       else
+               m_itemheight = 20;
+       recalcSize();
+}
+
 void eListbox::entryAdded(int index)
 {
                /* manage our local pointers. when the entry was added before the current position, we have to advance. */