Top | ![]() |
![]() |
![]() |
![]() |
GtkWidget * | gtk_toolbar_new () |
void | gtk_toolbar_insert () |
gint | gtk_toolbar_get_item_index () |
gint | gtk_toolbar_get_n_items () |
GtkToolItem * | gtk_toolbar_get_nth_item () |
gint | gtk_toolbar_get_drop_index () |
void | gtk_toolbar_set_drop_highlight_item () |
void | gtk_toolbar_set_show_arrow () |
void | gtk_toolbar_unset_icon_size () |
gboolean | gtk_toolbar_get_show_arrow () |
GtkToolbarStyle | gtk_toolbar_get_style () |
GtkIconSize | gtk_toolbar_get_icon_size () |
void | gtk_toolbar_set_style () |
void | gtk_toolbar_set_icon_size () |
void | gtk_toolbar_unset_style () |
A toolbar is created with a call to gtk_toolbar_new()
.
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 the GtkToolbar child property “expand” is TRUE and the property “draw” is 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.
void gtk_toolbar_insert (GtkToolbar *toolbar
,GtkToolItem *item
,gint pos
);
Insert a GtkToolItem into the toolbar at position pos
. 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.
Since: 2.4
gint gtk_toolbar_get_item_index (GtkToolbar *toolbar
,GtkToolItem *item
);
Returns the position of item
on the toolbar, starting from 0.
It is an error if item
is not a child of the toolbar.
Since: 2.4
gint
gtk_toolbar_get_n_items (GtkToolbar *toolbar
);
Returns the number of items on the toolbar.
Since: 2.4
GtkToolItem * gtk_toolbar_get_nth_item (GtkToolbar *toolbar
,gint n
);
Returns the n
'th item on toolbar
, or NULL
if the
toolbar does not contain an n
'th item.
The n
'th GtkToolItem on toolbar
,
or NULL
if there isn’t an n
'th item.
[nullable][transfer none]
Since: 2.4
gint gtk_toolbar_get_drop_index (GtkToolbar *toolbar
,gint x
,gint y
);
Returns the position corresponding to the indicated point on
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.
toolbar |
||
x |
x coordinate of a point on the toolbar |
|
y |
y coordinate of a point on the toolbar |
Since: 2.4
void gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar
,GtkToolItem *tool_item
,gint index_
);
Highlights toolbar
to give an idea of what it would look like
if item
was added to toolbar
at the position indicated by index_
.
If item
is NULL
, 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.
toolbar |
||
tool_item |
a GtkToolItem, or |
[allow-none] |
index_ |
a position on |
Since: 2.4
void gtk_toolbar_set_show_arrow (GtkToolbar *toolbar
,gboolean show_arrow
);
Sets whether to show an overflow menu when
toolbar
doesn’t have room for all items on it. If TRUE
,
items that there are not room are available through an
overflow menu.
Since: 2.4
void
gtk_toolbar_unset_icon_size (GtkToolbar *toolbar
);
Unsets toolbar icon size set with gtk_toolbar_set_icon_size()
, so that
user preferences will be used to determine the icon size.
gboolean
gtk_toolbar_get_show_arrow (GtkToolbar *toolbar
);
Returns whether the toolbar has an overflow menu.
See gtk_toolbar_set_show_arrow()
.
Since: 2.4
GtkToolbarStyle
gtk_toolbar_get_style (GtkToolbar *toolbar
);
Retrieves whether the toolbar has text, icons, or both . See
gtk_toolbar_set_style()
.
GtkIconSize
gtk_toolbar_get_icon_size (GtkToolbar *toolbar
);
Retrieves the icon size for the toolbar. See gtk_toolbar_set_icon_size()
.
void gtk_toolbar_set_style (GtkToolbar *toolbar
,GtkToolbarStyle style
);
Alters the view of toolbar
to display either icons only, text only, or both.
void gtk_toolbar_set_icon_size (GtkToolbar *toolbar
,GtkIconSize icon_size
);
This function sets the size of stock icons in the toolbar. 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.
void
gtk_toolbar_unset_style (GtkToolbar *toolbar
);
Unsets a toolbar style set with gtk_toolbar_set_style()
, so that
user preferences will be used to determine the toolbar style.