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

#if !defined(M_SPIN_HPP)
#define M_SPIN_HPP
#include <z_spin.hpp>
#include "m_utils.hpp"

extern "C"
{
#include _keysymdef_
#include _DrawP_
#include _LabelP_
#include _FrameP_
#include _BulletinBP_
}

// ----- MtfSpinControl widget definition -----------------------------------

#define MtfSpinControl OSSpinControl
#define MtfSpinControlIndex (XmBulletinBoardIndex + 1)

struct MtfSpinControlClassPart
{
	XtPointer reserved;
};

struct MtfSpinControlClassRec
{
	CoreClassPart coreClassPart;
	CompositeClassPart compositeClassPart;
	ConstraintClassPart constraintClassPart;
	XmManagerClassPart managerClassPart;
	XmBulletinBoardClassPart bulletin_boardClassPart;
	MtfSpinControlClassPart mtfSpinControlClassPart;
};

struct MtfSpinControlPart
{
	ZafPositionStruct lastMousePosition;
	XtIntervalId intervalID;
};

struct MtfSpinControl
{
	CorePart core;
	CompositePart composite;
	ConstraintPart constraint;
	XmManagerPart manager;
	XmBulletinBoardPart bulletin_board;
	MtfSpinControlPart mtfSpinControlPart;


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

	// Actions that map to Zinc functionality.
	static void activate(MtfSpinControl *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void arm(MtfSpinControl *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void classInitialize();
	static void drag_drop(MtfSpinControl *mtfObject, XEvent *xEvent, String *params, Cardinal *nparams);
	static void enter(MtfSpinControl *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void expose(MtfSpinControl *mtfObject, XEvent *xEvent, Region xRegion);
	static XtGeometryResult gmgr(Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *reply);
	static void help(MtfSpinControl *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->Event(L_HELP); }
	static void leave(MtfSpinControl *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void multi_activate(MtfSpinControl *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void multi_arm(MtfSpinControl *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void repeat(MtfSpinControl *mtfObject, XtIntervalId *intervalID);
	static void resize(MtfSpinControl *mtfObject);

	// General purpose functions.
	static ZafSpinControl *GetZincObject(MtfSpinControl *mtfObject)
		{ return ((ZafSpinControl *)mtfObject->manager.user_data); }
	static MtfSpinControl *GetMotifWidget(OSWindowID screenID)
		{ return ((MtfSpinControl *)screenID); }
};

#define LastMousePosition(mtfObject) XmField(mtfObject, MtfSpinControl::offsets, \
	MtfSpinControl, lastMousePosition, ZafPositionStruct)
#define IntervalID(mtfObject) XmField(mtfObject, MtfSpinControl::offsets, \
	MtfSpinControl, intervalID, XtIntervalId)

#endif
