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