gp_widget *gp_widget_checkbox_new(const char *label, int val); gp_widget *gp_widget_checkbox_new2(const char *label, int val, int (*on_event)(gp_widget_event *ev), void *priv)
Checkbox attributes can be accessed as widget->checkbox
.
gp_widget *gp_widget_checkbox_new(const char *label, int val); gp_widget *gp_widget_checkbox_new2(const char *label, int val, int (*on_event)(gp_widget_event *ev), void *priv)
Creates a checkbox widget, label can be NULL.
void gp_widget_checkbox_set(gp_widget *self, int val); void gp_widget_checkbox_toggle(gp_widget *self); int gp_widget_checkbox_get(gp_widget *self);
There is a difference between calling the gp_widget_checkbox_get()
function
and getting the value directly as widget->checkbox->val
. The function call
is type-safe, which means that the function will return -1 if the widget type
is not checkbox, while the direct access will possibly cause undefined
behavior if the widget type is not correct.
Attribute | Type | Default | Description |
---|---|---|---|
|
string |
Checkbox label |
|
|
bool |
False |
Initial value |
Widget event value | Description |
---|---|
0 |
Emitted on checkbox value change. |