add widget_ev_to_str(); Pass 'ed' through to EV_WIDGET_TOUCH_{UP,DOWN} calls

This commit is contained in:
Pim van Pelt
2017-11-26 19:27:57 +01:00
parent e826324244
commit 3cb5fc18e7
6 changed files with 51 additions and 12 deletions

View File

@ -138,3 +138,32 @@ void widget_delete_timer(struct widget_t *w) {
widget_set_timer(w, 0);
return;
}
void widget_ev_to_str(int ev, char *s, int slen) {
switch(ev) {
case EV_WIDGET_CREATE:
strncpy(s, "CREATE", slen);
break;
case EV_WIDGET_DRAW:
strncpy(s, "DRAW", slen);
break;
case EV_WIDGET_REDRAW:
strncpy(s, "REDRAW", slen);
break;
case EV_WIDGET_TIMER:
strncpy(s, "TIMER", slen);
break;
case EV_WIDGET_TOUCH_UP:
strncpy(s, "TOUCH_UP", slen);
break;
case EV_WIDGET_TOUCH_DOWN:
strncpy(s, "TOUCH_DOWN", slen);
break;
case EV_WIDGET_DESTROY:
strncpy(s, "DESTROY", slen);
break;
default: // EV_WIDGET_NONE
snprintf(s, slen, "EV%d", ev);
break;
}
}