/*
** Generated by X-Designer 
*/
/*
**LIBS: -lXm -lXt -lX11
*/

#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>

#include <Xm/Xm.h>
#include <Xm/DialogS.h>
#include <Xm/RowColumn.h>
#include <Xm/ScrollBar.h>
#include <Xm/Text.h>
#include <stdio.h>

extern Boolean aardvarkConverter ();
extern Boolean objStringConverter ();
Widget appshell = (Widget) NULL;
Widget rowcol = (Widget) NULL;
Widget text1_sw = (Widget) NULL;
Widget text1 = (Widget) NULL;
Widget text2_sw = (Widget) NULL;
Widget text2 = (Widget) NULL;



void create_appshell (display, app_name, app_argc, app_argv)
Display *display;
char *app_name;
int app_argc;
char **app_argv;
{
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNtitle, "Text Sources"); ac++;
	XtSetArg(al[ac], XmNargc, app_argc); ac++;
	XtSetArg(al[ac], XmNargv, app_argv); ac++;
	appshell = XtAppCreateShell ( app_name, "XApplication", applicationShellWidgetClass, display, al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	rowcol = XmCreateRowColumn ( appshell, "rowcol", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNcolumns, 38); ac++;
	XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
	XtSetArg(al[ac], XmNrows, 8); ac++;
	XtSetArg(al[ac], XmNwordWrap, TRUE); ac++;
	XtSetArg(al[ac], XmNscrollHorizontal, FALSE); ac++;
	text1 = XmCreateScrolledText ( rowcol, "text1", al, ac );
	ac = 0;
	text1_sw = XtParent ( text1 );

	XmTextSetString ( text1, "These two text widgets share a common text source\n\nThis means that any edits I make in one text widget will be automatically reflected in the other.\n\nThe text widgets can be displaying different parts of the source at the same time." );
	XtSetArg(al[ac], XmNcolumns, 24); ac++;
	XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
	XtSetArg(al[ac], XmNwordWrap, TRUE); ac++;
	XtSetArg(al[ac], XmNscrollHorizontal, FALSE); ac++;
	text2 = XmCreateScrolledText ( rowcol, "text2", al, ac );
	ac = 0;
	text2_sw = XtParent ( text2 );

        XmTextSetSource(text2, XmTextGetSource(text1), 0, 0 );
	XtManageChild(text1);
	XtManageChild(text2);
	XtManageChild ( rowcol);
}



XtAppContext app_context;
Display *display;       /*  Display             */

int main (argc,argv)
int    argc;
char            **argv;
{
	XtSetLanguageProc ( (XtAppContext) NULL, (XtLanguageProc) NULL, (XtPointer) NULL );
	XtToolkitInitialize ();
	app_context = XtCreateApplicationContext ();
	display = XtOpenDisplay (app_context, NULL, argv[0], "XApplication",
	                         NULL, 0, &argc, argv);
	if (!display)
	{
	    printf("%s: can't open display, exiting...\n", argv[0]);
	    exit (-1);
	}
	create_appshell ( display, argv[0], argc, argv );
	XtRealizeWidget (appshell);
	XtAppMainLoop (app_context);
	exit (0);
}

