aboutsummaryrefslogtreecommitdiff
path: root/lib/gui/elistbox.cpp
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2005-12-13 11:09:13 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2005-12-13 11:09:13 +0000
commit98a85fc2c88266504dfd5887e55d3a75765c87ab (patch)
tree01283b8bc57ab87d57d7e60a5d9034e63eca83de /lib/gui/elistbox.cpp
parent0a9a7967e1282fe7a85ec906c93e20a25ce821d1 (diff)
downloadenigma2-98a85fc2c88266504dfd5887e55d3a75765c87ab.tar.gz
enigma2-98a85fc2c88266504dfd5887e55d3a75765c87ab.zip
fix warnings,
fix handling of last page, remove debug messages
Diffstat (limited to 'lib/gui/elistbox.cpp')
-rw-r--r--lib/gui/elistbox.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp
index 36310aef..d9fa30fc 100644
--- a/lib/gui/elistbox.cpp
+++ b/lib/gui/elistbox.cpp
@@ -5,7 +5,7 @@
eListbox::eListbox(eWidget *parent)
:eWidget(parent), m_prev_scrollbar_page(-1), m_content_changed(false)
- , m_scrollbar(NULL), m_scrollbar_mode(showNever)
+ , m_scrollbar_mode(showNever), m_scrollbar(NULL)
{
setContent(new eListboxStringContent());
@@ -106,7 +106,11 @@ void eListbox::moveSelection(int dir)
/* current selection invisible? */
if (m_top + m_items_per_page <= m_content->cursorGet())
{
- m_top = m_content->cursorGet() - m_items_per_page + 1;
+ int rest = m_content->size() % m_items_per_page;
+ if ( rest )
+ m_top = m_content->cursorGet() - rest + 1;
+ else
+ m_top = m_content->cursorGet() - m_items_per_page + 1;
if (m_top < 0)
m_top = 0;
}
@@ -124,18 +128,13 @@ void eListbox::moveSelection(int dir)
while (m_selected < m_top)
{
- eDebug("%d < %d", m_selected, m_top);
m_top -= m_items_per_page;
if (m_top < 0)
m_top = 0;
}
-
while (m_selected >= m_top + m_items_per_page)
- {
- eDebug("%d >= %d + %d", m_selected, m_top, m_items_per_page);
/* m_top should be always valid here as it's selected */
m_top += m_items_per_page;
- }
if (m_top != oldtop)
invalidate();