summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/screen/page.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/fe310/eos/eve/screen/page.c')
-rw-r--r--fw/fe310/eos/eve/screen/page.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/fw/fe310/eos/eve/screen/page.c b/fw/fe310/eos/eve/screen/page.c
index 9579346..9568ce6 100644
--- a/fw/fe310/eos/eve/screen/page.c
+++ b/fw/fe310/eos/eve/screen/page.c
@@ -7,6 +7,7 @@
#include "screen.h"
#include "window.h"
+#include "view.h"
#include "page.h"
#include "widget/font.h"
@@ -15,51 +16,32 @@
#define CH_EOF 0x1a
-void eve_page_init(EVEPage *page, EVEWindow *window, EVEPageStack *stack, eve_view_touch_t touch, eve_view_draw_t draw, eve_page_evt_handler_t handle_evt, eve_page_g_updater_t update_g, eve_page_destructor_t destructor) {
+void eve_page_init(EVEPage *page, EVEWindow *window, EVEViewStack *stack, eve_view_touch_t touch, eve_view_draw_t draw, eve_page_evt_handler_t handle_evt, eve_page_g_updater_t update_g, eve_page_destructor_t destructor) {
memset(page, 0, sizeof(EVEPage));
- page->v.touch = touch;
- page->v.draw = draw;
- page->v.window = window;
+ eve_view_init(&page->v, window, touch, draw, NULL);
page->handle_evt = handle_evt;
page->update_g = update_g;
page->destructor = destructor;
page->stack = stack;
page->widget_f = NULL;
- window->view = (EVEView *)page;
}
-void eve_page_stack_init(EVEPageStack *stack) {
- memset(stack, 0, sizeof(EVEPageStack));
-}
-
-void eve_page_create(EVEWindow *window, EVEPageStack *stack, eve_page_constructor_t constructor) {
- if (stack->level < EVE_PAGE_SIZE_STACK - 1) {
- stack->constructor[stack->level] = constructor;
- stack->level++;
- constructor(window, stack);
- }
-}
-
-void eve_page_open(EVEPage *parent, eve_page_constructor_t constructor) {
+void eve_page_open(EVEPage *parent, eve_view_constructor_t constructor) {
EVEWindow *window = parent->v.window;
- EVEPageStack *stack = parent->stack;
+ EVEViewStack *stack = parent->stack;
+ eve_page_destructor_t destructor = parent->destructor;
- parent->destructor(parent);
- eve_page_create(window, stack, constructor);
+ if (destructor) destructor(parent);
+ eve_view_create(window, stack, constructor);
}
void eve_page_close(EVEPage *page) {
EVEWindow *window = page->v.window;
- EVEPageStack *stack = page->stack;
-
- if (stack->level > 1) {
- eve_page_constructor_t constructor;
+ EVEViewStack *stack = page->stack;
+ eve_page_destructor_t destructor = page->destructor;
- stack->level--;
- constructor = stack->constructor[stack->level - 1];
- page->destructor(page);
- constructor(window, stack);
- }
+ if (destructor) destructor(page);
+ eve_view_destroy(window, stack);
}
int16_t eve_page_x(EVEPage *page, int16_t x) {