aboutsummaryrefslogtreecommitdiff
path: root/clients/tui.h
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-19 22:03:06 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-19 22:03:06 +0200
commit84c4fdcf138ad6ef4f7edfea76f2318b7a7a5e3e (patch)
treedbae3b9fe87503297dc551393add7f0b97a0a543 /clients/tui.h
parent4329ffb98d7eeffe2b3874d2b31cb0857d33d944 (diff)
downloadbokf-0.1.37.tar.gz
bokf-0.1.37.zip
tui: row table widget (dynamic rows, trailing blank row) + testsv0.1.37
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