summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/screen/page.h
blob: 227375cfd0a5530465b079665b48e1b16edf1fba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#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 struct EVEPage {
    EVEView v;
    int16_t win_x;
    int16_t win_y;
    eve_page_evt_handler_t handle_evt;
    eve_page_g_updater_t update_g;
    eve_page_destructor_t destructor;
    struct EVEPageStack *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_close(EVEPage *page);

int16_t eve_page_x(EVEPage *page, int16_t x);
int16_t eve_page_y(EVEPage *page, int16_t y);
int16_t eve_page_scr_x(EVEPage *page, int16_t x);
int16_t eve_page_scr_y(EVEPage *page, int16_t y);

void eve_page_set_focus(EVEPage *page, struct EVEWidget *widget, EVERect *focus);
struct EVEWidget *eve_page_get_focus(EVEPage *page);
int eve_page_rect_visible(EVEPage *page, EVERect *g);