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 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <curses.h>
13 #include <ipxe/editstring.h>
14 
15 /** An editable text box widget */
16 struct edit_box {
17  /** Editable string */
19  /** Containing window */
21  /** Row */
22  unsigned int row;
23  /** Starting column */
24  unsigned int col;
25  /** Width */
26  unsigned int width;
27  /** First displayed character */
28  unsigned int first;
29  /** Flags */
30  unsigned int flags;
31 };
32 
33 /** Editable text box widget flags */
35  /** Show stars instead of contents (for password widgets) */
36  EDITBOX_STARS = 0x0001,
37 };
38 
39 extern void init_editbox ( struct edit_box *box, char *buf, size_t len,
40  WINDOW *win, unsigned int row, unsigned int col,
41  unsigned int width, unsigned int flags )
42  __attribute__ (( nonnull (1, 2) ));
43 extern void draw_editbox ( struct edit_box *box ) __nonnull;
44 static inline int edit_editbox ( struct edit_box *box, int key ) __nonnull;
45 
46 /**
47  * Edit text box widget
48  *
49  * @v box Editable text box widget
50  * @v key Key pressed by user
51  * @ret key Key returned to application, or zero
52  *
53  * You must call draw_editbox() to update the display after calling
54  * edit_editbox().
55  *
56  */
57 static inline int edit_editbox ( struct edit_box *box, int key ) {
58  return edit_string ( &box->string, key );
59 }
60 
61 #endif /* _IPXE_EDITBOX_H */
MuCurses header file.
Editable strings.
int box(WINDOW *win, chtype verch, chtype horch)
Draw borders from single-byte characters and renditions around a window.
Definition: edging.c:22
Curses Window struct.
Definition: curses.h:89
unsigned int row
Row.
Definition: editbox.h:22
int edit_string(struct edit_string *string, int key)
Edit editable string.
Definition: editstring.c:195
unsigned int width
Width.
Definition: editbox.h:26
void draw_editbox(struct edit_box *box) __nonnull
Draw text box widget.
Definition: editbox.c:69
WINDOW * win
Containing window.
Definition: editbox.h:20
unsigned int col
Starting column.
Definition: editbox.h:24
struct edit_box __attribute__
#define __nonnull
Declare a function's pointer parameters as non-null - i.e.
Definition: compiler.h:592
static int edit_editbox(struct edit_box *box, int key) __nonnull
Edit text box widget.
Definition: editbox.h:57
An editable text box widget.
Definition: editbox.h:16
unsigned int flags
Flags.
Definition: editbox.h:30
Show stars instead of contents (for password widgets)
Definition: editbox.h:36
unsigned int first
First displayed character.
Definition: editbox.h:28
uint32_t len
Length.
Definition: ena.h:14
An editable string.
Definition: editstring.h:13
void init_editbox(struct edit_box *box, char *buf, size_t len, WINDOW *win, unsigned int row, unsigned int col, unsigned int width, unsigned int flags)
Initialise text box widget.
Definition: editbox.c:50
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct edit_string string
Editable string.
Definition: editbox.h:18
edit_box_flags
Editable text box widget flags.
Definition: editbox.h:34
union @375 key
Sense key.
Definition: scsi.h:18
char * buf
Buffer for string.
Definition: editstring.h:15
uint8_t flags
Flags.
Definition: ena.h:18