Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::Toolbar Class Reference

A GtkToolbar C++ wrapper class. More...

`#include <inti/gtk/toolbar.h>`

Inheritance diagram for Inti::Gtk::Toolbar:

List of all members.

## Public Member Functions

Constructors

- Toolbar (Orientation orientation=ORIENTATION_HORIZONTAL, ToolbarStyle style=TOOLBAR_ICONS)
    Constrcut a new toolbar.
- virtual ~Toolbar ()
    Destructor.

Accessors

- GtkToolbar * gtk_toolbar () const
    Get a pointer to the GtkToolbar structure.
- GtkToolbarClass * gtk_toolbar_class () const
    Get a pointer to the GtkToolbarClass structure.
- operator GtkToolbar * () const
    Conversion operator; safely converts a Toolbar to a GtkToolbar pointer.
- bool children (std::vector< ToolbarChild * > &child_list) const
    Retrieves the list of the toolbar's children.
- Orientation get_orientation () const
    Returns the current orientation of the toolbar (see set_orientation()).
- ToolbarStyle get_style () const
    Retrieves whether the toolbar has text, icons, or both (see set_style()).
- IconSize get_icon_size () const
    Returns the current icon size for the icons on the toolbar (see set_icon_size()).
- bool get_tooltips () const
    Returns true if tooltips are enabled (see set_tooltips()).

Methods

- Button * append_button (const String &text, Widget *icon, const Slot0< void > *callback, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Adds a new button to the end (right or bottom edges) of the toolbar.
- Button * prepend_button (const String &text, Widget *icon, const Slot0< void > *callback, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Adds a new button to the beginning (left or top edges) of the toolbar.
- Button * insert_button (const String &text, Widget *icon, const Slot0< void > *callback, int position, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Inserts a new button into the toolbar at the specified position.
- ToggleButton * append_toggle_button (const String &text, Widget *icon, const Slot0< void > *callback, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Adds a new toggle button to the end (right or bottom edges) of the toolbar.
- ToggleButton * prepend_toggle_button (const String &text, Widget *icon, const Slot0< void > *callback, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Adds a new toggle button to the beginning (left or top edges) of the toolbar.
- ToggleButton * insert_toggle_button (const String &text, Widget *icon, const Slot0< void > *callback, int position, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Inserts a new toggle button into the toolbar at the specified position.
- RadioButton * append_radio_button (const RadioButton *group, const String &text, Widget *icon, const Slot0< void > *callback, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Adds a new radio button to the end (right or bottom edges) of the toolbar.
- RadioButton * prepend_radio_button (const RadioButton *group, const String &text, Widget *icon, const Slot0< void > *callback, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Adds a new radio button to the beginning (left or top edges) of the toolbar.
- RadioButton * insert_radio_button (const RadioButton *group, const String &text, Widget *icon, const Slot0< void > *callback, int position, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Inserts a new radio button into the toolbar at the specified position.
- Button * append_stock (const char *stock_id, const Slot0< void > *callback, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Adds a stock button to the end (right or bottom edges) of the toolbar.
- Button * prepend_stock (const char *stock_id, const Slot0< void > *callback, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Adds a stock button to the beginning (left or top edges) of the toolbar.
- Button * insert_stock (const char *stock_id, const Slot0< void > *callback, int position, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Inserts a new stock button into the toolbar at the specified position.
- void append_space ()
    Adds a new space to the end of the toolbar.
- void prepend_space ()
    Adds a new space to the beginning of the toolbar.
- void insert_space (int position)
    Inserts a new space into the toolbar at the specified position.
- void remove_space (int position)
    Removes the space at the specified position.
- void append_widget (Widget &widget, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Adds a widget to the end (right or bottom edges) of the toolbar.
- void prepend_widget (Widget &widget, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Adds a widget to the beginning (left or top edges) of the toolbar.
- void insert_widget (Widget &widget, int position, const String &tooltip_text=0, const String &tooltip_private_text=0)
    Inserts a widget into the toolbar at the specified position.
- void set_orientation (Orientation orientation)
    Sets whether a toolbar should appear horizontally or vertically.
- void set_style (ToolbarStyle style)
    Alters the view of toolbar to display either icons only, text only, or both.
- void set_icon_size (IconSize icon_size)
    Sets the size of stock icons in the toolbar.
- void set_tooltips (bool enable)
    Sets if the tooltips of a toolbar should be active or not.
- void unset_style ()
    Unsets the toolbar style set with set_style(), so that user preferences will be used to determine the toolbar style.
- void unset_icon_size ()
    Unsets the toolbar icon size set with set_icon_size(), so that user preferences will be used to determine the icon size.

Property Proxies

- const OrientationPropertyProxy prop_orientation ()
    The orientation of the toolbar (Orientation : Read / Write).
- const ToolbarStylePropertyProxy prop_toolbar_style ()
    How to draw the toolbar (ToolbarStyle : Read / Write).

Signal Proxies

- const OrientationChangedSignalProxy sig_orientation_changed ()
    Connect to the orientation_changed_signal; emitted when the orientation of a toolbar is changed.
- const StyleChangedSignalProxy sig_style_changed ()
    Connect to the style_changed_signal; emitted when ever the style of a toolbar is adjusted.

## Protected Member Functions

Constructors

- Toolbar (GtkToolbar *toolbar, bool reference=false)
    Construct a new Toolbar from an existing GtkToolbar.

Signal Handlers

- virtual void on_orientation_changed (Orientation orientation)
    Called when the orientation of a toolbar is changed.
- virtual void on_style_changed (ToolbarStyle style)
    Called when ever the style of a toolbar is adjusted.

## Detailed Description

A GtkToolbar C++ wrapper class.

After constructing an empty toolbar, buttons with text and/or images are added with append_button(), prepend_button(), and insert_button(). There are similar methods for adding ToggleButtons and RadioButtons. An arbitrary widget can be added to the toolbar with append_widget(), prepend_widget(), and insert_widget(). Widgets can be visibly grouped by adding gaps between widgets using append_space(), prepend_space(), and insert_space().

## Constructor & Destructor Documentation

Inti::Gtk::Toolbar::Toolbar | ( | GtkToolbar * | toolbar,
|  | bool | reference = false
| ) | `[explicit, protected]`

Construct a new Toolbar from an existing GtkToolbar.

Parameters:

  toolbar | A pointer to a GtkToolbar.
  reference | Set false if the initial reference count is floating, set true if it's not.

The toolbar can be a newly created GtkToolbar or an existing GtkToolbar (see G::Object::Object).

Inti::Gtk::Toolbar::Toolbar | ( | Orientation | orientation = ORIENTATION_HORIZONTAL,
|  | ToolbarStyle | style = TOOLBAR_ICONS
| ) | `[explicit]`

Constrcut a new toolbar.

Parameters:

  orientation | The Orientation, either horizontal or vertical.
  style | The style for the toolbar.

## Member Function Documentation

Button* Inti::Gtk::Toolbar::append_button | ( | const String & | text,
|  | Widget * | icon,
|  | const Slot0< void > * | callback,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Adds a new button to the end (right or bottom edges) of the toolbar.

Parameters:

  text | The toolbar button label.
  icon | A Widget that should be used as the button's icon.
  callback | The slot to call when the button is pressed.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new button added to the toolbar; you can ignore this value if you want.

RadioButton* Inti::Gtk::Toolbar::append_radio_button | ( | const RadioButton * | group,
|  | const String & | text,
|  | Widget * | icon,
|  | const Slot0< void > * | callback,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Adds a new radio button to the end (right or bottom edges) of the toolbar.

Parameters:

  group | The radio button whose group this radio button should be added to, or null.
  text | The toolbar button label.
  icon | A Widget that should be used as the button's icon.
  callback | The slot to call when the button is pressed.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new radio button added to the toolbar.

The group argument should be null for the first radio button in a group. Then for subsequent radio buttons in the same group, the return value from the first or previous call to this method is passed as the group argument for the next call.

Button* Inti::Gtk::Toolbar::append_stock | ( | const char * | stock_id,
|  | const Slot0< void > * | callback,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Adds a stock button to the end (right or bottom edges) of the toolbar.

Parameters:

  stock_id | The GTK+ stock identifier, such as GTK_STOCK_OPEN or GTK_STOCK_EXIT.
  callback | The slot to call when the button is pressed.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new button added to the toolbar; you can ignore this value if you want.

ToggleButton* Inti::Gtk::Toolbar::append_toggle_button | ( | const String & | text,
|  | Widget * | icon,
|  | const Slot0< void > * | callback,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Adds a new toggle button to the end (right or bottom edges) of the toolbar.

Parameters:

  text | The toolbar button label.
  icon | A Widget that should be used as the button's icon.
  callback | The slot to call when the button is pressed.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new toggle button added to the toolbar; you can ignore this value if you want.

void Inti::Gtk::Toolbar::append_widget | ( | Widget & | widget,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Adds a widget to the end (right or bottom edges) of the toolbar.

Parameters:

  widget | The Widget to add.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

bool Inti::Gtk::Toolbar::children | ( | std::vector< ToolbarChild * > & | child_list | ) | const

Retrieves the list of the toolbar's children.

Parameters:

  child_list | A reference to a vector of ToolbarChild* to hold the child list.

Returns:
  true if child_list is not empty.

ToolbarStyle Inti::Gtk::Toolbar::get_style | ( |  | ) | const

Retrieves whether the toolbar has text, icons, or both (see set_style()).

Returns:
  The current style of the toolbar.

Reimplemented from Inti::Gtk::Widget.

Button* Inti::Gtk::Toolbar::insert_button | ( | const String & | text,
|  | Widget * | icon,
|  | const Slot0< void > * | callback,
|  | int | position,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Inserts a new button into the toolbar at the specified position.

Parameters:

  text | The toolbar button label.
  icon | A Widget that should be used as the button's icon.
  callback | The slot to call when the button is pressed.
  position | The number of widgets to insert this item after.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new button added to the toolbar; you can ignore this value if you want.

RadioButton* Inti::Gtk::Toolbar::insert_radio_button | ( | const RadioButton * | group,
|  | const String & | text,
|  | Widget * | icon,
|  | const Slot0< void > * | callback,
|  | int | position,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Inserts a new radio button into the toolbar at the specified position.

Parameters:

  group | The radio button whose group this radio button should be added to, or null.
  text | The toolbar button label.
  icon | A Widget that should be used as the button's icon.
  callback | The slot to call when the button is pressed.
  position | The number of widgets to insert this item after.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new radio button added to the toolbar.

The group argument should be null for the first radio button in a group. Then for subsequent radio buttons in the same group, the return value from the first or previous call to this method is passed as the group argument for the next call.

void Inti::Gtk::Toolbar::insert_space | ( | int | position | ) |

Inserts a new space into the toolbar at the specified position.

Parameters:

  position | The number of widgets to insert the space after.

Button* Inti::Gtk::Toolbar::insert_stock | ( | const char * | stock_id,
|  | const Slot0< void > * | callback,
|  | int | position,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Inserts a new stock button into the toolbar at the specified position.

Parameters:

  stock_id | The GTK+ stock identifier, such as GTK_STOCK_OPEN or GTK_STOCK_EXIT.
  callback | The slot to call when the button is pressed.
  position | The number of widgets to insert this item after.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new button added to the toolbar; you can ignore this value if you want.

ToggleButton* Inti::Gtk::Toolbar::insert_toggle_button | ( | const String & | text,
|  | Widget * | icon,
|  | const Slot0< void > * | callback,
|  | int | position,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Inserts a new toggle button into the toolbar at the specified position.

Parameters:

  text | The toolbar button label.
  icon | A Widget that should be used as the button's icon.
  callback | The slot to call when the button is pressed.
  position | The number of widgets to insert this item after.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new toggle button added to the toolbar; you can ignore this value if you want.

void Inti::Gtk::Toolbar::insert_widget | ( | Widget & | widget,
|  | int | position,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Inserts a widget into the toolbar at the specified position.

Parameters:

  widget | The Widget to add.
  position | The number of widgets to insert the Widget after.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

virtual void Inti::Gtk::Toolbar::on_orientation_changed | ( | Orientation | orientation | ) | `[protected, virtual]`

Called when the orientation of a toolbar is changed.

Parameters:

  orientation | The new Orientation of the toolbar.

virtual void Inti::Gtk::Toolbar::on_style_changed | ( | ToolbarStyle | style | ) | `[protected, virtual]`

Called when ever the style of a toolbar is adjusted.

Parameters:

  style | The new ToolbarStyle of toolbar.

For example, this would be a useful signal to connect to if you want to display more items on the toolbar when it is in icon-only mode; each item takes less space on the bar.

Button* Inti::Gtk::Toolbar::prepend_button | ( | const String & | text,
|  | Widget * | icon,
|  | const Slot0< void > * | callback,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Adds a new button to the beginning (left or top edges) of the toolbar.

Parameters:

  text | The toolbar button label.
  icon | A Widget that should be used as the button's icon.
  callback | The slot to call when the button is pressed.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new button added to the toolbar; you can ignore this value if you want.

RadioButton* Inti::Gtk::Toolbar::prepend_radio_button | ( | const RadioButton * | group,
|  | const String & | text,
|  | Widget * | icon,
|  | const Slot0< void > * | callback,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Adds a new radio button to the beginning (left or top edges) of the toolbar.

Parameters:

  group | The radio button whose group this radio button should be added to, or null.
  text | The toolbar button label.
  icon | A Widget that should be used as the button's icon.
  callback | The slot to call when the button is pressed.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new radio button added to the toolbar.

The group argument should be null for the first radio button in a group. Then for subsequent radio buttons in the same group, the return value from the first or previous call to this method is passed as the group argument for the next call.

Button* Inti::Gtk::Toolbar::prepend_stock | ( | const char * | stock_id,
|  | const Slot0< void > * | callback,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Adds a stock button to the beginning (left or top edges) of the toolbar.

Parameters:

  stock_id | The GTK+ stock identifier, such as GTK_STOCK_OPEN or GTK_STOCK_EXIT.
  callback | The slot to call when the button is pressed.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new button added to the toolbar; you can ignore this value if you want.

ToggleButton* Inti::Gtk::Toolbar::prepend_toggle_button | ( | const String & | text,
|  | Widget * | icon,
|  | const Slot0< void > * | callback,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Adds a new toggle button to the beginning (left or top edges) of the toolbar.

Parameters:

  text | The toolbar button label.
  icon | A Widget that should be used as the button's icon.
  callback | The slot to call when the button is pressed.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

Returns:
  The new toggle button added to the toolbar; you can ignore this value if you want.

void Inti::Gtk::Toolbar::prepend_widget | ( | Widget & | widget,
|  | const String & | tooltip_text = 0,
|  | const String & | tooltip_private_text = 0
| ) |

Adds a widget to the beginning (left or top edges) of the toolbar.

Parameters:

  widget | The Widget to add.
  tooltip_text | A string that appears when the user holds the mouse over this item.
  tooltip_private_text | The private text of the tooltip.

void Inti::Gtk::Toolbar::set_icon_size | ( | IconSize | icon_size | ) |

Sets the size of stock icons in the toolbar.

Parameters:

  icon_size | The IconSize that stock icons in the toolbar shall have.

You can call this method either before you add the icons or after they've been added. The size you set will override user preferences for the default icon size.

void Inti::Gtk::Toolbar::set_orientation | ( | Orientation | orientation | ) |

Sets whether a toolbar should appear horizontally or vertically.

Parameters:

  orientation | The new Orientation.

void Inti::Gtk::Toolbar::set_style | ( | ToolbarStyle | style | ) |

Alters the view of toolbar to display either icons only, text only, or both.

Parameters:

  style | The new style for the toolbar.

void Inti::Gtk::Toolbar::set_tooltips | ( | bool | enable | ) |

Sets if the tooltips of a toolbar should be active or not.

Parameters:

  enable | Set to false to disable the tooltips, or true to enable them.

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

- toolbar.h

Main Page - Footer