Initial commit
This commit is contained in:
33
src/widget_topbar.c
Normal file
33
src/widget_topbar.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include "mgos.h"
|
||||
#include "tft.h"
|
||||
#include "widget.h"
|
||||
|
||||
static void widget_topbar_render(struct widget_t *w, void *ev_data) {
|
||||
if (!w)
|
||||
return;
|
||||
|
||||
mgos_ili9341_setclipwin(w->x, w->y, w->x+w->w, w->y+w->h);
|
||||
mgos_ili9341_fillRect(0, 0, w->w, w->h, ILI9341_WHITE);
|
||||
mgos_ili9341_resetclipwin();
|
||||
|
||||
(void) ev_data;
|
||||
}
|
||||
|
||||
void widget_topbar_ev(int ev, struct widget_t *w, void *ev_data) {
|
||||
if (!w)
|
||||
return;
|
||||
|
||||
switch(ev) {
|
||||
case EV_WIDGET_CREATE:
|
||||
case EV_WIDGET_DRAW:
|
||||
case EV_WIDGET_REDRAW:
|
||||
case EV_WIDGET_TIMER:
|
||||
widget_topbar_render(w, ev_data);
|
||||
break;
|
||||
case EV_WIDGET_TOUCH_UP:
|
||||
case EV_WIDGET_TOUCH_DOWN:
|
||||
case EV_WIDGET_DESTROY:
|
||||
default: // EV_WIDGET_NONE
|
||||
break;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user