diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2005-12-28 18:51:00 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2005-12-28 18:51:00 +0000 |
| commit | b55924aedff85c75f03d689cae75ad40523f0b7d (patch) | |
| tree | 61f950be1954aca0a27e7688b49107abfd0fafc7 /lib/gui/elistbox.cpp | |
| parent | c0e0929d4876c78f73013a96226fed7bdec00503 (diff) | |
| download | enigma2-b55924aedff85c75f03d689cae75ad40523f0b7d.tar.gz enigma2-b55924aedff85c75f03d689cae75ad40523f0b7d.zip | |
hopefully fix the 99% systemload bug when opening a new listbox
thats the reason why i use the element initializers (before i call any member funktion :) )
Diffstat (limited to 'lib/gui/elistbox.cpp')
| -rw-r--r-- | lib/gui/elistbox.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index aba74432..d9a875d1 100644 --- a/lib/gui/elistbox.cpp +++ b/lib/gui/elistbox.cpp @@ -3,20 +3,25 @@ #include <lib/gui/eslider.h> #include <lib/actions/action.h> + int m_scrollbar_mode, m_prev_scrollbar_page; + bool m_content_changed; + + int m_top, m_selected; + int m_itemheight; + int m_items_per_page; + int m_selection_enabled; + ePtr<iListboxContent> m_content; + eSlider *m_scrollbar; + eListbox::eListbox(eWidget *parent) - :eWidget(parent), m_prev_scrollbar_page(-1), m_content_changed(false) - , m_scrollbar_mode(showNever), m_scrollbar(NULL) + :eWidget(parent), m_scrollbar_mode(showNever), m_prev_scrollbar_page(-1) + ,m_content_changed(false), m_top(0), m_selected(0), m_itemheight(25) + ,m_items_per_page(0), m_selection_enabled(1), m_scrollbar(NULL) { setContent(new eListboxStringContent()); ePtr<eActionMap> ptr; eActionMap::getInstance(ptr); - - m_itemheight = 25; - m_selection_enabled = 1; - - m_items_per_page = 0; - ptr->bindAction("ListboxActions", 0, 0, this); } @@ -228,6 +233,9 @@ int eListbox::event(int event, void *data, void *data2) { case evtPaint: { + timeval t, t2; + gettimeofday(&t, 0); + ePtr<eWindowStyle> style; if (!m_content) @@ -259,6 +267,9 @@ int eListbox::event(int event, void *data, void *data2) m_content->cursorRestore(); + gettimeofday(&t2, 0); + t2 -= t; + eDebug("draw %d:%d", t2.tv_sec, t2.tv_usec); return 0; } case evtChangedSize: @@ -284,6 +295,9 @@ void eListbox::recalcSize() m_content->setSize(eSize(size().width(), m_itemheight)); m_items_per_page = size().height() / m_itemheight; + if (m_items_per_page > 20) + eDebug("eListbox::recalcSize() m_items_per_page %d", m_items_per_page); + if (m_items_per_page < 0) /* TODO: whyever - our size could be invalid, or itemheigh could be wrongly specified. */ m_items_per_page = 0; |
