From 1fe04afd8dd8addcc8902ea3c1c0f77d148cd1b7 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 9 Mar 2013 19:34:07 +0100 Subject: Fix keyboard navigation logic in listbox. --- plugingui/listbox.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'plugingui/listbox.h') diff --git a/plugingui/listbox.h b/plugingui/listbox.h index 26d104b..d7a5021 100644 --- a/plugingui/listbox.h +++ b/plugingui/listbox.h @@ -28,7 +28,7 @@ #define __DRUMGIZMO_LISTBOX_H__ #include -#include +#include #include "widget.h" #include "font.h" @@ -45,7 +45,7 @@ public: void addItem(std::string name, std::string value); void clear(); - bool selectItem(std::string name); + bool selectItem(int index); std::string selectedName(); std::string selectedValue(); @@ -57,8 +57,13 @@ public: virtual void keyEvent(KeyEvent *e); private: - std::map items; - std::string selected; + struct item { + std::string name; + std::string value; + }; + + std::vector items; + int selected; GUI::Font font; int padding; int btn_size; -- cgit v1.2.3