summaryrefslogtreecommitdiff
path: root/code/fe310/eos/eve/screen/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/fe310/eos/eve/screen/screen.c')
-rw-r--r--code/fe310/eos/eve/screen/screen.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/code/fe310/eos/eve/screen/screen.c b/code/fe310/eos/eve/screen/screen.c
index c65e8fc..52015be 100644
--- a/code/fe310/eos/eve/screen/screen.c
+++ b/code/fe310/eos/eve/screen/screen.c
@@ -5,7 +5,7 @@
#include "eve_kbd.h"
#include "screen.h"
-#include "tile.h"
+#include "window.h"
int eve_screen_init(EVEScreen *screen, uint16_t w, uint16_t h) {
memset(screen, 0, sizeof(EVEScreen));
@@ -29,11 +29,43 @@ void eve_screen_hide_kbd(EVEScreen *screen) {
screen->kbd_active = 0;
}
-void eve_screen_add_tile(EVEScreen *screen, EVETile *tile) {
- if (screen->tile_size < EVE_MAX_TILES) {
- screen->tile[screen->tile_size] = tile;
- screen->tile_size++;
+int eve_screen_win_insert(EVEScreen *screen, EVEWindow *window, int idx) {
+ if (idx) {
+ int i;
+ EVEWindow *h = screen->win_head;
+
+ for (i=1; i<idx; i++) {
+ h = h->next;
+ if (h == NULL) return EVE_ERR;
+ }
+ window->next = h->next;
+ h->next = window;
+ } else {
+ window->next = screen->win_head;
+ screen->win_head = window;
}
+ if (window->next == NULL) screen->win_tail = window;
+ return EVE_OK;
+}
+
+int eve_screen_win_remove(EVEScreen *screen, EVEWindow *window) {
+ EVEWindow *h = screen->win_head;
+ if (h == NULL) return EVE_ERR;
+ if (h == window) {
+ screen->win_head = window->next;
+ if (screen->win_head == NULL) screen->win_tail = NULL;
+ } else {
+ while (h->next && (h->next != window)) h = h->next;
+ if (h->next == NULL) return EVE_ERR;
+
+ h->next = window->next;
+ if (h->next == NULL) screen->win_tail = h;
+ }
+}
+
+void eve_screen_win_append(EVEScreen *screen, EVEWindow *window) {
+ screen->win_tail->next = window;
+ screen->win_tail = window;
}
void eve_screen_handle_touch(EVEScreen *screen, uint8_t tag0, int touch_idx) {