Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class button

boost::ui::button — Widget with label that generate event when clicked on.

Synopsis

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


class button : public boost::ui::widget {
public:
  // construct/copy/destruct
  explicit button(widget &, const uistring &);
  button();

  // public member functions
  template<typename F, class ... Args> button & on_press(F &&, Args &&...);

  // private member functions
  void on_press_raw(const boost::function< void()> &);
};

Description

Usage example:

class button_dialog : public ui::dialog
{
public:
    button_dialog() : ui::dialog("Button usage dialog")
    {
        ui::button(*this, "&Press me")
            .on_press(&button_dialog::on_press_me, this);

        show_modal();
    }

private:
    void on_press_me()
    {
        ui::info_dialog("Hello");
    }
};

See Also:

Button (Wikipedia)

button public construct/copy/destruct

  1. explicit button(widget & parent, const uistring & label);
    Creates button with text label with mnemonics.

    See Also:

    Mnemonics (Wikipedia)

  2. button();

button public member functions

  1. template<typename F, class ... Args> 
      button & on_press(F && f, Args &&... args);
    Connects button press handler.

button private member functions

  1. void on_press_raw(const boost::function< void()> & handler);

PrevUpHomeNext