X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdropdown.h;h=ecba9753cb5cace6957f74fa52162887703e202e;hb=ff2e39210cf151b50db3db0c62f2a2fc771b25e8;hp=49088e20f2dc8e01e6567f7b6eb69618f1febc0a;hpb=50bf1ef2e2c3c38de20f6996a6c5ed0066111177;p=libs%2Fgltk.git diff --git a/source/dropdown.h b/source/dropdown.h index 49088e2..ecba975 100644 --- a/source/dropdown.h +++ b/source/dropdown.h @@ -9,6 +9,7 @@ Distributed under the LGPL #define MSP_GLTK_DROPDOWN_H_ #include +#include "list.h" #include "widget.h" namespace Msp { @@ -28,8 +29,7 @@ public: }; private: - List *list; - std::string text; + List list; bool dropped; bool list_active; @@ -40,15 +40,25 @@ public: ~Dropdown(); void append(const std::string &); + void insert(unsigned, const std::string &); + void remove(unsigned); + void clear(); + unsigned get_n_items() const; + + void set_selected_index(int); + const std::string &get_selected() const; + int get_selected_index() const; virtual void button_press(int, int, unsigned); virtual void button_release(int, int, unsigned); virtual void pointer_motion(int, int); + private: virtual const char *get_class() const { return "dropdown"; } virtual void render_special(const Part &) const; virtual void on_geometry_change(); + void resize_list(); void list_item_selected(unsigned, const std::string &); };