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
GtkToolItem
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
tool_item_ptr
Default implementationTyped pointer to the underlying
GtkToolItem
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkToolItem
instance.Declaration
Swift
var tool_item_ptr: UnsafeMutablePointer<GtkToolItem>! { get }
-
Required Initialiser for types conforming to
ToolItemProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ToolItemPropertyName
source 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 : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a ToolItem property
Declaration
Swift
@inlinable func get(property: ToolItemPropertyName) -> GLibObject.Value
Parameters
property
the 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
property
the 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
ToolItemSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolItemSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
handler
The 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
ToolItemSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolItemSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
signalHandler
The 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_item
about 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 anil
pointer and returntrue
to 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
false
to 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-proxy
signalDeclaration
Swift
@discardableResult @inlinable func onCreateMenuProxy(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef) -> Bool) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
true
if the signal was handled,false
if not Run the given callback whenever thecreateMenuProxy
signal is emitted -
createMenuProxySignal
Extension methodTyped
create-menu-proxy
signal 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-reconfigured
signalDeclaration
Swift
@discardableResult @inlinable func onToolbarReconfigured(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
toolbarReconfigured
signal is emitted -
toolbarReconfiguredSignal
Extension methodTyped
toolbar-reconfigured
signal 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 innotify
being 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-important
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyIsImportant(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyIsImportant
signal is emitted -
notifyIsImportantSignal
Extension methodTyped
notify::is-important
signal 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 innotify
being 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-horizontal
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyVisibleHorizontal(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyVisibleHorizontal
signal is emitted -
notifyVisibleHorizontalSignal
Extension methodTyped
notify::visible-horizontal
signal 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 innotify
being 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-vertical
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyVisibleVertical(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyVisibleVertical
signal is emitted -
notifyVisibleVerticalSignal
Extension methodTyped
notify::visible-vertical
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyVisibleVerticalSignal: ToolItemSignalName { get }
-
getEllipsizeMode()
Extension methodReturns the ellipsize mode used for
tool_item
. Custom subclasses ofGtkToolItem
should call this function to find out how text should be ellipsized.Declaration
Swift
@inlinable func getEllipsizeMode() -> PangoEllipsizeMode
-
getExpand()
Extension methodReturns whether
tool_item
is allocated extra space. Seegtk_tool_item_set_expand()
.Declaration
Swift
@inlinable func getExpand() -> Bool
-
getHomogeneous()
Extension methodReturns whether
tool_item
is 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 ofGtkToolItem
should call this function to find out what size icons they should use.Declaration
Swift
@inlinable func getIconSize() -> GtkIconSize
-
getIsImportant()
Extension methodReturns whether
tool_item
is 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 ofGtkToolItem
should 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_id
matches the string passed togtk_tool_item_set_proxy_menu_item()
return the correspondingGtkMenuItem
.Custom subclasses of
GtkToolItem
should use this function to update their menu item when theGtkToolItem
changes. That themenu_item_ids
must match ensures that aGtkToolItem
will 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 ofGtkToolItem
should call this function in the handler of theGtkToolItem::toolbar_reconfigured
signal 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 ofGtkToolItem
should 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 ofGtkToolItem
should 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 ofGtkToolItem
should 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 ofGtkToolItem
should call this function in the handler of the GtkToolItemtoolbar_reconfigured
signal 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_item
has a drag window. Seegtk_tool_item_set_use_drag_window()
.Declaration
Swift
@inlinable func getUseDragWindow() -> Bool
-
getVisibleHorizontal()
Extension methodReturns whether the
tool_item
is visible on toolbars that are docked horizontally.Declaration
Swift
@inlinable func getVisibleHorizontal() -> Bool
-
getVisibleVertical()
Extension methodReturns whether
tool_item
is 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_item
has 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-proxy
signal.Declaration
Swift
@inlinable func rebuildMenu()
-
retrieveProxyMenuItem()
Extension methodReturns the
GtkMenuItem
that was last set bygtk_tool_item_set_proxy_menu_item()
, ie. theGtkMenuItem
that is going to appear in the overflow menu.Declaration
Swift
@inlinable func retrieveProxyMenuItem() -> WidgetRef!
-
set(expand:
Extension method) Sets whether
tool_item
is 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_item
is 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_item
should be considered important. TheGtkToolButton
class 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
GtkMenuItem
used in the toolbar overflow menu. Themenu_item_id
is 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
GtkMenuItem
used in the toolbar overflow menu. Themenu_item_id
is 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_item
has a drag window. Whentrue
the toolitem can be used as a drag source throughgtk_drag_source_set()
. Whentool_item
has 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_item
is visible when the toolbar is docked horizontally.Declaration
Swift
@inlinable func set(visibleHorizontal: Bool)
-
set(visibleVertical:
Extension method) Sets whether
tool_item
is 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_vertical
isfalse
tool_item
will not appear on toolbars that are docked vertically.Declaration
Swift
@inlinable func set(visibleVertical: Bool)
-
toolbarReconfigured()
Extension methodEmits the signal
GtkToolItem::toolbar_reconfigured
ontool_item
.GtkToolbar
and otherGtkToolShell
implementations use this function to notify children, when some aspect of their configuration changes.Declaration
Swift
@inlinable func toolbarReconfigured()
-
ellipsizeMode
Extension methodReturns the ellipsize mode used for
tool_item
. Custom subclasses ofGtkToolItem
should call this function to find out how text should be ellipsized.Declaration
Swift
@inlinable var ellipsizeMode: PangoEllipsizeMode { get }
-
expand
Extension methodReturns whether
tool_item
is allocated extra space. Seegtk_tool_item_set_expand()
.Declaration
Swift
@inlinable var expand: Bool { get nonmutating set }
-
homogeneous
Extension methodReturns whether
tool_item
is the same size as other homogeneous items. Seegtk_tool_item_set_homogeneous()
.Declaration
Swift
@inlinable var homogeneous: Bool { get nonmutating set }
-
iconSize
Extension methodReturns the icon size used for
tool_item
. Custom subclasses ofGtkToolItem
should call this function to find out what size icons they should use.Declaration
Swift
@inlinable var iconSize: GtkIconSize { get }
-
isImportant
Extension methodReturns whether
tool_item
is considered important. Seegtk_tool_item_set_is_important()
Declaration
Swift
@inlinable var isImportant: Bool { get nonmutating set }
-
orientation
Extension methodReturns the orientation used for
tool_item
. Custom subclasses ofGtkToolItem
should call this function to find out what size icons they should use.Declaration
Swift
@inlinable var orientation: GtkOrientation { get }
-
reliefStyle
Extension methodReturns the relief style of
tool_item
. Seegtk_button_set_relief()
. Custom subclasses ofGtkToolItem
should call this function in the handler of theGtkToolItem::toolbar_reconfigured
signal to find out the relief style of buttons.Declaration
Swift
@inlinable var reliefStyle: GtkReliefStyle { get }
-
textAlignment
Extension methodReturns the text alignment used for
tool_item
. Custom subclasses ofGtkToolItem
should call this function to find out how text should be aligned.Declaration
Swift
@inlinable var textAlignment: Double { get }
-
textOrientation
Extension methodReturns the text orientation used for
tool_item
. Custom subclasses ofGtkToolItem
should call this function to find out how text should be orientated.Declaration
Swift
@inlinable var textOrientation: GtkOrientation { get }
-
textSizeGroup
Extension methodReturns the size group used for labels in
tool_item
. Custom subclasses ofGtkToolItem
should call this function and use the size group for labels.Declaration
Swift
@inlinable var textSizeGroup: SizeGroupRef! { get }
-
toolbarStyle
Extension methodReturns the toolbar style used for
tool_item
. Custom subclasses ofGtkToolItem
should call this function in the handler of the GtkToolItemtoolbar_reconfigured
signal 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 }
-
useDragWindow
Extension methodReturns whether
tool_item
has a drag window. Seegtk_tool_item_set_use_drag_window()
.Declaration
Swift
@inlinable var useDragWindow: Bool { get nonmutating set }
-
visibleHorizontal
Extension methodReturns whether the
tool_item
is visible on toolbars that are docked horizontally.Declaration
Swift
@inlinable var visibleHorizontal: Bool { get nonmutating set }
-
visibleVertical
Extension methodReturns whether
tool_item
is visible when the toolbar is docked vertically. Seegtk_tool_item_set_visible_vertical()
.Declaration
Swift
@inlinable var visibleVertical: Bool { get nonmutating set }
-
parent
Extension methodUndocumented
Declaration
Swift
@inlinable var parent: GtkBin { get }