/***************************** 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/List.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/Scale.h>
#include <Xm/ScrollBar.h>
#include <Xm/TextF.h>

#include <xdclass.h>

class UIColorHelp_c: public xd_XmForm_c {
public:
	virtual void create (Widget parent, char *widget_name = NULL);
protected:
	Widget UIColorHelp;
	Widget list_;
	Widget red_;
	Widget green_;
	Widget blue_;
	Widget hue_;
	Widget saturation_;
	Widget lightness_;
	Widget sample_;
	Widget text_;
public:
	static void hslCB( Widget, XtPointer, XtPointer );
	virtual void hslCB( Widget, XtPointer ) = 0;
	static void addCB( Widget, XtPointer, XtPointer );
	virtual void addCB( Widget, XtPointer ) = 0;
	static void rgbCB( Widget, XtPointer, XtPointer );
	virtual void rgbCB( Widget, XtPointer ) = 0;
	static void extendedCB( Widget, XtPointer, XtPointer );
	virtual void extendedCB( Widget, XtPointer ) = 0;
	static void multipleCB( Widget, XtPointer, XtPointer );
	virtual void multipleCB( Widget, XtPointer ) = 0;
	static void singleCB( Widget, XtPointer, XtPointer );
	virtual void singleCB( Widget, XtPointer ) = 0;
	static void browseCB( Widget, XtPointer, XtPointer );
	virtual void browseCB( Widget, XtPointer ) = 0;
};

typedef UIColorHelp_c *UIColorHelp_p;

UIColorHelp_p UIColorHelp = (UIColorHelp_p) NULL;



void UIColorHelp_c::create (Widget parent, char *widget_name)
{
	Widget children[5];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	Widget scrolledList1 = (Widget)NULL;
	Widget form1 = (Widget)NULL;
	Widget rowcol4 = (Widget)NULL;
	Widget rowcol5 = (Widget)NULL;
	Widget rowcol3 = (Widget)NULL;
	Widget button1 = (Widget)NULL;

	if ( !widget_name )
		widget_name = "UIColorHelp";

	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	UIColorHelp = XmCreateForm ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = UIColorHelp;
	XtSetArg(al[ac], XmNvisibleItemCount, 27); ac++;
	XtSetArg(al[ac], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); ac++;
	list_ = XmCreateScrolledList ( UIColorHelp, "list_", al, ac );
	ac = 0;
	scrolledList1 = XtParent ( list_ );

	form1 = XmCreateForm ( UIColorHelp, "form1", al, ac );
	rowcol4 = XmCreateRowColumn ( form1, "rowcol4", al, ac );
	rowcol5 = XmCreateRowColumn ( rowcol4, "rowcol5", al, ac );
	XtSetArg(al[ac], XmNshowValue, TRUE); ac++;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	XtSetArg(al[ac], XmNdecimalPoints, 2); ac++;
	red_ = XmCreateScale ( rowcol5, "red_", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNshowValue, TRUE); ac++;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	XtSetArg(al[ac], XmNdecimalPoints, 2); ac++;
	green_ = XmCreateScale ( rowcol5, "green_", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNshowValue, TRUE); ac++;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	XtSetArg(al[ac], XmNdecimalPoints, 2); ac++;
	blue_ = XmCreateScale ( rowcol5, "blue_", al, ac );
	ac = 0;
	rowcol3 = XmCreateRowColumn ( rowcol4, "hsl_form_", al, ac );
	XtSetArg(al[ac], XmNshowValue, TRUE); ac++;
	XtSetArg(al[ac], XmNmaximum, 360); ac++;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	XtSetArg(al[ac], XmNdecimalPoints, 0); ac++;
	hue_ = XmCreateScale ( rowcol3, "hue_", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNshowValue, TRUE); ac++;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	XtSetArg(al[ac], XmNdecimalPoints, 2); ac++;
	saturation_ = XmCreateScale ( rowcol3, "saturation_", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNshowValue, TRUE); ac++;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	XtSetArg(al[ac], XmNdecimalPoints, 2); ac++;
	lightness_ = XmCreateScale ( rowcol3, "lightness_", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNheight, 30); ac++;
	sample_ = XmCreateDrawingArea ( rowcol4, "sample_", al, ac );
	ac = 0;
	button1 = XmCreatePushButton ( rowcol4, "<< Add", al, ac );
	text_ = XmCreateTextField ( rowcol4, "text_", al, ac );

	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_NONE); ac++;
	XtSetValues ( scrolledList1,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftWidget, scrolledList1); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( form1,al, ac );
	ac = 0;
	XtAddCallback (list_, XmNbrowseSelectionCallback, browseCB, (XtPointer) this);
	XtAddCallback (list_, XmNsingleSelectionCallback, singleCB, (XtPointer) this);
	XtAddCallback (list_, XmNmultipleSelectionCallback, multipleCB, (XtPointer) this);
	XtAddCallback (list_, XmNextendedSelectionCallback, extendedCB, (XtPointer) this);
	XtManageChild(list_);

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( rowcol4,al, ac );
	ac = 0;
	XtAddCallback (red_, XmNvalueChangedCallback, rgbCB, (XtPointer) this);
	XtAddCallback (green_, XmNvalueChangedCallback, rgbCB, (XtPointer) this);
	XtAddCallback (blue_, XmNvalueChangedCallback, rgbCB, (XtPointer) this);
	children[ac++] = red_;
	children[ac++] = green_;
	children[ac++] = blue_;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (hue_, XmNvalueChangedCallback, hslCB, (XtPointer) this);
	XtAddCallback (saturation_, XmNvalueChangedCallback, hslCB, (XtPointer) this);
	XtAddCallback (lightness_, XmNvalueChangedCallback, hslCB, (XtPointer) this);
	children[ac++] = hue_;
	children[ac++] = saturation_;
	children[ac++] = lightness_;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (button1, XmNactivateCallback, addCB, (XtPointer) this);
	children[ac++] = rowcol5;
	children[ac++] = rowcol3;
	children[ac++] = sample_;
	children[ac++] = button1;
	children[ac++] = text_;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = rowcol4;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = form1;
	XtManageChildren(children, ac);
	ac = 0;
}

void UIColorHelp_c::hslCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIColorHelp_p instance = (UIColorHelp_p) client_data;
	instance->hslCB ( widget, call_data );
}

void UIColorHelp_c::addCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIColorHelp_p instance = (UIColorHelp_p) client_data;
	instance->addCB ( widget, call_data );
}

void UIColorHelp_c::rgbCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIColorHelp_p instance = (UIColorHelp_p) client_data;
	instance->rgbCB ( widget, call_data );
}

void UIColorHelp_c::extendedCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIColorHelp_p instance = (UIColorHelp_p) client_data;
	instance->extendedCB ( widget, call_data );
}

void UIColorHelp_c::multipleCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIColorHelp_p instance = (UIColorHelp_p) client_data;
	instance->multipleCB ( widget, call_data );
}

void UIColorHelp_c::singleCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIColorHelp_p instance = (UIColorHelp_p) client_data;
	instance->singleCB ( widget, call_data );
}

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

