kernel - swapcache - vm_object_page_remove()
[dragonfly.git] / gnu / lib / libdialog / dialog.h
blobd66fe57da09180a15f79005a8718906553112008
1 #ifndef _DIALOG_H_INCLUDE
2 #define _DIALOG_H_INCLUDE
4 /*
5 * dialog.h -- common declarations for all dialog modules
7 * AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
9 * Substantial rennovation: 12/18/95, Jordan K. Hubbard
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * $FreeBSD: src/gnu/lib/libdialog/dialog.h,v 1.21.6.1 2000/12/15 05:54:36 jkh Exp $
26 * $DragonFly: src/gnu/lib/libdialog/dialog.h,v 1.2 2003/06/17 04:25:43 dillon Exp $
30 #define HAVE_NCURSES
32 #ifdef HAVE_NCURSES
33 #include <ncurses.h>
35 #else
37 #ifdef ultrix
38 #include <cursesX.h>
39 #else
40 #include <curses.h>
41 #endif
43 #endif
45 /* special return codes for `fire' actions */
46 #define DITEM_STATUS(flag) ((flag) & 0x0000FFFF)
47 #define DITEM_SUCCESS 0
48 #define DITEM_FAILURE 1
50 /* Flags - returned in upper 16 bits of return status */
51 #define DITEM_LEAVE_MENU (1 << 16)
52 #define DITEM_REDRAW (1 << 17)
53 #define DITEM_RECREATE (1 << 18)
54 #define DITEM_RESTORE (1 << 19)
55 #define DITEM_CONTINUE (1 << 20)
57 /* Attributes as used by entry fields right now */
58 #define DITEM_NO_ECHO 0x0001
61 /* negative offsets for buttons in item lists, if specified */
62 #define OK_BUTTON -2
63 #define CANCEL_BUTTON -1
65 /* for use in describing more exotic behaviors */
66 typedef struct _dmenu_item {
67 char *prompt;
68 char *title;
69 int (*checked)(struct _dmenu_item *self);
70 int (*fire)(struct _dmenu_item *self);
71 void (*selected)(struct _dmenu_item *self, int is_selected);
72 void *data;
73 char lbra, mark, rbra;
74 long aux;
75 } dialogMenuItem;
77 #define VERSION "0.4"
78 #define MAX_LEN 2048
80 #ifndef TRUE
81 #define TRUE (1)
82 #endif
83 #ifndef FALSE
84 #define FALSE (0)
85 #endif
87 extern int DialogX, DialogY, DialogInputAttrs;
90 * Attribute names
92 #define screen_attr attributes[0]
93 #define shadow_attr attributes[1]
94 #define dialog_attr attributes[2]
95 #define title_attr attributes[3]
96 #define border_attr attributes[4]
97 #define button_active_attr attributes[5]
98 #define button_inactive_attr attributes[6]
99 #define button_key_active_attr attributes[7]
100 #define button_key_inactive_attr attributes[8]
101 #define button_label_active_attr attributes[9]
102 #define button_label_inactive_attr attributes[10]
103 #define inputbox_attr attributes[11]
104 #define inputbox_border_attr attributes[12]
105 #define searchbox_attr attributes[13]
106 #define searchbox_title_attr attributes[14]
107 #define searchbox_border_attr attributes[15]
108 #define position_indicator_attr attributes[16]
109 #define menubox_attr attributes[17]
110 #define menubox_border_attr attributes[18]
111 #define item_attr attributes[19]
112 #define item_selected_attr attributes[20]
113 #define tag_attr attributes[21]
114 #define tag_selected_attr attributes[22]
115 #define tag_key_attr attributes[23]
116 #define tag_key_selected_attr attributes[24]
117 #define check_attr attributes[25]
118 #define check_selected_attr attributes[26]
119 #define uarrow_attr attributes[27]
120 #define darrow_attr attributes[28]
122 /* number of attributes */
123 #define ATTRIBUTE_COUNT 29
125 extern chtype attributes[];
127 #ifdef HAVE_NCURSES
128 extern bool use_shadow;
129 void draw_shadow(WINDOW *win, int y, int x, int height, int width);
130 #endif
131 void draw_box(WINDOW *win, int y, int x, int height, int width, chtype box, chtype border);
132 int line_edit(WINDOW *dialog, int box_y, int box_x, int flen, int box_width, chtype attrs, int first, unsigned char *result, int attr_mask);
133 int strheight(const char *p);
134 int strwidth(const char *p);
136 void dialog_create_rc(unsigned char *filename);
137 int dialog_yesno(unsigned char *title, unsigned char *prompt, int height, int width);
138 int dialog_noyes(unsigned char *title, unsigned char *prompt, int height, int width);
139 int dialog_prgbox(unsigned char *title, const unsigned char *line, int height, int width, int pause, int use_shell);
140 int dialog_msgbox(unsigned char *title, unsigned char *prompt, int height, int width, int pause);
141 int dialog_textbox(unsigned char *title, unsigned char *file, int height, int width);
142 int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int width, int menu_height,
143 int item_no, void *itptr, unsigned char *result, int *ch, int *sc);
144 int dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int width, int list_height,
145 int item_no, void *itptr, unsigned char *result);
146 int dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int width, int list_height,
147 int item_no, void *itptr, unsigned char *result);
148 int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int width, unsigned char *result);
149 void dialog_clear_norefresh(void);
150 void dialog_clear(void);
151 void dialog_update(void);
152 void init_dialog(void);
153 void end_dialog(void);
155 /* Additions to libdialog */
156 char *dialog_fselect(char *dir, char *fmask);
157 int dialog_dselect(char *dir, char *fmask);
158 void dialog_notify(char *msg);
159 int dialog_mesgbox(unsigned char *title, unsigned char *prompt, int height, int width);
160 void use_helpfile(char *helpfile);
161 void use_helpline(char *helpline);
162 char *get_helpline(void);
163 void restore_helpline(char *helpline);
164 void dialog_gauge(char *title, char *prompt, int y, int x, int height, int width, int perc);
167 * Display a tree menu from file
169 * filename - file with like find(1) output
170 * FS - fields separator
171 * title - title of dialog box
172 * prompt - prompt text into dialog box
173 * height - height of dialog box
174 * width - width of dialog box
175 * menu_height - height of menu box
176 * result - pointer to char array
178 * return values:
179 * -1 - ESC pressed
180 * 0 - Ok, result set (must be freed later)
181 * 1 - Cancel
183 int dialog_ftree(unsigned char *filename, unsigned char FS,
184 unsigned char *title, unsigned char *prompt,
185 int height, int width, int menu_height,
186 unsigned char **result);
189 * Display a tree menu from array
191 * names - array with like find(1) output
192 * size - size of array
193 * FS - fields separator
194 * title - title of dialog box
195 * prompt - prompt text into dialog box
196 * height - height of dialog box
197 * width - width of dialog box
198 * menu_height - height of menu box
199 * result - pointer to char array
201 * return values:
202 * -1 - ESC pressed
203 * 0 - Ok, result set
204 * 1 - Cancel
207 int dialog_tree(unsigned char **names, int size, unsigned char FS,
208 unsigned char *title, unsigned char *prompt,
209 int height, int width, int menu_height,
210 unsigned char **result);
212 #endif /* _DIALOG_H_INCLUDE */