/*==================================================================
  ==================================================================
  ==	XMusic -- An Interactive Interface to Csound		  ==
  ==       Copyright (C) 1988 by George D. Drapeau                ==
  ==                  All Rights Reserved                         ==
  ==================================================================
  ==================================================================
*/
/* $Log:	exitWin.c,v $
 * Revision 1.2  89/08/06  18:08:26  drapeau
 * Cleaned up the code for the first X11 release.
 *  */

#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Box.h>
#include <X11/Label.h>
#include <X11/Command.h>
#include "defs.h"
#include "externs.h"


void CreateExitWindow()
{
  Widget	exitBoxWidget,exitLabelWidget;
  Widget	exitYesCommandWidget,exitNoCommandWidget;
  static 	Arg argList[3] = 
    {
      {XtNx,(XtArgVal)350},
      {XtNy,(XtArgVal)400},
      {XtNtitle,(XtArgVal)"XMusic:Quit"}
    };

  exitWidget		= XtCreatePopupShell("Exit",		    /* Create a Popup shell for the Exit window */
					     transientShellWidgetClass,
					     topLevelShell,
					     argList,XtNumber(argList));
  
  exitBoxWidget 	= XtCreateManagedWidget("ExitBox",	    /* Create a box to hold commands for the Exit window */
						boxWidgetClass,
						exitWidget,
						NULL,NULL);
  XtSetArg(argList[0],XtNlabel,"Do you want to Quit XMusic?");
  exitLabelWidget	= XtCreateManagedWidget("ExitLabel",	    /* Create a label for the Exit Window */
						labelWidgetClass,
						exitBoxWidget,
						argList,1);
  XtSetArg(argList[0],XtNlabel,"Yes, Quit");
  exitYesCommandWidget	= XtCreateManagedWidget("ExitYesCommand",   /* Create a 'Yes' command for the Exit Window */
						commandWidgetClass,
						exitBoxWidget,
						argList,1);
  XtSetArg(argList[0],XtNlabel,"No");
  exitNoCommandWidget	= XtCreateManagedWidget("ExitNoCommand",    /* Create a 'No' command for the Exit Window */
						commandWidgetClass,
						exitBoxWidget,
						argList,1);
  XtAddCallback(exitYesCommandWidget,XtNcallback,Quit,NULL);	    /* Add callback functions to the Yes and No buttons */
  XtAddCallback(exitNoCommandWidget,XtNcallback,ForgetExit,NULL);
}								    /* end function CreateExitWindow */
