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

#include <Xm/Protocols.h>  

#include "uimail.h"

mail_shell_p mail_shell = (mail_shell_p) NULL;



void mail_shell_c::create (Widget parent, char *widget_name)
{
	Widget children[4];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	Widget menuBar1 = (Widget)NULL;
	Widget cascade1 = (Widget)NULL;
	Widget menu1 = (Widget)NULL;
	Widget button2 = (Widget)NULL;
	Widget scrolledText1 = (Widget)NULL;
	Widget scrolledList1 = (Widget)NULL;

	if ( !widget_name )
		widget_name = "mail_shell";

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	mail_shell = XmCreateDialogShell ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = mail_shell;
	XmAddWMProtocolCallback( mail_shell, XmInternAtom(XtDisplay(mail_shell), "WM_DELETE_WINDOW", False),&mail_shell_c:: closeCB, (XtPointer) this);
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	form_ = XmCreateForm ( mail_shell, "form_", al, ac );
	ac = 0;
	menuBar1 = XmCreateMenuBar ( form_, "menuBar1", al, ac );
	cascade1 = XmCreateCascadeButton ( menuBar1, "File", al, ac );
	menu1 = XmCreatePulldownMenu ( menuBar1, "menu1", al, ac );
	button2 = XmCreatePushButton ( menu1, "Close", al, ac );
	XtSetArg(al[ac], XmNcolumns, 40); ac++;
	XtSetArg(al[ac], XmNeditable, FALSE); ac++;
	XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
	XtSetArg(al[ac], XmNrows, 10); ac++;
	text_ = XmCreateScrolledText ( form_, "text_", al, ac );
	ac = 0;
	scrolledText1 = XtParent ( text_ );

	input_ = XmCreateTextField ( form_, "input_", al, ac );
	XtSetArg(al[ac], XmNselectionPolicy, XmMULTIPLE_SELECT); ac++;
	XtSetArg(al[ac], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); ac++;
	list_ = XmCreateScrolledList ( form_, "list_", al, ac );
	ac = 0;
	scrolledList1 = XtParent ( list_ );


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

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, menuBar1); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomWidget, input_); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightWidget, scrolledList1); ac++;
	XtSetValues ( scrolledText1,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_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightWidget, scrolledList1); ac++;
	XtSetValues ( input_,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, menuBar1); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( scrolledList1,al, ac );
	ac = 0;
	XtAddCallback (button2, XmNactivateCallback,&mail_shell_c:: closeCB, (XtPointer) this);
	children[ac++] = button2;
	XtManageChildren(children, ac);
	ac = 0;
	XtSetArg(al[ac], XmNsubMenuId, menu1); ac++;
	XtSetValues ( cascade1, al, ac );
	ac = 0;
	children[ac++] = cascade1;
	XtManageChildren(children, ac);
	ac = 0;
	XtManageChild(text_);
	XtAddCallback (input_, XmNactivateCallback,&mail_shell_c:: sendCB, (XtPointer) this);
	XtManageChild(list_);
	children[ac++] = menuBar1;
	children[ac++] = input_;
	XtManageChildren(children, ac);
}

void mail_shell_c::closeCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	mail_shell_p instance = (mail_shell_p) client_data;
	instance->closeCB ( widget, call_data );
}

void mail_shell_c::sendCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	mail_shell_p instance = (mail_shell_p) client_data;
	instance->sendCB ( widget, call_data );
}

