/***************************** 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/RowColumn.h>
#include <Xm/CascadeBG.h>
#include <Xm/LabelG.h>

#include <xdclass.h>

class UIMenuLine_c: public xd_XmForm_c {
public:
	virtual void create (Widget parent, char *widget_name = NULL);
protected:
	Widget UIMenuLine;
	Widget option_;
	Widget menu_;
public:
	static void activateCB( Widget, XtPointer, XtPointer );
	virtual void activateCB( Widget, XtPointer ) = 0;
};

typedef UIMenuLine_c *UIMenuLine_p;

UIMenuLine_p UIMenuLine = (UIMenuLine_p) NULL;



void UIMenuLine_c::create (Widget parent, char *widget_name)
{
	Widget children[2];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	Widget label1 = (Widget)NULL;
	Widget cascade1 = (Widget)NULL;

	if ( !widget_name )
		widget_name = "UIMenuLine";

	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	UIMenuLine = XmCreateForm ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = UIMenuLine;
	option_ = XmCreateOptionMenu ( UIMenuLine, "option_", al, ac );
	label1 = XmOptionLabelGadget ( option_ );
	cascade1 = XmOptionButtonGadget ( option_ );
	menu_ = XmCreatePulldownMenu ( option_, "menu_", al, ac );
	XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
	XtSetValues ( cascade1,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_FORM); ac++;
	XtSetValues ( option_,al, ac );
	ac = 0;
	XtAddCallback (menu_, XmNentryCallback, activateCB, (XtPointer) this);
	XtSetArg(al[ac], XmNsubMenuId, menu_); ac++;
	XtSetValues ( cascade1, al, ac );
	ac = 0;
	XtUnmanageChild ( label1 );
	children[ac++] = option_;
	XtManageChildren(children, ac);
	ac = 0;
}

void UIMenuLine_c::activateCB( Widget widget, XtPointer client_data, XtPointer call_data )
{
	UIMenuLine_p instance = (UIMenuLine_p) client_data;
	instance->activateCB ( widget, call_data );
}

