git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add possibility to select between different list styles via context menu
[enigma2.git]
/
lib
/
gui
/
elistbox.cpp
diff --git
a/lib/gui/elistbox.cpp
b/lib/gui/elistbox.cpp
index f3028ae3a94ce8e8bed48ade449f928186bba782..c21f363f4b9dd6a13b499e30687adfbeb63c77d9 100644
(file)
--- a/
lib/gui/elistbox.cpp
+++ b/
lib/gui/elistbox.cpp
@@
-58,6
+58,9
@@
void eListbox::setContent(iListboxContent *content)
if (content)
m_content->setListbox(this);
entryReset();
if (content)
m_content->setListbox(this);
entryReset();
+ /* if oldsel != m_selected, selectionChanged was already
+ emitted in entryReset. we want it in any case, so otherwise,
+ emit it now. */
if (oldsel == m_selected)
/* emit */ selectionChanged();
}
if (oldsel == m_selected)
/* emit */ selectionChanged();
}
@@
-78,6
+81,8
@@
bool eListbox::atEnd()
void eListbox::moveToEnd()
{
void eListbox::moveToEnd()
{
+ if (!m_content)
+ return;
/* move to last existing one ("end" is already invalid) */
m_content->cursorEnd(); m_content->cursorMove(-1);
/* current selection invisible? */
/* move to last existing one ("end" is already invalid) */
m_content->cursorEnd(); m_content->cursorMove(-1);
/* current selection invisible? */
@@
-329,8
+334,10
@@
int eListbox::event(int event, void *data, void *data2)
entryrect.moveBy(ePoint(0, m_itemheight));
}
entryrect.moveBy(ePoint(0, m_itemheight));
}
+ // clear/repaint empty/unused space between scrollbar and listboxentrys
if (m_scrollbar && m_scrollbar->isVisible())
{
if (m_scrollbar && m_scrollbar->isVisible())
{
+ style->setStyle(painter, eWindowStyle::styleListboxNormal);
painter.clip(eRect(m_scrollbar->position() - ePoint(5,0), eSize(5,m_scrollbar->size().height())));
painter.clear();
painter.clippop();
painter.clip(eRect(m_scrollbar->position() - ePoint(5,0), eSize(5,m_scrollbar->size().height())));
painter.clear();
painter.clippop();
@@
-340,6
+347,7
@@
int eListbox::event(int event, void *data, void *data2)
return 0;
}
return 0;
}
+
case evtChangedSize:
recalcSize();
return eWidget::event(event, data, data2);
case evtChangedSize:
recalcSize();
return eWidget::event(event, data, data2);
@@
-360,7
+368,8
@@
void eListbox::recalcSize()
{
m_content_changed=true;
m_prev_scrollbar_page=-1;
{
m_content_changed=true;
m_prev_scrollbar_page=-1;
- m_content->setSize(eSize(size().width(), m_itemheight));
+ if (m_content)
+ m_content->setSize(eSize(size().width(), m_itemheight));
m_items_per_page = size().height() / m_itemheight;
if (m_items_per_page < 0) /* TODO: whyever - our size could be invalid, or itemheigh could be wrongly specified. */
m_items_per_page = size().height() / m_itemheight;
if (m_items_per_page < 0) /* TODO: whyever - our size could be invalid, or itemheigh could be wrongly specified. */
@@
-388,7
+397,9
@@
void eListbox::setSelectionEnable(int en)
void eListbox::entryAdded(int index)
{
void eListbox::entryAdded(int index)
{
- /* manage our local pointers. when the entry was added before the current position, we have to advance. */
+ if (m_content && (m_content->size() % m_items_per_page) == 1)
+ m_content_changed=true;
+ /* 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)
/* 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)
@@
-410,7
+421,10
@@
void eListbox::entryAdded(int index)
void eListbox::entryRemoved(int index)
{
void eListbox::entryRemoved(int index)
{
- if (index == m_selected)
+ if (m_content && !(m_content->size() % m_items_per_page))
+ m_content_changed=true;
+
+ if (index == m_selected && m_content)
m_selected = m_content->cursorGet();
moveSelection(justCheck);
m_selected = m_content->cursorGet();
moveSelection(justCheck);