Main Page Widgets Namespaces Book

# Gtk::Button Class Reference
[Widgets]

Inheritance diagram for Gtk::Button:

[legend]
List of all members.

## Detailed Description

A widget that creates a signal when clicked on.

This widget is generally used with a signal handler that is called when the button is pressed. It can hold any valid child widget. The most commonly used child is the Gtk::Label.

Examples:

  book/buttons/button/buttons.h, and thread/dispatcher.cc.

## Public Member Functions

virtual | ~Button ()
GtkButton* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkButton* | gobj () const
| Provides access to the underlying C GtkObject.
| Button ()
| Create an empty button.
| Button (const Glib::ustring& label, bool mnemonic=false)
| Simple Push Button with label.
| Button (const StockID& stock_id)
void | pressed ()
void | released ()
void | clicked ()
void | enter ()
void | leave ()
void | set_relief (ReliefStyle newstyle)
ReliefStyle | get_relief () const
void | set_label (const Glib::ustring& label)
| Sets the text of the label of the button to str .
Glib::ustring | get_label () const
| Fetches the text from the label of the button, as set by set_label().
void | set_use_underline (bool use_underline=true)
| If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.
bool | get_use_underline () const
| Returns whether an embedded underline in the button label indicates a mnemonic.
void | set_use_stock (bool use_stock=true)
| If true, the label set on the button is used as a stock id to select the stock item for the button.
bool | get_use_stock () const
| Returns whether the button label is a stock item.
Glib::SignalProxy0<void> | signal_pressed ()
Glib::SignalProxy0<void> | signal_released ()
Glib::SignalProxy0<void> | signal_clicked ()
Glib::SignalProxy0<void> | signal_enter ()
Glib::SignalProxy0<void> | signal_leave ()
Glib::SignalProxy0<void> | signal_activate ()
Glib::PropertyProxy<Glib::ustring> | property_label ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<ReliefStyle> | property_relief ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> | property_use_underline ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> | property_use_stock ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.

## Protected Member Functions

virtual void | on_pressed ()
virtual void | on_released ()
virtual void | on_clicked ()
virtual void | on_enter ()
virtual void | on_leave ()
virtual void | on_activate ()

## Related Functions

(Note that these are not member functions.)
Gtk::Button* | wrap (GtkButton* object, bool take_copy=false)

## Constructor & Destructor Documentation

virtual Gtk::Button::~Button | ( |  | ) | `[virtual]`

Gtk::Button::Button | ( |  | ) |

| Create an empty button. With an empty button, you can Gtk::Button::add() a widget such as a Gtk::Pixmap or Gtk::Box. If you just wish to add a Gtk::Label, you may want to use the Gtk::Button(const Glib::ustring& label) ctor directly instead.

Gtk::Button::Button | ( | const Glib::ustring& | label,
|  | bool | mnemonic = false
| ) | `[explicit]`

| Simple Push Button with label. Create a button with the given label inside. You won't be able to add a widget in this button since it already has a Gtk::Label in it

Gtk::Button::Button | ( | const StockID& | stock_id | ) | `[explicit]`

## Member Function Documentation

void Gtk::Button::clicked | ( |  | ) |

void Gtk::Button::enter | ( |  | ) |

Glib::ustring Gtk::Button::get_label | ( |  | ) | const

Fetches the text from the label of the button, as set by set_label().

If the label text has not been set the return value will be `0`. This will be the case if you create an empty button with new() to use as a container.

Returns:
  The text of the label widget. This string is owned by the widget and must not be modified or freed.

ReliefStyle Gtk::Button::get_relief | ( |  | ) | const

bool Gtk::Button::get_use_stock | ( |  | ) | const

Returns whether the button label is a stock item.

Returns:
  `true` if the button label is used to select a stock item instead of being used directly as the label text.

bool Gtk::Button::get_use_underline | ( |  | ) | const

Returns whether an embedded underline in the button label indicates a mnemonic.

See set_use_underline().

Returns:
  `true` if an embedded underline in the button label indicates the mnemonic accelerator keys.

const GtkButton* Gtk::Button::gobj | ( |  | ) | const`[inline]`

| Provides access to the underlying C GtkObject. Reimplemented from Gtk::Bin. Reimplemented in Gtk::CheckButton, Gtk::OptionMenu, Gtk::RadioButton, and Gtk::ToggleButton.

GtkButton* Gtk::Button::gobj | ( |  | ) | `[inline]`

| Provides access to the underlying C GtkObject. Reimplemented from Gtk::Bin. Reimplemented in Gtk::CheckButton, Gtk::OptionMenu, Gtk::RadioButton, and Gtk::ToggleButton.

void Gtk::Button::leave | ( |  | ) |

virtual void Gtk::Button::on_activate | ( |  | ) | `[protected, virtual]`

virtual void Gtk::Button::on_clicked | ( |  | ) | `[protected, virtual]`

virtual void Gtk::Button::on_enter | ( |  | ) | `[protected, virtual]`

virtual void Gtk::Button::on_leave | ( |  | ) | `[protected, virtual]`

virtual void Gtk::Button::on_pressed | ( |  | ) | `[protected, virtual]`

virtual void Gtk::Button::on_released | ( |  | ) | `[protected, virtual]`

void Gtk::Button::pressed | ( |  | ) |

Glib::PropertyProxy<Glib::ustring> Gtk::Button::property_label | ( |  | ) |

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<ReliefStyle> Gtk::Button::property_relief | ( |  | ) |

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Button::property_use_stock | ( |  | ) |

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Button::property_use_underline | ( |  | ) |

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::Button::released | ( |  | ) |

void Gtk::Button::set_label | ( | const Glib::ustring& | label | ) |

Sets the text of the label of the button to str .

This text is also used to select the stock item if set_use_stock() is used.

This will also clear any previously set labels.

Parameters:

  label | A string.

void Gtk::Button::set_relief | ( | ReliefStyle | newstyle | ) |

void Gtk::Button::set_use_stock | ( | bool | use_stock = true | ) |

If true, the label set on the button is used as a stock id to select the stock item for the button.

Parameters:

  use_stock | `true` if the button should use a stock item.

void Gtk::Button::set_use_underline | ( | bool | use_underline = true | ) |

If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.

Parameters:

  use_underline | `true` if underlines in the text indicate mnemonics.

Glib::SignalProxy0<void> Gtk::Button::signal_activate | ( |  | ) |

Prototype:
  `void activate()`

Glib::SignalProxy0<void> Gtk::Button::signal_clicked | ( |  | ) |

Prototype:
  `void clicked()`

Glib::SignalProxy0<void> Gtk::Button::signal_enter | ( |  | ) |

Prototype:
  `void enter()`

Glib::SignalProxy0<void> Gtk::Button::signal_leave | ( |  | ) |

Prototype:
  `void leave()`

Glib::SignalProxy0<void> Gtk::Button::signal_pressed | ( |  | ) |

Prototype:
  `void pressed()`

Glib::SignalProxy0<void> Gtk::Button::signal_released | ( |  | ) |

Prototype:
  `void released()`

## Friends And Related Function Documentation

Gtk::Button* wrap | ( | GtkButton* | object,
|  | bool | take_copy = false
| ) | `[related]`

The documentation for this class was generated from the following file:

- button.h