2 * \brief Header: quick dialog engine
8 /*** typedefs(not structures) and defined constants **********************************************/
10 #define QUICK_CHECKBOX(txt, st, id_) \
12 .widget_type = quick_checkbox, \
13 .options = WOP_DEFAULT, \
14 .pos_flags = WPOS_KEEP_DEFAULT, \
24 #define QUICK_BUTTON(txt, act, cb, id_) \
26 .widget_type = quick_button, \
27 .options = WOP_DEFAULT, \
28 .pos_flags = WPOS_KEEP_DEFAULT, \
39 #define QUICK_INPUT(txt, hname, res, id_, is_passwd_, strip_passwd_, completion_flags_) \
41 .widget_type = quick_input, \
42 .options = WOP_DEFAULT, \
43 .pos_flags = WPOS_KEEP_DEFAULT, \
48 .label_location = input_label_none, \
51 .completion_flags = completion_flags_, \
52 .is_passwd = is_passwd_, \
53 .strip_passwd = strip_passwd_, \
60 #define QUICK_LABELED_INPUT(label_, label_loc, txt, hname, res, id_, is_passwd_, strip_passwd_, completion_flags_) \
62 .widget_type = quick_input, \
63 .options = WOP_DEFAULT, \
64 .pos_flags = WPOS_KEEP_DEFAULT, \
68 .label_text = label_, \
69 .label_location = label_loc, \
72 .completion_flags = completion_flags_, \
73 .is_passwd = is_passwd_, \
74 .strip_passwd = strip_passwd_, \
81 #define QUICK_LABEL(txt, id_) \
83 .widget_type = quick_label, \
84 .options = WOP_DEFAULT, \
85 .pos_flags = WPOS_KEEP_DEFAULT, \
95 #define QUICK_RADIO(cnt, items_, val, id_) \
97 .widget_type = quick_radio, \
98 .options = WOP_DEFAULT, \
99 .pos_flags = WPOS_KEEP_DEFAULT, \
110 #define QUICK_START_GROUPBOX(t) \
112 .widget_type = quick_start_groupbox, \
113 .options = WOP_DEFAULT, \
114 .pos_flags = WPOS_KEEP_DEFAULT, \
123 #define QUICK_STOP_GROUPBOX \
125 .widget_type = quick_stop_groupbox, \
126 .options = WOP_DEFAULT, \
127 .pos_flags = WPOS_KEEP_DEFAULT, \
138 #define QUICK_SEPARATOR(line_) \
140 .widget_type = quick_separator, \
141 .options = WOP_DEFAULT, \
142 .pos_flags = WPOS_KEEP_DEFAULT, \
152 #define QUICK_START_COLUMNS \
154 .widget_type = quick_start_columns, \
155 .options = WOP_DEFAULT, \
156 .pos_flags = WPOS_KEEP_DEFAULT, \
167 #define QUICK_NEXT_COLUMN \
169 .widget_type = quick_next_column, \
170 .options = WOP_DEFAULT, \
171 .pos_flags = WPOS_KEEP_DEFAULT, \
182 #define QUICK_STOP_COLUMNS \
184 .widget_type = quick_stop_columns, \
185 .options = WOP_DEFAULT, \
186 .pos_flags = WPOS_KEEP_DEFAULT, \
197 #define QUICK_START_BUTTONS(space_, line_) \
199 .widget_type = quick_buttons, \
200 .options = WOP_DEFAULT, \
201 .pos_flags = WPOS_KEEP_DEFAULT, \
211 #define QUICK_BUTTONS_OK_CANCEL \
212 QUICK_START_BUTTONS (TRUE, TRUE), \
213 QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL), \
214 QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL)
218 .widget_type = quick_end, \
219 .options = WOP_DEFAULT, \
220 .pos_flags = WPOS_KEEP_DEFAULT, \
231 /*** enums ***************************************************************************************/
242 quick_start_groupbox
= 6,
243 quick_stop_groupbox
= 7,
245 quick_start_columns
= 9,
246 quick_next_column
= 10,
247 quick_stop_columns
= 11,
253 input_label_none
= 0,
254 input_label_above
= 1,
255 input_label_left
= 2,
256 input_label_right
= 3,
257 input_label_below
= 4
258 } quick_input_label_location_t
;
260 /*** structures declarations (and typedefs of structures)*****************************************/
262 /* The widget is placed on relative_?/divisions_? of the parent widget */
263 typedef struct quick_widget_t quick_widget_t
;
265 struct quick_widget_t
269 widget_options_t options
;
270 widget_state_t state
;
271 widget_pos_flags_t pos_flags
;
274 /* widget parameters */
280 gboolean
*state
; /* in/out */
292 const char *label_text
;
293 quick_input_label_location_t label_location
;
294 quick_widget_t
*label
;
296 input_complete_t completion_flags
;
297 gboolean is_passwd
; /* TRUE -- is password */
298 gboolean strip_passwd
;
299 const char *histname
;
306 quick_widget_t
*input
;
313 int *value
; /* in/out */
331 WRect rect
; /* if rect.x == -1 or rect.y == -1, then dialog is ceneterd;
332 * rect.lines is unused and ignored */
335 quick_widget_t
*widgets
;
336 widget_cb_fn callback
;
337 widget_mouse_cb_fn mouse_callback
;
340 /*** global variables defined in .c file *********************************************************/
342 /*** declarations of public functions ************************************************************/
344 int quick_dialog_skip (quick_dialog_t
* quick_dlg
, int nskip
);
346 /*** inline functions ****************************************************************************/
349 quick_dialog (quick_dialog_t
*quick_dlg
)
351 return quick_dialog_skip (quick_dlg
, 1);
354 #endif /* MC__QUICK_H */