diff --git a/src/gui/widget/listbox.cpp b/src/gui/widget/listbox.cpp index e05c02943..74f63bf65 100644 --- a/src/gui/widget/listbox.cpp +++ b/src/gui/widget/listbox.cpp @@ -188,33 +188,13 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/) { loop = false; } - else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup) + else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup || + msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) { - if(getItemCount()!=0) { - int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected - step; - - if (new_selected < 0) { - if (selected != 0 && step != 1) - new_selected = 0; - else - new_selected = getItemCount() - 1; - } - updateSelection(new_selected); - } - } - else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown) - { - if(getItemCount()!=0) { - int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1 - int new_selected = selected + step; - if (new_selected > (int) getItemCount() - 1) { - if ((selected != getItemCount() - 1)) - new_selected = getItemCount() - 1; - else - new_selected = 0; - } - updateSelection(new_selected); + if (getItemCount() != 0) { + int new_selected = UpDownKey((int)getItemCount(), msg, listmaxshow, selected); + if (new_selected >= 0) + updateSelection(new_selected); } } else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) { diff --git a/src/gui/widget/listbox.h b/src/gui/widget/listbox.h index ce52081e0..26a27f8e6 100644 --- a/src/gui/widget/listbox.h +++ b/src/gui/widget/listbox.h @@ -26,12 +26,13 @@ #define __listbox__ #include "menue.h" +#include "listhelpers.h" #include #include -class CListBox : public CMenuTarget +class CListBox : public CMenuTarget, public CListHelpers { protected: CFrameBuffer* frameBuffer;