summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/screen/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/fe310/eos/eve/screen/view.c')
-rw-r--r--fw/fe310/eos/eve/screen/view.c55
1 files changed, 33 insertions, 22 deletions
diff --git a/fw/fe310/eos/eve/screen/view.c b/fw/fe310/eos/eve/screen/view.c
index 466644d..d6e9ede 100644
--- a/fw/fe310/eos/eve/screen/view.c
+++ b/fw/fe310/eos/eve/screen/view.c
@@ -55,28 +55,6 @@ uint8_t eve_view_clear(EVEView *view, uint8_t tag0, uint8_t tag_opt) {
return tag0;
}
-void eve_view_stack_init(EVEViewStack *stack) {
- memset(stack, 0, sizeof(EVEViewStack));
-}
-
-void eve_view_create(EVEWindow *window, EVEViewStack *stack, eve_view_constructor_t constructor) {
- if (stack->level < EVE_VIEW_SIZE_STACK - 1) {
- stack->constructor[stack->level] = constructor;
- stack->level++;
- constructor(window, stack);
- }
-}
-
-void eve_view_destroy(EVEWindow *window, EVEViewStack *stack) {
- if (stack->level > 1) {
- eve_view_constructor_t constructor;
-
- stack->level--;
- constructor = stack->constructor[stack->level - 1];
- constructor(window, stack);
- }
-}
-
int eve_view_uievt_push(EVEView *view, uint16_t evt, void *param) {
if (view->uievt) return view->uievt(view, evt, param);
return 0;
@@ -93,3 +71,36 @@ int eve_view_uievt_push_gest(EVEView *view, uint16_t evt, EVETouch *touch, uint1
}
return 0;
}
+
+void eve_stack_init(EVEViewStack *stack) {
+ memset(stack, 0, sizeof(EVEViewStack));
+}
+
+void eve_stack_create_view(EVEViewStack *stack, EVEWindow *window, eve_view_constructor_t constructor) {
+ int rv;
+
+ stack->dirty = 1;
+ if (stack->level < EVE_VIEW_SIZE_STACK - 1) {
+ stack->constructor[stack->level] = constructor;
+ stack->level++;
+ rv = constructor(window, stack);
+ if (rv) eve_stack_back(stack, window);
+ }
+}
+
+void eve_stack_back(EVEViewStack *stack, EVEWindow *window) {
+ eve_view_constructor_t constructor;
+ int rv = 1;
+
+ stack->dirty = 1;
+ while ((stack->level > 1) && rv) {
+ stack->level--;
+ constructor = stack->constructor[stack->level - 1];
+ rv = constructor(window, stack);
+ }
+}
+
+eve_view_constructor_t eve_stack_get(EVEViewStack *stack) {
+ if (stack->level) return stack->constructor[stack->level - 1];
+ return NULL;
+}