map: fix return value of map_delete
[vis.git] / ui.h
blob05d118dff4e4cd0322967c5d2dfdcbffd95f69e2
1 #ifndef UI_H
2 #define UI_H
4 #include <stdbool.h>
5 #include <stdarg.h>
6 #include <termkey.h>
8 typedef struct Ui Ui;
9 typedef struct UiWin UiWin;
11 enum UiLayout {
12 UI_LAYOUT_HORIZONTAL,
13 UI_LAYOUT_VERTICAL,
16 enum UiOption {
17 UI_OPTION_LINE_NUMBERS_ABSOLUTE = 1 << 0,
18 UI_OPTION_LINE_NUMBERS_RELATIVE = 1 << 1,
19 UI_OPTION_SYMBOL_SPACE = 1 << 2,
20 UI_OPTION_SYMBOL_TAB = 1 << 3,
21 UI_OPTION_SYMBOL_TAB_FILL = 1 << 4,
22 UI_OPTION_SYMBOL_EOL = 1 << 5,
23 UI_OPTION_SYMBOL_EOF = 1 << 6,
24 UI_OPTION_CURSOR_LINE = 1 << 7,
27 enum UiStyles {
28 UI_STYLE_LEXER_MAX = 64,
29 UI_STYLE_DEFAULT,
30 UI_STYLE_CURSOR,
31 UI_STYLE_CURSOR_LINE,
32 UI_STYLE_SELECTION,
33 UI_STYLE_LINENUMBER,
34 UI_STYLE_COLOR_COLUMN,
35 UI_STYLE_MAX,
38 #include "text.h"
39 #include "view.h"
40 #include "vis.h"
42 struct Ui {
43 bool (*init)(Ui*, Vis*);
44 void (*free)(Ui*);
45 void (*resize)(Ui*);
46 UiWin* (*window_new)(Ui*, View*, File*);
47 void (*window_free)(UiWin*);
48 void (*window_focus)(UiWin*);
49 UiWin* (*prompt_new)(Ui*, View*, File*);
50 void (*prompt)(Ui*, const char *title, const char *value);
51 char* (*prompt_input)(Ui*);
52 void (*prompt_hide)(Ui*);
53 void (*die)(Ui*, const char *msg, va_list ap) __attribute__((noreturn));
54 void (*info)(Ui*, const char *msg, va_list ap);
55 void (*info_hide)(Ui*);
56 void (*arrange)(Ui*, enum UiLayout);
57 void (*draw)(Ui*);
58 void (*redraw)(Ui*);
59 void (*update)(Ui*);
60 void (*suspend)(Ui*);
61 const char* (*getkey)(Ui*);
62 bool (*haskey)(Ui*);
63 void (*terminal_save)(Ui*);
64 void (*terminal_restore)(Ui*);
65 TermKey* (*termkey_get)(Ui*);
68 struct UiWin {
69 void (*draw)(UiWin*);
70 void (*draw_status)(UiWin*);
71 void (*reload)(UiWin*, File*);
72 void (*options_set)(UiWin*, enum UiOption);
73 enum UiOption (*options_get)(UiWin*);
74 bool (*syntax_style)(UiWin*, int id, const char *style);
77 #endif