HookObj.c revision a3bd7f05
1/* 2 3Copyright 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*/ 26 27#ifdef HAVE_CONFIG_H 28#include <config.h> 29#endif 30#include "IntrinsicI.h" 31#include "StringDefs.h" 32/****************************************************************** 33 * 34 * Hook Object Resources 35 * 36 ******************************************************************/ 37 38/* *INDENT-OFF* */ 39static XtResource resources[] = { 40 { XtNcreateHook, XtCCallback, XtRCallback, sizeof(XtPointer), 41 XtOffsetOf(HookObjRec, hooks.createhook_callbacks), 42 XtRCallback, (XtPointer)NULL}, 43 { XtNchangeHook, XtCCallback, XtRCallback, sizeof(XtPointer), 44 XtOffsetOf(HookObjRec, hooks.changehook_callbacks), 45 XtRCallback, (XtPointer)NULL}, 46 { XtNconfigureHook, XtCCallback, XtRCallback, sizeof(XtPointer), 47 XtOffsetOf(HookObjRec, hooks.confighook_callbacks), 48 XtRCallback, (XtPointer)NULL}, 49 { XtNgeometryHook, XtCCallback, XtRCallback, sizeof(XtPointer), 50 XtOffsetOf(HookObjRec, hooks.geometryhook_callbacks), 51 XtRCallback, (XtPointer)NULL}, 52 { XtNdestroyHook, XtCCallback, XtRCallback, sizeof(XtPointer), 53 XtOffsetOf(HookObjRec, hooks.destroyhook_callbacks), 54 XtRCallback, (XtPointer)NULL}, 55 { XtNshells, XtCReadOnly, XtRWidgetList, sizeof(WidgetList), 56 XtOffsetOf(HookObjRec, hooks.shells), XtRImmediate, (XtPointer) NULL }, 57 { XtNnumShells, XtCReadOnly, XtRCardinal, sizeof(Cardinal), 58 XtOffsetOf(HookObjRec, hooks.num_shells), XtRImmediate, (XtPointer) 0 } 59}; 60/* *INDENT-ON* */ 61 62static void GetValuesHook(Widget widget, ArgList args, Cardinal *num_args); 63static void Initialize(Widget req, Widget new, ArgList args, 64 Cardinal *num_args); 65 66/* *INDENT-OFF* */ 67externaldef(hookobjclassrec) HookObjClassRec hookObjClassRec = { 68 { /* Object Class Part */ 69 /* superclass */ (WidgetClass)&objectClassRec, 70 /* class_name */ "Hook", 71 /* widget_size */ sizeof(HookObjRec), 72 /* class_initialize */ NULL, 73 /* class_part_initialize */ NULL, 74 /* class_inited */ FALSE, 75 /* initialize */ Initialize, 76 /* initialize_hook */ NULL, 77 /* realize */ NULL, 78 /* actions */ NULL, 79 /* num_actions */ 0, 80 /* resources */ resources, 81 /* num_resources */ XtNumber(resources), 82 /* xrm_class */ NULLQUARK, 83 /* compress_motion */ FALSE, 84 /* compress_exposure */ TRUE, 85 /* compress_enterleave */ FALSE, 86 /* visible_interest */ FALSE, 87 /* destroy */ NULL, 88 /* resize */ NULL, 89 /* expose */ NULL, 90 /* set_values */ NULL, 91 /* set_values_hook */ NULL, 92 /* set_values_almost */ NULL, 93 /* get_values_hook */ GetValuesHook, 94 /* accept_focus */ NULL, 95 /* version */ XtVersion, 96 /* callback_offsets */ NULL, 97 /* tm_table */ NULL, 98 /* query_geometry */ NULL, 99 /* display_accelerator */ NULL, 100 /* extension */ NULL 101 }, 102 { /* HookObj Class Part */ 103 /* unused */ 0 104 } 105}; 106/* *INDENT-ON* */ 107 108externaldef(hookObjectClass) 109WidgetClass hookObjectClass = (WidgetClass) &hookObjClassRec; 110 111static void 112FreeShellList(Widget w, 113 XtPointer closure _X_UNUSED, 114 XtPointer call_data _X_UNUSED) 115{ 116 HookObject h = (HookObject) w; 117 118 if (h->hooks.shells != NULL) 119 XtFree((char *) h->hooks.shells); 120} 121 122static void 123Initialize(Widget req _X_UNUSED, 124 Widget new, 125 ArgList args _X_UNUSED, 126 Cardinal *num_args _X_UNUSED) 127{ 128 HookObject w = (HookObject) new; 129 130 w->hooks.max_shells = 0; 131 XtAddCallback(new, XtNdestroyCallback, FreeShellList, (XtPointer) NULL); 132} 133 134static void 135GetValuesHook(Widget widget _X_UNUSED, 136 ArgList args _X_UNUSED, 137 Cardinal *num_args _X_UNUSED) 138{ 139 /* get the XtNshells and XtNnumShells pseudo-resources */ 140} 141