From d3d239fa9cb25b4a3656c09dbb38f5743d51a213 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Thu, 25 Jun 2020 17:43:03 +0200 Subject: text widget fixed --- code/fe310/eos/eve/screen/font.c | 1 + code/fe310/eos/eve/screen/page.c | 8 ++++++++ code/fe310/eos/eve/screen/page.h | 3 +++ 3 files changed, 12 insertions(+) (limited to 'code/fe310/eos/eve/screen') diff --git a/code/fe310/eos/eve/screen/font.c b/code/fe310/eos/eve/screen/font.c index 1be462d..1441961 100644 --- a/code/fe310/eos/eve/screen/font.c +++ b/code/fe310/eos/eve/screen/font.c @@ -21,6 +21,7 @@ uint16_t eve_font_string_width(EVEFont *font, char *s) { r += font->w_ch[*s]; s++; } + return r; } diff --git a/code/fe310/eos/eve/screen/page.c b/code/fe310/eos/eve/screen/page.c index 4c72243..25acc49 100644 --- a/code/fe310/eos/eve/screen/page.c +++ b/code/fe310/eos/eve/screen/page.c @@ -24,6 +24,14 @@ void eve_page_init(EVEPage *page, eve_view_touch_t touch, eve_view_draw_t draw, page->window = window; } +int16_t eve_page_x(EVEPage *page, int16_t x) { + x + page->win_x - page->window->g.x; +} + +int16_t eve_page_y(EVEPage *page, int16_t y) { + y + page->win_y - page->window->g.y; +} + void eve_page_set_focus(EVEPage *page, EVEWidget *widget, EVERect *f) { EVERect g; diff --git a/code/fe310/eos/eve/screen/page.h b/code/fe310/eos/eve/screen/page.h index a2e5898..eb8dabc 100644 --- a/code/fe310/eos/eve/screen/page.h +++ b/code/fe310/eos/eve/screen/page.h @@ -21,6 +21,9 @@ typedef struct EVEPage { } EVEPage; void eve_page_init(EVEPage *page, eve_view_touch_t touch, eve_view_draw_t draw, eve_page_open_t open, eve_page_close_t close, eve_page_evt_handler_t handle_evt, eve_page_g_updater_t update_g, EVEWindow *window); +int16_t eve_page_x(EVEPage *page, int16_t x); +int16_t eve_page_y(EVEPage *page, int16_t y); + void eve_page_set_focus(EVEPage *page, struct EVEWidget *widget, EVERect *focus); struct EVEWidget *eve_page_get_focus(EVEPage *page); int eve_page_rect_visible(EVEPage *page, EVERect *g); -- cgit v1.2.3