ToolButtonProtocol
public protocol ToolButtonProtocol : ActionableProtocol, ToolItemProtocol
GtkToolButtons
are GtkToolItems
containing buttons.
Use gtk_tool_button_new()
to create a new GtkToolButton
.
The label of a GtkToolButton
is determined by the properties
GtkToolButton:label-widget
, GtkToolButton:label
, and
GtkToolButton:stock-id
. If GtkToolButton:label-widget
is
non-nil
, then that widget is used as the label. Otherwise, if
GtkToolButton:label
is non-nil
, that string is used as the label.
Otherwise, if GtkToolButton:stock-id
is non-nil
, the label is
determined by the stock item. Otherwise, the button does not have a label.
The icon of a GtkToolButton
is determined by the properties
GtkToolButton:icon-widget
and GtkToolButton:stock-id
. If
GtkToolButton:icon-widget
is non-nil
, then
that widget is used as the icon. Otherwise, if GtkToolButton:stock-id
is
non-nil
, the icon is determined by the stock item. Otherwise,
the button does not have a icon.
CSS nodes
GtkToolButton has a single CSS node with name toolbutton.
The ToolButtonProtocol
protocol exposes the methods and properties of an underlying GtkToolButton
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 ToolButton
.
Alternatively, use ToolButtonRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkToolButton
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
tool_button_ptr
Default implementationTyped pointer to the underlying
GtkToolButton
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkToolButton
instance.Declaration
Swift
var tool_button_ptr: UnsafeMutablePointer<GtkToolButton>! { get }
-
Required Initialiser for types conforming to
ToolButtonProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ToolButtonPropertyName
source property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: ToolButtonPropertyName, 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 ToolButton property
Declaration
Swift
@inlinable func get(property: ToolButtonPropertyName) -> 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 ToolButton property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: ToolButtonPropertyName, 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
ToolButtonSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolButtonSignalName, 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
ToolButtonSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolButtonSignalName, 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)
-
onClicked(flags:
Extension methodhandler: ) This signal is emitted when the tool button is clicked with the mouse or activated with the keyboard.
Note
This represents the underlyingclicked
signalDeclaration
Swift
@discardableResult @inlinable func onClicked(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
clicked
signal is emitted -
clickedSignal
Extension methodTyped
clicked
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var clickedSignal: ToolButtonSignalName { get }
-
onNotifyIconName(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::icon-name
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyIconName(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyIconName
signal is emitted -
notifyIconNameSignal
Extension methodTyped
notify::icon-name
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyIconNameSignal: ToolButtonSignalName { get }
-
onNotifyIconWidget(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::icon-widget
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyIconWidget(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyIconWidget
signal is emitted -
notifyIconWidgetSignal
Extension methodTyped
notify::icon-widget
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyIconWidgetSignal: ToolButtonSignalName { get }
-
onNotifyLabel(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::label
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyLabel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyLabel
signal is emitted -
notifyLabelSignal
Extension methodTyped
notify::label
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyLabelSignal: ToolButtonSignalName { get }
-
onNotifyLabelWidget(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::label-widget
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyLabelWidget(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyLabelWidget
signal is emitted -
notifyLabelWidgetSignal
Extension methodTyped
notify::label-widget
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyLabelWidgetSignal: ToolButtonSignalName { get }
-
onNotifyStockID(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::stock-id
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyStockID(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyStockID
signal is emitted -
notifyStockIDSignal
Extension methodTyped
notify::stock-id
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyStockIDSignal: ToolButtonSignalName { get }
-
onNotifyUseUnderline(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::use-underline
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyUseUnderline(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyUseUnderline
signal is emitted -
notifyUseUnderlineSignal
Extension methodTyped
notify::use-underline
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyUseUnderlineSignal: ToolButtonSignalName { get }
-
getIconName()
Extension methodReturns the name of the themed icon for the tool button, see
gtk_tool_button_set_icon_name()
.Declaration
Swift
@inlinable func getIconName() -> String!
-
getIconWidget()
Extension methodReturn the widget used as icon widget on
button
. Seegtk_tool_button_set_icon_widget()
.Declaration
Swift
@inlinable func getIconWidget() -> WidgetRef!
-
getLabel()
Extension methodReturns the label used by the tool button, or
nil
if the tool button doesn’t have a label. or uses a the label from a stock item. The returned string is owned by GTK+, and must not be modified or freed.Declaration
Swift
@inlinable func getLabel() -> String!
-
getLabelWidget()
Extension methodReturns the widget used as label on
button
. Seegtk_tool_button_set_label_widget()
.Declaration
Swift
@inlinable func getLabelWidget() -> WidgetRef!
-
getStockID()
Extension methodReturns the name of the stock item. See
gtk_tool_button_set_stock_id()
. The returned string is owned by GTK+ and must not be freed or modifed.get_stock_id is deprecated: Use gtk_tool_button_get_icon_name() instead.
Declaration
Swift
@available(*, deprecated) @inlinable func getStockID() -> String!
-
getUseUnderline()
Extension methodReturns whether underscores in the label property are used as mnemonics on menu items on the overflow menu. See
gtk_tool_button_set_use_underline()
.Declaration
Swift
@inlinable func getUseUnderline() -> Bool
-
set(iconName:
Extension method) Sets the icon for the tool button from a named themed icon. See the docs for
GtkIconTheme
for more details. TheGtkToolButton:icon-name
property only has an effect if not overridden by non-nil
GtkToolButton:label-widget
,GtkToolButton:icon-widget
andGtkToolButton:stock-id
properties.Declaration
Swift
@inlinable func set(iconName: UnsafePointer<gchar>? = nil)
-
set(iconWidget:
Extension method) Sets
icon
as the widget used as icon onbutton
. Ificon_widget
isnil
the icon is determined by theGtkToolButton:stock-id
property. If theGtkToolButton:stock-id
property is alsonil
,button
will not have an icon.Declaration
Swift
@inlinable func set(iconWidget: WidgetRef? = nil)
-
set(iconWidget:
Extension method) Sets
icon
as the widget used as icon onbutton
. Ificon_widget
isnil
the icon is determined by theGtkToolButton:stock-id
property. If theGtkToolButton:stock-id
property is alsonil
,button
will not have an icon.Declaration
Swift
@inlinable func set<WidgetT>(iconWidget: WidgetT?) where WidgetT : WidgetProtocol
-
set(label:
Extension method) Sets
label
as the label used for the tool button. TheGtkToolButton:label
property only has an effect if not overridden by a non-nil
GtkToolButton:label-widget
property. If both theGtkToolButton:label-widget
andGtkToolButton:label
properties arenil
, the label is determined by theGtkToolButton:stock-id
property. If theGtkToolButton:stock-id
property is alsonil
,button
will not have a label.Declaration
Swift
@inlinable func set(label: UnsafePointer<gchar>? = nil)
-
set(labelWidget:
Extension method) Sets
label_widget
as the widget that will be used as the label forbutton
. Iflabel_widget
isnil
theGtkToolButton:label
property is used as label. IfGtkToolButton:label
is alsonil
, the label in the stock item determined by theGtkToolButton:stock-id
property is used as label. IfGtkToolButton:stock-id
is alsonil
,button
does not have a label.Declaration
Swift
@inlinable func set(labelWidget: WidgetRef? = nil)
-
set(labelWidget:
Extension method) Sets
label_widget
as the widget that will be used as the label forbutton
. Iflabel_widget
isnil
theGtkToolButton:label
property is used as label. IfGtkToolButton:label
is alsonil
, the label in the stock item determined by theGtkToolButton:stock-id
property is used as label. IfGtkToolButton:stock-id
is alsonil
,button
does not have a label.Declaration
Swift
@inlinable func set<WidgetT>(labelWidget: WidgetT?) where WidgetT : WidgetProtocol
-
set(stockID:
Extension method) Sets the name of the stock item. See
gtk_tool_button_new_from_stock()
. The stock_id property only has an effect if not overridden by non-nil
GtkToolButton:label-widget
andGtkToolButton:icon-widget
properties.set_stock_id is deprecated: Use gtk_tool_button_set_icon_name() instead.
Declaration
Swift
@available(*, deprecated) @inlinable func set(stockID: UnsafePointer<gchar>? = nil)
-
set(useUnderline:
Extension method) If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu. For example, if the label property is “_Open” and
use_underline
istrue
, the label on the tool button will be “Open” and the item on the overflow menu will have an underlined “O”.Labels shown on tool buttons never have mnemonics on them; this property only affects the menu item on the overflow menu.
Declaration
Swift
@inlinable func set(useUnderline: Bool)
-
iconName
Extension methodReturns the name of the themed icon for the tool button, see
gtk_tool_button_set_icon_name()
.Declaration
Swift
@inlinable var iconName: String! { get nonmutating set }
-
iconWidget
Extension methodReturn the widget used as icon widget on
button
. Seegtk_tool_button_set_icon_widget()
.Declaration
Swift
@inlinable var iconWidget: WidgetRef! { get nonmutating set }
-
label
Extension methodUndocumented
Declaration
Swift
@inlinable var label: String! { get nonmutating set }
-
labelWidget
Extension methodReturns the widget used as label on
button
. Seegtk_tool_button_set_label_widget()
.Declaration
Swift
@inlinable var labelWidget: WidgetRef! { get nonmutating set }
-
stockID
Extension methodReturns the name of the stock item. See
gtk_tool_button_set_stock_id()
. The returned string is owned by GTK+ and must not be freed or modifed.get_stock_id is deprecated: Use gtk_tool_button_get_icon_name() instead.
Declaration
Swift
@inlinable var stockID: String! { get nonmutating set }
-
useUnderline
Extension methodReturns whether underscores in the label property are used as mnemonics on menu items on the overflow menu. See
gtk_tool_button_set_use_underline()
.Declaration
Swift
@inlinable var useUnderline: Bool { get nonmutating set }
-
parent
Extension methodUndocumented
Declaration
Swift
@inlinable var parent: GtkToolItem { get }