#include <Xm/Protocols.h>
#include "Tab.h"
/*
** 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/DrawingA.h>
#include <Xm/Form.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>

#include <Xm/Protocols.h>  
#include "flags.h"
#include "uipref.h"

pref_shell_p pref_shell = (pref_shell_p) NULL;



void pref_shell_c::create (Widget parent, char *widget_name)
{
	Widget children[2];      /* 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;

	if ( !widget_name )
	  widget_name = (char*) "pref_shell";

	XtSetArg(al[ac], XmNallowShellResize, FALSE); ac++;
	pref_shell = XmCreateDialogShell ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = pref_shell;
	XmAddWMProtocolCallback( pref_shell, XmInternAtom(XtDisplay(pref_shell), (char*) "WM_DELETE_WINDOW", False),&pref_shell_c:: closeCB, (XtPointer) this);
	XtSetArg(al[ac], XmNresizePolicy, XmRESIZE_ANY); ac++;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	form_ = XmCreateForm ( pref_shell, (char*)"form_", al, ac );
	ac = 0;
#define XmCreateDrawingArea CreateTab
	tab_ = XmCreateDrawingArea ( form_, (char*)"tab_", al, ac );
	ac = 0;
	menuBar1 = XmCreateMenuBar ( form_, (char*)"menuBar1", al, ac );
	cascade1 = XmCreateCascadeButton ( menuBar1, (char*)"File", al, ac );
	menu1 = XmCreatePulldownMenu ( menuBar1, (char*)"menu1", al, ac );
	button_close = XmCreatePushButton ( menu1, (char*)"button_close", al, ac );
	XtSetArg(al[ac], XmNcancelButton, button_close); ac++;
	XtSetValues ( form_,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_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( tab_,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( menuBar1,al, ac );
	ac = 0;
	XtAddCallback (form_, XmNmapCallback,&pref_shell_c:: mapCB, (XtPointer) this);
	XtAddCallback (button_close, XmNactivateCallback,&pref_shell_c:: closeCB, (XtPointer) this);
	children[ac++] = button_close;
	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;
	children[ac++] = tab_;
	children[ac++] = menuBar1;
	XtManageChildren(children, ac);
}

void pref_shell_c::mapCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	pref_shell_p instance = (pref_shell_p) client_data;
	instance->mapCB ( widget, call_data );
}

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

