summaryrefslogtreecommitdiff
path: root/code/fe310/eos/eve/screen/page.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/fe310/eos/eve/screen/page.c')
-rw-r--r--code/fe310/eos/eve/screen/page.c51
1 files changed, 24 insertions, 27 deletions
diff --git a/code/fe310/eos/eve/screen/page.c b/code/fe310/eos/eve/screen/page.c
index f703bd6..b2ef091 100644
--- a/code/fe310/eos/eve/screen/page.c
+++ b/code/fe310/eos/eve/screen/page.c
@@ -5,54 +5,51 @@
#include "eve_kbd.h"
#include "screen.h"
-#include "tile.h"
+#include "window.h"
#include "page.h"
#include "widget/widget.h"
-void eve_page_init(EVEPage *page, EVETile *tile, eve_canvas_touch_t touch, eve_canvas_draw_t draw, eve_page_open_t open, eve_page_close_t close) {
+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, EVEWindow *window) {
memset(page, 0, sizeof(EVEPage));
- page->tile = tile;
+ page->v.touch = touch;
+ page->v.draw = draw;
+ page->open = open;
+ page->close = close;
page->handle_evt = eve_page_handle_evt;
+ page->window = window;
}
-void eve_page_focus(EVEPage *page, EVEPageFocus *focus) {
- uint16_t tile_w, tile_h;
+void eve_page_focus(EVEPage *page, EVERect *f) {
+ EVERect g;
- if (focus->w == NULL) return;
- eve_tile_get_pos(page->tile, NULL, NULL, &tile_w, &tile_h);
+ eve_window_get_visible(page->window, &g);
+ g.x -= page->window->g.x;
+ g.y -= page->window->g.y;
- if (focus->f.x < page->win_x) {
- page->win_x -= page->win_x - focus->f.x;
+ if (f->x < page->win_x + g.x) {
+ page->win_x = f->x - g.x;
}
- if (focus->f.y < page->win_y) {
- page->win_y -= page->win_y - focus->f.y;
+ if (f->y < page->win_y + g.y) {
+ page->win_y = f->y - g.y;
}
- if ((focus->f.x + focus->f.w) > (page->win_x + tile_w)) {
- page->win_x += (focus->f.x + focus->f.w) - (page->win_x + tile_w);
+ if ((f->x + f->w) > (page->win_x + g.x + g.w)) {
+ page->win_x = (f->x + f->w) - (g.x + g.w);
}
- if ((focus->f.y + focus->f.h) > (page->win_y + tile_h)) {
- page->win_y += (focus->f.y + focus->f.h) - (page->win_y + tile_h);
+ if ((f->y + f->h) > (page->win_y + g.y + g.h)) {
+ page->win_y = (f->y + f->h) - (g.y + g.h);
}
}
-void eve_page_widget_focus(EVEPageFocus *focus, EVEWidget *widget) {
- focus->w = widget;
- focus->f.x = widget->x;
- focus->f.y = widget->y;
- focus->f.w = widget->w;
- focus->f.h = widget->h;
-}
-
int eve_page_widget_visible(EVEPage *page, EVEWidget *widget) {
- uint16_t tile_w, tile_h;
- eve_tile_get_pos(page->tile, NULL, NULL, &tile_w, &tile_h);
+ uint16_t w = page->window->g.w;
+ uint16_t h = page->window->g.h;
- if (((widget->x + widget->w) >= page->win_x) && ((widget->y + widget->h) >= page->win_y) && (widget->x <= (page->win_x + tile_w)) && (widget->y <= (page->win_y + tile_h))) return 1;
+ if (((widget->g.x + widget->g.w) >= page->win_x) && ((widget->g.y + widget->g.h) >= page->win_y) && (widget->g.x <= (page->win_x + w)) && (widget->g.y <= (page->win_y + h))) return 1;
return 0;
}
-void eve_page_handle_evt(EVEPage *page, struct EVEWidget *widget, EVETouch *touch, uint16_t evt, uint8_t tag0, int touch_idx) {
+void eve_page_handle_evt(EVEPage *page, EVEWidget *widget, EVETouch *touch, uint16_t evt, uint8_t tag0, int touch_idx) {
/*
if (evt & EVE_TOUCH_ETYPE_TRACK_Y) {
// do scroll