ui.h (653B)
1 #ifndef UI_H 2 #define UI_H 3 4 typedef enum { 5 SYM_EMPTYLINE 6 } Symbol; 7 8 typedef enum { 9 EV_KEY, 10 EV_UKN 11 } EventType; 12 13 typedef struct { 14 EventType type; 15 int key; 16 int mod; 17 int col, row; 18 } Event; 19 20 typedef struct { 21 const char *name; 22 void (*init)(void); 23 void (*exit)(void); 24 void (*frame_start)(void); 25 void (*frame_flush)(void); 26 int (*text_width)(char *s, int len); 27 int (*text_index_at)(char *s, int idx); 28 void (*move_cursor)(int x, int y); 29 void (*draw_line)(int r, int c, char *txt, int len); 30 void (*draw_symbol)(int r, int c, Symbol sym); 31 void (*get_window_size)(int *rows, int *cols); 32 Event (*next_event)(void); 33 } UI; 34 35 extern UI ui_tui; 36 37 #endif