summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/screen/page.h
blob: 6874a2d1b6e9c3c120d43056209b682f83611f00 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <stdint.h>

#define EVE_PAGE_KBDCH_CLOSE        0x1a

#define EVE_PAGE_OPT_SCROLL_X       0x01
#define EVE_PAGE_OPT_SCROLL_Y       0x02
#define EVE_PAGE_OPT_SCROLL_BACK    0x04
#define EVE_PAGE_OPT_TRACK_EXT_X    0x10
#define EVE_PAGE_OPT_TRACK_EXT_Y    0x20

#define EVE_PAGE_OPT_SCROLL_XY      (EVE_PAGE_OPT_SCROLL_X | EVE_PAGE_OPT_SCROLL_Y)
#define EVE_PAGE_OPT_TRACK_EXT_XY   (EVE_PAGE_OPT_TRACK_EXT_X | EVE_PAGE_OPT_TRACK_EXT_Y)

struct EVEWidget;
struct EVEPage;

typedef uint8_t (*eve_page_draw_t) (struct EVEPage *, uint8_t);
typedef int (*eve_page_touch_t) (struct EVEPage *, EVETouch *, uint16_t, uint8_t);
typedef int (*eve_page_uievt_t) (struct EVEPage *, uint16_t, void *);
typedef void (*eve_page_destructor_t) (struct EVEPage *);

typedef struct EVEPage {
    EVEView v;
    EVERect g;
    int16_t x0;
    int16_t y0;
    EVEViewStack *stack;
    eve_page_destructor_t destructor;
    struct EVEWidget *widget;
    uint16_t widget_size;
    struct EVEWidget *widget_f;
    EVEPhyLHO lho;
    uint32_t lho_t0;
    uint8_t track_mode;
    uint8_t opt;
} EVEPage;

void eve_page_init(EVEPage *page, EVEWindow *window, EVEViewStack *stack, struct EVEWidget *widget, uint16_t widget_size, uint8_t opt, eve_page_draw_t draw, eve_page_touch_t touch, eve_page_uievt_t uievt, eve_page_destructor_t destructor);

struct EVEWidget *eve_page_widget(EVEPage *page, uint16_t idx);
struct EVEWidget *eve_page_widget_search(EVEPage *page, char *label);
void eve_page_set_widget(EVEPage *page, struct EVEWidget *widget, uint16_t widget_size);

void eve_page_open(EVEPage *parent, eve_view_constructor_t constructor);
void eve_page_close(EVEPage *page);

/* Screen to page coordinates */
int16_t eve_page_x(EVEPage *page, int16_t x);
int16_t eve_page_y(EVEPage *page, int16_t y);
/* Page to window coordinates */
int16_t eve_page_win_x(EVEPage *page, int16_t x);
int16_t eve_page_win_y(EVEPage *page, int16_t y);
/* Page to screen coordinates */
int16_t eve_page_scr_x(EVEPage *page, int16_t x);
int16_t eve_page_scr_y(EVEPage *page, int16_t y);
int eve_page_rect_visible(EVEPage *page, EVERect *g);
void eve_page_show_rect(EVEPage *page, EVERect *rect);
int eve_page_oob(EVEPage *page, int *_max_x, int *_max_y);

struct EVEWidget *eve_page_focus(EVEPage *page);
void eve_page_set_focus(EVEPage *page, struct EVEWidget *widget);

uint8_t eve_page_draw(EVEPage *page, uint8_t tag0);
int eve_page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0);