3 * \brief Header: widget based utility functions
9 #include "lib/global.h"
15 struct WListbox
*list
;
18 /* Listbox utility functions */
19 Listbox
*create_listbox_window_centered (int center_y
, int center_x
, int lines
, int cols
,
20 const char *title
, const char *help
);
21 Listbox
*create_listbox_window (int lines
, int cols
, const char *title
, const char *help
);
22 #define LISTBOX_APPEND_TEXT(l,h,t,d) \
23 listbox_add_item (l->list, LISTBOX_APPEND_AT_END, h, t, d)
25 int run_listbox (Listbox
*l
);
38 /* The widget is placed on relative_?/divisions_? of the parent widget */
49 /* widget parameters */
53 int *state
; /* in/out */
65 int flags
; /* 1 -- is_password, 2 -- INPUT_COMPLETE_CD */
77 int *value
; /* in/out */
88 #define QUICK_CHECKBOX(x, xdiv, y, ydiv, txt, st) \
90 .widget_type = quick_checkbox, \
92 .x_divisions = xdiv, \
94 .y_divisions = ydiv, \
104 #define QUICK_BUTTON(x, xdiv, y, ydiv, txt, act, cb) \
106 .widget_type = quick_button, \
108 .x_divisions = xdiv, \
110 .y_divisions = ydiv, \
121 #define QUICK_INPUT(x, xdiv, y, ydiv, txt, len_, flags_, hname, res) \
123 .widget_type = quick_input, \
125 .x_divisions = xdiv, \
127 .y_divisions = ydiv, \
140 #define QUICK_LABEL(x, xdiv, y, ydiv, txt) \
142 .widget_type = quick_label, \
144 .x_divisions = xdiv, \
146 .y_divisions = ydiv, \
155 #define QUICK_RADIO(x, xdiv, y, ydiv, cnt, items_, val) \
157 .widget_type = quick_radio, \
159 .x_divisions = xdiv, \
161 .y_divisions = ydiv, \
172 #define QUICK_GROUPBOX(x, xdiv, y, ydiv, w, h, t) \
174 .widget_type = quick_groupbox, \
176 .x_divisions = xdiv, \
178 .y_divisions = ydiv, \
191 .widget_type = quick_end, \
210 int xpos
, ypos
; /* if -1, then center the dialog */
213 QuickWidget
*widgets
;
214 gboolean i18n
; /* If true, internationalization has happened */
217 int quick_dialog (QuickDialog
*qd
);
218 int quick_dialog_skip (QuickDialog
*qd
, int nskip
);
220 /* The input dialogs */
222 /* Pass this as def_text to request a password */
223 #define INPUT_PASSWORD ((char *) -1)
225 char *input_dialog (const char *header
, const char *text
,
226 const char *history_name
, const char *def_text
);
227 char *input_dialog_help (const char *header
, const char *text
, const char *help
,
228 const char *history_name
, const char *def_text
);
229 char *input_expand_dialog (const char *header
, const char *text
,
230 const char *history_name
, const char *def_text
);
232 void query_set_sel (int new_sel
);
234 /* Create message box but don't dismiss it yet, not background safe */
235 struct Dlg_head
*create_message (int flags
, const char *title
,
236 const char *text
, ...)
237 __attribute__ ((format (__printf__
, 3, 4)));
239 /* Show message box, background safe */
240 void message (int flags
, const char *title
, const char *text
, ...)
241 __attribute__ ((format (__printf__
, 3, 4)));
244 /* Use this as header for message() - it expands to "Error" */
245 #define MSG_ERROR ((char *) -1)
247 int query_dialog (const char *header
, const char *text
, int flags
, int count
, ...);
249 /* flags for message() and query_dialog() */
253 } /* dialog options */;