/*
** Generated by X-Designer
*/
/*
**LIBS: -lXm -lXt -lX11
*/

#include <stdio.h>
#include <stdlib.h>
#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>

#include <Xm/Xm.h>
#include <Xm/RepType.h>
#include <Xm/CascadeB.h>
#include <Xm/DialogS.h>
#include <Xm/FileSB.h>
#include <Xm/Form.h>
#include <Xm/Label.h>
#include <Xm/List.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/ScrollBar.h>
#include <Xm/SelectioB.h>
#include <Xm/Separator.h>
#include <Xm/Text.h>
#include <Xm/TextF.h>
#include <Xm/LabelG.h>
#include <Xm/PushBG.h>
#include <Xm/SeparatoG.h>


#include "accelerator.h"

extern void OpenCallback(Widget, XtPointer, XtPointer) ;
extern void ReadCallback(Widget, XtPointer, XtPointer) ;
extern void SaveCallback(Widget, XtPointer, XtPointer) ;
extern void SaveAsCallback(Widget, XtPointer, XtPointer) ;
extern void ExitCallback(Widget, XtPointer, XtPointer) ;
extern void AboutCallback(Widget, XtPointer, XtPointer) ;


/* Global Declarations */

XtAppContext app_context = (XtAppContext) 0 ;
Display     *display     = (Display *)    0 ;

int main(int argc, char **argv)
{

	/* Enable Localisation of the Application */

	XtSetLanguageProc((XtAppContext) 0, (XtLanguageProc) 0, (XtPointer) 0) ;

	/* Initialise the X Toolkit */

	XtToolkitInitialize ();

	/* Create a Global Application Context */

	app_context = XtCreateApplicationContext ();

	/* Open the Display */

	display = XtOpenDisplay(app_context, (String) 0, argv[0], "XApplication",
	                       (XrmOptionDescRec *) 0, 0,
	                       &argc, argv);
	if (display == (Display *) 0) {
		printf("%s: can't open display, exiting...\n", argv[0]);
		exit (-1);
	}

	/* This converter is not registered internally by Motif */

	XmRepTypeInstallTearOffModelConverter();

	/* Call the Create Procedures for the Dialogs in the Application */

	create_main_shell ( display, argv[0], argc, argv );
	create_about_shell ( main_shell );
	create_fsb_shell ( main_shell );
	create_dialog_shell ( main_shell );

	/*
	** Hand-crafted code to add in the Accelerator Transfers
	*/

	TransferAccelerator(dialog_shell, main_fm_open,    "ArmAndActivate") ;
	TransferAccelerator(dialog_shell, main_fm_read,    "ArmAndActivate") ;
	TransferAccelerator(dialog_shell, main_fm_save,    "ArmAndActivate") ;
	TransferAccelerator(dialog_shell, main_fm_saveas,  "ArmAndActivate") ;
	TransferAccelerator(dialog_shell, main_help_about, "ArmAndActivate") ;
	TransferAccelerator(fsb_shell,    main_help_about, "ArmAndActivate") ;

	/* Display the Primary Application Shell */

	XtRealizeWidget (main_shell);

	/*
	** And the Sub-Dialog. Hand-crafted code.
	*/

	XtManageChild (dialog_form) ;

	/* Entering X Main Loop... */

	XtAppMainLoop (app_context);

	/* NOTREACHED */

	exit (0);
}

