+
+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. */
+
+ /* we need to check <= - when the new entry has the (old) index of the cursor, the cursor was just moved down. */
+ if (index <= m_selected)
+ ++m_selected;
+ if (index <= m_top)
+ ++m_top;
+
+ /* we have to check wether our current cursor is gone out of the screen. */
+ /* moveSelection will check for this case */
+ moveSelection(justCheck);
+
+ /* now, check if the new index is visible. */
+ if ((m_top <= index) && (index < (m_top + m_items_per_page)))
+ {
+ /* todo, calc exact invalidation... */
+ invalidate();
+ }
+}
+
+void eListbox::entryRemoved(int index)
+{
+ if (index == m_selected)
+ m_selected = m_content->cursorGet();
+
+ moveSelection(justCheck);
+
+ if ((m_top <= index) && (index < (m_top + m_items_per_page)))
+ {
+ /* todo, calc exact invalidation... */
+ invalidate();
+ }
+}
+
+void eListbox::entryChanged(int index)
+{
+ if ((m_top <= index) && (index < (m_top + m_items_per_page)))
+ {
+ gRegion inv = eRect(0, m_itemheight * (index-m_top), size().width(), m_itemheight);
+ invalidate(inv);
+ }
+}
+
+void eListbox::entryReset()
+{
+ if (m_content)
+ m_content->cursorHome();
+ m_top = 0;
+ m_selected = 0;
+ invalidate();
+}