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

#if !defined(M_BUTTON_HPP)
#define M_BUTTON_HPP
#include <z_button.hpp>
#include "m_utils.hpp"

extern "C"
{
#include _DrawP_
#include _TranslateP_
#include _PushBP_
}

// ----- MtfButton widget definition ----------------------------------------

#define MtfButton OSButton
#define MtfButtonIndex (XmPushButtonIndex + 1)

struct MtfButtonClassPart
{
	XtPointer reserved;
};

struct MtfButtonClassRec
{
	CoreClassPart coreClassPart;
	XmPrimitiveClassPart primitiveClassPart;
	XmLabelClassPart labelClassPart;
	XmPushButtonClassPart buttonClassPart;
	MtfButtonClassPart mtfButtonClassPart;
};

struct MtfButtonPart
{
};

struct MtfButton
{
	CorePart core;
	XmPrimitivePart primitive;
	XmLabelPart label;
  	XmPushButtonPart button;
	MtfButtonPart mtfButtonPart;

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

	// Actions that map to Zinc functionality.
	static void activate(MtfButton *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void arm(MtfButton *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void arm_and_activate(MtfButton *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void call_default(MtfButton *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->RootObject()->Event(L_SELECT); }
	static void classInitialize();
	static void disarm(MtfButton *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void drag_drop(MtfButton *mtfObject, XEvent *xEvent, String *params, Cardinal *nparams);
	static void enter(MtfButton *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void expose(MtfButton *mtfObject, XEvent *xEvent, Region xRegion);
	static void focus_in(MtfButton *mtfObject, XEvent *xEvent, String *params, Cardinal *nparams);
	static void help(MtfButton *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->Event(L_HELP); }
	static void highlight(MtfButton *mtfObject);
	static void motion(MtfButton *mtfObject, XEvent *, String *, Cardinal *);
	static void unhighlight(MtfButton *mtfObject);
	static void leave(MtfButton *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void multi_activate(MtfButton *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void multi_arm(MtfButton *mtfObject, XEvent *xEvent, String *, Cardinal *);
	static void repeat(MtfButton *mtfObject, XtIntervalId *intervalID);

	// General purpose functions.
	static ZafButton *GetZincObject(MtfButton *mtfObject)
		{ return ((ZafButton *)mtfObject->primitive.user_data); }
	static MtfButton *GetMotifWidget(OSWindowID screenID)
		{ return ((MtfButton *)screenID); }
};

#endif

