Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::ToolButton Class Reference

A GtkToolButton C++ wrapper class. More...

`#include <xfc/gtk/toolbutton.hh>`

Inheritance diagram for Xfc::Gtk::ToolButton:

List of all members.

## Signal Prototypes

- const ClickedSignalType clicked_signal
    Clicked signal (see signal_clicked()).

## Public Member Functions

Constructors

- ToolButton ()
    Constructs an empty tool button.
- ToolButton (Widget &icon_widget)
    Constructs a new tool button using icon_widget as the icon.
- ToolButton (const String &label, bool use_underline=false)
    Constructs a new tool button using label as the label.
- ToolButton (Widget &icon_widget, const String &label, bool use_underline=false)
    Constructs a new tool button using icon_widget as the icon and label as the label.
- ToolButton (const StockId &stock_id)
    Constructs a new tool button containing the image and text from a stock item.
- virtual ~ToolButton ()
    Destructor.

Accessors

- GtkToolButton * gtk_tool_button () const
    Get a pointer to the GtkToolButton structure.
- operator GtkToolButton * () const
    Conversion operator; safely converts an ToolButton to a GtkToolButton pointer.
- String get_label () const
    Gets the label used by the tool button, or a null String if the tool button doesn't have a label, or uses the label from a stock item.
- bool get_use_underline () const
    Determines whether underscores in the label property are used as mnemonics on menu items on the overflow menu (see set_use_underline()).
- String get_stock_id () const
    Determines the ID of the stock item (see set_stock_id()).
- Widget * get_icon_widget () const
    Gets the widget used as the icon widget the button, or null.
- Widget * get_label_widget () const
    Gets the the widget used as label on the button (see set_label_widget()).

Methods

- void set_label (const String &label, bool use_underline=false)
    Sets label as the label used for the tool button.
- void set_use_underline (bool use_underline)
    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.
- void set_stock_id (const StockId &stock_id)
    Sets the ID of the stock item.
- void set_icon_widget (Widget *icon_widget)
    Sets icon_widget as the widget used as the icon on the button.
- void set_label_widget (Widget *label_widget)
    Sets label_widget as the widget used as the label for the button.
- void set_contents (Widget &icon_widget, const String &label, bool use_underline=false)
    Sets icon_widget as the widget used as the icon and label as the label used for the tool button.

Signal Proxies

- const ClickedSignalProxy signal_clicked ()
    Connect to the clicked_signal; emitted when the tool button is clicked with the mouse or activated with the keyboard.

## Protected Member Functions

Constructors

- ToolButton (GtkToolButton *tool_button, bool owns_reference=false)
    Construct a new ToolButton from an existing GtkToolButton.

## Detailed Description

A GtkToolButton C++ wrapper class.

ToolButton is a ToolItem that contains a button. A ToolButton can be constructed using a custom icon widget or a stock item.

The label of a ToolButton is determined by the properties "label_widget", "label", and "stock_id". If "label_widget" is set, then that widget is used as the label. Otherwise, if "label" is set, that string is used as the label. Otherwise, if "stock_id" is set, the label is determined by the stock item. Otherwise, the button does not have a label.

The icon of a ToolButton is determined by the properties "icon_widget" and "stock_id". If "icon_widget" is set, then that widget is used as the icon. Otherwise, if "stock_id" is set, the icon is determined by the stock item. Otherwise, the button does not have an icon.

See also: the ToolItems HOWTO.

## Constructor & Destructor Documentation

Xfc::Gtk::ToolButton::ToolButton | ( | GtkToolButton * | tool_button,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

  | Construct a new ToolButton from an existing GtkToolButton. Parameters:
  | tool_button | A pointer to a GtkToolButton.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.
The tool_button can be a newly created GtkToolButton or an existing GtkToolButton (see G::Object::Object).

Xfc::Gtk::ToolButton::ToolButton | ( | Widget & | icon_widget | ) |

  | Constructs a new tool button using icon_widget as the icon. Parameters:
  | icon_widget | A widget that will be used as the icon widget.

Xfc::Gtk::ToolButton::ToolButton | ( | const String & | label,
|  | bool | use_underline = `false`
| ) |

  | Constructs a new tool button using label as the label. Parameters:
  | label | A string that will be used as the label.
  | use_underline | Whether the button label has the mnemonic form "_Open".

Xfc::Gtk::ToolButton::ToolButton | ( | Widget & | icon_widget,
|  | const String & | label,
|  | bool | use_underline = `false`
| ) |

  | Constructs a new tool button using icon_widget as the icon and label as the label. Parameters:
  | icon_widget | A widget that will be used as the icon widget.
  | label | A string that will be used as the label.
  | use_underline | Whether the button label has the mnemonic form "_Open".

Xfc::Gtk::ToolButton::ToolButton | ( | const StockId & | stock_id | ) |

  | Constructs a new tool button containing the image and text from a stock item. Parameters:
  | stock_id | The ID of the stock item (see set_stock_id()).
It is an error if stock_id is not a name of a stock item.

## Member Function Documentation

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

| Gets the widget used as the icon widget the button, or null. Returns: The widget used as the icon on the button, or null.

String Xfc::Gtk::ToolButton::get_label | ( |  | ) | const

| Gets the label used by the tool button, or a null String if the tool button doesn't have a label, or uses the label from a stock item. Returns: The label, or a null String.

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

| Gets the the widget used as label on the button (see set_label_widget()). Returns: The widget used as the label on the button, or null.

String Xfc::Gtk::ToolButton::get_stock_id | ( |  | ) | const

| Determines the ID of the stock item (see set_stock_id()). Returns: The ID of the stock item for the button.

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

| Determines whether underscores in the label property are used as mnemonics on menu items on the overflow menu (see set_use_underline()). Returns: true if underscores in the label property are used as mnemonics.

void Xfc::Gtk::ToolButton::set_contents | ( | Widget & | icon_widget,
|  | const String & | label,
|  | bool | use_underline = `false`
| ) |

  | Sets icon_widget as the widget used as the icon and label as the label used for the tool button. Parameters:
  | icon_widget | The widget used as the icon.
  | label | A string that will be used as label, or null.
  | use_underline | Whether the button label has the mnemonic form "_Open"
This convenience method is equivalent to calling set_icon_widget() and set_label() separately. It also calls show() on the icon_widget.

void Xfc::Gtk::ToolButton::set_icon_widget | ( | Widget * | icon_widget | ) |

  | Sets icon_widget as the widget used as the icon on the button. Parameters:
  | icon_widget | The widget used as the icon, or null.
If icon_widget is null the icon is determined by the 'stock_id' property. If the 'stock_id' property is also null, the button will not have an icon.

void Xfc::Gtk::ToolButton::set_label | ( | const String & | label,
|  | bool | use_underline = `false`
| ) |

  | Sets label as the label used for the tool button. Parameters:
  | label | A string that will be used as label, or null.
  | use_underline | Whether the button label has the mnemonic form "_Open"
This method sets the 'label' property. The label property only has an effect if not overridden by a non-null 'label_widget' property. If both the 'label_widget' and 'label' properties are null, the label is determined by the 'stock_id' property. If the 'stock_id' property is also null, the button will not have a label.

void Xfc::Gtk::ToolButton::set_label_widget | ( | Widget * | label_widget | ) |

  | Sets label_widget as the widget used as the label for the button. Parameters:
  | label_widget | The widget used as the label, or null.
If label_widget is null the 'label' property is used as the label. If 'label' is also null, the label in the stock item determined by the 'stock_id' property is used as the label. If 'stock_id' is also null, the button does not have a label.

void Xfc::Gtk::ToolButton::set_stock_id | ( | const StockId & | stock_id | ) |

  | Sets the ID of the stock item. Parameters:
  | stock_id | The ID of the stock item (such as Gtk::Stock::OK and Gtk::Stock::APPLY).
The 'stock_id' property only has an effect if not overridden by non-null 'label' and 'icon_widget' properties.

void Xfc::Gtk::ToolButton::set_use_underline | ( | bool | use_underline | ) |

  | 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. Parameters:
  | use_underline | Whether the button label has the mnemonic form "_Open"
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.

## Member Data Documentation

const ClickedSignalType Xfc::Gtk::ToolButton::clicked_signal`[static, protected]`

| Clicked signal (see signal_clicked()). Calls a slot with the signature:
                 void function();

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

- toolbutton.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3