1 #ifndef MSP_GLTK_LIST_H_
2 #define MSP_GLTK_LIST_H_
4 #include <sigc++/signal.h>
14 Shows a list of items, allowing the user to select one. A slider is included
15 to allow scrolling through a long list.
17 class List: virtual public Widget, private Container
20 class Loader: public DataFile::DerivedObjectLoader<List, Widget::Loader>
25 void item(const std::string &);
29 /// This exists to make disconnecting signals easier
30 class DataObserver: public sigc::trackable
38 void item_added(unsigned);
39 void item_removed(unsigned);
41 void refresh_strings();
45 class Item: public Container
48 virtual const char *get_class() const { return "listitem"; }
50 virtual void autosize();
51 void set_active(bool);
53 virtual void render_special(const Part &, GL::Renderer &) const;
57 class BasicItem: public Item
63 BasicItem(const std::string &);
66 virtual void on_style_change();
70 sigc::signal<void, unsigned> signal_item_selected;
75 DataObserver *observer;
81 std::vector<Item *> items;
91 virtual const char *get_class() const { return "list"; }
93 virtual void autosize();
94 void autosize_rows(unsigned);
97 void set_data(ListData &);
98 ListData &get_data() { return *data; }
99 const ListData &get_data() const { return *data; }
101 void items_changed();
103 virtual Item *create_item(unsigned);
106 void set_selected_index(int);
107 int get_selected_index() const { return sel_index; }
110 virtual void render_special(const Part &, GL::Renderer &) const;
113 virtual void button_press(int, int, unsigned);
115 virtual void on_geometry_change();
116 virtual void on_style_change();
118 void reposition_slider();
119 void reposition_items();
120 void check_view_range();
121 void slider_value_changed(double);