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 satconfig part
[enigma2.git]
/
lib
/
gui
/
elistbox.cpp
diff --git
a/lib/gui/elistbox.cpp
b/lib/gui/elistbox.cpp
index f530019dd27a63cd24dcb6eb7781327a6d3ee303..ba2e35226fc20077adbf1a43cea0f78726a48bdf 100644
(file)
--- a/
lib/gui/elistbox.cpp
+++ b/
lib/gui/elistbox.cpp
@@
-1,20
+1,38
@@
- /* written by: Felix Domke <tmbinc@elitedvb.net> */
#include <lib/gui/elistbox.h>
#include <lib/gui/elistboxcontent.h>
#include <lib/gui/elistbox.h>
#include <lib/gui/elistboxcontent.h>
+#include <lib/actions/action.h>
eListbox::eListbox(eWidget *parent): eWidget(parent)
{
setContent(new eListboxStringContent());
eListbox::eListbox(eWidget *parent): eWidget(parent)
{
setContent(new eListboxStringContent());
+
+ ePtr<eActionMap> ptr;
+ eActionMap::getInstance(ptr);
+
+ ptr->bindAction("ListboxActions", 0, 0, this);
+}
+
+eListbox::~eListbox()
+{
+ ePtr<eActionMap> ptr;
+ eActionMap::getInstance(ptr);
+ ptr->unbindAction(this, 0);
}
void eListbox::setContent(iListboxContent *content)
{
m_content = content;
}
void eListbox::setContent(iListboxContent *content)
{
m_content = content;
+ if (content)
+ m_content->setListbox(this);
entryReset();
}
void eListbox::moveSelection(int dir)
{
entryReset();
}
void eListbox::moveSelection(int dir)
{
+ /* refuse to do anything without a valid list. */
+ if (!m_content)
+ return;
+
/* we need the old top/sel to see what we have to redraw */
int oldtop = m_top;
int oldsel = m_selected;
/* we need the old top/sel to see what we have to redraw */
int oldtop = m_top;
int oldsel = m_selected;
@@
-86,8
+104,9
@@
int eListbox::event(int event, void *data, void *data2)
{
ePtr<eWindowStyle> style;
{
ePtr<eWindowStyle> style;
+ if (!m_content)
+ return eWidget::event(event, data, data2);
assert(m_content);
assert(m_content);
- recalcSize(); // move to event
getStyle(style);
getStyle(style);
@@
-109,6
+128,17
@@
int eListbox::event(int event, void *data, void *data2)
return 0;
}
return 0;
}
+ case evtChangedSize:
+ recalcSize();
+ return eWidget::event(event, data, data2);
+
+ case evtAction:
+ if (isVisible())
+ {
+ moveSelection((int)data2);
+ return 1;
+ }
+ return 0;
default:
return eWidget::event(event, data, data2);
}
default:
return eWidget::event(event, data, data2);
}
@@
-168,9
+198,9
@@
void eListbox::entryChanged(int index)
void eListbox::entryReset()
{
void eListbox::entryReset()
{
- invalidate();
if (m_content)
m_content->cursorHome();
m_top = 0;
m_selected = 0;
if (m_content)
m_content->cursorHome();
m_top = 0;
m_selected = 0;
+ invalidate();
}
}