1/*********************************************************** 2 3Copyright 1987, 1988, 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 25Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 26 27 All Rights Reserved 28 29Permission to use, copy, modify, and distribute this software and its 30documentation for any purpose and without fee is hereby granted, 31provided that the above copyright notice appear in all copies and that 32both that copyright notice and this permission notice appear in 33supporting documentation, and that the name of Digital not be 34used in advertising or publicity pertaining to distribution of the 35software without specific, written prior permission. 36 37DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 38ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 39DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 40ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 41WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 42ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 43SOFTWARE. 44 45******************************************************************/ 46 47#ifdef HAVE_CONFIG_H 48#include <config.h> 49#endif 50#include "IntrinsicI.h" 51#include "StringDefs.h" 52#include "CreateI.h" 53 54/****************************************************************** 55 * 56 * Rectangle Object Resources 57 * 58 ******************************************************************/ 59 60static void XtCopyAncestorSensitive(Widget, int, XrmValue *); 61 62/* *INDENT-OFF* */ 63static XtResource resources[] = { 64 65 {XtNancestorSensitive, XtCSensitive, XtRBoolean, sizeof(Boolean), 66 XtOffsetOf(RectObjRec,rectangle.ancestor_sensitive),XtRCallProc, 67 (XtPointer)XtCopyAncestorSensitive}, 68 {XtNx, XtCPosition, XtRPosition, sizeof(Position), 69 XtOffsetOf(RectObjRec,rectangle.x), XtRImmediate, (XtPointer)0}, 70 {XtNy, XtCPosition, XtRPosition, sizeof(Position), 71 XtOffsetOf(RectObjRec,rectangle.y), XtRImmediate, (XtPointer)0}, 72 {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), 73 XtOffsetOf(RectObjRec,rectangle.width), XtRImmediate, (XtPointer)0}, 74 {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), 75 XtOffsetOf(RectObjRec,rectangle.height), XtRImmediate, (XtPointer)0}, 76 {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), 77 XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, 78 (XtPointer)1}, 79 {XtNsensitive, XtCSensitive, XtRBoolean, sizeof(Boolean), 80 XtOffsetOf(RectObjRec,rectangle.sensitive), XtRImmediate, 81 (XtPointer)True} 82}; 83/* *INDENT-ON* */ 84 85static void RectClassPartInitialize(WidgetClass); 86static void RectSetValuesAlmost(Widget, Widget, XtWidgetGeometry *, 87 XtWidgetGeometry *); 88 89/* *INDENT-OFF* */ 90externaldef(rectobjclassrec) RectObjClassRec rectObjClassRec = { 91 { 92 /* superclass */ (WidgetClass)&objectClassRec, 93 /* class_name */ "Rect", 94 /* widget_size */ sizeof(RectObjRec), 95 /* class_initialize */ NULL, 96 /* class_part_initialize */ RectClassPartInitialize, 97 /* class_inited */ FALSE, 98 /* initialize */ NULL, 99 /* initialize_hook */ NULL, 100 /* realize */ NULL, 101 /* actions */ NULL, 102 /* num_actions */ 0, 103 /* resources */ resources, 104 /* num_resources */ XtNumber(resources), 105 /* xrm_class */ NULLQUARK, 106 /* compress_motion */ FALSE, 107 /* compress_exposure */ TRUE, 108 /* compress_enterleave */ FALSE, 109 /* visible_interest */ FALSE, 110 /* destroy */ NULL, 111 /* resize */ NULL, 112 /* expose */ NULL, 113 /* set_values */ NULL, 114 /* set_values_hook */ NULL, 115 /* set_values_almost */ RectSetValuesAlmost, 116 /* get_values_hook */ NULL, 117 /* accept_focus */ NULL, 118 /* version */ XtVersion, 119 /* callback_offsets */ NULL, 120 /* tm_table */ NULL, 121 /* query_geometry */ NULL, 122 /* display_accelerator */ NULL, 123 /* extension */ NULL 124 } 125}; 126/* *INDENT-ON* */ 127 128externaldef(rectObjClass) 129WidgetClass rectObjClass = (WidgetClass) &rectObjClassRec; 130 131static void 132XtCopyAncestorSensitive(Widget widget, int offset _X_UNUSED, XrmValue *value) 133{ 134 static Boolean sensitive; 135 Widget parent = widget->core.parent; 136 137 sensitive = (parent->core.ancestor_sensitive & parent->core.sensitive); 138 value->addr = (XPointer) (&sensitive); 139} 140 141/* 142 * Start of rectangle object methods 143 */ 144 145static void 146RectClassPartInitialize(register WidgetClass wc) 147{ 148 register RectObjClass roc = (RectObjClass) wc; 149 register RectObjClass super = ((RectObjClass) roc->rect_class.superclass); 150 151 /* We don't need to check for null super since we'll get to object 152 eventually, and it had better define them! */ 153 154 if (roc->rect_class.resize == XtInheritResize) { 155 roc->rect_class.resize = super->rect_class.resize; 156 } 157 158 if (roc->rect_class.expose == XtInheritExpose) { 159 roc->rect_class.expose = super->rect_class.expose; 160 } 161 162 if (roc->rect_class.set_values_almost == XtInheritSetValuesAlmost) { 163 roc->rect_class.set_values_almost = super->rect_class.set_values_almost; 164 } 165 166 if (roc->rect_class.query_geometry == XtInheritQueryGeometry) { 167 roc->rect_class.query_geometry = super->rect_class.query_geometry; 168 } 169} 170 171/* 172 * Why there isn't an Initialize Method: 173 * 174 * Initialization of the RectObj non-Resource field is done by the 175 * intrinsics in _XtCreateWidget in order that the field is initialized 176 * for use by converters during instance resource resolution. 177 */ 178 179static void 180RectSetValuesAlmost(Widget old _X_UNUSED, 181 Widget new _X_UNUSED, 182 XtWidgetGeometry *request, 183 XtWidgetGeometry *reply) 184{ 185 *request = *reply; 186} 187