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;
82 std::vector<Item *> items;
92 virtual const char *get_class() const { return "list"; }
94 virtual void autosize();
96 void set_data(ListData &);
97 ListData &get_data() { return *data; }
98 const ListData &get_data() const { return *data; }
100 void items_changed();
102 virtual Item *create_item(unsigned);
105 void set_view_size(unsigned);
108 void set_selected_index(int);
109 int get_selected_index() const { return sel_index; }
112 virtual void render_special(const Part &, GL::Renderer &) const;
115 virtual void button_press(int, int, unsigned);
117 virtual void on_geometry_change();
118 virtual void on_style_change();
120 void reposition_slider();
121 void reposition_items();
122 void check_view_range();
123 void slider_value_changed(double);