/*  DEC/CMS REPLACEMENT HISTORY, Element SELECTION.H */
/*  *5    27-FEB-1988 18:25:16 GEORGE "Add copyright" */
/*  *4     5-JAN-1988 15:57:51 TREGGIARI "Replace with completely new version" */
/*  *3    18-DEC-1987 14:16:28 TREGGIARI "Replace with completely new version" */
/*  *2     2-NOV-1987 17:23:41 TREGGIARI "Replace with completely new version" */
/*  *1     2-NOV-1987 14:59:24 ORGOVAN "Initial Entry" */
/*  DEC/CMS REPLACEMENT HISTORY, Element SELECTION.H */
/*
 * $Header: Selection.h,v 1.1 89/02/07 17:19:12 haynes Exp $
 */

/*
*****************************************************************************
**                                                                          *
**                         COPYRIGHT (c) 1988 BY                            *
**             DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.                *
**	MASSACHUSSETTS INSTITUTE OF TECHNOLOGY, CAMBRIDGE, MASS.	    *
**                         ALL RIGHTS RESERVED                              *
**                                                                          *
**  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED  *
**  ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE  *
**  INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER  *
**  COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY  *
**  OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY  *
**  TRANSFERRED.                                                            *
**                                                                          *
**  THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE  *
**  AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT  *
**  CORPORATION OR MIT.                                                     *
**                                                                          *
**  DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS  *
**  SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.                 *
**                                                                          *
*****************************************************************************
**++
**  FACILITY:
**
**      < to be supplied >
**
**  ABSTRACT:
**
**      < to be supplied >
**
**  ENVIRONMENT:
**
**      < to be supplied >
**
**  MODIFICATION HISTORY:
**
**      < to be supplied >
**
**--
**/

#ifndef _Selection_h
#define _Selection_h

#define XT_CONVERT_FAIL (Atom)0x80000001

/*
 * Routine to get the value of a selection as a given type.  Returns
 * TRUE if it successfully got the value as requested, FALSE otherwise.  
 * selection is the atom describing the type of selection (e.g. 
 * primary or secondary). value is set to the pointer of the converted 
 * value, with length elements of data, each of size indicated by format.
 * (This pointer will be freed using XtFree when the selection has
 *  been delivered to the requestor.)  target is
 * the type that the conversion should use if possible; type is returned as
 * the actual type returned.  Format should be either 8, 16, or 32, and
 * specifies the word size of the selection, so that Xlib and the server can
 * convert it between different machine types. */

typedef Boolean (*XtConvertSelectionProc)(Widget, Atom*, Atom*, Atom*,
	caddr_t*, unsigned long*, int*);

/*
 * Routine to inform a widget that it no longer owns the given selection.
 */

typedef void (*XtLoseSelectionProc)(Widget, Atom*);


/*
 * Routine to inform the selection owner when a selection requestor
 * has successfully retrieved the selection value.
 */

typedef void (*XtSelectionDoneProc)(Widget, Atom*, Atom*);


/*
 * Routine to call back when a requested value has been obtained for a
 *  selection.
 */

typedef void (*XtSelectionCallbackProc)(Widget, caddr_t, Atom*, Atom*,
	caddr_t, unsigned long*, int*);
    

/*
 * Set the given widget to own the selection.  The convertProc should
 * be called when someone wants the current value of the selection. If it
 * is not NULL, the
 * losesSelection gets called whenever the window no longer owns the selection
 * (because someone else took it). If it is not NULL, the doneProc gets
 * called when the widget has provided the current value of the selection
 * to a requestor and the requestor has indicated that it has succeeded
 * in reading it by deleting the property.
 */

extern Boolean XtOwnSelection(Widget, Atom, Time, XtConvertSelectionProc,
	XtLoseSelectionProc, XtSelectionDoneProc);

/*
 * The given widget no longer wants the selection.  If it still owns it, then
 * the selection owner is cleared, and the window's losesSelection is called.
 */

extern void XtDisownSelection(Widget, Atom, Time);

/*
 * Get the value of the given selection.  
 */

extern void XtGetSelectionValue(Widget, Atom, Atom, XtSelectionCallbackProc,
	caddr_t, Time);

extern void XtGetSelectionValues(Widget, Atom, Atom*, int, XtSelectionCallbackProc,
	Opaque*, Time);


/* Set the selection timeout value, in units of milliseconds */

extern void XtSetSelectionTimeout(unsigned long);


 /* Return the selection timeout value, in units of milliseconds */

extern unsigned int XtGetSelectionTimeout();

/* incremental interface */

typedef void (*XtLoseSelectionIncrProc) (Widget, Atom*, Opaque); 

typedef void (*XtSelectionDoneIncrProc) (Widget, Atom*, Atom*, Opaque, Opaque);

typedef Boolean (*XtConvertSelectionIncrProc)(Widget, Atom*, Atom*, Atom*, caddr_t*,
	unsigned long*, int*, unsigned long, Opaque, Opaque);

typedef void (*XtCancelSelectionCallbackProc)(Widget, Atom*, Opaque);

typedef void (*XtCancelConvertSelectionProc)(Widget, Atom*, Atom*, Opaque, Opaque);

typedef void (*XtSelectionIncrCallbackProc) (Widget, Opaque, Atom*, Atom*, caddr_t,
	unsigned long*, int*);

extern Boolean XtOwnSelectionIncremental(
	Widget, Atom, Time, XtConvertSelectionIncrProc, XtLoseSelectionIncrProc,
        XtSelectionDoneIncrProc, XtCancelConvertSelectionProc, Opaque); 

extern  void XtGetSelectionValueIncremental(Widget, Atom, Atom,
	XtSelectionIncrCallbackProc, XtCancelSelectionCallbackProc, Opaque, Time);

extern void XtGetSelectionValuesIncremental(Widget, Atom, Atom*, int,
	XtSelectionIncrCallbackProc, XtCancelSelectionCallbackProc, Opaque*, Time);


#endif  _Selection_h
