1 #ifndef EL__BFU_WIDGET_H
2 #define EL__BFU_WIDGET_H
4 /* XXX: Include common definitions first */
5 #include "bfu/common.h"
7 #include "bfu/button.h"
8 #include "bfu/checkbox.h"
10 #include "bfu/inpfield.h"
11 #include "bfu/inphist.h"
13 #include "bfu/listbox.h"
14 #include "bfu/msgbox.h"
16 #include "util/lists.h"
23 /* XXX: Order matters here. --Zas */
24 widget_handler_T
*display
;
25 widget_handler_T
*init
;
26 widget_handler_T
*mouse
;
27 widget_handler_T
*kbd
;
28 widget_handler_T
*select
;
29 widget_handler_T
*clear
;
33 const struct widget_ops
*ops
;
37 widget_handler_T
*handler
;
40 int datalen
; /* 0 = no alloc/copy to cdata. */
43 struct widget_info_checkbox checkbox
;
44 struct widget_info_field field
;
45 struct widget_info_button button
;
46 struct widget_info_text text
;
49 enum widget_type type
;
53 struct widget
*widget
;
55 /* For WIDGET_FIELD: @cdata is in the charset of the terminal.
56 * (That charset can be UTF-8 only if CONFIG_UTF8 is defined,
57 * and is assumed to be unibyte otherwise.) The UTF-8 I/O
58 * option has no effect here.
60 * For WIDGET_TEXT: @cdata is cast from/to an unsigned char **
61 * that points to the first element of an array. Each element
62 * in this array corresponds to one line of text, and is an
63 * unsigned char * that points to the first character of that
64 * line. The array has @widget_data.info.text.lines elements.
66 * For WIDGET_LISTBOX: @cdata points to struct listbox_data. */
72 struct widget_data_info_field field
;
73 struct widget_data_info_checkbox checkbox
;
74 struct widget_data_info_text text
;
78 void display_widget(struct dialog_data
*, struct widget_data
*);
81 widget_is_focusable(struct widget_data
*widget_data
)
83 switch (widget_data
->widget
->type
) {
84 case WIDGET_LISTBOX
: return 0;
85 case WIDGET_TEXT
: return text_is_scrollable(widget_data
);