/* $XConsortium: IconP.h /main/cde1_maint/1 1995/07/17 18:30:20 drk $ */
/**---------------------------------------------------------------------
***	
***	file:		IconP.h
***
***	project:	MotifPlus Widgets
***
***	description:	Private include file for DtIcon gadget class.
***	
***	
***			(c) Copyright 1990 by Hewlett-Packard Company.
***
***
***-------------------------------------------------------------------*/


#ifndef _DtIconP_h
#define _DtIconP_h

#include <Xm/ExtObjectP.h>
#include <Xm/XmP.h>
#include <Xm/GadgetP.h>
#include <Dt/Icon.h>


/*-------------------------------------------------------------
**	Cache Class Structure
*/

/*	Cache Class Part
*/
typedef struct _DtIconCacheObjClassPart
{
    int foo;
} DtIconCacheObjClassPart;

/*	Cache Full Class Record
*/
typedef struct _DtIconCacheObjClassRec     /* label cache class record */
{
    ObjectClassPart                     object_class;
    XmExtClassPart                      ext_class;
    DtIconCacheObjClassPart            icon_class_cache;
} DtIconCacheObjClassRec;

/*	Cache Actual Class
*/
externalref DtIconCacheObjClassRec dtIconCacheObjClassRec;


/*-------------------------------------------------------------
**	Cache Instance Structure
*/

/*	Cache Instance Part
*/
typedef struct _DtIconCacheObjPart
{
	Dimension	margin_width;
	Dimension	margin_height;
	Dimension	string_height;
	Dimension	spacing;
	Pixel		foreground;
	Pixel		background;
	Pixel		arm_color;
	Boolean		fill_on_arm;
	Boolean		recompute_size;
	Boolean		draw_shadow;
	unsigned char	pixmap_position;
	unsigned char	string_position;
	unsigned char	alignment;
	unsigned char	behavior;
	unsigned char	fill_mode;
} DtIconCacheObjPart;

typedef struct _DtIconCacheObjRec
{
    ObjectPart               object;
    XmExtPart                ext;
    DtIconCacheObjPart      icon_cache;
} DtIconCacheObjRec;


typedef void (*GetPositionProc)(
#ifndef _NO_PROTO
	DtIconGadget,
	Position,
	Position,
	Dimension,
	Dimension,
	Position *,
	Position *,
	Position *,
	Position *
#endif
);
typedef void (*GetSizeProc)(
#ifndef _NO_PROTO
	DtIconGadget,
	Dimension *,
	Dimension *
#endif
);
typedef void (*DrawProc)(
#ifndef _NO_PROTO
	DtIconGadget,
	Drawable,
	Position,
	Position,
	Dimension,
	Dimension,
	Dimension,
	Dimension,
	unsigned char,
	unsigned char
#endif
);
typedef void (*CallCallbackProc)(
#ifndef _NO_PROTO
	DtIconGadget,
	XtCallbackList,
	int,
	XEvent *
#endif
);
typedef void (*UpdateGCsProc)(
#ifndef _NO_PROTO
	DtIconGadget
#endif
);
/*-------------------------------------------------------------
**	Class Structure
*/

/*	Class Part
*/
typedef struct _DtIconClassPart
{
#ifdef _NO_PROTO
	XtWidgetProc		get_size;
	XtWidgetProc		get_positions;
	XtWidgetProc		draw;
	XtWidgetProc		call_callback;
	XtWidgetProc		update_gcs;
#else
	GetSizeProc		get_size;
	GetPositionProc		get_positions;
	DrawProc		draw;
	CallCallbackProc	call_callback;
	UpdateGCsProc		update_gcs;
#endif
	Boolean			optimize_redraw;
	XmCacheClassPartPtr	cache_part;
	caddr_t			extension;
} DtIconClassPart;

/*	Full Class Record
*/
typedef struct _DtIconClassRec
{
	RectObjClassPart	rect_class;
	XmGadgetClassPart	gadget_class;
	DtIconClassPart	icon_class;
} DtIconClassRec;

/*	Actual Class
*/
externalref DtIconClassRec dtIconClassRec;


/*-------------------------------------------------------------
**	Instance Structure
*/

/*	Instance Part
*/
typedef struct _DtIconPart
{
	Boolean		set;
	Boolean		armed;
	Boolean		sync;
	Boolean		underline;
	unsigned char	shadow_type;
	unsigned char	border_type;
	XtCallbackList	callback;
	XtIntervalId	click_timer_id;
	XButtonEvent *	click_event;
	String		image_name;
	Pixmap		pixmap;
	Pixmap		mask;
	Pixel		pixmap_foreground;
	Pixel		pixmap_background;
	Dimension	max_pixmap_width;
	Dimension	max_pixmap_height;
	XmFontList	font_list;
	_XmString	string;
	Dimension	string_width;
	Dimension	pixmap_width;
	Dimension	pixmap_height;
	GC		clip_gc;
	GC		normal_gc;
	GC		background_gc;
	GC		armed_gc;
	GC		armed_background_gc;
	GC		parent_background_gc;
	Pixel		saved_parent_background;
	DtIconCacheObjPart *cache;
	unsigned char	operations;
	XtCallbackList	drop_callback;
} DtIconPart;

/*	Full Instance Record
*/
typedef struct _DtIconRec
{
	ObjectPart	object;
	RectObjPart	rectangle;
	XmGadgetPart	gadget;
	DtIconPart	icon;
} DtIconRec;


/*-------------------------------------------------------------
**	Class and Instance Macros
*/

/*	DtIcon Class Macros
*/	
#ifdef _NO_PROTO
#define DtInheritGetSize	((XtWidgetProc) _XtInherit)
#define DtInheritGetPositions	((XtWidgetProc) _XtInherit)
#define DtInheritDraw		((XtWidgetProc) _XtInherit)
#define DtInheritCallCallback	((XtWidgetProc) _XtInherit)
#define DtInheritUpdateGCs	((XtWidgetProc) _XtInherit)
#else
#define DtInheritGetSize	((GetSizeProc) _XtInherit)
#define DtInheritGetPositions	((GetPositionProc) _XtInherit)
#define DtInheritDraw		((DrawProc) _XtInherit)
#define DtInheritCallCallback	((CallCallbackProc) _XtInherit)
#define DtInheritUpdateGCs	((UpdateGCsProc) _XtInherit)
#endif
#define C_GetSize(wc)		(wc -> icon_class.get_size)
#define C_GetPositions(wc)	(wc -> icon_class.get_positions)
#define C_Draw(wc)		(wc -> icon_class.draw)
#define C_CallCallback(wc)	(wc -> icon_class.call_callback)
#define C_OptimizeRedraw(wc)	(wc -> icon_class.optimize_redraw)
#define C_UpdateGCs(wc)		(wc -> icon_class.update_gcs)

/*	DtIcon Macros
*/
#define G_GetSize(g,w,h) \
  (((DtIconClassRec *)g -> object.widget_class) -> icon_class.get_size) \
	(g,w,h)
#define G_GetPositions(g,w,h,h_t,s_t,p_x,p_y,s_x,s_y) \
  (((DtIconClassRec *)g -> object.widget_class) -> icon_class.get_positions) \
	(g,w,h,h_t,s_t,p_x,p_y,s_x,s_y)
#define G_Draw(g,d,x,y,w,h,h_t,s_t,s_type,fill) \
  (((DtIconClassRec *)g -> object.widget_class) -> icon_class.draw) \
	(g,d,x,y,w,h,h_t,s_t,s_type,fill)
#define G_CallCallback(g,cb,r,e) \
  (((DtIconClassRec *)g -> object.widget_class) -> icon_class.call_callback) \
	(g,cb,r,e)
#define G_UpdateGCs(g) \
  (((DtIconClassRec *)g -> object.widget_class) -> icon_class.update_gcs) \
	(g)

/*	Cached Instance Field Macros
*/
#define G_CachePixmapPosition(co)	(((DtIconCacheObject)(co)) -> \
				  	icon_cache.pixmap_position)
#define G_FillOnArm(g)		(((DtIconGadget)(g)) -> \
				  icon.cache -> fill_on_arm)
#define G_RecomputeSize(g)	(((DtIconGadget)(g)) -> \
				  icon.cache -> recompute_size)
#define G_DrawShadow(g)		(((DtIconGadget)(g)) -> \
				  icon.cache -> draw_shadow)
#define G_PixmapPosition(g)	(((DtIconGadget)(g)) -> \
				  icon.cache -> pixmap_position)
#define G_StringPosition(g)	(((DtIconGadget)(g)) -> \
				  icon.cache -> string_position)
#define G_Alignment(g)		(((DtIconGadget)(g)) -> \
				  icon.cache -> alignment)
#define G_Behavior(g)		(((DtIconGadget)(g)) -> \
				  icon.cache -> behavior)
#define G_FillMode(g)		(((DtIconGadget)(g)) -> \
				  icon.cache -> fill_mode)
#define G_MarginWidth(g)	(((DtIconGadget)(g)) -> \
				  icon.cache -> margin_width)
#define G_MarginHeight(g)	(((DtIconGadget)(g)) -> \
				  icon.cache -> margin_height)
#define G_StringHeight(g)	(((DtIconGadget)(g)) -> \
				  icon.cache -> string_height)
#define G_Spacing(g)		(((DtIconGadget)(g)) -> \
				  icon.cache -> spacing)
#define G_Foreground(g)		(((DtIconGadget)(g)) -> \
				  icon.cache -> foreground)
#define G_Background(g)		(((DtIconGadget)(g)) -> \
				  icon.cache -> background)
#define G_ArmColor(g)		(((DtIconGadget)(g)) -> \
				  icon.cache -> arm_color)

/*	Non-Cached Instance Field Macros
*/
#define G_Armed(g)		(g -> icon.armed)
#define G_Set(g)		(g -> icon.set)
#define G_Sync(g)		(g -> icon.sync)
#define G_Callback(g)		(g -> icon.callback)
#define G_ClickTimerID(g)	(g -> icon.click_timer_id)
#define G_ClickInterval(g)	(g -> icon.click_interval)
#define G_ClickEvent(g)		(g -> icon.click_event)
#define G_ShadowType(g)		(g -> icon.shadow_type)
#define G_BorderType(g)		(g -> icon.border_type)
#define G_Pixmap(g)		(g -> icon.pixmap)
#define G_Mask(g)		(g -> icon.mask)
#define G_PixmapForeground(g)	(g -> icon.pixmap_foreground)
#define G_PixmapBackground(g)	(g -> icon.pixmap_background)
#define G_MaxPixmapWidth(g)	(g -> icon.max_pixmap_width)
#define G_MaxPixmapHeight(g)	(g -> icon.max_pixmap_height)
#define G_String(g)		(g -> icon.string)
#define G_FontList(g)		(g -> icon.font_list)
#define G_ImageName(g)		(g -> icon.image_name)
#define G_StringWidth(g)	(g -> icon.string_width)
#define G_PixmapWidth(g)	(g -> icon.pixmap_width)
#define G_PixmapHeight(g)	(g -> icon.pixmap_height)
#define G_BackgroundGC(g)	(g -> icon.background_gc)
#define G_ArmedGC(g)		(g -> icon.armed_gc)
#define G_ArmedBackgroundGC(g)	(g -> icon.armed_background_gc)
#define G_NormalGC(g)		(g -> icon.normal_gc)
#define G_ClipGC(g)		(g -> icon.clip_gc)
#define G_Underline(g)		(g -> icon.underline)
#define G_ParentBackgroundGC(g)	(g -> icon.parent_background_gc)
#define G_SavedParentBG(g)	(g -> icon.saved_parent_background)
#define G_Operations(g)		(g -> icon.operations)
#define G_DropCallback(g)	(g -> icon.drop_callback)

#define Icon_Cache(w)                   (((DtIconGadget)(w))-> \
                                           icon.cache)

#define Icon_ClassCachePart(w) \
        (((DtIconGadgetClass)dtIconGadgetClass)->gadget_class.cache_part)


#endif /* _DtIconP_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */
