Checkboxes
PBCheckbox
Opaque object handle: A clickable checkbox UI element.
This is a subclass of PBElement. You can safely cast from PBCheckbox to PBElement. To cast from PBElement to PBCheckbox, call PBCheckboxCast; this performs a runtime assertion to check the cast is possible. This function is thread-safe.
This object maintains an internal reference count. When the reference count reaches zero, the object will be automatically deallocated. To increment the reference count, call PBElementRetain; to decrement the reference count, call PBElementRelease. These functions are thread-safe.
PBCheckboxFlags
Enumeration/bitset of type uint32_t: Flags controlling the behavior and appearance of a checkbox.
Constants
PBCheckbox_CHECKED
PBCheckbox_CHECKED = 1<<0
The checkbox is checked. The flag corresponds to PBCheckState_CHECKED.
PBCheckbox_MIXED
PBCheckbox_MIXED = 1<<1
The checkbox is in a mixed indeterminate state. The flag corresponds to PBCheckState_MIXED.
Or any of the values from PBElementFlags.
PBCheckboxCreate
Function: Create a new checkbox element.
Syntax (C/C++)
PBCheckboxPtr _Nullable PBCheckboxCreate(PBElementRef parent,
PBCheckboxFlags flags, ConstStr label);
Syntax (Python)
CheckboxCreate(parent, flags, label) -> (checkbox)
Parameters and Return Values
[in] parent (referenced PBElement): The parent element.
[in] flags (PBCheckboxFlags): Flags bitwise OR-ed together controlling the behavior and appearance of the element.
[in] label (referenced string): The label displayed next to the checkbox.
[out] checkbox (nullable owned PBCheckbox): The checkbox element, or null on failure.
Discussion
The initial check state of the checkbox is taken from the flags.
You can set the user message handler with PBElementSetUserMessageHandler and handle the PBMsg_VALUE_CHANGED message to be notified when the check state is changed.
See PBElementCreate for a more detailed description of element creation.
Example (C/C++)
PBCheckbox *checkbox = PBCheckboxAdd(parent,
PBElement_ALIGN_LEFT | PBCheckbox_CHECKED,
PB_STR("Enable"));
PBAssert(checkbox); /* may fail if low on memory */
PBElementRelease((PBElement *) checkbox);
See Also
PBCheckboxGetState
Function: Get the check state of a checkbox.
Syntax (C/C++)
PBCheckState PBCheckboxGetState(PBCheckboxRef checkbox);
Syntax (Python)
CheckboxGetState(checkbox) -> (checkState)
Parameters and Return Values
[in] checkbox (referenced PBCheckbox): The checkbox object.
[out] checkState (PBCheckState): Its current check state.
See Also
PBCheckboxSetState
Function: Set the check state of a checkbox.
Syntax (C/C++)
void PBCheckboxSetState(PBCheckboxRef checkbox, PBCheckState checkState,
bool sendValueChangedMessage);
Syntax (Python)
CheckboxSetState(checkbox, checkState, sendValueChangedMessage)
Parameters and Return Values
[in] checkbox (referenced PBCheckbox): The checkbox object.
[in] checkState (PBCheckState): The new check state.
[in] sendValueChangedMessage (bool
): Send PBMsg_VALUE_CHANGED to the checkbox element after modifying the check state.
Discussion
The checkbox element will be automatically redraw to show the new state.
See Also
PBCheckboxSetCheckBuddy
Function: Set the check buddy of the checkbox.
Syntax (C/C++)
void PBCheckboxSetCheckBuddy(PBCheckboxRef checkbox, PBElementRef buddy);
Syntax (Python)
CheckboxSetCheckBuddy(checkbox, buddy)
Parameters and Return Values
[in] checkbox (referenced PBCheckbox): The checkbox object.
[in] buddy (referenced PBElement): The check buddy.
Discussion
The buddy is automatically enabled and disabled as the checkbox is checked and unchecked respectively.
A checkbox can only have one buddy element. This function will replace the existing buddy, if there is one.