1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include <sys/types.h>
23 #include <fcntl.h>
24 #include <unistd.h>
25 #include <ctype.h>
26 #include <stdlib.h>
27 #include <string.h>
28
29 #include CURSES_LOC
30
31 #define ESC 27
32 #define TAB 9
33 #define MAX_LEN 2048
34 #define BUF_SIZE (10*1024)
35 #define MIN(x,y) (x < y ? x : y)
36 #define MAX(x,y) (x > y ? x : y)
37
38
39 #ifndef ACS_ULCORNER
40 #define ACS_ULCORNER '+'
41 #endif
42 #ifndef ACS_LLCORNER
43 #define ACS_LLCORNER '+'
44 #endif
45 #ifndef ACS_URCORNER
46 #define ACS_URCORNER '+'
47 #endif
48 #ifndef ACS_LRCORNER
49 #define ACS_LRCORNER '+'
50 #endif
51 #ifndef ACS_HLINE
52 #define ACS_HLINE '-'
53 #endif
54 #ifndef ACS_VLINE
55 #define ACS_VLINE '|'
56 #endif
57 #ifndef ACS_LTEE
58 #define ACS_LTEE '+'
59 #endif
60 #ifndef ACS_RTEE
61 #define ACS_RTEE '+'
62 #endif
63 #ifndef ACS_UARROW
64 #define ACS_UARROW '^'
65 #endif
66 #ifndef ACS_DARROW
67 #define ACS_DARROW 'v'
68 #endif
69
70
71
72
73 #define screen_attr attributes[0]
74 #define shadow_attr attributes[1]
75 #define dialog_attr attributes[2]
76 #define title_attr attributes[3]
77 #define border_attr attributes[4]
78 #define button_active_attr attributes[5]
79 #define button_inactive_attr attributes[6]
80 #define button_key_active_attr attributes[7]
81 #define button_key_inactive_attr attributes[8]
82 #define button_label_active_attr attributes[9]
83 #define button_label_inactive_attr attributes[10]
84 #define inputbox_attr attributes[11]
85 #define inputbox_border_attr attributes[12]
86 #define searchbox_attr attributes[13]
87 #define searchbox_title_attr attributes[14]
88 #define searchbox_border_attr attributes[15]
89 #define position_indicator_attr attributes[16]
90 #define menubox_attr attributes[17]
91 #define menubox_border_attr attributes[18]
92 #define item_attr attributes[19]
93 #define item_selected_attr attributes[20]
94 #define tag_attr attributes[21]
95 #define tag_selected_attr attributes[22]
96 #define tag_key_attr attributes[23]
97 #define tag_key_selected_attr attributes[24]
98 #define check_attr attributes[25]
99 #define check_selected_attr attributes[26]
100 #define uarrow_attr attributes[27]
101 #define darrow_attr attributes[28]
102
103
104 #define ATTRIBUTE_COUNT 29
105
106
107
108
109 extern bool use_colors;
110 extern bool use_shadow;
111
112 extern chtype attributes[];
113
114 extern const char *backtitle;
115
116
117
118
119 extern void create_rc (const char *filename);
120 extern int parse_rc (void);
121
122
123 void init_dialog (void);
124 void end_dialog (void);
125 void attr_clear (WINDOW * win, int height, int width, chtype attr);
126 void dialog_clear (void);
127 void color_setup (void);
128 void print_autowrap (WINDOW * win, const char *prompt, int width, int y, int x);
129 void print_button (WINDOW * win, const char *label, int y, int x, int selected);
130 void draw_box (WINDOW * win, int y, int x, int height, int width, chtype box,
131 chtype border);
132 void draw_shadow (WINDOW * win, int y, int x, int height, int width);
133
134 int first_alpha (const char *string);
135 int dialog_yesno (const char *title, const char *prompt, int height, int width);
136 int dialog_msgbox (const char *title, const char *prompt, int height,
137 int width, int pause);
138 int dialog_textbox (const char *title, const char *file, int height, int width);
139 int dialog_menu (const char *title, const char *prompt, int height, int width,
140 int menu_height, const char *choice, int item_no,
141 const char * const * items);
142 int dialog_checklist (const char *title, const char *prompt, int height,
143 int width, int list_height, int item_no,
144 const char * const * items, int flag);
145 extern unsigned char dialog_input_result[];
146 int dialog_inputbox (const char *title, const char *prompt, int height,
147 int width, const char *init);
148 int dialog_guage (const char *title, const char *prompt, int height, int width,
149 int percent);
150
151
152
153
154
155
156
157
158
159
160 #define M_EVENT (KEY_MAX+1)
161
162
163
164
165
166
167 #define FLAG_CHECK 1
168 #define FLAG_RADIO 0