summaryrefslogtreecommitdiff
path: root/plugingui/listboxbasic.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-04-19 22:57:02 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2013-04-19 22:57:02 +0200
commitabc0caf95536a4001615f863860a091d6bc55973 (patch)
treeb3f79d1c92bc8e48df7d20375050808a945ca7e6 /plugingui/listboxbasic.h
parent615c1f1544cabbe7ed4b33a1bde10b1b2ab71d2e (diff)
New listbox widgets and scrollbar.
Diffstat (limited to 'plugingui/listboxbasic.h')
-rw-r--r--plugingui/listboxbasic.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/plugingui/listboxbasic.h b/plugingui/listboxbasic.h
index 1b7644e..ebb46b0 100644
--- a/plugingui/listboxbasic.h
+++ b/plugingui/listboxbasic.h
@@ -34,16 +34,25 @@
#include "font.h"
#include "painter.h"
+#include "scrollbar.h"
+
namespace GUI {
class ListBoxBasic : public Widget {
public:
+ class Item {
+ public:
+ std::string name;
+ std::string value;
+ };
+
ListBoxBasic(Widget *parent);
~ListBoxBasic();
bool isFocusable() { return true; }
void addItem(std::string name, std::string value);
+ void addItems(std::vector<Item> &items);
void clear();
bool selectItem(int index);
@@ -58,24 +67,22 @@ public:
virtual void buttonEvent(ButtonEvent *e);
virtual void scrollEvent(ScrollEvent *e);
virtual void keyEvent(KeyEvent *e);
+ virtual void resize(int w, int h);
private:
- Image *bg_img;
+ ScrollBar scroll;
+
+ Image bg_img;
void setSelection(int index);
- struct item {
- std::string name;
- std::string value;
- };
+ std::vector<Item> items;
- std::vector<struct item> items;
int selected;
int marked;
GUI::Font font;
int padding;
int btn_size;
- int scroll_offset;
void (*sel_handler)(void *);
void *sel_ptr;