/*
** 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/Label.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/Separator.h>
#include <Xm/TextF.h>
#include <Xm/ToggleB.h>

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

find_shell_p find_shell = (find_shell_p) NULL;



void find_shell_c::create (Widget parent, char *widget_name)
{
	Widget children[8];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	Widget drawingArea2 = (Widget)NULL;
	Widget rowcol1 = (Widget)NULL;
	Widget menuBar1 = (Widget)NULL;
	Widget separator1 = (Widget)NULL;
	Widget drawingArea1 = (Widget)NULL;

	if ( !widget_name )
		widget_name = "find_shell";

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	find_shell = XmCreateDialogShell ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = find_shell;
	XmAddWMProtocolCallback( find_shell, XmInternAtom(XtDisplay(find_shell), "WM_DELETE_WINDOW", False),&find_shell_c:: closeCB, (XtPointer) this);
	XtSetArg(al[ac], XmNresizePolicy, XmRESIZE_ANY); ac++;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	form_ = XmCreateForm ( find_shell, "form_", al, ac );
	ac = 0;
	button_find = XmCreatePushButton ( form_, "button_find", al, ac );
	button_close = XmCreatePushButton ( form_, "button_close", al, ac );
	drawingArea2 = XmCreateDrawingArea ( form_, "drawingArea2", al, ac );
	find_text_ = XmCreateTextField ( form_, "find_text_", al, ac );
	message_ = XmCreateLabel ( form_, "find_message", al, ac );
	XtSetArg(al[ac], XmNnumColumns, 2); ac++;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++;
	rowcol1 = XmCreateRowColumn ( form_, "rowcol1", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	XtSetArg(al[ac], XmNset, TRUE); ac++;
	case_ = XmCreateToggleButton ( rowcol1, "Case sensitive", al, ac );
	ac = 0;
	back_ = XmCreateToggleButton ( rowcol1, "Backwards", al, ac );
	regexp_ = XmCreateToggleButton ( rowcol1, "Regular expression", al, ac );
	XtSetArg(al[ac], XmNset, TRUE); ac++;
	wrap_ = XmCreateToggleButton ( rowcol1, "Wrap around", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNshadowThickness, 1); ac++;
	XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
	XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
	menuBar1 = XmCreateMenuBar ( form_, "menuBar1", al, ac );
	ac = 0;
	quick_find_ = XmCreateCascadeButton ( menuBar1, "quick_find_", al, ac );
	quick_menu_ = XmCreatePulldownMenu ( menuBar1, "quick_menu_", al, ac );
	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	edit_ = XmCreatePushButton ( quick_menu_, "Edit...", al, ac );
	ac = 0;
	separator1 = XmCreateSeparator ( quick_menu_, "separator1", al, ac );
	drawingArea1 = XmCreateDrawingArea ( form_, "drawingArea1", al, ac );
	XtSetArg(al[ac], XmNcancelButton, button_close); ac++;
	XtSetArg(al[ac], XmNdefaultButton, button_find); ac++;
	XtSetValues ( form_,al, ac );
	ac = 0;

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

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

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 3); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftOffset, 3); ac++;
	XtSetArg(al[ac], XmNleftWidget, button_close); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightOffset, 3); ac++;
	XtSetArg(al[ac], XmNrightWidget, button_find); ac++;
	XtSetValues ( drawingArea2,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 2); ac++;
	XtSetArg(al[ac], XmNtopWidget, message_); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightOffset, 0); ac++;
	XtSetArg(al[ac], XmNrightWidget, menuBar1); ac++;
	XtSetValues ( find_text_,al, ac );
	ac = 0;

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

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

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 2); ac++;
	XtSetArg(al[ac], XmNtopWidget, message_); 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 ( menuBar1,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 2); ac++;
	XtSetArg(al[ac], XmNtopWidget, rowcol1); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 2); ac++;
	XtSetArg(al[ac], XmNbottomWidget, button_close); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 148); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( drawingArea1,al, ac );
	ac = 0;
	XtAddCallback (button_find, XmNactivateCallback,&find_shell_c:: findCB, (XtPointer) this);
	XtAddCallback (button_close, XmNactivateCallback,&find_shell_c:: closeCB, (XtPointer) this);
	XtAddCallback (regexp_, XmNvalueChangedCallback,&find_shell_c:: regexCB, (XtPointer) this);
	children[ac++] = case_;
	children[ac++] = back_;
	children[ac++] = regexp_;
	children[ac++] = wrap_;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (quick_menu_, XmNentryCallback,&find_shell_c:: entryCB, (XtPointer) this);
	children[ac++] = edit_;
	children[ac++] = separator1;
	XtManageChildren(children, ac);
	ac = 0;
	XtSetArg(al[ac], XmNsubMenuId, quick_menu_); ac++;
	XtSetValues ( quick_find_, al, ac );
	ac = 0;
	children[ac++] = quick_find_;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = button_find;
	children[ac++] = button_close;
	children[ac++] = drawingArea2;
	children[ac++] = find_text_;
	children[ac++] = rowcol1;
	children[ac++] = menuBar1;
	children[ac++] = drawingArea1;
	XtManageChildren(children, ac);
}

void find_shell_c::entryCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	find_shell_p instance = (find_shell_p) client_data;
	instance->entryCB ( widget, call_data );
}

void find_shell_c::regexCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	find_shell_p instance = (find_shell_p) client_data;
	instance->regexCB ( widget, call_data );
}

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

void find_shell_c::findCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	find_shell_p instance = (find_shell_p) client_data;
	instance->findCB ( widget, call_data );
}

