summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/widget/strw.h
blob: acfd74ba85cf4a89898bf0a55b0f57c67a0a2fe4 (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
#include <stdint.h>

struct EVEWidgetSpec;

typedef struct EVEStrCursor {
    char on;
    uint16_t x;
    uint16_t ch;
} EVEStrCursor;

typedef struct EVEStrWidget {
    EVEWidget w;
    EVEFont *font;
    utf8_t *str;
    uint16_t str_size;
    uint16_t str_len;
    struct {
        int16_t x;
        int16_t x0;
        uint16_t w;
    } str_g;
    EVEStrCursor cursor1;
    EVEStrCursor cursor2;
    struct {
        EVEStrCursor *cursor;
        short dx;
        char mode;
    } track;
} EVEStrWidget;

typedef struct EVEStrSpec {
    EVEFont *font;
    uint16_t str_size;
} EVEStrSpec;

void eve_strw_init(EVEStrWidget *widget, EVERect *g, EVEPage *page, EVEFont *font, utf8_t *str, uint16_t str_size);
int eve_strw_update(EVEStrWidget *widget);

int eve_strw_create(EVEWidget *_widget, struct EVEWidgetSpec *spec, EVEPage *page);
void eve_strw_destroy(EVEWidget *_widget);
uint8_t eve_strw_draw(EVEWidget *_widget, uint8_t tag0);
int eve_strw_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt);

void eve_strw_putc(void *_page, int c);
void eve_strw_cursor_set(EVEStrWidget *widget, EVEStrCursor *cursor, int16_t x);
void eve_strw_cursor_clear(EVEStrWidget *widget, EVEStrCursor *cursor);