Move binutils from /usr/libexec/gcc2/{aout,elf} to
[dragonfly.git] / gnu / lib / libdialog / dialog.priv.h
1 /*
2  *  dialog.h -- common declarations for all dialog modules
3  *
4  *  AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
5  *
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.
10  *
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.
15  *
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.
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 #include <termios.h>
29
30 #if defined(LOCALE)
31 #include <locale.h>
32 #endif
33
34   
35 /*
36  * Change these if you want
37  */
38 #define USE_SHADOW TRUE
39 #define USE_COLORS TRUE
40
41 #define ESC 27
42 #define TAB 9
43 #define BUF_SIZE (10*1024)
44
45 #ifndef MIN
46 #define MIN(x,y) (x < y ? x : y)
47 #endif
48 #ifndef MAX
49 #define MAX(x,y) (x > y ? x : y)
50 #endif
51
52 #ifndef ctrl
53 #define ctrl(a)          ((a) - 'a' + 1)
54 #endif
55
56 #ifndef HAVE_NCURSES
57 #ifndef ACS_ULCORNER
58 #define ACS_ULCORNER '+'
59 #endif
60 #ifndef ACS_LLCORNER
61 #define ACS_LLCORNER '+'
62 #endif
63 #ifndef ACS_URCORNER
64 #define ACS_URCORNER '+'
65 #endif
66 #ifndef ACS_LRCORNER
67 #define ACS_LRCORNER '+'
68 #endif
69 #ifndef ACS_HLINE
70 #define ACS_HLINE '-'
71 #endif
72 #ifndef ACS_VLINE
73 #define ACS_VLINE '|'
74 #endif
75 #ifndef ACS_LTEE
76 #define ACS_LTEE '+'
77 #endif
78 #ifndef ACS_RTEE
79 #define ACS_RTEE '+'
80 #endif
81 #ifndef ACS_UARROW
82 #define ACS_UARROW '^'
83 #endif
84 #ifndef ACS_DARROW
85 #define ACS_DARROW 'v'
86 #endif
87 #endif    /* HAVE_NCURSES */
88
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 */)
92
93 /*
94  * Global variables
95  */
96 #ifdef __DIALOG_MAIN__
97
98 #ifdef HAVE_NCURSES
99
100 /* use colors by default? */
101 bool use_colors = USE_COLORS;
102
103 /* shadow dialog boxes by default?
104    Note that 'use_shadow' implies 'use_colors' */
105 bool use_shadow = USE_SHADOW;
106
107 #endif
108
109
110 /*
111  * Attribute values, default is for mono display
112  */
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 */
143 };
144
145 #else
146
147 #ifdef HAVE_NCURSES
148 extern bool use_colors;
149 #endif
150
151 #endif    /* __DIALOG_MAIN__ */
152
153
154
155 #ifdef HAVE_NCURSES
156
157 /*
158  * Function prototypes
159  */
160 #ifdef __DIALOG_MAIN__
161
162 extern int parse_rc(void);
163
164 #endif    /* __DIALOG_MAIN__ */
165
166 #endif
167
168
169 #ifdef HAVE_NCURSES
170 void color_setup(void);
171 #endif
172
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);
183