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

# Xfc::Gtk::ToolItem Class Reference

A GtkToolItem C++ wrapper class. More...

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

Inheritance diagram for Xfc::Gtk::ToolItem:

List of all members.

## Signal Prototypes

- const CreateMenuProxySignalType create_menu_proxy_signal
    Create menu proxy signal (see signal_create_menu_proxy()).
- const ToolbarReconfiguredSignalType toolbar_reconfigured_signal
    Toolbar reconfigured signal (see signal_toolbar_reconfigured()).
- const SetTooltipSignalType set_tooltip_signal
    Set tooltip signal (see signal_set_tooltip()).

## Public Member Functions

Constructors

- ToolItem ()
    Constructs a new tool item.
- ToolItem (Widget &widget)
    Constructs a new tool item that displays widget.
- virtual ~ToolItem ()
    Destructor.

Accessors

- GtkToolItem * gtk_tool_item () const
    Get a pointer to the GtkToolItem structure.
- operator GtkToolItem * () const
    Conversion operator; safely converts an ToolItem to a GtkToolItem pointer.
- bool get_homogeneous () const
    Determines whether the tool item is the same size as other homogeneous items (see set_homogeneous()).
- bool get_expand () const
    Determines whether the tool item is allocated extra space (see set_expand()).
- bool get_use_drag_window () const
    Determines whether the tool item has a drag window (see set_use_drag_window()).
- bool get_visible_horizontal () const
    Determines whether the tool item is visible on toolbars that are docked horizontally.
- bool get_visible_vertical () const
    Determines whether the tool item is visible when the toolbar is docked vertically (see set_visible_vertical()).
- bool get_is_important () const
    Determines whether the tool item is considered important (see set_is_important()).
- IconSize get_icon_size () const
    Gets the icon size used for the tool item.
- Orientation get_orientation () const
    Gets the orientation used for the tool item.
- ToolbarStyle get_toolbar_style () const
    Gets the toolbar style used for the tool item.
- ReliefStyle get_relief_style () const
    Gets the relief style of the tool item (see set_relief_style().
- Widget * get_proxy_menu_item (const String &menu_item_id) const
    If menu_item_id matches the string passed to set_proxy_menu_item() returns the corresponding Gtk::MenuItem widget.
- Widget * retrieve_proxy_menu_item () const
    Retrieves the MenuItem that was last set by set_proxy_menu_item(), that is, the MenuItem that is going to appear in the overflow menu.

Methods

- void set_homogeneous (bool homogeneous)
    Sets whether the tool item is to be allocated the same size as other homogeneous items.
- void set_expand (bool expand)
    Sets whether the tool item is allocated extra space when there is more room on the toolbar than needed for the items.
- void set_tooltip (Tooltips &tooltips, const String &tip_text, const String &tip_private=0)
    Sets the Tooltips object to be used for the tool item, the text to be displayed as tooltip on the item and the private text to be used (see Gtk::Tooltips::set_tip()).
- void set_use_drag_window (bool use_drag_window)
    Sets whether toolitem has a drag window.
- void set_visible_horizontal (bool visible_horizontal)
    Sets whether the tool item is visible when the toolbar is docked horizontally.
- void set_visible_vertical (bool visible_vertical)
    Sets whether the tool item is visible when the toolbar is docked vertically.
- void set_is_important (bool is_important)
    Sets whether the tool item should be considered important.
- void set_proxy_menu_item (const String &menu_item_id, Widget *menu_item)
    Sets the MenuItem used in the toolbar overflow menu.
- void rebuild_menu ()
    Calling this method signals to the toolbar that the overflow menu item for the tool item has changed.

Signal Proxies

- const CreateMenuProxySignalProxy signal_create_menu_proxy ()
    Connect to the create_menu_proxy_signal; emitted when the toolbar is displaying an overflow menu.
- const ToolbarReconfiguredSignalProxy signal_toolbar_reconfigured ()
    Connect to the toolbar_reconfigured_signal; emitted when some property of the toolbar that the item is a child of changes.
- const SetTooltipSignalProxy signal_set_tooltip ()
    Connect to the set_tooltip_signal; emitted when the toolitem's tooltip changes.

## Protected Member Functions

Constructors

- ToolItem (GtkToolItem *tool_item, bool owns_reference=false)
    Construct a new ToolItem from an existing GtkToolItem.

## Detailed Description

A GtkToolItem C++ wrapper class.

ToolItems are widgets that can appear on a toolbar. To construct a toolbar item that contains something other than a button, use ToolItem(). Use Gtk::Container::add() to add a child widget to the tool item.

For toolbar items that contain buttons, see the Gtk::ToolButton, Gtk::ToggleToolButton and Gtk::RadioToolButton classes. See the Gtk::Toolbar class for a description of the toolbar widget.

See also: the ToolItems HOWTO.

## Constructor & Destructor Documentation

Xfc::Gtk::ToolItem::ToolItem | ( | GtkToolItem * | tool_item,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

Construct a new ToolItem from an existing GtkToolItem.

Parameters:

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

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

Xfc::Gtk::ToolItem::ToolItem | ( | Widget & | widget | ) | `[explicit]`

Constructs a new tool item that displays widget.

Parameters:

  | widget | The widget to set as the tool item's content.

## Member Function Documentation

bool Xfc::Gtk::ToolItem::get_expand | ( |  | ) | const

Determines whether the tool item is allocated extra space (see set_expand()).

Returns:
  true if then tool item is allocated extra space.

bool Xfc::Gtk::ToolItem::get_homogeneous | ( |  | ) | const

Determines whether the tool item is the same size as other homogeneous items (see set_homogeneous()).

Returns:
  true if the item is the same size as other homogeneous items.

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

Gets the icon size used for the tool item.

Returns:
  A Gtk::IconSize indicating the icon size used for the tool item.

Custom subclasses of ToolItem should call this function to find out what size icons they should use.

bool Xfc::Gtk::ToolItem::get_is_important | ( |  | ) | const

Determines whether the tool item is considered important (see set_is_important()).

Returns:
  true if the tool item is considered important.

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

Gets the orientation used for the tool item.

Returns:
  A Gtk::Orientation indicating the orientation used for the tool item.

Custom subclasses of ToolItem should call this function to find out the orientation of they should use.

Widget* Xfc::Gtk::ToolItem::get_proxy_menu_item | ( | const String & | menu_item_id | ) | const

If menu_item_id matches the string passed to set_proxy_menu_item() returns the corresponding Gtk::MenuItem widget.

Parameters:

  | menu_item_id | A string used to identify the menu item.

Returns:
  The MenuItem passed to set_proxy_menu_item(), if the menu_item_ids match.

Custom subclasses of ToolItem should use this function to update their menu item when the ToolItem changes. That the menu_item_ids must match ensures that a ToolItem will not inadvertently change a menu item that they did not create.

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

Gets the relief style of the tool item (see set_relief_style().

Returns:
  A Gtk::ReliefStyle indicating the relief style used for the tool item.

Custom subclasses of ToolItem should call this function in the handler of the ToolItem "toolbar_reconfigured" signal to find out the relief style of the buttons.

ToolbarStyle Xfc::Gtk::ToolItem::get_toolbar_style | ( |  | ) | const

Gets the toolbar style used for the tool item.

Returns:
  A Gtk::ToolbarStyle indicating the toolbar style used for the tool item.

Custom subclasses of ToolItem should call this function in the handler of the ToolItem "toolbar_reconfigured" signal to find out in what style the toolbar is displayed and change themselves accordingly. The possibilities are: Gtk::TOOLBAR_BOTH, meaning the tool item should show both an icon and a label, stacked vertically, Gtk::TOOLBAR_ICONS, meaning the toolbar shows only icons, Gtk::TOOLBAR_TEXT, meaning the tool item should only show text and Gtk::TOOLBAR_BOTH_HORIZ, meaning the tool item should show both an icon and a label, arranged horizontally.

bool Xfc::Gtk::ToolItem::get_use_drag_window | ( |  | ) | const

Determines whether the tool item has a drag window (see set_use_drag_window()).

Returns:
  true if the tool item uses a drag window.

bool Xfc::Gtk::ToolItem::get_visible_horizontal | ( |  | ) | const

Determines whether the tool item is visible on toolbars that are docked horizontally.

Returns:
  true if the tool item is visible on toolbars that are docked horizontally.

bool Xfc::Gtk::ToolItem::get_visible_vertical | ( |  | ) | const

Determines whether the tool item is visible when the toolbar is docked vertically (see set_visible_vertical()).

Returns:
  Whether the tool item is visible when the toolbar is docked vertically.

void Xfc::Gtk::ToolItem::rebuild_menu | ( |  | ) |

| Calling this method signals to the toolbar that the overflow menu item for the tool item has changed. If the overflow menu is visible when this function it called, the menu will be rebuilt. This function must be called when the tool item changes what it will do in response to the "create_menu_proxy" signal.

Widget* Xfc::Gtk::ToolItem::retrieve_proxy_menu_item | ( |  | ) | const

Retrieves the MenuItem that was last set by set_proxy_menu_item(), that is, the MenuItem that is going to appear in the overflow menu.

Returns:
  The MenuItem that is going to appear in the overflow menu for the tool item.

void Xfc::Gtk::ToolItem::set_expand | ( | bool | expand | ) |

Sets whether the tool item is allocated extra space when there is more room on the toolbar than needed for the items.

Parameters:

  | expand | Whether the tool item is allocated extra space.

The effect is that the item gets bigger when the toolbar gets bigger and smaller when the toolbar gets smaller.

void Xfc::Gtk::ToolItem::set_homogeneous | ( | bool | homogeneous | ) |

Sets whether the tool item is to be allocated the same size as other homogeneous items.

Parameters:

  | homogeneous | Whether the tool item is the same size as other homogeneous items.

The effect is that all homogeneous items will have the same width as the widest of the items.

void Xfc::Gtk::ToolItem::set_is_important | ( | bool | is_important | ) |

Sets whether the tool item should be considered important.

Parameters:

  | is_important | Whether the tool item should be considered important.

The ToolButton class uses this property to determine whether to show or hide its label when the toolbar style is Gtk::TOOLBAR_BOTH_HORIZ. The result is that only tool buttons with the "is_important" property set have labels, an effect known as "priority text".

void Xfc::Gtk::ToolItem::set_proxy_menu_item | ( | const String & | menu_item_id,
|  | Widget * | menu_item
| ) |

Sets the MenuItem used in the toolbar overflow menu.

Parameters:

  | menu_item_id | A string used to identify menu_item.
  | menu_item | A MenuItem to be used in the overflow menu.

The menu_item_id is used to identify the caller of this function and should also be used with get_proxy_menu_item(). If menu_item is null the MenuItem last set will not appear in the overflow menu (see signal_create_menu_proxy()).

void Xfc::Gtk::ToolItem::set_tooltip | ( | Tooltips & | tooltips,
|  | const String & | tip_text,
|  | const String & | tip_private = `0`
| ) |

Sets the Tooltips object to be used for the tool item, the text to be displayed as tooltip on the item and the private text to be used (see Gtk::Tooltips::set_tip()).

Parameters:

  | tooltips | The Tooltips object to be used.
  | 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.

void Xfc::Gtk::ToolItem::set_use_drag_window | ( | bool | use_drag_window | ) |

Sets whether toolitem has a drag window.

Parameters:

  | use_drag_window | Whether the tool item has a drag window.

When use_drag_window is true the tool item can be used as a drag source through Gtk::Widget::drag_source_set(). When the tool item has a drag window it will intercept all events, even those that would otherwise be sent to a child of toolitem.

void Xfc::Gtk::ToolItem::set_visible_horizontal | ( | bool | visible_horizontal | ) |

Sets whether the tool item is visible when the toolbar is docked horizontally.

Parameters:

  | visible_horizontal | Whether the tool item is visible when in horizontal mode.

void Xfc::Gtk::ToolItem::set_visible_vertical | ( | bool | visible_vertical | ) |

Sets whether the tool item is visible when the toolbar is docked vertically.

Parameters:

  | visible_vertical | Whether the tool item is visible when the toolbar is in vertical mode.

Some tool items, such as text entries, are too wide to be useful on a vertically docked toolbar. If visible_vertical is false the tool item will not appear on toolbars that are docked vertically.

const CreateMenuProxySignalProxy Xfc::Gtk::ToolItem::signal_create_menu_proxy | ( |  | ) |

Connect to the create_menu_proxy_signal; emitted when the toolbar is displaying an overflow menu.

In response the tool item should call Gtk::ToolItem::set_proxy_menu_item() with either with a null pointer and return true to indicate that the item should not appear in the overflow menu, or with a new menu item and return true, or return false to indicate that the signal was not handled by the item. This means that the item will not appear in the overflow menu unless a later handler installs a menu item.

const ToolbarReconfiguredSignalProxy Xfc::Gtk::ToolItem::signal_toolbar_reconfigured | ( |  | ) |

Connect to the toolbar_reconfigured_signal; emitted when some property of the toolbar that the item is a child of changes.

For custom subclasses of Gtk::ToolItem, the default handler of this signal uses the functions Gtk::Toolbar::get_orientation(), Gtk::Toolbar::get_style(), Gtk::Toolbar::get_icon_size() and Gtk::Toolbar::get_relief_style() to find out what the toolbar should look like and change themselves accordingly.

## Member Data Documentation

const CreateMenuProxySignalType Xfc::Gtk::ToolItem::create_menu_proxy_signal `[static, protected]`

Create menu proxy signal (see signal_create_menu_proxy()).

Calls a slot with the signature:

                 bool function();
                 // return: true if the signal was handled, false if not.

const SetTooltipSignalType Xfc::Gtk::ToolItem::set_tooltip_signal `[static, protected]`

Set tooltip signal (see signal_set_tooltip()).

Calls a slot with the signature:

                 bool function(Tooltips& tooltips, const String& tip_text, const String& tip_private);
                 // tooltips: The Gtk::Tooltips.
                 // tip_text: The tooltip text.
                 // tip_private: The tooltip private text.
                 // return: true if the signal was handled, false if not.

const ToolbarReconfiguredSignalType Xfc::Gtk::ToolItem::toolbar_reconfigured_signal `[static, protected]`

Toolbar reconfigured signal (see signal_toolbar_reconfigured()).

Calls a slot with the signature:

                 void function();

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

- toolitem.hh

Xfce Foundation Classes

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