1444c061aSmrg/*
2444c061aSmrg
3444c061aSmrgCopyright 1994, 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
25444c061aSmrg*/
26444c061aSmrg
27444c061aSmrg#ifdef HAVE_CONFIG_H
28444c061aSmrg#include <config.h>
29444c061aSmrg#endif
30444c061aSmrg#include "IntrinsicI.h"
31444c061aSmrg#include "StringDefs.h"
32444c061aSmrg/******************************************************************
33444c061aSmrg *
34444c061aSmrg * Hook Object Resources
35444c061aSmrg *
36444c061aSmrg ******************************************************************/
37444c061aSmrg
38a3bd7f05Smrg/* *INDENT-OFF* */
39444c061aSmrgstatic XtResource resources[] = {
40444c061aSmrg  { XtNcreateHook, XtCCallback, XtRCallback, sizeof(XtPointer),
41444c061aSmrg    XtOffsetOf(HookObjRec, hooks.createhook_callbacks),
42444c061aSmrg    XtRCallback, (XtPointer)NULL},
43444c061aSmrg  { XtNchangeHook, XtCCallback, XtRCallback, sizeof(XtPointer),
44444c061aSmrg    XtOffsetOf(HookObjRec, hooks.changehook_callbacks),
45444c061aSmrg    XtRCallback, (XtPointer)NULL},
46444c061aSmrg  { XtNconfigureHook, XtCCallback, XtRCallback, sizeof(XtPointer),
47444c061aSmrg    XtOffsetOf(HookObjRec, hooks.confighook_callbacks),
48444c061aSmrg    XtRCallback, (XtPointer)NULL},
49444c061aSmrg  { XtNgeometryHook, XtCCallback, XtRCallback, sizeof(XtPointer),
50444c061aSmrg    XtOffsetOf(HookObjRec, hooks.geometryhook_callbacks),
51444c061aSmrg    XtRCallback, (XtPointer)NULL},
52444c061aSmrg  { XtNdestroyHook, XtCCallback, XtRCallback, sizeof(XtPointer),
53444c061aSmrg    XtOffsetOf(HookObjRec, hooks.destroyhook_callbacks),
54444c061aSmrg    XtRCallback, (XtPointer)NULL},
55444c061aSmrg  { XtNshells, XtCReadOnly, XtRWidgetList, sizeof(WidgetList),
56444c061aSmrg    XtOffsetOf(HookObjRec, hooks.shells), XtRImmediate, (XtPointer) NULL },
57444c061aSmrg  { XtNnumShells, XtCReadOnly, XtRCardinal, sizeof(Cardinal),
58444c061aSmrg    XtOffsetOf(HookObjRec, hooks.num_shells), XtRImmediate, (XtPointer) 0 }
59444c061aSmrg};
60a3bd7f05Smrg/* *INDENT-ON* */
61444c061aSmrg
62444c061aSmrgstatic void GetValuesHook(Widget widget, ArgList args, Cardinal *num_args);
63444c061aSmrgstatic void Initialize(Widget req, Widget new, ArgList args,
64a3bd7f05Smrg                       Cardinal *num_args);
65444c061aSmrg
66a3bd7f05Smrg/* *INDENT-OFF* */
67444c061aSmrgexternaldef(hookobjclassrec) HookObjClassRec hookObjClassRec = {
68444c061aSmrg  { /* Object Class Part */
69a3bd7f05Smrg    /* superclass              */ (WidgetClass)&objectClassRec,
70a3bd7f05Smrg    /* class_name              */ "Hook",
71a3bd7f05Smrg    /* widget_size             */ sizeof(HookObjRec),
72a3bd7f05Smrg    /* class_initialize        */ NULL,
73a3bd7f05Smrg    /* class_part_initialize   */ NULL,
74a3bd7f05Smrg    /* class_inited            */ FALSE,
75a3bd7f05Smrg    /* initialize              */ Initialize,
76a3bd7f05Smrg    /* initialize_hook         */ NULL,
77a3bd7f05Smrg    /* realize                 */ NULL,
78a3bd7f05Smrg    /* actions                 */ NULL,
79a3bd7f05Smrg    /* num_actions             */ 0,
80a3bd7f05Smrg    /* resources               */ resources,
81a3bd7f05Smrg    /* num_resources           */ XtNumber(resources),
82a3bd7f05Smrg    /* xrm_class               */ NULLQUARK,
83a3bd7f05Smrg    /* compress_motion         */ FALSE,
84a3bd7f05Smrg    /* compress_exposure       */ TRUE,
85a3bd7f05Smrg    /* compress_enterleave     */ FALSE,
86a3bd7f05Smrg    /* visible_interest        */ FALSE,
87a3bd7f05Smrg    /* destroy                 */ NULL,
88a3bd7f05Smrg    /* resize                  */ NULL,
89a3bd7f05Smrg    /* expose                  */ NULL,
90a3bd7f05Smrg    /* set_values              */ NULL,
91a3bd7f05Smrg    /* set_values_hook         */ NULL,
92a3bd7f05Smrg    /* set_values_almost       */ NULL,
93a3bd7f05Smrg    /* get_values_hook         */ GetValuesHook,
94a3bd7f05Smrg    /* accept_focus            */ NULL,
95a3bd7f05Smrg    /* version                 */ XtVersion,
96a3bd7f05Smrg    /* callback_offsets        */ NULL,
97a3bd7f05Smrg    /* tm_table                */ NULL,
98a3bd7f05Smrg    /* query_geometry          */ NULL,
99a3bd7f05Smrg    /* display_accelerator     */ NULL,
100a3bd7f05Smrg    /* extension               */ NULL
101444c061aSmrg  },
102444c061aSmrg  { /* HookObj Class Part */
103a3bd7f05Smrg    /* unused               */  0
104444c061aSmrg  }
105444c061aSmrg};
106a3bd7f05Smrg/* *INDENT-ON* */
107444c061aSmrg
108a3bd7f05Smrgexternaldef(hookObjectClass)
109a3bd7f05SmrgWidgetClass hookObjectClass = (WidgetClass) &hookObjClassRec;
110444c061aSmrg
111a3bd7f05Smrgstatic void
112a3bd7f05SmrgFreeShellList(Widget w,
113a3bd7f05Smrg              XtPointer closure _X_UNUSED,
114a3bd7f05Smrg              XtPointer call_data _X_UNUSED)
115444c061aSmrg{
116a3bd7f05Smrg    HookObject h = (HookObject) w;
117a3bd7f05Smrg
118444c061aSmrg    if (h->hooks.shells != NULL)
119a3bd7f05Smrg        XtFree((char *) h->hooks.shells);
120444c061aSmrg}
121444c061aSmrg
122a3bd7f05Smrgstatic void
123a3bd7f05SmrgInitialize(Widget req _X_UNUSED,
124a3bd7f05Smrg           Widget new,
125a3bd7f05Smrg           ArgList args _X_UNUSED,
126a3bd7f05Smrg           Cardinal *num_args _X_UNUSED)
127444c061aSmrg{
128444c061aSmrg    HookObject w = (HookObject) new;
129a3bd7f05Smrg
130444c061aSmrg    w->hooks.max_shells = 0;
131a3bd7f05Smrg    XtAddCallback(new, XtNdestroyCallback, FreeShellList, (XtPointer) NULL);
132444c061aSmrg}
133444c061aSmrg
134a3bd7f05Smrgstatic void
135a3bd7f05SmrgGetValuesHook(Widget widget _X_UNUSED,
136a3bd7f05Smrg              ArgList args _X_UNUSED,
137a3bd7f05Smrg              Cardinal *num_args _X_UNUSED)
138444c061aSmrg{
139444c061aSmrg    /* get the XtNshells and XtNnumShells pseudo-resources */
140444c061aSmrg}
141