xmFrames

/*
 * xmFrames.h
 *
 *  Created on: May 7, 2017
 *      Author: chuck
 */

#ifndef XMFRAMES_H_
#define XMFRAMES_H_

#include 

/**** close connections ****/
void exitNicely();

/**** X ****/
Display *display;

/**** handle mouse movement ****/
void mouseCB(XtPointer appShell);
	int app_x;
	int app_y;

/* mouse down inside of separator button */
void vSepMouseDownCB(Widget vSep, XtPointer clientData, XtPointer callData);

/* works for mouse up outside of separator button */
void vSepMouseUpCB(Widget vSep, XtPointer clientData, XtPointer callData);

/* mouse down inside of separator button */
void hSepMouseDownCB(Widget hSep, XtPointer clientData, XtPointer callData);

/* works for mouse up outside of separator button */
void hSepMouseUpCB(Widget hSep, XtPointer clientData, XtPointer callData);

/**** vertical separator ****/
void vSepMouseMoveCB(XtPointer appShell);
	Boolean vSepMouseMoving;

/**** horizontal separator ****/
void hSepMouseMoveCB(XtPointer appShell);
	Boolean hSepMouseMoving;
	Boolean hSepMouseMoved;

/**** creates the menu bar then creates each menu item ****/
Widget createMenuBar(Widget appManager);

/**** creates the menu items ****/
void createMenuBarItems(Widget menuBar, String menuName);

/**** substituted here with a Form ****/
Widget createAppContent(Widget appManager, Widget menuBar, Widget statusBar);

/**** this is where the content is to be put ****/
Widget createContent();
	int v, h;
	Widget vSep;
	Widget hSep;
	Widget label;
	Widget fraTree;
		Widget fraTreeScrolledWindow;
			/* moved to xmTree */
			//void loadTreeForm(Widget parent);
	Widget fraView;
		Widget fraViewScrolledWindow;
			/* moved to xmView */
			//void loadView(Widget parent);
	Widget fraTerm;
		Widget fraTermScrolledWindow;
			//void loadTerm(Widget parent);
				//String getFileContents(String file_name);
void resizeContent();
void destroyContent();

/**** to tell the user what's happening ****/
Widget createStatusBar(Widget appManager);

/**** a simple (yeah right) message box ****/
void createMsgBox(String title, String msg);

/**** menuBar handling ****/
void menuBarCB(Widget widget, XtPointer clientData, XtPointer callData);
	Widget createFileDialog(Widget parent, XmString button, XmString title);
void popdownCB(Widget widget, XtPointer clientData, XtPointer callData);
void fileSelectCB(Widget widget, XtPointer clientData, XtPointer callData);

/**** check for notifications ****/
Boolean notifyCB(XtPointer appShell);

/**** simple menu item dialog handler ****/
void msgBoxCB(Widget widget, XtPointer clientData, XtPointer callData);

/**** what's happening? ****/
void showStatus(String status);

/**** this is a substitute for an array or something ****/
KeySym getMnemonic(String menuName, String menuItemName);


#endif /* XMFRAMES_H_ */

/*
 ============================================================================
 Name        : xmFrames.c
 Author      : chuck
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include 

#include 

#include "xmFrames.h"

#include "xmTree.h"
#include "xmView.h"
#include "xmTerm.h"

//#include 

/*
gcc xmSkeleton.c -o xmSkeleton -I/usr/local/include -I/usr/X11R6/include -L/usr/src/lib -L/usr/local/lib -L/usr/X11R6/lib -lXm -lXt -lX11 -lXpm
*/

/**** public ****/
Widget statusTextField;
Widget statusTimeField;
Widget statusFileName;
Widget contentManager;
Widget dataView;

/**** close connections ****/
void exitNicely() {
	//
	printf("exiting nicely\n");
	//
	printf("done\n");
	exit(0);

}

/**** handle mouse movement ****/
void mouseCB(XtPointer appShell) {

	Window root, ret_root, ret_child;
	int root_x, root_y, win_x, win_y;
	unsigned int mask;

	Position shell_x, shell_y;

	static int last_app_x;
	static int last_app_y;

	char *status;
	root = XDefaultRootWindow(display);
	XQueryPointer(display, root, &ret_root, &ret_child, &root_x, &root_y, &win_x, &win_y, &mask);

	XtVaGetValues(appShell, XmNx, &shell_x, XmNy, &shell_y, NULL);

	app_x = win_x - shell_x;
	app_y = win_y - shell_y;

	//do status if different x, y, else return
	if((app_x != last_app_x) || (app_y != last_app_y)) {
		asprintf(&status, "%d, %d", app_x, app_y);
		showStatus(status);
		last_app_x = app_x;
		last_app_y = app_y;
	} else {
		return;
	}

	return;
}

/**** creates the menu bar then creates each menu item ****/
Widget createMenuBar(Widget appManager) {

	Widget menuBar;

	XmString file;
	XmString edit;

	file = XmStringCreateLocalized ("File");
	edit = XmStringCreateLocalized ("Edit");

	menuBar = XmVaCreateSimpleMenuBar(appManager, "menuBar",
		XmNbackground, 0,
		XmVaCASCADEBUTTON, file, 'F',
		XmVaCASCADEBUTTON, edit, 'E',
		XmNleftAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_FORM,
		XmNtopAttachment, XmATTACH_FORM,
		NULL);

	XmStringFree(file);
	XmStringFree(edit);

	createMenuBarItems(menuBar, "File");
	createMenuBarItems(menuBar, "Edit");

	return menuBar;
}

/**** creates the menu items ****/
void createMenuBarItems(Widget menuBar, String menuName) {

	if(!strcmp(menuName, "File")) {

		XmString new;
		XmString newAccel;
		XmString open;
		XmString openAccel;
		XmString save;
		XmString saveAccel;
		XmString run;
		XmString runAccel;
		XmString exit;
		XmString exitAccel;

		new = XmStringCreateLocalized("New...");
		newAccel = XmStringCreateLocalized("Ctrl+N");
		open = XmStringCreateLocalized("Open...");
		openAccel = XmStringCreateLocalized("Ctrl+O");
		save = XmStringCreateLocalized("Save...");
		saveAccel = XmStringCreateLocalized("Ctrl+S");
		run = XmStringCreateLocalized("Run...");
		runAccel = XmStringCreateLocalized("Ctrl+R");
		exit = XmStringCreateLocalized("Exit");
		exitAccel = XmStringCreateLocalized("Ctrl+Q");

		XmVaCreateSimplePulldownMenu (menuBar, "fileMenu", 0, (XtCallbackProc)menuBarCB,
			XmNbackground, 0,
			XmVaPUSHBUTTON, new, 'N', "CtrlN", newAccel,
			XmVaPUSHBUTTON, open, 'O', "CtrlO", openAccel,
			XmVaPUSHBUTTON, save, 'S', "CtrlS", saveAccel,
			XmVaSEPARATOR,
			XmVaPUSHBUTTON, run, 'R', "CtrlR", runAccel,
			XmVaSEPARATOR,
			XmVaPUSHBUTTON, exit, 'x', "CtrlQ", exitAccel,
			NULL);

		XmStringFree(new);
		XmStringFree(newAccel);
		XmStringFree(open);
		XmStringFree(openAccel);
		XmStringFree(save);
		XmStringFree(saveAccel);
		XmStringFree(run);
		XmStringFree(runAccel);
		XmStringFree(exit);
		XmStringFree(exitAccel);

		return;
	}

	if(!strcmp(menuName, "Edit")) {

		XmString cut;
		XmString cutAccel;
		XmString copy;
		XmString copyAccel;
		XmString paste;
		XmString pasteAccel;
		XmString clear;
		XmString clearAccel;

		cut = XmStringCreateLocalized("Cut");
		cutAccel = XmStringCreateLocalized("Ctrl+X");
		copy = XmStringCreateLocalized("Copy");
		copyAccel = XmStringCreateLocalized("Ctrl+C");
		paste = XmStringCreateLocalized("Paste");
		pasteAccel = XmStringCreateLocalized("Ctrl+V");
		clear = XmStringCreateLocalized("Clear");
		clearAccel = XmStringCreateLocalized("Delete");

		XmVaCreateSimplePulldownMenu (menuBar, "editMenu", 1, (XtCallbackProc)menuBarCB,
			XmNbackground, 0,
			XmVaPUSHBUTTON, cut, 't', "CtrlX", cutAccel,
			XmVaPUSHBUTTON, copy, 'C', "CtrlC", copyAccel,
			XmVaPUSHBUTTON, paste, 'P', "CtrlV", pasteAccel,
			XmVaSEPARATOR,
			XmVaPUSHBUTTON, clear, 'l', "Delete", clearAccel,
			NULL);

		XmStringFree(cut);
		XmStringFree(cutAccel);
		XmStringFree(copy);
		XmStringFree(copyAccel);
		XmStringFree(paste);
		XmStringFree(pasteAccel);
		XmStringFree(clear);
		XmStringFree(clearAccel);
	}

	return;
}

/**** substituted here with a Form ****/
Widget createAppContent(Widget appManager, Widget menuBar, Widget statusBar) {

	Widget appContent;

	appContent = XtVaCreateWidget("appContent",
		xmFormWidgetClass, appManager,
		XmNbackground, BlackPixelOfScreen(XtScreen(appManager)),
		XmNwidth, 640,
		XmNheight, 320,
		XmNtopAttachment, XmATTACH_WIDGET,
		XmNtopWidget, menuBar,
		XmNleftAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_FORM,
		XmNbottomAttachment, XmATTACH_WIDGET,
		XmNbottomWidget, statusBar,
		NULL);

	contentManager = appContent;

	return appContent;
}


/* mouse down inside of separator button */
void vSepMouseDownCB(Widget vSep, XtPointer clientData, XtPointer callData) {

	vSepMouseMoving = True;

	XtVaGetValues(hSep, XmNy, &h, NULL);

	showStatus("mouse down");

	return;
}


/* works for mouse up outside of separator button */
void vSepMouseUpCB(Widget vSep, XtPointer clientData, XtPointer callData) {

	vSepMouseMoving = False;

	showStatus("mouse up");

	app_y = h;

	resizeContent();

	return;
}

/* mouse down inside of separator button */
void hSepMouseDownCB(Widget hSep, XtPointer clientData, XtPointer callData) {

	hSepMouseMoving = True;

	XtVaGetValues(vSep, XmNx, &v, NULL);

	showStatus("mouse down");

	return;
}


/* works for mouse up outside of separator button */
void hSepMouseUpCB(Widget hSep, XtPointer clientData, XtPointer callData) {

	hSepMouseMoving = False;

	showStatus("mouse up");

	app_x = v;

	resizeContent();

	return;
}


/**** this is where the content is to be put ****/
Widget createContent() {

	Arg args[10];
	int n = 0;

	if(app_x == 0) app_x = 160;
	if(app_y == 0) app_y = 200;

	if(hSepMouseMoved) {
		app_y = app_y - 32;
		hSepMouseMoved = False;
	}

	display = XOpenDisplay(NULL);

	vSep = XtVaCreateManagedWidget("v",
		xmPushButtonWidgetClass, contentManager,
		XmNx, app_x,
		XmNwidth, 12,
		XmNbackground, 0,
		XmNtopAttachment, XmATTACH_FORM,
		XmNbottomAttachment, XmATTACH_FORM,
		NULL);

	hSep = XtVaCreateManagedWidget("h",
		xmPushButtonWidgetClass, contentManager,
		XmNy, app_y,
		XmNheight, 12,
		XmNbackground, 0,
		XmNleftAttachment, XmATTACH_WIDGET,
		XmNleftWidget, vSep,
		XmNrightAttachment, XmATTACH_FORM,
		NULL);

	fraTree = XtVaCreateManagedWidget("fraTree",
		xmFrameWidgetClass, contentManager,
		XmNbackground, 0,
		XmNtopAttachment, XmATTACH_FORM,
		XmNbottomAttachment, XmATTACH_FORM,
		XmNleftAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_WIDGET,
		XmNrightWidget, vSep,
		NULL);

	label = XtVaCreateManagedWidget("Data Tree",
		xmLabelWidgetClass, fraTree,
		XmNbackground, 0,
		XmNframeChildType, XmFRAME_TITLE_CHILD,
		NULL);

	fraTreeScrolledWindow = XtVaCreateManagedWidget("fraTreeScrolledWindow",
		xmScrolledWindowWidgetClass, fraTree,
		XmNbackground, 0,
		//XmNscrollingPolicy, XmAUTOMATIC,
		NULL);

	//fraView = XtVaCreateManagedWidget("fraView",
	fraView = XtVaCreateWidget("fraView",
		xmFrameWidgetClass, contentManager,
		XmNbackground, 0,
		XmNtopAttachment, XmATTACH_FORM,
		XmNbottomAttachment, XmATTACH_WIDGET,
		XmNbottomWidget, hSep,
		XmNrightAttachment, XmATTACH_FORM,
		XmNleftAttachment, XmATTACH_WIDGET,
		XmNleftWidget, vSep,
		NULL);

	label = XtVaCreateManagedWidget("Data View",
		xmLabelWidgetClass, fraView,
		XmNbackground, 0,
		XmNframeChildType, XmFRAME_TITLE_CHILD,
		NULL);

	fraViewScrolledWindow = XtVaCreateManagedWidget("fraViewScrolledWindow",
		xmScrolledWindowWidgetClass, fraView,
		XmNbackground, 0,
		XmNscrollingPolicy, XmAUTOMATIC,
		NULL);

	fraTerm = XtVaCreateManagedWidget("fraTerm",
		xmFrameWidgetClass, contentManager,
		XmNbackground, 0,
		XmNtopAttachment, XmATTACH_WIDGET,
		XmNtopWidget, hSep,
		XmNbottomAttachment, XmATTACH_FORM,
		XmNleftAttachment, XmATTACH_WIDGET,
		XmNleftWidget, vSep,
		XmNrightAttachment, XmATTACH_FORM,
		NULL);

	label = XtVaCreateManagedWidget("Data Term",
		xmLabelWidgetClass, fraTerm,
		XmNbackground, 0,
		XmNframeChildType, XmFRAME_TITLE_CHILD,
		NULL);

	/* fraTermScrolledWindow */
	XtSetArg(args[n], XmNrows, 40); n++;
	XtSetArg(args[n], XmNcolumns, 80); n++;
	XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
	XtSetArg(args[n], XmNbackground, 0); n++;
	XtSetArg(args[n], XmNresizeHeight, True); n++;
	XtSetArg(args[n], XmNresizeWidth, True); n++;
	fraTermScrolledWindow = XmCreateScrolledText(fraTerm, "fraTermScrolledWindow", args, n);
	XtManageChild(fraTermScrolledWindow);


	XtAddCallback(vSep, XmNarmCallback, vSepMouseDownCB, NULL);
	XtAddCallback(vSep, XmNdisarmCallback, vSepMouseUpCB, NULL);

	XtAddCallback(hSep, XmNarmCallback, hSepMouseDownCB, NULL);
	XtAddCallback(hSep, XmNdisarmCallback, hSepMouseUpCB, NULL);

	loadTree(fraTreeScrolledWindow);

	loadView(fraViewScrolledWindow);

	loadTerm(fraTermScrolledWindow);

	return fraView;
}

/****  ****/
void resizeContent() {
	destroyContent();
	Widget content = createContent();
	XtManageChild(content);
}

/****  ****/
void destroyContent() {
	//
	XtDestroyWidget(fraTerm);
	XtDestroyWidget(fraView);
	XtDestroyWidget(fraTree);
	XtDestroyWidget(hSep);
	XtDestroyWidget(vSep);
}

/**** to tell the user what's happening, mod ****/
Widget createStatusBar(Widget appManager) {

	Widget statusBar;
	Widget statusField;
	Widget statusTime;
	Widget statusFile;

	statusBar = XtVaCreateManagedWidget ("statusBar",
		xmFormWidgetClass, appManager,
		XmNbackground, BlackPixelOfScreen(XtScreen(appManager)),
		XmNleftAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_FORM,
		XmNbottomAttachment, XmATTACH_FORM,
		NULL);

	statusField = XtVaCreateManagedWidget ("statusField",
		xmTextFieldWidgetClass, statusBar,
		XmNeditable, False,
		XmNcursorPositionVisible, False,
		XmNbackground, BlackPixelOfScreen(XtScreen(appManager)),
		XmNleftAttachment, XmATTACH_FORM,
		XmNbottomAttachment, XmATTACH_FORM,
		NULL);

	statusTime = XtVaCreateManagedWidget ("statusTime",
		xmTextFieldWidgetClass, statusBar,
		XmNeditable, False,
		XmNcursorPositionVisible, False,
		XmNbackground, BlackPixelOfScreen(XtScreen(appManager)),
		XmNrightAttachment, XmATTACH_FORM,
		XmNbottomAttachment, XmATTACH_FORM,
		NULL);

	statusFile = XtVaCreateManagedWidget ("statusFile",
		xmTextFieldWidgetClass, statusBar,
		XmNeditable, False,
		XmNcursorPositionVisible, False,
		XmNbackground, BlackPixelOfScreen(XtScreen(appManager)),
		XmNleftAttachment, XmATTACH_WIDGET,
		XmNleftWidget, statusField,
		XmNrightAttachment, XmATTACH_WIDGET,
		XmNrightWidget, statusTime,
		XmNbottomAttachment, XmATTACH_FORM,
		NULL);

	statusTextField = statusField;
	statusTimeField = statusTime;
	statusFileName = statusFile;

	XmTextSetString(statusFileName, "src/term.txt");

	showStatus("status");

	return statusBar;
}

/**** a simple (yeah right) message box ****/
void createMsgBox(String title, String msg) {

	Widget dialog;
	Arg args[14];
	int n = 0;

	XmString xmTitle = XmStringCreateLocalized(title);
	XmString xmMsg = XmStringCreateLocalized(msg);

	XtSetArg(args[n], XmNdialogTitle, xmTitle); n++;
	XtSetArg(args[n], XmNmessageString, xmMsg); n++;
	XtSetArg(args[n], XmNbackground, 0); n++;

	dialog = XmCreateMessageDialog(contentManager, "simple", args, n);

	XtManageChild(dialog);

	XtAddCallback(dialog, XmNokCallback, msgBoxCB, (XtPointer)"ok");
	XtAddCallback(dialog, XmNcancelCallback, msgBoxCB, (XtPointer)"cancel");
	XtAddCallback(dialog, XmNhelpCallback, msgBoxCB, (XtPointer)"help");

	XmStringFree(xmTitle);
	XmStringFree(xmMsg);

	return;
}

/**** menuBar handlers, tricky returns for static widgets ****/
void menuBarCB(Widget widget, XtPointer clientData, XtPointer callData) {

	String menuName = XtName(XtParent(widget));
	String menuItemName = XtName(widget);
	KeySym mnemonic = getMnemonic(menuName, menuItemName);

	static Widget openDialog, saveDialog;

	if(!strcmp(menuName, "fileMenu")) {
		Widget fileDialog = NULL;
		XmString button, title;
		switch(mnemonic) {
			case 'N':
				showStatus("New");
				XmTextSetString(statusFileName, "New File");
				newTextFile("");
				break;
			case 'O':
				showStatus("Open");
				if(openDialog) {
					fileDialog = openDialog;
					XtManageChild(fileDialog);
					return;
				} else {
					button = XmStringCreateLocalized("Open");
					title = XmStringCreateLocalized("Open File");
					openDialog = createFileDialog(XtParent(widget), button, title);
					XtManageChild(openDialog);
				}

				break;
			case 'S':
				showStatus("Save");
				if(saveDialog) {
					fileDialog = saveDialog;
					XtManageChild(fileDialog);
					return;
				} else {
					button = XmStringCreateLocalized("Save");
					title = XmStringCreateLocalized("Save File");
					saveDialog = createFileDialog(XtParent(widget), button, title);
					XtManageChild(saveDialog);
				}

				break;

			case 'R':
				showStatus("Run");
				createMsgBox("Run", "Put run code here");
				break;
			case 'x':
				exitNicely();
				break;
			default:
				printf("pg_menu.php\n");
				return;
			XmStringFree(button);
			XmStringFree(title);
		}
	}

	if(!strcmp(menuName, "editMenu")) {
		switch(mnemonic) {
			case 't':
				showStatus("Cut");
				//createMsgBox("Cut", "Put cut code here");
				menuEditText(EDIT_CUT);
				break;
			case 'C':
				showStatus("Copy");
				//createMsgBox("Copy", "Put copy code here");
				menuEditText(EDIT_COPY);
				break;
			case 'P':
				showStatus("Paste");
				//createMsgBox("Paste", "Put paste code here");
				menuEditText(EDIT_PASTE);
				break;
			case 'l':
				showStatus("Clear");
				//createMsgBox("Clear", "Put clear code here");
				menuEditText(EDIT_CLEAR);
				break;
			default:
				printf("pg_menu.php\n");
				return;
		}
	}

	return;
}

/****  ****/
Widget createFileDialog(Widget parent, XmString button, XmString title) {
	//
	Widget fileDialog = XmCreateFileSelectionDialog(parent, "Files", NULL, 0);
	XtVaSetValues(fileDialog, XmNdialogTitle, title, NULL);
	XtAddCallback(fileDialog, XmNcancelCallback, popdownCB, NULL);
	XtAddCallback(fileDialog, XmNokCallback, fileSelectCB, title);
	return fileDialog;

}

/**** FileSelectionDialog Cancel ****/
void popdownCB(Widget widget, XtPointer clientData, XtPointer callData) {
	//
	XtUnmanageChild(widget);
}

/**** FileSelectionDialog OK ****/
void fileSelectCB(Widget widget, XtPointer clientData, XtPointer callData) {

	XmFileSelectionBoxCallbackStruct *cbs =
			(XmFileSelectionBoxCallbackStruct *)callData;
	String fileName = XmStringUnparse(cbs->value, XmFONTLIST_DEFAULT_TAG,
			XmCHARSET_TEXT, XmCHARSET_TEXT, NULL, 0, XmOUTPUT_ALL);
	String title = XmStringUnparse(clientData, XmFONTLIST_DEFAULT_TAG,
			XmCHARSET_TEXT, XmCHARSET_TEXT, NULL, 0, XmOUTPUT_ALL);

	printf("title = %s\n", title);

	if(!strcmp(title, "Open File")) {
		XmTextSetString(statusFileName, fileName);
		openTextFile(fileName);
	}

	if(!strcmp(title, "Save File")) {
		saveTextFile(fileName);
	}

	XtUnmanageChild(widget);

	return;
}

/****  ****/



/**** vertical separator ****/
void vSepMouseMoveCB(XtPointer appShell) {
	//
return;
}

/**** horizontal separator ****/
void hSepMouseMoveCB(XtPointer appShell) {

	hSepMouseMoved = True;

	return;
}

/**** check for notifications ****/
Boolean notifyCB(XtPointer appShell) {

	mouseCB(appShell);

	if (vSepMouseMoving == True) {
		vSepMouseMoveCB(appShell);
	} else if (hSepMouseMoving == True) {
		hSepMouseMoveCB(appShell);
	}


	/**** keep checking ****/
	return False;
}

/**** simple menu item dialog handler ****/
void msgBoxCB(Widget widget, XtPointer clientData, XtPointer callData) {

	showStatus("");

	return;
}

/**** what's happening? ****/
void showStatus(String status) {

	XmTextSetString(statusTextField, status);

	return;
}

/**** this is a substitute for an array or something ****/
KeySym getMnemonic(String menuName, String menuItemName) {

        KeySym mnemonic;

	if(!strcmp(menuName, "fileMenu")) {
		if(!strcmp(menuItemName, "button_0")) return XStringToKeysym("N");
		if(!strcmp(menuItemName, "button_1")) return XStringToKeysym("O");
		if(!strcmp(menuItemName, "button_2")) return XStringToKeysym("S");
		if(!strcmp(menuItemName, "button_3")) return XStringToKeysym("R");
		if(!strcmp(menuItemName, "button_4")) return XStringToKeysym("x");
	}

	if(!strcmp(menuName, "editMenu")) {
		if(!strcmp(menuItemName, "button_0")) return XStringToKeysym("t");
		if(!strcmp(menuItemName, "button_1")) return XStringToKeysym("C");
		if(!strcmp(menuItemName, "button_2")) return XStringToKeysym("P");
		if(!strcmp(menuItemName, "button_3")) return XStringToKeysym("l");
	}

	return NULL;
}

/**** the main program ****/
main(int argc, char *argv[]) {

	Widget appShell;
	Widget appManager;
	Widget appContent;
	Widget content;
	Widget menuBar;
	Widget statusBar;

	XtAppContext appContext;

	appShell = XtVaOpenApplication(&appContext, "appClass",
		NULL, 0, &argc, argv, NULL, applicationShellWidgetClass,
		NULL);

	appManager = XtVaCreateManagedWidget("appManager",
		xmFormWidgetClass, appShell,
		NULL);

	menuBar = (Widget)createMenuBar(appManager);
	XtManageChild(menuBar);

	statusBar = createStatusBar(appManager);
	XtManageChild(statusBar);

	appContent = createAppContent(appManager, menuBar, statusBar);
	XtManageChild(appContent);

	content = createContent();
	XtManageChild(content);

	XtRealizeWidget(appShell);

	XtAppAddWorkProc(appContext, notifyCB, appShell);

	XtAppMainLoop(appContext);

}