/*
 * Copyright 1990 by Baylor College of Medicine ALL RIGHTS RESERVED. 
 *
 * This program is subject to a license agreement between 
 * Baylor College of Medicine and MIT. Any use inconsistent with
 * said license and any use by persons other than the faculty, 
 * students and staff at MIT or any use on a computer not operated 
 * as part of the Athena Computing Environment (ACE) is expressly 
 * prohibited.
 */
/****************************************************************
 * File: error.c  
 * Date: 03/03/91
 *
 * Description:
 *   This file contains the popup to display an error message. 
 *
 * Revisions:
 ****************************************************************/
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/MessageB.h>

#include "VtP.h"

/****************************************************************
 * Function: VtError 
 * Date: 03/03/91
 *
 * Description: 
 *   This function activates the error message popup window.
 *
 * Linkage: VtError(parent,msg)
 *   Widget parent - shell used as the popup parent
 *   char msg      - error message
 *
 * Revisions:
 ****************************************************************/
PUBLIC
void
VtError(parent,msg)
	Widget parent;
	char *msg;
{
	XmString xm_msg;
	XmString xm_title;
	XmString xm_cancel;
	Widget box, button;
	Arg args[5];
	int n = 0;

	xm_msg = XmStringCreateLtoR(msg,XmSTRING_DEFAULT_CHARSET);
	xm_title = XmStringCreateLtoR("Error",XmSTRING_DEFAULT_CHARSET);
	xm_cancel = XmStringCreateLtoR("Cancel",XmSTRING_DEFAULT_CHARSET);

	XtSetArg(args[n],XmNmessageString,xm_msg); n++;
	XtSetArg(args[n],XmNdialogTitle,xm_title); n++;
	XtSetArg(args[n],XmNokLabelString,xm_cancel); n++;
	XtSetArg(args[n],XmNdialogStyle,XmDIALOG_APPLICATION_MODAL); n++;
	box = XmCreateErrorDialog(parent,"Error",args,n);

	XmStringFree(xm_msg);
	XmStringFree(xm_title);
	XmStringFree(xm_cancel);

	button = XmMessageBoxGetChild(box,XmDIALOG_CANCEL_BUTTON);
	XtUnmanageChild(button);
	button = XmMessageBoxGetChild(box,XmDIALOG_HELP_BUTTON);
	XtUnmanageChild(button);

	XtManageChild(box);
}
