iPXE
include
ipxe
widget.h
Go to the documentation of this file.
1
#ifndef _IPXE_WIDGET_H
2
#define _IPXE_WIDGET_H
3
4
/** @file
5
*
6
* Text widgets
7
*
8
*/
9
10
FILE_LICENCE
( GPL2_OR_LATER_OR_UBDL );
11
12
#include <
curses.h
>
13
14
/** A text widget */
15
struct
widget
{
16
/** Widget operations */
17
struct
widget_operations
*
op
;
18
19
/** Row */
20
unsigned
int
row
;
21
/** Starting column */
22
unsigned
int
col
;
23
/** Width */
24
unsigned
int
width
;
25
/** Flags */
26
unsigned
int
flags
;
27
};
28
29
/** Text widget flags */
30
enum
widget_flags
{
31
/** Widget may have input focus */
32
WIDGET_EDITABLE
= 0x0001,
33
/** Widget contains a secret */
34
WIDGET_SECRET
= 0x0002,
35
};
36
37
/** Text widget operations */
38
struct
widget_operations
{
39
/**
40
* Draw widget
41
*
42
* @v widget Text widget
43
*/
44
void ( *
draw
) (
struct
widget
*
widget
);
45
/**
46
* Edit widget
47
*
48
* @v widget Text widget
49
* @v key Key pressed by user
50
* @ret key Key returned to application, or zero
51
*
52
* This will not update the display: you must call the draw()
53
* method to ensure that any changes to an editable widget are
54
* displayed to the user.
55
*/
56
int ( *
edit
) (
struct
widget
*
widget
,
int
key
);
57
};
58
59
/**
60
* Initialise text widget
61
*
62
* @v widget Text widget
63
* @v op Text widget operations
64
* @v row Row
65
* @v col Starting column
66
* @v width Width
67
*/
68
static
inline
__attribute__
(( always_inline ))
void
69
init_widget
(
struct
widget
*
widget
,
struct
widget_operations
*
op
,
70
unsigned
int
row
,
unsigned
int
col
,
unsigned
int
width
,
71
unsigned
int
flags
) {
72
73
widget
->
op
=
op
;
74
widget
->
row
=
row
;
75
widget
->
col
=
col
;
76
widget
->
width
=
width
;
77
widget
->
flags
=
flags
;
78
}
79
80
/**
81
* Draw text widget
82
*
83
* @v widget Text widget
84
*/
85
static
inline
__attribute__
(( always_inline ))
void
86
draw_widget
(
struct
widget
*
widget
) {
87
88
widget
->
op
->
draw
(
widget
);
89
}
90
91
/**
92
* Edit text widget
93
*
94
* @v widget Text widget
95
* @v key Key pressed by user
96
* @ret key Key returned to application, or zero
97
*
98
* This will not update the display: you must call draw_widget() to
99
* ensure that any changes to an editable widget are displayed to the
100
* user.
101
*/
102
static
inline
__attribute__
(( always_inline ))
int
103
edit_widget
(
struct
widget
*
widget
,
int
key
) {
104
105
return
widget
->
op
->
edit
(
widget
,
key
);
106
}
107
108
#endif
/* _IPXE_WIDGET_H */
curses.h
MuCurses header file.
init_widget
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:69
__attribute__
#define __attribute__(x)
Definition:
compiler.h:10
draw_widget
static void draw_widget(struct widget *widget)
Draw text widget.
Definition:
widget.h:86
widget::width
unsigned int width
Width.
Definition:
widget.h:24
widget::flags
unsigned int flags
Flags.
Definition:
widget.h:26
widget_operations::draw
void(* draw)(struct widget *widget)
Draw widget.
Definition:
widget.h:44
WIDGET_SECRET
Widget contains a secret.
Definition:
widget.h:34
WIDGET_EDITABLE
Widget may have input focus.
Definition:
widget.h:32
flags
uint8_t flags
Flags.
Definition:
ena.h:18
widget_operations
Text widget operations.
Definition:
widget.h:38
widget::col
unsigned int col
Starting column.
Definition:
widget.h:22
widget_flags
widget_flags
Text widget flags.
Definition:
widget.h:30
op
static uint16_t struct vmbus_xfer_pages_operations * op
Definition:
netvsc.h:327
widget::row
unsigned int row
Row.
Definition:
widget.h:20
widget
A text widget.
Definition:
widget.h:15
widget::op
struct widget_operations * op
Widget operations.
Definition:
widget.h:17
FILE_LICENCE
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
edit_widget
static int edit_widget(struct widget *widget, int key)
Edit text widget.
Definition:
widget.h:103
widget_operations::edit
int(* edit)(struct widget *widget, int key)
Edit widget.
Definition:
widget.h:56
key
union @383 key
Sense key.
Definition:
scsi.h:18
Generated by
1.8.15