diff options
author | Uros Majstorovic <majstor@majstor.org> | 2022-08-09 22:23:08 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2022-08-09 22:23:08 +0200 |
commit | 3f913efda03fd840cd526ef72e6f397c7da61bd7 (patch) | |
tree | 08f62c93e0e0660fdb7beba32276ff1ceb7a8a3c /fw/fe310/eos/eve/screen | |
parent | 810dde21ee65653c15606917b19566cfbaaf165e (diff) |
code layout
Diffstat (limited to 'fw/fe310/eos/eve/screen')
-rw-r--r-- | fw/fe310/eos/eve/screen/form.c | 52 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/form.h | 16 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/page.c | 149 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/page.h | 17 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/uievt.h | 16 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/view.c | 9 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/view.h | 4 |
7 files changed, 140 insertions, 123 deletions
diff --git a/fw/fe310/eos/eve/screen/form.c b/fw/fe310/eos/eve/screen/form.c index 8555158..13021a0 100644 --- a/fw/fe310/eos/eve/screen/form.c +++ b/fw/fe310/eos/eve/screen/form.c @@ -9,8 +9,6 @@ #include "page.h" #include "form.h" -#include "widget/widgets.h" - #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) @@ -57,7 +55,7 @@ static void widgets_destroy(EVEWidget *widget, uint16_t widget_size) { } } -EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec spec[], uint16_t spec_size, eve_form_uievt_t uievt, eve_form_action_t action, eve_form_destructor_t destructor) { +EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEFormSpec spec[], uint16_t spec_size, eve_form_uievt_t uievt, eve_form_action_t action, eve_form_destructor_t destructor) { EVEWidget *widgets; EVEWidget *widget; EVELabel *label; @@ -65,17 +63,17 @@ EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec s int w_size = 0; int i, r; - for (i=0; i<spec_size; i++) { - w_size += eve_widget_size(spec[i].widget.type); - } + if (uievt == NULL) uievt = eve_form_uievt; + if (destructor == NULL) destructor = eve_form_destroy; form = eve_malloc(sizeof(EVEForm)); if (form == NULL) { return NULL; } - if (uievt == NULL) uievt = eve_form_uievt; - if (destructor == NULL) destructor = eve_form_destroy; eve_form_init(form, window, stack, NULL, 0, uievt, action, destructor); + for (i=0; i<spec_size; i++) { + w_size += eve_widget_size(spec[i].widget.type); + } widgets = eve_malloc(w_size); if (widgets == NULL) { eve_free(form); @@ -84,7 +82,7 @@ EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec s widget = widgets; for (i=0; i<spec_size; i++) { - r = eve_widget_create(widget, spec[i].widget.type, &spec[i].widget.g, (EVEPage *)form, &spec[i].widget.spec); + r = eve_widget_create(widget, &spec[i].widget, (EVEPage *)form); if (r) { widgets_destroy(widgets, i); eve_free(widgets); @@ -92,7 +90,6 @@ EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec s return NULL; } if (spec[i].label.title) { - EVEFont *font = spec[i].label.font ? spec[i].label.font : eve_window_font(window); label = eve_malloc(sizeof(EVELabel)); if (label == NULL) { eve_widget_destroy(widget); @@ -101,15 +98,13 @@ EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEWidgetSpec s eve_free(form); return NULL; } - eve_label_init(label, &spec[i].label.g, font, spec[i].label.title); + eve_label_create(label, &spec[i].label, (EVEPage *)form); eve_widget_set_label(widget, label); - if (label->g.w == 0) label->g.w = eve_font_str_w(font, label->title); } - if (widget->label && (widget->label->g.w == 0)) eve_font_str_w(label->font, label->title) + EVE_FORM_LABEL_MARGIN; if (widget->g.w == 0) widget->g.w = window->g.w - (widget->label ? widget->label->g.w : 0); widget = eve_widget_next(widget); } - eve_form_update(form, widgets, spec_size); + eve_form_set_widget(form, widgets, spec_size); return form; } @@ -118,11 +113,11 @@ void eve_form_init(EVEForm *form, EVEWindow *window, EVEViewStack *stack, EVEWid memset(form, 0, sizeof(EVEForm)); eve_page_init(&form->p, window, stack, NULL, 0, EVE_PAGE_OPT_SCROLL_Y | EVE_PAGE_OPT_SCROLL_BACK | EVE_PAGE_OPT_TRACK_EXT_Y, eve_page_draw, eve_page_touch, (eve_view_uievt_t)uievt, (eve_page_destructor_t)destructor); form->action = action; - eve_form_update(form, widget, widget_size); + eve_form_set_widget(form, widget, widget_size); } -void eve_form_update(EVEForm *form, EVEWidget *widget, uint16_t widget_size) { - eve_page_update((EVEPage *)form, widget, widget_size); +void eve_form_set_widget(EVEForm *form, EVEWidget *widget, uint16_t widget_size) { + eve_page_set_widget((EVEPage *)form, widget, widget_size); form_update_g(form, NULL); } @@ -138,25 +133,24 @@ int eve_form_uievt(EVEForm *form, uint16_t evt, void *param) { form_update_g(form, (EVEWidget *)param); break; - case EVE_UIEVT_PAGE_SCROLL_START: + case EVE_UIEVT_GEST_SCROLL_START: break; - case EVE_UIEVT_PAGE_SCROLL_STOP: + case EVE_UIEVT_GEST_SCROLL_STOP: break; - case EVE_UIEVT_PAGE_TRACK_START: + case EVE_UIEVT_GEST_TRACK_START: break; - case EVE_UIEVT_PAGE_TRACK_STOP: { + case EVE_UIEVT_GEST_TRACK_STOP: { EVEUIEvtTouch *touch_p = (EVEUIEvtTouch *)param; - if (touch_p->evt & EVE_TOUCH_ETYPE_TRACK_STOP) { - if (touch_p->touch->eevt & EVE_TOUCH_EETYPE_TRACK_RIGHT) { - eve_page_close((EVEPage *)form); - return 1; - } - if (touch_p->touch->eevt & EVE_TOUCH_EETYPE_TRACK_LEFT) { - if (form->action) form->action(form); - } + + if (touch_p->touch->eevt & EVE_TOUCH_EETYPE_TRACK_RIGHT) { + eve_page_close((EVEPage *)form); + return 1; + } + if (touch_p->touch->eevt & EVE_TOUCH_EETYPE_TRACK_LEFT) { + if (form->action) form->action(form); } break; } diff --git a/fw/fe310/eos/eve/screen/form.h b/fw/fe310/eos/eve/screen/form.h index 272b6ed..62e10f7 100644 --- a/fw/fe310/eos/eve/screen/form.h +++ b/fw/fe310/eos/eve/screen/form.h @@ -1,10 +1,10 @@ #include <stdint.h> -#define EVE_FORM_LABEL_MARGIN 10 +#include "../widget/widget.h" struct EVEWidget; -struct EVEWidgetSpec; struct EVEForm; +struct EVEFormSpec; typedef int (*eve_form_uievt_t) (struct EVEForm *, uint16_t, void *); typedef void (*eve_form_action_t) (struct EVEForm *); @@ -15,9 +15,15 @@ typedef struct EVEForm { eve_form_action_t action; } EVEForm; -EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, struct EVEWidgetSpec *spec, uint16_t spec_size, eve_form_uievt_t uievt, eve_form_action_t action, eve_form_destructor_t destructor); -void eve_form_init(EVEForm *form, EVEWindow *window, EVEViewStack *stack, struct EVEWidget *widget, uint16_t widget_size, eve_form_uievt_t uievt, eve_form_action_t action, eve_form_destructor_t destructor); -void eve_form_update(EVEForm *form, struct EVEWidget *widget, uint16_t widget_size); +typedef struct EVEFormSpec { + EVELabelSpec label; + EVEWidgetSpec widget; +} EVEFormSpec; + +EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEFormSpec *spec, uint16_t spec_size, eve_form_uievt_t uievt, eve_form_action_t action, eve_form_destructor_t destructor); +void eve_form_init(EVEForm *form, EVEWindow *window, EVEViewStack *stack, EVEWidget *widget, uint16_t widget_size, eve_form_uievt_t uievt, eve_form_action_t action, eve_form_destructor_t destructor); +void eve_form_set_widget(EVEForm *form, EVEWidget *widget, uint16_t widget_size); void eve_form_destroy(EVEForm *form); int eve_form_uievt(EVEForm *form, uint16_t evt, void *param); + diff --git a/fw/fe310/eos/eve/screen/page.c b/fw/fe310/eos/eve/screen/page.c index 28526ca..64fc473 100644 --- a/fw/fe310/eos/eve/screen/page.c +++ b/fw/fe310/eos/eve/screen/page.c @@ -8,7 +8,6 @@ #include "window.h" #include "page.h" -#include "widget/label.h" #include "widget/widget.h" #define PAGE_TMODE_NONE 0 @@ -21,10 +20,22 @@ void eve_page_init(EVEPage *page, EVEWindow *window, EVEViewStack *stack, EVEWid page->stack = stack; page->opt = opt; page->destructor = destructor; - eve_page_update(page, widget, widget_size); + eve_page_set_widget(page, widget, widget_size); } -void eve_page_update(EVEPage *page, EVEWidget *widget, uint16_t widget_size) { +EVEWidget *eve_page_widget(EVEPage *page, uint16_t idx) { + EVEWidget *w = page->widget; + int i; + + if (idx >= page->widget_size) return NULL; + + for (i=0; i<idx; i++) { + w = eve_widget_next(w); + } + return w; +} + +void eve_page_set_widget(EVEPage *page, EVEWidget *widget, uint16_t widget_size) { page->widget = widget; page->widget_size = widget_size; } @@ -45,16 +56,16 @@ void eve_page_close(EVEPage *page) { if (stack->level <= 1) return; - if (page->lho_t0) { - page->lho_t0 = 0; + if (eve_timer_running()) { eve_timer_stop(); } if (eve_window_scroll(window->root, NULL) == window) { eve_window_scroll_stop(window); } - if (destructor) destructor(page); eve_window_kbd_detach(window); + + if (destructor) destructor(page); eve_view_destroy(window, stack); } @@ -93,30 +104,32 @@ int eve_page_rect_visible(EVEPage *page, EVERect *g) { return 0; } -void eve_page_focus(EVEPage *page, EVERect *rect) { - if (rect) { - EVERect g; +void eve_page_rect_set_visible(EVEPage *page, EVERect *rect) { + EVERect g; - eve_window_visible_g(page->v.window, &g); - g.x -= page->v.window->g.x; - g.y -= page->v.window->g.y; + eve_window_visible_g(page->v.window, &g); + g.x -= page->v.window->g.x; + g.y -= page->v.window->g.y; - if (rect->x < page->g.x + g.x) { - page->g.x = rect->x - g.x; - } - if (rect->y < page->g.y + g.y) { - page->g.y = rect->y - g.y; - } - if ((rect->x + rect->w) > (page->g.x + g.x + g.w)) { - page->g.x = (rect->x + rect->w) - (g.x + g.w); - } - if ((rect->y + rect->h) > (page->g.y + g.y + g.h)) { - page->g.y = (rect->y + rect->h) - (g.y + g.h); - } + if (rect->x < page->g.x + g.x) { + page->g.x = rect->x - g.x; + } + if (rect->y < page->g.y + g.y) { + page->g.y = rect->y - g.y; + } + if ((rect->x + rect->w) > (page->g.x + g.x + g.w)) { + page->g.x = (rect->x + rect->w) - (g.x + g.w); } + if ((rect->y + rect->h) > (page->g.y + g.y + g.h)) { + page->g.y = (rect->y + rect->h) - (g.y + g.h); + } +} + +EVEWidget *eve_page_focus(EVEPage *page) { + return page->widget_f; } -void eve_page_focus_widget(EVEPage *page, EVEWidget *widget, EVERect *rect) { +void eve_page_set_focus(EVEPage *page, EVEWidget *widget, EVERect *rect) { if (page->widget_f != widget) { EVEWindow *window = page->v.window; EVEWidget *widget_f = page->widget_f; @@ -131,67 +144,59 @@ void eve_page_focus_widget(EVEPage *page, EVEWidget *widget, EVERect *rect) { if (kbd) eve_kbd_set_handler(kbd, widget->putc, widget); if (!(widget_f && widget_f->putc)) eve_window_kbd_attach(window); } + if (page->widget_f) eve_view_uievt_push(&page->v, EVE_UIEVT_WIDGET_FOCUS_OUT, page->widget_f); page->widget_f = widget; + if (page->widget_f) eve_view_uievt_push(&page->v, EVE_UIEVT_WIDGET_FOCUS_IN, page->widget_f); } - if (rect) eve_page_focus(page, rect); + if (rect) eve_page_rect_set_visible(page, rect); } -EVEWidget *eve_page_focus_widget_get(EVEPage *page) { - return page->widget_f; -} - -EVEWidget *eve_page_widget(EVEPage *page, uint16_t idx) { - EVEWidget *w = page->widget; - int i; - - if (idx >= page->widget_size) return NULL; - - for (i=0; i<idx; i++) { - w = eve_widget_next(w); - } - return w; -} +#include <stdio.h> static int page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0) { EVEView *view = &page->v; EVEWindow *window = view->window; - int scroll, scroll_x, scroll_y; + int scroll_x = 0, scroll_y = 0, scroll; int ret = 0; - scroll_x = page->opt & (EVE_PAGE_OPT_SCROLL_X | EVE_PAGE_OPT_SCROLL_XY); - if (scroll_x && touch) scroll_x = touch->eevt & ((page->opt & EVE_PAGE_OPT_SCROLL_XY) ? EVE_TOUCH_EETYPE_TRACK_XY : EVE_TOUCH_EETYPE_TRACK_X); - - scroll_y = page->opt & (EVE_PAGE_OPT_SCROLL_Y | EVE_PAGE_OPT_SCROLL_XY); - if (scroll_y && touch) scroll_y = touch->eevt & ((page->opt & EVE_PAGE_OPT_SCROLL_XY) ? EVE_TOUCH_EETYPE_TRACK_XY : EVE_TOUCH_EETYPE_TRACK_Y); + if (touch) { + if ((page->opt & EVE_PAGE_OPT_SCROLL_XY) == EVE_PAGE_OPT_SCROLL_XY) { + scroll_x = scroll_y = (touch->eevt & EVE_TOUCH_EETYPE_TRACK_XY); + } else if (page->opt & EVE_PAGE_OPT_SCROLL_X) { + scroll_x = (touch->eevt & EVE_TOUCH_EETYPE_TRACK_X); + } else if (page->opt & EVE_PAGE_OPT_SCROLL_Y) { + scroll_y = (touch->eevt & EVE_TOUCH_EETYPE_TRACK_Y); + } + } scroll = scroll_x || scroll_y; if ((evt & EVE_TOUCH_ETYPE_POINT_UP) && !(touch->eevt & (EVE_TOUCH_EETYPE_TRACK_XY | EVE_TOUCH_EETYPE_ABORT))) { int _ret = 0; - if (page->widget_f) eve_page_focus_widget(page, NULL, NULL); - _ret = eve_view_uievt_pusht(view, EVE_UIEVT_PAGE_TOUCH, touch, evt, tag0); + if (page->widget_f) eve_page_set_focus(page, NULL, NULL); + _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_TOUCH, touch, evt, tag0); if (_ret) return _ret; ret = 1; } - /* Scroll start */ + /* Scroll / track start */ if ((evt & EVE_TOUCH_ETYPE_TRACK_START) && !(touch->eevt & EVE_TOUCH_EETYPE_ABORT)) { int _ret = 0; if (scroll) { page->track_mode = PAGE_TMODE_SCROLL; eve_window_scroll_start(window, touch->tracker.tag); - _ret = eve_view_uievt_pusht(view, EVE_UIEVT_PAGE_SCROLL_START, touch, evt, tag0); + _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_SCROLL_START, touch, evt, tag0); } else { page->track_mode = PAGE_TMODE_TRACK; - _ret = eve_view_uievt_pusht(view, EVE_UIEVT_PAGE_TRACK_START, touch, evt, tag0); + _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_TRACK_START, touch, evt, tag0); } if (_ret) return _ret; ret = 1; } - /* Scroll stop */ + /* Scroll / track stop */ if (((evt & EVE_TOUCH_ETYPE_TRACK_STOP) && !(evt & EVE_TOUCH_ETYPE_TRACK_ABORT)) || ((evt & EVE_TOUCH_ETYPE_POINT_UP) && (touch->eevt & EVE_TOUCH_EETYPE_ABORT) && !(touch->eevt & EVE_TOUCH_EETYPE_TRACK_XY))) { if ((page->track_mode == PAGE_TMODE_SCROLL) && (page->opt & EVE_PAGE_OPT_SCROLL_BACK)) { @@ -211,23 +216,29 @@ static int page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0 eve_window_scroll(window->root, &_tag); - eve_phy_lho_init(lho, lho_x, lho_y, 1000, 0.5, 0); - eve_phy_lho_start(lho, page->g.x, page->g.y); page->lho_t0 = eve_get_tick(); + eve_phy_lho_init(lho, lho_x, lho_y, 100, 0.5, 0); + eve_phy_lho_start(lho, page->g.x, page->g.y); eve_timer_start(_tag, 20); } } - if (!page->lho_t0) { + if (!eve_timer_running()) { int _ret = 0; - if (page->track_mode == PAGE_TMODE_SCROLL) { - page->track_mode = PAGE_TMODE_NONE; - eve_window_scroll_stop(window); - _ret = eve_view_uievt_pusht(view, EVE_UIEVT_PAGE_SCROLL_STOP, touch, evt, tag0); - } else if (!(touch->eevt & EVE_TOUCH_EETYPE_ABORT)) { - page->track_mode = PAGE_TMODE_NONE; - _ret = eve_view_uievt_pusht(view, EVE_UIEVT_PAGE_TRACK_STOP, touch, evt, tag0); + switch (page->track_mode) { + case PAGE_TMODE_SCROLL: { + page->track_mode = PAGE_TMODE_NONE; + eve_window_scroll_stop(window); + _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_SCROLL_STOP, touch, evt, tag0); + break; + } + + case PAGE_TMODE_TRACK: { + page->track_mode = PAGE_TMODE_NONE; + _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_TRACK_STOP, touch, evt, tag0); + break; + } } if (_ret) return _ret; ret = 1; @@ -254,26 +265,26 @@ static int page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0 } if ((evt & EVE_TOUCH_ETYPE_TIMER) && (page->opt & EVE_PAGE_OPT_SCROLL_BACK)) { EVEPhyLHO *lho = &page->lho; + int scroll_x = page->opt & EVE_PAGE_OPT_SCROLL_X; + int scroll_y = page->opt & EVE_PAGE_OPT_SCROLL_Y; int x, y, more; more = eve_phy_lho_tick(lho, eve_get_tick() - page->lho_t0, scroll_x ? &x : NULL, scroll_y ? &y : NULL); if (scroll_x) page->g.x = x; if (scroll_y) page->g.y = y; + printf("TIMER: %d\n", y); if (!more) { int _ret = 0; - page->lho_t0 = 0; - eve_timer_stop(); + printf("TIMER STOP!\n"); page->track_mode = PAGE_TMODE_NONE; + eve_timer_stop(); eve_window_scroll_stop(window); - _ret = eve_view_uievt_pusht(view, EVE_UIEVT_PAGE_SCROLL_STOP, touch, evt, tag0); + _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_SCROLL_STOP, touch, evt, tag0); if (_ret) return _ret; } ret = 1; } - if (evt & EVE_TOUCH_EETYPE_TIMER_ABORT) { - page->lho_t0 = 0; - } } return ret; diff --git a/fw/fe310/eos/eve/screen/page.h b/fw/fe310/eos/eve/screen/page.h index 0fc9809..7aa8c1d 100644 --- a/fw/fe310/eos/eve/screen/page.h +++ b/fw/fe310/eos/eve/screen/page.h @@ -5,10 +5,11 @@ #define EVE_PAGE_OPT_SCROLL_X 0x01 #define EVE_PAGE_OPT_SCROLL_Y 0x02 #define EVE_PAGE_OPT_SCROLL_BACK 0x04 -#define EVE_PAGE_OPT_SCROLL_XY 0x08 #define EVE_PAGE_OPT_TRACK_EXT_X 0x10 #define EVE_PAGE_OPT_TRACK_EXT_Y 0x20 -#define EVE_PAGE_OPT_TRACK_EXT_XY (EVE_PAGE_OPT_TRACK_EXT_X | EVE_PAGE_OPT_TRACK_EXT_Y) + +#define EVE_PAGE_OPT_SCROLL_XY (EVE_PAGE_OPT_SCROLL_X | EVE_PAGE_OPT_SCROLL_Y) +#define EVE_PAGE_OPT_TRACK_EXT_XY (EVE_PAGE_OPT_TRACK_EXT_X | EVE_PAGE_OPT_TRACK_EXT_Y) struct EVEWidget; struct EVEPage; @@ -32,7 +33,10 @@ typedef struct EVEPage { } EVEPage; void eve_page_init(EVEPage *page, EVEWindow *window, EVEViewStack *stack, struct EVEWidget *widget, uint16_t widget_size, uint8_t opt,eve_view_draw_t draw, eve_view_touch_t touch, eve_view_uievt_t uievt, eve_page_destructor_t destructor); -void eve_page_update(EVEPage *page, struct EVEWidget *widget, uint16_t widget_size); + +struct EVEWidget *eve_page_widget(EVEPage *page, uint16_t idx); +void eve_page_set_widget(EVEPage *page, struct EVEWidget *widget, uint16_t widget_size); + void eve_page_open(EVEPage *parent, eve_view_constructor_t constructor); void eve_page_close(EVEPage *page); @@ -46,11 +50,10 @@ int16_t eve_page_win_y(EVEPage *page, int16_t y); int16_t eve_page_scr_x(EVEPage *page, int16_t x); int16_t eve_page_scr_y(EVEPage *page, int16_t y); int eve_page_rect_visible(EVEPage *page, EVERect *g); +void eve_page_rect_set_visible(EVEPage *page, EVERect *rect); -void eve_page_focus(EVEPage *page, EVERect *rect); -void eve_page_focus_widget(EVEPage *page, struct EVEWidget *widget, EVERect *rect); -struct EVEWidget *eve_page_focus_widget_get(EVEPage *page); -struct EVEWidget *eve_page_widget(EVEPage *page, uint16_t idx); +struct EVEWidget *eve_page_focus(EVEPage *page); +void eve_page_set_focus(EVEPage *page, struct EVEWidget *widget, EVERect *rect); uint8_t eve_page_draw(EVEView *view, uint8_t tag0); int eve_page_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0); diff --git a/fw/fe310/eos/eve/screen/uievt.h b/fw/fe310/eos/eve/screen/uievt.h index 98f0d95..8e1e682 100644 --- a/fw/fe310/eos/eve/screen/uievt.h +++ b/fw/fe310/eos/eve/screen/uievt.h @@ -1,11 +1,13 @@ -#define EVE_UIEVT_WIN_UPDATE_G 1 -#define EVE_UIEVT_PAGE_UPDATE_G 2 -#define EVE_UIEVT_PAGE_TOUCH 3 -#define EVE_UIEVT_PAGE_SCROLL_START 4 -#define EVE_UIEVT_PAGE_SCROLL_STOP 5 -#define EVE_UIEVT_PAGE_TRACK_START 6 -#define EVE_UIEVT_PAGE_TRACK_STOP 7 +#define EVE_UIEVT_GEST_TOUCH 1 +#define EVE_UIEVT_GEST_SCROLL_START 2 +#define EVE_UIEVT_GEST_SCROLL_STOP 3 +#define EVE_UIEVT_GEST_TRACK_START 4 +#define EVE_UIEVT_GEST_TRACK_STOP 5 +#define EVE_UIEVT_WIN_UPDATE_G 6 +#define EVE_UIEVT_PAGE_UPDATE_G 7 #define EVE_UIEVT_WIDGET_UPDATE_G 8 +#define EVE_UIEVT_WIDGET_FOCUS_IN 9 +#define EVE_UIEVT_WIDGET_FOCUS_OUT 10 typedef struct EVEUIEvtTouch { EVETouch *touch; diff --git a/fw/fe310/eos/eve/screen/view.c b/fw/fe310/eos/eve/screen/view.c index ac9aef4..466644d 100644 --- a/fw/fe310/eos/eve/screen/view.c +++ b/fw/fe310/eos/eve/screen/view.c @@ -77,18 +77,19 @@ void eve_view_destroy(EVEWindow *window, EVEViewStack *stack) { } } -void eve_view_uievt_push(EVEView *view, uint16_t evt, void *param) { - if (view->uievt) view->uievt(view, evt, param); +int eve_view_uievt_push(EVEView *view, uint16_t evt, void *param) { + if (view->uievt) return view->uievt(view, evt, param); + return 0; } -int eve_view_uievt_pusht(EVEView *view, uint16_t evt, EVETouch *touch, uint16_t t_evt, uint8_t tag0) { +int eve_view_uievt_push_gest(EVEView *view, uint16_t evt, EVETouch *touch, uint16_t t_evt, uint8_t tag0) { if (view->uievt) { EVEUIEvtTouch param; param.touch = touch; param.evt = t_evt; param.tag0 = tag0; - view->uievt(view, evt, ¶m); + return view->uievt(view, evt, ¶m); } return 0; } diff --git a/fw/fe310/eos/eve/screen/view.h b/fw/fe310/eos/eve/screen/view.h index 65999d7..c8be33a 100644 --- a/fw/fe310/eos/eve/screen/view.h +++ b/fw/fe310/eos/eve/screen/view.h @@ -38,5 +38,5 @@ void eve_view_stack_init(EVEViewStack *stack); void eve_view_create(struct EVEWindow *window, EVEViewStack *stack, eve_view_constructor_t constructor); void eve_view_destroy(struct EVEWindow *window, EVEViewStack *stack); -void eve_view_uievt_push(EVEView *view, uint16_t evt, void *param); -int eve_view_uievt_pusht(EVEView *view, uint16_t evt, EVETouch *touch, uint16_t t_evt, uint8_t tag0); +int eve_view_uievt_push(EVEView *view, uint16_t evt, void *param); +int eve_view_uievt_push_gest(EVEView *view, uint16_t evt, EVETouch *touch, uint16_t t_evt, uint8_t tag0); |