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, \
15 .options = WOP_DEFAULT, \
16 .pos_flags = WPOS_KEEP_DEFAULT, \
26 #define QUICK_BUTTON(txt, act, cb, id_) \
28 .widget_type = quick_button, \
29 .options = WOP_DEFAULT, \
30 .pos_flags = WPOS_KEEP_DEFAULT, \
41 #define QUICK_INPUT(txt, hname, res, id_, is_passwd_, strip_passwd_, completion_flags_) \
43 .widget_type = quick_input, \
44 .options = WOP_DEFAULT, \
45 .pos_flags = WPOS_KEEP_DEFAULT, \
50 .label_location = input_label_none, \
53 .completion_flags = completion_flags_, \
54 .is_passwd = is_passwd_, \
55 .strip_passwd = strip_passwd_, \
62 #define QUICK_LABELED_INPUT(label_, label_loc, txt, hname, res, id_, is_passwd_, strip_passwd_, completion_flags_) \
64 .widget_type = quick_input, \
65 .options = WOP_DEFAULT, \
66 .pos_flags = WPOS_KEEP_DEFAULT, \
70 .label_text = label_, \
71 .label_location = label_loc, \
74 .completion_flags = completion_flags_, \
75 .is_passwd = is_passwd_, \
76 .strip_passwd = strip_passwd_, \
83 #define QUICK_LABEL(txt, id_) \
85 .widget_type = quick_label, \
86 .options = WOP_DEFAULT, \
87 .pos_flags = WPOS_KEEP_DEFAULT, \
97 #define QUICK_RADIO(cnt, items_, val, id_) \
99 .widget_type = quick_radio, \
100 .options = WOP_DEFAULT, \
101 .pos_flags = WPOS_KEEP_DEFAULT, \
112 #define QUICK_START_GROUPBOX(t) \
114 .widget_type = quick_start_groupbox, \
115 .options = WOP_DEFAULT, \
116 .pos_flags = WPOS_KEEP_DEFAULT, \
125 #define QUICK_STOP_GROUPBOX \
127 .widget_type = quick_stop_groupbox, \
128 .options = WOP_DEFAULT, \
129 .pos_flags = WPOS_KEEP_DEFAULT, \
140 #define QUICK_SEPARATOR(line_) \
142 .widget_type = quick_separator, \
143 .options = WOP_DEFAULT, \
144 .pos_flags = WPOS_KEEP_DEFAULT, \
154 #define QUICK_START_COLUMNS \
156 .widget_type = quick_start_columns, \
157 .options = WOP_DEFAULT, \
158 .pos_flags = WPOS_KEEP_DEFAULT, \
169 #define QUICK_NEXT_COLUMN \
171 .widget_type = quick_next_column, \
172 .options = WOP_DEFAULT, \
173 .pos_flags = WPOS_KEEP_DEFAULT, \
184 #define QUICK_STOP_COLUMNS \
186 .widget_type = quick_stop_columns, \
187 .options = WOP_DEFAULT, \
188 .pos_flags = WPOS_KEEP_DEFAULT, \
199 #define QUICK_START_BUTTONS(space_, line_) \
201 .widget_type = quick_buttons, \
202 .options = WOP_DEFAULT, \
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, \
221 .options = WOP_DEFAULT, \
222 .pos_flags = WPOS_KEEP_DEFAULT, \
233 /*** enums ***************************************************************************************/
244 quick_start_groupbox
= 6,
245 quick_stop_groupbox
= 7,
247 quick_start_columns
= 9,
248 quick_next_column
= 10,
249 quick_stop_columns
= 11,
255 input_label_none
= 0,
256 input_label_above
= 1,
257 input_label_left
= 2,
258 input_label_right
= 3,
259 input_label_below
= 4
260 } quick_input_label_location_t
;
262 /*** structures declarations (and typedefs of structures)*****************************************/
264 /* The widget is placed on relative_?/divisions_? of the parent widget */
265 typedef struct quick_widget_t quick_widget_t
;
267 struct quick_widget_t
271 widget_options_t options
;
272 widget_state_t state
;
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 input_complete_t completion_flags
;
299 gboolean is_passwd
; /* TRUE -- is password */
300 gboolean strip_passwd
;
301 const char *histname
;
308 quick_widget_t
*input
;
315 int *value
; /* in/out */
333 int y
, x
; /* if -1, then center the dialog */
334 int cols
; /* heigth is calculated automatically */
337 quick_widget_t
*widgets
;
338 widget_cb_fn callback
;
339 widget_mouse_cb_fn mouse_callback
;
342 /*** global variables defined in .c file *********************************************************/
344 /*** declarations of public functions ************************************************************/
346 int quick_dialog_skip (quick_dialog_t
* quick_dlg
, int nskip
);
348 /*** inline functions ****************************************************************************/
351 quick_dialog (quick_dialog_t
* quick_dlg
)
353 return quick_dialog_skip (quick_dlg
, 1);
356 #endif /* MC__QUICK_H */