Add 'type', 'label', rename 'icon' to 'img' in widget

This commit is contained in:
Pim van Pelt
2017-11-26 18:41:17 +01:00
parent a11336703e
commit fda8b332db
5 changed files with 108 additions and 12 deletions

View File

@ -14,12 +14,22 @@ struct widget_t;
#define EV_WIDGET_TOUCH_UP 6
#define EV_WIDGET_TOUCH_DOWN 7
enum widget_type_t {
WIDGET_TYPE_NONE =0,
WIDGET_TYPE_IMAGE =1,
WIDGET_TYPE_LOADSCREEN =2,
};
typedef void (*widget_event_fn)(int ev, struct widget_t *w, void *ev_data);
struct widget_t {
char *name;
uint16_t x, y, w, h;
enum widget_type_t type;
char *label;
char *img;
uint32_t timer_msec; // 0 to disable
widget_event_fn handler; // Event callback for this widget
void *user_data; // User supplied data
@ -34,11 +44,6 @@ struct widget_list_t {
SLIST_ENTRY(widget_list_t) entries;
};
/*
struct widget_t *widget_find(uint16_t x, uint16_t y);
void widget_remove(struct widget_t *widget);
*/
struct widget_t *widget_create(char *name, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
void widget_set_handler(struct widget_t *w, widget_event_fn handler, void *user_data);
void widget_delete_handler(struct widget_t *w);