|
iPXE
|
Text widget forms. More...
#include <stdlib.h>#include <string.h>#include <errno.h>#include <ipxe/ansicol.h>#include <ipxe/dynui.h>#include <ipxe/jumpscroll.h>#include <ipxe/settings.h>#include <ipxe/editbox.h>#include <ipxe/message.h>Go to the source code of this file.
Data Structures | |
| struct | form |
| A form. More... | |
| struct | form_control |
| A form control. More... | |
Macros | |
| #define | TITLE_ROW 1U |
| Form title row. More... | |
| #define | START_ROW 3U |
| Starting control row. More... | |
| #define | END_ROW ( LINES - 3U ) |
| Ending control row. More... | |
| #define | INSTRUCTION_ROW ( LINES - 2U ) |
| Instructions row. More... | |
| #define | INSTRUCTION_PAD " " |
| Padding between instructions. More... | |
| #define | INPUT_WIDTH ( COLS / 2U ) |
| Input field width. More... | |
| #define | INPUT_COL ( ( COLS - INPUT_WIDTH ) / 2U ) |
| Input field column. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static struct form * | alloc_form (struct dynamic_ui *dynui) |
| Allocate form. More... | |
| static void | free_form (struct form *form) |
| Free form. More... | |
| static int | layout_form (struct form *form) |
| Assign form rows. More... | |
| static void | draw_form (struct form *form) |
| Draw form. More... | |
| static void | draw_errors (struct form *form) |
| Draw (or clear) error messages. More... | |
| static int | parse_names (struct form *form) |
| Parse setting names. More... | |
| static void | load_values (struct form *form) |
| Load current input values. More... | |
| static int | save_values (struct form *form) |
| Store current input values. More... | |
| static int | submit_form (struct form *form) |
| Submit form. More... | |
| static int | form_loop (struct form *form) |
| Form main loop. More... | |
| int | show_form (struct dynamic_ui *dynui) |
| Show form. More... | |
Text widget forms.
Definition in file form_ui.c.
| #define INPUT_COL ( ( COLS - INPUT_WIDTH ) / 2U ) |
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Allocate form.
| dynui | Dynamic user interface |
| form | Form, or NULL on error |
Definition at line 99 of file form_ui.c.
References assert(), control, form::controls, dynamic_ui::count, form::dynui, dynamic_ui::items, len, dynamic_item::list, list_for_each_entry, dynamic_item::name, name, NULL, stpcpy(), strlen(), and zalloc().
Referenced by show_form().
|
static |
Free form.
| form | Form |
Definition at line 141 of file form_ui.c.
References form::controls, dynamic_ui::count, form::dynui, free, and form_control::value.
Referenced by show_form().
|
static |
Assign form rows.
| form | Form |
| rc | Return status code |
Definition at line 158 of file form_ui.c.
References assert(), control, form::controls, jump_scroller::count, dynamic_ui::count, jump_scroller::current, DBGC, form::dynui, DYNUI_DEFAULT, DYNUI_SECRET, EINVAL, END_ROW, ERANGE, flags, dynamic_item::flags, init_editbox(), INPUT_COL, INPUT_WIDTH, LINES, dynamic_item::name, jump_scroller::rows, form::scroll, START_ROW, dynamic_item::text, and WIDGET_SECRET.
Referenced by show_form().
|
static |
Draw form.
| form | Form |
Definition at line 252 of file form_ui.c.
References A_BOLD, attroff(), attron(), color_set, control, form::controls, dynamic_ui::count, CPAIR_NORMAL, draw_widget(), form::dynui, erase(), INSTRUCTION_PAD, INSTRUCTION_ROW, msg(), NULL, dynamic_ui::title, and TITLE_ROW.
Referenced by show_form().
|
static |
Draw (or clear) error messages.
| form | Form |
Definition at line 289 of file form_ui.c.
References clearmsg(), color_set, control, form::controls, dynamic_ui::count, CPAIR_ALERT, CPAIR_NORMAL, form::dynui, msg(), NULL, form_control::row, and strerror().
Referenced by submit_form().
|
static |
Parse setting names.
| form | Form |
| rc | Return status code |
Definition at line 320 of file form_ui.c.
References autovivify_child_settings(), control, form::controls, dynamic_ui::count, DBGC, form::dynui, parse_setting_name(), and rc.
Referenced by show_form().
|
static |
Load current input values.
| form | Form |
Definition at line 357 of file form_ui.c.
References control, form::controls, dynamic_ui::count, form::dynui, fetchf_setting_copy(), and NULL.
Referenced by show_form().
|
static |
Store current input values.
| form | Form |
| rc | Return status code |
Definition at line 378 of file form_ui.c.
References control, form::controls, dynamic_ui::count, form::dynui, rc, and storef_setting().
Referenced by submit_form().
|
static |
Submit form.
| form | Form |
| rc | Return status code |
Definition at line 404 of file form_ui.c.
References draw_errors(), rc, and save_values().
Referenced by form_loop().
|
static |
Form main loop.
| form | Form |
| rc | Return status code |
Definition at line 422 of file form_ui.c.
References control, form::controls, jump_scroller::count, dynamic_ui::count, CTRL_C, CTRL_X, jump_scroller::current, draw_widget(), form::dynui, dynui_shortcut(), ECANCELED, edit_widget(), ESC, getkey(), dynamic_item::index, jump_scroll_key(), jump_scroll_move(), key, KEY_ENTER, move(), dynamic_item::name, form_control::rc, rc, form::scroll, SCROLL_DOWN, and submit_form().
Referenced by show_form().
| int show_form | ( | struct dynamic_ui * | dynui | ) |
Show form.
| dynui | Dynamic user interface |
| rc | Return status code |
Definition at line 507 of file form_ui.c.
References alloc_form(), color_set, CPAIR_NORMAL, draw_form(), form::dynui, endwin(), ENOMEM, form_loop(), free_form(), initscr(), layout_form(), load_values(), NULL, parse_names(), rc, and start_color.
Referenced by login_ui(), and present_exec().
1.8.15