/***************************** 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 <xdclass.h>

class UILayoutDrawer_c: public xd_XmForm_c {
public:
	virtual void create (Widget parent, char *widget_name = NULL);
protected:
	Widget UILayoutDrawer;
	Widget split1_;
	Widget split2_;
	Widget add_;
	Widget delete_;
	Widget join_;
	Widget group_;
	Widget ungroup_;
public:
	static void deleteSelectionCB( Widget, XtPointer, XtPointer );
	virtual void deleteSelectionCB( Widget, XtPointer ) = 0;
	static void addPageCB( Widget, XtPointer, XtPointer );
	virtual void addPageCB( Widget, XtPointer ) = 0;
	static void splitVerCB( Widget, XtPointer, XtPointer );
	virtual void splitVerCB( Widget, XtPointer ) = 0;
	static void splitHorCB( Widget, XtPointer, XtPointer );
	virtual void splitHorCB( Widget, XtPointer ) = 0;
	static void ungroupSelectionCB( Widget, XtPointer, XtPointer );
	virtual void ungroupSelectionCB( Widget, XtPointer ) = 0;
	static void groupSelectionCB( Widget, XtPointer, XtPointer );
	virtual void groupSelectionCB( Widget, XtPointer ) = 0;
	static void joinSelectionCB( Widget, XtPointer, XtPointer );
	virtual void joinSelectionCB( Widget, XtPointer ) = 0;
};

typedef UILayoutDrawer_c *UILayoutDrawer_p;

UILayoutDrawer_p UILayoutDrawer = (UILayoutDrawer_p) NULL;



void UILayoutDrawer_c::create (Widget parent, char *widget_name)
{
	Widget children[4];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	XmString xmstrings[16];    /* temporary storage for XmStrings */
	Widget frame2 = (Widget)NULL;
	Widget form1 = (Widget)NULL;
	Widget rowcol1 = (Widget)NULL;
	Widget button1 = (Widget)NULL;
	Widget button2 = (Widget)NULL;
	Widget button3 = (Widget)NULL;
	Widget button4 = (Widget)NULL;
	Widget label1 = (Widget)NULL;
	Widget rowcol2 = (Widget)NULL;
	Widget button5 = (Widget)NULL;
	Widget button6 = (Widget)NULL;
	Widget button7 = (Widget)NULL;
	Widget button8 = (Widget)NULL;
	Widget label2 = (Widget)NULL;
	Widget frame4 = (Widget)NULL;
	Widget rowcol3 = (Widget)NULL;
	Widget frame5 = (Widget)NULL;
	Widget rowcol4 = (Widget)NULL;

	if ( !widget_name )
		widget_name = "Layout";

	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	UILayoutDrawer = XmCreateForm ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = UILayoutDrawer;
	XtSetArg(al[ac], XmNshadowType, XmSHADOW_IN); ac++;
	frame2 = XmCreateFrame ( UILayoutDrawer, "frame2", al, ac );
	ac = 0;
	form1 = XmCreateForm ( frame2, "form1", al, ac );
	split1_ = XmCreateFrame ( form1, "split1_", al, ac );
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	rowcol1 = XmCreateRowColumn ( split1_, "rowcol1", al, ac );
	ac = 0;
	button1 = XmCreatePushButton ( rowcol1, "2", al, ac );
	button2 = XmCreatePushButton ( rowcol1, "3", al, ac );
	button3 = XmCreatePushButton ( rowcol1, "5", al, ac );
	button4 = XmCreatePushButton ( rowcol1, "7", al, ac );
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;
	xmstrings[0] = XmStringCreateLtoR ( "Split selection horizontally", (XmStringCharSet)XmFONTLIST_DEFAULT_TAG );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	label1 = XmCreateLabel ( split1_, "label1", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	split2_ = XmCreateFrame ( form1, "split2_", al, ac );
	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
	rowcol2 = XmCreateRowColumn ( split2_, "rowcol2", al, ac );
	ac = 0;
	button5 = XmCreatePushButton ( rowcol2, "2", al, ac );
	button6 = XmCreatePushButton ( rowcol2, "3", al, ac );
	button7 = XmCreatePushButton ( rowcol2, "5", al, ac );
	button8 = XmCreatePushButton ( rowcol2, "7", al, ac );
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;
	xmstrings[0] = XmStringCreateLtoR ( "Split selection vertically", (XmStringCharSet)XmFONTLIST_DEFAULT_TAG );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	label2 = XmCreateLabel ( split2_, "label2", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	frame4 = XmCreateFrame ( form1, "frame4", al, ac );
	rowcol3 = XmCreateRowColumn ( frame4, "rowcol3", al, ac );
	xmstrings[0] = XmStringCreateLtoR ( "New frame", (XmStringCharSet)XmFONTLIST_DEFAULT_TAG );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	add_ = XmCreatePushButton ( rowcol3, "add_", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	xmstrings[0] = XmStringCreateLtoR ( "Delete selection", (XmStringCharSet)XmFONTLIST_DEFAULT_TAG );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	delete_ = XmCreatePushButton ( rowcol3, "delete_", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	xmstrings[0] = XmStringCreateLtoR ( "Join selection", (XmStringCharSet)XmFONTLIST_DEFAULT_TAG );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	join_ = XmCreatePushButton ( rowcol3, "join_", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	frame5 = XmCreateFrame ( form1, "frame5", al, ac );
	rowcol4 = XmCreateRowColumn ( frame5, "rowcol4", al, ac );
	xmstrings[0] = XmStringCreateLtoR ( "Connect frames", (XmStringCharSet)XmFONTLIST_DEFAULT_TAG );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	group_ = XmCreatePushButton ( rowcol4, "group_", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );
	xmstrings[0] = XmStringCreateLtoR ( "Disconnect frames", (XmStringCharSet)XmFONTLIST_DEFAULT_TAG );
	XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
	ungroup_ = XmCreatePushButton ( rowcol4, "ungroup_", al, ac );
	ac = 0;
	XmStringFree ( xmstrings [ 0 ] );

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

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

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, split1_); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightWidget, split1_); ac++;
	XtSetValues ( split2_,al, ac );
	ac = 0;

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

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftWidget, split1_); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightWidget, frame4); ac++;
	XtSetValues ( frame5,al, ac );
	ac = 0;
	XtAddCallback (button1, XmNactivateCallback, splitHorCB, (XtPointer) this);
	XtAddCallback (button2, XmNactivateCallback, splitHorCB, (XtPointer) this);
	XtAddCallback (button3, XmNactivateCallback, splitHorCB, (XtPointer) this);
	XtAddCallback (button4, XmNactivateCallback, splitHorCB, (XtPointer) this);
	children[ac++] = button1;
	children[ac++] = button2;
	children[ac++] = button3;
	children[ac++] = button4;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = rowcol1;
	children[ac++] = label1;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (button5, XmNactivateCallback, splitVerCB, (XtPointer) this);
	XtAddCallback (button6, XmNactivateCallback, splitVerCB, (XtPointer) this);
	XtAddCallback (button7, XmNactivateCallback, splitVerCB, (XtPointer) this);
	XtAddCallback (button8, XmNactivateCallback, splitVerCB, (XtPointer) this);
	children[ac++] = button5;
	children[ac++] = button6;
	children[ac++] = button7;
	children[ac++] = button8;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = rowcol2;
	children[ac++] = label2;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (add_, XmNactivateCallback, addPageCB, (XtPointer) this);
	XtAddCallback (delete_, XmNactivateCallback, deleteSelectionCB, (XtPointer) this);
	XtAddCallback (join_, XmNactivateCallback, joinSelectionCB, (XtPointer) this);
	children[ac++] = add_;
	children[ac++] = delete_;
	children[ac++] = join_;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = rowcol3;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (group_, XmNactivateCallback, groupSelectionCB, (XtPointer) this);
	XtAddCallback (ungroup_, XmNactivateCallback, ungroupSelectionCB, (XtPointer) this);
	children[ac++] = group_;
	children[ac++] = ungroup_;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = rowcol4;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = split1_;
	children[ac++] = split2_;
	children[ac++] = frame4;
	children[ac++] = frame5;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = form1;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = frame2;
	XtManageChildren(children, ac);
	ac = 0;
}

void UILayoutDrawer_c::deleteSelectionCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UILayoutDrawer_p instance = (UILayoutDrawer_p) client_data;
	instance->deleteSelectionCB ( widget, call_data );
}

void UILayoutDrawer_c::addPageCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UILayoutDrawer_p instance = (UILayoutDrawer_p) client_data;
	instance->addPageCB ( widget, call_data );
}

void UILayoutDrawer_c::splitVerCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UILayoutDrawer_p instance = (UILayoutDrawer_p) client_data;
	instance->splitVerCB ( widget, call_data );
}

void UILayoutDrawer_c::splitHorCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UILayoutDrawer_p instance = (UILayoutDrawer_p) client_data;
	instance->splitHorCB ( widget, call_data );
}

void UILayoutDrawer_c::ungroupSelectionCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UILayoutDrawer_p instance = (UILayoutDrawer_p) client_data;
	instance->ungroupSelectionCB ( widget, call_data );
}

void UILayoutDrawer_c::groupSelectionCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UILayoutDrawer_p instance = (UILayoutDrawer_p) client_data;
	instance->groupSelectionCB ( widget, call_data );
}

void UILayoutDrawer_c::joinSelectionCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UILayoutDrawer_p instance = (UILayoutDrawer_p) client_data;
	instance->joinSelectionCB ( widget, call_data );
}

