/*
** 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/DialogS.h>
#include <Xm/DrawingA.h>
#include <Xm/Form.h>
#include <Xm/ScrollBar.h>
#include <Xm/ScrolledW.h>


#include "halffont.h"

#ifndef   _NO_PROTO
extern void OnExpose(Widget, XtPointer, XtPointer) ;
#else  /* _NO_PROTO */
extern void OnExpose() ;
#endif /* _NO_PROTO */

Widget app_shell = (Widget) NULL;
Widget drawable = (Widget) NULL;



void create_app_shell (Display *display, char *app_name, int app_argc, char **app_argv)
{
	Widget children[3];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	XtPointer tmp_value;             /* ditto */
	Widget form1 = (Widget)NULL;
	Widget scrolledWin1 = (Widget)NULL;
	Widget scrollbar1 = (Widget)NULL;
	Widget scrollbar2 = (Widget)NULL;

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNargc, app_argc); ac++;
	XtSetArg(al[ac], XmNargv, app_argv); ac++;
	app_shell = XtAppCreateShell ( app_name, "XApplication", applicationShellWidgetClass, display, al, ac );

	ac = 0;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	form1 = XmCreateForm ( app_shell, "form1", al, ac );
	ac = 0;
	scrolledWin1 = XmCreateScrolledWindow ( form1, "scrolledWin1", al, ac );

	XtSetArg(al[ac], XmNhorizontalScrollBar, &scrollbar1); ac++;
	XtSetArg(al[ac], XmNverticalScrollBar, &scrollbar2); ac++;
	XtGetValues(scrolledWin1, al, ac );
	ac = 0;
	drawable = XmCreateDrawingArea ( scrolledWin1, "drawable", al, ac );


	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( scrolledWin1,al, ac );
	ac = 0;
	if (drawable)
		XtAddCallback( drawable, XmNexposeCallback, OnExpose, (XtPointer) 0 );
	children[ac++] = drawable;
	XtManageChildren(children, ac);
	ac = 0;
	XmScrolledWindowSetAreas(scrolledWin1, scrollbar1, scrollbar2, drawable );
	children[ac++] = scrolledWin1;
	XtManageChildren(children, ac);
	ac = 0;
	XtManageChild ( form1);
}


/* 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_app_shell ( display, argv[0], argc, argv );

	/* Display the Primary Application Shell */

	XtRealizeWidget (app_shell);

	/* Entering X Main Loop... */

	XtAppMainLoop (app_context);

	/* NOTREACHED */

	exit (0);
}

