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>
36 * Change these if you want
38 #define USE_SHADOW TRUE
39 #define USE_COLORS TRUE
43 #define BUF_SIZE (10*1024)
46 #define MIN(x,y) (x < y ? x : y)
49 #define MAX(x,y) (x > y ? x : y)
53 #define ctrl(a) ((a) - 'a' + 1)
58 #define ACS_ULCORNER '+'
61 #define ACS_LLCORNER '+'
64 #define ACS_URCORNER '+'
67 #define ACS_LRCORNER '+'
82 #define ACS_UARROW '^'
85 #define ACS_DARROW 'v'
87 #endif /* HAVE_NCURSES */
89 /* Travel key conventions */
90 #define KEY_IS_UP(key) ((key) == KEY_UP || (key) == '-' || key == '\020' /* ^P */)
91 #define KEY_IS_DOWN(key) ((key) == KEY_DOWN || (key) == '+' || key == '\016' /* ^N */)
96 #ifdef __DIALOG_MAIN__
100 /* use colors by default? */
101 bool use_colors
= USE_COLORS
;
103 /* shadow dialog boxes by default?
104 Note that 'use_shadow' implies 'use_colors' */
105 bool use_shadow
= USE_SHADOW
;
111 * Attribute values, default is for mono display
113 chtype attributes
[] = {
114 A_NORMAL
, /* screen_attr */
115 A_NORMAL
, /* shadow_attr */
116 A_REVERSE
, /* dialog_attr */
117 A_REVERSE
, /* title_attr */
118 A_REVERSE
, /* border_attr */
119 A_BOLD
, /* button_active_attr */
120 A_DIM
, /* button_inactive_attr */
121 A_UNDERLINE
, /* button_key_active_attr */
122 A_UNDERLINE
, /* button_key_inactive_attr */
123 A_NORMAL
, /* button_label_active_attr */
124 A_NORMAL
, /* button_label_inactive_attr */
125 A_REVERSE
, /* inputbox_attr */
126 A_REVERSE
, /* inputbox_border_attr */
127 A_REVERSE
, /* searchbox_attr */
128 A_REVERSE
, /* searchbox_title_attr */
129 A_REVERSE
, /* searchbox_border_attr */
130 A_REVERSE
, /* position_indicator_attr */
131 A_REVERSE
, /* menubox_attr */
132 A_REVERSE
, /* menubox_border_attr */
133 A_REVERSE
, /* item_attr */
134 A_NORMAL
, /* item_selected_attr */
135 A_REVERSE
, /* tag_attr */
136 A_REVERSE
, /* tag_selected_attr */
137 A_NORMAL
, /* tag_key_attr */
138 A_BOLD
, /* tag_key_selected_attr */
139 A_REVERSE
, /* check_attr */
140 A_REVERSE
, /* check_selected_attr */
141 A_REVERSE
, /* uarrow_attr */
142 A_REVERSE
/* darrow_attr */
148 extern bool use_colors
;
151 #endif /* __DIALOG_MAIN__ */
158 * Function prototypes
160 #ifdef __DIALOG_MAIN__
162 extern int parse_rc(void);
164 #endif /* __DIALOG_MAIN__ */
170 void color_setup(void);
173 void attr_clear(WINDOW
*win
, int height
, int width
, chtype attr
);
174 void print_autowrap(WINDOW
*win
, unsigned char *prompt
, int height
, int width
, int maxwidth
,
175 int y
, int x
, int center
, int rawmode
);
176 void print_button(WINDOW
*win
, unsigned char *label
, int y
, int x
, int selected
);
177 FILE *raw_popen(const char *program
, char * const *argv
, const char *type
);
178 int raw_pclose(FILE *iop
);
179 void display_helpfile(void);
180 void display_helpline(WINDOW
*w
, int y
, int width
);
181 void print_arrows(WINDOW
*dialog
, int scroll
, int menu_height
, int item_no
, int box_x
,
182 int box_y
, int tag_x
, int cur_x
, int cur_y
);