CheckButton
open class CheckButton : Widget, CheckButtonProtocol
A GtkCheckButton places a label next to an indicator.

A GtkCheckButton is created by calling either [ctorGtk.CheckButton.new]
or [ctorGtk.CheckButton.new_with_label].
The state of a GtkCheckButton can be set specifically using
[methodGtk.CheckButton.set_active], and retrieved using
[methodGtk.CheckButton.get_active].
Inconsistent state
In addition to “on” and “off”, check buttons can be an “in between” state that is neither on nor off. This can be used e.g. when the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a check button, and the current values in that range are inconsistent.
To set a GtkCheckButton to inconsistent state, use
[methodGtk.CheckButton.set_inconsistent].
Grouping
Check buttons can be grouped together, to form mutually exclusive groups - only one of the buttons can be toggled at a time, and toggling another one will switch the currently toggled one off.
Grouped check buttons use a different indicator, and are commonly referred to as radio buttons.

To add a GtkCheckButton to a group, use [methodGtk.CheckButton.set_group].
CSS nodes
checkbutton[.text-button]
├── check
╰── [label]
A GtkCheckButton has a main node with name checkbutton. If the
[propertyGtk.CheckButton:label] property is set, it contains a label
child. The indicator node is named check when no group is set, and
radio if the checkbutton is grouped together with other checkbuttons.
Accessibility
GtkCheckButton uses the GTK_ACCESSIBLE_ROLE_CHECKBOX role.
The CheckButton type acts as a reference-counted owner of an underlying GtkCheckButton instance.
It provides the methods that can operate on this data type through CheckButtonProtocol conformance.
Use CheckButton as a strong reference or owner of a GtkCheckButton instance.
-
Designated initialiser from the underlying `C` data type.This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the
CheckButtoninstance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkCheckButton>)Parameters
oppointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theCheckButtoninstance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkCheckButton>)Parameters
oppointer to the underlying object
-
Optional initialiser from a non-mutating
gpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theCheckButtoninstance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)Parameters
opgpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theCheckButtoninstance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)Parameters
oppointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theCheckButtoninstance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkCheckButton>?)Parameters
oppointer to the underlying object
-
Optional initialiser from the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theCheckButtoninstance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkCheckButton>?)Parameters
oppointer to the underlying object
-
Designated initialiser from the underlying
Cdata type. Will retainGtkCheckButton. i.e., ownership is transferred to theCheckButtoninstance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkCheckButton>)Parameters
oppointer to the underlying object
-
Reference intialiser for a related type that implements
CheckButtonProtocolWill retainGtkCheckButton.Declaration
Swift
@inlinable public init<T>(checkButton other: T) where T : CheckButtonProtocolParameters
otheran instance of a related type that implements
CheckButtonProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CheckButtonProtocol.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CheckButtonProtocol.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CheckButtonProtocol.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)Parameters
praw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CheckButtonProtocol.Declaration
Swift
@inlinable override public init(retainingRaw raw: UnsafeRawPointer) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CheckButtonProtocol.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)Parameters
pmutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CheckButtonProtocol.Declaration
Swift
@inlinable required public init(retainingRaw raw: UnsafeMutableRawPointer)Parameters
rawmutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CheckButtonProtocol.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CheckButtonProtocol.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Creates a new
GtkCheckButton.Declaration
Swift
@inlinable public init() -
Creates a new
GtkCheckButtonwith the given text.Declaration
Swift
@inlinable public init(label: UnsafePointer<CChar>? = nil) -
Creates a new
GtkCheckButtonwith the given text and a mnemonic.Declaration
Swift
@inlinable public init(mnemonic label: UnsafePointer<CChar>? = nil) -
Creates a new
GtkCheckButtonwith the given text.Declaration
Swift
@inlinable public static func newWith(label: UnsafePointer<CChar>? = nil) -> Widget! -
Creates a new
GtkCheckButtonwith the given text and a mnemonic.Declaration
Swift
@inlinable public static func newWith(mnemonic label: UnsafePointer<CChar>? = nil) -> Widget! -
Create a group of check buttons with the given array of labels
Declaration
Swift
@inlinable static func groupWith(labels: [String]) -> [CheckButton]Parameters
labelsarray of labels for the check buttons
Return Value
grouped array of radio buttons
-
Create a group of radio buttons with the given labels
Declaration
Swift
@inlinable static func groupLabeled(_ ls: String...) -> [CheckButton]Parameters
lslabels to use for the radio buttons
Return Value
grouped array of radio buttons
-
Create a group of check buttons with the given labels. Underscores in the labels denote the mnemonics for the corresponding buttons.
Declaration
Swift
@inlinable static func groupWith(mnemonics: [String]) -> [CheckButton]Parameters
mnemonicslabels to use for the buttons
Return Value
grouped array of radio buttons
-
Create a group of check buttons with the given labels Underscores in the labels denote the mnemonics for the corresponding buttons.
Declaration
Swift
@inlinable static func groupWithMnemonics(_ ms: String...) -> [CheckButton]Parameters
mslabels to use for the buttons
Return Value
grouped array of radio buttons
View on GitHub
Install in Dash
CheckButton Class Reference