It derives from <GtkWidget>.
Places a label next to an indicator.
A <GtkCheckButton> is created by calling
either check-button:new or
check-button:new-with-label.
The state of a <GtkCheckButton> can be set
specifically using check-button:set-active, and retrieved using
check-button:get-active?.
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 check-button:set-inconsistent.
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
check-button:set-group.
When the code must keep track of the state of a group of radio buttons,
it is recommended to keep track of such state through a stateful
<GAction> with a target for each button. Using
the toggled signals to keep track of the group changes and state
is discouraged.
<GtkCheckButton> supports the following
keyboard shortcuts:
checkbutton[.text-button][.grouped] ├── check ╰── [label]
A <GtkCheckButton> has a main node with name
checkbutton. If the check-button:label or check-button:child properties are set, it contains a child
widget. The indicator node is named check when no group is set, and
radio if the checkbutton is grouped together with other checkbuttons.
<GtkCheckButton> uses the
Gtk.AccessibleRole.checkbox role.
parent-instanceIf the check button is active.
Setting active to #t will add the :checked: state
to both the check button and the indicator CSS node.
Its value is a boolean.
Set it with (set! (check-button:active self) value).
The child widget.
Its value is a <GtkWidget>, or #f.
Set it with (set! (check-button:child self) value).
The check button whose group this widget belongs to.
Its value is a <GtkCheckButton>, or #f.
It can only be set, with (set! (check-button:group self) value).
If the check button is in an “in between” state.
The inconsistent state only affects visual appearance, not the semantics of the button.
Its value is a boolean.
Set it with (set! (check-button:inconsistent self) value).
Text of the label inside the check button, if it contains a label widget.
Its value is a string, or #f.
Set it with (set! (check-button:label self) value).
If set, an underline in the text indicates that the following character is to be used as mnemonic.
Its value is a boolean.
Set it with (set! (check-button:use-underline self) value).
Returns whether the check button is active.
Passed: a <GtkCheckButton>.
Returned: a boolean.
whether the check button is active
Gets the child widget of self or NULL if
CheckButton:label is set.
Passed: a <GtkCheckButton>.
Returned: a <GtkWidget>, or #f.
the child widget of self
Returns whether the check button is in an inconsistent state.
Passed: a <GtkCheckButton>.
Returned: a boolean.
#t if self is currently in an inconsistent state
Returns the label of the check button or NULL if
CheckButton:child is set.
Passed: a <GtkCheckButton>.
Returned: a string, or #f.
The label self shows next to the indicator. If no label is shown,
#f will be returned.
Returns whether underlines in the label indicate mnemonics.
Passed: a <GtkCheckButton>.
Returned: a boolean.
The value of the check-button:use-underline property. See
check-button:set-use-underline for details on how
to set a new value.
Creates a new <GtkCheckButton>.
Returned: a <GtkWidget>.
a new <GtkCheckButton>
Creates a new <GtkCheckButton> with the given
text.
Passed, or left out: a string, or #f.
the text for the check button.
Returned: a <GtkWidget>.
a new <GtkCheckButton>
Creates a new <GtkCheckButton> with the given
text and a mnemonic.
Passed, or left out: a string, or #f.
The text of the button, with an underscore in front of the mnemonic character
Returned: a <GtkWidget>.
a new <GtkCheckButton>
Changes the check buttons active state.
Passed: a <GtkCheckButton>.
Passed: a boolean.
the new value to set
Sets the child widget of self.
Note that by using this API, you take full responsibility for setting up the proper accessibility label and description information for self. Most likely, you’ll either set the accessibility label or description for self explicitly, or you’ll set a labelled-by or described-by relations from child to self.
Passed: a <GtkCheckButton>.
Passed, or left out: a <GtkWidget>, or #f.
the child widget
Adds self to the group of group.
In a group of multiple check buttons, only one button can be active at a time. The behavior of a checkbutton in a group is also commonly known as a radio button.
Setting the group of a check button also changes the css name of the indicator widget’s CSS node to ’radio’.
Setting up groups in a cycle leads to undefined behavior.
Note that the same effect can be achieved via the
<GtkActionable> API, by using the same action
with parameter type and state type ’s’ for all buttons in the group, and
giving each button its own target value.
Passed: a <GtkCheckButton>.
Passed, or left out: a <GtkCheckButton>, or
#f.
another <GtkCheckButton> to form a group with
Sets the <GtkCheckButton> to inconsistent
state.
You should turn off the inconsistent state again if the user checks the check button. This has to be done manually.
Passed: a <GtkCheckButton>.
Passed: a boolean.
#t if state is inconsistent
Sets the text of self.
If check-button:use-underline is #t, an underscore
in label is interpreted as mnemonic indicator, see
check-button:set-use-underline for details on this
behavior.
Passed: a <GtkCheckButton>.
Passed, or left out: a string, or #f.
The text shown next to the indicator, or #f to show no text
Sets whether underlines in the label indicate mnemonics.
If setting is #t, an underscore character in self’s
label indicates a mnemonic accelerator key. This behavior is similar to
label:use-underline.
Passed: a <GtkCheckButton>.
Passed: a boolean.
the new value to set
Connect a handler with (connect object check-button:activate
handler). It is called as (handler self).
Emitted to when the check button is activated.
The ::activate signal on
<GtkCheckButton> is an action signal and
emitting it causes the button to animate press then release.
Applications should never connect to this signal, but use the
check-button:toggled signal.
The default bindings for this signal are all forms of the ␣ and Enter keys.
Passed: a <GtkCheckButton>.
Connect a handler with (connect object check-button:toggled
handler). It is called as (handler self).
Emitted when the buttons’s check-button:active property changes.
Passed: a <GtkCheckButton>.
To override it in a new class, give register-type #:vfuncs
`((activate . ,procedure)). The procedure is called as
(procedure self).
Passed: the class whose implementation to call:
<GtkCheckButton>, or a class that derives from
it, or its GType number.
Passed: a <GtkCheckButton>.
To override it in a new class, give register-type #:vfuncs
`((toggled . ,procedure)). The procedure is called as
(procedure self).
Passed: the class whose implementation to call:
<GtkCheckButton>, or a class that derives from
it, or its GType number.
Passed: a <GtkCheckButton>.