Home | Libraries | People | FAQ | More |
boost::ui::list_box — Widget to select one or more strings.
// In header: <boost/ui/list_box.hpp> class list_box : public boost::ui::strings_box { public: // construct/copy/destruct explicit list_box(widget &); explicit list_box(widget &, const std::vector< uistring > &); template<typename Iterator> explicit list_box(widget &, Iterator, Iterator); template<typename Range> explicit list_box(widget &, const Range &); template<typename T> explicit list_box(widget &, std::initializer_list< T >); list_box(); // public member functions bool has_selection() const; size_type selected_index() const; uistring selected_string() const; // private member functions void on_select_raw(const boost::function< void()> &); void on_select_event_raw(const boost::function< void(index_event &)> &); void on_activate_raw(const boost::function< void()> &); void on_activate_event_raw(const boost::function< void(index_event &)> &); detail_impl * get_impl(); const detail_impl * get_impl() const; };
Usage example:
ui::list_box list_box = ui::list_box(parent, { "Option 1", "Option 2", "Option 3" }) .on_select_event([&](ui::index_event& e) { ui::log::info() << "Selected option index: " << e.index(); }) .on_activate_event([&](ui::index_event& e) { ui::log::info() << "Activated option index: " << e.index(); }) ;
See Also:
list_box
public
construct/copy/destructexplicit list_box(widget & parent);Creates empty
list_box
widget. explicit list_box(widget & parent, const std::vector< uistring > & options);Creates
list_box
widget with options. template<typename Iterator> explicit list_box(widget & parent, Iterator first, Iterator last);Creates
list_box
widget with options. template<typename Range> explicit list_box(widget & parent, const Range & r);Creates
list_box
widget with options. template<typename T> explicit list_box(widget & parent, std::initializer_list< T > list);Creates
list_box
widget with options. list_box();
list_box
private member functionsvoid on_select_raw(const boost::function< void()> & handler);
void on_select_event_raw(const boost::function< void(index_event &)> & handler);
void on_activate_raw(const boost::function< void()> & handler);
void on_activate_event_raw(const boost::function< void(index_event &)> & handler);
detail_impl * get_impl();
const detail_impl * get_impl() const;