3 This file is part of libmspgltk
4 Copyright © 2007-2011 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_GLTK_LIST_H_
9 #define MSP_GLTK_LIST_H_
11 #include <sigc++/signal.h>
12 #include "container.h"
19 Shows a list of items, allowing the user to select one. A slider is included
20 to allow scrolling through a long list.
22 class List: virtual public Widget, private Container
25 class Loader: public Widget::Loader
30 void item(const std::string &);
33 sigc::signal<void, unsigned, const std::string &> signal_item_selected;
36 std::vector<std::string> items;
42 const Part *items_part;
49 virtual const char *get_class() const { return "list"; }
51 virtual void autosize();
53 void append(const std::string &);
54 void insert(unsigned, const std::string &);
55 void remove(unsigned);
57 unsigned get_n_items() const { return items.size(); }
59 void set_selected_index(int);
60 const std::string &get_selected() const;
61 int get_selected_index() const { return sel_index; }
64 virtual void render_special(const Part &) const;
67 virtual void button_press(int, int, unsigned);
69 virtual void on_geometry_change();
70 virtual void on_style_change();
72 void reposition_slider();
73 void check_view_range();
74 void slider_value_changed(double);