some progress with vi_redraw
[visor] / visor / src / term.h
1 #ifndef TERM_H_
2 #define TERM_H_
3
4 enum term_event_type {
5         TERM_EV_KEY,
6         TERM_EV_RESIZE,
7         TERM_EV_MBUTTON,
8         TERM_EV_MMOTION
9 };
10
11 struct term_ev_any {
12         int type;
13 };
14
15 struct term_ev_resize {
16         int type;
17         int width, height;
18 };
19
20 struct term_ev_mbutton {
21         int type;
22         /* TODO */
23 };
24
25 struct term_ev_mmotion {
26         int type;
27         int x, y;
28 };
29
30 union term_event {
31         struct term_ev_any any;
32         struct term_ev_resize resize;
33         struct term_ev_mbutton mbutton;
34         struct term_ev_mmotion mmotion;
35 };
36
37 int term_init(const char *ttypath);
38 void term_cleanup(void);
39
40 void term_getsize(int *width, int *height);
41 void term_resize_func(void (*func)(int, int));
42
43 void term_send(const char *s, int size);
44 void term_putchar(char c);
45 void term_puts(const char *s);
46 void term_printf(const char *fmt, ...);
47 void term_flush(void);
48
49 void term_clear(void);
50 void term_setcursor(int row, int col);
51
52 int term_getchar(void);
53
54 #endif  /* TERM_H_ */