aboutsummaryrefslogtreecommitdiff
path: root/clients/tui.h
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-22 12:43:52 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-22 12:43:52 +0200
commit07f5b140922d13519ad7a0d1dad67a9b403be9f1 (patch)
treeb6dde2ed6adb90c6423a5e585b693b908637e5ee /clients/tui.h
parent760cb25bd220718e37d8b95016f30cdf8ef6acdc (diff)
downloadbokf-07f5b140922d13519ad7a0d1dad67a9b403be9f1.tar.gz
bokf-07f5b140922d13519ad7a0d1dad67a9b403be9f1.zip
tui: kundutkast, <UTKAST>, explicit Spara och F2-åtgärder
Diffstat (limited to 'clients/tui.h')
-rw-r--r--clients/tui.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/clients/tui.h b/clients/tui.h
index 6df27fb..1785a32 100644
--- a/clients/tui.h
+++ b/clients/tui.h
@@ -191,10 +191,33 @@ 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, int *focus);
void tui_form_hint(const char *hint); /* overrides the footer for the next run */
+/* Extra text appended to the form/list footer until changed (NULL clears). */
+void tui_form_hint_extra(const char *extra);
+void tui_list_hint_extra(const char *extra);
int tui_form_run_hook(const char *title, struct tui_form_field *f, int n,
int can_edit, int (*key)(void *ud, int ch), void *ud,
int *focus);
+/* --- action registry (docs/TUI-GUIDELINES.md "Interaction model") --- */
+struct tui_action {
+ const char *id; /* stable, e.g. "customer.archive" */
+ const char *label; /* Swedish UI text */
+ int key; /* accelerator; 0 = menu only */
+ int enabled; /* 1 runnable, 0 dim + reason, -1 heading */
+ const char *reason; /* why a disabled action is dim */
+};
+
+/* "label", or "label (reason)" when the action is disabled. */
+void tui_action_label(const struct tui_action *a, char *buf, size_t n);
+/* Builds "F9 = spara F2 = fler", showing at most max keyed actions. */
+void tui_action_hint(const struct tui_action *acts, int n, int max,
+ char *buf, size_t cap);
+/* Modal action list: arrows/Tab/Home/End/PgUp/PgDn/1-9/g navigate, Enter
+ runs (a disabled action shows its reason), Esc cancels. Returns the
+ chosen index or -1. *focus remembers the row. */
+int tui_action_menu(const char *title, const struct tui_action *acts, int n,
+ int *focus);
+
/* --- action list in a form (tui_form_run_actions) --- */
/* enabled: 1 = selectable and runs; 0 = dimmed but selectable (Enter shows
disabled_reason in a message); -1 = non-selectable heading/status row,