home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _25fc1723b5c1c53fc47fae0837499af9 < prev    next >
Encoding:
Text File  |  2004-06-01  |  7.5 KB  |  188 lines

  1. /*
  2.  * tkSelect.h --
  3.  *
  4.  *    Declarations of types shared among the files that implement
  5.  *    selection support.
  6.  *
  7.  * Copyright (c) 1995 Sun Microsystems, Inc.
  8.  *
  9.  * See the file "license.terms" for information on usage and redistribution
  10.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  11.  *
  12.  * RCS: @(#) $Id: tkSelect.h,v 1.4 1999/05/25 20:40:54 stanton Exp $
  13.  */
  14.  
  15. #ifndef _TKSELECT
  16. #define _TKSELECT
  17.  
  18. /*
  19.  * When a selection is owned by a window on a given display, one of the
  20.  * following structures is present on a list of current selections in the
  21.  * display structure.  The structure is used to record the current owner of
  22.  * a selection for use in later retrieval requests.  There is a list of
  23.  * such structures because a display can have multiple different selections
  24.  * active at the same time.
  25.  */
  26.  
  27. typedef struct TkSelectionInfo {
  28.     Atom selection;        /* Selection name, e.g. XA_PRIMARY. */
  29.     Tk_Window owner;        /* Current owner of this selection. */
  30.     int serial;            /* Serial number of last XSelectionSetOwner
  31.                  * request made to server for this
  32.                  * selection (used to filter out redundant
  33.                  * SelectionClear events). */
  34.     Time time;            /* Timestamp used to acquire selection. */
  35.     Tk_LostSelProc *clearProc;    /* Procedure to call when owner loses
  36.                  * selection. */
  37.     ClientData clearData;    /* Info to pass to clearProc. */
  38.     struct TkSelectionInfo *nextPtr;
  39.                 /* Next in list of current selections on
  40.                                  * this display.  NULL means end of list */
  41. } TkSelectionInfo;
  42.  
  43. /*
  44.  * One of the following structures exists for each selection handler
  45.  * created for a window by calling Tk_CreateSelHandler.  The handlers
  46.  * are linked in a list rooted in the TkWindow structure.
  47.  */
  48.  
  49. typedef struct TkSelHandler {
  50.     Atom selection;        /* Selection name, e.g. XA_PRIMARY */
  51.     Atom target;        /* Target type for selection
  52.                  * conversion, such as TARGETS or
  53.                  * STRING. */
  54.     Atom format;        /* Format in which selection
  55.                  * info will be returned, such
  56.                  * as STRING or ATOM. */
  57.     Tk_XSelectionProc *proc;    /* Procedure to generate selection
  58.                  * in this format. */
  59.     ClientData clientData;    /* Argument to pass to proc. */
  60.     int size;            /* Size of units returned by proc
  61.                  * (8 for STRING, 32 for almost
  62.                  * anything else). */
  63.     struct TkSelHandler *nextPtr;
  64.                 /* Next selection handler associated
  65.                  * with same window (NULL for end of
  66.                  * list). */
  67. } TkSelHandler;
  68.  
  69. /*
  70.  * When the selection is being retrieved, one of the following
  71.  * structures is present on a list of pending selection retrievals.
  72.  * The structure is used to communicate between the background
  73.  * procedure that requests the selection and the foreground
  74.  * event handler that processes the events in which the selection
  75.  * is returned.  There is a list of such structures so that there
  76.  * can be multiple simultaneous selection retrievals (e.g. on
  77.  * different displays).
  78.  */
  79.  
  80. typedef struct TkSelRetrievalInfo {
  81.     Tcl_Interp *interp;        /* Interpreter for error reporting. */
  82.     TkWindow *winPtr;        /* Window used as requestor for
  83.                  * selection. */
  84.     Atom selection;        /* Selection being requested. */
  85.     Atom property;        /* Property where selection will appear. */
  86.     Atom target;        /* Desired form for selection. */
  87.     Tk_GetXSelProc *proc;     /* Procedure to call to handle pieces
  88.                  * of selection. */
  89.     ClientData clientData;    /* Argument for proc. */
  90.     int result;            /* Initially -1.  Set to a Tcl
  91.                  * return value once the selection
  92.                  * has been retrieved. */
  93.     Tcl_TimerToken timeout;    /* Token for current timeout procedure. */
  94.     int idleTime;        /* Number of seconds that have gone by
  95.                  * without hearing anything from the
  96.                  * selection owner. */
  97.     Tcl_EncodingState encState;    /* Holds intermediate state during translations
  98.                  * of data that cross buffer boundaries. */
  99.     int encFlags;        /* Encoding translation state flags. */
  100.     Tcl_DString buf;        /* Buffer to hold translation data. */
  101.     struct TkSelRetrievalInfo *nextPtr;
  102.                 /* Next in list of all pending
  103.                  * selection retrievals.  NULL means
  104.                  * end of list. */
  105. } TkSelRetrievalInfo;
  106.  
  107. /*
  108.  * The clipboard contains a list of buffers of various types and formats.
  109.  * All of the buffers of a given type will be returned in sequence when the
  110.  * CLIPBOARD selection is retrieved.  All buffers of a given type on the
  111.  * same clipboard must have the same format.  The TkClipboardTarget structure
  112.  * is used to record the information about a chain of buffers of the same
  113.  * type.
  114.  */
  115.  
  116. typedef struct TkClipboardBuffer {
  117.     char *buffer;            /* Null terminated data buffer. */
  118.     long length;            /* Length of string in buffer. */
  119.     struct TkClipboardBuffer *nextPtr;    /* Next in list of buffers.  NULL
  120.                      * means end of list . */
  121. } TkClipboardBuffer;
  122.  
  123. typedef struct TkClipboardTarget {
  124.     Atom type;                /* Type conversion supported. */
  125.     Atom format;            /* Representation used for data. */
  126.     TkClipboardBuffer *firstBufferPtr;    /* First in list of data buffers. */
  127.     TkClipboardBuffer *lastBufferPtr;    /* Last in list of clipboard buffers.
  128.                      * Used to speed up appends. */
  129.     struct TkClipboardTarget *nextPtr;    /* Next in list of targets on
  130.                      * clipboard.  NULL means end of
  131.                      * list. */
  132. } TkClipboardTarget;
  133.  
  134. /*
  135.  * It is possible for a Tk_SelectionProc to delete the handler that it
  136.  * represents.  If this happens, the code that is retrieving the selection
  137.  * needs to know about it so it doesn't use the now-defunct handler
  138.  * structure.  One structure of the following form is created for each
  139.  * retrieval in progress, so that the retriever can find out if its
  140.  * handler is deleted.  All of the pending retrievals (if there are more
  141.  * than one) are linked into a list.
  142.  */
  143.  
  144. typedef struct TkSelInProgress {
  145.     TkSelHandler *selPtr;    /* Handler being executed.  If this handler
  146.                  * is deleted, the field is set to NULL. */
  147.     struct TkSelInProgress *nextPtr;
  148.                 /* Next higher nested search. */
  149. } TkSelInProgress;
  150.  
  151. /*
  152.  * Chunk size for retrieving selection.  It's defined both in
  153.  * words and in bytes;  the word size is used to allocate
  154.  * buffer space that's guaranteed to be word-aligned and that
  155.  * has an extra character for the terminating NULL.
  156.  */
  157.  
  158. #define TK_SEL_BYTES_AT_ONCE 4000
  159. #define TK_SEL_WORDS_AT_ONCE 1001
  160.  
  161. /*
  162.  * Declarations for procedures that are used by the selection-related files
  163.  * but shouldn't be used anywhere else in Tk (or by Tk clients):
  164.  */
  165.  
  166. extern TkSelInProgress *
  167.                         TkSelGetInProgress _ANSI_ARGS_((void));
  168. extern void             TkSelSetInProgress _ANSI_ARGS_((
  169.                             TkSelInProgress *pendingPtr));
  170.  
  171. extern void        TkSelClearSelection _ANSI_ARGS_((Tk_Window tkwin,
  172.                 XEvent *eventPtr));
  173. extern int        TkSelDefaultSelection _ANSI_ARGS_((
  174.                 TkSelectionInfo *infoPtr, Atom target,
  175.                 long *lbuffer, int maxBytes, Atom *typePtr, int *formatPtr));
  176. extern int        TkSelGetSelection _ANSI_ARGS_((Tcl_Interp *interp,
  177.                 Tk_Window tkwin, Atom selection, Atom target,
  178.                 Tk_GetXSelProc *proc, ClientData clientData));
  179. char *        TkSelCvtFromX _ANSI_ARGS_((long *propPtr, int numValues,
  180.                 Atom type, Tk_Window tkwin));
  181. int        TkSelCvtToX _ANSI_ARGS_((long *buffer, char *string, Atom type,
  182.                 Tk_Window tkwin, int maxBytes));
  183. #ifndef TkSelUpdateClipboard
  184. extern void        TkSelUpdateClipboard _ANSI_ARGS_((TkWindow *winPtr,
  185.                 TkClipboardTarget *targetPtr));
  186. #endif
  187. #endif /* _TKSELECT */
  188.