//	Zinc Application Framework - M_TEXT.HPP
//	COPYRIGHT (C) 1990-1999.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#if !defined(M_TEXT_HPP)
#define M_TEXT_HPP
#include <z_text.hpp>
#include "m_utils.hpp"

extern "C"
{
#include _Text_
typedef _XmTextRec *XmWidget;
#include _TextP_
}

// ----- ZafText widget definition ------------------------------------------

#define MtfText OSText
#define MtfTextIndex (XmTextIndex + 1)

struct MtfTextClassPart
{
	XtPointer reserved;
};

struct MtfTextClassRec
{
	CoreClassPart coreClassPart;
	XmPrimitiveClassPart primitiveClassPart;
	XmTextClassPart textClassPart;
	MtfTextClassPart mtfTextClassPart;
};

struct MtfTextPart
{
};

struct MtfText
{
	CorePart core;
	XmPrimitivePart primitive;
	XmTextPart text;
	MtfTextPart mtfTextPart;

	static MtfTextClassRec classRecord;
	static XmOffsetPtr offsets;
	static XtActionsRec action[];
	static char translations[];

	// Actions that map to Zinc functionality.
	static void activate(MtfText *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->Event(L_SELECT); }
	static void call_default(MtfText *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->RootObject()->Event(L_SELECT); }
	static void changed(MtfText *mtfObject, ZafText *object, XmTextVerifyCallbackStruct *callback);
	static void classInitialize();
	static void drag_drop(MtfText *mtfObject, XEvent *xEvent, String *params, Cardinal *nparams);
	static void enter(MtfText *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void expose(MtfText *mtfObject, XEvent *xEvent, Region xRegion);
	static void focus_in(MtfText *mtfObject, XEvent *xEvent, String *params, Cardinal *nparams);
	static void help(MtfText *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->Event(L_HELP); }
	static void highlight(MtfText *mtfObject);
	static void unhighlight(MtfText *mtfObject);
	static void leave(MtfText *mtfObject, XEvent *xEvent, String *, Cardinal *);

	// General purpose functions.
	static ZafText *GetZincObject(MtfText *mtfObject)
		{ return ((ZafText *)mtfObject->primitive.user_data); }
	static MtfText *GetMotifWidget(Widget widget)
		{ return ((MtfText *)widget); }
};

#endif
