iPXE
|
Menu interface. More...
#include <string.h>
#include <errno.h>
#include <curses.h>
#include <ipxe/keys.h>
#include <ipxe/timer.h>
#include <ipxe/console.h>
#include <ipxe/ansicol.h>
#include <ipxe/jumpscroll.h>
#include <ipxe/dynui.h>
Go to the source code of this file.
Data Structures | |
struct | menu_ui |
A menu user interface. More... | |
Macros | |
#define | TITLE_ROW 1U |
#define | MENU_ROW 3U |
#define | MENU_COL 1U |
#define | MENU_ROWS ( LINES - 2U - MENU_ROW ) |
#define | MENU_COLS ( COLS - 2U ) |
#define | MENU_PAD 2U |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | draw_menu_item (struct menu_ui *ui, unsigned int index) |
Draw a numbered menu item. More... | |
static void | draw_menu_items (struct menu_ui *ui) |
Draw the current block of menu items. More... | |
static int | menu_loop (struct menu_ui *ui, struct dynamic_item **selected) |
Menu main loop. More... | |
int | show_menu (struct dynamic_ui *dynui, unsigned long timeout, const char *select, struct dynamic_item **selected) |
Show menu. More... | |
Menu interface.
Definition in file menu_ui.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Draw a numbered menu item.
ui | Menu user interface |
index | Index |
Definition at line 66 of file menu_ui.c.
References A_BOLD, attroff(), attron(), clrtoeol(), color_set, CPAIR_NORMAL, CPAIR_SELECT, CPAIR_SEPARATOR, jump_scroller::current, menu_ui::dynui, dynui_item(), jump_scroller::first, index, len, memcpy(), memset(), MENU_COL, MENU_COLS, MENU_PAD, MENU_ROW, move(), dynamic_item::name, NULL, printw(), menu_ui::scroll, snprintf(), strlen(), dynamic_item::text, TICKS_PER_SEC, and menu_ui::timeout.
Referenced by draw_menu_items(), menu_loop(), and show_menu().
|
static |
Draw the current block of menu items.
ui | Menu user interface |
Definition at line 133 of file menu_ui.c.
References color_set, CPAIR_NORMAL, CPAIR_SEPARATOR, draw_menu_item(), jump_scroller::first, jump_scroll_is_first(), jump_scroll_is_last(), MENU_COL, MENU_PAD, MENU_ROW, MENU_ROWS, mvaddstr(), NULL, and menu_ui::scroll.
Referenced by menu_loop(), and show_menu().
|
static |
Menu main loop.
ui | Menu user interface |
selected | Selected item |
rc | Return status code |
Definition at line 156 of file menu_ui.c.
References assert(), CR, CTRL_C, jump_scroller::current, draw_menu_item(), draw_menu_items(), menu_ui::dynui, dynui_item(), dynui_shortcut(), ECANCELED, ESC, getkey(), dynamic_item::index, jump_scroll(), jump_scroll_key(), jump_scroll_move(), key, LF, move(), dynamic_item::name, NULL, rc, menu_ui::scroll, SCROLL_DOWN, SCROLL_NONE, TICKS_PER_SEC, menu_ui::timeout, and timeout().
Referenced by show_menu().
int show_menu | ( | struct dynamic_ui * | dynui, |
unsigned long | timeout, | ||
const char * | select, | ||
struct dynamic_item ** | selected | ||
) |
Show menu.
dynui | Dynamic user interface |
timeout | Timeout period, in ticks (0=indefinite) |
selected | Selected item |
rc | Return status code |
Definition at line 248 of file menu_ui.c.
References A_BOLD, assert(), attroff(), attron(), color_set, COLS, jump_scroller::count, CPAIR_NORMAL, jump_scroller::current, curs_set(), draw_menu_item(), draw_menu_items(), menu_ui::dynui, DYNUI_DEFAULT, endwin(), ENOENT, erase(), dynamic_item::flags, initscr(), dynamic_ui::items, jump_scroll(), list_for_each_entry, memset(), MENU_COLS, menu_loop(), MENU_ROWS, mvprintw, dynamic_item::name, NULL, rc, jump_scroller::rows, menu_ui::scroll, select(), snprintf(), start_color, strcmp(), strlen(), menu_ui::timeout, timeout(), dynamic_ui::title, and TITLE_ROW.
Referenced by choose_exec().