Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Public Member Functions | Static Protected Attributes
Xfc::Gtk::Toolbar Class Reference

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

#include <xfc/gtk/toolbar.hh>

Inheritance diagram for Xfc::Gtk::Toolbar:
Xfc::Gtk::Container Xfc::Gtk::Widget Xfc::Gtk::Object Xfc::Atk::Implementor Xfc::G::Object Xfc::G::TypeInterface Xfc::G::TypeInstance Xfc::G::TypeInstance Xfc::Trackable Xfc::Trackable

List of all members.

Public Member Functions

Static Protected Attributes

Constructors


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:
toolbarA pointer to a GtkToolbar.
owns_referenceSet 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:
orientationThe 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:
orientationThe Orientation, either horizontal or vertical.
styleThe 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:
itemA ToolItem.
tooltipThe 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:
xThe X coordinate of a point on the toolbar, in toolbar coordinates.
yThe 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.

Gets the current icon size for the icons on the toolbar.

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:
itemA 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.

Gets the number of items on the toolbar.

Returns:
The number of items on the toolbar.

Gets the tool item at position n on the toolbar, or null if the toolbar does not contain an n'th item.

Parameters:
nA zero-based position on the toolbar.
Returns:
The nth ToolItem on the toolbar, or null if there isn't an nth item.

Gets the current orientation of the toolbar (see set_orientation()).

Returns:
The current orientation.

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

Returns:
The relief style of buttons on the toolbar.

Determines whether the toolbar has an overflow menu (see set_show_arrow()).

Returns:
true if the toolbar has an overflow menu.

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

Returns:
The current style of the toolbar.

Reimplemented from Xfc::Gtk::Widget.

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:
itemA ToolItem.
posThe position of the new item.
tooltipThe 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.

Inserts a new separator tool item into the toolbar at the specified position.

Parameters:
posThe 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:
itemA ToolItem.
tooltipThe 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:
itemA ToolItem.
indexA 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.

Sets whether a toolbar should appear horizontally or vertically.

Parameters:
orientationThe 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_arrowSet true to show an overflow menu.

If show_arrow is true, items that there are not room for are available through an overflow menu.

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

Parameters:
styleThe 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:
itemA ToolItem.
tip_textThe text to be used as tooltip text for the tool item.
tip_privateThe 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:
enableSet to false to disable the tooltips, or true to enable them.

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.

Unsets the toolbar style set with set_style(), so that user preferences will be used to determine the toolbar style.


Member Data Documentation

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.
<

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.
<

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:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC