Create bars of buttons and other widgets
Class GtkToolbar
A toolbar can contain instances of a subclass of GtkToolItem. To add a GtkToolItem to the a toolbar, use gtk_toolbar_insert(). To remove an item from the toolbar use gtk_container_remove(). To add a button to the toolbar, add an instance of GtkToolButton.
Toolbar items can be visually grouped by adding instances of GtkSeparatorToolItem to the toolbar. If a GtkSeparatorToolItem 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 "popup-context-menu" signal.
Methods | |
get_drop_index | Returns the position corresponding to the indicated point on toolbar. |
get_icon_size | Retrieves the icon size for the toolbar. |
get_item_index | Returns the position of item on the toolbar, starting from 0. |
get_n_items | Returns the number of items on the toolbar. |
get_nth_item | Returns the n'th item on toolbar, or NULL if the toolbar does not contain an n'th item. |
get_relief_style | Returns the relief style of buttons on toolbar. |
get_show_arrow | Returns whether the toolbar has an overflow menu. |
get_style | Retrieves whether the toolbar has text, icons, or both. |
insert | Insert a GtkToolItem into the toolbar at position pos. |
set_drop_highlight_item | Highlights toolbar to give an idea of what it would look like if item was added to toolbar at the position indicated by index_. |
set_icon_size | This function sets the size of stock icons in the toolbar. |
set_show_arrow | Sets whether to show an overflow menu when toolbar doesn't have room for all items on it. |
set_style | Alters the view of toolbar to display either icons only, text only, or both. |
signal_orientation_changed | Emitted when the orientation of the toolbar changes. |
signal_popup_context_menu | Emitted when the user right-clicks the toolbar or uses the keybinding to display a popup menu. |
signal_style_changed | Emitted when the style of the toolbar changes. |
unset_icon_size | Unsets toolbar icon size set with gtk_toolbar_set_icon_size(), so that user preferences will be used to determine the icon size. |
unset_style | Unsets a toolbar style set with gtk_toolbar_set_style(), so that user preferences will be used to determine the toolbar style. |
Returns the position corresponding to the indicated point on toolbar.
GtkToolbar.get_drop_index( x, y )
x | x coordinate of a point on the toolbar |
y | y coordinate of a point on the toolbar |
Return | The position corresponding to the point (x, y) on the toolbar. |
This is useful when dragging items to the toolbar: this function returns the position a new item should be inserted.
x and y are in toolbar coordinates.
Retrieves the icon size for the toolbar.
GtkToolbar.get_icon_size()
Return | the current icon size for the icons on the toolbar (GtkIconSize). |
Returns the position of item on the toolbar, starting from 0.
GtkToolbar.get_item_index( item )
item | a GtkToolItem that is a child of toolbar |
Return | The position of item on the toolbar |
It is an error if item is not a child of the toolbar.
Returns the number of items on the toolbar.
GtkToolbar.get_n_items()
Return | the number of items on the toolbar |
Returns the n'th item on toolbar, or NULL if the toolbar does not contain an n'th item.
GtkToolbar.get_nth_item()
Returns the relief style of buttons on toolbar.
GtkToolbar.get_relief_style()
Return | The relief style of buttons on toolbar (GtkReliefStyle). |
Returns whether the toolbar has an overflow menu.
GtkToolbar.get_show_arrow()
Return | TRUE if the toolbar has an overflow menu. |
Retrieves whether the toolbar has text, icons, or both.
GtkToolbar.get_style()
Return | the current style of toolbar (GtkToolbarStyle). |
Insert a GtkToolItem into the toolbar at position pos.
GtkToolbar.insert( item, pos )
item | a GtkToolItem |
pos | the position of the new item |
If pos is 0 the item is prepended to the start of the toolbar. If pos is negative, the item is appended to the end of the toolbar.
Highlights toolbar to give an idea of what it would look like if item was added to toolbar at the position indicated by index_.
GtkToolbar.set_drop_highlight_item( tool_item, index )
tool_item | a GtkToolItem, or nil to turn of highlighting. |
index | a position on toolbar |
If item is nil, highlighting is turned off. In that case index_ is ignored.
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.
This function sets the size of stock icons in the toolbar.
GtkToolbar.set_icon_size( icon_size )
icon_size | The GtkIconSize that stock icons in the toolbar shall have |
You can call it both before you add the icons and after they've been added. The size you set will override user preferences for the default icon size.
This should only be used for special-purpose toolbars, normal application toolbars should respect the user preferences for the size of icons.
Sets whether to show an overflow menu when toolbar doesn't have room for all items on it.
GtkToolbar.set_show_arrow( show_arrow )
show_arrow | Whether to show an overflow menu |
If TRUE, items that there are not room are available through an overflow menu.
Alters the view of toolbar to display either icons only, text only, or both.
GtkToolbar.set_style( style )
style | the new style for toolbar (GtkToolbarStyle). |
Emitted when the orientation of the toolbar changes.
GtkToolbar.signal_orientation_changed()
Emitted when the user right-clicks the toolbar or uses the keybinding to display a popup menu.
GtkToolbar.signal_popup_context_menu()
Application developers should handle this signal if they want to display a context menu on the toolbar. The context-menu should appear at the coordinates given by x and y. The mouse button number is given by the button parameter. If the menu was popped up using the keybaord, button is -1.
Emitted when the style of the toolbar changes.
GtkToolbar.signal_style_changed()
Unsets toolbar icon size set with gtk_toolbar_set_icon_size(), so that user preferences will be used to determine the icon size.
GtkToolbar.unset_icon_size()
Unsets a toolbar style set with gtk_toolbar_set_style(), so that user preferences will be used to determine the toolbar style.
GtkToolbar.unset_style()