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"; }
51 virtual void autosize_special(const Part &, Geometry &);
53 void set_active(bool);
55 virtual void render_special(const Part &, GL::Renderer &) const;
59 class BasicItem: public Item
65 BasicItem(const std::string &);
68 virtual void on_style_change();
72 sigc::signal<void, unsigned> signal_item_selected;
77 DataObserver *observer;
84 std::vector<Item *> items;
94 virtual const char *get_class() const { return "list"; }
97 virtual void autosize_special(const Part &, Geometry &);
100 void set_data(ListData &);
101 ListData &get_data() { return *data; }
102 const ListData &get_data() const { return *data; }
104 void items_changed();
106 virtual Item *create_item(unsigned);
109 void set_view_size(unsigned);
112 void set_selected_index(int);
113 int get_selected_index() const { return sel_index; }
116 virtual void render_special(const Part &, GL::Renderer &) const;
119 virtual void button_press(int, int, unsigned);
121 virtual void on_geometry_change();
122 virtual void on_style_change();
124 void reposition_slider();
125 void reposition_items();
126 void check_view_range();
127 void slider_value_changed(double);