gtk.toolbar
Module for [Toolbar] class
Types 3
A toolbar is created with a call to [gtk.toolbar.Toolbar.new_].
A toolbar can contain instances of a subclass of #GtkToolItem. To add a #GtkToolItem to the a toolbar, use [gtk.toolbar.Toolbar.insert]. To remove an item from the toolbar use [gtk.container.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 #GtkSeparatorToolItem:draw is set to #FALSE, the effect is to force all following items to the end of the toolbar.
By default, a toolbar can be shrunk, upon which it will add an arrow button to show an overflow menu offering access to any #GtkToolItem child that has a proxy menu item. To disable this and request enough size for all children, call [gtk.toolbar.Toolbar.setShowArrow] to set #GtkToolbar:show-arrow to false.
Creating a context menu for the toolbar can be done by connecting to the #GtkToolbar::popup-context-menu signal.
CSS nodes
GtkToolbar has a single CSS node with name toolbar.
Toolbar self()Returns `this`, for use in `with` statements.ToolbarGidBuilder builder()Get builder for [gtk.toolbar.Toolbar] Returns: New builder objectgtk.types.IconSize iconSize() @propertyGet `iconSize` property. Returns: The size of the icons in a toolbar is normally determined by the toolbar-icon-size setting. When this property is set, it overrides the setting.void iconSize(gtk.types.IconSize propval) @propertySet `iconSize` property. Params: propval = The size of the icons in a toolbar is normally determined by the toolbar-icon-size setting. When this property is set, it overrides the setting.bool iconSizeSet() @propertyGet `iconSizeSet` property. Returns: Is true if the icon-size property has been set.void iconSizeSet(bool propval) @propertySet `iconSizeSet` property. Params: propval = Is true if the icon-size property has been set.bool showArrow() @propertyvoid showArrow(bool propval) @propertygtk.types.ToolbarStyle toolbarStyle() @propertyvoid toolbarStyle(gtk.types.ToolbarStyle propval) @propertyint getDropIndex(int x, int 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.gtk.types.IconSize getIconSize()Retrieves the icon size for the toolbar. See [gtk.toolbar.Toolbar.setIconSize]. Returns: the current icon size for the icons on the toolbar.int getItemIndex(gtk.tool_item.ToolItem 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.int getNItems()Returns the number of items on the toolbar. Returns: the number of items on the toolbargtk.tool_item.ToolItem getNthItem(int n)Returns the `n`'th item on toolbar, or null if the toolbar does not contain an `n`'th item.gtk.types.ReliefStyle getReliefStyle()Returns the relief style of buttons on toolbar. See [gtk.button.Button.setRelief]. Returns: The relief style of buttons on toolbar.bool getShowArrow()Returns whether the toolbar has an overflow menu. See [gtk.toolbar.Toolbar.setShowArrow]. Returns: true if the toolbar has an overflow menu.gtk.types.ToolbarStyle getStyle()Retrieves whether the toolbar has text, icons, or both . See [gtk.toolbar.Toolbar.setStyle]. Returns: the current style of toolbarvoid insert(gtk.tool_item.ToolItem item, int 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.void setDropHighlightItem(gtk.tool_item.ToolItem toolItem, int 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 ign...void setIconSize(gtk.types.IconSize iconSize)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 defa...void setShowArrow(bool showArrow)Sets whether to show an overflow menu when toolbar isn’t allocated enough size to show all of its items. If true, items which can’t fit in toolbar, and which have a proxy menu item set by [gtk....void setStyle(gtk.types.ToolbarStyle style)Alters the view of toolbar to display either icons only, text only, or both.void unsetIconSize()Unsets toolbar icon size set with [gtk.toolbar.Toolbar.setIconSize], so that user preferences will be used to determine the icon size.void unsetStyle()Unsets a toolbar style set with [gtk.toolbar.Toolbar.setStyle], so that user preferences will be used to determine the toolbar style.gulong connectFocusHomeOrEnd(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == bool)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.toolbar.Toolbar)))
&& Parameters!T.length < 3)Connect to `FocusHomeOrEnd` signal.gulong connectOrientationChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.Orientation)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.toolbar.Toolbar)))
&& Parameters!T.length < 3)Connect to `OrientationChanged` signal.gulong connectPopupContextMenu(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == int)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == int)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] == int)))
&& (Parameters!T.length < 4 || (ParameterStorageClassTuple!T[3] == ParameterStorageClass.none && is(Parameters!T[3] : gtk.toolbar.Toolbar)))
&& Parameters!T.length < 5)Connect to `PopupContextMenu` signal.gulong connectStyleChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.ToolbarStyle)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.toolbar.Toolbar)))
&& Parameters!T.length < 3)Connect to `StyleChanged` signal.T iconSize(gtk.types.IconSize propval)Set `iconSize` property. Params: propval = The size of the icons in a toolbar is normally determined by the toolbar-icon-size setting. When this property is set, it overrides the setting.T iconSizeSet(bool propval)Set `iconSizeSet` property. Params: propval = Is true if the icon-size property has been set. Returns: Builder instance for fluent chainingT showArrow(bool propval)T toolbarStyle(gtk.types.ToolbarStyle propval)Fluent builder for [gtk.toolbar.Toolbar]
Toolbar build()