3 * \brief Header: widget based utility functions
9 #include "lib/global.h"
16 struct WListbox
*list
;
19 /* Listbox utility functions */
20 Listbox
*create_listbox_window_centered (int center_y
, int center_x
, int lines
, int cols
,
21 const char *title
, const char *help
);
22 Listbox
*create_listbox_window (int lines
, int cols
, const char *title
, const char *help
);
23 #define LISTBOX_APPEND_TEXT(l,h,t,d) \
24 listbox_add_item (l->list, LISTBOX_APPEND_AT_END, h, t, d)
26 int run_listbox (Listbox
* l
);
40 /* The widget is placed on relative_?/divisions_? of the parent widget */
51 widget_options_t options
;
53 /* widget parameters */
59 int *state
; /* in/out */
73 int flags
; /* 1 -- is_password, 2 -- INPUT_COMPLETE_CD */
87 int *value
; /* in/out */
99 #define QUICK_CHECKBOX(x, xdiv, y, ydiv, txt, st) \
101 .widget_type = quick_checkbox, \
103 .x_divisions = xdiv, \
105 .y_divisions = ydiv, \
116 #define QUICK_BUTTON(x, xdiv, y, ydiv, txt, act, cb) \
118 .widget_type = quick_button, \
120 .x_divisions = xdiv, \
122 .y_divisions = ydiv, \
134 #define QUICK_INPUT(x, xdiv, y, ydiv, txt, len_, flags_, hname, res) \
136 .widget_type = quick_input, \
138 .x_divisions = xdiv, \
140 .y_divisions = ydiv, \
154 #define QUICK_LABEL(x, xdiv, y, ydiv, txt) \
156 .widget_type = quick_label, \
158 .x_divisions = xdiv, \
160 .y_divisions = ydiv, \
170 #define QUICK_RADIO(x, xdiv, y, ydiv, cnt, items_, val) \
172 .widget_type = quick_radio, \
174 .x_divisions = xdiv, \
176 .y_divisions = ydiv, \
188 #define QUICK_GROUPBOX(x, xdiv, y, ydiv, w, h, t) \
190 .widget_type = quick_groupbox, \
192 .x_divisions = xdiv, \
194 .y_divisions = ydiv, \
208 .widget_type = quick_end, \
229 int xpos
, ypos
; /* if -1, then center the dialog */
232 QuickWidget
*widgets
;
234 gboolean i18n
; /* If true, internationalization has happened */
237 int quick_dialog (QuickDialog
* qd
);
238 int quick_dialog_skip (QuickDialog
* qd
, int nskip
);
240 /* The input dialogs */
242 /* Pass this as def_text to request a password */
243 #define INPUT_PASSWORD ((char *) -1)
245 char *input_dialog (const char *header
, const char *text
,
246 const char *history_name
, const char *def_text
);
247 char *input_dialog_help (const char *header
, const char *text
, const char *help
,
248 const char *history_name
, const char *def_text
);
249 char *input_expand_dialog (const char *header
, const char *text
,
250 const char *history_name
, const char *def_text
);
252 void query_set_sel (int new_sel
);
254 /* Create message box but don't dismiss it yet, not background safe */
255 struct Dlg_head
*create_message (int flags
, const char *title
,
256 const char *text
, ...) __attribute__ ((format (__printf__
, 3, 4)));
258 /* Show message box, background safe */
259 void message (int flags
, const char *title
, const char *text
, ...)
260 __attribute__ ((format (__printf__
, 3, 4)));
263 /* Use this as header for message() - it expands to "Error" */
264 #define MSG_ERROR ((char *) -1)
266 int query_dialog (const char *header
, const char *text
, int flags
, int count
, ...);
268 /* flags for message() and query_dialog() */
273 } /* dialog options */ ;