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