49 #define END_ROW ( LINES - 3U ) 52 #define INSTRUCTION_ROW ( LINES - 2U ) 55 #define INSTRUCTION_PAD " " 58 #define INPUT_WIDTH ( COLS / 2U ) 61 #define INPUT_COL ( ( COLS - INPUT_WIDTH ) / 2U ) 107 len =
sizeof ( *form );
109 len +=
sizeof ( *control );
118 control = ( ( (
void * )
form ) +
sizeof ( *form ) );
120 ( dynui->
count *
sizeof ( *control ) ) );
161 unsigned int labels = 0;
162 unsigned int inputs = 0;
163 unsigned int pad_control = 0;
164 unsigned int pad_label = 0;
165 unsigned int minimum;
166 unsigned int remaining;
167 unsigned int between;
188 DBGC (
form,
"FORM %p has %d controls (%d labels, %d inputs)\n",
196 minimum = ( labels + ( inputs * 2 ) );
198 DBGC (
form,
"FORM %p has %d (of %d) usable rows\n",
200 if ( minimum > remaining )
202 remaining -= minimum;
206 if ( between <= remaining ) {
208 remaining -= between;
209 DBGC (
form,
"FORM %p padding between controls\n",
form );
213 if ( labels <= remaining ) {
220 DBGC (
form,
"FORM %p has %d spare rows\n",
form, remaining );
227 if ( item->
text[0] ) {
336 DBGC (
form,
"FORM %p item %d is for %s\n",
346 control->setting.type = &setting_type_string;
520 goto err_parse_names;
int getkey(unsigned long timeout)
Get single keypress.
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
A dynamic user interface item.
Editable text box widget.
void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
int erase(void)
Completely clear the screen.
int fetchf_setting_copy(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, char **value)
Fetch copy of formatted value of setting.
static int attroff(int attrs)
void clearmsg(unsigned int row)
Clear message on specified row.
int endwin(void)
Finalise console environment.
#define LINES(...)
Define inline lines.
unsigned int count
Number of user interface items.
#define ECANCELED
Operation canceled.
#define CPAIR_NORMAL
Normal text.
#define ENOMEM
Not enough space.
char * stpcpy(char *dest, const char *src)
Copy string.
struct list_head items
Dynamic user interface items.
WINDOW * initscr(void)
Initialise console environment.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
struct dynamic_item * dynui_shortcut(struct dynamic_ui *dynui, int key)
Find dynamic user interface item by shortcut key.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
#define CPAIR_ALERT
Error text.
struct settings * autovivify_child_settings(struct settings *parent, const char *name)
Find or create child settings block.
#define ESC
Escape character.
An editable text box widget.
int storef_setting(struct settings *settings, const struct setting *setting, const char *value)
Store formatted value of setting.
#define ERANGE
Result too large.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
void * zalloc(size_t size)
Allocate cleared memory.
size_t strlen(const char *src)
Get length of string.
A dynamic user interface.
static void init_editbox(struct edit_box *box, unsigned int row, unsigned int col, unsigned int width, unsigned int flags, char **buf)
Initialise text box widget.
#define DYNUI_DEFAULT
Dynamic user interface item is default selection.
static int move(int y, int x)
#define color_set(cpno, opts)
struct list_head list
List of dynamic user interface items.
#define NULL
NULL pointer (VOID *)
#define DYNUI_SECRET
Dynamic user interface item represents a secret.
int parse_setting_name(char *name, get_child_settings_t get_child, struct settings **settings, struct setting *setting)
Parse setting name.
static int attron(int attrs)