/*
**   ----------------------------------------------------------------- 
**        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.
**   ----------------------------------------------------------------- 
*/
#ifndef	_OPENLOOK_H
#define	_OPENLOOK_H

#ifndef	NOIDENT
#ident	"@(#)OpenLook.h	3.10	91/07/23 include/Xol SMI"	/* oltemporary:OpenLook.h 1.52	*/
#endif


/*	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.	*/


/*
 *************************************************************************
 *
 * Description:
 *		This file contains all the things necessary to compile
 *	an OPEN LOOK (tm) application.
 *
 *******************************file*header*******************************
 */

#ifdef	LIBXOL_BUILD
#include <Xol/OlBuildEnv.h>
#endif	/* LIBXOL_BUILD */

#include <Xol/OlXlibExt.h>
#include <Xol/OlClients.h>
#include <Xol/OlReasons.h>

#ifdef _XtIntrinsic_h			/* for Xwin 1.0 compatibility */

#include <Xol/OlStrings.h>

/*
 ************************************************************************
 *	Define some ANSI C and C++ stuff
 ************************************************************************
 */

			/* Define `OLconst' as `const'			*/
			/*	if ANSI C or C++, otherwise define	*/
			/*	it as ` ' (i.e nothing).		*/
			/* The toolkit developers should always use	*/
			/*	`OLconst' to avoid the compilation	*/
			/*	problems on a non-ANSI C or non-C++	*/
			/*	environment				*/

#if !defined(__STDC__) && !defined(__cplusplus) && !defined(c_plusplus)
#define OLconst
#else
#define OLconst	const
#endif

/* Define two macros for function Prototypes.
 * NOTE: since ANSI C and C++ treat externs for parameterless functions
 * differently, declare a parameter function in the following way:
 *
 * For functions with parameters:
 *	fooWithParams OL_ARGS((char *, int));
 * For functions with no parameters:
 *	fooNoParams OL_NO_ARGS();
 *
 * If token OlNeedFunctionPrototypes is defined and is zero, we undefine.
 * Else we set redefine it to have the value of one.
 */

#if !defined(OlNeedFunctionPrototypes) || (OlNeedFunctionPrototypes != 0)

#ifdef OlNeedFunctionPrototypes
#undef OlNeedFunctionPrototypes
#endif /* OlNeedFunctionPrototypes */

#if defined(__cplusplus) || defined(c_plusplus)

#define OlNeedFunctionPrototypes 1
#define OL_ARGS(x)	x
#define OL_NO_ARGS()	()

#else /* __cpluslus || c_plusplus */
#if defined(__STDC__)

#define OlNeedFunctionPrototypes 1
#define OL_ARGS(x)	x
#define OL_NO_ARGS()	(void)

#else /* defined(__STDC__) */

#undef OlNeedFunctionPrototypes
#define OL_ARGS(x)	()
#define OL_NO_ARGS()	()

#endif /* defined(__STDC__) */
#endif /* __cpluslus || c_plusplus */
#else /* !defined(OlNeedFunctionPrototypes)||(OlNeedFunctionPrototypes != 0) */

#undef OlNeedFunctionPrototypes
#define OL_ARGS(x)	()
#define OL_NO_ARGS()	()

#endif /* !defined(OlNeedFunctionPrototypes)||(OlNeedFunctionPrototypes != 0) */

	/* Now add three new macros to be used when defining functions.
	 * These macros look at the OlNeedFunctionPrototype token to
	 * determine how the macro is expanded.  Below illustrates how
	 * to use the macro.
	 *
	 *	FooBar OLARGLIST((num1, string, flag))
	 *		OLARG(int,	num1)
	 *		OLARG(String,	string)
	 *		OLGRA(int,	flag)
	 *	{
	 *		body of FooBar...
	 *	}
	 *
	 * For variable argument functions use the following syntax:
	 *
	 *	FooBar OLARGLIST((num1, string, OLVARGLIST))
	 *		OLARG(int,	num1)
	 *		OLARG(String,	string)
	 *		OLVARGS
	 *	{
	 *		body of FooBar...
	 *	}
	 *
	 * Also add two macros for enveloping function prototype sections.
	 */

#if OlNeedFunctionPrototypes

#define OLARGLIST(list)	(
#define OLARG(t,a)	t a,
#define OLGRA(t,a)	t a)
#define OLVARGLIST	...			/* junk parameter	*/
#define OLVARGS		...)

#if defined(__cplusplus) || defined(c_plusplus)
#define OLBeginFunctionPrototypeBlock	extern "C" {
#define OLEndFunctionPrototypeBlock	}
#else /* defined(__cplusplus) || defined(c_plusplus) */
#define OLBeginFunctionPrototypeBlock
#define OLEndFunctionPrototypeBlock
#endif /* defined(__cplusplus) || defined(c_plusplus) */

#else /* OlNeedFunctionPrototypes */

#define OLARGLIST(list)	list
#define OLARG(t,a)	t a;
#define OLGRA(t,a)	t a;
#define OLVARGLIST	va_alist
#define OLVARGS		va_dcl

#define OLBeginFunctionPrototypeBlock
#define OLEndFunctionPrototypeBlock

#endif /* OlNeedFunctionPrototypes */


/*
 ************************************************************************
 *	Define True Constant Tokens
 *		Tokens that appear in this section should not have
 *		their values changed.
 ************************************************************************
 */

#define OL_IGNORE		(~0)
#define OL_NO_ITEM		(~0)

/*
 ************************************************************************
 *	Define Tokens that have arbitary value assignments.  (Though
 *	their values must not change since it would break backwards
 *	compatibility.)
 *	New tokens should be added to the end of the list and their
 *	values must be unique.
 *	WARNING: do not remove or renumber any of the values in this
 *	list.
 ************************************************************************
 */

#define OleditDone		0
#define OleditError		1
#define OleditPosError		2
#define OleditReject		3

#define OL_ABSENT_PAIR		0
#define OL_ALL			1
#define OL_ALWAYS		2
#define OL_ATOM_HELP		3
#define OL_BOTH			4
#define OL_BOTTOM		5
#define OL_BUTTONSTACK		6
#define OL_CENTER		7
#define OL_CLASS_HELP		8
#define OL_COLUMNS		9
#define OL_COPY_MASK_VALUE	10
#define OL_COPY_SIZE		11
#define OL_COPY_SOURCE_VALUE	12
#define OL_CURRENT		13
#define OL_DEFAULT_PAIR		14
#define OL_DISK_SOURCE		15
#define OL_DISPLAY_FORM		16
#define OL_DOWN			17
#define OL_EXISTING_SOURCE	18
#define OL_FIXEDCOLS		19
#define OL_FIXEDHEIGHT		20
#define OL_FIXEDROWS		21
#define OL_FIXEDWIDTH		22
#define OL_FLAT_BUTTON		23
#define OL_FLAT_CHECKBOX	24
#define OL_FLAT_CONTAINER	25
#define OL_FLAT_EXCLUSIVES	26
#define OL_FLAT_HELP		27
#define OL_FLAT_NONEXCLUSIVES	28
#define OL_HALFSTACK		29
#define OL_HORIZONTAL		30
#define OL_IMAGE		31
#define OL_IN			32
#define OL_INDIRECT_SOURCE	33
#define OL_LABEL		34
#define OL_LEFT			35
#define OL_MASK_PAIR		36
#define OL_MAXIMIZE		37
#define OL_MILLIMETERS		38
#define OL_MINIMIZE		39
#define OL_NEVER		40
#define OL_NEXT			41
#define OL_NONE			42
#define OL_NONEBOTTOM		43
#define OL_NONELEFT		44
#define OL_NONERIGHT		45
#define OL_NONETOP		46
#define OL_NOTICES		47
#define OL_NO_VIRTUAL_MAPPING	48
#define OL_OBLONG		49
#define OL_OUT			50
#define OL_OVERRIDE_PAIR	51
#define OL_PIXELS		52
#define OL_POINTS		53
#define OL_POPUP		54
#define OL_PREVIOUS		55
#define OL_PROG_DEFINED_SOURCE	56
#define OL_RECTBUTTON		57
#define OL_RIGHT		58
#define OL_ROWS			59
#define OL_SOURCE_FORM		60
#define OL_SOURCE_PAIR		61
#define OL_STAYUP		62
#define OL_STRING		63
#define OL_STRING_SOURCE	64
#define OL_TEXT_APPEND		65
#define OL_TEXT_EDIT		66
#define OL_TEXT_READ		67
#define OL_TOP			68
#define OL_TRANSPARENT_SOURCE	69
#define OL_VERTICAL		70
#define OL_VIRTUAL_BUTTON	71
#define OL_VIRTUAL_KEY		72
#define OL_WIDGET_HELP		73
#define OL_WINDOW_HELP		74
#define OL_WRAP_ANY		75
#define OL_WRAP_WHITE_SPACE	76
#define OL_CONTINUOUS		77
#define OL_GRANULARITY		78
#define OL_RELEASE		79
#define OL_TICKMARK		80
#define OL_PERCENT		81
#define OL_SLIDERVALUE		82
#define OL_WT_BASE		83
#define OL_WT_CMD		84
#define OL_WT_NOTICE		85
#define OL_WT_HELP		86
#define OL_WT_OTHER		87
#define OL_SUCCESS		88
#define OL_DUPLICATE_KEY	89
#define OL_DUPLICATEKEY		89
#define OL_BAD_KEY		90
#define OL_MENU_FULL		91
#define OL_MENU_LIMITED		92
#define OL_MENU_CANCEL		93
#define OL_SELECTKEY		94
#define OL_MENUKEY		95
#define OL_MENUDEFAULT		96
#define OL_MENUDEFAULTKEY	97
#define OL_HSBMENU		98
#define OL_VSBMENU		99
#define OL_ADJUSTKEY		100
#define OL_NEXTAPP		101
#define OL_NEXTWINDOW		102
#define OL_PREVAPP		103
#define OL_PREVWINDOW		104
#define OL_WINDOWMENU		105
#define OL_WORKSPACEMENU	106
#define OL_DEFAULTACTION	108
#define OL_DRAG			109
#define OL_DROP			110
#define OL_TOGGLEPUSHPIN	111
#define OL_PAGELEFT		112
#define OL_PAGERIGHT		113
#define OL_SCROLLBOTTOM		114
#define OL_SCROLLTOP		115
#define OL_MULTIRIGHT		116
#define OL_MULTILEFT		117
#define OL_MULTIDOWN		118
#define OL_MULTIUP		119
#define OL_IMMEDIATE		120
#define OL_MOVEUP		121
#define OL_MOVEDOWN		122
#define OL_MOVERIGHT		123
#define OL_MOVELEFT		124
#define OL_CLICK_TO_TYPE	125
#define OL_REALESTATE		126
#define OL_UNDERLINE		127
#define OL_HIGHLIGHT		128
#define OL_INACTIVE		129
#define OL_DISPLAY		130
#define OL_PROC			131
#define OL_SIZE_PROC		132
#define OL_DRAW_PROC		133
#define OL_PINNED_MENU		134
#define OL_PRESS_DRAG_MENU	135
#define OL_STAYUP_MENU		136
#define OL_POINTER		137
#define OL_INPUTFOCUS		138
#define OL_QUIT			142
#define OL_DESTROY		143
#define OL_DISMISS		144
#define OL_PRE			145
#define OL_POST			146
#ifdef sun
#define OL_GROW_OFF     	147
#define OL_GROW_HORIZONTAL      148
#define OL_GROW_VERTICAL        149
#define OL_GROW_BOTH    	150
#endif


/* These are bit masks used in Vendor's XtNwmProtocolMask resource.*/
#if !defined(__STDC__) && !defined(__cplusplus) && !defined(c_plusplus)
#include <limits.h>
#define _OL_CHAR_BIT	CHAR_BIT
#else
#define _OL_CHAR_BIT	8
#endif

#define _OL_HI_BIT()	(unsigned long)(1 << (sizeof(long) * _OL_CHAR_BIT - 1))
#define _OL_WM_GROUP(X)	(_OL_HI_BIT() >> (X))
#define _OL_WM_GROUPALL()	(_OL_WM_GROUP(0))
#define _OL_WM_BITALL()		(~(_OL_WM_GROUP(0)))
#define OL_WM_DELETE_WINDOW	(_OL_WM_GROUP(0) | ((unsigned long)1 << 0))
#define OL_WM_SAVE_YOURSELF	(_OL_WM_GROUP(0) | ((unsigned long)1 << 1))
#define OL_WM_TAKE_FOCUS	(_OL_WM_GROUP(0) | ((unsigned long)1 << 2))

#define _OL_WM_TESTBIT(X, B)	(((X & _OL_WM_GROUPALL()) & \
				 (B & _OL_WM_GROUPALL())) ? \
				 ((X & _OL_WM_BITALL()) & \
				 (B & _OL_WM_BITALL())) : 0)

/* OPEN LOOK Virtual Event (Open Look commands),
 * To maintain the backward compatiability, the following "#define"s
 * are not sorted. As a reminder, the first 59 (i.e., 0-58)
 * entries are according to the OlInputEvent stuff from Dynamic.h
 * NOTE:  DO NOT ADD ANY VALUES TO THE END OF THIS LIST -- ADD THEM TO
 * TO THE END OF THE ABOVE LIST SO THAT THE NUMBER OF COLLISIONS
 * (FOR THE #define SYMBOLS' NUMERIC VALUES IS MINIMIZED!!!!
 */
#define OL_UNKNOWN_INPUT	0
#define OL_UNKNOWN_BTN_INPUT	1
#define OL_SELECT		2
#define OL_ADJUST		3
#define OL_MENU			4
#define OL_CONSTRAIN		5
#define OL_DUPLICATE		6
#define OL_PAN			7
#define OL_UNKNOWN_KEY_INPUT	8
#define OL_CUT			9
#define OL_COPY			10
#define OL_PASTE		11
#define OL_HELP			12
#define OL_CANCEL		13
#define OL_PROP			14
#define OL_PROPERTY		OL_PROP
#define OL_STOP			15
#define OL_UNDO			16
#define OL_NEXTFIELD		17
#define OL_NEXT_FIELD		OL_NEXTFIELD
#define OL_PREVFIELD		18
#define OL_PREV_FIELD		OL_PREVFIELD
#define OL_CHARFWD		19
#define OL_CHARBAK		20
#define OL_ROWDOWN		21
#define OL_ROWUP		22
#define OL_WORDFWD		23
#define OL_WORDBAK		24
#define OL_LINESTART		25
#define OL_LINEEND		26
#define OL_DOCSTART		27
#define OL_DOCEND		28
#define OL_PANESTART		29
#define OL_PANEEND		30
#define OL_DELCHARFWD		31
#define OL_DELCHARBAK		32
#define OL_DELWORDFWD		33
#define OL_DELWORDBAK		34
#define OL_DELLINEFWD		35
#define OL_DELLINEBAK		36
#define OL_DELLINE		37
#define OL_SELCHARFWD		38
#define OL_SELCHARBAK		39
#define OL_SELWORDFWD		40
#define OL_SELWORDBAK		41
#define OL_SELLINEFWD		42
#define OL_SELLINEBAK		43
#define OL_SELLINE		44
#define OL_SELFLIPENDS		45
#define OL_REDRAW		46
#define OL_RETURN		47
#define OL_PAGEUP		48
#define OL_PAGEDOWN		49
#define OL_HOME			50
#define OL_END			51
#define OL_SCROLLUP		52
#define OL_SCROLLDOWN		53
#define OL_SCROLLLEFT		54
#define OL_SCROLLRIGHT		55
#define OL_SCROLLLEFTEDGE	56
#define OL_SCROLLRIGHTEDGE	57
#define OL_PGM_GOTO		58	/* LAST NUMBER IN THIS LIST	*/
/*
 * NOTE:  DO NOT ADD ANY VALUES TO THE END OF THE ABOVE LIST -- ADD THEM TO
 * TO THE END OF THE ABOVE THIS LIST SO THAT THE NUMBER OF COLLISIONS
 * (FOR THE #define SYMBOLS' NUMERIC VALUES IS MINIMIZED!!!!
 */

/*
 ************************************************************************
 *	Define Bitwise Tokens
 *		This are easily identified by the naming convention
 ************************************************************************
 */
#define OL_B_OFF		0
#define OL_B_HORIZONTAL		(1<<0)
#define OL_B_VERTICAL		(1<<1)
#define OL_B_BOTH		(OL_B_VERTICAL|OL_B_HORIZONTAL)

/*
 ************************************************************************
 *    Define pseudo-gravity values. Real gravity values currently
 *    stop with 10, but we'll leave some room for official growth.
 ************************************************************************
 */
#define Ol_EastWestGravity    1000    /* attach left and right */
#define Ol_NorthSouthGravity  1001    /* attach top and bottom */
#define Ol_AllGravity         1002    /* attach all four sides */

/*
 ************************************************************************
 *	Define Constant tokens that are being maintained for source
 *	compatibility with older versions of the toolkit.
 ************************************************************************
 */
#define OL_BEEP_NEVER			OL_NEVER
#define OL_BEEP_NOTICES			OL_NOTICES
#define OL_BEEP_NOTICES_AND_FOOTERS	OL_ALWAYS
#define OL_BEEP_ALWAYS			OL_ALWAYS
#define OL_AUTO_SCROLL_OFF		OL_B_OFF
#define OL_AUTO_SCROLL_HORIZONTAL	OL_B_HORIZONTAL
#define OL_AUTO_SCROLL_VERTICAL		OL_B_VERTICAL
#define OL_AUTO_SCROLL_BOTH		OL_B_BOTH
#ifndef sun
#define OL_GROW_OFF			OL_B_OFF
#define OL_GROW_HORIZONTAL		OL_B_HORIZONTAL
#define OL_GROW_VERTICAL		OL_B_VERTICAL
#define OL_GROW_BOTH			OL_B_BOTH
#endif

/*
 ************************************************************************
 *	Define public structures
 ************************************************************************
 */
				/* Define a callback management
				 * structure for flat widgets		*/

typedef struct {
	Cardinal	item_index;	/* sub-object initiating callb.	*/
	XtPointer	items;		/* sub-object list		*/
	Cardinal	num_items;	/* number of sub-objects	*/
	String *	item_fields;	/* key of fields for list	*/
	Cardinal	num_item_fields;/* number of item fields	*/
	Cardinal	num_fields;	/* number of item fields	*/
} OlFlatCallData;

				/* Define a structure for the complex
				 * flat help id				*/

typedef struct _OlFlatHelpId {
	Widget		widget;
	Cardinal	item_index;
} OlFlatHelpId;

/*
 *************************************************************************
 *	Macros
 *************************************************************************
 */
			/* The following three macros would normally
			 * appear in the private header file, but we
			 * need them for the metric macros		*/

#define _OlFloor(value)		((int) (value))
#define _OlCeiling(value)	((int) (_OlFloor(value) == (value) ? \
					(value) : ((value) + 1)))
#define _OlRound(dbl)		((int) ((double) (dbl) + (double)\
				((double)(dbl) < (double)0 ? -0.5 : 0.5)))

						/* Metric macros	*/

extern Display * toplevelDisplay;

#define OlDefaultDisplay toplevelDisplay
#define OlDefaultScreen  DefaultScreenOfDisplay(toplevelDisplay)

					/* Pixels to Millimeters */

#define Ol_ScreenPixelToMM(direction, value, screen) \
	((double) (value) * (double)(direction == OL_HORIZONTAL ? \
	((double)WidthMMOfScreen(screen) / (double)WidthOfScreen(screen))  :\
	((double)HeightMMOfScreen(screen) / (double)HeightOfScreen(screen))))

#define OlScreenPixelToMM(direction, value, screen) \
		_OlRound(Ol_ScreenPixelToMM(direction, value, screen))

#define Ol_PixelToMM(direction, value) \
		Ol_ScreenPixelToMM(direction, value, OlDefaultScreen)

#define OlPixelToMM(direction, value) \
		OlScreenPixelToMM(direction, value, OlDefaultScreen)

					/* Millimeters to Pixels */

#define Ol_ScreenMMToPixel(direction, value, screen) \
	((double) (value) * (double)(direction == OL_HORIZONTAL ? \
	((double)WidthOfScreen(screen) / (double)WidthMMOfScreen(screen))  :\
	((double)HeightOfScreen(screen) / (double)HeightMMOfScreen(screen))))

#define OlScreenMMToPixel(direction, value, screen) \
		_OlRound(Ol_ScreenMMToPixel(direction, value, screen))

#define Ol_MMToPixel(direction, value) \
		Ol_ScreenMMToPixel(direction, value, OlDefaultScreen)

#define OlMMToPixel(direction, value) \
		OlScreenMMToPixel(direction, value, OlDefaultScreen)

					/* Pixels to Points */

#define Ol_ScreenPixelToPoint(direction, value, screen) \
	(2.834645669 * (double)(value) * (double)(direction == OL_HORIZONTAL ? \
	((double)WidthMMOfScreen(screen) / (double)WidthOfScreen(screen))  :\
	((double)HeightMMOfScreen(screen) / (double)HeightOfScreen(screen))))

#define OlScreenPixelToPoint(direction, value, screen) \
		_OlRound(Ol_ScreenPixelToPoint(direction, value, screen))

#define Ol_PixelToPoint(direction, value) \
		Ol_ScreenPixelToPoint(direction, value, OlDefaultScreen)

#define OlPixelToPoint(direction, value) \
		OlScreenPixelToPoint(direction, value, OlDefaultScreen)

					/* Points to Pixels */

#define Ol_ScreenPointToPixel(direction, value, screen) \
	(0.352777777 * (double)(value) * (double)(direction == OL_HORIZONTAL ? \
	((double)WidthOfScreen(screen) / (double)WidthMMOfScreen(screen))  :\
	((double)HeightOfScreen(screen) / (double)HeightMMOfScreen(screen))))

#define OlScreenPointToPixel(direction, value, screen) \
		_OlRound(Ol_ScreenPointToPixel(direction, value, screen))

#define Ol_PointToPixel(direction, value) \
		Ol_ScreenPointToPixel(direction, value, OlDefaultScreen)

#define OlPointToPixel(direction, value) \
		OlScreenPointToPixel(direction, value, OlDefaultScreen)


/*************************************************************************
 *
 *	typedef's, enum's, struct's
 */

				/* Add a function Prototype for
				 * Dynamic callbacks		*/

typedef void	(*OlDynamicCallbackProc) OL_ARGS((XtPointer));
typedef short		OlDefine;	/* OPEN LOOK non-bitmask #defines */
typedef OlDefine	OlVirtualName;
typedef unsigned long	OlBitMask;	/* OPEN LOOK bitmask #defines	*/

		/* Declare a function pointer type for the variable
		 * argument error handlers.  Note: since this header
		 * does not include stdarg.h (or varargs.h), we'll
		 * only specify function prototypes only if the macros
		 * va_start and va_arg are defined (which would be
		 * the case if stdarg.h (or varargs.h) were included).	*/

#if defined(va_start) && defined(va_arg)
typedef void	(*OlVaDisplayErrorMsgHandler) OL_ARGS((
	Display *,	/* display;	display pointer or NULL		*/
	String,		/* name;	message's resource name - 	*/
			/*		concatenated with the type	*/
	String,		/* type;	message's resource type - 	*/
			/*		concatenated to the name	*/
	String,		/* class;	class of message		*/
	String,		/* message;	composed message created from	*/
	va_list		/* vargs	variable arguments		*/
));
typedef OlVaDisplayErrorMsgHandler	OlVaDisplayWarningMsgHandler;

#else /* defined(va_start) && defined(va_arg) */

typedef void				(*OlVaDisplayErrorMsgHandler)();
typedef OlVaDisplayErrorMsgHandler	OlVaDisplayWarningMsgHandler;

#endif /* defined(va_start) && defined(va_arg) */

typedef void	(*OlErrorHandler) OL_ARGS((
	String		/* message;	simple error message string	*/
));

typedef void	(*OlWarningHandler) OL_ARGS((
	String		/* message;	simple warning message string	*/
));

				/* Include some things that should of
				 * been in the R3 Intrinsics but were
				 * not.  These must be removed for R4	*/

#ifndef XtSpecificationRelease
typedef caddr_t		XtPointer;
#define XtRWidget	"Widget"
#endif /* XtSpecificationRelease */

typedef struct {
	String		name;		/* XtN string			*/
	String		default_value;	/* `,' seperated string		*/
	OlVirtualName	virtual_name;	/* ol command value		*/
} OlKeyOrBtnRec, *OlKeyOrBtnInfo;
					/* Packed Widget Structure	*/
typedef struct {
	Widget          widget;		/* new id to be filled in	*/
	String          name;		/* name of new widget		*/
	WidgetClass *	class_ptr;	/* addr. of widget class	*/
	Widget *	parent_ptr;	/* addr. of parent id		*/
	String		descendant;	/* resource names used in GetValues
					 * call on parent to get real
					 * parent			*/
	ArgList         resources;	/* resources for new widget	*/
	Cardinal        num_resources;	/* number of resources		*/
	Boolean         managed;	/* should widget be managed ???	*/
} OlPackedWidget, *OlPackedWidgetList;

/*
 * Support for Text Verification Callbacks
 */
typedef enum {motionVerify, modVerify, leaveVerify} OlVerifyOpType;
typedef enum {OlsdLeft, OlsdRight} OlScanDirection;
typedef enum {
    OlstPositions, OlstWhiteSpace, OlstEOL, OlstParagraph, OlstLast
    } OlScanType;

typedef long OlTextPosition;
typedef struct {
	int           firstPos;
	int           length;
	unsigned char *ptr;
} OlTextBlock, *OlTextBlockPtr;

typedef struct {
	XEvent		*xevent;
	OlVerifyOpType	operation;
	Boolean		doit;
	OlTextPosition	currInsert, newInsert;
	OlTextPosition	startPos, endPos;
	OlTextBlock	*text;
} OlTextVerifyCD, *OlTextVerifyPtr;

typedef char		OlMnemonic;

typedef struct {
	Boolean		consumed;
	XEvent *	xevent;
	Modifiers	dont_care;
	OlVirtualName	virtual_name;
	KeySym		keysym;
	String 		buffer;
	Cardinal	length;
	Cardinal	item_index;
} OlVirtualEventRec, *OlVirtualEvent;

typedef struct _OlVirtualEventInfo *OlVirtualEventTable; /* an opque defn */

typedef void	(*OlEventHandlerProc) OL_ARGS((Widget, OlVirtualEvent));

typedef struct {
	int			type;	/* XEvent type		*/
	OlEventHandlerProc	handler;/* handling routine	*/
} OlEventHandlerRec, *OlEventHandlerList;

typedef struct {
	unsigned long	msgtype;	 /* type of WM msg */
	XEvent		*xevent;
} OlWMProtocolVerify;

/*
 * For the 3D coloration:
 */

typedef struct _OlColorTuple {
	Pixel		bg0;	/* ``white''          */
	Pixel		bg1;	/* XtNbackground      */
	Pixel		bg2;	/* bg1 + 10-15% black */
	Pixel		bg3;	/* bg1 + 50% black    */
}		OlColorTuple;

typedef struct _OlColorTupleList {
	OlColorTuple *	list;
	Cardinal	size;
}		OlColorTupleList;


/*
 *************************************************************************
 *	Public extern declarations
 *************************************************************************
 */

OLBeginFunctionPrototypeBlock

extern void
OlAction OL_ARGS((
	Widget,		/* w;		*/
	XEvent *,	/* xevent;	*/
	String *,	/* params;	*/
	Cardinal *	/* num_params;	*/
));

extern Boolean
OlActivateWidget OL_ARGS((
	Widget,		/* widget;		widget to activate	*/
	OlVirtualName,	/* activation_type;	type of activation	*/
	XtPointer	/* activate_data;	widget specific data	*/	
));

extern void
OlAddCallback OL_ARGS((
	Widget,
	String,
	XtCallbackProc,
	XtPointer
));

extern Boolean
OlAssociateWidget OL_ARGS((
	Widget,		/* leader widget */
	Widget,		/* follower widget */
	Boolean		/* disable traversal */
));

extern Pixel
OlBlackPixel OL_ARGS((
	Widget
));

extern Boolean
OlCallAcceptFocus OL_ARGS((
	Widget,
	Time
));

extern void
OlCallCallbacks OL_ARGS((
	Widget,
	String,
	XtPointer
));

extern void
OlCallDynamicCallbacks OL_NO_ARGS();

extern Boolean
OlCanAcceptFocus OL_ARGS((
	Widget,
	Time
));

extern void
OlClassSearchIEDB OL_ARGS((
	WidgetClass,		/* wc;		*/
	OlVirtualEventTable	/* db;		*/
));

extern void
OlClassSearchTextDB OL_ARGS((
	WidgetClass	/* wc;		- the target */
));

extern OlVirtualEventTable
OlCreateInputEventDB OL_ARGS((
	Widget,		/* w;				*/
	OlKeyOrBtnInfo,	/* key_info;			*/
	int,		/* num_key_info;		*/
	OlKeyOrBtnInfo,	/* btn_info;			*/
	int		/* num_btn_info;		*/
));

	/* Convert a string containing virtual expressions into
	 * into a standard Xt translation string		*/
extern char *
OlConvertVirtualTranslation OL_ARGS((
	char *		/* translation;	- virtual translation	*/
));

	/* Create a single Packed Widget	*/
extern Widget
OlCreatePackedWidget OL_ARGS((
	OlPackedWidget *	/* packed_widget; */
));

	/* Create multiple packed widgets	*/
extern Widget
OlCreatePackedWidgetList OL_ARGS((
	/* OlPackedWidgetList	packed_widget_list; */
	/* Cardinal		num_of_elements; */
));


extern Boolean
OlDragAndDrop OL_ARGS((
	Widget,		/* widget which started drag operation	*/
	Window *,	/* window where drop occurred		*/
	Position *,	/* x location in window of drop		*/
	Position *	/* y location in window of drop		*/
));

				/* OPEN LOOK toolkit error	*/
extern void
OlError OL_ARGS((
	String		/* error_msg;	- message string */
));

extern Boolean
OlFlatCallAcceptFocus OL_ARGS((
	Widget,		/* Flat widget id	*/
	Cardinal,	/* Item index		*/
	Time		/* time			*/
));

extern Cardinal
OlFlatGetFocusItem OL_ARGS((
	Widget		/* Flat widget id	*/
));

extern void
OlFlatGetItemGeometry OL_ARGS((
	Widget,		/* Flat widget id	*/
	Cardinal,	/* item index		*/
	Position *,	/* x return		*/
	Position *,	/* y return		*/
	Dimension *,	/* width return		*/
	Dimension *	/* height return	*/
));

extern Cardinal
OlFlatGetItemIndex OL_ARGS((
	Widget,		/* Flat widget id	*/
	Position,	/* x location		*/
	Position	/* y location		*/
));

extern void
OlFlatGetValues OL_ARGS((
	Widget,		/* widget;	- flat widget id	*/
	Cardinal,	/* item_index;	- item to query		*/
	ArgList,	/* args;	- querying args		*/
	Cardinal	/* num_args;	- number of args	*/
));

extern void
OlFlatSetValues OL_ARGS((
	Widget,		/* widget;	- flat widget id	*/
	Cardinal,	/* item_index;	- item to modify	*/
	ArgList,	/* args;	- modifying args	*/
	Cardinal	/* num_args;	- number of args	*/
));

extern void
OlVaFlatGetValues OL_ARGS((
	Widget,		/* widget;	- flat widget id	*/
	Cardinal,	/* item_index;	- item to query		*/
	...		/* NULL terminated name/value pairs	*/
));

extern void
OlVaFlatSetValues OL_ARGS((
	Widget,		/* widget;	- flat widget id	*/
	Cardinal,	/* item_index;	- item to modify	*/
	...		/* NULL terminated name/value pairs	*/
));

extern char
OlGetResolution OL_ARGS((
	Screen *	/* screen; */
));

extern XtCallbackStatus
OlHasCallbacks OL_ARGS((
	Widget,
	String
));

/* Note: this function is obsolete.  Use OlGetCurrentFocusWidget() */
extern Boolean
OlHasFocus OL_ARGS((
	Widget		/* widget;	- widget to query	*/
));

					/* Toolkit initialization	*/
extern Widget
OlInitialize OL_ARGS((
	char *,		/* shell_name;	- initial shell instance name	*/
	char *,		/* classname;	- application class		*/
	XrmOptionDescRec *, /* urlist;	- options list			*/
	Cardinal,	/* num_urs;	- number of options		*/
	int *,		/* argc;	- pointer to argc		*/
	char **		/* argv;	- argv				*/
));

extern Bool
OlIsFMRunning OL_ARGS((
	Display *,
	Screen *
));

extern Bool
OlIsWMRunning OL_ARGS((
	Display *,
	Screen *
));

extern Bool
OlIsWSMRunning OL_ARGS((
	Display *,
	Screen *
));

#define OL_CORE_IE		(XtPointer) 1
#define OL_TEXT_IE		(XtPointer) 2
#define OL_DEFAULT_IE		(XtPointer) 3

extern void
OlLookupInputEvent OL_ARGS((
	Widget,		/* widget;		- widget getting xevent	*/
	XEvent *,	/* xevent;		- xevent to look at	*/
	OlVirtualEvent,	/* virtual_event_ret;	- returned virtual event*/
	XtPointer	/* db_flag;		- search flag		*/
));

typedef void    (*OlMenuPositionProc) OL_ARGS((
	Widget,         /* menu;         - menu shell widget id		*/
	Widget,         /* emanate;      - the emanate widget		*/
	Cardinal,	/* emanate_index - index to flat item		*/
	OlDefine,       /* state;        - menu's state          	*/
	Position *,     /* mx;           - moving position       	*/
	Position *,     /* my;           - moving position       	*/
	Position *,     /* px;           - pointer position      	*/
	Position *      /* py;           - pointer position      	*/
));

extern void
OlMenuPopdown OL_ARGS((
	Widget,			/* w;		- menu's widget id 	*/
	Boolean			/* pinned_also; - pinned or not 	*/
));

extern void
OlMenuPopup OL_ARGS((
	Widget,			/* w;		 - menu's widget id	*/
	Widget,                 /* emanate;      - emanate widget       */
	Cardinal,		/* emanate_index - index to flat item	*/
	OlDefine,		/* state;	 - menu's state		*/
	Boolean,		/* setpos;	 - set position 	*/
	Position,		/* x;		 - pointer position 	*/
	Position,		/* y;		 - pointer position 	*/
	OlMenuPositionProc	/* pos_proc;	 - procedure or NULL 	*/
));

extern void
OlMenuPost OL_ARGS((
	Widget			/* w;		- Menu's Widget id */
));

extern void
OlMenuUnpost OL_ARGS((
	Widget			/* w;		- menu's widget id */
));

extern Widget
OlMoveFocus OL_ARGS((
	Widget,		/* widget;	- Starting point */
	OlDefine,	/* direction;	- direction of movement */
	Time		/* time;	- time of request */
));

					/* Toolkit post-initialization	*/
extern void
OlPostInitialize OL_ARGS((
	char *,		/* classname;	- application class		*/
	XrmOptionDescRec *, /* urlist;	- options list			*/
	Cardinal,	/* num_urs;	- number of options		*/
	int *,		/* argc;	- pointer to argc		*/
	char **		/* argv;	- argv				*/
));

					/* Toolkit pre-initialization	*/
extern void
OlPreInitialize OL_ARGS((
	char *,		/* classname;	- application class		*/
	XrmOptionDescRec *, /* urlist;	- options list			*/
	Cardinal,	/* num_urs;	- number of options		*/
	int *,		/* argc;	- pointer to argc		*/
	char **		/* argv;	- argv				*/
));

extern void
OlGetApplicationResources OL_ARGS((
	Widget			w,
	XtPointer		base,
	XtResource *		resources,
	int			num_resources,
	ArgList			args,
	Cardinal		num_args
));

extern void
OlGetApplicationValues OL_ARGS((
	Widget,		/* widget;	- widget to get display */
	ArgList,	/* args;	- args to be fetched	*/
	Cardinal	/* num_args;	- number of args	*/
));

extern Widget
OlGetCurrentFocusWidget OL_ARGS((
	Widget		/* widget;	- of the Base window for this widget */
));

extern void
OlGrabDragPointer OL_ARGS((
	Widget,		/* widget wanting to begin draa operation	*/
	Cursor,		/* cursor used during drag operation		*/
	Window		/* confine to window or None			*/
));

extern void
OlGrabVirtualKey OL_ARGS((
	Widget			w,
	OlVirtualName		vkey,
	Boolean			owner_events,
	int			pointer_mode,
	int			keyboard_mode
));

extern OlDefine
OlQueryAcceleratorDisplay OL_ARGS((
	Widget		/* any widget	*/
));

extern OlDefine
OlQueryMnemonicDisplay OL_ARGS((
	Widget		/* any widget	*/
));

extern void
OlRegisterDynamicCallback OL_ARGS((
	OlDynamicCallbackProc	proc,
	XtPointer		data
));

						/* Register help	*/
extern void
OlRegisterHelp OL_ARGS((
	OlDefine,	/* id_type;	- type of help being registered	*/
	XtPointer,	/* id;		- id of object registering help	*/
	String,		/* tag;		- string tag for the help msg.	*/
	OlDefine,	/* source_type;	- type of help message source	*/
	XtPointer	/* source;	- pointer to the message source	*/
));

extern void
OlRemoveCallback OL_ARGS((
	Widget,
	String,
	XtCallbackProc,
	XtPointer
));

extern Boolean
OlSetAppEventProc OL_ARGS((
	Widget,			/* widget of the application		*/
	OlDefine,		/* type:	OL_PRE or OL_POST	*/
	OlEventHandlerList,	/* list 				*/
	Cardinal		/* length of list			*/
));

extern void
OlSetInputFocus OL_ARGS((
	Widget,		/* widget;	widget to get focus	*/
	int,		/* revert_to;	See XLib documentation	*/
	Time		/* time;	time or CurrentTime	*/
));

			/* This procedure is used to override the default
			 * fatal error message procedure.		*/

extern OlVaDisplayErrorMsgHandler
OlSetVaDisplayErrorMsgHandler OL_ARGS((
	OlVaDisplayErrorMsgHandler	/* new handler or NULL	*/
));

			/* This procedure is used to override the default
			 * non-fatal error message procedure.		*/

extern OlVaDisplayWarningMsgHandler
OlSetVaDisplayWarningMsgHandler OL_ARGS((
	OlVaDisplayWarningMsgHandler	/* new handler or NULL	*/
));

	/* To register a procedure to be called on fatal errors:	*/
extern OlErrorHandler
OlSetErrorHandler OL_ARGS((
	OlErrorHandler		/* handler;	- handler to be called	*/
));

	/* To register a procedure to be called on non-fatal errors:	*/
extern OlWarningHandler
OlSetWarningHandler OL_ARGS((
	OlWarningHandler	/* handler;	- handler to be called	*/
));

extern void
OlUnassociateWidget OL_ARGS((
	Widget			/* follower widget */
));

extern void
OlUngrabDragPointer OL_ARGS((
	Widget			/* widget which started the drag operation */
));

extern void
OlUngrabVirtualKey OL_ARGS((
	Widget			w,
	OlVirtualName		vkey
));

extern int
OlUnregisterDynamicCallback OL_ARGS((
	OlDynamicCallbackProc	proc,
	XtPointer		data
));

extern void
OlUpdateDisplay OL_ARGS((
	Widget			w
));

			/* The OPEN LOOK toolkit's fatal error routine.
			 * This is a variable argument list routine
			 * where the first 5 parameters are mandatory	*/

extern void
OlVaDisplayErrorMsg OL_ARGS((
	Display *,	/* display;	Display pointer or NULL		*/
	String,		/* name;	message's resource name - 
					concatenated with the type	*/
	String,		/* type;	message's resource type - 
					concatenated to the name	*/
	String,		/* class;	class of message		*/
	String,		/* message;	the message string		*/
	...		/* parameters;	variable arguments to satisfy
					the message parameters		*/
));

			/* The OPEN LOOK toolkit's non-fatal error routine.
			 * This is a variable argument list routine
			 * where the first 5 parameters are mandatory	*/

extern void
OlVaDisplayWarningMsg OL_ARGS((
	Display *,	/* display;	Display pointer or NULL		*/
	String,		/* name;	message's resource name - 
					concatenated with the type	*/
	String,		/* type;	message's resource type - 
					concatenated to the name	*/
	String,		/* class;	class of message		*/
	String,		/* message;	the message string		*/
	...		/* parameters;	variable arguments to satisfy
					the message parameters		*/
));

					/* OPEN LOOK toolkit warning	*/
extern void
OlWarning OL_ARGS((
	String		/* error_msg;	- message string	*/
));

extern Pixel
OlWhitePixel OL_ARGS((
	Widget
));

extern Colormap
OlColormapOfObject OL_ARGS((
	Widget
));

extern Visual *
OlVisualOfObject OL_ARGS((
	Widget
));

extern int
OlDepthOfObject OL_ARGS((
	Widget
));

extern void
OlWidgetSearchIEDB OL_ARGS((
	Widget,			/* w;		*/
	OlVirtualEventTable	/* db;		*/
));

extern void
OlWidgetSearchTextDB OL_ARGS((
	Widget		/* widget;	- the target */
));

extern void
OlWMProtocolAction OL_ARGS((
	Widget,
	OlWMProtocolVerify *,
	OlDefine		/* action to be taken */
));

#ifdef	sun
extern void _XtInherit OL_NO_ARGS();
#endif

OLEndFunctionPrototypeBlock

#endif /* _XtIntrinsic_h */

#ifdef	sun
static void (*OlInherit)() = _XtInherit; /* needed to pull in libXt.sa */
#endif


#endif	/* !_OPENLOOK_H */
