Home | Libraries | People | FAQ | More |
boost::ui::choice — Widget to select string from popup list of strings.
// In header: <boost/ui/choice.hpp> class choice : public boost::ui::strings_box { public: // construct/copy/destruct explicit choice(widget &); explicit choice(widget &, const std::vector< uistring > &); template<typename Iterator> explicit choice(widget &, Iterator, Iterator); template<typename Range> explicit choice(widget &, const Range &); template<typename T> explicit choice(widget &, std::initializer_list< T >); choice(); // public member functions uistring text() const; index_type current_selection_index() const; // private member functions void on_select_raw(const boost::function< void()> &); void on_select_event_raw(const boost::function< void(index_event &)> &); detail_impl * get_impl(); const detail_impl * get_impl() const; };
Usage example:
ui::choice choice = ui::choice(parent, { "Option 1", "Option 2", "Option 3" }) .on_select_event([&](ui::index_event& e) { ui::log::info() << "Selected option index: " << e.index() << ", text: " << choice.text(); });
See Also:
choice
public
construct/copy/destructexplicit choice(widget & parent);Creates empty choice widget.
explicit choice(widget & parent, const std::vector< uistring > & options);Creates choice widget with options.
template<typename Iterator> explicit choice(widget & parent, Iterator first, Iterator last);Creates choice widget with options.
template<typename Range> explicit choice(widget & parent, const Range & r);Creates choice widget with options.
template<typename T> explicit choice(widget & parent, std::initializer_list< T > list);Creates choice widget with options.
choice();
choice
public member functionsuistring text() const;Returns text that is associated this widget.
index_type current_selection_index() const;Returns index of the selected text item. If widget has no items then returns npos.
choice
private member functionsvoid on_select_raw(const boost::function< void()> & handler);
void on_select_event_raw(const boost::function< void(index_event &)> & handler);
detail_impl * get_impl();
const detail_impl * get_impl() const;