From abc0caf95536a4001615f863860a091d6bc55973 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 19 Apr 2013 22:57:02 +0200 Subject: New listbox widgets and scrollbar. --- plugingui/listboxbasic.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'plugingui/listboxbasic.h') 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 &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 items; - std::vector items; int selected; int marked; GUI::Font font; int padding; int btn_size; - int scroll_offset; void (*sel_handler)(void *); void *sel_ptr; -- cgit v1.2.3