1444c061aSmrg/***********************************************************
2444c061aSmrg
3444c061aSmrgCopyright 1987, 1988, 1998  The Open Group
4444c061aSmrg
5444c061aSmrgPermission to use, copy, modify, distribute, and sell this software and its
6444c061aSmrgdocumentation for any purpose is hereby granted without fee, provided that
7444c061aSmrgthe above copyright notice appear in all copies and that both that
8444c061aSmrgcopyright notice and this permission notice appear in supporting
9444c061aSmrgdocumentation.
10444c061aSmrg
11444c061aSmrgThe above copyright notice and this permission notice shall be included in
12444c061aSmrgall copies or substantial portions of the Software.
13444c061aSmrg
14444c061aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15444c061aSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16444c061aSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17444c061aSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18444c061aSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19444c061aSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20444c061aSmrg
21444c061aSmrgExcept as contained in this notice, the name of The Open Group shall not be
22444c061aSmrgused in advertising or otherwise to promote the sale, use or other dealings
23444c061aSmrgin this Software without prior written authorization from The Open Group.
24444c061aSmrg
25444c061aSmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
26444c061aSmrg
27444c061aSmrg                        All Rights Reserved
28444c061aSmrg
29444c061aSmrgPermission to use, copy, modify, and distribute this software and its
30444c061aSmrgdocumentation for any purpose and without fee is hereby granted,
31444c061aSmrgprovided that the above copyright notice appear in all copies and that
32444c061aSmrgboth that copyright notice and this permission notice appear in
33444c061aSmrgsupporting documentation, and that the name of Digital not be
34444c061aSmrgused in advertising or publicity pertaining to distribution of the
35444c061aSmrgsoftware without specific, written prior permission.
36444c061aSmrg
37444c061aSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38444c061aSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39444c061aSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40444c061aSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41444c061aSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42444c061aSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43444c061aSmrgSOFTWARE.
44444c061aSmrg
45444c061aSmrg******************************************************************/
46444c061aSmrg
47444c061aSmrg#ifdef HAVE_CONFIG_H
48444c061aSmrg#include <config.h>
49444c061aSmrg#endif
50444c061aSmrg#include "IntrinsicI.h"
51444c061aSmrg#include "StringDefs.h"
52444c061aSmrg#include "CreateI.h"
53444c061aSmrg
54444c061aSmrg/******************************************************************
55444c061aSmrg *
56444c061aSmrg * Rectangle Object Resources
57444c061aSmrg *
58444c061aSmrg ******************************************************************/
59444c061aSmrg
60444c061aSmrgstatic void XtCopyAncestorSensitive(Widget, int, XrmValue *);
61444c061aSmrg
62a3bd7f05Smrg/* *INDENT-OFF* */
63444c061aSmrgstatic XtResource resources[] = {
64444c061aSmrg
65444c061aSmrg    {XtNancestorSensitive, XtCSensitive, XtRBoolean, sizeof(Boolean),
66444c061aSmrg      XtOffsetOf(RectObjRec,rectangle.ancestor_sensitive),XtRCallProc,
67444c061aSmrg      (XtPointer)XtCopyAncestorSensitive},
68444c061aSmrg    {XtNx, XtCPosition, XtRPosition, sizeof(Position),
69444c061aSmrg         XtOffsetOf(RectObjRec,rectangle.x), XtRImmediate, (XtPointer)0},
70444c061aSmrg    {XtNy, XtCPosition, XtRPosition, sizeof(Position),
71444c061aSmrg         XtOffsetOf(RectObjRec,rectangle.y), XtRImmediate, (XtPointer)0},
72444c061aSmrg    {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension),
73444c061aSmrg         XtOffsetOf(RectObjRec,rectangle.width), XtRImmediate, (XtPointer)0},
74444c061aSmrg    {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension),
75444c061aSmrg         XtOffsetOf(RectObjRec,rectangle.height), XtRImmediate, (XtPointer)0},
76444c061aSmrg    {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
77444c061aSmrg         XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
78a3bd7f05Smrg         (XtPointer)1},
79444c061aSmrg    {XtNsensitive, XtCSensitive, XtRBoolean, sizeof(Boolean),
80444c061aSmrg         XtOffsetOf(RectObjRec,rectangle.sensitive), XtRImmediate,
81a3bd7f05Smrg         (XtPointer)True}
82a3bd7f05Smrg};
83a3bd7f05Smrg/* *INDENT-ON* */
84444c061aSmrg
85444c061aSmrgstatic void RectClassPartInitialize(WidgetClass);
86a3bd7f05Smrgstatic void RectSetValuesAlmost(Widget, Widget, XtWidgetGeometry *,
87a3bd7f05Smrg                                XtWidgetGeometry *);
88444c061aSmrg
89a3bd7f05Smrg/* *INDENT-OFF* */
90444c061aSmrgexternaldef(rectobjclassrec) RectObjClassRec rectObjClassRec = {
91444c061aSmrg  {
92a3bd7f05Smrg    /* superclass            */ (WidgetClass)&objectClassRec,
93a3bd7f05Smrg    /* class_name            */ "Rect",
94a3bd7f05Smrg    /* widget_size           */ sizeof(RectObjRec),
95a3bd7f05Smrg    /* class_initialize      */ NULL,
96a3bd7f05Smrg    /* class_part_initialize */ RectClassPartInitialize,
97a3bd7f05Smrg    /* class_inited          */ FALSE,
98a3bd7f05Smrg    /* initialize            */ NULL,
99a3bd7f05Smrg    /* initialize_hook       */ NULL,
100a3bd7f05Smrg    /* realize               */ NULL,
101a3bd7f05Smrg    /* actions               */ NULL,
102a3bd7f05Smrg    /* num_actions           */ 0,
103a3bd7f05Smrg    /* resources             */ resources,
104a3bd7f05Smrg    /* num_resources         */ XtNumber(resources),
105a3bd7f05Smrg    /* xrm_class             */ NULLQUARK,
106a3bd7f05Smrg    /* compress_motion       */ FALSE,
107a3bd7f05Smrg    /* compress_exposure     */ TRUE,
108a3bd7f05Smrg    /* compress_enterleave   */ FALSE,
109a3bd7f05Smrg    /* visible_interest      */ FALSE,
110a3bd7f05Smrg    /* destroy               */ NULL,
111a3bd7f05Smrg    /* resize                */ NULL,
112a3bd7f05Smrg    /* expose                */ NULL,
113a3bd7f05Smrg    /* set_values            */ NULL,
114a3bd7f05Smrg    /* set_values_hook       */ NULL,
115a3bd7f05Smrg    /* set_values_almost     */ RectSetValuesAlmost,
116a3bd7f05Smrg    /* get_values_hook       */ NULL,
117a3bd7f05Smrg    /* accept_focus          */ NULL,
118a3bd7f05Smrg    /* version               */ XtVersion,
119a3bd7f05Smrg    /* callback_offsets      */ NULL,
120a3bd7f05Smrg    /* tm_table              */ NULL,
121a3bd7f05Smrg    /* query_geometry        */ NULL,
122a3bd7f05Smrg    /* display_accelerator   */ NULL,
123a3bd7f05Smrg    /* extension             */ NULL
124444c061aSmrg  }
125444c061aSmrg};
126a3bd7f05Smrg/* *INDENT-ON* */
127444c061aSmrg
128444c061aSmrgexternaldef(rectObjClass)
129a3bd7f05SmrgWidgetClass rectObjClass = (WidgetClass) &rectObjClassRec;
130444c061aSmrg
131a3bd7f05Smrgstatic void
132a3bd7f05SmrgXtCopyAncestorSensitive(Widget widget, int offset _X_UNUSED, XrmValue *value)
133444c061aSmrg{
134a3bd7f05Smrg    static Boolean sensitive;
135444c061aSmrg    Widget parent = widget->core.parent;
136444c061aSmrg
137444c061aSmrg    sensitive = (parent->core.ancestor_sensitive & parent->core.sensitive);
138a3bd7f05Smrg    value->addr = (XPointer) (&sensitive);
139444c061aSmrg}
140444c061aSmrg
141444c061aSmrg/*
142444c061aSmrg * Start of rectangle object methods
143444c061aSmrg */
144444c061aSmrg
145a3bd7f05Smrgstatic void
146a3bd7f05SmrgRectClassPartInitialize(register WidgetClass wc)
147444c061aSmrg{
148a3bd7f05Smrg    register RectObjClass roc = (RectObjClass) wc;
149a3bd7f05Smrg    register RectObjClass super = ((RectObjClass) roc->rect_class.superclass);
150444c061aSmrg
151444c061aSmrg    /* We don't need to check for null super since we'll get to object
152444c061aSmrg       eventually, and it had better define them!  */
153444c061aSmrg
154444c061aSmrg    if (roc->rect_class.resize == XtInheritResize) {
155a3bd7f05Smrg        roc->rect_class.resize = super->rect_class.resize;
156444c061aSmrg    }
157444c061aSmrg
158444c061aSmrg    if (roc->rect_class.expose == XtInheritExpose) {
159a3bd7f05Smrg        roc->rect_class.expose = super->rect_class.expose;
160444c061aSmrg    }
161444c061aSmrg
162444c061aSmrg    if (roc->rect_class.set_values_almost == XtInheritSetValuesAlmost) {
163a3bd7f05Smrg        roc->rect_class.set_values_almost = super->rect_class.set_values_almost;
164444c061aSmrg    }
165444c061aSmrg
166444c061aSmrg    if (roc->rect_class.query_geometry == XtInheritQueryGeometry) {
167a3bd7f05Smrg        roc->rect_class.query_geometry = super->rect_class.query_geometry;
168444c061aSmrg    }
169444c061aSmrg}
170444c061aSmrg
171444c061aSmrg/*
172444c061aSmrg * Why there isn't an Initialize Method:
173444c061aSmrg *
174444c061aSmrg * Initialization of the RectObj non-Resource field is done by the
175444c061aSmrg * intrinsics in _XtCreateWidget in order that the field is initialized
176444c061aSmrg * for use by converters during instance resource resolution.
177444c061aSmrg */
178444c061aSmrg
179a3bd7f05Smrgstatic void
180a3bd7f05SmrgRectSetValuesAlmost(Widget old _X_UNUSED,
181a3bd7f05Smrg                    Widget new _X_UNUSED,
182a3bd7f05Smrg                    XtWidgetGeometry *request,
183a3bd7f05Smrg                    XtWidgetGeometry *reply)
184444c061aSmrg{
185444c061aSmrg    *request = *reply;
186444c061aSmrg}
187