diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-11-28 01:52:37 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-11-28 01:52:37 +0000 |
| commit | 5d4117d8e413629c17fee5c13589375a3f1cc2bd (patch) | |
| tree | 69cba75f3b4ae24b9d8f73c7ab9f5d3b04748cf0 /lib | |
| parent | c5f61282a2391235e05ff40bc40a2f0852ea1a9f (diff) | |
| download | enigma2-5d4117d8e413629c17fee5c13589375a3f1cc2bd.tar.gz enigma2-5d4117d8e413629c17fee5c13589375a3f1cc2bd.zip | |
listbox: add ability to disable selection highlight
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gui/elistbox.cpp | 11 | ||||
| -rw-r--r-- | lib/gui/elistbox.h | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index c3dd659b..28d220a2 100644 --- a/lib/gui/elistbox.cpp +++ b/lib/gui/elistbox.cpp @@ -10,6 +10,7 @@ eListbox::eListbox(eWidget *parent): eWidget(parent) eActionMap::getInstance(ptr); m_itemheight = 25; + m_selection_enabled = 1; ptr->bindAction("ListboxActions", 0, 0, this); } @@ -144,7 +145,7 @@ int eListbox::event(int event, void *data, void *data2) for (int y = 0, i = 0; i <= m_items_per_page; y += m_itemheight, ++i) { - m_content->paint(painter, *style, ePoint(0, y), m_selected == m_content->cursorGet() && m_content->size()); + m_content->paint(painter, *style, ePoint(0, y), m_selected == m_content->cursorGet() && m_content->size() && m_selection_enabled); m_content->cursorMove(+1); } @@ -183,6 +184,14 @@ void eListbox::setItemHeight(int h) recalcSize(); } +void eListbox::setSelectionEnable(int en) +{ + if (m_selection_enabled == en) + return; + m_selection_enabled = en; + entryChanged(m_selected); /* redraw current entry */ +} + void eListbox::entryAdded(int index) { /* manage our local pointers. when the entry was added before the current position, we have to advance. */ diff --git a/lib/gui/elistbox.h b/lib/gui/elistbox.h index 29349cbb..a7ed637d 100644 --- a/lib/gui/elistbox.h +++ b/lib/gui/elistbox.h @@ -75,6 +75,7 @@ public: }; void setItemHeight(int h); + void setSelectionEnable(int en); #ifndef SWIG /* entryAdded: an entry was added *before* the given index. it's index is the given number. */ @@ -89,11 +90,12 @@ public: protected: int event(int event, void *data=0, void *data2=0); void recalcSize(); - + private: int m_top, m_selected; int m_itemheight; int m_items_per_page; + int m_selection_enabled; ePtr<iListboxContent> m_content; #endif |
