Add screen_widget_broadcast()

This commit is contained in:
Pim van Pelt
2017-12-02 14:18:54 +01:00
parent ef4451b81f
commit f7a62fce48
2 changed files with 17 additions and 0 deletions

View File

@ -155,6 +155,19 @@ struct widget_t *screen_widget_find_by_xy(struct screen_t *s, uint16_t x, uint16
return NULL;
}
void screen_widget_broadcast(struct screen_t *s, int ev, void *ev_data) {
struct widget_list_t *wl;
if (!s)
return NULL;
SLIST_FOREACH(wl, &s->widget_entries, entries) {
if (wl->widget->handler)
wl->widget->handler(ev, wl->widget, ev_data);
}
return NULL;
}
void screen_widget_set_handler(struct screen_t *s, widget_event_fn handler) {
if (!s)
return;