Debian Codegraph @

src/Private.h

raw
1 /*
2 * Copyright (c) 1998 by The XFree86 Project, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 *
22 * Except as contained in this notice, the name of the XFree86 Project shall
23 * not be used in advertising or otherwise to promote the sale, use or other
24 * dealings in this Software without prior written authorization from the
25 * XFree86 Project.
26 */
27
28 #ifndef _XawPrivate_h
29 #define _XawPrivate_h
30
31 #define XawMax(a, b) ((a) > (b) ? (a) : (b))
32 #define XawMin(a, b) ((a) < (b) ? (a) : (b))
33 #define XawAbs(a) ((a) < 0 ? -(a) : (a))
34
35 #define XawStackAlloc(size, stk_buffer) \
36 ((size) <= sizeof(stk_buffer) \
37 ? (XtPointer)(stk_buffer) \
38 : XtMalloc((Cardinal)(size)))
39
40 #define XawStackFree(pointer, stk_buffer) \
41 do { \
42 if ((pointer) != (XtPointer)(stk_buffer)) \
43 XtFree((char *)pointer); \
44 } while (0)
45
46 #ifndef XtX
47 #define XtX(w) (((RectObj)w)->rectangle.x)
48 #endif
49 #ifndef XtY
50 #define XtY(w) (((RectObj)w)->rectangle.y)
51 #endif
52 #ifndef XtWidth
53 #define XtWidth(w) (((RectObj)w)->rectangle.width)
54 #endif
55 #ifndef XtHeight
56 #define XtHeight(w) (((RectObj)w)->rectangle.height)
57 #endif
58 #ifndef XtBorderWidth
59 #define XtBorderWidth(w) (((RectObj)w)->rectangle.border_width)
60 #endif
61
62 #ifndef OLDXAW
63 #define XAW_PRIV_VAR_PREFIX '$'
64
65 typedef Bool (*XawParseBooleanProc)(Widget, String, XEvent*, Bool*);
66
67 typedef struct _XawActionVarList XawActionVarList;
68 typedef struct _XawActionResList XawActionResList;
69
70 /* Boolean expressions */
71 Bool XawParseBoolean(Widget, String, XEvent*, Bool*);
72 Bool XawBooleanExpression(Widget, String, XEvent*);
73
74 /* actions */
75 void XawPrintActionErrorMsg(String, Widget, String*, Cardinal*);
76 XawActionResList *XawGetActionResList(WidgetClass);
77 XawActionVarList *XawGetActionVarList(Widget);
78
79 void XawSetValuesAction(Widget, XEvent*, String*, Cardinal*);
80 void XawGetValuesAction(Widget, XEvent*, String*, Cardinal*);
81 void XawDeclareAction(Widget, XEvent*, String*, Cardinal*);
82 void XawCallProcAction(Widget, XEvent*, String*, Cardinal*);
83
84 /* display lists */
85 #define XAWDL_CONVERT_ERROR (XtPointer)-1
86 typedef struct _XawDL _XawDisplayList;
87 typedef struct _XawDLClass XawDLClass, XawDisplayListClass;
88
89 typedef void (*XawDisplayListProc)(Widget, XtPointer, XtPointer,
90 XEvent*, Region);
91 typedef void *(*XawDLArgsInitProc)(String, String*, Cardinal*,
92 Screen*, Colormap, int);
93 typedef void *(*XawDLDataInitProc)(String,
94 Screen*, Colormap, int);
95 typedef void (*XawDLArgsDestructor)(Display*, String, XtPointer,
96 String*, Cardinal*);
97 typedef void (*XawDLDataDestructor)(Display*, String, XtPointer);
98
99 void XawRunDisplayList(Widget, _XawDisplayList*, XEvent*, Region);
100 void XawDisplayListInitialize(void);
101
102 _XawDisplayList *XawCreateDisplayList(String, Screen*, Colormap, int);
103 void XawDestroyDisplayList(_XawDisplayList*);
104 String XawDisplayListString(_XawDisplayList*);
105 XawDLClass *XawGetDisplayListClass(String);
106 XawDLClass *XawCreateDisplayListClass(String,
107 XawDLArgsInitProc, XawDLArgsDestructor,
108 XawDLDataInitProc, XawDLDataDestructor);
109 Bool XawDeclareDisplayListProc(XawDLClass*, String, XawDisplayListProc);
110
111 /* pixmaps */
112 typedef struct _XawArgVal {
113 String name;
114 String value;
115 } XawArgVal;
116
117 typedef struct _XawParams {
118 String name;
119 String type;
120 String ext;
121 XawArgVal **args;
122 Cardinal num_args;
123 } XawParams;
124
125 typedef struct _XawPixmap {
126 String name;
127 Pixmap pixmap;
128 Pixmap mask;
129 Dimension width;
130 Dimension height;
131 } XawPixmap;
132
133 typedef Bool (*XawPixmapLoader)(XawParams*, Screen*, Colormap, int,
134 Pixmap*, Pixmap*,
135 Dimension*, Dimension*);
136 Bool XawPixmapsInitialize(void);
137 Bool XawAddPixmapLoader(String, String, XawPixmapLoader);
138 XawPixmap *XawLoadPixmap(String, Screen*, Colormap, int);
139 XawPixmap *XawPixmapFromXPixmap(Pixmap, Screen*, Colormap, int);
140 XawParams *XawParseParamsString(String name);
141 void XawFreeParamsStruct(XawParams *params);
142 XawArgVal *XawFindArgVal(XawParams *params, String name);
143 void XawReshapeWidget(Widget, XawPixmap*);
144 #endif /* OLDXAW */
145
146 /* misc */
147 void XawTypeToStringWarning(Display*, String);
148
149 /* OS.c */
150 int _XawGetPageSize(void);
151
152 #endif /* _XawPrivate_h */