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

#include <xdclass.h>

class UIIconHelp_c: public xd_XmForm_c {
public:
	virtual void create (Widget parent, char *widget_name = NULL);
protected:
	Widget UIIconHelp;
	Widget drag_;
	Widget menu1_;
	Widget menu2_;
	Widget help_;
public:
	static void newIconCB( Widget, XtPointer, XtPointer );
	virtual void newIconCB( Widget, XtPointer ) = 0;
	static void deleteCB( Widget, XtPointer, XtPointer );
	virtual void deleteCB( Widget, XtPointer ) = 0;
	static void editCB( Widget, XtPointer, XtPointer );
	virtual void editCB( Widget, XtPointer ) = 0;
	static void folderCB( Widget, XtPointer, XtPointer );
	virtual void folderCB( Widget, XtPointer ) = 0;
};

typedef UIIconHelp_c *UIIconHelp_p;

UIIconHelp_p UIIconHelp = (UIIconHelp_p) NULL;



void UIIconHelp_c::create (Widget parent, char *widget_name)
{
	Widget children[4];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	Widget frame1 = (Widget)NULL;
	Widget label2 = (Widget)NULL;
	Widget separator1 = (Widget)NULL;
	Widget button1 = (Widget)NULL;
	Widget button2 = (Widget)NULL;
	Widget button4 = (Widget)NULL;
	Widget button3 = (Widget)NULL;
	Widget drawingArea1 = (Widget)NULL;
	Widget drawingArea2 = (Widget)NULL;

	if ( !widget_name )
		widget_name = "UIIconHelp";

	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	UIIconHelp = XmCreateForm ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = UIIconHelp;
	XtSetArg(al[ac], XmNshadowType, XmSHADOW_IN); ac++;
	frame1 = XmCreateFrame ( UIIconHelp, "frame1", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNautoClean, TRUE); ac++;
	XtSetArg(al[ac], XmNsingleLine, TRUE); ac++;
	XtSetArg(al[ac], XmNeditNames, TRUE); ac++;
	XtSetArg(al[ac], XmNheight, 60); ac++;
	drag_ = XtCreateWidget("drag_", dragWidgetClass, frame1, al, ac);
	ac = 0;
	menu1_ = XmCreatePopupMenu ( drag_, "menu1_", al, ac );
	label2 = XmCreateLabel ( menu1_, "title", al, ac );
	separator1 = XmCreateSeparator ( menu1_, "separator1", al, ac );
	button1 = XmCreatePushButton ( menu1_, "edit", al, ac );
	button2 = XmCreatePushButton ( menu1_, "delete", al, ac );
	menu2_ = XmCreatePopupMenu ( drag_, "menu2_", al, ac );
	button4 = XmCreatePushButton ( menu2_, "New icon...", al, ac );
	button3 = XmCreatePushButton ( menu2_, "Open help folder", al, ac );
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;
	help_ = XmCreateLabel ( frame1, "Help", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNwidth, 1); ac++;
	XtSetArg(al[ac], XmNheight, 80); ac++;
	drawingArea1 = XmCreateDrawingArea ( UIIconHelp, "drawingArea1", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNwidth, 290); ac++;
	drawingArea2 = XmCreateDrawingArea ( UIIconHelp, "drawingArea2", al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomWidget, drawingArea2); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftWidget, drawingArea1); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( frame1,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_NONE); 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_NONE); ac++;
	XtSetValues ( drawingArea2,al, ac );
	ac = 0;
	XtAddCallback (button1, XmNactivateCallback, editCB, (XtPointer) this);
	XtAddCallback (button2, XmNactivateCallback, deleteCB, (XtPointer) this);
	children[ac++] = label2;
	children[ac++] = separator1;
	children[ac++] = button1;
	children[ac++] = button2;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (button4, XmNactivateCallback, newIconCB, (XtPointer) this);
	XtAddCallback (button3, XmNactivateCallback, folderCB, (XtPointer) this);
	children[ac++] = button4;
	children[ac++] = button3;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = drag_;
	children[ac++] = help_;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = frame1;
	children[ac++] = drawingArea1;
	children[ac++] = drawingArea2;
	XtManageChildren(children, ac);
	ac = 0;
}

void UIIconHelp_c::newIconCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIIconHelp_p instance = (UIIconHelp_p) client_data;
	instance->newIconCB ( widget, call_data );
}

void UIIconHelp_c::deleteCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIIconHelp_p instance = (UIIconHelp_p) client_data;
	instance->deleteCB ( widget, call_data );
}

void UIIconHelp_c::editCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIIconHelp_p instance = (UIIconHelp_p) client_data;
	instance->editCB ( widget, call_data );
}

void UIIconHelp_c::folderCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIIconHelp_p instance = (UIIconHelp_p) client_data;
	instance->folderCB ( widget, call_data );
}

