iPXE
Data Structures | Enumerations | Functions
widget.h File Reference

Text widgets. More...

#include <curses.h>

Go to the source code of this file.

Data Structures

struct  widget
 A text widget. More...
 
struct  widget_operations
 Text widget operations. More...
 

Enumerations

enum  widget_flags { WIDGET_EDITABLE = 0x0001, WIDGET_SECRET = 0x0002 }
 Text widget flags. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
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. More...
 
static void draw_widget (struct widget *widget)
 Draw text widget. More...
 
static int edit_widget (struct widget *widget, int key)
 Edit text widget. More...
 

Detailed Description

Text widgets.

Definition in file widget.h.

Enumeration Type Documentation

◆ widget_flags

Text widget flags.

Enumerator
WIDGET_EDITABLE 

Widget may have input focus.

WIDGET_SECRET 

Widget contains a secret.

Definition at line 30 of file widget.h.

30  {
31  /** Widget may have input focus */
32  WIDGET_EDITABLE = 0x0001,
33  /** Widget contains a secret */
34  WIDGET_SECRET = 0x0002,
35 };
Widget contains a secret.
Definition: widget.h:34
Widget may have input focus.
Definition: widget.h:32

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ 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 
)
inlinestatic

Initialise text widget.

Parameters
widgetText widget
opText widget operations
rowRow
colStarting column
widthWidth

Definition at line 69 of file widget.h.

71  {
72 
73  widget->op = op;
74  widget->row = row;
75  widget->col = col;
76  widget->width = width;
77  widget->flags = flags;
78 }
unsigned int width
Width.
Definition: widget.h:24
unsigned int flags
Flags.
Definition: widget.h:26
uint8_t flags
Flags.
Definition: ena.h:18
unsigned int col
Starting column.
Definition: widget.h:22
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
unsigned int row
Row.
Definition: widget.h:20
A text widget.
Definition: widget.h:15
struct widget_operations * op
Widget operations.
Definition: widget.h:17

References widget::col, flags, widget::flags, widget::op, op, widget::row, and widget::width.

Referenced by init_editbox(), and init_label().

◆ draw_widget()

static void draw_widget ( struct widget widget)
inlinestatic

Draw text widget.

Parameters
widgetText widget

Definition at line 86 of file widget.h.

86  {
87 
88  widget->op->draw ( widget );
89 }
void(* draw)(struct widget *widget)
Draw widget.
Definition: widget.h:44
A text widget.
Definition: widget.h:15
struct widget_operations * op
Widget operations.
Definition: widget.h:17

References widget_operations::draw, and widget::op.

Referenced by draw_form(), form_loop(), and main_loop().

◆ edit_widget()

static int edit_widget ( struct widget widget,
int  key 
)
inlinestatic

Edit text widget.

Parameters
widgetText widget
keyKey pressed by user
Return values
keyKey returned to application, or zero

This will not update the display: you must call draw_widget() to ensure that any changes to an editable widget are displayed to the user.

Definition at line 103 of file widget.h.

103  {
104 
105  return widget->op->edit ( widget, key );
106 }
A text widget.
Definition: widget.h:15
struct widget_operations * op
Widget operations.
Definition: widget.h:17
int(* edit)(struct widget *widget, int key)
Edit widget.
Definition: widget.h:56
union @383 key
Sense key.
Definition: scsi.h:18

References widget_operations::edit, key, and widget::op.

Referenced by edit_setting(), and form_loop().