1 /*
2  * Motif
3  *
4  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*
24  * HISTORY
25  */
26 /* $XConsortium: TransferI.h /main/6 1996/10/16 16:57:37 drk $ */
27 #ifndef _XmTransferI_H
28 #define _XmTransferI_H
29 
30 #include <Xm/TransferT.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /****************************************************************/
37 /* Structure which is stored for each transfer request.  This   */
38 /* is where XmTransferValue will keep the data for the internal */
39 /* wrapper. 							*/
40 /****************************************************************/
41 
42 #define TB_NONE		    0
43 #define TB_IGNORE	    1
44 #define TB_INTERNAL   	    2
45 
46 typedef struct {
47   XtPointer		next;
48   XtPointer		client_data;
49   XtPointer		location_data;
50   int			flags;
51   Atom			target;
52   XtCallbackProc	selection_proc;
53 } TransferBlockRec, *TransferBlock;
54 
55 /****************************************************************/
56 /* This structure forms the context block for each transfer_id. */
57 /* These structures are chained to allow for multiple           */
58 /* concurrent outstanding data transfers.                       */
59 /****************************************************************/
60 
61 typedef struct {
62   XtPointer	next;
63   XtPointer	prev;
64   Widget	widget;
65   Atom		selection;
66   Atom		real_selection;
67   XtEnum	op;
68   int		count;
69   int		outstanding;
70   int		flags;
71   int		status;
72   Widget	drag_context;
73   Widget	drop_context;
74   XmSelectionFinishedProc	*doneProcs;
75   int		numDoneProcs;
76   XtCallbackProc		auto_proc;
77   XtPointer	client_data;
78   XmDestinationCallbackStruct	*callback_struct;
79   TransferBlock last;
80   TransferBlock requests;
81 } TransferContextRec, *TransferContext;
82 
83 enum{ TC_NONE = 0, TC_FLUSHED = 1, TC_CALLED_WIDGET = 2,
84       TC_CALLED_CALLBACKS = 4, TC_EXITED_DH = 8,
85       TC_DID_DELETE = 16, TC_IN_MULTIPLE = 32 };
86 
87 /****************************************************************/
88 /* The convertProc has a small context block which is           */
89 /* setup by the source calls and deleted in the loseProc        */
90 /****************************************************************/
91 
92 typedef struct {
93   long		op;	/* Make it big so it can hold a variety of data */
94   int		flags;
95   long		itemid;
96   XtPointer	location_data;
97   XtPointer	client_data;
98   Widget	drag_context;
99 } ConvertContextRec, *ConvertContext;
100 
101 enum{ CC_NONE = 0};
102 
103 /****************************************************************/
104 /* Need to keep a count of outstanding SNAPSHOT requests.       */
105 /****************************************************************/
106 
107 typedef struct {
108   long		outstanding;
109   Atom		distinguisher;
110 } SnapshotRequestRec, *SnapshotRequest;
111 
112 /* Internal functions */
113 
114 extern char * _XmTextToLocaleText(Widget, XtPointer, Atom, int,
115 				  unsigned long, Boolean *);
116 
117 extern void _XmConvertHandlerSetLocal(void);
118 
119 extern Boolean _XmConvertHandler(Widget wid, Atom *selection, Atom *target,
120 			  Atom *type, XtPointer *value,
121 			  unsigned long *size, int *fmt);
122 
123 extern Boolean _XmDestinationHandler(Widget wid, Atom selection, XtEnum op,
124 			      XmSelectionFinishedProc done_proc,
125 			      XtPointer location_data, Time time,
126 			      XSelectionRequestEvent *event);
127 
128 extern void _XmConvertComplete(Widget wid, XtPointer value,
129 			unsigned long size, int format, Atom type,
130 			XmConvertCallbackStruct *cs);
131 
132 extern XmDestinationCallbackStruct
133        *_XmTransferGetDestinationCBStruct(XtPointer);
134 
135 #ifdef __cplusplus
136 }  /* Close scope of 'extern "C"' declaration which encloses file. */
137 #endif
138 
139 #endif /* _XmTransferI_H */
140 
141