author | Claus Gittinger <cg@exept.de> |
Tue, 14 May 2019 09:46:14 +0200 | |
changeset 4263 | d349fa8d2945 |
parent 4131 | 8ad89f6c14a4 |
permissions | -rw-r--r-- |
4126 | 1 |
"{ Encoding: utf8 }" |
2 |
||
873 | 3 |
" |
4 |
COPYRIGHT (c) 1998 by eXept Software AG / Claus Gittinger |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
1397 | 14 |
"{ Package: 'stx:libview2' }" |
15 |
||
4126 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
873 | 18 |
Object subclass:#DropContext |
19 |
instanceVariableNames:'dropObjects rootPoint dropSource sourceWidget dropTarget |
|
2627
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
20 |
targetWidget targetId hasDropped dragHandler manager dropInfo |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
21 |
dragType' |
873 | 22 |
classVariableNames:'' |
23 |
poolDictionaries:'' |
|
24 |
category:'Interface-DragAndDrop' |
|
25 |
! |
|
26 |
||
2627
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
27 |
Object subclass:#DragType |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
28 |
instanceVariableNames:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
29 |
classVariableNames:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
30 |
poolDictionaries:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
31 |
privateIn:DropContext |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
32 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
33 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
34 |
DropContext::DragType subclass:#DragTypeCopy |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
35 |
instanceVariableNames:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
36 |
classVariableNames:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
37 |
poolDictionaries:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
38 |
privateIn:DropContext |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
39 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
40 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
41 |
DropContext::DragType subclass:#DragTypeLink |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
42 |
instanceVariableNames:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
43 |
classVariableNames:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
44 |
poolDictionaries:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
45 |
privateIn:DropContext |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
46 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
47 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
48 |
DropContext::DragType subclass:#DragTypeMove |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
49 |
instanceVariableNames:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
50 |
classVariableNames:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
51 |
poolDictionaries:'' |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
52 |
privateIn:DropContext |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
53 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
54 |
|
873 | 55 |
!DropContext class methodsFor:'documentation'! |
56 |
||
57 |
copyright |
|
58 |
" |
|
59 |
COPYRIGHT (c) 1998 by eXept Software AG / Claus Gittinger |
|
60 |
All Rights Reserved |
|
61 |
||
62 |
This software is furnished under a license and may be used |
|
63 |
only in accordance with the terms of that license and with the |
|
64 |
inclusion of the above copyright notice. This software may not |
|
65 |
be provided or otherwise made available to, or used by, any |
|
66 |
other person. No title to or ownership of the software is |
|
67 |
hereby transferred. |
|
68 |
" |
|
69 |
||
70 |
! |
|
71 |
||
72 |
documentation |
|
73 |
" |
|
74 |
instance, which keeps information about the current drag & drop operation. |
|
75 |
||
76 |
dropObjects <Collection> collection of dropObjects. |
|
77 |
rootPoint <Point> the current mouse position on the screen (root view). |
|
78 |
||
79 |
[see also:] |
|
80 |
DragAndDropManager |
|
81 |
DropObject |
|
82 |
DropSource |
|
83 |
DropTarget |
|
84 |
||
85 |
[author:] |
|
86 |
Claus Atzkern |
|
87 |
" |
|
88 |
! ! |
|
89 |
||
2627
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
90 |
!DropContext class methodsFor:'constants'! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
91 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
92 |
dragTypeCopy |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
93 |
^ DragTypeCopy |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
94 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
95 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
96 |
dragTypeDefault |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
97 |
^ DragTypeMove |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
98 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
99 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
100 |
dragTypeLink |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
101 |
^ DragTypeLink |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
102 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
103 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
104 |
dragTypeMove |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
105 |
^ DragTypeMove |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
106 |
! ! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
107 |
|
873 | 108 |
!DropContext methodsFor:'accessing'! |
109 |
||
1161
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
110 |
dragHandler |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
111 |
^ dragHandler |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
112 |
|
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
113 |
! |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
114 |
|
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
115 |
dragHandler:aHandler |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
116 |
dragHandler := aHandler |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
117 |
! |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
118 |
|
2627
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
119 |
dragType |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
120 |
"the type of drag - modified by pressing one of Shift, Ctrl or Alt" |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
121 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
122 |
^ dragType ? DragTypeMove |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
123 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
124 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
125 |
dragType:aSymbol |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
126 |
"the type of drag - modified by pressing one of Shift, Ctrl or Alt" |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
127 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
128 |
dragType := aSymbol |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
129 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
130 |
|
1662 | 131 |
dropInfo |
132 |
"a hook for additional info" |
|
133 |
||
134 |
dropInfo isNil ifTrue:[ |
|
135 |
dropInfo := IdentityDictionary new |
|
136 |
]. |
|
137 |
^ dropInfo |
|
138 |
! |
|
139 |
||
873 | 140 |
dropObjects |
1824 | 141 |
"returns the collection of dropobjects" |
142 |
||
873 | 143 |
^ dropObjects ? #() |
144 |
! |
|
145 |
||
1618 | 146 |
manager:something |
147 |
manager := something. |
|
148 |
! |
|
149 |
||
873 | 150 |
rootPoint |
1824 | 151 |
"returns the absolute point on the screen (rootPoint)" |
152 |
||
873 | 153 |
^ rootPoint |
154 |
! ! |
|
155 |
||
1397 | 156 |
!DropContext methodsFor:'accessing-source'! |
873 | 157 |
|
158 |
dropSource |
|
1824 | 159 |
"returns the drop source or nil" |
160 |
||
873 | 161 |
^ dropSource |
162 |
! |
|
163 |
||
164 |
sourceWidget |
|
1824 | 165 |
"returns the source widget the drag is started from" |
166 |
||
873 | 167 |
^ sourceWidget |
168 |
! ! |
|
169 |
||
1397 | 170 |
!DropContext methodsFor:'accessing-target'! |
873 | 171 |
|
172 |
dropTarget |
|
1824 | 173 |
"returns the drop target or nil" |
174 |
||
873 | 175 |
^ dropTarget |
176 |
! |
|
177 |
||
178 |
targetId |
|
1824 | 179 |
"returns the id of the target widget" |
180 |
||
873 | 181 |
^ targetId |
182 |
! |
|
183 |
||
184 |
targetPoint |
|
4131 | 185 |
"returns the point on the target widget (in LOGICAL coordinates)" |
1824 | 186 |
|
2444
3d985b31faf2
targetPoitn was computed wrong for textViews (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
187 |
|trn org pnt dev| |
873 | 188 |
|
2564 | 189 |
rootPoint isNil ifTrue:[^ nil]. |
190 |
||
873 | 191 |
dev := sourceWidget device. |
1430
572d486a52b8
use rootWindowId (save a message send)
Claus Gittinger <cg@exept.de>
parents:
1397
diff
changeset
|
192 |
pnt := dev translatePoint:rootPoint from:(dev rootWindowId) to:targetId. |
873 | 193 |
|
4131 | 194 |
"/ aha: the comment which was previously above was WRONG!! |
195 |
"/ the targetPoint is in LOGICAL coordinates NOT in device coordinates |
|
196 |
||
197 |
(pnt notNil and:[targetWidget notNil]) ifTrue:[ |
|
873 | 198 |
(trn := targetWidget transformation) notNil ifTrue:[ |
2444
3d985b31faf2
targetPoitn was computed wrong for textViews (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
199 |
^ trn applyInverseTo:pnt. |
3d985b31faf2
targetPoitn was computed wrong for textViews (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
200 |
]. |
4131 | 201 |
(org := targetWidget viewOrigin) notNil ifTrue:[ |
202 |
^ pnt + org. |
|
203 |
]. |
|
873 | 204 |
]. |
4130 | 205 |
"/ Transcript show:'targetPnt: '; showCR:pnt. |
873 | 206 |
^ pnt |
4126 | 207 |
|
4131 | 208 |
"Modified (comment): / 15-06-2018 / 02:31:35 / Claus Gittinger" |
209 |
! |
|
210 |
||
211 |
targetPointInDeviceCoordinates |
|
212 |
"returns the point on the target widget (in DEVICE coordinates)" |
|
213 |
||
214 |
|pnt dev| |
|
215 |
||
216 |
rootPoint isNil ifTrue:[^ nil]. |
|
217 |
||
218 |
dev := sourceWidget device. |
|
219 |
pnt := dev translatePoint:rootPoint from:(dev rootWindowId) to:targetId. |
|
220 |
||
221 |
^ pnt |
|
222 |
||
223 |
"Created: / 15-06-2018 / 02:22:12 / Claus Gittinger" |
|
873 | 224 |
! |
225 |
||
226 |
targetWidget |
|
1824 | 227 |
"returns the widget assigned to the current dropTarget" |
228 |
||
873 | 229 |
^ targetWidget |
230 |
! ! |
|
231 |
||
232 |
!DropContext methodsFor:'actions'! |
|
233 |
||
234 |
doDrop |
|
1824 | 235 |
"evaluate the drop operation; set the feedBack" |
236 |
||
873 | 237 |
hasDropped := self canDrop. |
238 |
||
239 |
self isAlienView ifFalse:[ |
|
240 |
hasDropped ifTrue:[ |
|
241 |
dropTarget drop:self |
|
242 |
] ifFalse:[ |
|
243 |
"/ |
|
244 |
"/ called to restore the widget in |
|
245 |
"/ case that something has changed |
|
246 |
"/ |
|
247 |
dropTarget notNil ifTrue:[ |
|
248 |
dropTarget leave:self |
|
249 |
] |
|
250 |
] |
|
251 |
] ifTrue:[ |
|
252 |
"/ |
|
253 |
"/ not one of my views |
|
254 |
"/ external clipboard mechanism via display |
|
255 |
"/ |
|
256 |
"/ ?? FEEDBACK ?? hasDropped ?? |
|
257 |
"/ |
|
1732
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
258 |
sourceWidget device |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
259 |
drop:dropObjects |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
260 |
inWindowID:targetId |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
261 |
position:(self targetPoint) |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
262 |
rootPosition:rootPoint. |
873 | 263 |
]. |
264 |
||
265 |
dropSource notNil ifTrue:[ |
|
1732
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
266 |
hasDropped ifTrue:[ "/ could have been cleared in drop-code |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
267 |
dropSource dropFeedBackFrom:self |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
268 |
] |
873 | 269 |
]. |
1618 | 270 |
! |
271 |
||
2091 | 272 |
exchangeDragHandler:aHandler |
273 |
"make the new handler to the active handler" |
|
274 |
||
275 |
(aHandler notNil and:[ aHandler ~~ dragHandler ]) ifTrue:[ |
|
2014 | 276 |
dragHandler postDragging. |
277 |
dragHandler := aHandler. |
|
278 |
manager dragHandler:dragHandler. |
|
279 |
]. |
|
280 |
! |
|
281 |
||
1662 | 282 |
passiveAction:aBlock |
283 |
manager passiveAction:aBlock |
|
284 |
! |
|
285 |
||
1618 | 286 |
saveDraw:aBlock |
287 |
"evaluate aBlock with the drag temporarily being undrawn |
|
288 |
(i.e. restore original picture, evaluate the block, and draw dragged objects again). |
|
289 |
Return blocks value." |
|
290 |
||
291 |
^ manager saveDraw:aBlock |
|
873 | 292 |
! ! |
293 |
||
1161
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
294 |
!DropContext methodsFor:'change & update'! |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
295 |
|
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
296 |
contentsWillChange |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
297 |
"called by the dropTarget-widget if the contents will change during a |
1824 | 298 |
dragAndDrop operation" |
299 |
||
1161
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
300 |
dragHandler notNil ifTrue:[ |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
301 |
dragHandler dropTargetWillChange |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
302 |
] |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
303 |
! ! |
1b0ae7be8de6
keep reference to DragHandler
Claus Gittinger <cg@exept.de>
parents:
873
diff
changeset
|
304 |
|
873 | 305 |
!DropContext methodsFor:'drag & drop manager interface'! |
306 |
||
307 |
dropObjects:something |
|
1824 | 308 |
"set the collection of dropobjects" |
309 |
||
873 | 310 |
something notNil ifTrue:[ |
311 |
dropObjects := something isCollection ifTrue:[something] |
|
312 |
ifFalse:[Array with:something] |
|
313 |
] |
|
314 |
! |
|
315 |
||
316 |
dropSource:aDropSource |
|
1824 | 317 |
"set the dropSource" |
318 |
||
873 | 319 |
dropSource := aDropSource. |
320 |
! |
|
321 |
||
322 |
dropTarget:aDropTargetOrNil |
|
1824 | 323 |
"set a new drop target" |
324 |
||
873 | 325 |
dropTarget := aDropTargetOrNil. |
326 |
! |
|
327 |
||
328 |
rootPoint:something |
|
1824 | 329 |
"set the absolute point on the screen (rootPoint); |
330 |
called by the drag and drop manager" |
|
331 |
||
873 | 332 |
rootPoint := something. |
333 |
! |
|
334 |
||
335 |
sourceWidget:aView |
|
1824 | 336 |
"set the source widget the drag is started from" |
337 |
||
873 | 338 |
sourceWidget := aView. |
339 |
! |
|
340 |
||
341 |
targetWidget:aViewOrNil id:anId |
|
1824 | 342 |
"set a new drop widget" |
343 |
||
873 | 344 |
targetWidget := aViewOrNil. |
345 |
targetId := anId. |
|
346 |
! ! |
|
347 |
||
348 |
!DropContext methodsFor:'queries'! |
|
349 |
||
350 |
canDrop |
|
2260 | 351 |
"returns true if the current dropTarget can drop the objects" |
1824 | 352 |
|
2260 | 353 |
^ dropTarget notNil and:[dropTarget canDrop:self] |
354 |
||
355 |
"Modified: / 13-10-2006 / 15:48:02 / cg" |
|
873 | 356 |
! |
357 |
||
1732
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
358 |
clearHasDroppedFlagToSuppressFeedBack |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
359 |
"can be used from within a targets drop code, |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
360 |
to signal that no feedBack should be send to the |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
361 |
dropSource (because the drop did not happen)" |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
362 |
|
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
363 |
hasDropped := false |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
364 |
! |
d31fef80f6e5
feedBackSelector -> dropFeedBackSelector
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
365 |
|
873 | 366 |
hasDropped |
367 |
^ hasDropped ? false |
|
368 |
! |
|
369 |
||
370 |
isAlienView |
|
1824 | 371 |
"returns true if current dropTarget is not an ST/X view" |
372 |
||
873 | 373 |
^ targetWidget isNil |
374 |
! |
|
375 |
||
376 |
isRootView |
|
1824 | 377 |
"returns true if the current target widget is the root view (screen)" |
378 |
||
2000 | 379 |
^ targetWidget isNil |
380 |
ifTrue:[false] |
|
381 |
ifFalse:[targetWidget isRootView] |
|
873 | 382 |
! ! |
383 |
||
2627
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
384 |
!DropContext::DragType class methodsFor:'testing'! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
385 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
386 |
isDragTypeCopy |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
387 |
^ false |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
388 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
389 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
390 |
isDragTypeLink |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
391 |
^ false |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
392 |
! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
393 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
394 |
isDragTypeMove |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
395 |
^ false |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
396 |
! ! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
397 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
398 |
!DropContext::DragTypeCopy class methodsFor:'testing'! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
399 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
400 |
isDragTypeCopy |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
401 |
^ true |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
402 |
! ! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
403 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
404 |
!DropContext::DragTypeLink class methodsFor:'testing'! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
405 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
406 |
isDragTypeLink |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
407 |
^ true |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
408 |
! ! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
409 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
410 |
!DropContext::DragTypeMove class methodsFor:'testing'! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
411 |
|
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
412 |
isDragTypeMove |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
413 |
^ true |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
414 |
! ! |
9f78995f7a33
change back the cursor, when escaping;
Claus Gittinger <cg@exept.de>
parents:
2564
diff
changeset
|
415 |
|
873 | 416 |
!DropContext class methodsFor:'documentation'! |
417 |
||
418 |
version |
|
4126 | 419 |
^ '$Header$' |
4130 | 420 |
! |
421 |
||
422 |
version_CVS |
|
423 |
^ '$Header$' |
|
873 | 424 |
! ! |
4126 | 425 |