home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
x
/
volume13
/
xrainbow
/
part03
< prev
next >
Wrap
Internet Message Format
|
1991-06-27
|
80KB
Path: uunet!lll-winken!sun-barr!cronkite!newstop!exodus!maxine.WPI.EDU
From: daven@maxine.WPI.EDU (Dave Nedde)
Newsgroups: comp.sources.x
Subject: v13i065: xrainbow, Part03/05
Message-ID: <15965@exodus.Eng.Sun.COM>
Date: 28 Jun 91 01:04:35 GMT
References: <csx-13i063-xrainbow@uunet.UU.NET>
Sender: news@exodus.Eng.Sun.COM
Lines: 2176
Approved: argv@sun.com
Submitted-by: daven@maxine.WPI.EDU (Dave Nedde)
Posting-number: Volume 13, Issue 65
Archive-name: xrainbow/part03
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 3 (of 5)."
# Contents: xrainbow/Wc1_05/Wc/WcConvert.c
# xrainbow/Wc1_05/Wc/WcCreate.c xrainbow/Wc1_05/Wc/WcCreate.h
# xrainbow/Wc1_05/Wc/WcCreateP.h
# xrainbow/include/X11/Xaw_d/DrawingA.h
# Wrapped by daven@ash on Mon Jun 3 12:33:23 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'xrainbow/Wc1_05/Wc/WcConvert.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xrainbow/Wc1_05/Wc/WcConvert.c'\"
else
echo shar: Extracting \"'xrainbow/Wc1_05/Wc/WcConvert.c'\" \(21715 characters\)
sed "s/^X//" >'xrainbow/Wc1_05/Wc/WcConvert.c' <<'END_OF_FILE'
X/*
X** Copyright (c) 1990 David E. Smyth
X**
X** This file was derived from work performed by Martin Brunecky at
X** Auto-trol Technology Corporation, Denver, Colorado, under the
X** following copyright:
X**
X*******************************************************************************
X* Copyright 1990 by Auto-trol Technology Corporation, Denver, Colorado.
X*
X* All Rights Reserved
X*
X* Permission to use, copy, modify, and distribute this software and its
X* documentation for any purpose and without fee is hereby granted, provided
X* that the above copyright notice appears on all copies and that both the
X* copyright and this permission notice appear in supporting documentation
X* and that the name of Auto-trol not be used in advertising or publicity
X* pertaining to distribution of the software without specific, prior written
X* permission.
X*
X* Auto-trol disclaims all warranties with regard to this software, including
X* all implied warranties of merchantability and fitness, in no event shall
X* Auto-trol be liable for any special, indirect or consequential damages or
X* any damages whatsoever resulting from loss of use, data or profits, whether
X* in an action of contract, negligence or other tortious action, arising out
X* of or in connection with the use or performance of this software.
X*******************************************************************************
X**
X** Redistribution and use in source and binary forms are permitted
X** provided that the above copyright notice and this paragraph are
X** duplicated in all such forms and that any documentation, advertising
X** materials, and other materials related to such distribution and use
X** acknowledge that the software was developed by David E. Smyth. The
X** name of David E. Smyth may not be used to endorse or promote products
X** derived from this software without specific prior written permission.
X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
X** WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
X** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X**
X*/
X
X/*
X* SCCS_data: @(#)WcConvert.c 1.1 ( 19 Nov 90 )
X*
X* Subsystem_group:
X*
X* Widget Creation Library
X*
X* Module_description:
X*
X* This module contains Xt converter functions which convert strings,
X* as found in the Xrm database, into useful types.
X*
X* It also contains the routine which registers all Wc converters.
X*
X* The CvtStringToWidget converter takes a pathname which starts
X* from the application shell an proceeds to a specific widget. The
X* widget must already have been created. Note that this converter
X* needs to be used INSTEAD of the XmuCvtStringToWidget which gets
X* registered by the Athena widgets. The Xmu converter is not so
X* user friendly. This means this file also declares an external
X* function XmuCvtStringToWidget() which is really CvtStringToWidget,
X* and this needs to be linked before Xmu.
X*
X* The CvtStringToCallback converter parses the resource string in
X* the format:
X*
X* ...path: name[(args)][,name[(args)]]...
X*
X* where: name: specifies the registered callback function name
X* args: specifies the string passed to a callback as
X* "client data".
X*
X* Multiple callbacks can be specified for a single callback list
X* resource. Any callbacks must be "registered" by the application
X* prior converter invocation (.i.e.prior widget creation).
X* If no "args" string is provided, the default "client data"
X* specified at callback registration are used.
X*
X* The CvtStringToConstructor converter searches the Constructor
X* cache for a registered constructor.
X*
X* The CvtStringToClass converter searches the Class cache for a
X* registered object (widget) class pointer name.
X*
X* The CvtStringToClassName converter searches the ClassName cache
X* for a registered object (widget) class name.
X
X*
X* Module_interface_summary:
X*
X* Resource converter is invoked indirectly by the toolkit. The
X* converter is added to the toolkit by widgets calling
X* WcAddConverters() in the Wc intialization code.
X*
X* Module_history:
X*
X* mm/dd/yy initials function action
X* -------- -------- -------- ---------------------------------------------
X* 06/08/90 D.Smyth Class, ClassName, and Constructor converters.
X* 05/24/90 D.Smyth WcAddConverters created from something similar
X* 04/03/90 MarBru CvtStr.. Fixed argument termination with a NUL char
X* 02/26/90 MarBru All Created
X*
X* Design_notes:
X*
X* For VMS, we could have used LIB$FIND_IMAGE_SYMBOL and use dynamic
X* (runtime) binding. But since most UNIX systems lack such capability,
X* we stick to the concept of "registration" routines.
X*
X* One time, I considered applying conversion to callback argument, which
X* would take the burden of conversion from the callback code (runtime)
X* to the callback conversion (one time initialization). The problem is
X* that some conversions are widget context specific (color to pixel needs
X* display connection), and at the time of callback conversion I do not
X* have a widget. I could require the widget argument, but this would kill
X* caching of the conversion result.
X*
X* The sequential search of the callback cache is far from optimal. I should
X* use binary search, or the R4 conversion cache. I can't use the R4 cache
X* until Motif 1.1 is released which will (supposedly) run on R4 Intrinsics.
X*
X*******************************************************************************
X*/
X/*
X*******************************************************************************
X* Include_files.
X*******************************************************************************
X*/
X
X#include <ctype.h> /* isupper() and tolower macros */
X#include <stdio.h>
X
X/* -- X Window System includes */
X#include <X11/Intrinsic.h>
X#include <X11/StringDefs.h>
X
X/* -- Widget Creation Library includes */
X#include "WcCreate.h"
X#include "WcCreateP.h"
X
X/*
X*******************************************************************************
X* Private_constant_declarations.
X*******************************************************************************
X*/
X
X/*
X*******************************************************************************
X* Private_type_declarations.
X*******************************************************************************
X*/
X
X/*
X*******************************************************************************
X* Private_macro_definitions.
X*******************************************************************************
X*/
X
X#define done( type, value ) \
X{ \
X if ( toVal->addr != NULL ) \
X { \
X if ( toVal->size < sizeof( type ) ) \
X { \
X toVal->size = sizeof( type ); \
X return; \
X } \
X *(type*)(toVal->addr) = (value); \
X } \
X else \
X { \
X static type static_val; \
X static_val = (value); \
X toVal->addr = (caddr_t)&static_val; \
X } \
X toVal->size = sizeof(type); \
X return; \
X}
X
X/*
X*******************************************************************************
X* Private_data_definitions.
X*******************************************************************************
X*/
X
X/*
X*******************************************************************************
X* Private_function_declarations.
X*******************************************************************************
X*/
X
X/*
X -- Convert String To ClassPtr
X*******************************************************************************
X This conversion searches the Object Class cache for the appropriate
X Cache record. The resource database string is simply the name
X of the class pointer, case insensitive. The value provided is the
X widget class pointer, as passed to XtCreateWidget().
X*/
X
Xvoid CvtStringToClassPtr (args, num_args, fromVal, toVal )
X XrmValue *args;
X Cardinal *num_args;
X XrmValue *fromVal;
X XrmValue *toVal;
X{
X char* string = (char *) fromVal->addr;
X char cleanName[MAX_XRMSTRING];
X char* lowerCase;
X XrmQuark quark;
X int i;
X
X (void)WcCleanName ( string, cleanName );
X lowerCase = WcLowerCaseCopy ( cleanName );
X quark = XrmStringToQuark ( lowerCase );
X XtFree ( lowerCase );
X
X for (i=0; i<classes_num; i++)
X {
X if ( classes_ptr[i].quark == quark )
X {
X done( WidgetClass, classes_ptr[i].class );
X }
X }
X XtStringConversionWarning (cleanName, "Object Class, not registered.");
X}
X
X/*
X -- Convert String To ClassName
X*******************************************************************************
X This conversion searches the Class Name cache for the appropriate
X Cache record. The resource database string is simply the name
X of the class, case insensitive. The value provided is the widget
X class pointer, as passed to XtCreateWidget().
X*/
X
Xvoid CvtStringToClassName (args, num_args, fromVal, toVal )
X XrmValue *args;
X Cardinal *num_args;
X XrmValue *fromVal;
X XrmValue *toVal;
X{
X char* string = (char *) fromVal->addr;
X char cleanName[MAX_XRMSTRING];
X char* lowerCase;
X XrmQuark quark;
X int i;
X
X (void)WcCleanName ( string, cleanName );
X lowerCase = WcLowerCaseCopy ( cleanName );
X quark = XrmStringToQuark ( lowerCase );
X XtFree ( lowerCase );
X
X for (i=0; i<cl_nm_num; i++)
X {
X if ( cl_nm_ptr[i].quark == quark )
X {
X done( WidgetClass, cl_nm_ptr[i].class );
X }
X }
X XtStringConversionWarning (cleanName, "Class Name, not registered.");
X}
X
X/*
X -- Convert String To Constructor
X*******************************************************************************
X This conversion searches the Constructor Cache for the appropriate
X Cache record. The resource database string is simply the name
X of the constructor, case insensitive. The value provided is a
X Contrstructor Cache Record. The constructor (func ptr) itself is
X not provided, as the user of this value (generally WcCreateDatabaseChild)
X also likes to have the constructor name as registered for error messages.
X*/
X
Xvoid CvtStringToConstructor (args, num_args, fromVal, toVal)
X XrmValue *args;
X Cardinal *num_args;
X XrmValue *fromVal;
X XrmValue *toVal;
X{
X char* string = (char *) fromVal->addr;
X char cleanName[MAX_XRMSTRING];
X char* lowerCase;
X XrmQuark quark;
X int i;
X
X (void)WcCleanName ( string, cleanName );
X lowerCase = WcLowerCaseCopy ( cleanName );
X quark = XrmStringToQuark ( lowerCase );
X XtFree ( lowerCase );
X
X for (i=0; i<constrs_num; i++)
X {
X if ( constrs_ptr[i].quark == quark )
X {
X done( ConCacheRec*, &(constrs_ptr[i]) );
X }
X }
X XtStringConversionWarning (cleanName, "Constructor, not registered.");
X}
X
X/*
X -- Convert String To Callback
X*******************************************************************************
X This conversion creates a callback list structure from the X resource
X database string in format:
X
X name(arg),name(arg).....
X
X Note "name" is not case sensitive, while "arg" may be - it is passed to
X a callback as client data as a null terminated string (first level
X parenthesis stripped off). Even if nothing is specified e.g.,
X SomeCallback() there is a null terminated string passed as client
X data to the callback. If it is empty, then it is the null string.
X
X Note also that the argument CANNOT be converted at this point: frequently,
X the argument refers to a widget which has not yet been created, or
X uses the context of the callback (i.e., WcUnmanageCB( this ) uses the
X widget which invoked the callback).
X*/
X
Xtypedef struct
X{
X char *name_start, *name_end; /* callback name start, end */
X char *arg_start, *arg_end; /* argument string start, end */
X} Segment;
X
X#ifdef FUNCTION_PROTOTYPES
Xstatic int ParseCallbackString( char*, Segment*, int );
Xstatic XtCallbackRec* BuildCallbackList( Segment* );
Xstatic int GetCallbackAddrFromCache(char*, char*, XtCallbackRec* );
Xstatic void CopyArgsToCallbackClosure( char*, char*, XtCallbackRec* );
X#else
Xstatic int ParseCallbackString();
Xstatic XtCallbackRec* BuildCallbackList();
Xstatic int GetCallbackAddrFromCache();
Xstatic void CopyArgsToCallbackClosure();
X#endif
X
X/*
X -- Convert String To Callback
X*******************************************************************************
X*/
X
Xvoid CvtStringToCallback (args, num_args, fromVal, toVal)
X XrmValue *args;
X Cardinal *num_args;
X XrmValue *fromVal;
X XrmValue *toVal;
X{
X static XtCallbackRec* retval; /* return value MUST be static */
X
X Segment name_arg_segments[MAX_CALLBACKS];
X char* string = (char *) fromVal->addr;
X
X/* -- assume error or undefined input argument */
X toVal->size = 0;
X toVal->addr = (caddr_t) NULL;
X
X if (ParseCallbackString( string, name_arg_segments, MAX_CALLBACKS ))
X return;
X
X /* name_arg_segments[MAX_CALLBACKS-1].name_start MUST be NULL
X */
X retval = BuildCallbackList( name_arg_segments );
X
X toVal->size = sizeof(XtCallbackRec*);
X toVal->addr = (caddr_t)&retval;
X}
X
X/*
X -- Parse string into name+argument segments: returns 1 if failed
X*******************************************************************************
X*/
X
Xstatic int ParseCallbackString( string, seg, num_segs )
X char* string;
X Segment* seg;
X int num_segs;
X{
X register char* cp = string;
X register char* ws;
X register int in_parens = 0;
X
X/* -- Don't need to do anything if there is nothing interesting in string */
X if ( cp == NULL) return 1;
X if (*cp == NULL) return 1;
X
X /* skip leading whitespace */
X while( *cp <= ' ' )
X if (*++cp == NULL) return 1;
X
X/* -- Always end the parse on a null to make life easier */
X#define NEXT_CHAR if (*++cp == NULL) goto end_of_parse;
X#define BARF(str) { XtStringConversionWarning( string, str ); return 1; }
X
X while (1) /* parsing loop */
X {
X /* start new segment: we've got the start of the callback name,
X ** and nothing else.
X */
X seg->name_start = cp;
X seg->name_end = seg->arg_start = seg->arg_end = (char*)NULL;
X
X
X /* take care of possible error - barf if *cp is left paren or comma */
X if ( *cp == '(' || *cp == ',' )
X BARF( "Callback, name cannot start with `(' or `,'" )
X
X /* name is everything up to whitespace, a left paren, or comma */
X while( ' ' < *cp && *cp != '(' && *cp != ',' )
X NEXT_CHAR
X
X seg->name_end = cp-1; /* found end of the callback name */
X
X /* There may be whitespace between name and left paren or comma */
X while( *cp <= ' ' )
X NEXT_CHAR
X
X /* if we've found a left paren, collect the argument */
X if ( *cp == '(' )
X {
X ws = cp; /* actually points at initial left paren */
X in_parens = 1;
X while (in_parens)
X {
X NEXT_CHAR /* 1st time skips the initial left paren */
X if ( '(' == *cp ) in_parens++;
X if ( ')' == *cp ) in_parens--;
X }
X /* Now cp actually points at final right paren. Lets get rid of
X ** leading and trailing argument whitespace. If only whitespace
X ** then leave seg->arg_start == seg->arg_end == NULL
X */
X do {
X ws++; /* skip initial '(', will hit ')' at cp if no arg */
X } while ( *ws <= ' ' );
X if (ws != cp)
X {
X seg->arg_start = ws; /* first non-whitespace of argument */
X ws = cp; /* now look at the final right paren */
X do {
X ws--;
X } while ( *ws <= ' ' );
X seg->arg_end = ws;
X }
X NEXT_CHAR /* skip final right paren */
X }
X /* Skip optional comma separator, then do next segment */
X while( *cp <= ' ' || *cp == ',' )
X NEXT_CHAR
X
X seg++;
X /* NB: we must have space for following `NULL' segment */
X if ( --num_segs < 2 )
X BARF( "Callback, Too many callbacks" );
X }
X
Xend_of_parse:
X /* Got here because we've detected the NULL terminator. We
X ** could have hit the NULL at any of the "NEXT_CHAR" invocations.
X */
X
X if (seg->name_start && !seg->name_end)
X seg->name_end = cp-1; /* callback name */
X else if ( in_parens )
X BARF( "Callback, Unbalanced parens in callback argument" )
X
X seg++; seg->name_start = (char*)NULL; /* following seg is NULL */
X
X return 0; /* sucessful parse */
X}
X
X/*
X -- Build XtCallbackList based on name+arg segments
X*******************************************************************************
X*/
X
Xstatic XtCallbackRec* BuildCallbackList( seg )
X Segment* seg;
X{
X XtCallbackRec callback_list[MAX_CALLBACKS]; /* temporary */
X XtCallbackRec* rec = callback_list;
X int callback_list_len = 0;
X int bytes;
X
X/* -- process individual callback string segments "name(arg)" */
X for( ; seg->name_start ; seg++ )
X {
X if ( GetCallbackAddrFromCache( seg->name_start, seg->name_end, rec ) )
X {
X CopyArgsToCallbackClosure( seg->arg_start, seg->arg_end, rec );
X rec++;
X callback_list_len++;
X }
X }
X
X/* -- terminate the callback list */
X {
X rec->callback = NULL;
X rec->closure = NULL;
X callback_list_len++;
X }
X
X/* -- make a permanent copy of the new callback list, and return a pointer */
X bytes = callback_list_len * sizeof(XtCallbackRec);
X rec = (XtCallbackRec*)XtMalloc( bytes );
X memcpy ( (char*)rec, (char*)callback_list, bytes );
X return rec;
X}
X
X/*
X -- Find named callback in callback cache: TRUE if found
X*******************************************************************************
X Searches the Callback cache, gets the address of the callback
X function, and the default closure data as registered.
X*/
X
Xstatic int GetCallbackAddrFromCache( name_start, name_end, rec )
X char* name_start;
X char* name_end;
X XtCallbackRec* rec;
X{
X static char lowerCaseName[MAX_XRMSTRING];
X register char* cp = name_start;
X register char* dest = lowerCaseName;
X register int i;
X XrmQuark quark;
X
X /* our callback cache names are case insensitive */
X while( cp <= name_end )
X *dest++ = (isupper(*cp) ) ? tolower (*cp++) : *cp++;
X *dest = NUL;
X
X /* try to locate callback in our cache of callbacks */
X quark = XrmStringToQuark (lowerCaseName);
X
X for ( i=0 ; i < callbacks_num ; i++ )
X {
X if ( callbacks_ptr[i].quark == quark )
X {
X rec->callback = callbacks_ptr[i].callback;
X rec->closure = callbacks_ptr[i].closure; /* default closure */
X return 1;
X }
X }
X XtStringConversionWarning ( lowerCaseName,
X "Callback, unknown callback name");
X return 0;
X}
X
X/*
X -- Copy arguments from segment into XtCallbackList
X*******************************************************************************
X*/
X
Xstatic void CopyArgsToCallbackClosure( arg_start, arg_end, rec )
X char* arg_start;
X char* arg_end;
X XtCallbackRec* rec;
X{
X register char *arg;
X register int alen;
X
X if ( arg_start )
X {
X /* arg in parens - pass as string replacing default closure */
X alen = 1 + (int)arg_end - (int)arg_start;
X arg = XtMalloc(alen+1);
X strncpy ( arg, arg_start, alen );
X arg[alen] = NUL;
X rec->closure = (caddr_t)arg;
X }
X else
X {
X /* no arg in parens. Make sure closure is something -
X ** do NOT return NULL in any event. Causes SEGV too
X ** easily.
X */
X if (rec->closure == NULL)
X rec->closure = (caddr_t)"";
X }
X}
X
X/*
X -- Convert String To Widget
X*******************************************************************************
X This conversion creates a Widget id from the X resource database string.
X The conversion will fail, and WcFullNameToWidget() will issue a warning,
X if the widget so named has not been created when this converter is called.
X For example, if a widget refers to itself for some reason, during
X its creation when this converter is called, it is not yet created:
X therefore, the converter will fail.
X*/
X
Xvoid XmuCvtStringToWidget (args, num_args, fromVal, toVal)
X XrmValue *args;
X Cardinal *num_args;
X XrmValue *fromVal;
X XrmValue *toVal;
X{
X toVal->addr =
X (caddr_t) WcFullNameToWidget( WcRootWidget(NULL), fromVal->addr);
X toVal->size = sizeof(Widget);
X}
X
X/*
X*******************************************************************************
X* Public_function_declarations.
X*******************************************************************************
X*/
X
X/*
X -- Add String To ... Convertors
X*******************************************************************************
X*/
X
Xvoid WcAddConverters ( app )
X XtAppContext app;
X{
X ONCE_PER_XtAppContext( app );
X
X XtAddConverter (XtRString,
X WcRClassPtr,
X CvtStringToClassPtr,
X (XtConvertArgList)NULL,
X (Cardinal)0);
X
X XtAddConverter (XtRString,
X WcRClassName,
X CvtStringToClassName,
X (XtConvertArgList)NULL,
X (Cardinal)0);
X
X XtAddConverter (XtRString,
X WcRConstructor,
X CvtStringToConstructor,
X (XtConvertArgList)NULL,
X (Cardinal)0);
X
X XtAddConverter (XtRString,
X XtRCallback,
X CvtStringToCallback,
X (XtConvertArgList)NULL,
X (Cardinal)0);
X
X XtAddConverter (XtRString,
X XtRWidget,
X XmuCvtStringToWidget,
X (XtConvertArgList)NULL,
X (Cardinal)0);
X}
END_OF_FILE
if test 21715 -ne `wc -c <'xrainbow/Wc1_05/Wc/WcConvert.c'`; then
echo shar: \"'xrainbow/Wc1_05/Wc/WcConvert.c'\" unpacked with wrong size!
fi
# end of 'xrainbow/Wc1_05/Wc/WcConvert.c'
fi
if test -f 'xrainbow/Wc1_05/Wc/WcCreate.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xrainbow/Wc1_05/Wc/WcCreate.c'\"
else
echo shar: Extracting \"'xrainbow/Wc1_05/Wc/WcCreate.c'\" \(27716 characters\)
sed "s/^X//" >'xrainbow/Wc1_05/Wc/WcCreate.c' <<'END_OF_FILE'
X/*
X** Copyright (c) 1990 David E. Smyth
X**
X** This file was derived from work performed by Martin Brunecky at
X** Auto-trol Technology Corporation, Denver, Colorado, under the
X** following copyright:
X**
X*******************************************************************************
X* Copyright 1990 by Auto-trol Technology Corporation, Denver, Colorado.
X*
X* All Rights Reserved
X*
X* Permission to use, copy, modify, and distribute this software and its
X* documentation for any purpose and without fee is hereby granted, provided
X* that the above copyright notice appears on all copies and that both the
X* copyright and this permission notice appear in supporting documentation
X* and that the name of Auto-trol not be used in advertising or publicity
X* pertaining to distribution of the software without specific, prior written
X* permission.
X*
X* Auto-trol disclaims all warranties with regard to this software, including
X* all implied warranties of merchantability and fitness, in no event shall
X* Auto-trol be liable for any special, indirect or consequential damages or
X* any damages whatsoever resulting from loss of use, data or profits, whether
X* in an action of contract, negligence or other tortious action, arising out
X* of or in connection with the use or performance of this software.
X*******************************************************************************
X**
X** Redistribution and use in source and binary forms are permitted
X** provided that the above copyright notice and this paragraph are
X** duplicated in all such forms and that any documentation, advertising
X** materials, and other materials related to such distribution and use
X** acknowledge that the software was developed by David E. Smyth. The
X** name of David E. Smyth may not be used to endorse or promote products
X** derived from this software without specific prior written permission.
X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
X** WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
X** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X**
X*/
X
X/*
X* SCCS_data: @(#)WcCreate.c 1.1 ( 19 Nov 90 )
X*
X* Subsystem_group:
X*
X* Widget Creation Library
X*
X* Module_description:
X*
X* This module contains the functions used to create and manage
X* a widget tree using the Xrm database.
X
X* The Xrm database format used to prescribe widget's children
X* is as follows:
X*
X* ...parent.wcChildren: childName1, childName2, ...
X*
X* The type of each child must be specified. There are three
X* ways of doing this: (1) by widget class (class pointer name),
X* (2) by widget class name, and (3) by widget constructor
X* function name. The resource value given is case insensitive,
X* although one is encouraged to use the capitalization given
X* in the reference manuals simply on stylistic grounds. The
X* three examples below are effectively equivalent:
X*
X* ...drawing.wcClass: xmDrawingAreaWidgetClass
X* ...drawing.wcClassName: XmDrawingArea
X* ...drawing.wcConstructor: XmCreateDrawingArea
X*
X* Since there are multiple ways of specifying the widget type,
X* a precedence is defined: wcClass is the highest precedence,
X* and wcClass > wcClassName > wcConstructor.
X*
X* Currently, the Motif widget set defines many constructors, such
X* as XmCreateForm or XmCreateFileSelectionBox. Constructors are
X* somtimes called Convenience Functions or even Confusion Functions.
X* It is highly recommended that you use the WcTrace resource when
X* first using Constructors in order to see the resulting widget
X* heirarchy more clearly. The WcTrace resource is specified as:
X*
X* ...drawing.wcTrace: True
X
X* By default, all widgets created from the Xrm resource database
X* are managed. In some cases, this is not what is desired: for
X* example, pop-up menus are generally not managed when they are
X* created, rather they are managed due to some mouse event. In
X* such cases, the WcManaged resource should be set False, as below:
X*
X* *fileMenu.wcManaged: False
X
X* It is possible to bind one or more callback functions to the
X* creation of a widget by using the WcCallback resource. For
X* example, using the Motif widget set, when a menu bar is created
X* as a child of an XmMainWindow, the menuBar resource of the
X* XmMainWindow needs to be set to refer to the menu bar. For
X* example:
X*
X* App.main.wcClassName: XmMainWindow
X* App.main.wcChildren: mbar
X* *mbar.wcConstructor: XmCreateMenuBar
X* *mbar.wcCallback: WcSetResourceCB( *main.menuBar: this)
X
X* Sometimes widget heirarchies are dynamic: many of the widgets
X* are created at initialization time, but others need to be created
X* at run time. Simply do not include the names of the dynamic
X* created widgets in any wcChildren resource. They will then still
X* be defined in the Xrm database, but they will not be created
X* during the initial widget tree creation.
X
X* The WcDeferred resource is an obsolete mechanism which should no
X* longer be used.
X
X* For example, let's say your interface includes a box world, where
X* the user can create an arbitrary number of various types of boxes:
X
X* *box_world.wcClass: MyBoxWorldWidgetClass
X*
X* *box_type1.wcClass: MyBoxType1WidgetClass
X* *box_type2.wcClass: MyBoxType2WidgetClass
X* *box_type3.wcClass: MyBoxType3WidgetClass
X* *box_type3.wcChildren: child1, child2, child3, child4
X*
X* *button1.callback: WcCreateChildrenCB( *box_world, box_type1 )
X* *button2.callback: WcCreateChildrenCB( *box_world, box_type2 )
X* *button3.callback: WcCreateChildrenCB( *box_world, box_type3 )
X*
X* Initially, when box_world is created, it will have no children.
X* Each time button1 is pressed, another instance of box_type1 will
X* be created as a child of box_world, and managed (since wcManaged
X* is by default True). Similarly, everytime button2 is pressed
X* another box_type2 will be created, and everytime button3 is
X* pressed another box_type3 will be created, along with children
X* named child1, child2, child3, and child4, and their children as
X* applicable.
X
X* User interfaces are often rather complex. Since the Widget
X* Creation Library allows much more of the interface to be
X* specified in resource files than in prehistoric days of
X* Widget application programming, it becomes necessary to allow
X* interfaces to be specified in a collection of resource files.
X*
X* It is very desirable that anything in the interface can be
X* tailored by the user. Therefore, each resource filename
X* loaded to describe an interface must be searched for in
X* all the locations defined by the Xt Intrinsics. This is
X* exactly the same as the initial resource file.
X*
X* Since a resource file may override any of the resources on
X* a given widget, including other creation resources, the
X* resource file name is first fetched before any of the other
X* wc* resources.
X*
X* A resource file name is specified as follows:
X*
X* *menuBar.wcResFile: MenuBar
X*
X* Each of the standard directories will be searched in order
X* for a file named MenuBar, and each merged into the resource database.
X
X* The following is the complete set of resources which are
X* interpreted by the Widget Creation Library:
X*
X* ...widget.wcChildren: childName1, childName2, ...
X* ...widget.wcClass: classPointerName
X* ...widget.wcClassName: className
X* ...widget.wcConstructor: constructorFunctionName
X* ...widget.wcTrace: true/false (default = false)
X* ...widget.wcManaged: true/false (default = true)
X* ...widget.wcCallback: callback1(args), callback2(args), ...
X* ...widget.wcResFile: filename
X*
X* In all cases, the Widget Creation resource names can be
X* specified as Wc<name> or wc<name>, with the capitalized
X* form having looser binding (representing the resource class).
X
X* Example:
X*
X* HelloWorld.wcChildren: push
X*
X* *push.wcClass: xmPushButtonWidgetClass
X* *push.labelString: Hello World
X* *push.activateCallback: WcExitCB(1)
X
X* Since (for portability reasons) we can not assume runtime binding,
X* all widget classes or creation routines (constructors) must be
X* "registered" by the application BEFORE widget tree creation.
X*
X* The widget tree creation is performed by the WcCreateDatabaseChild()
X* function, which descends the widget tree recursively until no more
X* children are found, or a non-composite widget/object is found.
X*
X* Several convenience callbacks are provided with the package, allowing
X* deferred widget creation, control (manage/unmanage) and other utility
X* functions. These are found in WcCallb.c
X*
X* Module_history:
X
X* mm/dd/yy initials function action
X* -------- -------- -------- ---------------------------------------------
X* 13Aug90 D.Smyth Got rid of WcDefered stuff
X* 11Jul90 D.Smyth Added wcResFile resource
X* 30Jun90 R.Whitby WcWidgetCreation added call to WcRegisterWcActions
X* 19Jun90 D.Smyth Version 1.0
X* 04/18/90 MarBru many.. Changed w->core.name to XrmQuarkToString...
X* 03/27/90 MarBru Creation Converted to a completely new syntax
X* 02/16/90 MarBru Create.. Limited creation to composite widgets/objects
X*
X* Design_notes:
X*
X*******************************************************************************
X*/
X/*
X*******************************************************************************
X* Include_files.
X*******************************************************************************
X*/
X
X/* -- Operating system includes */
X#include <stdio.h>
X
X/* -- X Window System includes */
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X
X/* -- Widget Creation Includes */
X#include "WcCreate.h"
X#include "WcCreateP.h"
X
X/*
X*******************************************************************************
X* Private_data_definitions.
X*******************************************************************************
X*/
X
Xstatic char msg[MAX_ERRMSG];
X
X/* -- Creation resources
X NOTE: All resource values are fetched at once, but if WcResFile
X is specified, then the resource files must be loaded and then
X the resources re-fetched. This is an optimization: usually
X WcResFile is not specified, so two fetches from the Xrm database
X do not need to be done in the normal case. If resource files are
X loaded and the resources are re-fetched, WcResFile is ignored.
X NOTE: The WcClass and WcClassName resources are both converted to
X a class pointer, as we can construct useful error messages using:
X class->core_class.class_name
X However, the Constructor must be the entire constructor cache
X record so we have the name of the constructor for the error
X messages.
X NOTE: WcClass and WcClassName write to different ResourceRec
X members, so we can provide better error messages.
X*/
X
XXtResource wc_resources[] =
X {
X { WcNwcResFile, WcCWcResFile, XtRString, sizeof(String),
X XtOffset(ResourceRecPtr, resFile ), XtRImmediate, (caddr_t) NULL
X },
X { WcNwcChildren, WcCWcChildren, XtRString, sizeof(String),
X XtOffset(ResourceRecPtr, children ), XtRImmediate, (caddr_t) NULL
X },
X { WcNwcPopups, WcCWcPopups, XtRString, sizeof(String),
X XtOffset(ResourceRecPtr, popups ), XtRImmediate, (caddr_t) NULL
X },
X { WcNwcClass, WcCWcClass, WcRClassPtr, sizeof(caddr_t),
X XtOffset(ResourceRecPtr, class ), XtRImmediate, (caddr_t) NULL
X },
X { WcNwcClassName, WcCWcClassName, WcRClassName, sizeof(caddr_t),
X XtOffset(ResourceRecPtr, classFromName ), XtRImmediate, (caddr_t) NULL
X },
X { WcNwcConstructor, WcCWcConstructor, WcRConstructor, sizeof(caddr_t),
X XtOffset(ResourceRecPtr, constructor ), XtRImmediate, (caddr_t) NULL
X },
X { WcNwcManaged, WcCWcManaged, XtRBoolean, sizeof(Boolean),
X XtOffset(ResourceRecPtr, managed), XtRImmediate, (caddr_t) TRUE
X },
X { WcNwcTrace, WcCWcTrace, XtRBoolean, sizeof(Boolean),
X XtOffset(ResourceRecPtr, trace), XtRImmediate, (caddr_t) FALSE
X },
X { WcNwcCallback, WcCWcCallback, XtRCallback, sizeof(XtCallbackList),
X XtOffset(ResourceRecPtr, callback ), XtRImmediate, (caddr_t) NULL
X }
X };
X
X/*
X*******************************************************************************
X* Private_function_declarations.
X*******************************************************************************
X*/
X
X#define TRACE_CREATION 1
X#define TRACE_POPUP 2
X
X#ifdef FUNCTION_PROTOTYPES
Xstatic void GetWcResources( ResourceRec*, Widget, char* nm, char* class );
Xstatic int DuplicateType ( ResourceRec*, Widget, char* nm, char* callr );
Xstatic Widget CreateWidget ( ResourceRec*, Widget, char* nm, char* callr );
Xstatic Widget CreatePopup ( ResourceRec*, Widget, char* nm, char* callr );
Xstatic void CreationWarningMessage ( ResourceRec* rp, Widget pw,
X char* name, char* caller, char* func );
Xstatic void PrintCreationTrace ( ResourceRec*, Widget child, int traceTyp );
Xstatic void CallCreationCallbacks( ResourceRec*, Widget child );
X#else
Xstatic void GetWcResources();
Xstatic int DuplicateType();
Xstatic Widget CreateWidget();
Xstatic Widget CreatePopup();
Xstatic void CreationWarningMessage();
Xstatic void PrintCreationTrace();
Xstatic void CallCreationCallbacks();
X#endif
X
X/*
X*******************************************************************************
X* Public_function_declarations.
X*******************************************************************************
X*/
X
X/*
X -- Create Widget Tree from Xrm Database
X*******************************************************************************
X This routine creates widget children as defined in Xrm database.
X It checks the widget resource "WcChildren", which is a list of
X names of children to create. Each child must then be further defined
X in the databse.
X
X This function is frequently called from an application's main()
X procedure after the application shell is created via XtInitialize().
X
X Note that this function registers the converters for StringToWidget,
X StringToCallback, and so forth.
X*/
X
Xvoid WcWidgetCreation ( root )
X Widget root;
X{
X XtAppContext app = XtWidgetToApplicationContext( root );
X char* fullName = WcWidgetToFullName( root ); /* must be XtFree'd */
X ResourceRec res;
X
X /* register the root of this widget */
X (void)WcRootWidget(root);
X
X /* register the Xt standard widgets */
X WcRegisterIntrinsic ( app );
X
X /* register the Wc converters */
X WcAddConverters( app );
X
X /* register the Wc callbacks */
X WcRegisterWcCallbacks ( app );
X
X /* register the Wc actions */
X WcRegisterWcActions ( app );
X
X if ( XtIsSubclass( root, compositeWidgetClass ) )
X {
X XtGetApplicationResources ( root, &res,
X wc_resources, XtNumber(wc_resources), NULL, 0 );
X
X if ( res.popups || res.children )
X {
X if ( res.popups )
X WcCreateNamedPopups ( root, res.popups );
X if ( res.children )
X WcCreateNamedChildren ( root, res.children );
X }
X else
X {
X sprintf( msg,
X "WcWidgetCreation (%s) - Failed \n\
X Problem: No children defined in Xrm database.\n\
X Possible: resource file not found (XENVIRONEMENT not set?), \n\
X Possible: top level widget in resource file not named %s",
X fullName, root->core.name );
X XtWarning( msg );
X }
X }
X
X else
X {
X sprintf( msg,
X "WcWidgetCreation (%s) - Failed \n\
X Problem: %s is not a composite widget, cannot have children.",
X fullName, fullName );
X XtWarning( msg );
X }
X
X XtFree ( fullName );
X}
X
X/*
X -- Create And Manage Named Children from Xrm Database
X*******************************************************************************
X This function creates widget's children specified by names list,
X by calling WcCreateDatabaseChild() for each of the names provided.
X
X All the children are then managed, unless WcManaged resource is FALSE.
X
X Note that widgets created by WcCreateDatabaseChild may or may not
X be children of `pw' due to the use of constructors. Only children
X of `pw' may be managed via a call to XtManageChildren(). Other
X widgets must be managed individually. Usually, these widgets
X are created by the XmCreateScrolled*() or XmCreate*Dialog confusion
X functions.
X*/
X
Xvoid WcCreateNamedChildren ( pw, names )
X Widget pw; /* children's parent */
X char* names; /* (list of) widget names to create */
X{
X Widget child;
X int children = 0;
X Widget widget_children[MAX_CHILDREN];
X int other = 0;
X Widget widget_other[MAX_CHILDREN];
X char cleanName[MAX_XRMSTRING];
X char* next;
X int managed;
X int i;
X
X if ( !names ) return;
X
X next = WcCleanName( names, cleanName );
X
X while ( cleanName[0] )
X {
X child = WcCreateDatabaseChild ( pw, cleanName, &managed );
X if ( child )
X {
X if ( managed && (XtParent( child ) == pw ) )
X widget_children[children++] = child;
X else if ( managed )
X widget_other[other++] = child;
X }
X next = WcSkipWhitespace_Comma( next );
X next = WcCleanName( next, cleanName );
X }
X
X if ( children )
X XtManageChildren( widget_children, children );
X
X for (i = 0 ; i < other ; i++)
X XtManageChild( widget_other[i] );
X}
X
X/*
X -- Create Named Popup Children from Xrm Database
X*******************************************************************************
X This function creates widget's popup children specified by names list,
X by calling WcCreateDatabasePopup() for each of the names provided.
X*/
X
Xvoid WcCreateNamedPopups ( pw, names )
X Widget pw; /* children's parent */
X char* names; /* (list of) names of popup widgets to create */
X{
X Widget child;
X char cleanName[MAX_XRMSTRING];
X char* next;
X
X if ( !names ) return;
X
X next = WcCleanName( names, cleanName );
X
X while ( cleanName[0] )
X {
X child = WcCreateDatabasePopup ( pw, cleanName );
X next = WcSkipWhitespace_Comma( next );
X next = WcCleanName( next, cleanName );
X }
X}
X
X/*
X -- Create Widget from the Resource Database
X*******************************************************************************
X WcCreateDatabaseChild() causes a normal child to be created. This
X implies that the parent widget is a composite widget.
X*/
X
XWidget WcCreateDatabaseChild ( pw, name, managed )
X Widget pw; /* child's parent */
X char* name; /* child name to create */
X int *managed; /* returned T/F: this child to be managed ? */
X{
X ResourceRec res; /* child's creation resources */
X Widget child; /* what we create */
X char* className; /* get after child is created */
X
X *managed = FALSE; /* Assume error */
X
X if ( !XtIsSubclass( pw, compositeWidgetClass ) )
X {
X /* child is not a manager widget, so cannot create children */
X char* parentName = WcWidgetToFullName( pw );
X sprintf( msg,
X "WcCreateDatabaseChild (%s) - children ignored \n\
X Problem: %s is not a composite, cannot have children.",
X parentName, parentName );
X XtWarning( msg );
X XtFree( parentName );
X return (Widget)NULL;
X }
X
X GetWcResources ( &res, pw, name, name );
X if (DuplicateType ( &res, pw, name, "WcCreateDatabaseChild" ))
X return (Widget)NULL;
X
X child = CreateWidget ( &res, pw, name, "WcCreateDatabaseChild" );
X
X /* Now that widget is created, we can get the "class" resources */
X className = child->core.widget_class->core_class.class_name;
X GetWcResources ( &res, pw, name, className );
X
X if (res.trace)
X PrintCreationTrace ( &res, child, TRACE_CREATION );
X if (res.callback)
X CallCreationCallbacks ( &res, child );
X
X if (res.popups)
X WcCreateNamedPopups ( child, res.popups );
X if (res.children)
X WcCreateNamedChildren ( child, res.children );
X
X *managed = res.managed;
X return child;
X}
X
X/*
X -- Create Popup Widget from the Resource Database
X*******************************************************************************
X WcCreateDatabasePopup() causes a popup widget to be created. Any
X widget can have popup chidren.
X*/
X
XWidget WcCreateDatabasePopup ( pw, name )
X Widget pw; /* child's parent */
X char* name; /* child name to create */
X{
X ResourceRec res; /* child's creation resources */
X Widget child; /* what we create */
X char* className; /* get after child is created */
X
X GetWcResources ( &res, pw, name, name );
X if (DuplicateType ( &res, pw, name, "WcCreateDatabasePopup" ))
X return (Widget)NULL;
X
X child = CreatePopup ( &res, pw, name, "WcCreateDatabasePopup" );
X
X /* Now that widget is created, we can get the "class" resources */
X className = child->core.widget_class->core_class.class_name;
X GetWcResources ( &res, pw, name, className );
X
X if (res.trace)
X PrintCreationTrace ( &res, child, TRACE_POPUP );
X if (res.callback)
X CallCreationCallbacks ( &res, child );
X
X if (res.popups)
X WcCreateNamedPopups ( child, res.popups );
X if (res.children)
X WcCreateNamedChildren ( child, res.children );
X
X return child;
X}
X
X/*
X*******************************************************************************
X** Private functions used by WcCreateDatabaseChild and WcCreateDatabasePopup
X*******************************************************************************
X*/
X
X/*
X -- Get Wc* Resources for named child of pw from Xrm resource database
X*******************************************************************************
X*/
X
Xstatic void GetWcResources( rp, pw, name, className )
X ResourceRec* rp;
X Widget pw;
X char* name;
X char* className;
X{
X /* Get creation resources for the child to be created.
X ** After this XtGetSubresources() call, the resource structure `res'
X ** contains resources specified in the Xrm database or the defaults.
X */
X XtGetSubresources ( pw, rp, name, className,
X wc_resources, XtNumber(wc_resources), NULL, 0 );
X
X /* if a resource file is specified for this widget, first
X ** load the resource file, then re-fetch the resources.
X ** Notice that we don't check for resFile again.
X */
X if ( rp->resFile )
X {
X WcLoadResourceFileCB ( pw, rp->resFile, NULL );
X XtGetSubresources ( pw, rp, name, className,
X wc_resources, XtNumber(wc_resources), NULL, 0 );
X }
X}
X
X/*
X -- See if duplicate type resources are specified for this widget
X*******************************************************************************
X Exactly one of WcClass, WcClassName, or WcConstructor must be
X specified in order to create a widget. If none are specified,
X or if more than one is specified, then this is an error, and
X this function returns TRUE, and the widget should not then be
X created.
X*/
X
Xstatic int DuplicateType( rp, pw, name, caller )
X ResourceRec* rp;
X Widget pw;
X char* name;
X char* caller;
X{
X /* Booleans */
X int class = (NULL != rp->class);
X int className = (NULL != rp->classFromName);
X int constructor = (NULL != rp->constructor);
X char* reason;
X char* parentName;
X
X if ( class + className + constructor == 0 )
X reason = "No WcClass, WcClassName, nor WcConstructor";
X
X else if ( class + className + constructor == 3 )
X reason = "WcClass, WcClassName, and WcConstructor";
X
X else if ( class + className == 2 )
X reason = "WcClass and WcClassName";
X
X else if ( class + constructor == 2 )
X reason = "WcClass and WcConstructor";
X
X else if ( className + constructor == 2 )
X reason = "WcClassName and WcConstructor";
X
X else
X return 0; /* OK */
X
X parentName = WcWidgetToFullName( pw );
X sprintf( msg,
X "%s (%s.%s) - Failed (Ambiguous) \n\
X Problem: %s specified, \n\
X child %s.%s not created.",
X caller, parentName, name,
X reason,
X parentName, name );
X XtWarning( msg );
X XtFree( parentName );
X return 1;
X}
X
X/*
X -- Create child widget using XtCreateWidget or constructor
X*******************************************************************************
X*/
X
Xstatic Widget CreateWidget ( rp, pw, name, caller )
X ResourceRec* rp;
X Widget pw;
X char* name;
X char* caller;
X{
X Widget child;
X
X if ( rp->class )
X child = XtCreateWidget ( name, rp->class, pw, NULL, 0 );
X else if ( rp->classFromName )
X child = XtCreateWidget ( name, rp->classFromName , pw, NULL, 0 );
X else /* rp->constructor */
X child = rp->constructor->constructor( pw, name, NULL, 0 );
X
X if (child)
X return child;
X CreationWarningMessage( rp, pw, name, caller, "XtCreateWidget" );
X return (Widget)NULL;
X}
X
X/*
X -- Create child widget using XtCreateWidget or constructor
X*******************************************************************************
X*/
X
Xstatic Widget CreatePopup ( rp, pw, name, caller )
X ResourceRec* rp;
X Widget pw;
X char* name;
X char* caller;
X{
X Widget child;
X
X if ( rp->class )
X child = XtCreatePopupShell ( name, rp->class, pw, NULL, 0 );
X else if ( rp->classFromName )
X child = XtCreatePopupShell ( name, rp->classFromName , pw, NULL, 0 );
X else /* rp->constructor */
X child = rp->constructor->constructor( pw, name, NULL, 0 );
X
X if (child)
X return child;
X CreationWarningMessage( rp, pw, name, caller, "XtCreatePopupShell" );
X return (Widget)NULL;
X}
X
X/*
X -- Print warning message when CreateWidget or CreatePopup fail
X*******************************************************************************
X*/
X
Xstatic void CreationWarningMessage ( rp, pw, name, caller, func )
X ResourceRec* rp;
X Widget pw;
X char* name;
X char* caller;
X char* func;
X{
X char* parentName = WcWidgetToFullName( pw );
X static char funcWithArgs[1024];
X
X if ( rp->class || rp->classFromName )
X {
X sprintf( funcWithArgs, "%s( %s, %s )",
X func, name, rp->class->core_class.class_name );
X }
X else /* rp->constructor */
X {
X sprintf( funcWithArgs, "%s( %s )", rp->constructor->name, name );
X }
X
X sprintf( msg,
X "%s (%s.%s) - Failed \n\
X Problem: %s failed.",
X caller, parentName, name,
X funcWithArgs );
X
X XtWarning( msg );
X XtFree( parentName );
X}
X
X/*
X -- Print creation trace message
X*******************************************************************************
X*/
X
Xstatic void PrintCreationTrace( rp, child, traceType )
X ResourceRec* rp;
X Widget child;
X int traceType;
X{
X char* childName = WcWidgetToFullName( child );
X char* trace;
X
X if (traceType == TRACE_CREATION)
X trace = (rp->managed) ? " managed" : "unmanaged";
X else
X trace = " pop-up";
X
X fprintf(stderr,"Wc %s: %s of class %s\n",
X trace,
X childName,
X child->core.widget_class->core_class.class_name);
X
X XtFree( childName );
X}
X
X/*
X -- Call creation time callbacks specified by WcCallbacks resource.
X*******************************************************************************
X*/
X
Xstatic void CallCreationCallbacks( rp, child )
X ResourceRec* rp;
X Widget child;
X{
X XtCallbackRec *cb = rp->callback;
X for ( ; cb->callback; cb++ )
X (*cb->callback)( child, cb->closure, NULL );
X}
END_OF_FILE
if test 27716 -ne `wc -c <'xrainbow/Wc1_05/Wc/WcCreate.c'`; then
echo shar: \"'xrainbow/Wc1_05/Wc/WcCreate.c'\" unpacked with wrong size!
fi
# end of 'xrainbow/Wc1_05/Wc/WcCreate.c'
fi
if test -f 'xrainbow/Wc1_05/Wc/WcCreate.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xrainbow/Wc1_05/Wc/WcCreate.h'\"
else
echo shar: Extracting \"'xrainbow/Wc1_05/Wc/WcCreate.h'\" \(7512 characters\)
sed "s/^X//" >'xrainbow/Wc1_05/Wc/WcCreate.h' <<'END_OF_FILE'
X/*
X** Copyright (c) 1990 David E. Smyth
X**
X** This file was derived from work performed by Martin Brunecky at
X** Auto-trol Technology Corporation, Denver, Colorado, under the
X** following copyright:
X**
X*******************************************************************************
X* Copyright 1990 by Auto-trol Technology Corporation, Denver, Colorado.
X*
X* All Rights Reserved
X*
X* Permission to use, copy, modify, and distribute this software and its
X* documentation for any purpose and without fee is hereby granted, provided
X* that the above copyright notice appears on all copies and that both the
X* copyright and this permission notice appear in supporting documentation
X* and that the name of Auto-trol not be used in advertising or publicity
X* pertaining to distribution of the software without specific, prior written
X* permission.
X*
X* Auto-trol disclaims all warranties with regard to this software, including
X* all implied warranties of merchantability and fitness, in no event shall
X* Auto-trol be liable for any special, indirect or consequential damages or
X* any damages whatsoever resulting from loss of use, data or profits, whether
X* in an action of contract, negligence or other tortious action, arising out
X* of or in connection with the use or performance of this software.
X*******************************************************************************
X**
X** Redistribution and use in source and binary forms are permitted
X** provided that the above copyright notice and this paragraph are
X** duplicated in all such forms and that any documentation, advertising
X** materials, and other materials related to such distribution and use
X** acknowledge that the software was developed by David E. Smyth. The
X** name of David E. Smyth may not be used to endorse or promote products
X** derived from this software without specific prior written permission.
X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
X** WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
X** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X**
X*/
X
X/*
X* SCCS_data: @(#)WcCreate.h 1.1 ( 19 Nov 90 )
X*
X* Include_name:
X*
X* WcCreate.h
X*
X* Subsystem_group:
X*
X* Widget Creation Library
X*
X* Include_description:
X*
X* Public defines for the Widget Creation Library supporting widget
X* tree creation from the Xrm database.
X*
X* Include_history:
X*
X* mm/dd/yy initials action
X* -------- -------- -------------------------------------------------------
X* 07/16/90 D.Smyth added WcAllowDuplicate*Reg... decls
X* 06/30/90 R.Whitby added WcRegisterWcActions declaration
X* 06/19/90 D.Smyth Widget Creation Library version 1.0 Release
X* 04/04/90 marbru updated, added new callbacks
X* 03/27/90 marbru updated for new names
X* 03/02/90 marbru created
X*
X*******************************************************************************
X*/
X#ifndef _WcCreate_h
X#define _WcCreate_h
X
X/*
X#include <X11/IntrinsicP.h>
X#include <X11/CoreP.h>
X#include <X11/ObjectP.h>
X*/
X
X#ifdef FUNCTION_PROTOTYPES
X/****************************** ANSI FUNC DECLS ******************************/
X
X#define APP XtAppContext
X#define EV extern void
X#define EW extern Widget
X#define EC extern char*
X
X/* -- Widget class, constructor, and callback proc registration routines */
X
XEV WcRegisterClassPtr (APP, char* name, WidgetClass class);
XEV WcRegisterClassName (APP, char* name, WidgetClass class);
XEV WcRegisterConstructor(APP, char* name, Widget(*constructor) () );
XEV WcRegisterCallback (APP, char* CBname, XtCallbackProc, caddr_t defCliData);
XEV WcRegisterAction (APP, char* name, XtActionProc proc );
XEV WcRegisterWcCallbacks(APP );
X
X/* -- Allow duplicate registration of classes, constructors, and callbacks */
X
XEV WcAllowDuplicateRegistration ( int allowed );
XEV WcAllowDuplicateClassPtrReg ( int allowed );
XEV WcAllowDuplicateClassNameReg ( int allowed );
XEV WcAllowDuplicateConstructorReg ( int allowed );
XEV WcAllowDuplicateCallbackReg ( int allowed );
X
X/* -- Widget action registration routine */
X
XEV WcRegisterWcActions ( APP );
X
X/* -- Widget creation routines */
X
XEV WcWidgetCreation ( Widget root );
XEV WcCreateNamedChildren ( Widget parent, char* names );
XEV WcCreateNamedPopups ( Widget parent, char* names );
XEW WcCreateDatabaseChild ( Widget parent, char* name, int* managed );
XEW WcCreateDatabasePopup ( Widget parent, char* name );
X
X/* -- Widget name routines
X** The character buffer returned by WcNamesToWidgetList contains the
X** names which could not be converted to widgets. This buffer is static,
X** so its contents are changed everytime WcNamesToWidgetList is called.
X** The character buffer returned by WcWidgetToFullName must be XtFree'd
X** by the caller.
X*/
X
XEW WcChildNameToWidget ( Widget w, char* childName );
XEW WcFullNameToWidget ( Widget w, char* name );
XEC WcNamesToWidgetList ( Widget, char* names, Widget widgetList[], int* count);
XEC WcWidgetToFullName ( Widget w );
X
X/* -- Useful for argument parsing */
X
XEC WcLowerCaseCopy ( char* in ); /* caller frees buf */
XEC WcSkipWhitespace ( char* cp );
XEC WcSkipWhitespace_Comma ( char* cp );
XEC WcCleanName ( char* in, char* out ); /* out[] must exist */
XEC WcStripWhitespaceFromBothEnds (char* name ); /* caller frees buf */
X
XEC WcGetResourceType ( Widget, char* rName ); /* caller frees buf */
XEV WcSetValueFromString ( Widget, char* rName, char* rVal );
XEV WcSetValueFromStringAndType( Widget, char* rName, char* rVal, char* rType );
X
XEC WcStrStr( char* searchThis, char* forThisPattern ); /* like ANSI strstr */
X
X#undef APP
X#undef EV
X#undef EW
X#undef EC
X
X#else
X/**************************** NON-ANSI FUNC DECLS ****************************/
X
X/* -- Widget constructor registration routine */
X
Xextern void WcRegisterClassPtr ();
Xextern void WcRegisterClassName ();
Xextern void WcRegisterConstructor ();
Xextern void WcRegisterCallback ();
Xextern void WcRegisterAction ();
Xextern void WcRegisterWcCallbacks ();
X
X/* -- Allow duplicate registration of classes, constructors, and callbacks */
X
Xextern void WcAllowDuplicateRegistration ();
Xextern void WcAllowDuplicateClassPtrReg ();
Xextern void WcAllowDuplicateClassNameReg ();
Xextern void WcAllowDuplicateConstructorReg ();
Xextern void WcAllowDuplicateCallbackReg ();
X
X/* -- Widget action registration routine */
X
Xextern void WcRegisterWcActions ();
X
X/* -- Widget creation routines */
X
Xextern void WcWidgetCreation ();
Xextern void WcCreateNamedChildren ();
Xextern void WcCreateNamedPopups ();
Xextern Widget WcCreateDatabaseChild ();
Xextern Widget WcCreateDatabasePopup ();
X
X/* -- Widget name routine */
X
Xextern Widget WcChildNameToWidget ();
Xextern Widget WcFullNameToWidget ();
Xextern char* WcNamesToWidgetList (); /* rets: names not converted */
Xextern char* WcWidgetToFullName (); /* ret'd buff must be free'd */
X
Xextern char* WcLowerCaseCopy (); /* ret'd buff must be free'd */
Xextern char* WcSkipWhitespace ();
Xextern char* WcSkipWhitespace_Comma ();
Xextern char* WcCleanName ();
Xextern char* WcStripWhitespaceFromBothEnds (); /* ret'd buff must be free'd */
X
Xextern char* WcGetResourceType (); /* ret'd buff must be free'd */
Xextern void WcSetValueFromString ();
Xextern void WcSetValueFromStringAndType ();
X
Xextern char* WcStrStr (); /* same as ANSI strstr() */
X
X#endif /* FUNCTION_PROTOTYPES */
X
X#endif /* _WcCreate_h */
END_OF_FILE
if test 7512 -ne `wc -c <'xrainbow/Wc1_05/Wc/WcCreate.h'`; then
echo shar: \"'xrainbow/Wc1_05/Wc/WcCreate.h'\" unpacked with wrong size!
fi
# end of 'xrainbow/Wc1_05/Wc/WcCreate.h'
fi
if test -f 'xrainbow/Wc1_05/Wc/WcCreateP.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xrainbow/Wc1_05/Wc/WcCreateP.h'\"
else
echo shar: Extracting \"'xrainbow/Wc1_05/Wc/WcCreateP.h'\" \(15619 characters\)
sed "s/^X//" >'xrainbow/Wc1_05/Wc/WcCreateP.h' <<'END_OF_FILE'
X/*
X** Copyright (c) 1990 David E. Smyth
X**
X** This file was derived from work performed by Martin Brunecky at
X** Auto-trol Technology Corporation, Denver, Colorado, under the
X** following copyright:
X**
X*******************************************************************************
X* Copyright 1990 by Auto-trol Technology Corporation, Denver, Colorado.
X*
X* All Rights Reserved
X*
X* Permission to use, copy, modify, and distribute this software and its
X* documentation for any purpose and without fee is hereby granted, provided
X* that the above copyright notice appears on all copies and that both the
X* copyright and this permission notice appear in supporting documentation
X* and that the name of Auto-trol not be used in advertising or publicity
X* pertaining to distribution of the software without specific, prior written
X* permission.
X*
X* Auto-trol disclaims all warranties with regard to this software, including
X* all implied warranties of merchantability and fitness, in no event shall
X* Auto-trol be liable for any special, indirect or consequential damages or
X* any damages whatsoever resulting from loss of use, data or profits, whether
X* in an action of contract, negligence or other tortious action, arising out
X* of or in connection with the use or performance of this software.
X*******************************************************************************
X**
X** Redistribution and use in source and binary forms are permitted
X** provided that the above copyright notice and this paragraph are
X** duplicated in all such forms and that any documentation, advertising
X** materials, and other materials related to such distribution and use
X** acknowledge that the software was developed by David E. Smyth. The
X** name of David E. Smyth may not be used to endorse or promote products
X** derived from this software without specific prior written permission.
X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
X** WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
X** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X**
X*/
X
X/*
X* SCCS_data: @(#)WcCreateP.h 1.1 ( 19 Nov 90 )
X*
X* Include_name:
X*
X* WcCreateP.h
X*
X* Subsystem_group:
X*
X* Widget Creation Library
X*
X* Include_description:
X*
X* Private defines for the Widget Creation Library supporting widget
X* tree creation from the Xrm database.
X*
X* Include_history:
X*
X* mm/dd/yy initials action
X* -------- -------- -------------------------------------------------------
X* 11/14/90 D.Smyth Added popup resources
X* 06/30/90 R.Whitby added Action declarations
X* 05/24/90 D.Smyth created from provate section of WsCreate.h
X* 03/02/90 marbru created
X*
X*******************************************************************************
X*/
X#ifndef _WcCreateP_h
X#define _WcCreateP_h
X
X/*
X*******************************************************************************
X* Private_constant_declarations.
X*******************************************************************************
X*/
X#undef NUL
X#define NUL '\0'
X#define MAX_XRMSTRING 4096 /* max length of the Xrm DB string */
X#define MAX_ERRMSG 1024 /* max length of error message */
X#define MAX_CHILDREN 1024 /* max number of widget's children */
X#define MAX_PATHNAME 1024 /* max length of the pathname */
X#define INCR_REGISTRY 32 /* incr of cl, con, cb registries */
X#define MAX_CALLBACKS 64 /* max callbacks per Xrm resource */
X#define MAX_WIDGETS 512 /* max depth of a widget tree */
X#define MAX_ROOT_WIDGETS 32 /* max # separate widget trees */
X#define MAX_RES_FILES 512 /* max # res file names per interf */
X
X#define WcNwcResFile "wcResFile"
X#define WcNwcChildren "wcChildren"
X#define WcNwcPopups "wcPopups"
X#define WcNwcClass "wcClass"
X#define WcNwcClassName "wcClassName"
X#define WcNwcConstructor "wcConstructor"
X#define WcNwcManaged "wcManaged"
X#define WcNwcTrace "wcTrace"
X#define WcNwcCallback "wcCallback"
X
X#define WcCWcResFile "WcResFile"
X#define WcCWcChildren "WcChildren"
X#define WcCWcPopups "WcPopups"
X#define WcCWcClass "WcClass"
X#define WcCWcClassName "WcClassName"
X#define WcCWcConstructor "WcConstructor"
X#define WcCWcManaged "WcManaged"
X#define WcCWcTrace "WcTrace"
X#define WcCWcCallback "WcCallback"
X
X/* Motif 1.0 has a bug: widgets ask for Windows
X** instead of Widgets for their resources...
X*/
X#define WcRWidget "Window"
X#define WcRClassPtr "ClassPtr"
X#define WcRClassName "ClassName"
X#define WcRConstructor "Constructor"
X/*
X*******************************************************************************
X* Private_type_declarations.
X*******************************************************************************
X*/
X
Xtypedef void (*PtrFuncVoid)(); /* ptr to func returning void */
Xtypedef Widget (*PtrFuncWidget)(); /* ptr to func returning Widget */
X
X/* Registration structs: It is a good idea if the classes, class names,
X** constructors, and callbacks are registered with the same upper & lower
X** case names as the names in the ref manuals and source files, as this
X** makes the user error messages clearer.
X*/
X
Xtypedef struct /* Class cache record */
X{
X String name; /* class ptr name as registered */
X XrmQuark quark; /* quarkified class ptr name */
X WidgetClass class; /* widget class pointer */
X} ClCacheRec;
X
Xtypedef struct /* Class Name cache record */
X{
X String name; /* class name as registered */
X XrmQuark quark; /* quarkified class name */
X WidgetClass class; /* widget class pointer */
X} ClNameCacheRec;
X
Xtypedef struct /* Constructor cache record */
X{
X String name; /* constructor as registered */
X XrmQuark quark; /* quarkified constructor name */
X Widget (*constructor)(); /* constructor function ptr */
X} ConCacheRec;
X
Xtypedef struct /* Callback cache record */
X{
X String name; /* name as registered */
X XrmQuark quark; /* quarkified callback name */
X XtCallbackProc callback; /* callback procedure pointer */
X caddr_t closure; /* default client data */
X} CBCacheRec;
X
Xtypedef struct _ResourceRec
X{
X String resFile; /* additional resource file name */
X String children; /* list of children names to create */
X String popups; /* list of popup children to create */
X WidgetClass class; /* widget class pointer */
X WidgetClass classFromName; /* widget class pointer */
X ConCacheRec* constructor; /* ptr to Constructo cache record */
X Boolean managed; /* created managed (default TRUE) */
X Boolean deferred; /* deferred creation, (def FALSE) */
X Boolean trace; /* creation trace required */
X XtCallbackList callback; /* creation callback list */
X} ResourceRec, *ResourceRecPtr;
X
X/*
X*******************************************************************************
X* Private_macro_definitions.
X*******************************************************************************
X ONCE_PER_XtAppContext(app) should be invoked at the beginning of each
X function which performs registration, like MriRegisterMotif and
X AriRegisterAthena. Note that this IS a macro: therefore, the return
X statement actually causes the return from the registration function.
X*/
X
X#define ONCE_PER_XtAppContext( app ) \
X{ \
X static XtAppContext already[1024]; \
X static int numApps = 0; \
X int i; \
X \
X for (i = 0; i < numApps ; i++) \
X if (app == already[i]) \
X return; \
X \
X already[numApps++] = app; \
X}
X
X/*
X*******************************************************************************
X* Private_data_definitions.
X*******************************************************************************
X The following cache/registry of known widget classes and contructors,
X initially empty, are loaded by the application using "registration"
X routines.
X Assuming small numbers of constructors, the sequential search
X of such cache is (initially) considered acceptable.
X*/
X
X/* -- Named class pointer cache, intially empty */
X
Xextern int classes_num;
Xextern int classes_max;
Xextern ClCacheRec* classes_ptr;
X
X/* -- Class name cache, intially empty */
X
Xextern int cl_nm_num;
Xextern int cl_nm_max;
Xextern ClNameCacheRec* cl_nm_ptr;
X
X/* -- Named object constructor cache, intially empty */
X
Xextern int constrs_num;
Xextern int constrs_max;
Xextern ConCacheRec* constrs_ptr;
X
X/* -- Callback function cache, initially empty */
X
Xextern int callbacks_num;
Xextern int callbacks_max;
Xextern CBCacheRec* callbacks_ptr;
X/* -- Widget Creation resources */
X
Xextern XtResource wc_resources[];
X
X/*
X*******************************************************************************
X* Private_function_declarations.
X*******************************************************************************
X The following functions are generally private functions to the
X WcCreate routines, but they may be defined in different files from
X where they are used. Client programs probably should not invoke
X these functions directly.
X*/
X
X#ifdef FUNCTION_PROTOTYPES
X/****************************** ANSI FUNC DECLS ******************************/
X
X#define EV extern void
X
X/* -- Resource converters */
X
XEV WcAddConverters ( XtAppContext );
XEV CvtStringToClassPtr ( XrmValue*, Cardinal*, XrmValue*, XrmValue* );
XEV CvtStringToClassName ( XrmValue*, Cardinal*, XrmValue*, XrmValue* );
XEV CvtStringToConstructor ( XrmValue*, Cardinal*, XrmValue*, XrmValue* );
XEV CvtStringToCallback ( XrmValue*, Cardinal*, XrmValue*, XrmValue* );
XEV XmuCvtStringToWidget ( XrmValue*, Cardinal*, XrmValue*, XrmValue* );
X
X/* -- Find root widget of argument, remember if never seen before */
X
Xextern Widget WcRootWidget ( Widget );
X
X/* -- Convenience Callbacks - Clients generally invoke these only
X by binding them to widgets via the resource file. They can
X be programmatically bound, but generally should not be.
X*/
X
XEV WcCreateChildrenCB (Widget w, char* parent_children, caddr_t unused );
XEV WcCreatePopupsCB (Widget w, char* parent_children, caddr_t unused );
XEV WcManageCB (Widget w, char* widgetNames, caddr_t unused );
XEV WcUnmanageCB (Widget w, char* widgetNames, caddr_t unused );
XEV WcManageChildrenCB (Widget w, char* parent_children, caddr_t unused );
XEV WcUnmanageChildrenCB (Widget w, char* parent_children, caddr_t unused );
XEV WcDestroyCB (Widget w, char* widgetNames, caddr_t unused );
XEV WcSetValueCB (Widget w, char* name_res_resVal, caddr_t unused );
XEV WcSetTypeValueCB (Widget w, char* nm_res_type_val, caddr_t unused );
XEV WcSetSensitiveCB (Widget w, char* widgetNames, caddr_t unused );
XEV WcSetInsensitiveCB (Widget w, char* widgetNames, caddr_t unused );
XEV WcLoadResourceFileCB (Widget w, char* resFileName, caddr_t unused );
XEV WcTraceCB (Widget w, char* annotation, caddr_t unused );
XEV WcPopupCB (Widget w, char* widgetName, caddr_t unused );
XEV WcPopupGrabCB (Widget w, char* widgetName, caddr_t unused );
XEV WcPopdownCB (Widget w, char* widgetName, caddr_t unused );
XEV WcMapCB (Widget w, char* widgetName, caddr_t unused );
XEV WcUnmapCB (Widget w, char* widgetName, caddr_t unused );
XEV WcSystemCB (Widget w, char* shellCmdString, caddr_t unused );
XEV WcExitCB (Widget w, char* exitValue, caddr_t unused );
X
X/* -- Convenience Actions - Clients generally invoke these only
X by binding them to widgets via the resource file. They can
X be programmatically bound, but generally should not be.
X*/
X
X#define ACT_ARGS Widget w, XEvent *event, String *params, Cardinal *num_params
X
XEV WcCreateChildrenACT ( ACT_ARGS );
XEV WcCreatePopupsACT ( ACT_ARGS );
XEV WcManageACT ( ACT_ARGS );
XEV WcUnmanageACT ( ACT_ARGS );
XEV WcManageChildrenACT ( ACT_ARGS );
XEV WcUnmanageChildrenACT ( ACT_ARGS );
XEV WcDestroyACT ( ACT_ARGS );
XEV WcSetValueACT ( ACT_ARGS );
XEV WcSetTypeValueACT ( ACT_ARGS );
XEV WcSetSensitiveACT ( ACT_ARGS );
XEV WcSetInsensitiveACT ( ACT_ARGS );
XEV WcLoadResourceFileACT ( ACT_ARGS );
XEV WcTraceACT ( ACT_ARGS );
XEV WcPopupACT ( ACT_ARGS );
XEV WcPopupGrabACT ( ACT_ARGS );
XEV WcPopdownACT ( ACT_ARGS );
XEV WcMapACT ( ACT_ARGS );
XEV WcUnmapACT ( ACT_ARGS );
XEV WcSystemACT ( ACT_ARGS );
XEV WcExitACT ( ACT_ARGS );
X
X#undef ACT_ARGS
X#undef EV
X
X#else
X/**************************** NON-ANSI FUNC DECLS ****************************/
X
X/* -- Resource converters */
X
Xextern void WcAddConverters ();
Xextern void CvtStringToClassPtr ();
Xextern void CvtStringToClassName ();
Xextern void CvtStringToConstructor ();
Xextern void CvtStringToCallback ();
Xextern void XmuCvtStringToWidget (); /* note naming! replace Xmu... */
X
X/* -- Find root widget of argument, remember if never seen before */
X
Xextern Widget WcRootWidget ();
X
X/* -- Convenience Callbacks - Clients generally invoke these only
X by binding them to widgets via the resource file. They can
X be programmatically bound, but generally should not be.
X*/
X
Xextern void WcCreateChildrenCB ();
Xextern void WcCreatePopupsCB ();
Xextern void WcManageCB ();
Xextern void WcUnmanageCB ();
Xextern void WcManageChildrenCB ();
Xextern void WcUnmanageChildrenCB ();
Xextern void WcDestroyCB ();
Xextern void WcSetValueCB ();
Xextern void WcSetTypeValueCB ();
Xextern void WcSetSensitiveCB ();
Xextern void WcSetInsensitiveCB ();
Xextern void WcLoadResourceFileCB ();
Xextern void WcTraceCB ();
Xextern void WcPopupCB ();
Xextern void WcPopupGrabCB ();
Xextern void WcPopdownCB ();
Xextern void WcMapCB ();
Xextern void WcUnmapCB ();
Xextern void WcSystemCB ();
Xextern void WcExitCB ();
X
X/* -- Convenience Actions - Clients generally invoke these only
X by binding them to widgets via the resource file. They can
X be programmatically bound, but generally should not be.
X*/
X
Xextern void WcCreateChildrenACT ();
Xextern void WcCreatePopupsACT ();
Xextern void WcManageACT ();
Xextern void WcUnmanageACT ();
Xextern void WcManageChildrenACT ();
Xextern void WcUnmanageChildrenACT ();
Xextern void WcDestroyACT ();
Xextern void WcSetValueACT ();
Xextern void WcSetTypeValueACT ();
Xextern void WcSetSensitiveACT ();
Xextern void WcSetInsensitiveACT ();
Xextern void WcLoadResourceFileACT ();
Xextern void WcTraceACT ();
Xextern void WcPopupACT ();
Xextern void WcPopupGrabACT ();
Xextern void WcPopdownACT ();
Xextern void WcMapACT ();
Xextern void WcUnmapACT ();
Xextern void WcSystemACT ();
Xextern void WcExitACT ();
X
X#endif /* FUNCTION_PROTOTYPES */
X
X#endif /* _WcCreateP_h */
END_OF_FILE
if test 15619 -ne `wc -c <'xrainbow/Wc1_05/Wc/WcCreateP.h'`; then
echo shar: \"'xrainbow/Wc1_05/Wc/WcCreateP.h'\" unpacked with wrong size!
fi
# end of 'xrainbow/Wc1_05/Wc/WcCreateP.h'
fi
if test -f 'xrainbow/include/X11/Xaw_d/DrawingA.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xrainbow/include/X11/Xaw_d/DrawingA.h'\"
else
echo shar: Extracting \"'xrainbow/include/X11/Xaw_d/DrawingA.h'\" \(1399 characters\)
sed "s/^X//" >'xrainbow/include/X11/Xaw_d/DrawingA.h' <<'END_OF_FILE'
X/* DrawingA.h - Public Header file */
X
X/* Copyright 1990, David Nedde
X/*
X/* Permission to use, copy, modify, and distribute this
X/* software and its documentation for any purpose and without fee
X/* is granted provided that the above copyright notice appears in all copies.
X/* It is provided "as is" without express or implied warranty.
X*/
X
X/* Define widget's class pointer and strings used to specify resources */
X
X#ifndef _XawDrawingArea_h
X#define _XawDrawingArea_h
X
X/* Resources ADDED to label widget:
X
X Name Class RepType Default Value
X ---- ----- ------- -------------
X exposeCallback Callback Pointer NULL
X inputCallback Callback Pointer NULL
X motionCallback Callback Pointer NULL
X resizeCallback Callback Pointer NULL
X*/
X
X
Xextern WidgetClass drawingAreaWidgetClass;
X
Xtypedef struct _DrawingAreaClassRec *DrawingAreaWidgetClass;
Xtypedef struct _DrawingAreaRec *DrawingAreaWidget;
X
X
X/* Resource strings */
X#define XtNexposeCallback "exposeCallback"
X#define XtNinputCallback "inputCallback"
X#define XtNmotionCallback "motionCallback"
X#define XtNresizeCallback "resizeCallback"
X
X
Xtypedef struct _XawDrawingAreaCallbackStruct {
X int reason;
X XEvent *event;
X Window window;
X} XawDrawingAreaCallbackStruct;
X
X/* Reasons */
X#define XawCR_EXPOSE 1
X#define XawCR_INPUT 2
X#define XawCR_MOTION 3
X#define XawCR_RESIZE 4
X
X#endif /* _XawDrawingArea_h */
END_OF_FILE
if test 1399 -ne `wc -c <'xrainbow/include/X11/Xaw_d/DrawingA.h'`; then
echo shar: \"'xrainbow/include/X11/Xaw_d/DrawingA.h'\" unpacked with wrong size!
fi
# end of 'xrainbow/include/X11/Xaw_d/DrawingA.h'
fi
echo shar: End of archive 3 \(of 5\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 5 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 5 archives.
echo "Please Read README"
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
--
Dan Heller
O'Reilly && Associates Z-Code Software Comp-sources-x:
Senior Writer President comp-sources-x@uunet.uu.net
argv@ora.com argv@zipcode.com