IntrinsicP.h revision fdf6a26f
1/***********************************************************
2
3Copyright 1987, 1988, 1994, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25
26Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28                        All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
45
46******************************************************************/
47
48#ifndef _XtintrinsicP_h
49#define _XtintrinsicP_h
50
51#include <X11/Intrinsic.h>
52
53/*
54 * Field sizes and offsets of XrmResource must match those of XtResource.
55 * Type long is used instead of XrmQuark here because XrmQuark and String
56 * are not the same size on all systems.
57 */
58typedef struct {
59    XtIntPtr	xrm_name;	  /* Resource name quark		*/
60    XtIntPtr	xrm_class;	  /* Resource class quark		*/
61    XtIntPtr	xrm_type;	  /* Resource representation type quark */
62    Cardinal	xrm_size;	  /* Size in bytes of representation	*/
63    int		xrm_offset;	  /* -offset-1				*/
64    XtIntPtr	xrm_default_type; /* Default representation type quark	*/
65    XtPointer	xrm_default_addr; /* Default resource address		*/
66} XrmResource, *XrmResourceList;
67#if __STDC_VERSION__ >= 201112L
68_Static_assert(XtOffsetOf(XrmResource, xrm_default_addr) ==
69                   XtOffsetOf(XtResource, default_addr),
70               "Field offset mismatch");
71#endif
72
73typedef unsigned long XtVersionType;
74
75#define XT_VERSION 11
76#ifndef XT_REVISION
77#define XT_REVISION 6
78#endif
79#define XtVersion (XT_VERSION * 1000 + XT_REVISION)
80#define XtVersionDontCheck 0
81
82typedef void (*XtProc)(
83    void
84);
85
86typedef void (*XtWidgetClassProc)(
87    WidgetClass /* class */
88);
89
90typedef void (*XtWidgetProc)(
91    Widget	/* widget */
92);
93
94typedef Boolean (*XtAcceptFocusProc)(
95    Widget	/* widget */,
96    Time*	/* time */
97);
98
99typedef void (*XtArgsProc)(
100    Widget	/* widget */,
101    ArgList	/* args */,
102    Cardinal*	/* num_args */
103);
104
105typedef void (*XtInitProc)(
106    Widget	/* request */,
107    Widget	/* new */,
108    ArgList	/* args */,
109    Cardinal*	/* num_args */
110);
111
112typedef Boolean (*XtSetValuesFunc)(
113    Widget 	/* old */,
114    Widget 	/* request */,
115    Widget 	/* new */,
116    ArgList 	/* args */,
117    Cardinal*	/* num_args */
118);
119
120typedef Boolean (*XtArgsFunc)(
121    Widget	/* widget */,
122    ArgList	/* args */,
123    Cardinal*	/* num_args */
124);
125
126typedef void (*XtAlmostProc)(
127    Widget		/* old */,
128    Widget		/* new */,
129    XtWidgetGeometry*	/* request */,
130    XtWidgetGeometry*	/* reply */
131);
132
133typedef void (*XtExposeProc)(
134    Widget	/* widget */,
135    XEvent*	/* event */,
136    Region	/* region */
137);
138
139/* compress_exposure options*/
140#define XtExposeNoCompress		((XtEnum)False)
141#define XtExposeCompressSeries		((XtEnum)True)
142#define XtExposeCompressMultiple	2
143#define XtExposeCompressMaximal		3
144
145/* modifiers */
146#define XtExposeGraphicsExpose	  	0x10
147#define XtExposeGraphicsExposeMerged	0x20
148#define XtExposeNoExpose	  	0x40
149#define XtExposeNoRegion		0x80
150
151typedef void (*XtRealizeProc)(
152    Widget 		  /* widget */,
153    XtValueMask* 	  /* mask */,
154    XSetWindowAttributes* /* attributes */
155);
156
157typedef XtGeometryResult (*XtGeometryHandler)(
158    Widget		/* widget */,
159    XtWidgetGeometry*	/* request */,
160    XtWidgetGeometry*	/* reply */
161);
162
163typedef void (*XtStringProc)(
164    Widget	/* widget */,
165    String	/* str */
166);
167
168typedef struct {
169    String	name;	/* resource name */
170    String	type;	/* representation type name */
171    XtArgVal	value;	/* representation */
172    int		size;	/* size of representation */
173} XtTypedArg, *XtTypedArgList;
174
175typedef void (*XtAllocateProc)(
176    WidgetClass		/* widget_class */,
177    Cardinal *		/* constraint_size */,
178    Cardinal *		/* more_bytes */,
179    ArgList		/* args */,
180    Cardinal *		/* num_args */,
181    XtTypedArgList	/* typed_args */,
182    Cardinal *		/* num_typed_args */,
183    Widget *		/* widget_return */,
184    XtPointer *		/* more_bytes_return */
185);
186
187typedef void (*XtDeallocateProc)(
188    Widget		/* widget */,
189    XtPointer		/* more_bytes */
190);
191
192struct _XtStateRec;	/* Forward declare before use for C++ */
193
194typedef struct _XtTMRec {
195    XtTranslations  translations;	/* private to Translation Manager    */
196    XtBoundActions  proc_table;		/* procedure bindings for actions    */
197    struct _XtStateRec *current_state;  /* Translation Manager state ptr     */
198    unsigned long   lastEventTime;
199} XtTMRec, *XtTM;
200
201#include <X11/CoreP.h>
202#include <X11/CompositeP.h>
203#include <X11/ConstrainP.h>
204#include <X11/ObjectP.h>
205#include <X11/RectObjP.h>
206
207#define XtDisplay(widget)	DisplayOfScreen((widget)->core.screen)
208#define XtScreen(widget)	((widget)->core.screen)
209#define XtWindow(widget)	((widget)->core.window)
210
211#define XtClass(widget)		((widget)->core.widget_class)
212#define XtSuperclass(widget)	(XtClass(widget)->core_class.superclass)
213#define XtIsRealized(object)	(XtWindowOfObject(object) != None)
214#define XtParent(widget)	((widget)->core.parent)
215
216#undef XtIsRectObj
217extern Boolean XtIsRectObj(Widget);
218#define XtIsRectObj(obj) \
219    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x02)
220
221#undef XtIsWidget
222extern Boolean XtIsWidget(Widget);
223#define XtIsWidget(obj) \
224    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x04)
225
226#undef XtIsComposite
227extern Boolean XtIsComposite(Widget);
228#define XtIsComposite(obj) \
229    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x08)
230
231#undef XtIsConstraint
232extern Boolean XtIsConstraint(Widget);
233#define XtIsConstraint(obj) \
234    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x10)
235
236#undef XtIsShell
237extern Boolean XtIsShell(Widget);
238#define XtIsShell(obj) \
239    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x20)
240
241#undef XtIsWMShell
242extern Boolean XtIsWMShell(Widget);
243#define XtIsWMShell(obj) \
244    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x40)
245
246#undef XtIsTopLevelShell
247extern Boolean XtIsTopLevelShell(Widget);
248#define XtIsTopLevelShell(obj) \
249    (((Object)(obj))->object.widget_class->core_class.class_inited & 0x80)
250
251#ifdef DEBUG
252#define XtCheckSubclass(w, widget_class_ptr, message)	\
253	if (!XtIsSubclass(((Widget)(w)), (widget_class_ptr))) {	\
254	    String dbgArgV[3];				\
255	    Cardinal dbgArgC = 3;			\
256	    dbgArgV[0] = ((Widget)(w))->core.widget_class->core_class.class_name;\
257	    dbgArgV[1] = (widget_class_ptr)->core_class.class_name;	     \
258	    dbgArgV[2] = (message);					     \
259	    XtAppErrorMsg(XtWidgetToApplicationContext((Widget)(w)),	     \
260		    "subclassMismatch", "xtCheckSubclass", "XtToolkitError", \
261		    "Widget class %s found when subclass of %s expected: %s",\
262		    dbgArgV, &dbgArgC);			\
263	}
264#else
265#define XtCheckSubclass(w, widget_class, message)	/* nothing */
266#endif
267
268_XFUNCPROTOBEGIN
269
270extern Widget _XtWindowedAncestor( /* internal; implementation-dependent */
271    Widget 		/* object */
272);
273
274#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(LIBXT_COMPILATION)
275__declspec(dllimport)
276#else
277extern
278#endif
279void _XtInherit(
280    void
281);
282
283extern void _XtHandleFocus(
284    Widget		/* widget */,
285    XtPointer		/* client_data */,
286    XEvent *		/* event */,
287    Boolean *		/* cont */);
288
289extern void XtCreateWindow(
290    Widget 		/* widget */,
291    unsigned int 	/* window_class */,
292    Visual*		/* visual */,
293    XtValueMask		/* value_mask */,
294    XSetWindowAttributes* /* attributes */
295);
296
297extern void XtResizeWidget(
298    Widget 		/* widget */,
299    _XtDimension	/* width */,
300    _XtDimension	/* height */,
301    _XtDimension	/* border_width */
302);
303
304extern void XtMoveWidget(
305    Widget 		/* widget */,
306    _XtPosition		/* x */,
307    _XtPosition		/* y */
308);
309
310extern void XtConfigureWidget(
311    Widget 		/* widget */,
312    _XtPosition		/* x */,
313    _XtPosition		/* y */,
314    _XtDimension	/* width */,
315    _XtDimension	/* height */,
316    _XtDimension	/* border_width */
317);
318
319extern void XtResizeWindow(
320    Widget 		/* widget */
321);
322
323extern void XtProcessLock(
324    void
325);
326
327extern void XtProcessUnlock(
328    void
329);
330
331_XFUNCPROTOEND
332
333#endif /* _XtIntrinsicP_h */
334/* DON'T ADD STUFF AFTER THIS #endif */
335