1
2
3
4
5 #ifndef MC__WTOOLS_H
6 #define MC__WTOOLS_H
7
8
9
10
11 #define INPUT_PASSWORD ((char *) -1)
12
13
14 #define MSG_ERROR ((char *) -1)
15
16 typedef struct status_msg_t status_msg_t;
17 #define STATUS_MSG(x) ((status_msg_t *) (x))
18
19 typedef struct simple_status_msg_t simple_status_msg_t;
20 #define SIMPLE_STATUS_MSG(x) ((simple_status_msg_t *) (x))
21
22 typedef void (*status_msg_cb) (status_msg_t *sm);
23 typedef int (*status_msg_update_cb) (status_msg_t *sm);
24
25
26
27
28 enum
29 {
30 D_NORMAL = 0,
31 D_ERROR = (1 << 0),
32 D_CENTER = (1 << 1)
33 };
34
35
36
37
38
39
40 struct status_msg_t
41 {
42 WDialog *dlg;
43 gint64 start;
44 gint64 delay;
45 gboolean block;
46
47 status_msg_cb init;
48 status_msg_update_cb update;
49 status_msg_cb deinit;
50 };
51
52
53 struct simple_status_msg_t
54 {
55 status_msg_t status_msg;
56
57 WLabel *label;
58 };
59
60
61
62
63
64
65 char *input_dialog (const char *header, const char *text, const char *history_name,
66 const char *def_text, input_complete_t completion_flags);
67 char *input_dialog_help (const char *header, const char *text, const char *help,
68 const char *history_name, const char *def_text, gboolean strip_password,
69 input_complete_t completion_flags);
70 char *input_expand_dialog (const char *header, const char *text, const char *history_name,
71 const char *def_text, input_complete_t completion_flags);
72
73 int query_dialog (const char *header, const char *text, int flags, int count, ...);
74 void query_set_sel (int new_sel);
75
76
77 WDialog *create_message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4);
78
79
80 MC_MOCKABLE void message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4);
81
82 gboolean mc_error_message (GError **mcerror, int *code);
83
84 status_msg_t *status_msg_create (const char *title, double delay, status_msg_cb init_cb,
85 status_msg_update_cb update_cb, status_msg_cb deinit_cb);
86 void status_msg_destroy (status_msg_t *sm);
87 void status_msg_init (status_msg_t *sm, const char *title, double delay, status_msg_cb init_cb,
88 status_msg_update_cb update_cb, status_msg_cb deinit_cb);
89 void status_msg_deinit (status_msg_t *sm);
90 int status_msg_common_update (status_msg_t *sm);
91
92 void simple_status_msg_init_cb (status_msg_t *sm);
93
94
95
96 #endif