/*
**   ----------------------------------------------------------------- 
**        Copyright (C) 1990, 1991 Sun Microsystems, Inc
**                   All rights reserved.
**         Notice of copyright on this source code
**         product does not indicate publication.
**   
**   RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by
**   the U.S. Government is subject to restrictions as set forth
**   in subparagraph (c)(1)(ii) of the Rights in Technical Data
**   and Computer Software Clause at DFARS 252.227-7013 (Oct. 1988)
**   and FAR 52.227-19 (c) (June 1987).
**   
**     Sun Microsystems, Inc., 2550 Garcia Avenue,
**     Mountain View, California 94043.
**   ----------------------------------------------------------------- 
*/
/*	Copyright (c) 1990 UNIX System Laboratories, Inc.	*/
/*	Copyright (c) 1988 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF     	*/
/*	UNIX System Laboratories, Inc.                     	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

#ifndef	NOIDENT
#ident	"@(#)button:include/openlook/ButtonP.h	1.24"
#endif

#ifndef _Ol_ButtonP_h_
#define _Ol_ButtonP_h_

/*
 ************************************************************
 *
 *  Description:
 *	This file contains the private definitions for the
 *	OPEN LOOK(tm) Button widget and gadget.
 *
 ************************************************************
 */

#include <Xol/Olg.h>

#include <Xol/PrimitiveP.h>	/* include widget's superclass header */
#include <Xol/EventObjP.h>	/* include gadget's superclass header */
#include <Xol/Button.h>

#define find_button_part(w) (_OlIsGadget(w) ?			\
			     &((ButtonGadget)(w))->button :	\
			     &((ButtonWidget)(w))->button)
#define XtCeil(n)	((int) (n + .5))
#define isOblongType(t)	((int) (t == OL_OBLONG || t == OL_BUTTONSTACK || t == OL_HALFSTACK) ? TRUE : FALSE)

#define NORMAL 1
#define HIGHLIGHTED 0

/*
 *  There are no new fields for the ButtonClassPart
 */
typedef struct _ButtonClass {
	int makes_compiler_happy;  /* not used */
} ButtonClassPart;

/*
 *  declare the ButtonClassRec as a subclass of core
 */
typedef struct _ButtonClassRec {
	CoreClassPart		core_class;
	PrimitiveClassPart	primitive_class;
	ButtonClassPart		button_class;
} ButtonClassRec;

/*
 *  declare the ButtonGadgetClassRec as a subclass of EventObj
 */
typedef struct _ButtonGadgetClassRec {
	RectObjClassPart rect_class;
	EventObjClassPart event_class;
	ButtonClassPart button_class;
} ButtonGadgetClassRec;

/*
 *  buttonClassRec and buttonGadgetClassRec are defined in Button.c
 */
extern ButtonClassRec buttonClassRec;
extern ButtonGadgetClassRec buttonGadgetClassRec;

/*
 *  declaration of the Button widget fields
 */
typedef struct {
	/*
	 *  Public resources
	 */
	Pixel		background_pixel;
	Pixel		corner_color;
	char *		label;
	XImage *	label_image;
	OlDefine	label_type;
	OlDefine	button_type;
	OlDefine	menumark;
	OlDefine	label_justify;
	int		scale;
	int		shell_behavior;
	Boolean		label_tile;
	Boolean		is_default;
	Boolean		set;
	Boolean		dim;
	Boolean		busy;
	Boolean		internal_busy;
	Boolean		recompute_size;
	XtCallbackList	select;
	XtCallbackList	unselect;
	Widget		preview;
	XtCallbackList	post_select;
	XtCallbackList	label_proc;

	/*
	 *  Private fields
	 */
	Dimension	normal_height;
	Dimension	normal_width;
	GC		normal_GC;
	GC		inverse_text_GC;
	GC		parent_GC;
	OlgAttrs *	pAttrs;
	OlgAttrs *	pHighlightAttrs;
} ButtonPart;

typedef struct _ButtonRec {
	CorePart	core;
	PrimitivePart	primitive;
	ButtonPart	button;
} ButtonRec;

typedef struct _ButtonGadgetRec {
	ObjectPart object;
	RectObjPart rect;
	EventObjPart event;
	ButtonPart button;
} ButtonGadgetRec;

						/* Add some externs	*/
extern void
_OlButtonPreview();

extern void 
_OlDrawHighlightButton();

extern void 
_OlDrawNormalButton();

#endif /* _Ol_ButtonP_h_ */
