3 * \brief Header: widget based utility functions
15 struct WListbox
*list
;
18 /* Listbox utility functions */
19 Listbox
*create_listbox_window_delta (int delta_x
, int delta_y
, int cols
, int lines
, const char *title
, const char *help
);
21 Listbox
*create_listbox_window (int cols
, int lines
, 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, \
89 .u.checkbox.text = txt, \
90 .u.checkbox.state = st \
93 #define QUICK_BUTTON(x, xdiv, y, ydiv, txt, act, cb) \
95 .widget_type = quick_button, \
97 .x_divisions = xdiv, \
99 .y_divisions = ydiv, \
101 .u.button.text = txt, \
102 .u.button.action = act, \
103 .u.button.callback = cb \
106 #define QUICK_INPUT(x, xdiv, y, ydiv, txt, len_, flags_, hname, res) \
108 .widget_type = quick_input, \
110 .x_divisions = xdiv, \
112 .y_divisions = ydiv, \
114 .u.input.text = txt, \
115 .u.input.len = len_, \
116 .u.input.flags = flags_, \
117 .u.input.histname = hname, \
118 .u.input.result = res \
121 #define QUICK_LABEL(x, xdiv, y, ydiv, txt) \
123 .widget_type = quick_label, \
125 .x_divisions = xdiv, \
127 .y_divisions = ydiv, \
129 .u.label.text = txt \
132 #define QUICK_RADIO(x, xdiv, y, ydiv, cnt, items_, val) \
134 .widget_type = quick_radio, \
136 .x_divisions = xdiv, \
138 .y_divisions = ydiv, \
140 .u.radio.count = cnt, \
141 .u.radio.items = items_, \
142 .u.radio.value = val, \
147 .widget_type = quick_end, \
153 .u.input.text = NULL, \
155 .u.input.flags = 0, \
156 .u.input.histname = NULL, \
157 .u.input.result = NULL \
162 int xpos
, ypos
; /* if -1, then center the dialog */
165 QuickWidget
*widgets
;
166 gboolean i18n
; /* If true, internationalization has happened */
169 int quick_dialog (QuickDialog
*qd
);
170 int quick_dialog_skip (QuickDialog
*qd
, int nskip
);
172 /* The input dialogs */
174 /* Pass this as def_text to request a password */
175 #define INPUT_PASSWORD ((char *) -1)
177 char *input_dialog (const char *header
, const char *text
,
178 const char *history_name
, const char *def_text
);
179 char *input_dialog_help (const char *header
, const char *text
, const char *help
,
180 const char *history_name
, const char *def_text
);
181 char *input_expand_dialog (const char *header
, const char *text
,
182 const char *history_name
, const char *def_text
);
184 void query_set_sel (int new_sel
);
186 /* Create message box but don't dismiss it yet, not background safe */
187 struct Dlg_head
*create_message (int flags
, const char *title
,
188 const char *text
, ...)
189 __attribute__ ((format (__printf__
, 3, 4)));
191 /* Show message box, background safe */
192 void message (int flags
, const char *title
, const char *text
, ...)
193 __attribute__ ((format (__printf__
, 3, 4)));
196 /* Use this as header for message() - it expands to "Error" */
197 #define MSG_ERROR ((char *) -1)
199 int query_dialog (const char *header
, const char *text
, int flags
, int count
, ...);
201 /* flags for message() and query_dialog() */
205 } /* dialog options */;