
#include <X11/Xlib.h>
#include <X11/Xos.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xmu/Misc.h>

#include <Place.h>

static XrmQuark XtQLeft, XtQRight, XtQTop, XtQBottom;

void
XtwInitializePlaceCvt()
{
  XtQLeft   = XrmStringToQuark("left");
  XtQRight  = XrmStringToQuark("right");
  XtQTop    = XrmStringToQuark("top");
  XtQBottom = XrmStringToQuark("bottom");
}  
  

/* ARGSUSED */
void 
XtwCvtStringToPlaceType(args, num_args, fromVal, toVal)
     XrmValuePtr args;           /* unused */
     Cardinal    *num_args;      /* unused */
     XrmValuePtr fromVal;
     XrmValuePtr toVal;
{
  static XtwPlaceType placeType = XtwUnspecified;
  XrmQuark q;
  char lowerName[1000];

  XmuCopyISOLatin1Lowered (lowerName, (char*) fromVal->addr);
  q = XrmStringToQuark(lowerName);

  if (q == XtQLeft) 
    placeType = XtwLeft;

  if (q == XtQRight) 
    placeType = XtwRight;

  if (q == XtQTop) 
    placeType = XtwTop;

  if (q == XtQBottom) 
    placeType = XtwBottom;

  if(placeType != XtwUnspecified)
    {
      toVal->size = sizeof(XtwPlaceType);
      toVal->addr = (XtPointer) &placeType;
      return;
    }

  XtStringConversionWarning(fromVal->addr, "placeType");
  toVal->addr = NULL;
  toVal->size = 0;
}
