1 /*
2  * Copyright (c)2004 Cat's Eye Technologies.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  *   Redistributions of source code must retain the above copyright
9  *   notice, this list of conditions and the following disclaimer.
10  *
11  *   Redistributions in binary form must reproduce the above copyright
12  *   notice, this list of conditions and the following disclaimer in
13  *   the documentation and/or other materials provided with the
14  *   distribution.
15  *
16  *   Neither the name of Cat's Eye Technologies nor the names of its
17  *   contributors may be used to endorse or promote products derived
18  *   from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31  * OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /*
35  * curses_util.h
36  * $Id: curses_util.h,v 1.5 2005/02/08 07:49:03 cpressey Exp $
37  */
38 
39 #ifndef __CURSES_UTIL_H
40 #define __CURSES_UTIL_H
41 
42 #include <ncurses.h>
43 #include <panel.h>
44 
45 extern unsigned int ymax, xmax;		/* Size of the user's terminal. */
46 extern int monochrome;
47 
48 #define	CURSES_COLORS_NORMAL	0	/* usual text inside forms */
49 #define	CURSES_COLORS_BACKDROP	1	/* backdrop behind all forms */
50 #define	CURSES_COLORS_MENUBAR	2	/* line at top of screen */
51 #define	CURSES_COLORS_STATUSBAR	3	/* line at bottom of screen */
52 #define	CURSES_COLORS_BORDER	4	/* border of forms */
53 #define	CURSES_COLORS_FORMTITLE	5	/* title of forms */
54 #define	CURSES_COLORS_LABEL	6	/* labels of controls */
55 #define	CURSES_COLORS_CONTROL	7	/* ambient parts of a control */
56 #define	CURSES_COLORS_TEXT	8	/* text in a control */
57 #define	CURSES_COLORS_FOCUS	9	/* control, when it has focus */
58 #define	CURSES_COLORS_SCROLLAREA 10	/* background of scrollbar */
59 #define	CURSES_COLORS_SCROLLBAR	11	/* foreground of scrollbar */
60 #define	CURSES_COLORS_ACCEL	12	/* shortcut keys in labels */
61 #define	CURSES_COLORS_ACCELFOCUS 13	/* shortcut keys, with focus */
62 
63 #define	CURSES_COLORS_MAX	14
64 
65 #define	COLOR_GREY		COLOR_WHITE
66 #define	COLOR_BROWN		COLOR_YELLOW
67 
68 void			 curses_colors_init(int);
69 void			 curses_colors_set(WINDOW *, int);
70 
71 void			 curses_window_blank(WINDOW *);
72 void			 curses_frame_draw(int, int, int, int);
73 void			 curses_load_backdrop(WINDOW *, const char *);
74 
75 void			 curses_debug_str(const char *);
76 void			 curses_debug_int(int);
77 void			 curses_debug_key(int);
78 void			 curses_debug_float(float);
79 
80 int			 extract_wrapped_line(const char *, char *, int, int *);
81 
82 #endif /* !__CURSES_UTIL_H */
83