/***************************** 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 <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/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/ScrollBar.h>
#include <Xm/ScrolledW.h>
#include <Xm/Text.h>
#include <Drag.h>

#define XtNfontList XmNfontList

extern void XDmanage_link ( );
extern void XDunmanage_link ( );
extern void XDpopup_link ( );
extern void XDpopdown_link ( );
extern void XDmap_link ( );
extern void XDunmap_link ( );
extern void XDenable_link ( );
extern void XDdisable_link ( );

extern void drag_click_callback ();
extern void options_callback ();
extern void help_callback ();

Widget text_top = (Widget)NULL;
Widget text_form = (Widget)NULL;
Widget text = (Widget)NULL;

Widget folder_top = (Widget)NULL;
Widget folder_form = (Widget)NULL;
Widget folder_drag = (Widget)NULL;

Widget top = (Widget)NULL;
Widget form = (Widget)NULL;
Widget drag = (Widget)NULL;


void create_text_top (parent)
Widget parent;
{
	Display *display = XtDisplay ( parent );
	Widget children[3];      /* Children to manage */
	Arg al[64];           /* Arg List */
	register int ac = 0;      /* Arg Count */
	char from_s [256];    /* For font list conversion */
	XrmValue from_value, to_value; /* ditto */
	int fg, bg;           /* colour values for pixmaps */ 
	XmString *list_items; /* For list items */
	int list_item;        /* Index for list_items */
	XmString xmstrings[15];    /* temporary storage for XmStrings */
	Widget widget2 = (Widget)NULL;

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	text_top = XmCreateDialogShell ( parent, "text_top", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNwidth, 450); ac++;
	XtSetArg(al[ac], XmNheight, 600); ac++;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	text_form = XmCreateForm ( text_top, "text_form", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNeditable, FALSE); ac++;
	XtSetArg(al[ac], XmNcursorPositionVisible, FALSE); ac++;
	XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
	text = XmCreateScrolledText ( text_form, "text", al, ac );
	ac = 0;
	widget2 = XtParent ( text );

	XtSetArg(al[ac], XmNwidth, 450); ac++;
	XtSetArg(al[ac], XmNheight, 600); ac++;
        XtSetValues ( widget2,al, ac );
	ac = 0;

	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 ( widget2,al, ac );
	ac = 0;
	XtManageChild(text);
}



void create_folder_top (parent)
Widget parent;
{
	Display *display = XtDisplay ( parent );
	Widget children[3];      /* Children to manage */
	Arg al[64];           /* Arg List */
	register int ac = 0;      /* Arg Count */
	char from_s [256];    /* For font list conversion */
	XrmValue from_value, to_value; /* ditto */
	int fg, bg;           /* colour values for pixmaps */ 
	XmString *list_items; /* For list items */
	int list_item;        /* Index for list_items */
	XmString xmstrings[15];    /* temporary storage for XmStrings */
	Widget widget8 = (Widget)NULL;
	Widget widget9 = (Widget)NULL;
	Widget widget10 = (Widget)NULL;

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	folder_top = XmCreateDialogShell ( parent, "folder_top", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNwidth, 529); ac++;
	XtSetArg(al[ac], XmNheight, 327); ac++;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	folder_form = XmCreateForm ( folder_top, "folder_form", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNscrollBarDisplayPolicy, XmSTATIC); ac++;
	XtSetArg(al[ac], XmNscrollingPolicy, XmAUTOMATIC); ac++;
	widget8 = XmCreateScrolledWindow ( folder_form, "widget8", al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNhorizontalScrollBar, &widget9 ); ac++;
	XtSetArg(al[ac], XmNverticalScrollBar, &widget10 ); ac++;
	XtGetValues(widget8, al, ac );
	ac = 0;
#if 0
	sprintf ( from_s, "-*-*-*-i-*-*-*-*-*-*-*-*-*-*" );
	from_value.size = strlen(from_s)+1;
	from_value.addr = from_s;
	XtConvert(widget8, XmRString, &from_value, XmRFontList, &to_value);
	XtSetArg(al[ac], XtNfontList, *(int *)to_value.addr); ac++;
#endif
	XtSetArg(al[ac], XmNwidth, 500); ac++;
	XtSetArg(al[ac], XmNheight, 300); ac++;
	folder_drag = XtCreateWidget ( "examin_drag", dragWidgetClass, widget8, al, ac );
	ac = 0;

	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 ( widget8,al, ac );
	ac = 0;
	XtAddCallback (folder_drag, XtNdblClickCallback, drag_click_callback,NULL);
	children[ac++] = folder_drag;
	XtManageChildren(children, ac);
	ac = 0;
	XmScrolledWindowSetAreas(widget8, widget9, widget10, folder_drag );
	children[ac++] = widget8;
	XtManageChildren(children, ac);
	ac = 0;
}



void create_top (display, app_name, app_argc, app_argv)
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 */
	char from_s [256];    /* For font list conversion */
	XrmValue from_value, to_value; /* ditto */
	int fg, bg;           /* colour values for pixmaps */ 
	XmString *list_items; /* For list items */
	int list_item;        /* Index for list_items */
	XmString xmstrings[15];    /* temporary storage for XmStrings */
	Widget widget14 = (Widget)NULL;
	Widget widget15 = (Widget)NULL;
	Widget widget16 = (Widget)NULL;
	Widget widget17 = (Widget)NULL;
	Widget widget18 = (Widget)NULL;

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNargc, app_argc); ac++;
	XtSetArg(al[ac], XmNargv, app_argv); ac++;
	top = XtAppCreateShell ( app_name, "Metview", applicationShellWidgetClass, display, al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNwidth, 532); ac++;
	XtSetArg(al[ac], XmNheight, 357); ac++;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	form = XmCreateForm ( top, "form", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	widget14 = XmCreateRowColumn ( form, "widget14", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	xmstrings[0] = XmStringCreateLtoR("Options...", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	widget15 = XmCreatePushButton ( widget14, "widget15", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	XtSetArg(al[ac], XmNwidth, 532); ac++;
	XtSetArg(al[ac], XmNheight, 329); ac++;
	XtSetArg(al[ac], XmNscrollBarDisplayPolicy, XmSTATIC); ac++;
	XtSetArg(al[ac], XmNscrollingPolicy, XmAUTOMATIC); ac++;
	widget16 = XmCreateScrolledWindow ( form, "widget16", al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNhorizontalScrollBar, &widget17 ); ac++;
	XtSetArg(al[ac], XmNverticalScrollBar, &widget18 ); ac++;
	XtGetValues(widget16, al, ac );
	ac = 0;
#if 0
	sprintf ( from_s, "-*-*-*-i-*-*-*-*-*-*-*-*-*-*" );
	from_value.size = strlen(from_s)+1;
	from_value.addr = from_s;
	XtConvert(widget16, XmRString, &from_value, XmRFontList, &to_value);
	XtSetArg(al[ac], XtNfontList, *(int *)to_value.addr); ac++;
#endif
	XtSetArg(al[ac], XmNwidth, 500); ac++;
	XtSetArg(al[ac], XmNheight, 300); ac++;
	drag = XtCreateWidget ( "examin_drag", dragWidgetClass, widget16, al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
        XtSetValues ( widget14,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomWidget, widget14); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
        XtSetValues ( widget16,al, ac );
	ac = 0;
	XtAddCallback (widget15, XmNactivateCallback, options_callback,NULL);
	children[ac++] = widget15;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (drag, XmNhelpCallback, help_callback,NULL);
	XtAddCallback (drag, XtNdblClickCallback, drag_click_callback,NULL);
	children[ac++] = drag;
	XtManageChildren(children, ac);
	ac = 0;
	XmScrolledWindowSetAreas(widget16, widget17, widget18, drag );
	children[ac++] = widget14;
	children[ac++] = widget16;
	XtManageChildren(children, ac);
	ac = 0;
	XtManageChild ( form);
}


