PtOnOffButton
An on/off button that can be set or unset
Class hierarchy:
PtWidget -> PtBasic -> PtLabel -> PtToggleButton -> PtOnOffButton
For more information, see the diagram of the widget hierarchy.
PhAB icon:

Public header:
<photon/PtOnOffButton.h>
Description:
A PtOnOffButton widget displays an on/off button that can be set or unset. Instances of this class of widget are typically used in exclusive or nonexclusive groups.

A PtOnOffButton widget.
New resources:
| Resource | C type | Pt type | Default |
|---|---|---|---|
| Pt_ARG_ONOFF_STATE | short | Scalar | 0 (off) |
| Pt_CB_ONOFF_NEW_VALUE | PtCallback_t * | Link | NULL |
Pt_ARG_ONOFF_STATE
| C type | Pt type | Default |
|---|---|---|
| short | Scalar | 0 (off) |
Indicates the current state of the on/off button. If the button is off, this resource has a value of 0; if the button is on, this resource has a nonzero value.
Pt_CB_ONOFF_NEW_VALUE
| C type | Pt type | Default |
|---|---|---|
| PtCallback_t * | Link | NULL |
A list of callbacks that the widget invokes when the state of the on/off button changes.
These callbacks are also invoked whenever a call to PtSetResources() changes the state of the button, provided the Pt_CALLBACKS_ACTIVE flag is set (see the description of Pt_ARG_FLAGS under PtWidget).
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
- reason
- Pt_CB_ONOFF_NEW_VALUE
- reason_subtype
- 0 (not used).
- event
- The event that caused this callback to be invoked.
- cbdata
- A pointer to a PtOnOffButtonCallback_t structure
that contains at least the following member:
- int state;
- The current state of the on/off button.
These callbacks should return Pt_CONTINUE.
Inherited resources:
If the widget modifies an inherited resource, the "Default override" column indicates the new value. This modification affects any subclasses of the widget.
