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

# Xfc::Gtk::Toolbar Class Reference

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

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

Inheritance diagram for Xfc::Gtk::Toolbar:

List of all members.

## Signal Prototypes

- const OrientationChangedSignalType orientation_changed_signal
    Orientation changed signal (see signal_orientation_changed()).
- const StyleChangedSignalType style_changed_signal
    Style changed signal (see signal_style_changed())
- const PopupContextMenuSignalType popup_context_menu_signal
    Popup context menu signal (see signal_popup_context_menu()).

## Public Member Functions

Constructors

- Toolbar ()
    Construct a new default toolbar.
- Toolbar (Orientation orientation)
    Construct a new toolbar with the specifed orientation.
- Toolbar (Orientation orientation, ToolbarStyle style)
    Constrcut a new toolbar with the specified orientation and style.
- virtual ~Toolbar ()
    Destructor.

Accessors

- GtkToolbar * gtk_toolbar () const
    Get a pointer to the GtkToolbar structure.
- operator GtkToolbar * () const
    Conversion operator; safely converts a Toolbar to a GtkToolbar pointer.
- int get_item_index (const ToolItem &item) const
    Obtains the position of item on the toolbar, starting from 0.
- int get_n_items () const
    Gets the number of items on the toolbar.
- ToolItem * get_nth_item (int n) const
    Gets the tool item at position n on the toolbar, or null if the toolbar does not contain an n'th item.
- bool get_show_arrow () const
    Determines whether the toolbar has an overflow menu (see set_show_arrow()).
- Orientation get_orientation () const
    Gets the current orientation of the toolbar (see set_orientation()).
- bool get_tooltips () const
    Determines whether tooltips are enabled (see set_tooltips()).
- ToolbarStyle get_style () const
    Retrieves whether the toolbar has text, icons, or both (see set_style()).
- IconSize get_icon_size () const
    Gets the current icon size for the icons on the toolbar (see set_icon_size()).
- ReliefStyle get_relief_style () const
    Gets the relief style of buttons on the toolbar (see Gtk::Button::set_relief_style()).
- int get_drop_index (int x, int y) const
    Obtains the position corresponding to the indicated point on the toolbar.

Methods

- void append (ToolItem &item, const String &tooltip)
    Appends a ToolItem to the end of the toolbar.
- void prepend (ToolItem &item, const String &tooltip)
    Prepends a ToolItem to the start of the toolbar.
- void insert (ToolItem &item, int pos, const String &tooltip)
    Insert a ToolItem into the toolbar at position pos.
- void append_separator ()
    Adds a new separator tool item to the end of the toolbar.
- void insert_separator (int pos)
    Inserts a new separator tool item into the toolbar at the specified position.
- void set_show_arrow (bool show_arrow)
    Sets whether to show an overflow menu when toolbar doesn't have room for all items on it.
- void set_orientation (Orientation orientation)
    Sets whether a toolbar should appear horizontally or vertically.
- void set_tooltips (bool enable)
    Sets if the tooltips of a toolbar should be active or not.
- void set_style (ToolbarStyle style)
    Alters the view of toolbar to display either icons only, text only, or both.
- void unset_style ()
    Unsets the toolbar style set with set_style(), so that user preferences will be used to determine the toolbar style.
- void set_drop_highlight_item (ToolItem &item, int index)
    Highlights the toolbar to give an idea of what it would look like if item was added to the toolbar at the position indicated by index.
- void unset_drop_highlight_item ()
    Turn off drop highlighting.
- void set_tooltip (ToolItem &item, const String &tip_text, const String &tip_private=0)
    Sets the tooltip to be used for the tool item, the text to be displayed as tooltip on the item and the private text to be used, if any.

Signal Proxies

- const OrientationChangedSignalProxy signal_orientation_changed ()
    Connect to the orientation_changed_signal; emitted when the orientation of a toolbar is changed.
- const StyleChangedSignalProxy signal_style_changed ()
    Connect to the style_changed_signal; emitted when ever the style of a toolbar is adjusted.
- const PopupContextMenuSignalProxy signal_popup_context_menu ()
    Connect to the popup_context_menu_signal; emitted when when the user right-clicks the toolbar or uses the keybinding to display a popup menu.

## Protected Member Functions

Constructors

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

## Detailed Description

A GtkToolbar C++ wrapper class.

A toolbar can contain instances of a subclass of Gtk::ToolItem. To add a ToolItem to the a toolbar, use append(), prepend() or insert(). To remove an item from the toolbar use Gtk::Container::remove(). To add a button to the toolbar, add an instance of Gtk::ToolButton.

Toolbar items can be visually grouped by adding instances of Gtk::SeparatorToolItem to the toolbar. If a SeparatorToolItem has the 'expand' property set to true and the 'draw' property set to false the effect is to force all following items to the end of the toolbar. Creating a context menu for the toolbar can be done by connecting to the Gtk::Toolbar popup_context_menu signal (see signal_popup_context_menu()).

See also: the Toolbar and ToolItems HOWTOs and example.

## Constructor & Destructor Documentation

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

  | Construct a new Toolbar from an existing GtkToolbar. Parameters:
  | toolbar | A pointer to a GtkToolbar.
  | owns_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).

Xfc::Gtk::Toolbar::Toolbar | ( |  | ) |

| Construct a new default toolbar. The default toolbar is a horizontal toolbar that displays both icons and text.

Xfc::Gtk::Toolbar::Toolbar | ( | Orientation | orientation | ) | `[explicit]`

  | Construct a new toolbar with the specifed orientation. Parameters:
  | orientation | The Orientation, either horizontal or vertical.
By default this toolbar displays both icons and text. To change the toolbar style call Gtk::Toolbar::set_style();

Xfc::Gtk::Toolbar::Toolbar | ( | Orientation | orientation,
|  | ToolbarStyle | style
| ) |

  | Constrcut a new toolbar with the specified orientation and style. Parameters:
  | orientation | The Orientation, either horizontal or vertical.
  | style | The style for the toolbar.

## Member Function Documentation

void Xfc::Gtk::Toolbar::append | ( | ToolItem & | item,
|  | const String & | tooltip
| ) |

  | Appends a ToolItem to the end of the toolbar. Parameters:
  | item | A ToolItem.
  | tooltip | The tooltip to display for the item.

int Xfc::Gtk::Toolbar::get_drop_index | ( | int | x,
|  | int | y
| ) | const

  | Obtains the position corresponding to the indicated point on the toolbar. Parameters:
  | x | The X coordinate of a point on the toolbar, in toolbar coordinates.
  | y | The Y coordinate of a point on the toolbar, in toolbar coordinates.
Returns: The position corresponding to the point (x, y) on the toolbar. This is useful when dragging items to the toolbar. This method returns the position a new item should be inserted.

IconSize Xfc::Gtk::Toolbar::get_icon_size | ( |  | ) | const

| Gets the current icon size for the icons on the toolbar (see set_icon_size()). Returns: The current icon size.

int Xfc::Gtk::Toolbar::get_item_index | ( | const ToolItem & | item | ) | const

  | Obtains the position of item on the toolbar, starting from 0. Parameters:
  | item | A ToolItem that is a child of the toolbar.
Returns: The position of item on the toolbar. It is an error if item is not a child of the toolbar.

int Xfc::Gtk::Toolbar::get_n_items | ( |  | ) | const

| Gets the number of items on the toolbar. Returns: The number of items on the toolbar.

ToolItem* Xfc::Gtk::Toolbar::get_nth_item | ( | int | n | ) | const

  | Gets the tool item at position n on the toolbar, or null if the toolbar does not contain an n'th item. Parameters:
  | n | A zero-based position on the toolbar.
Returns: The nth ToolItem on the toolbar, or null if there isn't an nth item.

Orientation Xfc::Gtk::Toolbar::get_orientation | ( |  | ) | const

| Gets the current orientation of the toolbar (see set_orientation()). Returns: The current orientation.

ReliefStyle Xfc::Gtk::Toolbar::get_relief_style | ( |  | ) | const

| Gets the relief style of buttons on the toolbar (see Gtk::Button::set_relief_style()). Returns: The relief style of buttons on the toolbar.

bool Xfc::Gtk::Toolbar::get_show_arrow | ( |  | ) | const

| Determines whether the toolbar has an overflow menu (see set_show_arrow()). Returns: true if the toolbar has an overflow menu.

ToolbarStyle Xfc::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 Xfc::Gtk::Widget.

bool Xfc::Gtk::Toolbar::get_tooltips | ( |  | ) | const

| Determines whether tooltips are enabled (see set_tooltips()). Returns: true if tooltips are enabled.

void Xfc::Gtk::Toolbar::insert | ( | ToolItem & | item,
|  | int | pos,
|  | const String & | tooltip
| ) |

  | Insert a ToolItem into the toolbar at position pos. Parameters:
  | item | A ToolItem.
  | pos | The position of the new item.
  | tooltip | The tooltip to display for the item.
If pos is 0 the item is prepended to the start of the toolbar. If pos is -1, the item is appended to the end of the toolbar. Otherwise the tool item is inserted at position pos.

void Xfc::Gtk::Toolbar::insert_separator | ( | int | pos | ) |

  | Inserts a new separator tool item into the toolbar at the specified position. Parameters:
  | pos | The number of tool items to insert the space after.
If pos is -1 the separator is added to the end of the toolbar. If pos is 0 the separator is added to the beginning of the toolbar. Otherwise the separator is inserted at position pos.

void Xfc::Gtk::Toolbar::prepend | ( | ToolItem & | item,
|  | const String & | tooltip
| ) |

  | Prepends a ToolItem to the start of the toolbar. Parameters:
  | item | A ToolItem.
  | tooltip | The tooltip to display for the item.

void Xfc::Gtk::Toolbar::set_drop_highlight_item | ( | ToolItem & | item,
|  | int | index
| ) |

  | Highlights the toolbar to give an idea of what it would look like if item was added to the toolbar at the position indicated by index. Parameters:
  | item | A ToolItem.
  | index | A position on the toolbar.
The tool item passed to this function must not be part of any widget hierarchy. When an item is set as drop highlight item it can not added to any widget hierarchy or used as highlight item for another toolbar.

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

  | Sets whether a toolbar should appear horizontally or vertically. Parameters:
  | orientation | The new Orientation.

void Xfc::Gtk::Toolbar::set_show_arrow | ( | bool | show_arrow | ) |

  | Sets whether to show an overflow menu when toolbar doesn't have room for all items on it. Parameters:
  | show_arrow | Set true to show an overflow menu.
If show_arrow is true, items that there are not room for are available through an overflow menu.

void Xfc::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 Xfc::Gtk::Toolbar::set_tooltip | ( | ToolItem & | item,
|  | const String & | tip_text,
|  | const String & | tip_private = `0`
| ) |

  | Sets the tooltip to be used for the tool item, the text to be displayed as tooltip on the item and the private text to be used, if any. Parameters:
  | item | A ToolItem.
  | tip_text | The text to be used as tooltip text for the tool item.
  | tip_private | The text to be used as private tooltip text.
Calling this convenience method is equivalent to calling Gtk::ToolItem::set_tooltip().

void Xfc::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.

## Member Data Documentation

const OrientationChangedSignalType Xfc::Gtk::Toolbar::orientation_changed_signal`[static, protected]`

| Orientation changed signal (see signal_orientation_changed()). Calls a slot with the signature:
                 void function(Gtk::Orientation orientation);
                 // orientation: The new Orientation of the toolbar.

const PopupContextMenuSignalType Xfc::Gtk::Toolbar::popup_context_menu_signal`[static, protected]`

| Popup context menu signal (see signal_popup_context_menu()). Calls a slot with the signature:
                 bool function(int x, int y, int button);
                 // x: The x coordinate of the point where the menu should appear.
                 // y: The y coordinate of the point where the menu should appear.
                 // button: The mouse button the user pressed, or -1.
                 // return: true if the signal was handled, <EM>false</EM> if not.

const StyleChangedSignalType Xfc::Gtk::Toolbar::style_changed_signal`[static, protected]`

| Style changed signal (see signal_style_changed()) Calls a slot with the signature:
                 void function(Gtk::ToolbarStyle style);
                 // style: The new ToolbarStyle of toolbar.

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

- toolbar.hh

Xfce Foundation Classes

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