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

#include <xdclass.h>

class UIPaperDrawer_c: public xd_XmForm_c {
public:
	virtual void create (Widget parent, char *widget_name = NULL);
protected:
	Widget UIPaperDrawer;
	Widget height_;
	Widget width_;
public:
	static void a3CB( Widget, XtPointer, XtPointer );
	virtual void a3CB( Widget, XtPointer ) = 0;
	static void a4CB( Widget, XtPointer, XtPointer );
	virtual void a4CB( Widget, XtPointer ) = 0;
	static void rotateCB( Widget, XtPointer, XtPointer );
	virtual void rotateCB( Widget, XtPointer ) = 0;
	static void setCB( Widget, XtPointer, XtPointer );
	virtual void setCB( Widget, XtPointer ) = 0;
};

typedef UIPaperDrawer_c *UIPaperDrawer_p;

UIPaperDrawer_p UIPaperDrawer = (UIPaperDrawer_p) NULL;



void UIPaperDrawer_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 rowcol1 = (Widget)NULL;
	Widget frame1 = (Widget)NULL;
	Widget label1 = (Widget)NULL;
	Widget frame2 = (Widget)NULL;
	Widget label2 = (Widget)NULL;
	Widget form1 = (Widget)NULL;
	Widget rowcol2 = (Widget)NULL;
	Widget button4 = (Widget)NULL;
	Widget button1 = (Widget)NULL;
	Widget button2 = (Widget)NULL;
	Widget button3 = (Widget)NULL;

	if ( !widget_name )
		widget_name = "Paper";

	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	UIPaperDrawer = XmCreateForm ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = UIPaperDrawer;
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	rowcol1 = XmCreateRowColumn ( UIPaperDrawer, "rowcol1", al, ac );
	ac = 0;
	frame1 = XmCreateFrame ( rowcol1, "frame1", al, ac );
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;
	label1 = XmCreateLabel ( frame1, "Height:", al, ac );
	ac = 0;
	height_ = XmCreateTextField ( frame1, "height_", al, ac );
	frame2 = XmCreateFrame ( rowcol1, "frame2", al, ac );
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;
	label2 = XmCreateLabel ( frame2, "Width:", al, ac );
	ac = 0;
	width_ = XmCreateTextField ( frame2, "width_", al, ac );
	form1 = XmCreateForm ( rowcol1, "form1", al, ac );
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	rowcol2 = XmCreateRowColumn ( form1, "rowcol2", al, ac );
	ac = 0;
	button4 = XmCreatePushButton ( rowcol2, "Set", al, ac );
	button1 = XmCreatePushButton ( rowcol2, "Rotate", al, ac );
	button2 = XmCreatePushButton ( rowcol2, "A4", al, ac );
	button3 = XmCreatePushButton ( rowcol2, "A3", al, ac );

	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 ( rowcol1,al, ac );
	ac = 0;
	children[ac++] = label1;
	children[ac++] = height_;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = label2;
	children[ac++] = width_;
	XtManageChildren(children, 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 ( rowcol2,al, ac );
	ac = 0;
	XtAddCallback (button4, XmNactivateCallback, setCB, (XtPointer) this);
	XtAddCallback (button1, XmNactivateCallback, rotateCB, (XtPointer) this);
	XtAddCallback (button2, XmNactivateCallback, a4CB, (XtPointer) this);
	XtAddCallback (button3, XmNactivateCallback, a3CB, (XtPointer) this);
	children[ac++] = button4;
	children[ac++] = button1;
	children[ac++] = button2;
	children[ac++] = button3;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = rowcol2;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = frame1;
	children[ac++] = frame2;
	children[ac++] = form1;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = rowcol1;
	XtManageChildren(children, ac);
	ac = 0;
}

void UIPaperDrawer_c::a3CB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIPaperDrawer_p instance = (UIPaperDrawer_p) client_data;
	instance->a3CB ( widget, call_data );
}

void UIPaperDrawer_c::a4CB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIPaperDrawer_p instance = (UIPaperDrawer_p) client_data;
	instance->a4CB ( widget, call_data );
}

void UIPaperDrawer_c::rotateCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIPaperDrawer_p instance = (UIPaperDrawer_p) client_data;
	instance->rotateCB ( widget, call_data );
}

void UIPaperDrawer_c::setCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIPaperDrawer_p instance = (UIPaperDrawer_p) client_data;
	instance->setCB ( widget, call_data );
}

