2 * dialog.h -- common declarations for all dialog modules
4 * AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <sys/types.h>
35 * Change these if you want
37 #define USE_SHADOW TRUE
38 #define USE_COLORS TRUE
42 #define BUF_SIZE (10*1024)
45 #define MIN(x,y) (x < y ? x : y)
48 #define MAX(x,y) (x > y ? x : y)
52 #define ctrl(a) ((a) - 'a' + 1)
57 #define ACS_ULCORNER '+'
60 #define ACS_LLCORNER '+'
63 #define ACS_URCORNER '+'
66 #define ACS_LRCORNER '+'
81 #define ACS_UARROW '^'
84 #define ACS_DARROW 'v'
86 #endif /* HAVE_NCURSES */
88 /* Travel key conventions */
89 #define KEY_IS_UP(key) ((key) == KEY_UP || (key) == '-' || key == '\020' /* ^P */)
90 #define KEY_IS_DOWN(key) ((key) == KEY_DOWN || (key) == '+' || key == '\016' /* ^N */)
95 #ifdef __DIALOG_MAIN__
99 /* use colors by default? */
100 bool use_colors = USE_COLORS;
102 /* shadow dialog boxes by default?
103 Note that 'use_shadow' implies 'use_colors' */
104 bool use_shadow = USE_SHADOW;
110 * Attribute values, default is for mono display
112 chtype attributes[] = {
113 A_NORMAL, /* screen_attr */
114 A_NORMAL, /* shadow_attr */
115 A_REVERSE, /* dialog_attr */
116 A_REVERSE, /* title_attr */
117 A_REVERSE, /* border_attr */
118 A_BOLD, /* button_active_attr */
119 A_DIM, /* button_inactive_attr */
120 A_UNDERLINE, /* button_key_active_attr */
121 A_UNDERLINE, /* button_key_inactive_attr */
122 A_NORMAL, /* button_label_active_attr */
123 A_NORMAL, /* button_label_inactive_attr */
124 A_REVERSE, /* inputbox_attr */
125 A_REVERSE, /* inputbox_border_attr */
126 A_REVERSE, /* searchbox_attr */
127 A_REVERSE, /* searchbox_title_attr */
128 A_REVERSE, /* searchbox_border_attr */
129 A_REVERSE, /* position_indicator_attr */
130 A_REVERSE, /* menubox_attr */
131 A_REVERSE, /* menubox_border_attr */
132 A_REVERSE, /* item_attr */
133 A_NORMAL, /* item_selected_attr */
134 A_REVERSE, /* tag_attr */
135 A_REVERSE, /* tag_selected_attr */
136 A_NORMAL, /* tag_key_attr */
137 A_BOLD, /* tag_key_selected_attr */
138 A_REVERSE, /* check_attr */
139 A_REVERSE, /* check_selected_attr */
140 A_REVERSE, /* uarrow_attr */
141 A_REVERSE /* darrow_attr */
147 extern bool use_colors;
150 #endif /* __DIALOG_MAIN__ */
157 * Function prototypes
159 #ifdef __DIALOG_MAIN__
161 extern int parse_rc(void);
163 #endif /* __DIALOG_MAIN__ */
169 void color_setup(void);
172 void attr_clear(WINDOW *win, int height, int width, chtype attr);
173 void print_autowrap(WINDOW *win, unsigned char *prompt, int height, int width, int maxwidth,
174 int y, int x, int center, int rawmode);
175 void print_button(WINDOW *win, unsigned char *label, int y, int x, int selected);
176 FILE *raw_popen(const char *program, char * const *argv, const char *type);
177 int raw_pclose(FILE *iop);
178 void display_helpfile(void);
179 void display_helpline(WINDOW *w, int y, int width);
180 void print_arrows(WINDOW *dialog, int scroll, int menu_height, int item_no, int box_x,
181 int box_y, int tag_x, int cur_x, int cur_y);