/***************************** 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 <stdlib.h>
#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>

#include <Xm/Xm.h>
#include <Xm/DialogS.h>
#include <Xm/DrawingA.h>
#include <Xm/Form.h>
#include <Xm/Label.h>
#include <Xm/List.h>
#include <Xm/ScrollBar.h>
#include <Array.h>

#include <xdclass.h>

class UIODBFunctionsDrawer_c: public xd_XmForm_c {
public:
	virtual void create (Widget parent, char *widget_name = NULL);
protected:
	Widget UIODBFunctionsDrawer;
	Widget operators_;
	Widget functions_;
	Widget contants_;
	Widget help_;
public:
	static void browseCB( Widget, XtPointer, XtPointer );
	virtual void browseCB( Widget, XtPointer ) = 0;
	static void doubleClickCB( Widget, XtPointer, XtPointer );
	virtual void doubleClickCB( Widget, XtPointer ) = 0;
};

typedef UIODBFunctionsDrawer_c *UIODBFunctionsDrawer_p;

UIODBFunctionsDrawer_p UIODBFunctionsDrawer = (UIODBFunctionsDrawer_p) NULL;



void UIODBFunctionsDrawer_c::create (Widget parent, char *widget_name)
{
	Widget children[3];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	Widget drawingArea1 = (Widget)NULL;
	Widget form2 = (Widget)NULL;
	Widget label2 = (Widget)NULL;
	Widget scrolledList2 = (Widget)NULL;
	Widget form1 = (Widget)NULL;
	Widget label1 = (Widget)NULL;
	Widget scrolledList1 = (Widget)NULL;
	Widget form3 = (Widget)NULL;
	Widget label3 = (Widget)NULL;
	Widget scrolledList3 = (Widget)NULL;

	if ( !widget_name )
		widget_name = "Functions";

	XtSetArg(al[ac], XmNheight, 128); ac++;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	UIODBFunctionsDrawer = XmCreateForm ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = UIODBFunctionsDrawer;
	XtSetArg(al[ac], XmNcolumns, 3); ac++;
	drawingArea1 = XtCreateWidget("drawingArea1", arrayWidgetClass, UIODBFunctionsDrawer, al, ac);
	ac = 0;
	form2 = XmCreateForm ( drawingArea1, "form2", al, ac );
	label2 = XmCreateLabel ( form2, "Operators", al, ac );
	XtSetArg(al[ac], XmNvisibleItemCount, 3); ac++;
	XtSetArg(al[ac], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); ac++;
	operators_ = XmCreateScrolledList ( form2, "operators_", al, ac );
	ac = 0;
	scrolledList2 = XtParent ( operators_ );

	form1 = XmCreateForm ( drawingArea1, "form1", al, ac );
	label1 = XmCreateLabel ( form1, "Functions", al, ac );
	XtSetArg(al[ac], XmNvisibleItemCount, 3); ac++;
	XtSetArg(al[ac], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); ac++;
	functions_ = XmCreateScrolledList ( form1, "functions_", al, ac );
	ac = 0;
	scrolledList1 = XtParent ( functions_ );

	form3 = XmCreateForm ( drawingArea1, "form3", al, ac );
	label3 = XmCreateLabel ( form3, "Constants", al, ac );
	XtSetArg(al[ac], XmNvisibleItemCount, 3); ac++;
	XtSetArg(al[ac], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); ac++;
	contants_ = XmCreateScrolledList ( form3, "contants_", al, ac );
	ac = 0;
	scrolledList3 = XtParent ( contants_ );

	XtSetArg(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++;
	help_ = XmCreateLabel ( UIODBFunctionsDrawer, "-", al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomWidget, help_); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( drawingArea1,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_FORM); ac++;
	XtSetValues ( help_,al, ac );
	ac = 0;

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

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, label2); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( scrolledList2,al, ac );
	ac = 0;
	XtAddCallback (operators_, XmNbrowseSelectionCallback, browseCB, (XtPointer) this);
	XtAddCallback (operators_, XmNdefaultActionCallback, doubleClickCB, (XtPointer) this);
	XtManageChild(operators_);
	children[ac++] = label2;
	XtManageChildren(children, ac);
	ac = 0;

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

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, label1); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( scrolledList1,al, ac );
	ac = 0;
	XtAddCallback (functions_, XmNbrowseSelectionCallback, browseCB, (XtPointer) this);
	XtAddCallback (functions_, XmNdefaultActionCallback, doubleClickCB, (XtPointer) this);
	XtManageChild(functions_);
	children[ac++] = label1;
	XtManageChildren(children, ac);
	ac = 0;

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

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, label3); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( scrolledList3,al, ac );
	ac = 0;
	XtAddCallback (contants_, XmNbrowseSelectionCallback, browseCB, (XtPointer) this);
	XtAddCallback (contants_, XmNdefaultActionCallback, doubleClickCB, (XtPointer) this);
	XtManageChild(contants_);
	children[ac++] = label3;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = form2;
	children[ac++] = form1;
	children[ac++] = form3;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = drawingArea1;
	children[ac++] = help_;
	XtManageChildren(children, ac);
	ac = 0;
}

void UIODBFunctionsDrawer_c::browseCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIODBFunctionsDrawer_p instance = (UIODBFunctionsDrawer_p) client_data;
	instance->browseCB ( widget, call_data );
}

void UIODBFunctionsDrawer_c::doubleClickCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIODBFunctionsDrawer_p instance = (UIODBFunctionsDrawer_p) client_data;
	instance->doubleClickCB ( widget, call_data );
}

