2 * \brief Header: quick dialog engine
8 #include "lib/tty/mouse.h"
10 /*** typedefs(not structures) and defined constants **********************************************/
12 #define QUICK_CHECKBOX(txt, st, id_) \
14 .widget_type = quick_checkbox, \
16 .pos_flags = WPOS_KEEP_DEFAULT, \
26 #define QUICK_BUTTON(txt, act, cb, id_) \
28 .widget_type = quick_button, \
30 .pos_flags = WPOS_KEEP_DEFAULT, \
41 #define QUICK_INPUT(txt, flags_, hname, res, id_) \
43 .widget_type = quick_input, \
45 .pos_flags = WPOS_KEEP_DEFAULT, \
50 .label_location = input_label_none, \
60 #define QUICK_LABELED_INPUT(label_, label_loc, txt, flags_, hname, res, id_) \
62 .widget_type = quick_input, \
64 .pos_flags = WPOS_KEEP_DEFAULT, \
68 .label_text = label_, \
69 .label_location = label_loc, \
79 #define QUICK_LABEL(txt, id_) \
81 .widget_type = quick_label, \
83 .pos_flags = WPOS_KEEP_DEFAULT, \
93 #define QUICK_RADIO(cnt, items_, val, id_) \
95 .widget_type = quick_radio, \
97 .pos_flags = WPOS_KEEP_DEFAULT, \
108 #define QUICK_START_GROUPBOX(t) \
110 .widget_type = quick_start_groupbox, \
112 .pos_flags = WPOS_KEEP_DEFAULT, \
121 #define QUICK_STOP_GROUPBOX \
123 .widget_type = quick_stop_groupbox, \
125 .pos_flags = WPOS_KEEP_DEFAULT, \
137 #define QUICK_SEPARATOR(line_) \
139 .widget_type = quick_separator, \
141 .pos_flags = WPOS_KEEP_DEFAULT, \
151 #define QUICK_START_COLUMNS \
153 .widget_type = quick_start_columns, \
155 .pos_flags = WPOS_KEEP_DEFAULT, \
167 #define QUICK_NEXT_COLUMN \
169 .widget_type = quick_next_column, \
171 .pos_flags = WPOS_KEEP_DEFAULT, \
183 #define QUICK_STOP_COLUMNS \
185 .widget_type = quick_stop_columns, \
187 .pos_flags = WPOS_KEEP_DEFAULT, \
199 #define QUICK_START_BUTTONS(space_, line_) \
201 .widget_type = quick_buttons, \
203 .pos_flags = WPOS_KEEP_DEFAULT, \
213 #define QUICK_BUTTONS_OK_CANCEL \
214 QUICK_START_BUTTONS (TRUE, TRUE), \
215 QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL), \
216 QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL)
220 .widget_type = quick_end, \
222 .pos_flags = WPOS_KEEP_DEFAULT, \
234 /*** enums ***************************************************************************************/
245 quick_start_groupbox
= 6,
246 quick_stop_groupbox
= 7,
248 quick_start_columns
= 9,
249 quick_next_column
= 10,
250 quick_stop_columns
= 11,
256 input_label_none
= 0,
257 input_label_above
= 1,
258 input_label_left
= 2,
259 input_label_right
= 3,
260 input_label_below
= 4
261 } quick_input_label_location_t
;
263 /*** structures declarations (and typedefs of structures)*****************************************/
265 /* The widget is placed on relative_?/divisions_? of the parent widget */
266 typedef struct quick_widget_t quick_widget_t
;
268 struct quick_widget_t
272 widget_options_t options
;
273 widget_pos_flags_t pos_flags
;
276 /* widget parameters */
282 int *state
; /* in/out */
294 const char *label_text
;
295 quick_input_label_location_t label_location
;
296 quick_widget_t
*label
;
298 int flags
; /* 1 -- is_password, 2 -- INPUT_COMPLETE_CD */
299 const char *histname
;
301 gboolean strip_password
;
307 quick_widget_t
*input
;
314 int *value
; /* in/out */
332 int y
, x
; /* if -1, then center the dialog */
333 int cols
; /* heigth is calculated automatically */
336 quick_widget_t
*widgets
;
337 widget_cb_fn callback
;
341 /*** global variables defined in .c file *********************************************************/
343 /*** declarations of public functions ************************************************************/
345 int quick_dialog_skip (quick_dialog_t
* quick_dlg
, int nskip
);
347 /*** inline functions ****************************************************************************/
350 quick_dialog (quick_dialog_t
* quick_dlg
)
352 return quick_dialog_skip (quick_dlg
, 1);
355 #endif /* MC__QUICK_H */