/***************************** 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/Text.h>
#include <Xm/ToggleBG.h>
#include <Drag.h>

#include <Xm/Protocols.h>
#include "UISyncFolders.h"

UISyncFolders_p UISyncFolders = (UISyncFolders_p) NULL;



void UISyncFolders_c::create (Display *display, char *app_name, int app_argc, char **app_argv, char *app_class_name)
{
	Widget children[5];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	Widget rowcol1 = (Widget)NULL;
	Widget label1 = (Widget)NULL;
	Widget form4 = (Widget)NULL;
	Widget radioBox4 = (Widget)NULL;
	Widget label8 = (Widget)NULL;
	Widget form7 = (Widget)NULL;
	Widget radioBox2 = (Widget)NULL;
	Widget form3 = (Widget)NULL;
	Widget frame4 = (Widget)NULL;
	Widget label3 = (Widget)NULL;
	Widget frame5 = (Widget)NULL;
	Widget label4 = (Widget)NULL;
	Widget label2 = (Widget)NULL;
	Widget form8 = (Widget)NULL;
	Widget radioBox3 = (Widget)NULL;
	Widget form1 = (Widget)NULL;
	Widget button2 = (Widget)NULL;
	Widget button3 = (Widget)NULL;

	if ( !app_class_name )
		app_class_name = "XApplication";

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
	XtSetArg(al[ac], XmNargc, app_argc); ac++;
	XtSetArg(al[ac], XmNargv, app_argv); ac++;
	UISyncFolders = XtAppCreateShell ( app_name, app_class_name, applicationShellWidgetClass, display, al, ac );
	ac = 0;
	_xd_rootwidget = UISyncFolders;
	XmAddWMProtocolCallback( UISyncFolders, XmInternAtom(XtDisplay(UISyncFolders), "WM_DELETE_WINDOW", False), closeCB, (XtPointer) this);
	rowcol1 = XmCreateRowColumn ( UISyncFolders, "rowcol1", al, ac );
	XtSetArg(al[ac], XmNeditable, FALSE); ac++;
	XtSetArg(al[ac], XmNresizeHeight, TRUE); ac++;
	XtSetArg(al[ac], XmNpendingDelete, FALSE); ac++;
	XtSetArg(al[ac], XmNcursorPositionVisible, FALSE); ac++;
	XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
	XtSetArg(al[ac], XmNrows, 6); ac++;
	XtSetArg(al[ac], XmNautoShowCursorPosition, FALSE); ac++;
	XtSetArg(al[ac], XmNwordWrap, TRUE); ac++;
	text_ = XmCreateText ( rowcol1, "text_", al, ac );
	ac = 0;
	added_form_ = XmCreateFrame ( rowcol1, "added_form_", al, ac );
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;
	label1 = XmCreateLabel ( added_form_, "What has been added in the system folder:", al, ac );
	ac = 0;
	form4 = XmCreateForm ( added_form_, "form4", al, ac );
	radioBox4 = XmCreateRadioBox ( form4, "radioBox4", al, ac );
	XtSetArg(al[ac], XmNset, TRUE); ac++;
	add_all_ = XmCreateToggleButtonGadget ( radioBox4, "Add all", al, ac );
	ac = 0;
	add_selected_ = XmCreateToggleButtonGadget ( radioBox4, "Add selected only", al, ac );
	add_none_ = XmCreateToggleButtonGadget ( radioBox4, "Add none", al, ac );
	XtSetArg(al[ac], XmNheight, 68); ac++;
	added_ = XtCreateWidget("added_", dragWidgetClass, form4, al, ac);
	ac = 0;
	changed_form_ = XmCreateFrame ( rowcol1, "changed_form_", al, ac );
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;
	label8 = XmCreateLabel ( changed_form_, "What has changed:", al, ac );
	ac = 0;
	form7 = XmCreateForm ( changed_form_, "form7", al, ac );
	radioBox2 = XmCreateRadioBox ( form7, "radioBox2", al, ac );
	XtSetArg(al[ac], XmNset, TRUE); ac++;
	preserve_all_ = XmCreateToggleButtonGadget ( radioBox2, "Preserve all", al, ac );
	ac = 0;
	preserve_selected_ = XmCreateToggleButtonGadget ( radioBox2, "Preserve selected only", al, ac );
	overwrite_all_ = XmCreateToggleButtonGadget ( radioBox2, "Overwrite all", al, ac );
	overwrite_selected_ = XmCreateToggleButtonGadget ( radioBox2, "Overwrite selected only", al, ac );
	form3 = XmCreateForm ( form7, "form3", al, ac );
	frame4 = XmCreateFrame ( form3, "frame4", al, ac );
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;
	label3 = XmCreateLabel ( frame4, "Your version:", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNheight, 68); ac++;
	changed_u_ = XtCreateWidget("changed_u_", dragWidgetClass, frame4, al, ac);
	ac = 0;
	frame5 = XmCreateFrame ( form3, "frame5", al, ac );
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;
	label4 = XmCreateLabel ( frame5, "System version:", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNheight, 68); ac++;
	changed_s_ = XtCreateWidget("changed_s_", dragWidgetClass, frame5, al, ac);
	ac = 0;
	gone_form_ = XmCreateFrame ( rowcol1, "gone_form_", al, ac );
	XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++;
	label2 = XmCreateLabel ( gone_form_, "What has been removed from the system folder:", al, ac );
	ac = 0;
	form8 = XmCreateForm ( gone_form_, "form8", al, ac );
	radioBox3 = XmCreateRadioBox ( form8, "radioBox3", al, ac );
	XtSetArg(al[ac], XmNset, TRUE); ac++;
	remove_all_ = XmCreateToggleButtonGadget ( radioBox3, "Remove all", al, ac );
	ac = 0;
	remove_selected_ = XmCreateToggleButtonGadget ( radioBox3, "Remove selected only", al, ac );
	keep_all_ = XmCreateToggleButtonGadget ( radioBox3, "Keep all", al, ac );
	XtSetArg(al[ac], XmNheight, 68); ac++;
	gone_ = XtCreateWidget("gone_", dragWidgetClass, form8, al, ac);
	ac = 0;
	form1 = XmCreateForm ( rowcol1, "form1", al, ac );
	button2 = XmCreatePushButton ( form1, "Later", al, ac );
	button3 = XmCreatePushButton ( form1, "Synchronize", al, ac );

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 60); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( radioBox4,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_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 60); ac++;
	XtSetValues ( added_,al, ac );
	ac = 0;
	XtAddCallback (radioBox4, XmNentryCallback, entryCB, (XtPointer) this);
	children[ac++] = add_all_;
	children[ac++] = add_selected_;
	children[ac++] = add_none_;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (added_, XmNselectCallback, selectCB, (XtPointer) this);
	children[ac++] = radioBox4;
	children[ac++] = added_;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = label1;
	children[ac++] = form4;
	XtManageChildren(children, ac);
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 60); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( radioBox2,al, ac );
	ac = 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_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 60); ac++;
	XtSetValues ( form3,al, ac );
	ac = 0;
	XtAddCallback (radioBox2, XmNentryCallback, entryCB, (XtPointer) this);
	children[ac++] = preserve_all_;
	children[ac++] = preserve_selected_;
	children[ac++] = overwrite_all_;
	children[ac++] = overwrite_selected_;
	XtManageChildren(children, ac);
	ac = 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_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 50); 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_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 50); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( frame5,al, ac );
	ac = 0;
	XtAddCallback (changed_u_, XmNselectCallback, selectCB, (XtPointer) this);
	children[ac++] = label3;
	children[ac++] = changed_u_;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (changed_s_, XmNselectCallback, selectCB, (XtPointer) this);
	children[ac++] = label4;
	children[ac++] = changed_s_;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = frame4;
	children[ac++] = frame5;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = radioBox2;
	children[ac++] = form3;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = label8;
	children[ac++] = form7;
	XtManageChildren(children, ac);
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 60); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
	XtSetValues ( radioBox3,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_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 60); ac++;
	XtSetValues ( gone_,al, ac );
	ac = 0;
	XtAddCallback (radioBox3, XmNentryCallback, entryCB, (XtPointer) this);
	children[ac++] = remove_all_;
	children[ac++] = remove_selected_;
	children[ac++] = keep_all_;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (gone_, XmNselectCallback, selectCB, (XtPointer) this);
	children[ac++] = radioBox3;
	children[ac++] = gone_;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = label2;
	children[ac++] = form8;
	XtManageChildren(children, 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_POSITION); ac++;
	XtSetArg(al[ac], XmNrightPosition, 49); ac++;
	XtSetValues ( button2,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
	XtSetArg(al[ac], XmNleftPosition, 51); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( button3,al, ac );
	ac = 0;
	XtAddCallback (button2, XmNactivateCallback, closeCB, (XtPointer) this);
	XtAddCallback (button3, XmNactivateCallback, syncCB, (XtPointer) this);
	children[ac++] = button2;
	children[ac++] = button3;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = text_;
	children[ac++] = added_form_;
	children[ac++] = changed_form_;
	children[ac++] = gone_form_;
	children[ac++] = form1;
	XtManageChildren(children, ac);
	ac = 0;
	XtManageChild ( rowcol1);
}

void UISyncFolders_c::selectCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UISyncFolders_p instance = (UISyncFolders_p) client_data;
	instance->selectCB ( widget, call_data );
}

void UISyncFolders_c::entryCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UISyncFolders_p instance = (UISyncFolders_p) client_data;
	instance->entryCB ( widget, call_data );
}

void UISyncFolders_c::syncCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UISyncFolders_p instance = (UISyncFolders_p) client_data;
	instance->syncCB ( widget, call_data );
}

void UISyncFolders_c::closeCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UISyncFolders_p instance = (UISyncFolders_p) client_data;
	instance->closeCB ( widget, call_data );
}

