CheckButtonRef

public struct CheckButtonRef : CheckButtonProtocol, GWeakCapturing

A GtkCheckButton places a label next to an indicator.

Example GtkCheckButtons

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.

Example GtkCheckButtons

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 CheckButtonRef type acts as a lightweight Swift reference to an underlying GtkCheckButton instance. It exposes methods that can operate on this data type through CheckButtonProtocol conformance. Use CheckButtonRef only as an unowned reference to an existing GtkCheckButton instance.

  • ptr
    Untyped pointer to the underlying `GtkCheckButton` instance.
    

    For type-safe access, use the generated, typed pointer check_button_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

CheckButton Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkCheckButton>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkCheckButton>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkCheckButton>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkCheckButton>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements CheckButtonProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : CheckButtonProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> CheckButtonRef where T : CheckButtonProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to CheckButtonProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to CheckButtonProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to CheckButtonProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating 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
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to CheckButtonProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new GtkCheckButton.

    Declaration

    Swift

    @inlinable
    init()
  • Creates a new GtkCheckButton with the given text.

    Declaration

    Swift

    @inlinable
    init(label: UnsafePointer<CChar>? = nil)
  • Creates a new GtkCheckButton with the given text and a mnemonic.

    Declaration

    Swift

    @inlinable
    init(mnemonic label: UnsafePointer<CChar>? = nil)
  • Creates a new GtkCheckButton with the given text.

    Declaration

    Swift

    @inlinable
    static func newWith(label: UnsafePointer<CChar>? = nil) -> WidgetRef!
  • Creates a new GtkCheckButton with the given text and a mnemonic.

    Declaration

    Swift

    @inlinable
    static func newWith(mnemonic label: UnsafePointer<CChar>? = nil) -> WidgetRef!