2 * Copyright 2000, International Business Machines Corporation and others.
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
10 #ifndef __gator_windows_h
11 #define __gator_windows_h 1
13 /*--------------------------------------------------------------------------------
16 * Constants and data structures defining the basis for gator windows,
17 * independent of the lower-level graphical environment.
18 *--------------------------------------------------------------------------------*/
21 * Gator window definition.
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 */
35 * window display list item.
38 struct gwin_dlist *next; /* "car" */
39 struct onode *data; /* "cdr" */
43 * Initialization parameters for the gator window package.
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? */
53 * Creation parameters for gator windows.
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 */
63 * Line-drawing parameters.
65 struct gwin_lineparams {
66 int x1, y1; /*X, Y coordinates of first point */
67 int x2, y2; /*X, Y coordinates of second point */
71 * Rectangle-drawing parameters.
73 struct gwin_rectparams {
74 int x, y; /*X, Y coordinates of rectangle's origin */
75 int width, height; /*Rectangle width & height */
81 struct gwin_sizeparams {
82 int maxx, maxy; /* x,y size */
86 * Char-drawing parameters.
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? */
95 * String-drawing parameters.
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 */
104 * Inversion parameters.
106 struct gwin_invparams {
107 int x, y; /*X, Y coordinates of origin */
108 int width, height; /*Width & height of rectangle to invert */
112 * Operations on gator windows.
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 */
130 * Macros facilitating the use of the window functions.
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)
146 * Base operations on the lower-level window system.
149 struct gwin *(*gw_createwin) (); /*Create a window */
150 int (*gw_cleanup) (); /*Clean up before program exit */
154 * Ptr to the base operation array.
156 extern struct gwinbaseops gwinbops;
159 * Macros facilitating the use of the base window operations.
161 #define WOP_CREATE(p) ((*(gwinbops.gw_createwin))(p))
162 #define WOP_CLEANUP(w) ((*(gwinbops.gw_cleanup))(w))
165 * Pointer to the base window, which is created by the initialization routine.
167 extern struct gwin gator_basegwin;
169 extern int gw_init();
172 * Initialize the gator window package.
175 * struct gwin_initparams *params: Ptr to initialization params.
179 * Error value otherwise.
182 /* initialize the whole gator toolkit package */
183 extern struct gwin *gtx_Init();
185 #endif /* __gator_windows_h */