Create bars of buttons and other widgets
A toolbar is created with a call to gtk-toolbar-new
.
A toolbar can contain instances of a subclass of <gtk-tool-item>
. To add
a <gtk-tool-item>
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 <gtk-tool-button>
.
Toolbar items can be visually grouped by adding instances of
<gtk-separator-tool-item>
to the toolbar. If a
<gtk-separator-tool-item>
has the "expand" property set to
#t
and the "draw" property set to #f
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.
Derives from
<gtk-container>
.This class defines the following slots:
orientation
- The orientation of the toolbar
toolbar-style
- How to draw the toolbar
show-arrow
- If an arrow should be shown if the toolbar doesn't fit
tooltips
- If the tooltips of the toolbar should be active or not
icon-size
- Size of icons in this toolbar
icon-size-set
- Whether the icon-size property has been set
<gtk-orientation>
)Emitted when the orientation of the toolbar changes.
<gtk-toolbar-style>
)Emitted when the style of the toolbar changes.
<gint>
) (arg1 <gint>
) (arg2 <gint>
) ⇒ <gboolean>
Emitted when the user right-clicks the toolbar or uses the keybinding to display a popup 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.
<gboolean>
) ⇒ <gboolean>
A keybinding signal used internally by GTK+. This signal can't be used in application code
<gtk-widget>
)Creates a new toolbar.
- ret
- the newly-created toolbar.
<gtk-toolbar>
) (item <gtk-tool-item>
) (pos int
)Insert a
<gtk-tool-item>
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.
- toolbar
- a
<gtk-toolbar>
- item
- a
<gtk-tool-item>
- pos
- the position of the new item
Since 2.4
<gtk-toolbar>
) (item <gtk-tool-item>
) ⇒ (ret int
)Returns the position of item on the toolbar, starting from 0. It is an error if item is not a child of the toolbar.
- toolbar
- a
<gtk-toolbar>
- item
- a
<gtk-tool-item>
that is a child of toolbar- ret
- the position of item on the toolbar.
Since 2.4
<gtk-toolbar>
) ⇒ (ret int
)Returns the number of items on the toolbar.
- toolbar
- a
<gtk-toolbar>
- ret
- the number of items on the toolbar
Since 2.4
<gtk-toolbar>
) (n int
) ⇒ (ret <gtk-tool-item>
)Returns the n'th item on toolbar, or ‘
#f
’ if the toolbar does not contain an n'th item.
- toolbar
- a
<gtk-toolbar>
- n
- A position on the toolbar
- ret
- The n'th
<gtk-tool-item>
on toolbar, or ‘#f
’ if there isn't an n'th item.Since 2.4
<gtk-toolbar>
) (x int
) (y int
) ⇒ (ret int
)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
- a
<gtk-toolbar>
- x
- x coordinate of a point on the toolbar
- y
- y coordinate of a point on the toolbar
- ret
- The position corresponding to the point (x, y) on the toolbar.
Since 2.4
<gtk-toolbar>
) (tool_item <gtk-tool-item>
) (index_ int
)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 ‘
#f
’, 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
- a
<gtk-toolbar>
- tool-item
- a
<gtk-tool-item>
, or ‘#f
’ to turn of highlighting- index
- a position on toolbar
Since 2.4
<gtk-toolbar>
) (show_arrow bool
)Sets whether to show an overflow menu when toolbar doesn't have room for all items on it. If ‘
#t
’, items that there are not room are available through an overflow menu.
- toolbar
- a
<gtk-toolbar>
- show-arrow
- Whether to show an overflow menu
Since 2.4
<gtk-toolbar>
) (orientation <gtk-orientation>
)Sets whether a toolbar should appear horizontally or vertically.
- toolbar
- a
<gtk-toolbar>
.- orientation
- a new
<gtk-orientation>
.
<gtk-toolbar>
) (enable bool
)Sets if the tooltips of a toolbar should be active or not.
- toolbar
- a
<gtk-toolbar>
.- enable
- set to ‘
#f
’ to disable the tooltips, or ‘#t
’ to enable them.
<gtk-toolbar>
) ⇒ (ret bool
)Returns whether the toolbar has an overflow menu. See
gtk-toolbar-set-show-arrow
.
- toolbar
- a
<gtk-toolbar>
- ret
- ‘
#t
’ if the toolbar has an overflow menu.Since 2.4
<gtk-toolbar>
) ⇒ (ret <gtk-orientation>
)Retrieves the current orientation of the toolbar. See
gtk-toolbar-set-orientation
.
- toolbar
- a
<gtk-toolbar>
- ret
- the orientation
<gtk-toolbar>
) ⇒ (ret <gtk-toolbar-style>
)Retrieves whether the toolbar has text, icons, or both . See
gtk-toolbar-set-style
.
- toolbar
- a
<gtk-toolbar>
- ret
- the current style of toolbar
<gtk-toolbar>
) ⇒ (ret <gtk-icon-size>
)Retrieves the icon size for the toolbar. See
gtk-toolbar-set-icon-size
.
- toolbar
- a
<gtk-toolbar>
- ret
- the current icon size for the icons on the toolbar.
<gtk-toolbar>
) ⇒ (ret bool
)Retrieves whether tooltips are enabled. See
gtk-toolbar-set-tooltips
.
- toolbar
- a
<gtk-toolbar>
- ret
- ‘
#t
’ if tooltips are enabled
<gtk-toolbar>
) ⇒ (ret <gtk-relief-style>
)Returns the relief style of buttons on toolbar. See
gtk-button-set-relief
.
- toolbar
- a
<gtk-toolbar>
- ret
- The relief style of buttons on toolbar.
Since 2.4