aboutsummaryrefslogtreecommitdiff
path: root/lib/gui/elistbox.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-02-07 09:14:02 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-02-07 09:14:02 +0000
commitd9ee52e4f0fbe9a1ae00d0e66f9e6f0a07fa319f (patch)
treef1084b85919b5590615e281331cfe535c3a160c8 /lib/gui/elistbox.cpp
parent4bc08995411e21f3564f09e136809be68ddf96a8 (diff)
downloadenigma2-d9ee52e4f0fbe9a1ae00d0e66f9e6f0a07fa319f.tar.gz
enigma2-d9ee52e4f0fbe9a1ae00d0e66f9e6f0a07fa319f.zip
- added iStaticServiceInformation
- added service list interface for dvb - started work on queries (currently only "instr" on servicename) - started work on infobar - added listbox with service - fixed dvbdb - remove some debug output
Diffstat (limited to 'lib/gui/elistbox.cpp')
-rw-r--r--lib/gui/elistbox.cpp69
1 files changed, 62 insertions, 7 deletions
diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp
index 5a9ee4d6..f530019d 100644
--- a/lib/gui/elistbox.cpp
+++ b/lib/gui/elistbox.cpp
@@ -1,3 +1,4 @@
+ /* written by: Felix Domke <tmbinc@elitedvb.net> */
#include <lib/gui/elistbox.h>
#include <lib/gui/elistboxcontent.h>
@@ -9,11 +10,7 @@ eListbox::eListbox(eWidget *parent): eWidget(parent)
void eListbox::setContent(iListboxContent *content)
{
m_content = content;
- invalidate();
- if (m_content)
- m_content->cursorHome();
- m_top = 0;
- m_selected = 0;
+ entryReset();
}
void eListbox::moveSelection(int dir)
@@ -46,6 +43,8 @@ void eListbox::moveSelection(int dir)
if (m_top < 0)
m_top = 0;
break;
+ case justCheck:
+ break;
}
/* note that we could be on an invalid cursor position, but we don't
@@ -54,6 +53,7 @@ void eListbox::moveSelection(int dir)
/* now, look wether the current selection is out of screen */
m_selected = m_content->cursorGet();
+
if (m_selected < m_top)
{
m_top -= m_items_per_page;
@@ -64,11 +64,12 @@ void eListbox::moveSelection(int dir)
/* m_top should be always valid here as it's selected */
m_top += m_items_per_page;
}
-
+
if (m_top != oldtop)
invalidate();
- else
+ else if (m_selected != oldsel)
{
+
/* redraw the old and newly selected */
gRegion inv = eRect(0, m_itemheight * (m_selected-m_top), size().width(), m_itemheight);
inv |= eRect(0, m_itemheight * (oldsel-m_top), size().width(), m_itemheight);
@@ -119,3 +120,57 @@ void eListbox::recalcSize()
m_content->setSize(eSize(size().width(), m_itemheight));
m_items_per_page = size().height() / m_itemheight;
}
+
+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()
+{
+ invalidate();
+ if (m_content)
+ m_content->cursorHome();
+ m_top = 0;
+ m_selected = 0;
+}