ToolbarProtocol
public protocol ToolbarProtocol : ContainerProtocol, OrientableProtocol, ToolShellProtocol
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 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_set_show_arrow() 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.
The ToolbarProtocol protocol exposes the methods and properties of an underlying GtkToolbar instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Toolbar.
Alternatively, use ToolbarRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkToolbarinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
toolbar_ptrDefault implementationTyped pointer to the underlying
GtkToolbarinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkToolbarinstance.Declaration
Swift
var toolbar_ptr: UnsafeMutablePointer<GtkToolbar>! { get } -
Required Initialiser for types conforming to
ToolbarProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ToolbarPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: ToolbarPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a Toolbar property
Declaration
Swift
@inlinable func get(property: ToolbarPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a Toolbar property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: ToolbarPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
ToolbarSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolbarSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe Swift signal handler (function or callback) to invoke on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
connect(signal:Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
ToolbarSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolbarSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onFocusHomeOrEnd(flags:Extension methodhandler: ) A keybinding signal used internally by GTK+. This signal can’t be used in application code
Note
This represents the underlyingfocus-home-or-endsignalDeclaration
Swift
@discardableResult @inlinable func onFocusHomeOrEnd(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ focusHome: Bool) -> Bool) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
focusHometrueif the first item should be focusedhandlertrueif the signal was handled,falseif not Run the given callback whenever thefocusHomeOrEndsignal is emitted -
focusHomeOrEndSignalExtension methodTyped
focus-home-or-endsignal for using theconnect(signal:)methodsDeclaration
Swift
static var focusHomeOrEndSignal: ToolbarSignalName { get } -
onOrientationChanged(flags:Extension methodhandler: ) Emitted when the orientation of the toolbar changes.
Note
This represents the underlyingorientation-changedsignalDeclaration
Swift
@discardableResult @inlinable func onOrientationChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ orientation: Orientation) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
orientationthe new
GtkOrientationof the toolbarhandlerThe signal handler to call Run the given callback whenever the
orientationChangedsignal is emitted -
orientationChangedSignalExtension methodTyped
orientation-changedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var orientationChangedSignal: ToolbarSignalName { get } -
onPopupContextMenu(flags:Extension methodhandler: ) 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
xandy. The mouse button number is given by thebuttonparameter. If the menu was popped up using the keybaord,buttonis -1.Note
This represents the underlyingpopup-context-menusignalDeclaration
Swift
@discardableResult @inlinable func onPopupContextMenu(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ x: Int, _ y: Int, _ button: Int) -> Bool) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
xthe x coordinate of the point where the menu should appear
ythe y coordinate of the point where the menu should appear
buttonthe mouse button the user pressed, or -1
handlerreturn
trueif the signal was handled,falseif not Run the given callback whenever thepopupContextMenusignal is emitted -
popupContextMenuSignalExtension methodTyped
popup-context-menusignal for using theconnect(signal:)methodsDeclaration
Swift
static var popupContextMenuSignal: ToolbarSignalName { get } -
onStyleChanged(flags:Extension methodhandler: ) Emitted when the style of the toolbar changes.
Note
This represents the underlyingstyle-changedsignalDeclaration
Swift
@discardableResult @inlinable func onStyleChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ style: ToolbarStyle) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
stylethe new
GtkToolbarStyleof the toolbarhandlerThe signal handler to call Run the given callback whenever the
styleChangedsignal is emitted -
styleChangedSignalExtension methodTyped
style-changedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var styleChangedSignal: ToolbarSignalName { get } -
onNotifyIconSize(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::icon-sizesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyIconSize(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyIconSizesignal is emitted -
notifyIconSizeSignalExtension methodTyped
notify::icon-sizesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyIconSizeSignal: ToolbarSignalName { get } -
onNotifyIconSizeSet(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::icon-size-setsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyIconSizeSet(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyIconSizeSetsignal is emitted -
notifyIconSizeSetSignalExtension methodTyped
notify::icon-size-setsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyIconSizeSetSignal: ToolbarSignalName { get } -
onNotifyShowArrow(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::show-arrowsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyShowArrow(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyShowArrowsignal is emitted -
notifyShowArrowSignalExtension methodTyped
notify::show-arrowsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyShowArrowSignal: ToolbarSignalName { get } -
onNotifyToolbarStyle(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::toolbar-stylesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyToolbarStyle(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyToolbarStylesignal is emitted -
notifyToolbarStyleSignalExtension methodTyped
notify::toolbar-stylesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyToolbarStyleSignal: ToolbarSignalName { get }
-
getDropIndex(x:Extension methody: ) 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.xandyare intoolbarcoordinates.Declaration
Swift
@inlinable func getDropIndex(x: Int, y: Int) -> Int -
getIconSize()Extension methodRetrieves the icon size for the toolbar. See
gtk_toolbar_set_icon_size().Declaration
Swift
@inlinable func getIconSize() -> GtkIconSize -
getItemIndex(item:Extension method) Returns the position of
itemon the toolbar, starting from 0. It is an error ifitemis not a child of the toolbar.Declaration
Swift
@inlinable func getItemIndex<ToolItemT>(item: ToolItemT) -> Int where ToolItemT : ToolItemProtocol -
getNItems()Extension methodReturns the number of items on the toolbar.
Declaration
Swift
@inlinable func getNItems() -> Int -
getNthItem(n:Extension method) Returns the
n‘th item ontoolbar, ornilif the toolbar does not contain ann'th item.Declaration
Swift
@inlinable func getNthItem(n: Int) -> ToolItemRef! -
getReliefStyle()Extension methodReturns the relief style of buttons on
toolbar. Seegtk_button_set_relief().Declaration
Swift
@inlinable func getReliefStyle() -> GtkReliefStyle -
getShowArrow()Extension methodReturns whether the toolbar has an overflow menu. See
gtk_toolbar_set_show_arrow().Declaration
Swift
@inlinable func getShowArrow() -> Bool -
getStyle()Extension methodRetrieves whether the toolbar has text, icons, or both . See
gtk_toolbar_set_style().Declaration
Swift
@inlinable func getStyle() -> GtkToolbarStyle -
insert(item:Extension methodpos: ) Insert a
GtkToolIteminto the toolbar at positionpos. Ifposis 0 the item is prepended to the start of the toolbar. Ifposis negative, the item is appended to the end of the toolbar.Declaration
Swift
@inlinable func insert<ToolItemT>(item: ToolItemT, pos: Int) where ToolItemT : ToolItemProtocol -
setDropHighlightItem(toolItem:Extension methodindex: ) Highlights
toolbarto give an idea of what it would look like ifitemwas added totoolbarat the position indicated byindex_. Ifitemisnil, highlighting is turned off. In that caseindex_is ignored.The
tool_itempassed 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.Declaration
Swift
@inlinable func setDropHighlightItem(toolItem: ToolItemRef? = nil, index: Int) -
setDropHighlightItem(toolItem:Extension methodindex: ) Highlights
toolbarto give an idea of what it would look like ifitemwas added totoolbarat the position indicated byindex_. Ifitemisnil, highlighting is turned off. In that caseindex_is ignored.The
tool_itempassed 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.Declaration
Swift
@inlinable func setDropHighlightItem<ToolItemT>(toolItem: ToolItemT?, index: Int) where ToolItemT : ToolItemProtocol -
set(iconSize:Extension method) 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.
Declaration
Swift
@inlinable func set(iconSize: GtkIconSize) -
set(showArrow:Extension method) Sets whether to show an overflow menu when
toolbarisn’t allocated enough size to show all of its items. Iftrue, items which can’t fit intoolbar, and which have a proxy menu item set bygtk_tool_item_set_proxy_menu_item()orGtkToolItem::create-menu-proxy, will be available in an overflow menu, which can be opened by an added arrow button. Iffalse,toolbarwill request enough size to fit all of its child items without any overflow.Declaration
Swift
@inlinable func set(showArrow: Bool) -
set(style:Extension method) Alters the view of
toolbarto display either icons only, text only, or both.Declaration
Swift
@inlinable func set(style: GtkToolbarStyle) -
unsetIconSize()Extension methodUnsets toolbar icon size set with
gtk_toolbar_set_icon_size(), so that user preferences will be used to determine the icon size.Declaration
Swift
@inlinable func unsetIconSize() -
unsetStyle()Extension methodUnsets a toolbar style set with
gtk_toolbar_set_style(), so that user preferences will be used to determine the toolbar style.Declaration
Swift
@inlinable func unsetStyle() -
iconSizeExtension methodRetrieves the icon size for the toolbar. See
gtk_toolbar_set_icon_size().Declaration
Swift
@inlinable var iconSize: GtkIconSize { get nonmutating set } -
nItemsExtension methodReturns the number of items on the toolbar.
Declaration
Swift
@inlinable var nItems: Int { get } -
reliefStyleExtension methodReturns the relief style of buttons on
toolbar. Seegtk_button_set_relief().Declaration
Swift
@inlinable var reliefStyle: GtkReliefStyle { get } -
showArrowExtension methodReturns whether the toolbar has an overflow menu. See
gtk_toolbar_set_show_arrow().Declaration
Swift
@inlinable var showArrow: Bool { get nonmutating set } -
styleExtension methodRetrieves whether the toolbar has text, icons, or both . See
gtk_toolbar_set_style().Declaration
Swift
@inlinable var style: GtkToolbarStyle { get nonmutating set } -
containerExtension methodUndocumented
Declaration
Swift
@inlinable var container: GtkContainer { get }
View on GitHub
Install in Dash
ToolbarProtocol Protocol Reference