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 #ifndef _XmDragCI_h
24 #define _XmDragCI_h
25 
26 #include <Xm/XmP.h>
27 #include <Xm/DragCP.h>
28 #include <Xm/DragIconP.h>
29 #include <Xm/DropSMgrP.h>
30 #include <Xm/DisplayP.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #define _XmDragStart(dc, srcW, event) \
37   ((*((XmDragContextClass)XtClass(dc))->drag_class.start) (dc, srcW, event))
38 
39 #define _XmDragCancel(dc) \
40   ((*((XmDragContextClass)XtClass(dc))->drag_class.cancel) (dc))
41 
42 #define _XmDCtoDD(dc)	((XmDisplay)XtParent(dc))
43 
44 #define _XmDRAG_MASK_BASE \
45 	(ButtonPressMask | ButtonReleaseMask | ButtonMotionMask)
46 #ifdef DRAG_USE_MOTION_HINTS
47 #define _XmDRAG_GRAB_MASK \
48 	(_XmDRAG_MASK_BASE PointerMotionHintMask)
49 #else
50 #define _XmDRAG_GRAB_MASK _XmDRAG_MASK_BASE
51 #endif /* _XmDRAG_USE_MOTION_HINTS */
52 
53 #define _XmDRAG_EVENT_MASK(dc) \
54   ((((XmDragContext)dc)->drag.trackingMode == XmDRAG_TRACK_WM_QUERY) \
55    ? (_XmDRAG_GRAB_MASK | EnterWindowMask | LeaveWindowMask) \
56    : (_XmDRAG_GRAB_MASK))
57 
58 enum{	XmCR_DROP_SITE_TREE_ADD = _XmNUMBER_DND_CB_REASONS,
59 	XmCR_DROP_SITE_TREE_REMOVE
60 	} ;
61 /*
62  *  values for dragTrackingMode
63  */
64 enum {
65   XmDRAG_TRACK_WM_QUERY, XmDRAG_TRACK_MOTION, XmDRAG_TRACK_WM_QUERY_PENDING
66 };
67 
68 
69 /* Strings to use for the intern atoms */
70 typedef String	XmCanonicalString;
71 
72 #define XmMakeCanonicalString( s) \
73 	(XmCanonicalString) XrmQuarkToString(XrmStringToQuark(s))
74 
75 #define _XmAllocAndCopy( data, len) \
76 	memcpy((XtPointer) XtMalloc(len), (XtPointer)(data), (len))
77 
78 
79 typedef struct _XmDragTopLevelClientDataStruct{
80     Widget	destShell;
81     Position	xOrigin, yOrigin;
82 	Dimension	width, height;
83     XtPointer	iccInfo;
84     Boolean	sourceIsExternal;
85 	Window	window;
86 	Widget	dragOver;
87 } XmDragTopLevelClientDataStruct, *XmDragTopLevelClientData;
88 
89 typedef struct _XmDragMotionClientDataStruct{
90     Window	window;
91     Widget	dragOver;
92 } XmDragMotionClientDataStruct, *XmDragMotionClientData;
93 
94 
95 /*
96  * dsm to dragDisplay comm
97  */
98 /* Move to DropSMgrI.h */
99 typedef struct _XmDropSiteTreeAddCallbackStruct{
100     int		    	reason;
101     XEvent          	*event;
102     Widget		rootShell;
103     Cardinal		numDropSites;
104     Cardinal		numArgsPerDSHint;
105 } XmDropSiteTreeAddCallbackStruct, *XmDropSiteTreeAddCallback;
106 
107 /* Move to DropSMgrI.h */
108 typedef struct _XmDropSiteTreeRemoveCallbackStruct{
109     int			reason;
110     XEvent          	*event;
111     Widget		rootShell;
112 } XmDropSiteTreeRemoveCallbackStruct, *XmDropSiteTreeRemoveCallback;
113 
114 /* Move to DropSMgrI.h */
115 typedef struct _XmDropSiteTreeUpdateCallbackStruct{
116     int			reason;
117     XEvent          	*event;
118     Widget		rootShell;
119     Cardinal		numDropSites;
120     Cardinal		numArgsPerDSHint;
121 } XmDropSiteTreeUpdateCallbackStruct, *XmDropSiteTreeUpdateCallback;
122 
123 typedef struct _XmDropSiteEnterPendingCallbackStruct{
124     int                 reason;
125     XEvent              *event;
126     Time                timeStamp;
127     Boolean		enter_pending;
128 } XmDropSiteEnterPendingCallbackStruct, *XmDropSiteEnterPendingCallback;
129 
130 /* Move to DropSMgrI.h */
131 typedef struct _XmAnimationData {
132     Widget		dragOver;
133     Window		window;
134     Position		windowX, windowY;
135     Screen		*screen;
136     XmRegion		clipRegion;
137     XmRegion		dropSiteRegion;
138     XtPointer		saveAddr;
139 } XmAnimationDataRec, *XmAnimationData;
140 
141 
142 /********    Private Function Declarations    ********/
143 
144 extern XmDragReceiverInfo _XmAllocReceiverInfo(
145                         XmDragContext dc) ;
146 extern unsigned char _XmGetActiveProtocolStyle(
147                         Widget w) ;
148 
149 /********    End Private Function Declarations    ********/
150 
151 
152 #ifdef __cplusplus
153 }  /* Close scope of 'extern "C"' declaration which encloses file. */
154 #endif
155 
156 #endif /* _XmDragCI_h */
157