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

#if !defined(M_TREE_HPP)
#define M_TREE_HPP
#include <z_tree.hpp>
#include "m_utils.hpp"

extern "C"
{
#include _DrawP_
#include _FrameP_
#include _TranslateP_
#include _ListP_
#include _BulletinBP_
}

// ----- MtfTreeList widget definition --------------------------------------

#define MtfTreeList OSTreeList
#define MtfTreeListIndex (XmListIndex + 1)

struct MtfTreeListClassPart
{
	XtPointer reserved;
};

struct MtfTreeListClassRec
{
	CoreClassPart coreClassPart;
	XmPrimitiveClassPart primitiveClassPart;
	XmListClassPart listClassPart;
	MtfTreeListClassPart mtfTreeListClassPart;
};

struct MtfTreeListPart
{
	Pixmap pixmap;
};

struct MtfTreeList
{
	CorePart core;
	XmPrimitivePart primitive;
	XmListPart list;
	MtfTreeListPart mtfTreeListPart;

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

	// Actions that map to Zinc functionality.
	static void begin_select(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->Event(L_SELECT); }
	static void button_select(MtfTreeList *mtfObject, XEvent *xEvent, String *params, Cardinal *num_params);
	static void call_default(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->RootObject()->Event(L_SELECT); }
	static void classInitialize();
	static void deselect_all(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *);
	static void destroy_pixmap(MtfTreeList *mtfObject);
	static void double_click(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->Event(L_DOUBLE_CLICK); }
	static void drag_drop(MtfTreeList *mtfObject, XEvent *xEvent, String *params, Cardinal *nparams);
	static void enter(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *);
	static void expose(MtfTreeList *mtfObject, XEvent *xEvent, Region xRegion);
	static void first_extend(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_EXTEND_FIRST); }
	static void first_item(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_FIRST); }
	static void focus_in(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *);
	static void focus_out(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *);
	static void help(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->Event(L_HELP); }
	static void initialize(MtfTreeList *, MtfTreeList *mtfObject, ArgList, Cardinal *);
	static void last_extend(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_EXTEND_LAST); }
	static void last_item(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_LAST); }
	static void leave(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *);
	static void left_item(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_LEFT); }
	static void next_extend(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_EXTEND_NEXT); }
	static void next_item(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_NEXT); }
	static void next_page(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_PGDN); }
	static void noop(MtfTreeList *, XEvent *, String *, Cardinal *)
		{ } // no operation is performed by this function.
	static void previous_extend(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_EXTEND_PREVIOUS); }
	static void previous_item(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_PREVIOUS); }
	static void previous_page(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_PGUP); }
	static void resize(MtfTreeList *mtfObject)
		{ GetZincObject(mtfObject)->Event(N_SIZE); }
	static void right_item(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->MoveEvent(L_RIGHT); }
	static void select_all(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *);
	static void toggle_expanded(MtfTreeList *mtfObject, XEvent *, String *, Cardinal *)
		{ GetZincObject(mtfObject)->Event(L_TOGGLE_EXPANDED); }

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

#define TreePixmap(mtfObject) XmField(mtfObject, MtfTreeList::offsets, \
	MtfTreeList, pixmap, Pixmap)

#endif
