# Gtk::ToolButton Class Reference
[Widgets]

A Gtk::ToolItem subclass that displays buttons. More...

Inherits Gtk::ToolItem.

Inherited by Gtk::MenuToolButton, and Gtk::ToggleToolButton.

Collaboration diagram for Gtk::ToolButton:
[legend]

List of all members.

## Public Member Functions

virtual | ~ToolButton ()
GtkToolButton* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkToolButton* | gobj () const
| Provides access to the underlying C GtkObject.
| ToolButton ()
| Creates a new ToolButton.
| ToolButton (const Gtk::StockID& stock_id)
| Creates a new ToolButton from a StockID.
| ToolButton (const Glib::ustring& label)
| Creates a new ToolButton with a label.
| ToolButton (Widget& icon_widget, const Glib::ustring& label=Glib::ustring())
| Creates a new ToolButton with an image.
void | set_label (const Glib::ustring& label)
| Sets label as the label used for the tool button.
Glib::ustring | get_label () const
| Returns the label used by the tool button, or `0` if the tool button doesn't have a label.
void | set_use_underline (bool use_underline=true)
| If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu.
bool | get_use_underline () const
| Returns whether underscores in the label property are used as mnemonics on menu items on the overflow menu.
void | set_stock_id (const Gtk::StockID& stock_id)
| Sets the name of the stock item.
Glib::ustring | get_stock_id () const
| Returns the name of the stock item.
void | set_icon_name (const Glib::ustring& icon_name)
| Sets the icon for the tool button from a named themed icon.
Glib::ustring | get_icon_name () const
| Returns the name of the themed icon for the tool button, see set_icon_name().
void | set_icon_widget (Widget& icon_widget)
| Sets icon as the widget used as icon on button.
Widget* | get_icon_widget ()
| Return the widget used as icon widget on button.
const Widget* | get_icon_widget () const
| Return the widget used as icon widget on button.
void | set_label_widget (Widget& label_widget)
| Sets label_widget as the widget that will be used as the label for button.
Widget* | get_label_widget ()
| Returns the widget used as label on button.
const Widget* | get_label_widget () const
| Returns the widget used as label on button.
Glib::SignalProxy0< void > | signal_clicked ()
| This signal is emitted when the tool button is clicked with the mouse or activated with the keyboard.
Glib::PropertyProxy < Glib::ustring > | property_label ()
| Text to show in the item.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_label () const
| Text to show in the item.
Glib::PropertyProxy< bool > | property_use_underline ()
| If set.
Glib::PropertyProxy_ReadOnly < bool > | property_use_underline () const
| If set.
Glib::PropertyProxy < Gtk::Widget* > | property_label_widget ()
| Widget to use as the item label.
Glib::PropertyProxy_ReadOnly < Gtk::Widget* > | property_label_widget () const
| Widget to use as the item label.
Glib::PropertyProxy < Glib::ustring > | property_stock_id ()
| The stock icon displayed on the item.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_stock_id () const
| The stock icon displayed on the item.
Glib::PropertyProxy< Gtk::Widget > | property_icon_widget ()
| Icon widget to display in the item.
Glib::PropertyProxy_ReadOnly < Gtk::Widget > | property_icon_widget () const
| Icon widget to display in the item.

## Protected Member Functions

virtual void | on_clicked ()

## Related Functions

(Note that these are not member functions.)
Gtk::ToolButton* | wrap (GtkToolButton* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A Gtk::ToolItem subclass that displays buttons.

A ToolButton is are Gtk::ToolItem containing a button.

## Constructor & Destructor Documentation

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

Gtk::ToolButton::ToolButton | ( |  | ) |

Creates a new ToolButton.

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

Creates a new ToolButton from a StockID.

The ToolButton will be created according to the stock_id properties.

Parameters:

  | stock_id | The StockID which determines the look of the ToolButton.

Gtk::ToolButton::ToolButton | ( | const Glib::ustring & | label | ) | `[explicit]`

Creates a new ToolButton with a label.

The ToolButton will have the label label.

Parameters:

  | label | The string used to display the label for this ToolButton.

Gtk::ToolButton::ToolButton | ( | Widget& | icon_widget,
|  | const Glib::ustring & | label = `Glib::ustring()` |
| ) |  |  | `[explicit]`

Creates a new ToolButton with an image.

The ToolButton will have the label label and an image widget icon_widget.

Parameters:

  | icon_widget | The widget placed as the ToolButton's icon.
  | label | The string used to display the label for this ToolButton.

## Member Function Documentation

Glib::ustring Gtk::ToolButton::get_icon_name | ( |  | ) | const

Returns the name of the themed icon for the tool button, see set_icon_name().

Since gtkmm 2.8:

Returns:
  The icon name or `0` if the tool button has no themed icon.

const Widget* Gtk::ToolButton::get_icon_widget | ( |  | ) | const

Return the widget used as icon widget on button.

See set_icon_widget().

Since gtkmm 2.4:

Returns:
  The widget used as icon on button, or `0`.

Widget* Gtk::ToolButton::get_icon_widget | ( |  | ) |

Return the widget used as icon widget on button.

See set_icon_widget().

Since gtkmm 2.4:

Returns:
  The widget used as icon on button, or `0`.

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

Returns the label used by the tool button, or `0` if the tool button doesn't have a label.

or uses a the label from a stock item. The returned string is owned by GTK+, and must not be modified or freed.

Since gtkmm 2.4:

Returns:
  The label, or `0`.

const Widget* Gtk::ToolButton::get_label_widget | ( |  | ) | const

Returns the widget used as label on button.

See set_label_widget().

Since gtkmm 2.4:

Returns:
  The widget used as label on button, or `0`.

Widget* Gtk::ToolButton::get_label_widget | ( |  | ) |

Returns the widget used as label on button.

See set_label_widget().

Since gtkmm 2.4:

Returns:
  The widget used as label on button, or `0`.

Glib::ustring Gtk::ToolButton::get_stock_id | ( |  | ) | const

Returns the name of the stock item.

See set_stock_id(). The returned string is owned by GTK+ and must not be freed or modifed.

Since gtkmm 2.4:

Returns:
  The name of the stock item for button.

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

Returns whether underscores in the label property are used as mnemonics on menu items on the overflow menu.

See set_use_underline().

Since gtkmm 2.4:

Returns:
  `true` if underscores in the label property are used as mnemonics on menu items on the overflow menu.

const GtkToolButton* Gtk::ToolButton::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::ToolItem.

Reimplemented in Gtk::MenuToolButton, Gtk::RadioToolButton, and Gtk::ToggleToolButton.

GtkToolButton* Gtk::ToolButton::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::ToolItem.

Reimplemented in Gtk::MenuToolButton, Gtk::RadioToolButton, and Gtk::ToggleToolButton.

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

Glib::PropertyProxy_ReadOnly<Gtk::Widget> Gtk::ToolButton::property_icon_widget | ( |  | ) | const

Icon widget to display in the item.

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<Gtk::Widget> Gtk::ToolButton::property_icon_widget | ( |  | ) |

Icon widget to display in the item.

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_ReadOnly<Glib::ustring> Gtk::ToolButton::property_label | ( |  | ) | const

Text to show in the item.

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<Glib::ustring> Gtk::ToolButton::property_label | ( |  | ) |

Text to show in the item.

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_ReadOnly<Gtk::Widget*> Gtk::ToolButton::property_label_widget | ( |  | ) | const

Widget to use as the item 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<Gtk::Widget*> Gtk::ToolButton::property_label_widget | ( |  | ) |

Widget to use as the item 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_ReadOnly<Glib::ustring> Gtk::ToolButton::property_stock_id | ( |  | ) | const

The stock icon displayed on the item.

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<Glib::ustring> Gtk::ToolButton::property_stock_id | ( |  | ) |

The stock icon displayed on the item.

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_ReadOnly<bool> Gtk::ToolButton::property_use_underline | ( |  | ) | const

If set.

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::ToolButton::property_use_underline | ( |  | ) |

If set.

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::ToolButton::set_icon_name | ( | const Glib::ustring & | icon_name | ) |

Sets the icon for the tool button from a named themed icon.

See the docs for Gtk::IconTheme for more details. The "icon_name" property only has an effect if not overridden by non-`0` "label", "icon_widget" and "stock_id" properties.

Since gtkmm 2.8:

Parameters:

  | icon_name | The name of the themed icon.

void Gtk::ToolButton::set_icon_widget | ( | Widget& | icon_widget | ) |

Sets icon as the widget used as icon on button.

If icon_widget is `0` the icon is determined by the "stock_id" property. If the "stock_id" property is also `0`, button will not have an icon.

Since gtkmm 2.4:

Parameters:

  | icon_widget | The widget used as icon, or `0`.

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

Sets label as the label used for the tool button.

The "label" property only has an effect if not overridden by a non-`0` "label_widget" property. If both the "label_widget" and "label" properties are `0`, the label is determined by the "stock_id" property. If the "stock_id" property is also `0`, button will not have a label.

Since gtkmm 2.4:

Parameters:

  | label | A string that will be used as label, or `0`.

void Gtk::ToolButton::set_label_widget | ( | Widget& | label_widget | ) |

Sets label_widget as the widget that will be used as the label for button.

If label_widget is `0` the "label" property is used as label. If "label" is also `0`, the label in the stock item determined by the "stock_id" property is used as label. If "stock_id" is also `0`, button does not have a label.

Since gtkmm 2.4:

Parameters:

  | label_widget | The widget used as label, or `0`.

void Gtk::ToolButton::set_stock_id | ( | const Gtk::StockID& | stock_id | ) |

Sets the name of the stock item.

See the ToolButton::ToolButton(const Gtk::StockID& stock_id, IconSize size) constructor. The stock_id property only has an effect if not overridden by "label" and "icon_widget" properties.

Since gtkmm 2.4:

Parameters:

  | stock_id | A name of a stock item, or `0`.

void Gtk::ToolButton::set_use_underline | ( | bool | use_underline = `true` | ) |

If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu.

For example, if the label property is "_Open" and use_underline is `true`, the label on the tool button will be "Open" and the item on the overflow menu will have an underlined 'O'.

Labels shown on tool buttons never have mnemonics on them; this property only affects the menu item on the overflow menu.

Since gtkmm 2.4:

Parameters:

  | use_underline | Whether the button label has the form "_Open".

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

This signal is emitted when the tool button is clicked with the mouse or activated with the keyboard.

Deprecated:
  This is an "action" key-binding signal that you should rarely need to use.

Prototype:
  `void on_my_clicked()`

## Friends And Related Function Documentation

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

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

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

- gtkmm/toolbutton.h