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
);
37 /* The widget is placed on relative_?/divisions_? of the parent widget */
48 /* widget parameters */
52 int *state
; /* in/out */
64 int flags
; /* 1 -- is_password, 2 -- INPUT_COMPLETE_CD */
76 int *value
; /* in/out */
81 #define QUICK_CHECKBOX(x, xdiv, y, ydiv, txt, st) \
83 .widget_type = quick_checkbox, \
85 .x_divisions = xdiv, \
87 .y_divisions = ydiv, \
97 #define QUICK_BUTTON(x, xdiv, y, ydiv, txt, act, cb) \
99 .widget_type = quick_button, \
101 .x_divisions = xdiv, \
103 .y_divisions = ydiv, \
114 #define QUICK_INPUT(x, xdiv, y, ydiv, txt, len_, flags_, hname, res) \
116 .widget_type = quick_input, \
118 .x_divisions = xdiv, \
120 .y_divisions = ydiv, \
133 #define QUICK_LABEL(x, xdiv, y, ydiv, txt) \
135 .widget_type = quick_label, \
137 .x_divisions = xdiv, \
139 .y_divisions = ydiv, \
148 #define QUICK_RADIO(x, xdiv, y, ydiv, cnt, items_, val) \
150 .widget_type = quick_radio, \
152 .x_divisions = xdiv, \
154 .y_divisions = ydiv, \
167 .widget_type = quick_end, \
186 int xpos
, ypos
; /* if -1, then center the dialog */
189 QuickWidget
*widgets
;
190 gboolean i18n
; /* If true, internationalization has happened */
193 int quick_dialog (QuickDialog
*qd
);
194 int quick_dialog_skip (QuickDialog
*qd
, int nskip
);
196 /* The input dialogs */
198 /* Pass this as def_text to request a password */
199 #define INPUT_PASSWORD ((char *) -1)
201 char *input_dialog (const char *header
, const char *text
,
202 const char *history_name
, const char *def_text
);
203 char *input_dialog_help (const char *header
, const char *text
, const char *help
,
204 const char *history_name
, const char *def_text
);
205 char *input_expand_dialog (const char *header
, const char *text
,
206 const char *history_name
, const char *def_text
);
208 void query_set_sel (int new_sel
);
210 /* Create message box but don't dismiss it yet, not background safe */
211 struct Dlg_head
*create_message (int flags
, const char *title
,
212 const char *text
, ...)
213 __attribute__ ((format (__printf__
, 3, 4)));
215 /* Show message box, background safe */
216 void message (int flags
, const char *title
, const char *text
, ...)
217 __attribute__ ((format (__printf__
, 3, 4)));
220 /* Use this as header for message() - it expands to "Error" */
221 #define MSG_ERROR ((char *) -1)
223 int query_dialog (const char *header
, const char *text
, int flags
, int count
, ...);
225 /* flags for message() and query_dialog() */
229 } /* dialog options */;