iPXE
editbox.h
Go to the documentation of this file.
1#ifndef _IPXE_EDITBOX_H
2#define _IPXE_EDITBOX_H
3
4/** @file
5 *
6 * Editable text box widget
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <curses.h>
14#include <ipxe/editstring.h>
15#include <ipxe/widget.h>
16
17/** An editable text box widget */
18struct edit_box {
19 /** Text widget */
20 struct widget widget;
21 /** Editable string */
23 /** First displayed character */
24 unsigned int first;
25};
26
28
29/**
30 * Initialise text box widget
31 *
32 * @v box Editable text box widget
33 * @v row Row
34 * @v col Starting column
35 * @v width Width
36 * @v flags Flags
37 * @v buf Dynamically allocated string buffer
38 */
39static inline __attribute__ (( always_inline )) void
40init_editbox ( struct edit_box *box, unsigned int row, unsigned int col,
41 unsigned int width, unsigned int flags, char **buf ) {
42
43 init_widget ( &box->widget, &editbox_operations, row, col,
44 width, ( flags | WIDGET_EDITABLE ) );
45 init_editstring ( &box->string, buf );
46 if ( *buf )
47 box->string.cursor = strlen ( *buf );
48}
49
50#endif /* _IPXE_EDITBOX_H */
MuCurses header file.
int box(WINDOW *win, chtype verch, chtype horch)
Draw borders from single-byte characters and renditions around a window.
Definition edging.c:22
struct widget_operations editbox_operations
Text box widget operations.
Definition editbox.c:101
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.
Definition editbox.h:40
Editable strings.
static __nonnull void init_editstring(struct edit_string *string, char **buf)
Initialise editable string.
Definition editstring.h:47
uint8_t flags
Flags.
Definition ena.h:7
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define __attribute__(x)
Definition compiler.h:10
size_t strlen(const char *src)
Get length of string.
Definition string.c:244
An editable text box widget.
Definition editbox.h:18
struct edit_string string
Editable string.
Definition editbox.h:22
struct widget widget
Text widget.
Definition editbox.h:20
unsigned int first
First displayed character.
Definition editbox.h:24
An editable string.
Definition editstring.h:14
Text widget operations.
Definition widget.h:39
Text widgets.
static void init_widget(struct widget *widget, struct widget_operations *op, unsigned int row, unsigned int col, unsigned int width, unsigned int flags)
Initialise text widget.
Definition widget.h:70
@ WIDGET_EDITABLE
Widget may have input focus.
Definition widget.h:33