Navigation C API Pages Python bindings Applications

Widget class

A widget class implements a common interface for widgets that share a common type of value, e.g. boolean value. The advantage of widget classes is that the application code does not need to know how exactly the widget on the screen looks like as long as it matches the expected class.

Widget classes
enum gp_widget_class {
        GP_WIDGET_CLASS_NONE = 0,
        GP_WIDGET_CLASS_BOOL,
        GP_WIDGET_CLASS_INT,
        GP_WIDGET_CLASS_CHOICE,
        GP_WIDGET_CLASS_MAX,
};

There are currently three widget classes apart from NONE class that is used by widgets that does not implement any class interface.

JSON loader by class and UID
gp_widget *gp_widget_by_cuid(gp_htable *uids, const char *uid, enum gp_widget_class widget_class);

Widgets can be loaded from JSON hash table by class.

Boolean class
int gp_widget_bool_get(gp_widget *self);
void gp_widget_bool_set(gp_widget *self, int val);
void gp_widget_bool_toggle(gp_widget *self);

Boolean class implements three functions for manipulating the boolean value.

Integer class
int gp_widget_int_val_get(gp_widget *self);

void gp_widget_int_set(gp_widget *self, int min, int max, int val);

void gp_widget_int_val_set(gp_widget *self, int val);

void gp_widget_int_max_set(gp_widget *self, int max);

void gp_widget_int_min_set(gp_widget *self, int min);

Integer class functions to manipulate the value and bounds.