#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <Xaw3d/Text.h>
#include <X11/StringDefs.h>
#include <Xm/Xm.h>

char *
clock_defined_name ( name )
char *name;
{
    extern char *def_defined_name() ;

    /*
    ** XtNhand is defined as hands,
    ** So can't just put XtN on the front
    */
    if ( strcmp ( name, "hands" ) == 0 )
	return "XtNhand";

    return def_defined_name ( name );
}

Widget
asciiStringRealise ( name, class, parent, args, arg_count )
char *name;
WidgetClass class;
Widget parent;
char *args;
int arg_count;
{
    /* default for editType is read  only, this is not helpful */
    Arg al[5];
    int ac = 0;
    char *buf = XtMalloc ( 256 );
    buf[0] = '\0';
    XtSetArg ( al[ac], "editType", XawtextEdit ); ac++;
    XtSetArg ( al[ac], "textOptions", 0x40 ); ac++;
    XtSetArg ( al[ac], "string", buf ); ac++;
    XtSetArg ( al[ac], "maxLength", 256 ); ac++;
    XtSetArg ( al[ac], "length", 256 ); ac++;
    return XtCreateWidget(name, class, parent, al, ac);
}

/*
** Use this to override the creation functionto give container
** widgets some inital width and height
*/

Widget
sizedCreate ( name, class, parent, args, arg_count )
char *name;
WidgetClass class;
Widget parent;
char *args;
int arg_count;
{
    Arg al[5];
    int ac = 0;
    XtSetArg ( al[ac], XtNwidth, 20 ); ac++;
    XtSetArg ( al[ac], XtNheight, 20 ); ac++;
    return XtCreateWidget(name, class, parent, al, ac);
}

/*
** Set the delete response field in VendorShell to unmap, so that
** the hierarchy doesn't get destroyed by selecting close from the
** window menu.
*/

Widget
shellCreate ( name, class, parent, args, arg_count )
char *name;
WidgetClass class;
Widget parent;
char *args;
int arg_count;
{
    Arg al[1];
    int ac = 0;
    XtSetArg ( al[ac], XmNdeleteResponse, XmUNMAP ); ac++;
    return XtCreateWidget(name, class, parent, al, ac);
}
