19b6e11fd4223e82f0f22f91d4997ae4798f092d
[openafs.git] / src / gtx / gtxcurseswin.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef __gator_curseswindows_h
11 #define __gator_curseswindows_h  1
12
13 #include "gtxwindows.h"         /*Base gator window dfns */
14 #if defined(AFS_HPUX110_ENV) && !defined(__HP_CURSES)
15 #define __HP_CURSES
16 #endif
17 #ifdef AFS_LINUX20_ENV
18 #include <ncurses.h>            /*Curses library */
19 #else
20 #include <curses.h>             /*Curses library */
21 #endif
22
23 /*Value for gwin w_type field*/
24 #define GATOR_WIN_CURSES    2
25
26 /*Private data for a curses gwin*/
27 struct gator_cursesgwin {
28     WINDOW *wp;                 /*Window pointer */
29     int charwidth;              /*Character width in pixels */
30     int charheight;             /*Character height in pixels */
31     char box_vertchar;          /*Vertical char for boxing purposes */
32     char box_horizchar;         /*Horizontal char for boxing purposes */
33 };
34
35 /*Curses gwin's creation parameters*/
36 struct gator_cursesgwin_params {
37     struct gwin_createparams gwin_params;       /*Basic params for the window */
38     int charwidth;              /*Character width in pixels */
39     int charheight;             /*Character height in pixels */
40     char box_vertchar;          /*Vertical char for boxing purposes */
41     char box_horizchar;         /*Horizontal char for boxing purposes */
42 };
43
44 /*Curses initialization routine*/
45
46 extern int gator_cursesgwin_init(int adebug);
47     /*
48      * Summary:
49      *    Initialize the curses window package.
50      *
51      * Args:
52      *    int adebug: Is debugging turned on?
53      *
54      * Returns:
55      *    0 on success,
56      *    Error value otherwise.
57      */
58
59 /*Curses window's creation routine*/
60
61 extern struct gwin *gator_cursesgwin_create(struct gator_cursesgwin_params *);
62     /*
63      * Summary:
64      *    Create a curses window.
65      *
66      * Args:
67      *    struct gator_cursesgwin_params *params : Ptr to creation parameters.
68      *
69      * Returns:
70      *    Ptr to the created curses window structure if successful,
71      *    Error value otherwise.
72      */
73
74 /*Curses cleanup routine*/
75
76 extern int gator_cursesgwin_cleanup(struct gwin *);
77     /*
78      * Summary:
79      *    Clean up after the curses window package.
80      *
81      * Args:
82      *    struct gwin *gwp : Ptr to base window.
83      *
84      * Returns:
85      *    0 on success,
86      *    Error value otherwise.
87      */
88
89 extern struct gwinbaseops gator_curses_gwinbops;
90
91 /*Curses window's routines*/
92
93 extern int gator_cursesgwin_box(struct gwin *);
94     /*
95      * Summary:
96      *    Draw a box around the given curses window.
97      *
98      * Args:
99      *   struct gwin *gwp : Ptr to the curses window to draw
100      *                              a box around.
101      *
102      * Returns:
103      *    0: Success.
104      *    Error value otherwise.
105      */
106
107 extern int gator_cursesgwin_clear(struct gwin *);
108     /*
109      * Summary:
110      *    Clear out the given curses window.
111      *
112      * Args:
113      *   struct gwin *gwp : Ptr to the curses window to clear
114      *                              out.
115      *
116      * Returns:
117      *    0: Success.
118      *    Error value otherwise.
119      */
120
121 extern int gator_cursesgwin_destroy(struct gwin *);
122     /*
123      * Summary:
124      *    Destroy the given curses window.
125      *
126      * Args:
127      *   struct gwin *gwp : Ptr to the curses window to destroy.
128      *
129      * Returns:
130      *    0: Success.
131      *    Error value otherwise.
132      */
133
134 extern int gator_cursesgwin_display(struct gwin *);
135     /*
136      * Summary:
137      *    Display/redraw the given curses window.
138      *
139      * Args:
140      *   struct gwin *gwp : Ptr to the curses window to draw.
141      *
142      * Returns:
143      *    0: Success.
144      *    Error value otherwise.
145      */
146
147 extern int gator_cursesgwin_drawline(struct gwin *, struct gwin_lineparams *);
148     /*
149      * Summary:
150      *    Draw a line between two points in the given curses
151      *    window.
152      *
153      * Args:
154      *   struct gwin *gwp : Ptr to the curses window in which
155      *                              the line is to be drawn.
156      *   struct gwin_lineparams *params : Ptr to other params.
157      *
158      * Returns:
159      *    0: Success.
160      *    Error value otherwise.
161      */
162
163 extern int gator_cursesgwin_drawrectangle(struct gwin *, 
164                                           struct gwin_rectparams *);
165     /*
166      * Summary:
167      *    Draw a rectangle in the given curses window.
168      *
169      * Args:
170      *   struct gwin *gwp : Ptr to the curses window in which
171      *                              the rectangle is to be drawn.
172      *   struct gwin_rectparams *params : Ptr to other params.
173      *
174      * Returns:
175      *    0: Success.
176      *    Error value otherwise.
177      */
178
179 extern int gator_cursesgwin_drawchar(struct gwin *, struct gwin_charparams *);
180     /*
181      * Summary:
182      *    Draw a character in the given curses window.
183      *
184      * Args:
185      *   struct gwin *gwp : Ptr to the curses window in which
186      *                              the character is to be drawn.
187      *   struct gwin_charparams *params : Ptr to other params.
188      *
189      * Returns:
190      *    0: Success.
191      *    Error value otherwise.
192      */
193
194 extern int gator_cursesgwin_drawstring(struct gwin *, struct gwin_strparams *);
195     /*
196      * Summary:
197      *    Draw a string in the given curses window.
198      *
199      * Args:
200      *   struct gwin *gwp : Ptr to the curses window in which
201      *                              the string is to be drawn.
202      *   struct gwin_strparams *params : Ptr to other params.
203      *
204      * Returns:
205      *    0: Success.
206      *    Error value otherwise.
207      */
208
209 extern int gator_cursesgwin_invert(struct gwin *, struct gwin_invparams *);
210     /*
211      * Summary:
212      *    Invert a region in the given curses window.
213      *
214      * Args:
215      *   struct gwin *gwp : Ptr to the curses window in which
216      *                              the inverted region lies.
217      *   struct gwin_invparams *params : Ptr to other params.
218      *
219      * Returns:
220      *    0: Success.
221      *    Error value otherwise.
222      */
223
224 extern int gator_cursesgwin_getchar(struct gwin *);
225
226 extern int gator_cursesgwin_getdimensions(struct gwin *,
227                                           struct gwin_sizeparams *aparms);
228
229 extern int gator_cursesgwin_wait(struct gwin *);
230
231 #endif /* __gator_curseswindows_h */