1
2
3
4
5
6
7
8
9 #ifndef MC__DIALOG_H
10 #define MC__DIALOG_H
11
12 #include <sys/types.h>
13
14 #include "lib/global.h"
15 #include "lib/hook.h"
16 #include "lib/keybind.h"
17
18
19
20 #define DIALOG(x) ((WDialog *)(x))
21 #define CONST_DIALOG(x) ((const WDialog *)(x))
22
23
24
25 #define B_EXIT 0
26 #define B_CANCEL 1
27 #define B_ENTER 2
28 #define B_HELP 3
29 #define B_USER 100
30
31
32
33
34 typedef enum
35 {
36 DLG_COLOR_NORMAL,
37 DLG_COLOR_FOCUS,
38 DLG_COLOR_HOT_NORMAL,
39 DLG_COLOR_HOT_FOCUS,
40 DLG_COLOR_TITLE,
41 DLG_COLOR_COUNT
42 } dlg_colors_enum_t;
43
44
45
46 typedef struct WDialog WDialog;
47
48
49
50 typedef char *(*dlg_shortcut_str) (long command);
51
52
53 typedef char *(*dlg_title_str) (const WDialog * h, size_t len);
54
55 typedef int dlg_colors_t[DLG_COLOR_COUNT];
56
57
58
59 struct WDialog
60 {
61 WGroup group;
62
63
64 gboolean compact;
65 const char *help_ctx;
66 const int *colors;
67
68
69 int ret_value;
70
71
72 void *data;
73 char *event_group;
74 Widget *bg;
75
76 dlg_shortcut_str get_shortcut;
77 dlg_title_str get_title;
78 };
79
80
81
82
83 extern dlg_colors_t dialog_colors;
84 extern dlg_colors_t alarm_colors;
85 extern dlg_colors_t listbox_colors;
86
87 extern GList *top_dlg;
88
89
90 extern hook_t *idle_hook;
91
92 extern gboolean fast_refresh;
93 extern gboolean mouse_close_dialog;
94
95 extern const global_keymap_t *dialog_map;
96
97
98
99
100 WDialog *dlg_create (gboolean modal, int y1, int x1, int lines, int cols,
101 widget_pos_flags_t pos_flags, gboolean compact,
102 const int *colors, widget_cb_fn callback, widget_mouse_cb_fn mouse_callback,
103 const char *help_ctx, const char *title);
104
105 void dlg_set_default_colors (void);
106
107 void dlg_init (WDialog * h);
108 int dlg_run (WDialog * d);
109
110 void dlg_run_done (WDialog * h);
111 void dlg_save_history (WDialog * h);
112 void dlg_process_event (WDialog * h, int key, Gpm_Event * event);
113
114 char *dlg_get_title (const WDialog * h, size_t len);
115
116
117 cb_ret_t dlg_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data);
118 void dlg_default_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event);
119
120 void dlg_stop (WDialog * h);
121
122
123 void do_refresh (void);
124
125
126
127
128
129 #endif