diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-12-12 22:03:13 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-12-12 22:03:13 +0000 |
| commit | 4724c0eba2e29f53bd93be10a149e0bb89ae8640 (patch) | |
| tree | c083fe94e53b7d548508e57e83b761ee23fb93c6 /lib/gui/elistbox.cpp | |
| parent | 1c4c06d35a9e13dc60d820c4077e76c363f1a965 (diff) | |
| download | enigma2-4724c0eba2e29f53bd93be10a149e0bb89ae8640.tar.gz enigma2-4724c0eba2e29f53bd93be10a149e0bb89ae8640.zip | |
listbox: move checkScrollbar to the proper place
Diffstat (limited to 'lib/gui/elistbox.cpp')
| -rw-r--r-- | lib/gui/elistbox.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index c4f9ed2c..36310aef 100644 --- a/lib/gui/elistbox.cpp +++ b/lib/gui/elistbox.cpp @@ -56,6 +56,10 @@ void eListbox::moveSelection(int dir) /* refuse to do anything without a valid list. */ if (!m_content) return; + + /* if our list does not have one entry, don't do anything. */ + if (!m_items_per_page) + return; /* we need the old top/sel to see what we have to redraw */ int oldtop = m_top; @@ -120,13 +124,18 @@ 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(); @@ -139,6 +148,9 @@ void eListbox::moveSelection(int dir) invalidate(inv); } + + if (m_scrollbar_mode != showNever) + updateScrollBar(); } void eListbox::moveSelectionTo(int index) @@ -213,9 +225,6 @@ int eListbox::event(int event, void *data, void *data2) gPainter &painter = *(gPainter*)data2; - if (m_scrollbar_mode != showNever) - updateScrollBar(); - m_content->cursorSave(); m_content->cursorMove(m_top - m_selected); @@ -329,5 +338,6 @@ void eListbox::entryReset() m_content->cursorHome(); m_top = 0; m_selected = 0; + moveSelection(justCheck); invalidate(); } |
