mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
listbox: use CListHelpers
This commit is contained in:
committed by
svenhoefer
parent
ed7eaafbcb
commit
cfeaf6fc6d
@@ -188,33 +188,13 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
|
|||||||
{
|
{
|
||||||
loop = false;
|
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) {
|
if (getItemCount() != 0) {
|
||||||
int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1
|
int new_selected = UpDownKey((int)getItemCount(), msg, listmaxshow, selected);
|
||||||
int new_selected = selected - step;
|
if (new_selected >= 0)
|
||||||
|
updateSelection(new_selected);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) {
|
else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end) {
|
||||||
|
@@ -26,12 +26,13 @@
|
|||||||
#define __listbox__
|
#define __listbox__
|
||||||
|
|
||||||
#include "menue.h"
|
#include "menue.h"
|
||||||
|
#include "listhelpers.h"
|
||||||
|
|
||||||
#include <driver/framebuffer.h>
|
#include <driver/framebuffer.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class CListBox : public CMenuTarget
|
class CListBox : public CMenuTarget, public CListHelpers
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CFrameBuffer* frameBuffer;
|
CFrameBuffer* frameBuffer;
|
||||||
|
Reference in New Issue
Block a user