aboutsummaryrefslogtreecommitdiff
path: root/clients/tui.h
diff options
context:
space:
mode:
Diffstat (limited to 'clients/tui.h')
-rw-r--r--clients/tui.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/clients/tui.h b/clients/tui.h
index 0bda359..d41d58c 100644
--- a/clients/tui.h
+++ b/clients/tui.h
@@ -12,6 +12,7 @@
/* Universal keys that have no control code or need a stable name. */
#define TUI_KEY_CTRL_N 0x0e
+#define TUI_KEY_CTRL_X 0x18
#define TUI_KEY_CTRL_ENTER (KEY_MAX + 1)
/* The application supplies input, frame/hints drawing and a quit hook so
@@ -128,4 +129,36 @@ int tui_form_next(int sel, int n, int ch);
int tui_form_run(const char *title, struct tui_form_field *f, int n,
int can_edit);
+/* --- row table --- */
+enum { TUI_RT_EDIT = 0, TUI_RT_INFO, TUI_RT_DATE };
+
+struct tui_rt_col {
+ const char *header;
+ int x;
+ int width;
+ int kind;
+};
+
+struct tui_rt {
+ int nrows, maxrows, ncols, neditable;
+ const struct tui_rt_col *cols;
+ int y;
+ int row, col;
+ int fresh;
+ size_t pos;
+ void (*cell)(void *, int, int, char **, size_t *);
+ void (*info)(void *, int, char *, size_t);
+ void *ud;
+};
+
+void tui_rt_init(struct tui_rt *t, int nrows, int maxrows, int ncols,
+ const struct tui_rt_col *cols, int y,
+ void (*cell)(void *, int, int, char **, size_t *),
+ void (*info)(void *, int, char *, size_t), void *ud);
+int tui_rt_blank_row(struct tui_rt *t, int row);
+int tui_rt_normalize(struct tui_rt *t);
+int tui_rt_move(struct tui_rt *t, int dr, int dc);
+int tui_rt_clear(struct tui_rt *t);
+int tui_rt_run(const char *title, struct tui_rt *t, const char *hint);
+
#endif