/*
** 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/DialogS.h>
#include <Xm/DrawnB.h>
#include <Xm/Form.h>
#include <Xm/PushB.h>
#include <Xm/ScrollBar.h>
#include <Xm/ScrolledW.h>
#include <Xm/Protocols.h>  
#include "flags.h"


extern "C" {
#include "Hyper.h"
#define XmCreateDrawnButton CreateHyper
}

#include "uidepend.h"

depend_shell_p depend_shell = (depend_shell_p) NULL;



void depend_shell_c::create (Widget parent, char *widget_name)
{
	Widget scrolledWin1 = (Widget)NULL;
	Widget scrollbar1 = (Widget)NULL;
	Widget scrollbar2 = (Widget)NULL;
	Widget children[2];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */

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

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	depend_shell = XmCreateDialogShell ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = depend_shell;
	XmAddWMProtocolCallback( depend_shell, XmInternAtom(XtDisplay(depend_shell), (char*)"WM_DELETE_WINDOW", False),&depend_shell_c:: closeCB, (XtPointer) this);
	XtSetArg(al[ac], XmNresizePolicy, XmRESIZE_ANY); ac++;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	form_ = XmCreateForm ( depend_shell, (char*) "form_", al, ac );

	XtSetArg(al[ac], XmNscrollingPolicy, XmAUTOMATIC); ac++;
	scrolledWin1 = XmCreateScrolledWindow ( form_, "scrolledWin1", al, ac );

	ac = 0;
	button_close = XmCreatePushButton ( form_, (char *) "button_close", al, ac );
	hyper_ = XmCreateDrawnButton ( scrolledWin1, (char*) "hyper_", 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], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 30); ac++; // editres
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightOffset, 4); ac++;
	XtSetValues ( hyper_,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 4); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 30); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 4); ac++;
	XtSetValues ( scrolledWin1,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 4); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 4); ac++;
	XtSetValues ( button_close,al, ac );

	XmScrolledWindowSetAreas(scrolledWin1, scrollbar1, scrollbar2, hyper_ );
	XtAddCallback (button_close, XmNactivateCallback,&depend_shell_c:: closeCB, (XtPointer) this);
	XtAddCallback (hyper_, XmNactivateCallback,&depend_shell_c:: hyperCB, (XtPointer) this);
	ac = 0;
	children[ac++] = button_close;
	children[ac++] = scrolledWin1;
	XtManageChildren(children, ac);
	ac = 0;

	children[ac++] = hyper_;
	XtManageChildren(children, ac);
}

void depend_shell_c::hyperCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	depend_shell_p instance = (depend_shell_p) client_data;
	instance->hyperCB ( widget, call_data );
}

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

