Standardize License information
[openafs.git] / src / gtx / gtxwindows.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_windows_h
11 #define __gator_windows_h  1
12
13 /*--------------------------------------------------------------------------------
14  * gator_windows.h
15  *
16  * Constants and data structures defining the basis for gator windows,
17  * independent of the lower-level graphical environment.
18  *--------------------------------------------------------------------------------*/
19
20 /*
21  * Gator window definition.
22  */
23 struct gwin {
24     int w_type;                 /*Type of window*/
25     int w_x, w_y;               /*X and Y coordinates*/
26     int w_width, w_height;      /*Width & height in pixels*/
27     int w_changed;              /*Does the window need to be refreshed?*/
28     struct gwinops *w_op;       /*Ptr to the operations defined on the window*/
29     struct gwin *w_parent;      /*Parent window, if any*/
30     struct gtx_frame *w_frame;  /*Frame information */
31     int *w_data;                /*Ptr to info describing the window*/
32 };
33
34 /*
35  * window display list item.
36  */
37 struct gwin_dlist {
38     struct gwin_dlist *next;    /* "car" */
39     struct onode *data;         /* "cdr" */
40 };
41
42 /*
43  * Initialization parameters for the gator window package.
44  */
45 struct gwin_initparams {
46     int i_type;                 /*Type of lower-level graphics package used*/
47     int i_x, i_y;               /*X, Y coordinates of the screen area*/
48     int i_width, i_height;      /*Width, height of the screen area*/
49     int i_debug;                /*Should debugging be turned on?*/
50 };
51
52 /*
53  * Creation parameters for gator windows.
54  */
55 struct gwin_createparams {
56     int cr_type;                /*Type of window*/
57     int cr_x, cr_y;             /*X and Y coordinates*/
58     int cr_width, cr_height;    /*Width & height in pixels*/
59     struct gwin *cr_parentwin;  /*Ptr to parent window structure*/
60 };
61
62 /*
63  * Line-drawing parameters.
64  */
65 struct gwin_lineparams {
66     int x1, y1;     /*X, Y coordinates of first point*/
67     int x2, y2;     /*X, Y coordinates of second point*/
68 };
69
70 /*
71  * Rectangle-drawing parameters.
72  */
73 struct gwin_rectparams {
74     int x, y;           /*X, Y coordinates of rectangle's origin*/
75     int width, height;  /*Rectangle width & height*/
76 };
77
78 /*
79  * Size params.
80  */
81 struct gwin_sizeparams {
82     int maxx, maxy;     /* x,y size */
83 };
84
85 /*
86  * Char-drawing parameters.
87  */
88 struct gwin_charparams {
89     int x, y;           /*X, Y coordinates of char origin*/
90     char c;             /*Char to draw*/
91     int highlight;      /*Print in highlight/standout mode?*/
92 };
93
94 /*
95  * String-drawing parameters.
96  */
97 struct gwin_strparams {
98     int x, y;           /*X, Y coordinates of string*/
99     int highlight;      /*Print in highlight/standout mode?*/
100     char *s;            /*String to draw*/
101 };
102
103 /*
104  * Inversion parameters.
105  */
106 struct gwin_invparams {
107     int x, y;           /*X, Y coordinates of origin*/
108     int width, height;  /*Width & height of rectangle to invert*/
109 };
110
111 /*
112  * Operations on gator windows.
113  */
114 struct gwinops {
115     int (*gw_box)();            /* Draw a box around the given window*/
116     int (*gw_clear)();          /* Clear out a window*/
117     int (*gw_destroy)();        /* Destroy a window*/
118     int (*gw_display)();        /* [Re]display a window*/
119     int (*gw_drawline)();       /* Draw a line between two points*/
120     int (*gw_drawrectangle)();  /* Draw a rectangle at the given loc & dimensions*/
121     int (*gw_drawchar)();       /* Draw a char at the given location*/
122     int (*gw_drawstring)();     /* Draw a char string at the given location*/
123     int (*gw_invert)();         /* Invert region*/
124     int (*gw_getchar)();        /* Get a character from a window */
125     int (*gw_getdimensions)();  /* Get dimensions of a window */
126     int (*gw_wait)();           /* Wait for input */
127 };
128
129 /*
130  * Macros facilitating the use of the window functions.
131  */
132 #define WOP_BOX(WNP)                    (WNP)->w_op->gw_box(WNP)
133 #define WOP_CLEAR(WNP)                  (WNP)->w_op->gw_clear(WNP)
134 #define WOP_DESTROY(WNP)                (WNP)->w_op->gw_destroy(WNP)
135 #define WOP_DISPLAY(WNP)                (WNP)->w_op->gw_display(WNP)
136 #define WOP_DRAWLINE(WNP, params)       (WNP)->w_op->gw_drawline(WNP, params)
137 #define WOP_DRAWRECTANGLE(WNP, params)  (WNP)->w_op->gw_drawrectangle(WNP, params)
138 #define WOP_DRAWCHAR(WNP, params)       (WNP)->w_op->gw_drawchar(WNP, params)
139 #define WOP_DRAWSTRING(WNP, params)     (WNP)->w_op->gw_drawstring(WNP, params)
140 #define WOP_INVERT(WNP, params)         (WNP)->w_op->gw_invert(WNP, params)
141 #define WOP_GETCHAR(WNP)                (WNP)->w_op->gw_getchar(WNP)
142 #define WOP_GETDIMENSIONS(WNP,params)   (WNP)->w_op->gw_getdimensions(WNP, params)
143 #define WOP_WAIT(WNP)                   (WNP)->w_op->gw_wait(WNP)
144
145 /*
146  * Base operations on the lower-level window system.
147  */
148 struct gwinbaseops {
149     struct gwin *(*gw_createwin)(); /*Create a window*/
150     int (*gw_cleanup)();            /*Clean up before program exit*/
151 };
152
153 /*
154  * Ptr to the base operation array.
155  */
156 extern struct gwinbaseops gwinbops;
157
158 /*
159  * Macros facilitating the use of the base window operations.
160  */
161 #define WOP_CREATE(p)   ((*(gwinbops.gw_createwin))(p))
162 #define WOP_CLEANUP(w)  ((*(gwinbops.gw_cleanup))(w))
163
164 /*
165  * Pointer to the base window, which is created by the initialization routine.
166  */
167 extern struct gwin gator_basegwin;
168
169 extern int gw_init();
170     /*
171      * Summary:
172      *    Initialize the gator window package.
173      *
174      * Args:
175      *    struct gwin_initparams *params: Ptr to initialization params.
176      *
177      * Returns:
178      *    0 on success,
179      *    Error value otherwise.
180      */
181
182 /* initialize the whole gator toolkit package */
183 extern struct gwin *gtx_Init();
184
185 #endif /* __gator_windows_h */