/***************************** 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/CascadeB.h>
#include <Xm/DialogS.h>
#include <Xm/Form.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/Text.h>

extern void send_callback ();
extern void cancel_callback ();
extern void entry_callback ();
extern void browse_callback ();
extern void remove_callback ();

Widget top = (Widget)NULL;
Widget form = (Widget)NULL;
Widget text_subject = (Widget)NULL;
Widget text_to = (Widget)NULL;
Widget menu_to = (Widget)NULL;
Widget text_msg = (Widget)NULL;
Widget list_icons = (Widget)NULL;
Widget remove_button = (Widget)NULL;


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 widget2 = (Widget)NULL;
	Widget widget3 = (Widget)NULL;
	Widget widget4 = (Widget)NULL;
	Widget widget5 = (Widget)NULL;
	Widget widget6 = (Widget)NULL;
	Widget widget7 = (Widget)NULL;
	Widget widget9 = (Widget)NULL;
	Widget widget11 = (Widget)NULL;
	Widget widget12 = (Widget)NULL;
	Widget widget14 = (Widget)NULL;
	Widget widget18 = (Widget)NULL;
	Widget widget19 = (Widget)NULL;
	Widget widget24 = (Widget)NULL;

	XtSetArg(al[ac], XmNallowShellResize, FALSE); ac++;
	XtSetArg(al[ac], XmNtitle, "Metview-Mail"); 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], XmNautoUnmanage, FALSE); ac++;
	form = XmCreateForm ( top, "form", al, ac );
	ac = 0;
	xmstrings[0] = XmStringCreateLtoR("Send", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	widget2 = XmCreatePushButton ( form, "widget2", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	xmstrings[0] = XmStringCreateLtoR("Cancel", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	widget3 = XmCreatePushButton ( form, "widget3", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	widget4 = XmCreatePanedWindow ( form, "widget4", al, ac );
	widget5 = XmCreateForm ( widget4, "widget5", al, ac );
	widget6 = XmCreateForm ( widget5, "widget6", al, ac );
	xmstrings[0] = XmStringCreateLtoR("Subject:", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	widget7 = XmCreateLabel ( widget6, "widget7", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	text_subject = XmCreateText ( widget6, "text_subject", al, ac );
	widget9 = XmCreateForm ( widget5, "widget9", al, ac );
	text_to = XmCreateText ( widget9, "text_to", al, ac );
	XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
	XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
	widget11 = XmCreateMenuBar ( widget9, "widget11", al, ac );
	ac = 0;
	menu_to = XmCreatePulldownMenu ( widget11, "menu_to", al, ac );
	xmstrings[0] = XmStringCreateLtoR("To:", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	XtSetArg(al[ac], XmNsubMenuId, menu_to); ac++;
	widget12 = XmCreateCascadeButton ( widget11, "widget12", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	XtSetArg(al[ac], XmNcolumns, 48); ac++;
	XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
	XtSetArg(al[ac], XmNrows, 13); ac++;
	text_msg = XmCreateScrolledText ( widget5, "text_msg", al, ac );
	ac = 0;
	widget14 = XtParent ( text_msg );

	widget18 = XmCreateForm ( widget4, "widget18", al, ac );
	XtSetArg(al[ac], XmNvisibleItemCount, 6); ac++;
	XtSetArg(al[ac], XmNselectionPolicy, XmEXTENDED_SELECT); ac++;
	XtSetArg(al[ac], XmNlistSizePolicy, XmCONSTANT); ac++;
	list_icons = XmCreateScrolledList ( widget18, "list_icons", al, ac );
	ac = 0;
	widget19 = XtParent ( list_icons );

	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	xmstrings[0] = XmStringCreateLtoR("Remove", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	remove_button = XmCreatePushButton ( widget18, "remove_button", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	xmstrings[0] = XmStringCreateLtoR("Attachments (drop any icon here):", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	widget24 = XmCreateLabel ( widget18, "widget24", 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_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 5); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
        XtSetValues ( widget2,al, ac );
	ac = 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 ( widget3,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, widget2); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
        XtSetValues ( widget4,al, ac );
	ac = 0;
	XtAddCallback (widget2, XmNactivateCallback, send_callback,NULL);
	XtAddCallback (widget3, XmNactivateCallback, cancel_callback,NULL);

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 5); ac++;
	XtSetArg(al[ac], XmNtopWidget, widget9); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 0); ac++;
        XtSetValues ( widget6,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 0); ac++;
        XtSetValues ( widget9,al, ac );
	ac = 0;

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

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
        XtSetValues ( widget7,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
	XtSetArg(al[ac], XmNleftWidget, widget7); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 0); ac++;
        XtSetValues ( text_subject,al, ac );
	ac = 0;
	children[ac++] = widget7;
	children[ac++] = text_subject;
	XtManageChildren(children, ac);
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
	XtSetArg(al[ac], XmNleftWidget, widget11); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 0); ac++;
        XtSetValues ( text_to,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
        XtSetValues ( widget11,al, ac );
	ac = 0;
	XtAddCallback (menu_to, XmNentryCallback, entry_callback,NULL);
	children[ac++] = widget12;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = text_to;
	children[ac++] = widget11;
	XtManageChildren(children, ac);
	ac = 0;
	XtManageChild(text_msg);
	children[ac++] = widget6;
	children[ac++] = widget9;
	XtManageChildren(children, ac);
	ac = 0;

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

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

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
        XtSetValues ( widget24,al, ac );
	ac = 0;
	XtAddCallback (list_icons, XmNsingleSelectionCallback, browse_callback,NULL);
	XtAddCallback (list_icons, XmNmultipleSelectionCallback, browse_callback,NULL);
	XtAddCallback (list_icons, XmNextendedSelectionCallback, browse_callback,NULL);
	XtAddCallback (list_icons, XmNdefaultActionCallback, browse_callback,NULL);
	XtAddCallback (list_icons, XmNbrowseSelectionCallback, browse_callback,NULL);
	XtManageChild(list_icons);
	XtAddCallback (remove_button, XmNactivateCallback, remove_callback,NULL);
	children[ac++] = remove_button;
	children[ac++] = widget24;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = widget5;
	children[ac++] = widget18;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = widget2;
	children[ac++] = widget3;
	children[ac++] = widget4;
	XtManageChildren(children, ac);
	ac = 0;
	XtManageChild ( form);
}


