gp_widget *gp_widget_button_new(const char *label, enum gp_widget_button_type btype, int (*on_event)(gp_widget_event *ev), void *priv);
Button is a widget that emits event when pressed, buttons can have label or type or both, see below.
Button attributes can be accessed as widget->button
.
gp_widget *gp_widget_button_new(const char *label, enum gp_widget_button_type btype, int (*on_event)(gp_widget_event *ev), void *priv);
Creates a button widget, at least one of the label or btype has to be set.
If button type is set the button will be rendered with a small picture that describes the action, e.g. floppy for GP_BUTTON_SAVE. If label is also set the button will have both icon and label. The type picture will be positioned either on the left or on the right side of the label and the default position could be overriden by bit-or of GP_BUTTON_TEXT_LEFT or GP_BUTTON_TEXT_RIGHT with the button type.
Buttons with just a label are created with btype set to GP_BUTTON_LABEL which is equal to 0.
Attribute | Type | Default | Description |
---|---|---|---|
|
string |
Button label |
|
|
string |
"label" |
Button type |
|
string |
depends |
Button text align |
The text_align can be either left or right and the default value depends on the btype.
Widget event value | Description |
---|---|
0 |
Emitted on button press. |