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

#include <xdclass.h>

class UIScrolledText_c: public xd_XmForm_c {
public:
	virtual void create (Widget parent, char *widget_name = NULL);
protected:
	Widget UIScrolledText;
	Widget scrolledText_;
	Widget scrollbarH_;
	Widget scrollbarV_;
	Widget text_;
public:
	static void changedCB( Widget, XtPointer, XtPointer );
	virtual void changedCB( Widget, XtPointer ) = 0;
	static void activateCB( Widget, XtPointer, XtPointer );
	virtual void activateCB( Widget, XtPointer ) = 0;
};

typedef UIScrolledText_c *UIScrolledText_p;

UIScrolledText_p UIScrolledText = (UIScrolledText_p) NULL;



void UIScrolledText_c::create (Widget parent, char *widget_name)
{
	Widget children[3];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	XtPointer tmp_value;             /* ditto */

	if ( !widget_name )
		widget_name = (char *) "UIScrolledText";

	XtSetArg(al[ac], XmNwidth, 294); ac++;
	XtSetArg(al[ac], XmNheight, 150); ac++;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	UIScrolledText = XmCreateForm ( parent, widget_name, al, ac );
	ac = 0;
	_xd_rootwidget = UIScrolledText;
	XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;
	text_ = XmCreateScrolledText ( UIScrolledText, (char *) "text_", al, ac );
	ac = 0;
	scrolledText_ = XtParent ( text_ );

	XtSetArg(al[ac], XmNhorizontalScrollBar, &scrollbarH_); ac++;
	XtSetArg(al[ac], XmNverticalScrollBar, &scrollbarV_); ac++;
	XtGetValues(scrolledText_, al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNwidth, 294); ac++;
	XtSetArg(al[ac], XmNheight, 145); ac++;
	if (scrolledText_)
		XtSetValues ( scrolledText_, al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( scrolledText_, al, ac );
	ac = 0;
	XtAddCallback (text_, XmNvalueChangedCallback, &UIScrolledText_c::changedCB, (XtPointer) this);
	XtAddCallback (text_, XmNactivateCallback, &UIScrolledText_c::activateCB, (XtPointer) this);
	if (text_ != (Widget) 0) { XtManageChild(text_); }
}

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

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

