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
GtkToolButtoninstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
tool_button_ptrDefault implementationTyped pointer to the underlying
GtkToolButtoninstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkToolButtoninstance.Declaration
Swift
var tool_button_ptr: UnsafeMutablePointer<GtkToolButton>! { get } -
Required Initialiser for types conforming to
ToolButtonProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ToolButtonPropertyNamesource 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 : 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 ToolButton property
Declaration
Swift
@inlinable func get(property: ToolButtonPropertyName) -> 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 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
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
ToolButtonSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolButtonSignalName, 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
ToolButtonSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolButtonSignalName, 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)
-
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 underlyingclickedsignalDeclaration
Swift
@discardableResult @inlinable func onClicked(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
clickedsignal is emitted -
clickedSignalExtension methodTyped
clickedsignal 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 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-namesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyIconName(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyIconNamesignal is emitted -
notifyIconNameSignalExtension methodTyped
notify::icon-namesignal 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 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-widgetsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyIconWidget(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyIconWidgetsignal is emitted -
notifyIconWidgetSignalExtension methodTyped
notify::icon-widgetsignal 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 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::labelsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyLabel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyLabelsignal is emitted -
notifyLabelSignalExtension methodTyped
notify::labelsignal 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 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::label-widgetsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyLabelWidget(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyLabelWidgetsignal is emitted -
notifyLabelWidgetSignalExtension methodTyped
notify::label-widgetsignal 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 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::stock-idsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyStockID(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyStockIDsignal is emitted -
notifyStockIDSignalExtension methodTyped
notify::stock-idsignal 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 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::use-underlinesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyUseUnderline(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolButtonRef, _ 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
notifyUseUnderlinesignal is emitted -
notifyUseUnderlineSignalExtension methodTyped
notify::use-underlinesignal 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
nilif 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
GtkIconThemefor more details. TheGtkToolButton:icon-nameproperty only has an effect if not overridden by non-nilGtkToolButton:label-widget,GtkToolButton:icon-widgetandGtkToolButton:stock-idproperties.Declaration
Swift
@inlinable func set(iconName: UnsafePointer<gchar>? = nil) -
set(iconWidget:Extension method) Sets
iconas the widget used as icon onbutton. Ificon_widgetisnilthe icon is determined by theGtkToolButton:stock-idproperty. If theGtkToolButton:stock-idproperty is alsonil,buttonwill not have an icon.Declaration
Swift
@inlinable func set(iconWidget: WidgetRef? = nil) -
set(iconWidget:Extension method) Sets
iconas the widget used as icon onbutton. Ificon_widgetisnilthe icon is determined by theGtkToolButton:stock-idproperty. If theGtkToolButton:stock-idproperty is alsonil,buttonwill not have an icon.Declaration
Swift
@inlinable func set<WidgetT>(iconWidget: WidgetT?) where WidgetT : WidgetProtocol -
set(label:Extension method) Sets
labelas the label used for the tool button. TheGtkToolButton:labelproperty only has an effect if not overridden by a non-nilGtkToolButton:label-widgetproperty. If both theGtkToolButton:label-widgetandGtkToolButton:labelproperties arenil, the label is determined by theGtkToolButton:stock-idproperty. If theGtkToolButton:stock-idproperty is alsonil,buttonwill not have a label.Declaration
Swift
@inlinable func set(label: UnsafePointer<gchar>? = nil) -
set(labelWidget:Extension method) Sets
label_widgetas the widget that will be used as the label forbutton. Iflabel_widgetisniltheGtkToolButton:labelproperty is used as label. IfGtkToolButton:labelis alsonil, the label in the stock item determined by theGtkToolButton:stock-idproperty is used as label. IfGtkToolButton:stock-idis alsonil,buttondoes not have a label.Declaration
Swift
@inlinable func set(labelWidget: WidgetRef? = nil) -
set(labelWidget:Extension method) Sets
label_widgetas the widget that will be used as the label forbutton. Iflabel_widgetisniltheGtkToolButton:labelproperty is used as label. IfGtkToolButton:labelis alsonil, the label in the stock item determined by theGtkToolButton:stock-idproperty is used as label. IfGtkToolButton:stock-idis alsonil,buttondoes 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-nilGtkToolButton:label-widgetandGtkToolButton:icon-widgetproperties.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_underlineistrue, 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) -
iconNameExtension 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 } -
iconWidgetExtension methodReturn the widget used as icon widget on
button. Seegtk_tool_button_set_icon_widget().Declaration
Swift
@inlinable var iconWidget: WidgetRef! { get nonmutating set } -
labelExtension methodUndocumented
Declaration
Swift
@inlinable var label: String! { get nonmutating set } -
labelWidgetExtension methodReturns the widget used as label on
button. Seegtk_tool_button_set_label_widget().Declaration
Swift
@inlinable var labelWidget: WidgetRef! { get nonmutating set } -
stockIDExtension 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 } -
useUnderlineExtension 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 } -
parentExtension methodUndocumented
Declaration
Swift
@inlinable var parent: GtkToolItem { get }
View on GitHub
Install in Dash
ToolButtonProtocol Protocol Reference