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

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 browse_callback ();
extern void delete_callback ();
extern void save_callback ();
extern void refresh_callback ();
extern void close_callback ();

Widget top = (Widget)NULL;
Widget form = (Widget)NULL;
Widget article_list = (Widget)NULL;
Widget article_text = (Widget)NULL;
Widget delete_button = (Widget)NULL;
Widget save_button = (Widget)NULL;
Widget close_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[4];      /* 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 widget6 = (Widget)NULL;
	Widget widget10 = (Widget)NULL;
	Widget widget13 = (Widget)NULL;
	Widget widget15 = (Widget)NULL;

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNtitle, "Metview Icon Inbox"); 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;
	XtSetArg(al[ac], XmNvisibleItemCount, 5); ac++;
	XtSetArg(al[ac], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); ac++;
	article_list = XmCreateScrolledList ( form, "article_list", al, ac );
	ac = 0;
	widget2 = XtParent ( article_list );

	XtSetArg(al[ac], XmNcolumns, 60); ac++;
	XtSetArg(al[ac], XmNeditable, FALSE); ac++;
	XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
	XtSetArg(al[ac], XmNrows, 24); ac++;
	XtSetArg(al[ac], XmNwordWrap, TRUE); ac++;
	XtSetArg(al[ac], XmNscrollHorizontal, FALSE); ac++;
	article_text = XmCreateScrolledText ( form, "article_text", al, ac );
	ac = 0;
	widget6 = XtParent ( article_text );

	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	widget10 = XmCreateRowColumn ( form, "widget10", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	xmstrings[0] = XmStringCreateLtoR("Delete article", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	delete_button = XmCreatePushButton ( widget10, "delete_button", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	xmstrings[0] = XmStringCreateLtoR("Install examples", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	save_button = XmCreatePushButton ( widget10, "save_button", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	widget13 = XmCreateRowColumn ( form, "widget13", al, ac );
	ac = 0;
	xmstrings[0] = XmStringCreateLtoR("Refresh", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	widget15 = XmCreatePushButton ( widget13, "widget15", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	xmstrings[0] = XmStringCreateLtoR("Close", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	close_button = XmCreatePushButton ( widget13, "close_button", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 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 ( widget2,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 5); ac++;
	XtSetArg(al[ac], XmNtopWidget, widget2); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 5); ac++;
	XtSetArg(al[ac], XmNbottomWidget, widget10); 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 ( widget6,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_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 5); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
        XtSetValues ( widget10,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 ( widget13,al, ac );
	ac = 0;
	XtAddCallback (article_list, XmNbrowseSelectionCallback, browse_callback,NULL);
	XtManageChild(article_list);
	XtManageChild(article_text);
	XtAddCallback (delete_button, XmNactivateCallback, delete_callback,NULL);
	XtAddCallback (save_button, XmNactivateCallback, save_callback,NULL);
	children[ac++] = delete_button;
	children[ac++] = save_button;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (widget15, XmNactivateCallback, refresh_callback,NULL);
	XtAddCallback (close_button, XmNactivateCallback, close_callback,NULL);
	children[ac++] = widget15;
	children[ac++] = close_button;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = widget10;
	children[ac++] = widget13;
	XtManageChildren(children, ac);
	ac = 0;
	XtManageChild ( form);
}


