Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class combo_box

boost::ui::combo_box — Widget to select one or more strings and edit it.

Synopsis

// In header: <boost/ui/combo_box.hpp>


class combo_box : public boost::ui::strings_box {
public:
  // construct/copy/destruct
  explicit combo_box(widget &);
  explicit combo_box(widget &, const uistring &);
  explicit combo_box(widget &, const std::vector< uistring > &);
  template<typename Iterator> explicit combo_box(widget &, Iterator, Iterator);
  template<typename Range> explicit combo_box(widget &, const Range &);
  template<typename T> 
    explicit combo_box(widget &, std::initializer_list< T >);
  explicit combo_box(widget &, const uistring &, 
                     const std::vector< uistring > &);
  template<typename Range> 
    explicit combo_box(widget &, const uistring &, const Range &);
  template<typename T> 
    explicit combo_box(widget &, const uistring &, std::initializer_list< T >);
  combo_box();

  // public member functions
  combo_box & text(const uistring &);
  uistring text() 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;
};

Description

Usage example:

ui::combo_box combo_box = ui::combo_box(parent,
    "Initial text",
    { "Option 1", "Option 2", "Option 3" })
    .on_select_event([&](ui::index_event& e)
    {
        ui::log::info() << "Selected option index: " << e.index()
                        << ", text: "                << combo_box.text();
    });

See Also:

Combo box (Wikipedia)

combo_box public construct/copy/destruct

  1. explicit combo_box(widget & parent);
    Creates empty combo box widget.
  2. explicit combo_box(widget & parent, const uistring & text);
    Creates combo box widget without options and with initial text.
  3. explicit combo_box(widget & parent, const std::vector< uistring > & options);
    Creates combo box widget with options and without initial text.
  4. template<typename Iterator> 
      explicit combo_box(widget & parent, Iterator first, Iterator last);
    Creates combo box widget with options and without initial text.
  5. template<typename Range> explicit combo_box(widget & parent, const Range & r);
    Creates combo box widget with options and without initial text.
  6. template<typename T> 
      explicit combo_box(widget & parent, std::initializer_list< T > list);
    Creates combo box widget with options and without initial text.
  7. explicit combo_box(widget & parent, const uistring & text, 
                       const std::vector< uistring > & options);
    Creates combo_box widget with options and initial text.
  8. template<typename Range> 
      explicit combo_box(widget & parent, const uistring & text, const Range & r);
    Creates combo_box widget with options and initial text.
  9. template<typename T> 
      explicit combo_box(widget & parent, const uistring & text, 
                         std::initializer_list< T > list);
    Creates combo_box widget with options and initial text.
  10. combo_box();

combo_box public member functions

  1. combo_box & text(const uistring & txt);
    Sets text into the editor.
  2. uistring text() const;
    Returns text from the editor.

combo_box private member functions

  1. void on_select_raw(const boost::function< void()> & handler);
  2. void on_select_event_raw(const boost::function< void(index_event &)> & handler);
  3. detail_impl * get_impl();
  4. const detail_impl * get_impl() const;

PrevUpHomeNext