/***************************** LICENSE START ***********************************

 Copyright 2012 ECMWF and INPE. This software is distributed under the terms
 of the Apache License version 2.0. In applying this license, ECMWF does not
 waive the privileges and immunities granted to it by virtue of its status as
 an Intergovernmental Organization or submit itself to any jurisdiction.

 ***************************** LICENSE END *************************************/

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

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

#include <Xm/Xm.h>
#include <Xm/DialogS.h>
#include <Xm/DrawingA.h>
#include <Xm/Form.h>
#include <Xm/Frame.h>
#include <Xm/Label.h>
#include <Xm/List.h>
#include <Xm/PanedW.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/ScrollBar.h>
#include <Xm/ScrolledW.h>
#include <Xm/Separator.h>
#include <Xm/Text.h>

#include <Array.h>
#include <Drag.h>
#define XmCreateDrawingArea CreateDragWidget

extern void exit_callback(Widget, XtPointer, XtPointer) ;
extern void info_callback(Widget, XtPointer, XtPointer) ;
extern void kill_callback(Widget, XtPointer, XtPointer) ;
extern void debug_callback(Widget, XtPointer, XtPointer) ;

static Widget xd_links [ 1 ];

void XDmanage_link( Widget w, XtPointer client_data, XtPointer call_data)
{
	if (client_data && *(Widget *) client_data)
		XtManageChild(*(Widget *) client_data);
}

void XDunmanage_link( Widget w, XtPointer client_data, XtPointer call_data)
{
	if (client_data && *(Widget *) client_data)
		XtUnmanageChild(*(Widget *) client_data);
}

void XDpopup_link( Widget w, XtPointer client_data, XtPointer call_data)
{
	if (client_data && *(Widget *) client_data)
		XtPopup(*(Widget *) client_data, XtGrabNone);
}

void XDpopdown_link( Widget w, XtPointer client_data, XtPointer call_data)
{
	if (client_data && *(Widget *) client_data)
		XtPopdown(*(Widget *) client_data);
}

void XDmap_link( Widget w, XtPointer client_data, XtPointer call_data)
{
	if (client_data && *(Widget *) client_data)
		XtMapWidget(*(Widget *) client_data);
}

void XDunmap_link( Widget w, XtPointer client_data, XtPointer call_data)
{
	if (client_data && *(Widget *) client_data)
		XtUnmapWidget(*(Widget *) client_data);
}

void XDenable_link( Widget w, XtPointer client_data, XtPointer call_data)
{
	if (client_data && *(Widget *) client_data)
		XtSetSensitive(*(Widget *) client_data, TRUE);
}

void XDdisable_link( Widget w, XtPointer client_data, XtPointer call_data)
{
	if (client_data && *(Widget *) client_data)
		XtSetSensitive(*(Widget *) client_data, FALSE);
}

Widget top = (Widget) NULL;
Widget from = (Widget) NULL;
Widget drag_service = (Widget) NULL;
Widget action_menu = (Widget) NULL;
Widget name_label = (Widget) NULL;
Widget info_menu = (Widget) NULL;
Widget kill_menu = (Widget) NULL;
Widget debug_menu = (Widget) NULL;
Widget drag_request = (Widget) NULL;
Widget drag_wait = (Widget) NULL;
Widget request_top = (Widget) NULL;
Widget request_form = (Widget) NULL;
Widget request_text = (Widget) NULL;
Widget progress_list = (Widget) NULL;
Widget info_label = (Widget) NULL;



void create_action_menu (Widget parent)
{
	Widget children[6];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	XtPointer tmp_value;             /* ditto */
	XmString xmstrings[16];    /* temporary storage for XmStrings */
	Widget separator6 = (Widget)NULL;
	Widget separator7 = (Widget)NULL;

	action_menu = XmCreatePopupMenu ( parent, (char *) "action_menu", al, ac );
	name_label = XmCreateLabel ( action_menu, (char *) "name_label", al, ac );
	separator6 = XmCreateSeparator ( action_menu, (char *) "separator6", al, ac );
	xmstrings[0] = XmStringGenerate ( (XtPointer) "Info", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	XtSetArg(al[ac], XmNfillOnArm, FALSE); ac++;
	info_menu = XmCreatePushButton ( action_menu, (char *) "info_menu", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	xmstrings[0] = XmStringGenerate ( (XtPointer) "Abort", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	kill_menu = XmCreatePushButton ( action_menu, (char *) "kill_menu", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	separator7 = XmCreateSeparator ( action_menu, (char *) "separator7", al, ac );
	xmstrings[0] = XmStringGenerate ( (XtPointer) "Debug", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	debug_menu = XmCreatePushButton ( action_menu, (char *) "debug_menu", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	if (info_menu)
		XtAddCallback( info_menu, XmNactivateCallback, info_callback, (XtPointer) 0 );
	if (kill_menu)
		XtAddCallback( kill_menu, XmNactivateCallback, kill_callback, (XtPointer) 0 );
	if (debug_menu)
		XtAddCallback( debug_menu, XmNactivateCallback, debug_callback, (XtPointer) 0 );
	if ((children[ac] = name_label) != (Widget) 0) { ac++; }
	if ((children[ac] = separator6) != (Widget) 0) { ac++; }
	if ((children[ac] = info_menu) != (Widget) 0) { ac++; }
	if ((children[ac] = kill_menu) != (Widget) 0) { ac++; }
	if ((children[ac] = separator7) != (Widget) 0) { ac++; }
	if ((children[ac] = debug_menu) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
}

void create_top (Display *display, char *app_name, int app_argc, char **app_argv)
{
	Widget children[6];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	XtPointer tmp_value;             /* ditto */
	XmString xmstrings[16];    /* temporary storage for XmStrings */
	Widget button1 = (Widget)NULL;
	Widget panedWindow2 = (Widget)NULL;
	Widget frame3 = (Widget)NULL;
	Widget scrolledWin3 = (Widget)NULL;
	Widget scrollbar4 = (Widget)NULL;
	Widget scrollbar5 = (Widget)NULL;
	Widget label6 = (Widget)NULL;
	Widget frame2 = (Widget)NULL;
	Widget scrolledWin8 = (Widget)NULL;
	Widget scrollbar9 = (Widget)NULL;
	Widget scrollbar10 = (Widget)NULL;
	Widget label4 = (Widget)NULL;
	Widget frame1 = (Widget)NULL;
	Widget scrolledWin11 = (Widget)NULL;
	Widget scrollbar12 = (Widget)NULL;
	Widget scrollbar13 = (Widget)NULL;
	Widget label3 = (Widget)NULL;

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNtitle, "Metview Process Monitor"); ac++;
	XtSetArg(al[ac], XmNargc, app_argc); ac++;
	XtSetArg(al[ac], XmNargv, app_argv); ac++;
	top = XtAppCreateShell(app_name, (char *) "Metview", applicationShellWidgetClass, display, al, ac);

	ac = 0;
	XtSetArg(al[ac], XmNwidth, 520); ac++;
	XtSetArg(al[ac], XmNheight, 520); ac++;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	from = XmCreateForm ( top, (char *) "from", al, ac );
	ac = 0;
	xmstrings[0] = XmStringGenerate ( (XtPointer) "Close", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	button1 = XmCreatePushButton ( from, (char *) "button1", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	panedWindow2 = XmCreatePanedWindow ( from, (char *) "panedWindow2", al, ac );
	XtSetArg(al[ac], XmNpaneMinimum, 1); ac++;
	XtSetArg(al[ac], XmNheight, 200); ac++;
	frame3 = XmCreateFrame ( panedWindow2, (char *) "frame3", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNheight, 140); ac++;
	XtSetArg(al[ac], XmNscrollBarDisplayPolicy, XmSTATIC); ac++;
	XtSetArg(al[ac], XmNscrollingPolicy, XmAUTOMATIC); ac++;
	scrolledWin3 = XmCreateScrolledWindow ( frame3, (char *) "scrolledWin3", al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNhorizontalScrollBar, &scrollbar4); ac++;
	XtSetArg(al[ac], XmNverticalScrollBar, &scrollbar5); ac++;
	XtGetValues(scrolledWin3, al, ac );
	ac = 0;
	drag_service = XmCreateDrawingArea ( scrolledWin3, (char *) "drag_service", al, ac );
	XtSetArg(al[ac], XmNframeChildType, XmFRAME_TITLE_CHILD); ac++;
	xmstrings[0] = XmStringGenerate ( (XtPointer) "Modules in Memory", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	label6 = XmCreateLabel ( frame3, (char *) "label6", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	XtSetArg(al[ac], XmNheight, 200); ac++;
	frame2 = XmCreateFrame ( panedWindow2, (char *) "frame2", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNheight, 140); ac++;
	XtSetArg(al[ac], XmNscrollBarDisplayPolicy, XmSTATIC); ac++;
	XtSetArg(al[ac], XmNscrollingPolicy, XmAUTOMATIC); ac++;
	scrolledWin8 = XmCreateScrolledWindow ( frame2, (char *) "scrolledWin8", al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNhorizontalScrollBar, &scrollbar9); ac++;
	XtSetArg(al[ac], XmNverticalScrollBar, &scrollbar10); ac++;
	XtGetValues(scrolledWin8, al, ac );
	ac = 0;
	drag_request = XmCreateDrawingArea ( scrolledWin8, (char *) "drag_request", al, ac );
	XtSetArg(al[ac], XmNframeChildType, XmFRAME_TITLE_CHILD); ac++;
	xmstrings[0] = XmStringGenerate ( (XtPointer) "Active Processes", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	label4 = XmCreateLabel ( frame2, (char *) "label4", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	XtSetArg(al[ac], XmNheight, 200); ac++;
	XtSetArg(al[ac], XmNmarginHeight, 12); ac++;
	frame1 = XmCreateFrame ( panedWindow2, (char *) "frame1", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNheight, 140); ac++;
	XtSetArg(al[ac], XmNscrollBarDisplayPolicy, XmSTATIC); ac++;
	XtSetArg(al[ac], XmNscrollingPolicy, XmAUTOMATIC); ac++;
	scrolledWin11 = XmCreateScrolledWindow ( frame1, (char *) "scrolledWin11", al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNhorizontalScrollBar, &scrollbar12); ac++;
	XtSetArg(al[ac], XmNverticalScrollBar, &scrollbar13); ac++;
	XtGetValues(scrolledWin11, al, ac );
	ac = 0;
	drag_wait = XmCreateDrawingArea ( scrolledWin11, (char *) "drag_wait", al, ac );
	XtSetArg(al[ac], XmNframeChildType, XmFRAME_TITLE_CHILD); ac++;
	xmstrings[0] = XmStringGenerate ( (XtPointer) "Pending Processes", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	label3 = XmCreateLabel ( frame1, (char *) "label3", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );


	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 5); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 5); ac++;
	XtSetValues ( button1, al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 5); ac++;
	XtSetArg(al[ac], XmNbottomWidget, button1); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( panedWindow2, al, ac );
	ac = 0;
	if (button1)
		XtAddCallback( button1, XmNactivateCallback, exit_callback, (XtPointer) 0 );
	if ((children[ac] = drag_service) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
	XtVaSetValues(scrolledWin3,
	              XmNhorizontalScrollBar, scrollbar4,
	              XmNverticalScrollBar, scrollbar5,
	              XmNworkWindow, drag_service,
	              NULL);
	if ((children[ac] = scrolledWin3) != (Widget) 0) { ac++; }
	if ((children[ac] = label6) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
	if ((children[ac] = drag_request) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
	XtVaSetValues(scrolledWin8,
	              XmNhorizontalScrollBar, scrollbar9,
	              XmNverticalScrollBar, scrollbar10,
	              XmNworkWindow, drag_request,
	              NULL);
	if ((children[ac] = scrolledWin8) != (Widget) 0) { ac++; }
	if ((children[ac] = label4) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
	if ((children[ac] = drag_wait) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
	XtVaSetValues(scrolledWin11,
	              XmNhorizontalScrollBar, scrollbar12,
	              XmNverticalScrollBar, scrollbar13,
	              XmNworkWindow, drag_wait,
	              NULL);
	if ((children[ac] = scrolledWin11) != (Widget) 0) { ac++; }
	if ((children[ac] = label3) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
	if ((children[ac] = frame3) != (Widget) 0) { ac++; }
	if ((children[ac] = frame2) != (Widget) 0) { ac++; }
	if ((children[ac] = frame1) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
	if ((children[ac] = button1) != (Widget) 0) { ac++; }
	if ((children[ac] = panedWindow2) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
	if (from != (Widget) 0) { XtManageChild ( from); }
}


void create_request_top (Widget parent)
{
	Widget children[3];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	XtPointer tmp_value;             /* ditto */
	XmString xmstrings[16];    /* temporary storage for XmStrings */
	Widget button14 = (Widget)NULL;
	Widget panedWindow15 = (Widget)NULL;
	Widget scrolledText16 = (Widget)NULL;
	Widget scrollbar18 = (Widget)NULL;
	Widget scrollbar19 = (Widget)NULL;
	Widget scrolledList17 = (Widget)NULL;
	Widget scrollbar21 = (Widget)NULL;
	Widget scrollbar22 = (Widget)NULL;

	XtSetArg(al[ac], XmNallowShellResize, FALSE); ac++;
	XtSetArg(al[ac], XmNtitle, "Info"); ac++;
	XtSetArg(al[ac], XmNtransient, TRUE); ac++;
	request_top = XmCreateDialogShell ( parent, (char *) "request_top", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	request_form = XmCreateForm ( request_top, (char *) "request_form", al, ac );
	ac = 0;
	xmstrings[0] = XmStringGenerate ( (XtPointer) "Close", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	button14 = XmCreatePushButton ( request_form, (char *) "button14", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	panedWindow15 = XmCreatePanedWindow ( request_form, (char *) "panedWindow15", al, ac );
	XtSetArg(al[ac], XmNcolumns, 51); ac++;
	XtSetArg(al[ac], XmNeditable, FALSE); ac++;
	XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
	XtSetArg(al[ac], XmNrows, 19); ac++;
	request_text = XmCreateScrolledText ( panedWindow15, (char *) "request_text", al, ac );
	ac = 0;
	scrolledText16 = XtParent ( request_text );

	XtSetArg(al[ac], XmNhorizontalScrollBar, &scrollbar18); ac++;
	XtSetArg(al[ac], XmNverticalScrollBar, &scrollbar19); ac++;
	XtGetValues(scrolledText16, al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNvisibleItemCount, 3); ac++;
	XtSetArg(al[ac], XmNlistSizePolicy, XmCONSTANT); ac++;
	progress_list = XmCreateScrolledList ( panedWindow15, (char *) "progress_list", al, ac );
	ac = 0;
	scrolledList17 = XtParent ( progress_list );

	XtSetArg(al[ac], XmNhorizontalScrollBar, &scrollbar21); ac++;
	XtSetArg(al[ac], XmNverticalScrollBar, &scrollbar22); ac++;
	XtGetValues(scrolledList17, al, ac );
	ac = 0;
	info_label = XmCreateLabel ( request_form, (char *) "info_label", al, ac );
	xd_links [0] = request_form;


	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 5); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 5); ac++;
	XtSetValues ( button14, al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 5); ac++;
	XtSetArg(al[ac], XmNtopWidget, info_label); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 5); ac++;
	XtSetArg(al[ac], XmNbottomWidget, button14); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 5); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 5); ac++;
	XtSetValues ( panedWindow15, al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 5); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 5); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 5); ac++;
	XtSetValues ( info_label, al, ac );
	ac = 0;
	XtAddCallback (button14, XmNactivateCallback, XDunmanage_link, (XtPointer) &xd_links[0] );
	if (request_text != (Widget) 0) { XtManageChild(request_text); }
	if (progress_list != (Widget) 0) { XtManageChild(progress_list); }
	if ((children[ac] = button14) != (Widget) 0) { ac++; }
	if ((children[ac] = panedWindow15) != (Widget) 0) { ac++; }
	if ((children[ac] = info_label) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
}

