summaryrefslogtreecommitdiff
path: root/fw/fe310
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2020-08-26 02:07:48 +0200
committerUros Majstorovic <majstor@majstor.org>2020-08-26 02:07:48 +0200
commitd6a8caa7e27dd08180f6a5a45a080c2e4cfc1fe4 (patch)
tree52f8010eace6e3e7002f6396297109a15eb8e81b /fw/fe310
parent48d934f5b422d87a59ffb38e6215a851f28c1b0e (diff)
kbdwin removed; stack and contructor moved to view
Diffstat (limited to 'fw/fe310')
-rw-r--r--fw/fe310/eos/app/root.c113
-rw-r--r--fw/fe310/eos/app/root.h6
-rw-r--r--fw/fe310/eos/app/status.c2
-rw-r--r--fw/fe310/eos/eve/screen/Makefile2
-rw-r--r--fw/fe310/eos/eve/screen/form.c3
-rw-r--r--fw/fe310/eos/eve/screen/form.h2
-rw-r--r--fw/fe310/eos/eve/screen/kbdwin.c39
-rw-r--r--fw/fe310/eos/eve/screen/kbdwin.h14
-rw-r--r--fw/fe310/eos/eve/screen/page.c42
-rw-r--r--fw/fe310/eos/eve/screen/page.h19
-rw-r--r--fw/fe310/eos/eve/screen/screen.c2
-rw-r--r--fw/fe310/eos/eve/screen/view.c39
-rw-r--r--fw/fe310/eos/eve/screen/view.h27
-rw-r--r--fw/fe310/eos/eve/screen/window.c18
-rw-r--r--fw/fe310/eos/eve/screen/window.h15
-rw-r--r--fw/fe310/eos/eve/widget/freew.c1
-rw-r--r--fw/fe310/eos/eve/widget/label.c1
-rw-r--r--fw/fe310/eos/eve/widget/pagew.c5
-rw-r--r--fw/fe310/eos/eve/widget/pagew.h8
-rw-r--r--fw/fe310/eos/eve/widget/spacerw.c1
-rw-r--r--fw/fe310/eos/eve/widget/strw.c1
-rw-r--r--fw/fe310/eos/eve/widget/textw.c1
-rw-r--r--fw/fe310/eos/eve/widget/widget.c1
23 files changed, 191 insertions, 171 deletions
diff --git a/fw/fe310/eos/app/root.c b/fw/fe310/eos/app/root.c
index 8f7ad94..6eb3fa6 100644
--- a/fw/fe310/eos/app/root.c
+++ b/fw/fe310/eos/app/root.c
@@ -8,7 +8,7 @@
#include "eve/screen/screen.h"
#include "eve/screen/window.h"
-#include "eve/screen/kbdwin.h"
+#include "eve/screen/view.h"
#include "eve/screen/page.h"
#include "eve/screen/form.h"
@@ -19,17 +19,77 @@
EVEFont *_app_font_default;
+static EVEKbd kbd;
static EVEFont font;
static EVEScreen screen;
static EVEWindow win_status;
static EVEWindow win_main;
-static EVEKbdWin win_kbd;
-static EVEView view_status = {
- app_status_touch,
- app_status_draw,
- NULL
-};
-static EVEPageStack page_stack;
+static EVEWindow win_kbd;
+static EVEView view_kbd;
+static EVEView view_status;
+static EVEViewStack view_stack;
+
+EVEScreen *app_screen(void) {
+ return &screen;
+}
+
+static int kbd_touch(EVEView *v, uint8_t tag0, int touch_idx) {
+ EVEKbd *kbd = v->param;
+
+ return eve_kbd_touch(kbd, tag0, touch_idx);
+}
+
+static uint8_t kbd_draw(EVEView *v, uint8_t tag0) {
+ EVEKbd *kbd = v->param;
+
+ eve_kbd_draw(kbd);
+ return tag0;
+}
+
+void app_root_init(eve_view_constructor_t home_page) {
+ EVERect g;
+
+ _app_font_default = &font;
+ eos_spi_dev_start(EOS_DEV_DISP);
+
+ eve_brightness(0x40);
+
+ eve_font_init(&font, APP_FONT_HANDLE);
+ eve_screen_init(&screen, APP_SCREEN_W, APP_SCREEN_H);
+
+ eve_kbd_init(&kbd, NULL, screen.mem_next, &screen.mem_next);
+ eve_screen_set_kbd(&screen, &kbd);
+
+ g.x = 0;
+ g.y = 0;
+ g.w = APP_SCREEN_W;
+ g.h = APP_STATUS_H;
+ eve_window_init(&win_status, &g, &screen, "status");
+ eve_view_init(&view_status, &win_status, app_status_touch, app_status_draw, NULL);
+
+ g.x = 0;
+ g.y = APP_STATUS_H;
+ g.w = APP_SCREEN_W;
+ g.h = APP_SCREEN_H - APP_STATUS_H;
+ eve_window_init(&win_main, &g, &screen, "main");
+
+ eve_window_init(&win_kbd, &kbd.g, &screen, "kbd");
+ eve_view_init(&view_kbd, &win_kbd, kbd_touch, kbd_draw, &kbd);
+
+ eve_view_stack_init(&view_stack);
+ eve_view_create(&win_main, &view_stack, home_page);
+
+ eve_window_append(&win_status);
+ eve_window_append(&win_main);
+ eve_window_append(&win_kbd);
+
+ eve_screen_hide_kbd(&screen);
+ eve_screen_draw(&screen);
+
+ eos_spi_dev_stop();
+
+ eos_net_acquire_for_evt(EOS_EVT_UI | EVE_ETYPE_INTR, 1);
+}
static void widgets_destroy(EVEWidget *widget, uint16_t widget_size) {
int i;
@@ -40,7 +100,7 @@ static void widgets_destroy(EVEWidget *widget, uint16_t widget_size) {
}
}
-EVEForm *app_form_create(EVEWindow *window, EVEPageStack *stack, APPWidgetSpec spec[], uint16_t spec_size, eve_page_destructor_t destructor) {
+EVEForm *app_form_create(EVEWindow *window, EVEViewStack *stack, APPWidgetSpec spec[], uint16_t spec_size, eve_page_destructor_t destructor) {
EVEWidget *widgets;
EVEWidget *widget;
EVELabel *label;
@@ -97,38 +157,3 @@ void app_form_destroy(EVEForm *form) {
eve_free(form->widget);
eve_free(form);
}
-
-void app_root_init(eve_page_constructor_t home_page) {
- EVERect g;
-
- _app_font_default = &font;
- eos_spi_dev_start(EOS_DEV_DISP);
-
- eve_brightness(0x40);
- eve_font_init(&font, APP_FONT_HANDLE);
- eve_screen_init(&screen, APP_SCREEN_W, APP_SCREEN_H);
-
- g.x = 0;
- g.y = 0;
- g.w = APP_SCREEN_W;
- g.h = APP_STATUS_H;
- eve_window_init(&win_status, &g, &view_status, &screen);
- g.x = 0;
- g.y = APP_STATUS_H;
- g.w = APP_SCREEN_W;
- g.h = APP_SCREEN_H - APP_STATUS_H;
- eve_window_init(&win_main, &g, NULL, &screen);
- eve_kbdwin_init(&win_kbd, &screen);
-
- eve_page_stack_init(&page_stack);
- eve_page_create(&win_main, &page_stack, home_page);
-
- eve_window_append(&win_status);
- eve_window_append(&win_main);
- eve_kbdwin_append(&win_kbd);
- eve_screen_draw(&screen);
-
- eos_spi_dev_stop();
-
- eos_net_acquire_for_evt(EOS_EVT_UI | EVE_ETYPE_INTR, 1);
-}
diff --git a/fw/fe310/eos/app/root.h b/fw/fe310/eos/app/root.h
index 37f1448..1885515 100644
--- a/fw/fe310/eos/app/root.h
+++ b/fw/fe310/eos/app/root.h
@@ -21,6 +21,8 @@ typedef struct APPWidgetSpec {
} widget;
} APPWidgetSpec;
-void app_root_init(eve_page_constructor_t home_page);
-EVEForm *app_form_create(EVEWindow *window, EVEPageStack *stack, APPWidgetSpec spec[], uint16_t spec_size, eve_page_destructor_t destructor);
+EVEScreen *app_screen(void);
+void app_root_init(eve_view_constructor_t home_page);
+
+EVEForm *app_form_create(EVEWindow *window, EVEViewStack *stack, APPWidgetSpec spec[], uint16_t spec_size, eve_page_destructor_t destructor);
void app_form_destroy(EVEForm *form);
diff --git a/fw/fe310/eos/app/status.c b/fw/fe310/eos/app/status.c
index fb278be..3a41ff2 100644
--- a/fw/fe310/eos/app/status.c
+++ b/fw/fe310/eos/app/status.c
@@ -8,7 +8,7 @@
#include "eve/screen/screen.h"
#include "eve/screen/window.h"
-#include "eve/screen/page.h"
+#include "eve/screen/view.h"
#include "status.h"
diff --git a/fw/fe310/eos/eve/screen/Makefile b/fw/fe310/eos/eve/screen/Makefile
index b1650bd..fc21670 100644
--- a/fw/fe310/eos/eve/screen/Makefile
+++ b/fw/fe310/eos/eve/screen/Makefile
@@ -2,7 +2,7 @@ include ../../../common.mk
CFLAGS += -I.. -I../..
-obj = screen.o window.o kbdwin.o page.o form.o
+obj = screen.o window.o view.o page.o form.o
%.o: %.c %.h
diff --git a/fw/fe310/eos/eve/screen/form.c b/fw/fe310/eos/eve/screen/form.c
index 5837a99..fe1bd0d 100644
--- a/fw/fe310/eos/eve/screen/form.c
+++ b/fw/fe310/eos/eve/screen/form.c
@@ -7,6 +7,7 @@
#include "screen.h"
#include "window.h"
+#include "view.h"
#include "page.h"
#include "form.h"
@@ -17,7 +18,7 @@
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
-int eve_form_init(EVEForm *form, EVEWindow *window, EVEPageStack *stack, EVEWidget *widget, uint16_t widget_size, eve_page_destructor_t destructor) {
+int eve_form_init(EVEForm *form, EVEWindow *window, EVEViewStack *stack, EVEWidget *widget, uint16_t widget_size, eve_page_destructor_t destructor) {
memset(form, 0, sizeof(EVEForm));
eve_page_init(&form->p, window, stack, eve_form_touch, eve_form_draw, eve_form_handle_evt, eve_form_update_g, destructor);
form->widget = widget;
diff --git a/fw/fe310/eos/eve/screen/form.h b/fw/fe310/eos/eve/screen/form.h
index b6e59ff..cab10b9 100644
--- a/fw/fe310/eos/eve/screen/form.h
+++ b/fw/fe310/eos/eve/screen/form.h
@@ -8,7 +8,7 @@ typedef struct EVEForm {
uint16_t widget_size;
} EVEForm;
-int eve_form_init(EVEForm *form, EVEWindow *window, EVEPageStack *stack, struct EVEWidget *widget, uint16_t widget_size, eve_page_destructor_t destructor);
+int eve_form_init(EVEForm *form, EVEWindow *window, EVEViewStack *stack, struct EVEWidget *widget, uint16_t widget_size, eve_page_destructor_t destructor);
int eve_form_touch(EVEView *v, uint8_t tag0, int touch_idx);
uint8_t eve_form_draw(EVEView *v, uint8_t tag0);
int eve_form_handle_evt(EVEPage *page, struct EVEWidget *widget, EVETouch *touch, uint16_t evt, uint8_t tag0, int touch_idx);
diff --git a/fw/fe310/eos/eve/screen/kbdwin.c b/fw/fe310/eos/eve/screen/kbdwin.c
deleted file mode 100644
index decedad..0000000
--- a/fw/fe310/eos/eve/screen/kbdwin.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-
-#include "eve.h"
-#include "eve_kbd.h"
-
-#include "screen.h"
-#include "window.h"
-#include "kbdwin.h"
-
-static int kbdwin_touch(EVEView *v, uint8_t tag0, int touch_idx) {
- EVEKbdView *k_view = (EVEKbdView *)v;
-
- return eve_kbd_touch(&k_view->kbd, tag0, touch_idx);
-}
-
-static uint8_t kbdwin_draw(EVEView *v, uint8_t tag0) {
- EVEKbdView *k_view = (EVEKbdView *)v;
-
- eve_kbd_draw(&k_view->kbd);
- return tag0;
-}
-
-void eve_kbdwin_init(EVEKbdWin *kbd_win, EVEScreen *screen) {
- EVEKbd *kbd = &kbd_win->view.kbd;
-
- kbd_win->view.v.touch = kbdwin_touch;
- kbd_win->view.v.draw = kbdwin_draw;
- eve_kbd_init(kbd, NULL, screen->mem_next, &screen->mem_next);
- eve_window_init(&kbd_win->win, &kbd->g, &kbd_win->view.v, screen);
-}
-
-void eve_kbdwin_append(EVEKbdWin *kbd_win) {
- EVEKbd *kbd = &kbd_win->view.kbd;
- EVEWindow *window = &kbd_win->win;
-
- eve_screen_set_kbd(window->screen, kbd);
- eve_window_append(window);
-}
diff --git a/fw/fe310/eos/eve/screen/kbdwin.h b/fw/fe310/eos/eve/screen/kbdwin.h
deleted file mode 100644
index 2cc14d9..0000000
--- a/fw/fe310/eos/eve/screen/kbdwin.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdint.h>
-
-typedef struct EVEKbdView {
- EVEView v;
- EVEKbd kbd;
-} EVEKbdView;
-
-typedef struct EVEKbdWin {
- EVEWindow win;
- EVEKbdView view;
-} EVEKbdWin;
-
-void eve_kbdwin_init(EVEKbdWin *kbd_win, EVEScreen *screen);
-void eve_kbdwin_append(EVEKbdWin *kbd_win);
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) {
diff --git a/fw/fe310/eos/eve/screen/page.h b/fw/fe310/eos/eve/screen/page.h
index 227375c..168a017 100644
--- a/fw/fe310/eos/eve/screen/page.h
+++ b/fw/fe310/eos/eve/screen/page.h
@@ -1,15 +1,11 @@
#include <stdint.h>
-#define EVE_PAGE_SIZE_STACK 16
-
struct EVEPage;
struct EVEWidget;
-struct EVEPageStack;
-typedef void (*eve_page_constructor_t) (EVEWindow *window, struct EVEPageStack *);
-typedef void (*eve_page_destructor_t) (struct EVEPage *);
typedef int (*eve_page_evt_handler_t) (struct EVEPage *, struct EVEWidget *, EVETouch *, uint16_t, uint8_t, int);
typedef void (*eve_page_g_updater_t) (struct EVEPage *, struct EVEWidget *);
+typedef void (*eve_page_destructor_t) (struct EVEPage *);
typedef struct EVEPage {
EVEView v;
@@ -18,19 +14,12 @@ typedef struct EVEPage {
eve_page_evt_handler_t handle_evt;
eve_page_g_updater_t update_g;
eve_page_destructor_t destructor;
- struct EVEPageStack *stack;
+ struct EVEViewStack *stack;
struct EVEWidget *widget_f;
} EVEPage;
-typedef struct EVEPageStack {
- eve_page_constructor_t constructor[EVE_PAGE_SIZE_STACK];
- uint8_t level;
-} EVEPageStack;
-
-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_stack_init(EVEPageStack *stack);
-void eve_page_create(EVEWindow *window, EVEPageStack *stack, eve_page_constructor_t constructor);
-void eve_page_open(EVEPage *parent, eve_page_constructor_t constructor);
+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);
+void eve_page_open(EVEPage *parent, eve_view_constructor_t constructor);
void eve_page_close(EVEPage *page);
int16_t eve_page_x(EVEPage *page, int16_t x);
diff --git a/fw/fe310/eos/eve/screen/screen.c b/fw/fe310/eos/eve/screen/screen.c
index f103b48..af5a91f 100644
--- a/fw/fe310/eos/eve/screen/screen.c
+++ b/fw/fe310/eos/eve/screen/screen.c
@@ -6,7 +6,7 @@
#include "screen.h"
#include "window.h"
-#include "kbdwin.h"
+#include "view.h"
int eve_screen_init(EVEScreen *screen, uint16_t w, uint16_t h) {
memset(screen, 0, sizeof(EVEScreen));
diff --git a/fw/fe310/eos/eve/screen/view.c b/fw/fe310/eos/eve/screen/view.c
new file mode 100644
index 0000000..30229e5
--- /dev/null
+++ b/fw/fe310/eos/eve/screen/view.c
@@ -0,0 +1,39 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "eve.h"
+#include "eve_kbd.h"
+
+#include "screen.h"
+#include "window.h"
+#include "view.h"
+
+void eve_view_init(EVEView *view, EVEWindow *window, eve_view_touch_t touch, eve_view_draw_t draw, void *param) {
+ view->touch = touch;
+ view->draw = draw;
+ view->param = param;
+ view->window = window;
+ window->view = view;
+}
+
+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);
+ }
+}
diff --git a/fw/fe310/eos/eve/screen/view.h b/fw/fe310/eos/eve/screen/view.h
new file mode 100644
index 0000000..3b635ef
--- /dev/null
+++ b/fw/fe310/eos/eve/screen/view.h
@@ -0,0 +1,27 @@
+#include <stdint.h>
+
+#define EVE_VIEW_SIZE_STACK 16
+
+struct EVEView;
+struct EVEViewStack;
+
+typedef int (*eve_view_touch_t) (struct EVEView *, uint8_t, int);
+typedef uint8_t (*eve_view_draw_t) (struct EVEView *, uint8_t);
+typedef void (*eve_view_constructor_t) (EVEWindow *window, struct EVEViewStack *);
+
+typedef struct EVEView {
+ eve_view_touch_t touch;
+ eve_view_draw_t draw;
+ EVEWindow *window;
+ void *param;
+} EVEView;
+
+typedef struct EVEViewStack {
+ eve_view_constructor_t constructor[EVE_VIEW_SIZE_STACK];
+ uint8_t level;
+} EVEViewStack;
+
+void eve_view_init(EVEView *view, EVEWindow *window, eve_view_touch_t touch, eve_view_draw_t draw, void *param);
+void eve_view_stack_init(EVEViewStack *stack);
+void eve_view_create(EVEWindow *window, EVEViewStack *stack, eve_view_constructor_t constructor);
+void eve_view_destroy(EVEWindow *window, EVEViewStack *stack); \ No newline at end of file
diff --git a/fw/fe310/eos/eve/screen/window.c b/fw/fe310/eos/eve/screen/window.c
index e49897f..bfa53d1 100644
--- a/fw/fe310/eos/eve/screen/window.c
+++ b/fw/fe310/eos/eve/screen/window.c
@@ -9,15 +9,12 @@
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
-void eve_window_init(EVEWindow *window, EVERect *g, EVEView *view, EVEScreen *screen) {
+void eve_window_init(EVEWindow *window, EVERect *g, EVEScreen *screen, char *name) {
memset(window, 0, sizeof(EVEWindow));
if (g) window->g = *g;
- if (view) {
- window->view = view;
- window->view->window = window;
- }
window->screen = screen;
+ window->name = name;
window->color_fg = 0xffffff;
}
@@ -114,3 +111,14 @@ void eve_window_remove(EVEWindow *window) {
screen->win_tail = window->prev;
}
}
+
+EVEWindow *eve_window_get(EVEScreen *screen, char *name) {
+ EVEWindow *w = screen->win_head;
+
+ while (w) {
+ if (strcmp(name, w->name) == 0) return w;
+ w = w->next;
+ }
+
+ return NULL;
+}
diff --git a/fw/fe310/eos/eve/screen/window.h b/fw/fe310/eos/eve/screen/window.h
index 7f14f18..89c83eb 100644
--- a/fw/fe310/eos/eve/screen/window.h
+++ b/fw/fe310/eos/eve/screen/window.h
@@ -3,19 +3,11 @@
struct EVEView;
struct EVEWindow;
-typedef int (*eve_view_touch_t) (struct EVEView *, uint8_t, int);
-typedef uint8_t (*eve_view_draw_t) (struct EVEView *, uint8_t);
-
-typedef struct EVEView {
- eve_view_touch_t touch;
- eve_view_draw_t draw;
- struct EVEWindow *window;
-} EVEView;
-
typedef struct EVEWindow {
EVERect g;
- EVEView *view;
EVEScreen *screen;
+ char *name;
+ struct EVEView *view;
struct EVEWindow *next;
struct EVEWindow *prev;
uint32_t color_bg;
@@ -23,7 +15,7 @@ typedef struct EVEWindow {
uint8_t tag;
} EVEWindow;
-void eve_window_init(EVEWindow *window, EVERect *g, EVEView *view, EVEScreen *screen);
+void eve_window_init(EVEWindow *window, EVERect *g, EVEScreen *screen, char *name);
void eve_window_set_color_bg(EVEWindow *window, uint8_t r, uint8_t g, uint8_t b);
void eve_window_set_color_fg(EVEWindow *window, uint8_t r, uint8_t g, uint8_t b);
@@ -34,3 +26,4 @@ void eve_window_append(EVEWindow *window);
void eve_window_insert_above(EVEWindow *window, EVEWindow *win_prev);
void eve_window_insert_below(EVEWindow *window, EVEWindow *win_next);
void eve_window_remove(EVEWindow *window);
+EVEWindow *eve_window_get(EVEScreen *screen, char *name);
diff --git a/fw/fe310/eos/eve/widget/freew.c b/fw/fe310/eos/eve/widget/freew.c
index 51d1ead..eaf982c 100644
--- a/fw/fe310/eos/eve/widget/freew.c
+++ b/fw/fe310/eos/eve/widget/freew.c
@@ -7,6 +7,7 @@
#include "screen/screen.h"
#include "screen/window.h"
+#include "screen/view.h"
#include "screen/page.h"
#include "font.h"
diff --git a/fw/fe310/eos/eve/widget/label.c b/fw/fe310/eos/eve/widget/label.c
index b4af37f..728f0bb 100644
--- a/fw/fe310/eos/eve/widget/label.c
+++ b/fw/fe310/eos/eve/widget/label.c
@@ -7,6 +7,7 @@
#include "screen/screen.h"
#include "screen/window.h"
+#include "screen/view.h"
#include "screen/page.h"
#include "font.h"
diff --git a/fw/fe310/eos/eve/widget/pagew.c b/fw/fe310/eos/eve/widget/pagew.c
index b3e71a6..319e207 100644
--- a/fw/fe310/eos/eve/widget/pagew.c
+++ b/fw/fe310/eos/eve/widget/pagew.c
@@ -7,6 +7,7 @@
#include "screen/screen.h"
#include "screen/window.h"
+#include "screen/view.h"
#include "screen/page.h"
#include "font.h"
@@ -20,7 +21,7 @@ int eve_pagew_create(EVEPageWidget *widget, EVERect *g, EVEPageSpec *spec) {
return EVE_OK;
}
-void eve_pagew_init(EVEPageWidget *widget, EVERect *g, EVEFont *font, char *title, eve_page_constructor_t constructor) {
+void eve_pagew_init(EVEPageWidget *widget, EVERect *g, EVEFont *font, char *title, eve_view_constructor_t constructor) {
EVEWidget *_widget = &widget->w;
memset(widget, 0, sizeof(EVEPageWidget));
@@ -28,7 +29,7 @@ void eve_pagew_init(EVEPageWidget *widget, EVERect *g, EVEFont *font, char *titl
eve_pagew_update(widget, font, title, constructor);
}
-void eve_pagew_update(EVEPageWidget *widget, EVEFont *font, char *title, eve_page_constructor_t constructor) {
+void eve_pagew_update(EVEPageWidget *widget, EVEFont *font, char *title, eve_view_constructor_t constructor) {
EVEWidget *_widget = &widget->w;
if (font) widget->font = font;
diff --git a/fw/fe310/eos/eve/widget/pagew.h b/fw/fe310/eos/eve/widget/pagew.h
index 797f1c3..67b1199 100644
--- a/fw/fe310/eos/eve/widget/pagew.h
+++ b/fw/fe310/eos/eve/widget/pagew.h
@@ -4,19 +4,19 @@ typedef struct EVEPageWidget {
EVEWidget w;
char *title;
EVEFont *font;
- eve_page_constructor_t constructor;
+ eve_view_constructor_t constructor;
uint8_t tag;
} EVEPageWidget;
typedef struct EVEPageSpec {
EVEFont *font;
char *title;
- eve_page_constructor_t constructor;
+ eve_view_constructor_t constructor;
} EVEPageSpec;
int eve_pagew_create(EVEPageWidget *widget, EVERect *g, EVEPageSpec *spec);
-void eve_pagew_init(EVEPageWidget *widget, EVERect *g, EVEFont *font, char *title, eve_page_constructor_t constructor);
-void eve_pagew_update(EVEPageWidget *widget, EVEFont *font, char *title, eve_page_constructor_t constructor);
+void eve_pagew_init(EVEPageWidget *widget, EVERect *g, EVEFont *font, char *title, eve_view_constructor_t constructor);
+void eve_pagew_update(EVEPageWidget *widget, EVEFont *font, char *title, eve_view_constructor_t constructor);
int eve_pagew_touch(EVEWidget *_widget, EVEPage *page, uint8_t tag0, int touch_idx);
uint8_t eve_pagew_draw(EVEWidget *_widget, EVEPage *page, uint8_t tag0);
diff --git a/fw/fe310/eos/eve/widget/spacerw.c b/fw/fe310/eos/eve/widget/spacerw.c
index 23aec14..e53c9c1 100644
--- a/fw/fe310/eos/eve/widget/spacerw.c
+++ b/fw/fe310/eos/eve/widget/spacerw.c
@@ -7,6 +7,7 @@
#include "screen/screen.h"
#include "screen/window.h"
+#include "screen/view.h"
#include "screen/page.h"
#include "font.h"
diff --git a/fw/fe310/eos/eve/widget/strw.c b/fw/fe310/eos/eve/widget/strw.c
index 4344e7c..0e1c97f 100644
--- a/fw/fe310/eos/eve/widget/strw.c
+++ b/fw/fe310/eos/eve/widget/strw.c
@@ -7,6 +7,7 @@
#include "screen/screen.h"
#include "screen/window.h"
+#include "screen/view.h"
#include "screen/page.h"
#include "clipb.h"
diff --git a/fw/fe310/eos/eve/widget/textw.c b/fw/fe310/eos/eve/widget/textw.c
index dd11c11..c81031a 100644
--- a/fw/fe310/eos/eve/widget/textw.c
+++ b/fw/fe310/eos/eve/widget/textw.c
@@ -7,6 +7,7 @@
#include "screen/screen.h"
#include "screen/window.h"
+#include "screen/view.h"
#include "screen/page.h"
#include "clipb.h"
diff --git a/fw/fe310/eos/eve/widget/widget.c b/fw/fe310/eos/eve/widget/widget.c
index 7c1fcad..1d610bf 100644
--- a/fw/fe310/eos/eve/widget/widget.c
+++ b/fw/fe310/eos/eve/widget/widget.c
@@ -7,6 +7,7 @@
#include "screen/screen.h"
#include "screen/window.h"
+#include "screen/view.h"
#include "screen/page.h"
#include "widgets.h"