2 * \brief Header: widget based utility functions
8 /*** typedefs(not structures) and defined constants **********************************************/
10 /* Pass this as def_text to request a password */
11 #define INPUT_PASSWORD ((char *) -1)
13 /* Use this as header for message() - it expands to "Error" */
14 #define MSG_ERROR ((char *) -1)
16 typedef struct status_msg_t status_msg_t
;
17 #define STATUS_MSG(x) ((status_msg_t *)(x))
19 typedef struct simple_status_msg_t simple_status_msg_t
;
20 #define SIMPLE_STATUS_MSG(x) ((simple_status_msg_t *)(x))
22 typedef void (*status_msg_cb
) (status_msg_t
* sm
);
23 typedef int (*status_msg_update_cb
) (status_msg_t
* sm
);
25 /*** enums ***************************************************************************************/
27 /* flags for message() and query_dialog() */
33 } /* dialog options */ ;
35 /*** structures declarations (and typedefs of structures)*****************************************/
37 /* Base class for status message of long-time operations.
38 Useful to show progress of long-time operations and interrupt it. */
42 WDialog
*dlg
; /* pointer to status message dialog */
43 gint64 start
; /* start time in microseconds */
44 gint64 delay
; /* delay before raise the 'dlg' in microseconds */
45 gboolean block
; /* how to get event using tty_get_event() */
47 status_msg_cb init
; /* callback to init derived classes */
48 status_msg_update_cb update
; /* callback to update dlg */
49 status_msg_cb deinit
; /* callback to deinit derived classes */
52 /* Simple status message with label and 'Abort' button */
53 struct simple_status_msg_t
55 status_msg_t status_msg
; /* base class */
60 /*** global variables defined in .c file *********************************************************/
62 /*** declarations of public functions ************************************************************/
64 /* The input dialogs */
65 char *input_dialog (const char *header
, const char *text
,
66 const char *history_name
, const char *def_text
,
67 input_complete_t completion_flags
);
68 char *input_dialog_help (const char *header
, const char *text
, const char *help
,
69 const char *history_name
, const char *def_text
, gboolean strip_password
,
70 input_complete_t completion_flags
);
71 char *input_expand_dialog (const char *header
, const char *text
, const char *history_name
,
72 const char *def_text
, input_complete_t completion_flags
);
74 int query_dialog (const char *header
, const char *text
, int flags
, int count
, ...);
75 void query_set_sel (int new_sel
);
77 /* Create message box but don't dismiss it yet, not background safe */
79 WDialog
*create_message (int flags
, const char *title
, const char *text
, ...)
82 /* Show message box, background safe */
83 void message (int flags
, const char *title
, const char *text
, ...) G_GNUC_PRINTF (3, 4);
86 gboolean
mc_error_message (GError
** mcerror
, int *code
);
88 status_msg_t
*status_msg_create (const char *title
, double delay
, status_msg_cb init_cb
,
89 status_msg_update_cb update_cb
, status_msg_cb deinit_cb
);
90 void status_msg_destroy (status_msg_t
* sm
);
91 void status_msg_init (status_msg_t
* sm
, const char *title
, double delay
, status_msg_cb init_cb
,
92 status_msg_update_cb update_cb
, status_msg_cb deinit_cb
);
93 void status_msg_deinit (status_msg_t
* sm
);
94 int status_msg_common_update (status_msg_t
* sm
);
96 void simple_status_msg_init_cb (status_msg_t
* sm
);
98 /*** inline functions ****************************************************************************/
100 #endif /* MC__WTOOLS_H */