Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / gtx / gtxwindows.h
blob7d0e1df537f41af68754481862c985dc65c68d1b
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
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 */
10 #ifndef __gator_windows_h
11 #define __gator_windows_h 1
13 /*--------------------------------------------------------------------------------
14 * gator_windows.h
16 * Constants and data structures defining the basis for gator windows,
17 * independent of the lower-level graphical environment.
18 *--------------------------------------------------------------------------------*/
21 * Gator window definition.
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 */
35 * window display list item.
37 struct gwin_dlist {
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 */
79 * Size params.
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.
114 struct gwinops {
115 int (*gw_box) (struct gwin *); /* Draw a box around the given window */
116 int (*gw_clear) (struct gwin *); /* Clear out a window */
117 int (*gw_destroy) (struct gwin *); /* Destroy a window */
118 int (*gw_display) (struct gwin *); /* [Re]display a window */
119 int (*gw_drawline) (struct gwin *, struct gwin_lineparams *);
120 /* Draw a line between two points */
121 int (*gw_drawrectangle) (struct gwin *, struct gwin_rectparams *);
122 /* Draw a rectangle at the given loc & dimensions */
123 int (*gw_drawchar) (struct gwin *, struct gwin_charparams *);
124 /* Draw a char at the given location */
125 int (*gw_drawstring) (struct gwin *, struct gwin_strparams *);
126 /* Draw a char string at the given location */
127 int (*gw_invert) (struct gwin *, struct gwin_invparams *);
128 /* Invert region */
129 int (*gw_getchar) (struct gwin *); /* Get a character from a window */
130 int (*gw_getdimensions) (struct gwin *, struct gwin_sizeparams *);
131 /* Get dimensions of a window */
132 int (*gw_wait) (struct gwin *); /* Wait for input */
136 * Macros facilitating the use of the window functions.
138 #define WOP_BOX(WNP) (WNP)->w_op->gw_box(WNP)
139 #define WOP_CLEAR(WNP) (WNP)->w_op->gw_clear(WNP)
140 #define WOP_DESTROY(WNP) (WNP)->w_op->gw_destroy(WNP)
141 #define WOP_DISPLAY(WNP) (WNP)->w_op->gw_display(WNP)
142 #define WOP_DRAWLINE(WNP, params) (WNP)->w_op->gw_drawline(WNP, params)
143 #define WOP_DRAWRECTANGLE(WNP, params) (WNP)->w_op->gw_drawrectangle(WNP, params)
144 #define WOP_DRAWCHAR(WNP, params) (WNP)->w_op->gw_drawchar(WNP, params)
145 #define WOP_DRAWSTRING(WNP, params) (WNP)->w_op->gw_drawstring(WNP, params)
146 #define WOP_INVERT(WNP, params) (WNP)->w_op->gw_invert(WNP, params)
147 #define WOP_GETCHAR(WNP) (WNP)->w_op->gw_getchar(WNP)
148 #define WOP_GETDIMENSIONS(WNP,params) (WNP)->w_op->gw_getdimensions(WNP, params)
149 #define WOP_WAIT(WNP) (WNP)->w_op->gw_wait(WNP)
152 * Base operations on the lower-level window system.
154 struct gwinbaseops {
155 struct gwin *(*gw_createwin) (void *);
156 /*Create a window */
157 int (*gw_cleanup) (struct gwin *); /*Clean up before program exit */
161 * Ptr to the base operation array.
163 extern struct gwinbaseops gwinbops;
166 * Macros facilitating the use of the base window operations.
168 #define WOP_CREATE(p) ((*(gwinbops.gw_createwin))(p))
169 #define WOP_CLEANUP(w) ((*(gwinbops.gw_cleanup))(w))
172 * Pointer to the base window, which is created by the initialization routine.
174 extern struct gwin gator_basegwin;
176 extern int gw_init(struct gwin_initparams *);
178 * Summary:
179 * Initialize the gator window package.
181 * Args:
182 * struct gwin_initparams *params: Ptr to initialization params.
184 * Returns:
185 * 0 on success,
186 * Error value otherwise.
189 /* initialize the whole gator toolkit package */
190 extern struct gwin *gtx_Init(int, int);
192 #endif /* __gator_windows_h */