diff options
Diffstat (limited to 'clients/tui.h')
| -rw-r--r-- | clients/tui.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/clients/tui.h b/clients/tui.h index 39ea913..061edbf 100644 --- a/clients/tui.h +++ b/clients/tui.h @@ -127,6 +127,7 @@ enum { }; #define TUI_FORM_BACK (-1) +#define TUI_FORM_PAGE 10 #define TUI_FORM_REFRESH (-2) #define TUI_FORM_SUBMIT (-8) @@ -169,8 +170,12 @@ struct tui_rt { void (*info)(void *, int, char *, size_t); void *ud; int (*key)(void *, int); - /* Writes the dim status lines shown under the table ('\n' separated). */ + /* Writes the dim status line shown under the table ('\n' -> ' '). */ void (*footer)(void *, char *, size_t); + /* Optional header fields drawn above the table; focus starts there. */ + struct tui_form_field *fields; + int nfields; + int focus; /* header field index, or -1 for the table */ }; void tui_rt_init(struct tui_rt *t, int nrows, int maxrows, int ncols, @@ -180,6 +185,7 @@ void tui_rt_init(struct tui_rt *t, int nrows, int maxrows, int ncols, void tui_rt_set_key(struct tui_rt *t, int (*key)(void *ud, int ch)); void tui_rt_set_footer(struct tui_rt *t, void (*footer)(void *ud, char *buf, size_t n)); +void tui_rt_set_fields(struct tui_rt *t, struct tui_form_field *fields, int n); 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); @@ -188,4 +194,15 @@ int tui_rt_clear(struct tui_rt *t); int tui_rt_col_of(const struct tui_rt *t, int ecol); int tui_rt_run(const char *title, struct tui_rt *t, const char *hint); +/* Focus order for a row table with header fields: fields first, then the + editable cells row by row, wrapping back to the first field. focus -1 is + the table, 0..nf-1 the fields; dir 1 = Tab, -1 = Shift-Tab. When the new + focus is in the table, updates the row and col pointers. */ +int tui_rt_focus_step(int focus, int nf, int *row, int *col, int nrows, + int neditable, int dir); + +/* The footer line (above the hints) and its flattening. */ +int tui_rt_footer_row(int lines); +void tui_rt_footer_flatten(char *s); + #endif |
