A toolbar can contain instances of a subclass of
gtk-tool-item
widgets. A toolbar is created with a call to the
gtk-toolbar-new function. To add a
gtk-tool-item widget to the toolbar, use the
gtk-toolbar-insert function. To remove an item from the toolbar use the
gtk-container-remove function. To add a button to the toolbar, add an instance of the
gtk-tool-button class.
Toolbar items can be visually grouped by adding instances of the
gtk-separator-tool-item class to the toolbar. If the
expand child property is
true and the
draw property 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.
CSS nodes
The
gtk-toolbar implementation has a single CSS node with name
toolbar.
Child Property Details
- expand
- The expand child property of type :boolean (Read / Write)
Whether the item should receive extra space when the toolbar grows.
Default value: false - homogeneous
- The homogeneous child property of type :boolean (Read / Write)
Whether the item should be the same size as other homogeneous items.
Default value: false
Style Property Details
- button-relief
- The button-relief style property of type gtk-relief-style (Read)
Type of bevel around toolbar buttons.
Default value: :none - internal-padding
- The internal-padding style property of type :int (Read)
Amount of border space between the toolbar shadow and the buttons.
Warning: The internal-padding style property has been
deprecated since version 3.6 and should not be used in newly written
code. Use the standard padding CSS property, through objects like gtk-style-context and gtk-css-provider. The value of this style property is ignored.
Allowed values: >= 0
Default value: 0 - max-child-expand
- The max-child-expand style property of type :int (Read)
Maximum amount of space an expandable item will be given.
Allowed values: >= 0
Default value: 2147483647 - shadow-type
- The shadow-type style property of type gtk-shadow-type (Read)
Style of bevel around the toolbar.
Warning: The shadow-type style property has been deprecated
since version 3.6 and should not be used in newly written code. Use the
standard border CSS property, through objects like gtk-style-context and gtk-css-provider. The value of this style property is ignored.
Default value: :out - space-size
- The space-size style property of type :int (Read)
Size of spacers.
Warning: The space-size style property has been deprecated
since version 3.20 and should not be used in newly written code. Use the
standard margin/padding CSS properties on the separator elements. The value of this style property is ignored.
Allowed values: >= 0
Default value: 12 - space-style
- The space-style style property of type gtk-toolbar-space-style (Read)
Whether spacers are vertical lines or just blank.
Warning: The space-style style property has been deprecated
since version 3.20 and should not be used in newly written code. Use CSS
properties on the separator elements to style toolbar spacers. The value of this style property is ignored.
Default value: :line
Signal Details
The "focus-home-or-end" signal
lambda (toolbar focus-home) :action
A keybinding signal used internally by GTK. The signal cannot be used in
application code.
- toolbar
- The gtk-toolbar widget which emitted the signal.
- focus-home
- True if the first item should be focused.
- Returns
- True if the signal was handled, false if not.
The "orientation-changed" signal
lambda (toolbar orientation) :run-first
Emitted when the orientation of the toolbar changes.
- toolbar
- The gtk-toolbar widget which emitted the signal.
- orientation
- The new value of the gtk-orientation enumeration of the toolbar.
The "popup-context-menu" signal
lambda (toolbar x y button) :run-last
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 keyboard,
button is -1.
- toolbar
- The gtk-toolbar widget which emitted the signal.
- x
- An integer with the x coordinate of the point where the menu should appear.
- y
- An integer with the y coordinate of the point where the menu should appear.
- button
- An integer with the mouse button the user pressed, or -1.
- Returns
- Return true if the signal was handled, false if not.
The "style-changed" signal
lambda (toolbar style) :run-first
Emitted when the style of the toolbar changes.
- toolbar
- The gtk-toolbar widget which emitted the signal.
- style
- The new value of the gtk-toolbar-style enumeration of the toolbar.