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 #ifndef _XmDropSMgrP_h
25 #define _XmDropSMgrP_h
26 
27 #include <Xm/XmP.h>
28 #include <Xm/DropSMgr.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 typedef void (*XmDSMCreateInfoProc)
35 	(XmDropSiteManagerObject, Widget, ArgList, Cardinal);
36 typedef void (*XmDSMDestroyInfoProc)
37 	(XmDropSiteManagerObject, Widget);
38 typedef void (*XmDSMStartUpdateProc)
39 	(XmDropSiteManagerObject, Widget);
40 typedef void (*XmDSMRetrieveInfoProc)
41 	(XmDropSiteManagerObject, Widget, ArgList, Cardinal);
42 typedef void (*XmDSMUpdateInfoProc)
43 	(XmDropSiteManagerObject, Widget, ArgList, Cardinal);
44 typedef void (*XmDSMEndUpdateProc)
45 	(XmDropSiteManagerObject, Widget);
46 typedef void (*XmDSMUpdateProc)
47 	(XmDropSiteManagerObject, XtPointer, XtPointer);
48 typedef void (*XmDSMProcessMotionProc)
49 	(XmDropSiteManagerObject, XtPointer, XtPointer);
50 typedef void (*XmDSMProcessDropProc)
51 	(XmDropSiteManagerObject, XtPointer, XtPointer);
52 typedef void (*XmDSMOperationChangedProc)
53 	(XmDropSiteManagerObject, XtPointer, XtPointer);
54 typedef void (*XmDSMChangeRootProc)
55 	(XmDropSiteManagerObject, XtPointer, XtPointer);
56 typedef void (*XmDSMInsertInfoProc)
57 	(XmDropSiteManagerObject, XtPointer, XtPointer);
58 typedef void (*XmDSMRemoveInfoProc)
59 	(XmDropSiteManagerObject, XtPointer);
60 typedef void (*XmDSMSyncTreeProc)
61 	(XmDropSiteManagerObject, Widget);
62 typedef int  (*XmDSMGetTreeFromDSMProc)
63 	(XmDropSiteManagerObject, Widget, XtPointer);
64 typedef void (*XmDSMCreateDSInfoTable)
65 	(XmDropSiteManagerObject);
66 typedef void (*XmDSMDestroyDSInfoTable)
67 	(XmDropSiteManagerObject);
68 typedef void (*XmDSMRegisterInfoProc)
69 	(XmDropSiteManagerObject, Widget, XtPointer);
70 typedef XtPointer (*XmDSMWidgetToInfoProc)
71 	(XmDropSiteManagerObject, Widget);
72 typedef void (*XmDSMUnregisterInfoProc)
73 	(XmDropSiteManagerObject, XtPointer);
74 
75 typedef struct {
76     XmDSMCreateInfoProc		createInfo;
77     XmDSMDestroyInfoProc	destroyInfo;
78     XmDSMStartUpdateProc	startUpdate;
79     XmDSMRetrieveInfoProc	retrieveInfo;
80     XmDSMUpdateInfoProc		updateInfo;
81     XmDSMEndUpdateProc		endUpdate;
82 
83     /* Used by DragController Object */
84 
85     XmDSMUpdateProc		updateDSM;
86 
87     /* Used by update proc */
88 
89     XmDSMProcessMotionProc	processMotion;
90     XmDSMProcessDropProc	processDrop;
91     XmDSMOperationChangedProc	operationChanged;
92     XmDSMChangeRootProc		changeRoot;
93 
94     /* Used to manage DropSites */
95 
96     XmDSMInsertInfoProc		insertInfo;
97     /* Need a get and a put function for update? */
98     XmDSMRemoveInfoProc		removeInfo;
99 
100 	/* Used to manage the pre-register information */
101 
102     XmDSMSyncTreeProc		syncTree;
103     XmDSMGetTreeFromDSMProc	getTreeFromDSM;
104 
105     /* Used to hash between widgets and info */
106 
107     XmDSMCreateDSInfoTable	createTable;
108     XmDSMDestroyDSInfoTable 	destroyTable;
109     XmDSMRegisterInfoProc	registerInfo;
110     XmDSMWidgetToInfoProc	widgetToInfo;
111     XmDSMUnregisterInfoProc 	unregisterInfo;
112 
113     XtPointer			extension;
114 } XmDropSiteManagerClassPart;
115 
116 /*  Full class record declaration for dropSite class  */
117 
118 typedef struct _XmDropSiteManagerClassRec{
119     ObjectClassPart		object_class;
120     XmDropSiteManagerClassPart		dropManager_class;
121 } XmDropSiteManagerClassRec;
122 
123 externalref XmDropSiteManagerClassRec 	xmDropSiteManagerClassRec;
124 
125 /* Macros for calling methods */
126 
127 #define DSMCreateInfo(dsm, widget, args, numArgs) \
128 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
129 		dropManager_class.createInfo) \
130 		((dsm), (widget), (args), (numArgs))
131 
132 #define DSMDestroyInfo(dsm, widget) \
133 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
134 		dropManager_class.destroyInfo) \
135 		((dsm), (widget))
136 
137 #define DSMStartUpdate(dsm, widget) \
138 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
139 		dropManager_class.startUpdate) \
140 		((dsm), (widget))
141 
142 #define DSMRetrieveInfo(dsm, widget, args, numArgs) \
143 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
144 		dropManager_class.retrieveInfo) \
145 		((dsm), (widget), (args), (numArgs))
146 
147 #define DSMUpdateInfo(dsm, widget, args, numArgs) \
148 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
149 		dropManager_class.updateInfo) \
150 		((dsm), (widget), (args), (numArgs))
151 
152 #define DSMEndUpdate(dsm, widget) \
153 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
154 		dropManager_class.endUpdate) \
155 		((dsm), (widget))
156 
157 #define DSMUpdate(dsm, clientData, callData) \
158 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
159 		dropManager_class.updateDSM) \
160 		((dsm), (clientData), (callData))
161 
162 #define DSMProcessMotion(dsm, clientData, callData) \
163 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
164 		dropManager_class.processMotion) \
165 		((dsm), (clientData), (callData))
166 
167 #define DSMProcessDrop(dsm, clientData, callData) \
168 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
169 		dropManager_class.processDrop) \
170 		((dsm),(clientData), (callData))
171 
172 #define DSMOperationChanged(dsm, clientData, callData) \
173 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
174 		dropManager_class.operationChanged) \
175 		((dsm),(clientData), (callData))
176 
177 #define DSMChangeRoot(dsm, clientData, callData) \
178 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
179 		dropManager_class.changeRoot) \
180 		((dsm), (clientData), (callData))
181 
182 #define DSMInsertInfo(dsm, info, call_data) \
183 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
184 		dropManager_class.insertInfo) \
185 		((dsm), (info), (call_data))
186 
187 #define DSMRemoveInfo(dsm, info) \
188 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
189 		dropManager_class.removeInfo) \
190 		((dsm), (info))
191 
192 #define DSMSyncTree(dsm, shell) \
193 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
194 		dropManager_class.syncTree) \
195 		((dsm), (shell))
196 
197 #define DSMGetTreeFromDSM(dsm, shell, dataPtr) \
198 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
199 		dropManager_class.getTreeFromDSM) \
200 		((dsm), (shell), (dataPtr))
201 
202 #define DSMCreateTable(dsm) \
203 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
204 		dropManager_class.createTable) \
205 		((dsm))
206 
207 #define DSMDestroyTable(dsm) \
208 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
209 		dropManager_class.destroyTable) \
210 		((dsm))
211 
212 #define DSMRegisterInfo(dsm, widget, info) \
213 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
214 		dropManager_class.registerInfo) \
215 		((dsm), (widget), (info))
216 
217 #define DSMWidgetToInfo(dsm, widget) \
218 	(XtPointer) ((((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
219 		dropManager_class.widgetToInfo) \
220 		((dsm), (widget)))
221 
222 #define DSMUnregisterInfo(dsm, info) \
223 	(((XmDropSiteManagerObjectClass) XtClass(dsm))-> \
224 		dropManager_class.unregisterInfo) \
225 		  ((dsm), (info))
226 
227 /* Internal update struct */
228 
229 typedef struct __XmDropSiteUpdateInfoRec {
230   XmDropSiteManagerObject		dsm;
231   Widget				refWidget;
232   struct __XmDropSiteUpdateInfoRec	*next;
233 } _XmDropSiteUpdateInfoRec, *_XmDropSiteUpdateInfo;
234 
235 /* DropSiteManager instance record */
236 
237 typedef struct _XmDropSiteManagerPart{
238     XtCallbackProc	notifyProc;
239     XtCallbackProc	treeUpdateProc;
240     XtPointer		client_data;
241     XtPointer		dragUnderData;
242     XtPointer		curInfo;
243     Time		curTime;
244     Position		curX, curY, oldX, oldY;
245     unsigned char	curDropSiteStatus;
246     Widget		curDragContext;
247     Boolean		curAnimate;
248     unsigned char	curOperations;
249     unsigned char	curOperation;
250     XmRegion		curAncestorClipRegion;
251     XmRegion		newAncestorClipRegion;
252     XtPointer		dsTable;
253     XtPointer		dsRoot;
254     Position		rootX, rootY;
255     Dimension		rootW, rootH;
256     XtPointer		clipperList;
257     _XmDropSiteUpdateInfo	updateInfo;
258     XtIntervalId	updateTimeOutId;
259 } XmDropSiteManagerPart, *XmDropSiteManagerPartPtr;
260 
261 /* Full instance record declaration */
262 
263 typedef struct _XmDropSiteManagerRec{
264     ObjectPart			object;
265     XmDropSiteManagerPart	dropManager;
266 } XmDropSiteManagerRec;
267 
268 #ifdef __cplusplus
269 }  /* Close scope of 'extern "C"' declaration which encloses file. */
270 #endif
271 
272 #endif /* _XmDropSMgrP_h */
273