X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdropdown.h;h=06aefa5af96d32cc0b6b3cc0d590bb092298164b;hb=1bc84ded58379ee24315db8784d9fb710a02e24e;hp=166eebf53da3943040c2565b9f4d471cca7d9919;hpb=fdc7fecc65f5f517d66abe3546a949a46836c4a6;p=libs%2Fgltk.git diff --git a/source/dropdown.h b/source/dropdown.h index 166eebf..06aefa5 100644 --- a/source/dropdown.h +++ b/source/dropdown.h @@ -3,6 +3,7 @@ #include #include "list.h" +#include "text.h" #include "widget.h" namespace Msp { @@ -13,7 +14,7 @@ class List; class Dropdown: virtual public Widget, private Container { public: - class Loader: public Widget::Loader + class Loader: public DataFile::DerivedObjectLoader { public: Loader(Dropdown &); @@ -21,31 +22,38 @@ public: void item(const std::string &); }; - sigc::signal signal_item_selected; + sigc::signal signal_item_selected; private: List list; bool dropped; + Text text; public: Dropdown(); + Dropdown(ListData &); +private: + void init(); +public: virtual const char *get_class() const { return "dropdown"; } - virtual void autosize(); +private: + virtual void autosize_special(const Part &, Geometry &); + +public: + void set_data(ListData &d) { list.set_data(d); } + ListData &get_data() { return list.get_data(); } + const ListData &get_data() const { return list.get_data(); } - void append(const std::string &); - void insert(unsigned, const std::string &); - void remove(unsigned); - void clear(); - unsigned get_n_items() const; + template + void set_item_type() { list.set_item_type(); } void set_selected_index(int); - const std::string &get_selected() const; - int get_selected_index() const; + int get_selected_index() const { return list.get_selected_index(); } private: - virtual void rebuild_special(const Part &, CachedPart &); + virtual void rebuild_special(const Part &); virtual void render_special(const Part &, GL::Renderer &) const; public: @@ -56,7 +64,7 @@ private: void list_autosize_changed(); void resize_list(); - void list_item_selected(unsigned, const std::string &); + void list_item_selected(unsigned); }; } // namespace GLtk