ToolItemProtocol
public protocol ToolItemProtocol : ActivatableProtocol, BinProtocol
GtkToolItems are widgets that can appear on a toolbar. To
create a toolbar item that contain something else than a button, use
gtk_tool_item_new(). Use gtk_container_add() to add a child
widget to the tool item.
For toolbar items that contain buttons, see the GtkToolButton,
GtkToggleToolButton and GtkRadioToolButton classes.
See the GtkToolbar class for a description of the toolbar widget, and
GtkToolShell for a description of the tool shell interface.
The ToolItemProtocol protocol exposes the methods and properties of an underlying GtkToolItem 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 ToolItem.
Alternatively, use ToolItemRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkToolIteminstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
tool_item_ptrDefault implementationTyped pointer to the underlying
GtkToolIteminstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkToolIteminstance.Declaration
Swift
var tool_item_ptr: UnsafeMutablePointer<GtkToolItem>! { get } -
Required Initialiser for types conforming to
ToolItemProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ToolItemPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: ToolItemPropertyName, 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 ToolItem property
Declaration
Swift
@inlinable func get(property: ToolItemPropertyName) -> 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 ToolItem property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: ToolItemPropertyName, 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
ToolItemSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolItemSignalName, 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
ToolItemSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolItemSignalName, 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)
-
onCreateMenuProxy(flags:Extension methodhandler: ) This signal is emitted when the toolbar needs information from
tool_itemabout whether the item should appear in the toolbar overflow menu. In response the tool item should eithercall
gtk_tool_item_set_proxy_menu_item()with anilpointer and returntrueto indicate that the item should not appear in the overflow menucall
gtk_tool_item_set_proxy_menu_item()with a new menu item and returntrue, orreturn
falseto indicate that the signal was not handled by the item. This means that the item will not appear in the overflow menu unless a later handler installs a menu item.
The toolbar may cache the result of this signal. When the tool item changes how it will respond to this signal it must call
gtk_tool_item_rebuild_menu()to invalidate the cache and ensure that the toolbar rebuilds its overflow menu.Note
This represents the underlyingcreate-menu-proxysignalDeclaration
Swift
@discardableResult @inlinable func onCreateMenuProxy(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef) -> Bool) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlertrueif the signal was handled,falseif not Run the given callback whenever thecreateMenuProxysignal is emitted -
createMenuProxySignalExtension methodTyped
create-menu-proxysignal for using theconnect(signal:)methodsDeclaration
Swift
static var createMenuProxySignal: ToolItemSignalName { get } -
onToolbarReconfigured(flags:Extension methodhandler: ) This signal is emitted when some property of the toolbar that the item is a child of changes. For custom subclasses of
GtkToolItem, the default handler of this signal use the functionsgtk_tool_shell_get_orientation()gtk_tool_shell_get_style()gtk_tool_shell_get_icon_size()gtk_tool_shell_get_relief_style()to find out what the toolbar should look like and change themselves accordingly.
Note
This represents the underlyingtoolbar-reconfiguredsignalDeclaration
Swift
@discardableResult @inlinable func onToolbarReconfigured(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
toolbarReconfiguredsignal is emitted -
toolbarReconfiguredSignalExtension methodTyped
toolbar-reconfiguredsignal for using theconnect(signal:)methodsDeclaration
Swift
static var toolbarReconfiguredSignal: ToolItemSignalName { get } -
onNotifyIsImportant(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::is-importantsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyIsImportant(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef, _ 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
notifyIsImportantsignal is emitted -
notifyIsImportantSignalExtension methodTyped
notify::is-importantsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyIsImportantSignal: ToolItemSignalName { get } -
onNotifyVisibleHorizontal(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::visible-horizontalsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyVisibleHorizontal(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef, _ 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
notifyVisibleHorizontalsignal is emitted -
notifyVisibleHorizontalSignalExtension methodTyped
notify::visible-horizontalsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyVisibleHorizontalSignal: ToolItemSignalName { get } -
onNotifyVisibleVertical(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::visible-verticalsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyVisibleVertical(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef, _ 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
notifyVisibleVerticalsignal is emitted -
notifyVisibleVerticalSignalExtension methodTyped
notify::visible-verticalsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyVisibleVerticalSignal: ToolItemSignalName { get }
-
getEllipsizeMode()Extension methodReturns the ellipsize mode used for
tool_item. Custom subclasses ofGtkToolItemshould call this function to find out how text should be ellipsized.Declaration
Swift
@inlinable func getEllipsizeMode() -> PangoEllipsizeMode -
getExpand()Extension methodReturns whether
tool_itemis allocated extra space. Seegtk_tool_item_set_expand().Declaration
Swift
@inlinable func getExpand() -> Bool -
getHomogeneous()Extension methodReturns whether
tool_itemis the same size as other homogeneous items. Seegtk_tool_item_set_homogeneous().Declaration
Swift
@inlinable func getHomogeneous() -> Bool -
getIconSize()Extension methodReturns the icon size used for
tool_item. Custom subclasses ofGtkToolItemshould call this function to find out what size icons they should use.Declaration
Swift
@inlinable func getIconSize() -> GtkIconSize -
getIsImportant()Extension methodReturns whether
tool_itemis considered important. Seegtk_tool_item_set_is_important()Declaration
Swift
@inlinable func getIsImportant() -> Bool -
getOrientation()Extension methodReturns the orientation used for
tool_item. Custom subclasses ofGtkToolItemshould call this function to find out what size icons they should use.Declaration
Swift
@inlinable func getOrientation() -> GtkOrientation -
getProxyMenuItem(menuItemID:Extension method) If
menu_item_idmatches the string passed togtk_tool_item_set_proxy_menu_item()return the correspondingGtkMenuItem.Custom subclasses of
GtkToolItemshould use this function to update their menu item when theGtkToolItemchanges. That themenu_item_idsmust match ensures that aGtkToolItemwill not inadvertently change a menu item that they did not create.Declaration
Swift
@inlinable func getProxyMenuItem(menuItemID: UnsafePointer<gchar>!) -> WidgetRef! -
getReliefStyle()Extension methodReturns the relief style of
tool_item. Seegtk_button_set_relief(). Custom subclasses ofGtkToolItemshould call this function in the handler of theGtkToolItem::toolbar_reconfiguredsignal to find out the relief style of buttons.Declaration
Swift
@inlinable func getReliefStyle() -> GtkReliefStyle -
getTextAlignment()Extension methodReturns the text alignment used for
tool_item. Custom subclasses ofGtkToolItemshould call this function to find out how text should be aligned.Declaration
Swift
@inlinable func getTextAlignment() -> Double -
getTextOrientation()Extension methodReturns the text orientation used for
tool_item. Custom subclasses ofGtkToolItemshould call this function to find out how text should be orientated.Declaration
Swift
@inlinable func getTextOrientation() -> GtkOrientation -
getTextSizeGroup()Extension methodReturns the size group used for labels in
tool_item. Custom subclasses ofGtkToolItemshould call this function and use the size group for labels.Declaration
Swift
@inlinable func getTextSizeGroup() -> SizeGroupRef! -
getToolbarStyle()Extension methodReturns the toolbar style used for
tool_item. Custom subclasses ofGtkToolItemshould call this function in the handler of the GtkToolItemtoolbar_reconfiguredsignal to find out in what style the toolbar is displayed and change themselves accordinglyPossibilities are:
GTK_TOOLBAR_BOTH, meaning the tool item should show both an icon and a label, stacked verticallyGTK_TOOLBAR_ICONS, meaning the toolbar shows only iconsGTK_TOOLBAR_TEXT, meaning the tool item should only show textGTK_TOOLBAR_BOTH_HORIZ, meaning the tool item should show both an icon and a label, arranged horizontally
Declaration
Swift
@inlinable func getToolbarStyle() -> GtkToolbarStyle -
getUseDragWindow()Extension methodReturns whether
tool_itemhas a drag window. Seegtk_tool_item_set_use_drag_window().Declaration
Swift
@inlinable func getUseDragWindow() -> Bool -
getVisibleHorizontal()Extension methodReturns whether the
tool_itemis visible on toolbars that are docked horizontally.Declaration
Swift
@inlinable func getVisibleHorizontal() -> Bool -
getVisibleVertical()Extension methodReturns whether
tool_itemis visible when the toolbar is docked vertically. Seegtk_tool_item_set_visible_vertical().Declaration
Swift
@inlinable func getVisibleVertical() -> Bool -
rebuildMenu()Extension methodCalling this function signals to the toolbar that the overflow menu item for
tool_itemhas changed. If the overflow menu is visible when this function it called, the menu will be rebuilt.The function must be called when the tool item changes what it will do in response to the
GtkToolItem::create-menu-proxysignal.Declaration
Swift
@inlinable func rebuildMenu() -
retrieveProxyMenuItem()Extension methodReturns the
GtkMenuItemthat was last set bygtk_tool_item_set_proxy_menu_item(), ie. theGtkMenuItemthat is going to appear in the overflow menu.Declaration
Swift
@inlinable func retrieveProxyMenuItem() -> WidgetRef! -
set(expand:Extension method) Sets whether
tool_itemis allocated extra space when there is more room on the toolbar then needed for the items. The effect is that the item gets bigger when the toolbar gets bigger and smaller when the toolbar gets smaller.Declaration
Swift
@inlinable func set(expand: Bool) -
set(homogeneous:Extension method) Sets whether
tool_itemis to be allocated the same size as other homogeneous items. The effect is that all homogeneous items will have the same width as the widest of the items.Declaration
Swift
@inlinable func set(homogeneous: Bool) -
set(isImportant:Extension method) Sets whether
tool_itemshould be considered important. TheGtkToolButtonclass uses this property to determine whether to show or hide its label when the toolbar style isGTK_TOOLBAR_BOTH_HORIZ. The result is that only tool buttons with the “is_important” property set have labels, an effect known as “priority text”Declaration
Swift
@inlinable func set(isImportant: Bool) -
setProxyMenuItem(menuItemID:Extension methodmenuItem: ) Sets the
GtkMenuItemused in the toolbar overflow menu. Themenu_item_idis used to identify the caller of this function and should also be used withgtk_tool_item_get_proxy_menu_item().See also
GtkToolItem::create-menu-proxy.Declaration
Swift
@inlinable func setProxyMenuItem(menuItemID: UnsafePointer<gchar>!, menuItem: WidgetRef? = nil) -
setProxyMenuItem(menuItemID:Extension methodmenuItem: ) Sets the
GtkMenuItemused in the toolbar overflow menu. Themenu_item_idis used to identify the caller of this function and should also be used withgtk_tool_item_get_proxy_menu_item().See also
GtkToolItem::create-menu-proxy.Declaration
Swift
@inlinable func setProxyMenuItem<WidgetT>(menuItemID: UnsafePointer<gchar>!, menuItem: WidgetT?) where WidgetT : WidgetProtocol -
setTooltip(markup:Extension method) Sets the markup text to be displayed as tooltip on the item. See
gtk_widget_set_tooltip_markup().Declaration
Swift
@inlinable func setTooltip(markup: UnsafePointer<gchar>!) -
setTooltip(text:Extension method) Sets the text to be displayed as tooltip on the item. See
gtk_widget_set_tooltip_text().Declaration
Swift
@inlinable func setTooltip(text: UnsafePointer<gchar>!) -
set(useDragWindow:Extension method) Sets whether
tool_itemhas a drag window. Whentruethe toolitem can be used as a drag source throughgtk_drag_source_set(). Whentool_itemhas a drag window it will intercept all events, even those that would otherwise be sent to a child oftool_item.Declaration
Swift
@inlinable func set(useDragWindow: Bool) -
set(visibleHorizontal:Extension method) Sets whether
tool_itemis visible when the toolbar is docked horizontally.Declaration
Swift
@inlinable func set(visibleHorizontal: Bool) -
set(visibleVertical:Extension method) Sets whether
tool_itemis visible when the toolbar is docked vertically. Some tool items, such as text entries, are too wide to be useful on a vertically docked toolbar. Ifvisible_verticalisfalsetool_itemwill not appear on toolbars that are docked vertically.Declaration
Swift
@inlinable func set(visibleVertical: Bool) -
toolbarReconfigured()Extension methodEmits the signal
GtkToolItem::toolbar_reconfiguredontool_item.GtkToolbarand otherGtkToolShellimplementations use this function to notify children, when some aspect of their configuration changes.Declaration
Swift
@inlinable func toolbarReconfigured() -
ellipsizeModeExtension methodReturns the ellipsize mode used for
tool_item. Custom subclasses ofGtkToolItemshould call this function to find out how text should be ellipsized.Declaration
Swift
@inlinable var ellipsizeMode: PangoEllipsizeMode { get } -
expandExtension methodReturns whether
tool_itemis allocated extra space. Seegtk_tool_item_set_expand().Declaration
Swift
@inlinable var expand: Bool { get nonmutating set } -
homogeneousExtension methodReturns whether
tool_itemis the same size as other homogeneous items. Seegtk_tool_item_set_homogeneous().Declaration
Swift
@inlinable var homogeneous: Bool { get nonmutating set } -
iconSizeExtension methodReturns the icon size used for
tool_item. Custom subclasses ofGtkToolItemshould call this function to find out what size icons they should use.Declaration
Swift
@inlinable var iconSize: GtkIconSize { get } -
isImportantExtension methodReturns whether
tool_itemis considered important. Seegtk_tool_item_set_is_important()Declaration
Swift
@inlinable var isImportant: Bool { get nonmutating set } -
orientationExtension methodReturns the orientation used for
tool_item. Custom subclasses ofGtkToolItemshould call this function to find out what size icons they should use.Declaration
Swift
@inlinable var orientation: GtkOrientation { get } -
reliefStyleExtension methodReturns the relief style of
tool_item. Seegtk_button_set_relief(). Custom subclasses ofGtkToolItemshould call this function in the handler of theGtkToolItem::toolbar_reconfiguredsignal to find out the relief style of buttons.Declaration
Swift
@inlinable var reliefStyle: GtkReliefStyle { get } -
textAlignmentExtension methodReturns the text alignment used for
tool_item. Custom subclasses ofGtkToolItemshould call this function to find out how text should be aligned.Declaration
Swift
@inlinable var textAlignment: Double { get } -
textOrientationExtension methodReturns the text orientation used for
tool_item. Custom subclasses ofGtkToolItemshould call this function to find out how text should be orientated.Declaration
Swift
@inlinable var textOrientation: GtkOrientation { get } -
textSizeGroupExtension methodReturns the size group used for labels in
tool_item. Custom subclasses ofGtkToolItemshould call this function and use the size group for labels.Declaration
Swift
@inlinable var textSizeGroup: SizeGroupRef! { get } -
toolbarStyleExtension methodReturns the toolbar style used for
tool_item. Custom subclasses ofGtkToolItemshould call this function in the handler of the GtkToolItemtoolbar_reconfiguredsignal to find out in what style the toolbar is displayed and change themselves accordinglyPossibilities are:
GTK_TOOLBAR_BOTH, meaning the tool item should show both an icon and a label, stacked verticallyGTK_TOOLBAR_ICONS, meaning the toolbar shows only iconsGTK_TOOLBAR_TEXT, meaning the tool item should only show textGTK_TOOLBAR_BOTH_HORIZ, meaning the tool item should show both an icon and a label, arranged horizontally
Declaration
Swift
@inlinable var toolbarStyle: GtkToolbarStyle { get } -
useDragWindowExtension methodReturns whether
tool_itemhas a drag window. Seegtk_tool_item_set_use_drag_window().Declaration
Swift
@inlinable var useDragWindow: Bool { get nonmutating set } -
visibleHorizontalExtension methodReturns whether the
tool_itemis visible on toolbars that are docked horizontally.Declaration
Swift
@inlinable var visibleHorizontal: Bool { get nonmutating set } -
visibleVerticalExtension methodReturns whether
tool_itemis visible when the toolbar is docked vertically. Seegtk_tool_item_set_visible_vertical().Declaration
Swift
@inlinable var visibleVertical: Bool { get nonmutating set } -
parentExtension methodUndocumented
Declaration
Swift
@inlinable var parent: GtkBin { get }
View on GitHub
Install in Dash
ToolItemProtocol Protocol Reference