/*
**   ----------------------------------------------------------------- 
**        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	"@(#)OlClients.h	3.4 SMI"
#ident	"@(#)misc:include/Xol/OlClients.h	1.16"
#endif

#ifndef __OlClients_h__
#define __OlClients_h__


typedef struct {
	long	flags;
	enum {
	MENU_FULL = 0,
	MENU_LIMITED = 1,
	MENU_NONE = 2
	} menu_type;
	long	pushpin_initial_state;	/* as for WM_PUSHPIN_STATE */
} WMDecorationHints;

#define DELIMITER	'\n'

#define WMDecorationHeader	(1L<<0)		/* has title bar */
#define WMDecorationPushpin	(1L<<2)		/* has push pin */
#define WMDecorationCloseButton	(1L<<3)		/* has shine mark */
#define WMDecorationResizeable	(1L<<5)		/* has grow corners */


#define WMWindowNotBusy		0
#define WMWindowIsBusy		1


#define WMPushpinIsOut		0
#define WMPushpinIsIn		1


typedef struct {
	int		state;
	Window		icon;
} WMState;

#define OLWSM_STATE	(1L<<0)	/* olwsm is running */
#define OLWM_STATE	(1L<<1)	/* olwm is running */
#define OLFM_STATE	(1L<<2)	/* olfm is running */

typedef struct {
	unsigned long	state;
} OLManagerState;


typedef struct {
	int	min_width;
	int	min_height;
	int	max_width;
	int	max_height;
	int	width_inc;
	int	height_inc;
} WMIconSize;


#define MessageHint	(1L<<7)

#define ConfigureDenied	(1L<<0)		/* WM_CONFIGURE_DENIED */
#define WindowMoved	(1L<<1)		/* WM_WINDOW_MOVED */
#define BangMessage	(1L<<2)		/* BANG! */
#define FocusMessage	(1L<<3)		/* WM_TAKE_FOCUS */

/*
 * Following for WMState structure
 */

#define WithdrawnState	0
#define NormalState	1
#define IconicState	3

/**************************************************************************
 *
 * WARNING. OlWinAttr and the _OL_WIN_ATTR property.
 * -------- --------- --- --- ------------ ---------
 *
 * In earlier versions of OLIT prior to, and including, version 2.5 the 
 * _OL_WIN_ATTR property recognised by the Sun olwm was incompatible with 
 * that defined by the AT&T version of the toolkit in that there were no
 * "flags" or "cancel" fields in the Sun version of the property.
 *
 * In version 2 (and 2.5) of OLIT these fields were #ifdef'ed out of the
 * AT&T strutcure in order to support interoperability with OpenWindows 
 * V2.0 olwm.
 *
 * From V2.5 of OLIT it is intended to move over to the longer AT&T version
 * of this property containing the 'flags' and 'cancel' fields.
 * However to maintain backwards compatibility with V2.0 code the shorter
 * variant shall remain. Its use is restricted to provide source and binary
 * backwards compatibility for V2.0 clients ONLY.
 *
 * In general applications developers building on OLIT V2.5 or later are 
 * STRONGLY ADVISED NOT TO USE THE OlWinAttrs STRUCTURE DIRECTLY IN EITHER 
 * OF ITS FORMS, ALONG WITH THE GetOLWinAttrs, SetOLWinAttrs, 
 * XGetWindowPropety OR XChangeProperty FUNCTIONS IN ORDER TO AFFECT WINDOW 
 * DECORATION. Applications programmers should use the appropriate resources
 * affecting window decoration defined by the Vendor Shell Class Extension 
 * found in OLIT V2.5 or later. 
 *
 * Should the applications programmer insist on direct use of the
 * _OL_WIN_ATTR property, access should be via the (New)OlWinAttr structure
 * and the Set/GetOLWinAttrs and Set/GetNewOLWinAttrs functions,
 * since they take note (as does the Vendor Shell extension) of the 
 * XtNuseShortOLWinAttrs toolkit resource which defines the appropriate
 * variant of the property recognised by the local olwm.
 * Applications programmers using Xlib functions to read and write the
 * _OL_WIN_ATTR property should note the setting of this resource and
 * and the length of the property returned from XGetWindowProperty to
 * determine the appropriate variant in use.
 *
 * Note that macros are provided for cross compilation between AT&T 
 * environments and Sun.
 *
 **************************************************************************/

/* 
 * THE FOLLOWING STRUCTURE USED IN A SUN ENVIRONMENT IS USED FOR BACKWARDS 
 * COMPATIBILITY ONLY
 */

typedef struct OlWinAttr {	/* old short version DO NOT USE */
#if	!(defined(sun) || defined(OpenWindowsEnvironment))
	unsigned long	flags;
#endif
	Atom		win_type;
	long		menu_type;
	long		pin_state;
#if	!(defined(sun) || defined(OpenWindowsEnvironment))
	long		cancel;
#endif
} OLWinAttr;

#define	ULongsInOLWinAttr	(sizeof (OLWinAttr) / sizeof (unsigned long))

/*
 * This New structure should be used if at all, developers are recommended
 * to use the appropriate shell resources.
 */

#if	defined(sun) || defined(OpenWindowsEnvironment)
typedef struct NewOlWinAttr {	/* new longer AT&T compliant struct */
	unsigned long	flags;
	Atom		win_type;
	long		menu_type;
	long		pin_state;
	long		cancel;
} NewOLWinAttr;

#define	ULongsInNewOLWinAttr	(sizeof (NewOLWinAttr) / sizeof (unsigned long))
#else
#ifdef	SunOLWinAttrinATTEnv
#define	NewOLWinAttr	OLWinAttr /* for compiling sun code in a AT&T
				   * environment
				   */
#define	ULongsInNewOLWinAttr	ULongsInOLWinAttr
#endif	SunOLWinAttrinATTEnv
#ifdef	ATTOLWinAttrinSunEnv
#define	OLWinAttr	NewOLWinAttr
#endif	ATTOLWinAttrinSunEnv
#endif	/* sun || OpenWindowsEnvironment */

typedef struct OlWinColors {
	unsigned long	flags;
	unsigned long	fg_red;
	unsigned long	fg_green;
	unsigned long	fg_blue;
	unsigned long	bg_red;
	unsigned long	bg_green;
	unsigned long	bg_blue;
	unsigned long	bd_red;
	unsigned long	bd_green;
	unsigned long	bd_blue;
} OLWinColors;

/*
 * values for _OL_WIN_ATTR flags
 */

#define	_OL_WA_WIN_TYPE		(1<<0)
#define	_OL_WA_MENU_TYPE	(1<<1)
#define	_OL_WA_PIN_STATE	(1<<2)
#define	_OL_WA_CANCEL		(1<<3)

/*
 * values for _OL_WIN_COLORS flags
 */

#define	_OL_WC_FOREGROUND	(1<<0)
#define	_OL_WC_BACKGROUND	(1<<1)
#define	_OL_WC_BORDER		(1<<2)

/*
 * for compatiblity with earlier software
 */

#define WM_PUSHPIN_STATE	_OL_PIN_STATE
#define WM_WINDOW_BUSY		_OL_WIN_BUSY
#define MENU_DISMISS_ONLY	MENU_NONE


extern Atom	WM_DISMISS;
extern Atom	WM_DECORATION_HINTS;
extern Atom	WM_WINDOW_MOVED;
extern Atom	WM_TAKE_FOCUS;
extern Atom	WM_DELETE_WINDOW;
extern Atom	BANG;
extern Atom	WM_SAVE_YOURSELF;
extern Atom	WM_STATE;
extern Atom	WM_CHANGE_STATE;
extern Atom	WM_PROTOCOLS;

extern Atom	_OL_COPY;
extern Atom	_OL_CUT;
extern Atom	_OL_HELP_KEY;
extern Atom	_OL_WIN_ATTR;
extern Atom	_OL_WT_BASE;
extern Atom	_OL_WT_CMD;
extern Atom	_OL_WT_PROP;
extern Atom	_OL_WT_HELP;
extern Atom	_OL_WT_NOTICE;
extern Atom	_OL_WT_OTHER;
extern Atom	_OL_DECOR_ADD;
extern Atom	_OL_DECOR_DEL;
extern Atom	_OL_DECOR_CLOSE;
extern Atom	_OL_DECOR_RESIZE;
extern Atom	_OL_DECOR_HEADER;
extern Atom	_OL_DECOR_PIN;
extern Atom	_OL_WIN_COLORS;
extern Atom	_OL_PIN_STATE;
extern Atom	_OL_WIN_BUSY;
extern Atom	_OL_MENU_FULL;
extern Atom	_OL_MENU_LIMITED;
extern Atom	_OL_NONE;

extern void	InitializeOpenLook();
extern void	SetWMDecorationHints();
extern void	SetWMState();
extern void	SetWMWindowBusy();
extern Status	GetHelpKeyMessage();
extern void	SendProtocolMessage();
extern void	SetWMPushpinState();
extern int	GetOLWinAttr();
#if	defined(sun) || defined(OpenWindowsEnvironment)
extern void	SetOLWinAttr();
#endif	
#if	defined(sun) || defined(OpenWindowsEnvironment)
extern int	GetNewOLWinAttr();
extern void	SetNewOLWinAttr();
#else
#ifdef	SunOLWinAttrinATTEnv
#define	GetNewOLWinAttr	GetOLWinAttr /* for compilation of sun code */
#define	SetNewOLWinAttr	SetOLWinAttr /* in an AT&T environment	    */
#endif	SunOLWinAttrinATTEnv
#ifdef	ATTOLWinAttrinSunEnv
#define	GetOLWinAttr	GetNewOLWinAttr /* for compilation of AT&T code */
#define	SetOLWinAttr	SetNewOLWinAttr /* in a Sun environment    	*/
#endif
#endif
extern int	GetOLWinColors();

extern void     EnqueueCharProperty();
extern char *   GetCharProperty();
extern Atom *   GetAtomList();

#endif /* __OlClients_h__ */
