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


#include "uimenu.h"

menu_form_p menu_form = (menu_form_p) NULL;



void menu_form_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 scrolledList1 = (Widget)NULL;
	Widget form1 = (Widget)NULL;
	Widget rowcol1 = (Widget)NULL;
	Widget rowcol2 = (Widget)NULL;
	Widget label1 = (Widget)NULL;
	Widget optionMenu1 = (Widget)NULL;
	// Widget label2 = (Widget)NULL;
	Widget cascade1 = (Widget)NULL;
	Widget button1 = (Widget)NULL;
	Widget button2 = (Widget)NULL;
	Widget button3 = (Widget)NULL;
	Widget button4 = (Widget)NULL;
	Widget separator2 = (Widget)NULL;

	if ( !widget_name )
		widget_name = "Command menus";

	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	menu_form = XmCreateForm ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = menu_form;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	form_ = XmCreateForm ( menu_form, "form_", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNvisibleItemCount, 17); ac++;
	XtSetArg(al[ac], XmNlistSizePolicy, XmCONSTANT); ac++;
	list_ = XmCreateScrolledList ( form_, "list_", al, ac );
	ac = 0;
	scrolledList1 = XtParent ( list_ );

	form1 = XmCreateForm ( form_, "form1", al, ac );
	XtSetArg(al[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++;
	rowcol1 = XmCreateRowColumn ( form1, "rowcol1", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	add_ = XmCreatePushButton ( rowcol1, "Add", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	update_ = XmCreatePushButton ( rowcol1, "Update", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	remove_ = XmCreatePushButton ( rowcol1, "Remove", al, ac );
	ac = 0;
	rowcol2 = XmCreateRowColumn ( form1, "rowcol2", al, ac );
	label1 = XmCreateLabel ( rowcol2, "Title:", al, ac );
	title_ = XmCreateTextField ( rowcol2, "title_", al, ac );
	optionMenu1 = XmCreateOptionMenu ( rowcol2, "optionMenu1", al, ac );
	// label2 = XmOptionLabelGadget ( optionMenu1 ); /* 20150819 */
	cascade1 = XmOptionButtonGadget ( optionMenu1 );
	actions_ = XmCreatePulldownMenu ( optionMenu1, "actions_", al, ac );
	button1 = XmCreatePushButton ( actions_, "Ecf command", al, ac );
	button2 = XmCreatePushButton ( actions_, "Separator", al, ac );
	button3 = XmCreatePushButton ( actions_, "Window", al, ac );
	button4 = XmCreatePushButton ( actions_, "Internal", al, ac );
	separator2 = XmCreateSeparator ( form1, "separator2", al, ac );

	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 ( form_,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 5); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 5); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 5); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightOffset, 5); ac++;
	XtSetArg(al[ac], XmNrightWidget, form1); ac++;
	XtSetValues ( scrolledList1,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 5); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 5); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 5); ac++;
	XtSetValues ( form1,al, ac );
	ac = 0;

	XtAddCallback (list_, XmNbrowseSelectionCallback,&menu_form_c:: browseCB, (XtPointer) this);
	XtManageChild(list_);

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 0); ac++;
	XtSetValues ( rowcol1,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 0); ac++;
	XtSetValues ( rowcol2,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopOffset, 0); ac++;
	XtSetArg(al[ac], XmNtopWidget, rowcol2); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
	XtSetArg(al[ac], XmNbottomWidget, rowcol1); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightOffset, 0); ac++;
	XtSetValues ( separator2,al, ac );
	ac = 0;
	XtAddCallback (add_, XmNactivateCallback,&menu_form_c:: addCB, (XtPointer) this);
	XtAddCallback (update_, XmNactivateCallback,&menu_form_c:: updateCB, (XtPointer) this);
	XtAddCallback (remove_, XmNactivateCallback,&menu_form_c:: removeCB, (XtPointer) this);
	children[ac++] = add_;
	children[ac++] = update_;
	children[ac++] = remove_;
	XtManageChildren(children, ac);
	ac = 0;
	XtAddCallback (title_, XmNvalueChangedCallback,&menu_form_c:: changedCB, (XtPointer) this);
	children[ac++] = button1;
	children[ac++] = button2;
	children[ac++] = button3;
	children[ac++] = button4;
	XtManageChildren(children, ac);
	ac = 0;
	XtSetArg(al[ac], XmNsubMenuId, actions_); ac++;
	XtSetValues ( cascade1, al, ac );
	ac = 0;
	children[ac++] = label1;
	children[ac++] = title_;
	children[ac++] = optionMenu1;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = rowcol1;
	children[ac++] = rowcol2;
	children[ac++] = separator2;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = form1;
	XtManageChildren(children, ac);
	ac = 0;
	children[ac++] = form_;
	XtManageChildren(children, ac);
}

void menu_form_c::updateCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	menu_form_p instance = (menu_form_p) client_data;
	instance->updateCB ( widget, call_data );
}

void menu_form_c::changedCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	menu_form_p instance = (menu_form_p) client_data;
	instance->changedCB ( widget, call_data );
}

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

void menu_form_c::removeCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	menu_form_p instance = (menu_form_p) client_data;
	instance->removeCB ( widget, call_data );
}

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

void menu_form_c::menuCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	menu_form_p instance = (menu_form_p) client_data;
	instance->menuCB ( widget, call_data );
}

