Grip.c revision 7a84e134
17a84e134Smrg/* $Xorg: Grip.c,v 1.4 2001/02/09 02:03:43 xorgcvs Exp $ */
27a84e134Smrg
37a84e134Smrg/***********************************************************
47a84e134Smrg
57a84e134SmrgCopyright 1987, 1988, 1994, 1998  The Open Group
67a84e134Smrg
77a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its
87a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that
97a84e134Smrgthe above copyright notice appear in all copies and that both that
107a84e134Smrgcopyright notice and this permission notice appear in supporting
117a84e134Smrgdocumentation.
127a84e134Smrg
137a84e134SmrgThe above copyright notice and this permission notice shall be included in
147a84e134Smrgall copies or substantial portions of the Software.
157a84e134Smrg
167a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
177a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
187a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
197a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
207a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
217a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
227a84e134Smrg
237a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be
247a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings
257a84e134Smrgin this Software without prior written authorization from The Open Group.
267a84e134Smrg
277a84e134Smrg
287a84e134SmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
297a84e134Smrg
307a84e134Smrg                        All Rights Reserved
317a84e134Smrg
327a84e134SmrgPermission to use, copy, modify, and distribute this software and its
337a84e134Smrgdocumentation for any purpose and without fee is hereby granted,
347a84e134Smrgprovided that the above copyright notice appear in all copies and that
357a84e134Smrgboth that copyright notice and this permission notice appear in
367a84e134Smrgsupporting documentation, and that the name of Digital not be
377a84e134Smrgused in advertising or publicity pertaining to distribution of the
387a84e134Smrgsoftware without specific, written prior permission.
397a84e134Smrg
407a84e134SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
417a84e134SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
427a84e134SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
437a84e134SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
447a84e134SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
457a84e134SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
467a84e134SmrgSOFTWARE.
477a84e134Smrg
487a84e134Smrg******************************************************************/
497a84e134Smrg/* $XFree86: xc/lib/Xaw/Grip.c,v 1.7 2001/01/17 19:42:26 dawes Exp $ */
507a84e134Smrg
517a84e134Smrg/*
527a84e134Smrg * Grip.c - Grip Widget (Used by Paned Widget)
537a84e134Smrg *
547a84e134Smrg */
557a84e134Smrg#ifdef HAVE_CONFIG_H
567a84e134Smrg#include <config.h>
577a84e134Smrg#endif
587a84e134Smrg#include <X11/IntrinsicP.h>
597a84e134Smrg#include <X11/StringDefs.h>
607a84e134Smrg#include <X11/Xaw/GripP.h>
617a84e134Smrg#include <X11/Xaw/XawInit.h>
627a84e134Smrg
637a84e134Smrg/*
647a84e134Smrg * Prototypes
657a84e134Smrg */
667a84e134Smrgstatic void
677a84e134SmrgGripAction(Widget, XEvent*, String*, Cardinal*);
687a84e134Smrg
697a84e134Smrg/*
707a84e134Smrg * Initialization
717a84e134Smrg */
727a84e134Smrgstatic XtResource resources[] = {
737a84e134Smrg  {
747a84e134Smrg    XtNwidth,
757a84e134Smrg    XtCWidth,
767a84e134Smrg    XtRDimension,
777a84e134Smrg    sizeof(Dimension),
787a84e134Smrg    XtOffsetOf(GripRec, core.width),
797a84e134Smrg    XtRImmediate,
807a84e134Smrg    (XtPointer)DEFAULT_GRIP_SIZE
817a84e134Smrg  },
827a84e134Smrg  {
837a84e134Smrg    XtNheight,
847a84e134Smrg    XtCHeight,
857a84e134Smrg    XtRDimension,
867a84e134Smrg    sizeof(Dimension),
877a84e134Smrg    XtOffsetOf(GripRec, core.height),
887a84e134Smrg    XtRImmediate,
897a84e134Smrg    (XtPointer)DEFAULT_GRIP_SIZE
907a84e134Smrg  },
917a84e134Smrg  {
927a84e134Smrg    XtNforeground,
937a84e134Smrg    XtCForeground,
947a84e134Smrg    XtRPixel,
957a84e134Smrg    sizeof(Pixel),
967a84e134Smrg    XtOffsetOf(GripRec, core.background_pixel),
977a84e134Smrg    XtRString,
987a84e134Smrg    XtDefaultForeground
997a84e134Smrg  },
1007a84e134Smrg  {
1017a84e134Smrg    XtNborderWidth,
1027a84e134Smrg    XtCBorderWidth,
1037a84e134Smrg    XtRDimension,
1047a84e134Smrg    sizeof(Dimension),
1057a84e134Smrg    XtOffsetOf(GripRec, core.border_width),
1067a84e134Smrg    XtRImmediate,
1077a84e134Smrg    (XtPointer)0
1087a84e134Smrg  },
1097a84e134Smrg  {
1107a84e134Smrg    XtNcallback,
1117a84e134Smrg    XtCCallback,
1127a84e134Smrg    XtRCallback,
1137a84e134Smrg    sizeof(XtPointer),
1147a84e134Smrg    XtOffsetOf(GripRec, grip.grip_action),
1157a84e134Smrg    XtRCallback,
1167a84e134Smrg    NULL
1177a84e134Smrg  },
1187a84e134Smrg};
1197a84e134Smrg
1207a84e134Smrgstatic XtActionsRec actionsList[] =
1217a84e134Smrg{
1227a84e134Smrg  {"GripAction",      GripAction},
1237a84e134Smrg};
1247a84e134Smrg
1257a84e134Smrg#define Superclass	(&simpleClassRec)
1267a84e134Smrg
1277a84e134SmrgGripClassRec gripClassRec = {
1287a84e134Smrg  /* core */
1297a84e134Smrg   {
1307a84e134Smrg     (WidgetClass)Superclass,		/* superclass */
1317a84e134Smrg     "Grip",				/* class name */
1327a84e134Smrg     sizeof(GripRec),			/* size */
1337a84e134Smrg     XawInitializeWidgetSet,		/* class initialize */
1347a84e134Smrg     NULL,				/* class_part_init */
1357a84e134Smrg     False,				/* class_inited */
1367a84e134Smrg     NULL,				/* initialize */
1377a84e134Smrg     NULL,				/* initialize_hook */
1387a84e134Smrg     XtInheritRealize,			/* realize */
1397a84e134Smrg     actionsList,			/* actions */
1407a84e134Smrg     XtNumber(actionsList),		/* num_actions */
1417a84e134Smrg     resources,				/* resources */
1427a84e134Smrg     XtNumber(resources),		/* num_resources */
1437a84e134Smrg     NULLQUARK,				/* xrm_class */
1447a84e134Smrg     True,				/* compress_motion */
1457a84e134Smrg     True,				/* compress_exposure */
1467a84e134Smrg     True,				/* compress_enterleave */
1477a84e134Smrg     False,				/* visible_interest */
1487a84e134Smrg     NULL,				/* destroy */
1497a84e134Smrg     NULL,				/* resize */
1507a84e134Smrg     XtInheritExpose,			/* expose */
1517a84e134Smrg     NULL,				/* set_values */
1527a84e134Smrg     NULL,				/* set_values_hook */
1537a84e134Smrg     XtInheritSetValuesAlmost,		/* set_values_almost */
1547a84e134Smrg     NULL,				/* get_values_hook */
1557a84e134Smrg     NULL,				/* accept_focus */
1567a84e134Smrg     XtVersion,				/* version */
1577a84e134Smrg     NULL,				/* callback_private */
1587a84e134Smrg     NULL,				/* tm_table */
1597a84e134Smrg     XtInheritQueryGeometry,		/* query_geometry */
1607a84e134Smrg     XtInheritDisplayAccelerator,	/* display_accelerator */
1617a84e134Smrg     NULL,				/* extension */
1627a84e134Smrg   },
1637a84e134Smrg   /* simple */
1647a84e134Smrg   {
1657a84e134Smrg     XtInheritChangeSensitive,		/* change_sensitive */
1667a84e134Smrg   },
1677a84e134Smrg   /* grip */
1687a84e134Smrg   {
1697a84e134Smrg     NULL,				/* extension */
1707a84e134Smrg   }
1717a84e134Smrg};
1727a84e134Smrg
1737a84e134SmrgWidgetClass gripWidgetClass = (WidgetClass)&gripClassRec;
1747a84e134Smrg
1757a84e134Smrg/*
1767a84e134Smrg * Implementation
1777a84e134Smrg */
1787a84e134Smrgstatic void
1797a84e134SmrgGripAction(Widget widget, XEvent *event, String *params, Cardinal *num_params)
1807a84e134Smrg{
1817a84e134Smrg    XawGripCallDataRec call_data;
1827a84e134Smrg
1837a84e134Smrg    call_data.event = event;
1847a84e134Smrg    call_data.params = params;
1857a84e134Smrg    call_data.num_params = *num_params;
1867a84e134Smrg
1877a84e134Smrg    XtCallCallbacks(widget, XtNcallback, (XtPointer)&call_data);
1887a84e134Smrg}
189