author | ca |
Sat, 18 Jan 2003 15:28:36 +0100 | |
changeset 1685 | 82350f572e2f |
parent 1678 | 9944d3b5d5bf |
child 1686 | fe4a13681941 |
permissions | -rw-r--r-- |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
2 |
COPYRIGHT (c) 1996 by eXept Software AG / Claus Gittinger |
1166 | 3 |
All Rights Reserved |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
4 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
5 |
This software is furnished under a license and may be used |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
10 |
hereby transferred. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
11 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
12 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
13 |
|
1397 | 14 |
"{ Package: 'stx:libview2' }" |
15 |
||
341 | 16 |
Object subclass:#DragAndDropManager |
874 | 17 |
instanceVariableNames:'dropContext dragView dropAction dragOffset handler restoreBlock |
1661
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
18 |
alienCursor enabledCursor disabledCursor canDrop escapePressed |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
19 |
passiveAction' |
1511 | 20 |
classVariableNames:'DragContextQuerySignal DragOriginatorQuerySignal |
21 |
DragOffsetQuerySignal ActiveDragAndDropManagers' |
|
628 | 22 |
poolDictionaries:'' |
874 | 23 |
category:'Interface-DragAndDrop' |
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
24 |
! |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
25 |
|
341 | 26 |
!DragAndDropManager class methodsFor:'documentation'! |
27 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
28 |
copyright |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
29 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
30 |
COPYRIGHT (c) 1996 by eXept Software AG / Claus Gittinger |
1166 | 31 |
All Rights Reserved |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
32 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
33 |
This software is furnished under a license and may be used |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
34 |
only in accordance with the terms of that license and with the |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
35 |
inclusion of the above copyright notice. This software may not |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
36 |
be provided or otherwise made available to, or used by, any |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
37 |
other person. No title to or ownership of the software is |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
38 |
hereby transferred. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
39 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
40 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
41 |
! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
42 |
|
348 | 43 |
documentation |
44 |
" |
|
45 |
this class provides low-level drag & drop mechanisms. |
|
46 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
47 |
Easy to use interface interfaces: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
48 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
49 |
A drag is usually initiated by a view or its application model, |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
50 |
when a selection is moved (for example, SelectionInListView can |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
51 |
be initializd to do so). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
52 |
There, the view creates a collection of dropObjects from its selection, |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
53 |
and starts the drag operation with: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
54 |
|
1166 | 55 |
DragAndDropManager startDrag:collectionOfDragObjects from:aView. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
56 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
57 |
This easy to use interface starts a drag and also drops the collection |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
58 |
into the target view. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
59 |
While dragging, a thumbsUp cursor is shown, if the view-under-the-drag |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
60 |
can handle a drop, a thumbsDown is shown if not, and a question mark |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
61 |
is shown for alien views (which means: we dont know). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
62 |
Alien view drop is supported (but no 'canDrop' query). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
63 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
64 |
For rubber-band line dragging, two more easy-to-use startup methods are |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
65 |
provided: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
66 |
|
1166 | 67 |
DragAndDropManager |
68 |
startLineDragIn:aView at:position |
|
69 |
atEnd:aFourArgEndBlock |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
70 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
71 |
and: |
1166 | 72 |
DragAndDropManager |
73 |
startArrowDragIn:aView at:position |
|
74 |
atEnd:aFourArgEndBlock |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
75 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
76 |
both of the above expect a 4-arg block to be passed, which will be |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
77 |
evaluated at end-drag, with the target view, its viewID, the drop position |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
78 |
on the screen and within the target view as arguments. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
79 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
80 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
81 |
Expert interface: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
82 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
83 |
More control over the dragging (i.e. the drawing procedure) |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
84 |
can be optained, by passing a dragBlock and an endDrag action: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
85 |
|
1166 | 86 |
aDragAndDropMgr := DragAndDropManager new. |
87 |
aDragAndDropMgr dropObjects:(self collectionOfDragObjects). |
|
88 |
aDragAndDropMgr |
|
89 |
startOpaqueDrag:[:aPoint :aView :dropObjects | |
|
90 |
self |
|
91 |
showDragging:dropObjects |
|
92 |
in:aView |
|
93 |
at:aPoint - (xOffset@0) |
|
94 |
] |
|
95 |
offset:clickOffset |
|
96 |
extent:saveUnderExtent |
|
97 |
in:self |
|
98 |
at:clickPoint |
|
99 |
atEnd:[:v :vId :posScreen :posView | ... ] |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
100 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
101 |
the arguments are: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
102 |
startOpaqueDrag: |
1166 | 103 |
a 3-arg block, which is evaluated by the d&d manager whenever the |
104 |
mouse moves; it is supposed to draw the dropObjects at some position |
|
105 |
in the passed view. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
106 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
107 |
offset: |
1166 | 108 |
a clickOffset; drawing is offset by this amount |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
109 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
110 |
extent: |
1166 | 111 |
a save extent; the size of the screen area that must be saved during |
112 |
the drag operation |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
113 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
114 |
in: |
1166 | 115 |
initiating view |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
116 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
117 |
at: |
1166 | 118 |
position where d&d operation starts |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
119 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
120 |
atEnd: |
1166 | 121 |
a 4-arg block that is evaluated when the d&d is finished. |
122 |
It gets the target view (or nil, for alien views), the targets |
|
123 |
view ID (needed if its an alien view), the screen position and the |
|
124 |
relative position within the target view of the drop as arguments. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
125 |
|
1166 | 126 |
For internal (ST/X) views, the dropBlock should perform |
127 |
a simple canDrop:/doDrop message. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
128 |
|
1166 | 129 |
For alien views, the Displays d&d functions can be used. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
130 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
131 |
|
348 | 132 |
[author:] |
1166 | 133 |
Claus Gittinger |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
134 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
135 |
[see also:] |
1166 | 136 |
DemoView1, DemoView2, ... |
137 |
SelectionInListView FileBrowser - for a concrete example |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
138 |
|
348 | 139 |
" |
140 |
||
141 |
! |
|
142 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
143 |
examples |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
144 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
145 |
a button, which initiates dragging of a file-object |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
146 |
Notice that this can be dropped into the launchers panel, |
549 | 147 |
to open a fileBrowser on that directory ... |
1166 | 148 |
[exBegin] |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
149 |
|o top v| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
150 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
151 |
top := StandardSystemView new. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
152 |
v := Button label:'press for drag' in:top. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
153 |
v pressAction:[ |
1166 | 154 |
|o| |
155 |
o := DropObject newFile:('/etc'). |
|
156 |
DragAndDropManager startDrag:o from:v. |
|
157 |
v turnOff |
|
158 |
]. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
159 |
top openWithExtent:200@200 |
1166 | 160 |
[exEnd] |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
161 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
162 |
initiate a drag with some offset: |
1166 | 163 |
[exBegin] |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
164 |
|o top v| |
341 | 165 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
166 |
top := StandardSystemView new. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
167 |
v := Button label:'press for drag' in:top. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
168 |
v pressAction:[ |
1166 | 169 |
|o| |
170 |
o := DropObject newFile:('.'). |
|
171 |
DragAndDropManager startDrag:o from:v offset:10@10. |
|
172 |
v turnOff |
|
173 |
]. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
174 |
top openWithExtent:200@200 |
1166 | 175 |
[exEnd] |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
176 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
177 |
initiate a line drag: |
1166 | 178 |
[exBegin] |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
179 |
|o top v endAction| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
180 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
181 |
endAction := [ :v :vID :sPos :vPos | |
1166 | 182 |
Transcript show:'end drag in '. |
183 |
v isNil ifTrue:[ |
|
184 |
Transcript show:'alien view' |
|
185 |
] ifFalse:[ |
|
186 |
Transcript show:v |
|
187 |
]. |
|
188 |
Transcript show:' at screen: '; show:sPos; |
|
189 |
show:' in view: '; showCR:vPos |
|
190 |
]. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
191 |
top := StandardSystemView new. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
192 |
v := Button label:'press for drag' in:top. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
193 |
v pressAction:[ |
1166 | 194 |
DragAndDropManager |
195 |
startLineDragIn:v at:10@10 atEnd:endAction. |
|
196 |
v turnOff |
|
197 |
]. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
198 |
top openWithExtent:200@200 |
1166 | 199 |
[exEnd] |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
200 |
|
874 | 201 |
more drag & drop; offset, displayObjects, ... |
1166 | 202 |
[exBegin] |
874 | 203 |
|dropObj topView pannel icon buttonAction addButton| |
204 |
||
205 |
topView := StandardSystemView new. |
|
206 |
pannel := VerticalPanelView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0) in:topView. |
|
207 |
pannel horizontalLayout:#fit. |
|
208 |
pannel verticalLayout:#fitSpace. |
|
209 |
||
210 |
icon := Image fromFile:('xpmBitmaps/QUESTION3.xpm'). |
|
211 |
dropObj := DropObject newFile:('.'). |
|
212 |
||
213 |
addButton := [:offset :label :dispObj| |button| |
|
1166 | 214 |
button := Button label:label in:pannel. |
874 | 215 |
|
1166 | 216 |
button pressAction:[ |
217 |
DragAndDropManager startDrag:dropObj from:button offset:offset display:dispObj. |
|
218 |
button turnOff. |
|
219 |
] |
|
874 | 220 |
]. |
221 |
||
881 | 222 |
addButton value:(0@-5) value:'String' value:'String'. |
874 | 223 |
addButton value:#topLeft value:'String' value:'String'. |
224 |
addButton value:#topRight value:'Text' value:(Text string:'hello' emphasis:#bold). |
|
225 |
addButton value:#bottomLeft value:'Icon' value:icon. |
|
226 |
addButton value:#bottomRight value:'LabelAndIcon' value:(LabelAndIcon icon:icon string:'Label & Icon'). |
|
227 |
addButton value:#center value:'Mixed' value:(Array with:'String' with:icon). |
|
228 |
||
229 |
topView label:'Drag & Drop'. |
|
230 |
topView openWithExtent:200@200. |
|
1166 | 231 |
[exEnd] |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
232 |
" |
341 | 233 |
! ! |
234 |
||
628 | 235 |
!DragAndDropManager class methodsFor:'initialization'! |
236 |
||
237 |
initialize |
|
238 |
DragOriginatorQuerySignal := QuerySignal new. |
|
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
239 |
DragOffsetQuerySignal := QuerySignal new. |
1511 | 240 |
DragContextQuerySignal := QuerySignal new. |
1487 | 241 |
ActiveDragAndDropManagers := IdentityDictionary new. |
628 | 242 |
|
243 |
" |
|
244 |
self initialize |
|
245 |
" |
|
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
246 |
|
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
247 |
"Modified: 11.8.1997 / 00:54:21 / cg" |
1420 | 248 |
! ! |
249 |
||
250 |
!DragAndDropManager class methodsFor:'instance creation'! |
|
874 | 251 |
|
252 |
new |
|
253 |
^ self basicNew initialize |
|
628 | 254 |
! ! |
255 |
||
256 |
!DragAndDropManager class methodsFor:'Signal constants'! |
|
257 |
||
1511 | 258 |
dragContextQuerySignal |
259 |
^ DragContextQuerySignal |
|
260 |
! |
|
261 |
||
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
262 |
dragOffsetQuerySignal |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
263 |
^ DragOffsetQuerySignal |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
264 |
|
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
265 |
"Created: 11.8.1997 / 00:54:10 / cg" |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
266 |
! |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
267 |
|
628 | 268 |
dragOriginatorQuerySignal |
269 |
^ DragOriginatorQuerySignal |
|
270 |
! ! |
|
271 |
||
1487 | 272 |
!DragAndDropManager class methodsFor:'helpers'! |
273 |
||
274 |
saveDraw:aBlock device:aDevice |
|
275 |
|activeManager| |
|
276 |
||
277 |
activeManager := ActiveDragAndDropManagers at:aDevice ifAbsent:nil. |
|
278 |
activeManager isNil ifTrue:[ |
|
279 |
aBlock value |
|
280 |
] ifFalse:[ |
|
281 |
activeManager saveDraw:aBlock |
|
282 |
]. |
|
283 |
! ! |
|
284 |
||
285 |
!DragAndDropManager class methodsFor:'queries'! |
|
286 |
||
287 |
isDragAndDropActiveOnDevice:aDevice |
|
288 |
^ ActiveDragAndDropManagers includesKey:aDevice |
|
289 |
! ! |
|
290 |
||
874 | 291 |
!DragAndDropManager class methodsFor:'simple start - drop source'! |
292 |
||
293 |
startDragFrom:aView dropSource:aDropSource |
|
294 |
"start a drop at the current pointer position. |
|
295 |
" |
|
296 |
^ (self new) startDragFrom:aView dropSource:aDropSource |
|
297 |
! ! |
|
298 |
||
299 |
!DragAndDropManager class methodsFor:'simple start - generic'! |
|
300 |
||
301 |
startDrag:draggableObjects from:aView |
|
302 |
"start a drop at the current pointer position |
|
303 |
" |
|
304 |
^ self startDrag:draggableObjects |
|
1166 | 305 |
from:aView |
306 |
offset:0@0 |
|
307 |
atEnd:nil |
|
308 |
display:draggableObjects |
|
874 | 309 |
|
310 |
" |
|
311 |
EXAMPLE: |
|
312 |
||
313 |
|button| |
|
314 |
||
315 |
button := (Button label:'press me'). |
|
316 |
||
317 |
button pressAction:[ |
|
1166 | 318 |
DragAndDropManager startDrag:(DropObject newFile:('.')) from:button. |
319 |
button turnOff |
|
874 | 320 |
]. |
321 |
||
322 |
button openAt:100@100 |
|
323 |
" |
|
324 |
! |
|
325 |
||
326 |
startDrag:draggableObjects from:aView atEnd:aFourArgEndBlock |
|
327 |
"start a drop at the current pointer position |
|
328 |
When finished, the endAction is called with four args: |
|
329 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
330 |
the dropPoint in root-coordinates and the dropPoint within the targetView |
|
331 |
" |
|
332 |
^ self startDrag:draggableObjects |
|
1166 | 333 |
from:aView |
334 |
offset:0@0 |
|
335 |
atEnd:aFourArgEndBlock |
|
336 |
display:draggableObjects |
|
874 | 337 |
|
338 |
" |
|
339 |
EXAMPLE: |
|
340 |
||
341 |
|button| |
|
342 |
||
343 |
button := (Button label:'press me'). |
|
344 |
||
345 |
button pressAction:[ |
|
1166 | 346 |
DragAndDropManager startDrag:(DropObject newFile:('.')) |
347 |
from:button |
|
348 |
atEnd:[:targetView :targetViewId :screenPoint :targetPoint| |
|
349 |
Transcript showCR:'target view: ', targetView printString. |
|
350 |
Transcript showCR:'target id: ', targetViewId printString. |
|
351 |
Transcript showCR:'point screen: ', screenPoint printString. |
|
352 |
Transcript showCR:'point target: ', targetPoint printString. |
|
353 |
]. |
|
354 |
button turnOff |
|
874 | 355 |
]. |
356 |
||
357 |
button openAt:100@100 |
|
358 |
" |
|
359 |
||
360 |
! |
|
361 |
||
362 |
startDrag:draggableObjects from:aView atEnd:aFourArgEndBlock display:something |
|
363 |
"start a drop at the current pointer position |
|
364 |
When finished, the endAction is called with four args: |
|
365 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
366 |
the dropPoint in root-coordinates and the dropPoint within the targetView |
|
367 |
" |
|
368 |
^ self startDrag:draggableObjects |
|
1166 | 369 |
from:aView |
370 |
offset:0@0 |
|
371 |
atEnd:aFourArgEndBlock |
|
372 |
display:something |
|
874 | 373 |
|
374 |
" |
|
375 |
EXAMPLE: |
|
376 |
||
377 |
|button| |
|
378 |
||
379 |
button := (Button label:'press me'). |
|
380 |
||
381 |
button pressAction:[ |
|
1166 | 382 |
DragAndDropManager startDrag:(DropObject newFile:('.')) |
383 |
from:button |
|
384 |
atEnd:[:targetView :targetViewId :screenPoint :targetPoint| |
|
385 |
Transcript showCR:'target view: ', targetView printString. |
|
386 |
Transcript showCR:'target id: ', targetViewId printString. |
|
387 |
Transcript showCR:'point screen: ', screenPoint printString. |
|
388 |
Transcript showCR:'point target: ', targetPoint printString. |
|
389 |
] |
|
390 |
display:(Array with:'String' with:(Image fromFile:('xpmBitmaps/QUESTION3.xpm'))). |
|
391 |
button turnOff |
|
874 | 392 |
]. |
393 |
||
394 |
button openAt:100@100 |
|
395 |
" |
|
396 |
! |
|
397 |
||
398 |
startDrag:draggableObjects from:aView display:something |
|
399 |
"start a drop at the current pointer position |
|
400 |
" |
|
401 |
^ self startDrag:draggableObjects |
|
1166 | 402 |
from:aView |
403 |
offset:0@0 |
|
404 |
atEnd:nil |
|
405 |
display:something |
|
874 | 406 |
|
407 |
" |
|
408 |
EXAMPLE: |
|
409 |
||
410 |
|dropObj topView pannel icon buttonAction addButton| |
|
411 |
||
412 |
topView := StandardSystemView new. |
|
413 |
pannel := VerticalPanelView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0) in:topView. |
|
414 |
pannel horizontalLayout:#fit. |
|
415 |
pannel verticalLayout:#fitSpace. |
|
416 |
||
417 |
icon := Image fromFile:('xpmBitmaps/QUESTION3.xpm'). |
|
418 |
dropObj := DropObject newFile:('.'). |
|
419 |
||
420 |
addButton := [:label :dispObj| |button| |
|
1166 | 421 |
button := Button label:label in:pannel. |
874 | 422 |
|
1166 | 423 |
button pressAction:[ |
424 |
DragAndDropManager startDrag:dropObj from:button display:dispObj. |
|
425 |
button turnOff. |
|
426 |
] |
|
874 | 427 |
]. |
428 |
||
429 |
addButton value:'String' value:'String'. |
|
430 |
addButton value:'Text' value:(Text string:'hello' emphasis:#bold). |
|
431 |
addButton value:'Icon' value:icon. |
|
432 |
addButton value:'LabelAndIcon' value:(LabelAndIcon icon:icon string:'Label & Icon'). |
|
433 |
addButton value:'Mixed' value:(Array with:'String' with:icon). |
|
434 |
||
435 |
topView label:'Drag & Drop'. |
|
436 |
topView openWithExtent:200@200. |
|
437 |
" |
|
438 |
! |
|
439 |
||
440 |
startDrag:draggableObjects from:aView offset:anOffset |
|
441 |
"start a drop at the current pointer position |
|
442 |
" |
|
443 |
^ self startDrag:draggableObjects |
|
1166 | 444 |
from:aView |
445 |
offset:anOffset |
|
446 |
atEnd:nil |
|
447 |
display:draggableObjects |
|
874 | 448 |
|
449 |
" |
|
450 |
EXAMPLE: |
|
451 |
||
452 |
|button| |
|
453 |
||
454 |
button := (Button label:'press me'). |
|
455 |
||
456 |
button pressAction:[ |
|
1166 | 457 |
DragAndDropManager startDrag:(DropObject newFile:('.')) from:button offset:(-10 @ -10). |
458 |
button turnOff |
|
874 | 459 |
]. |
460 |
||
461 |
button openAt:100@100 |
|
462 |
" |
|
463 |
||
464 |
! |
|
465 |
||
466 |
startDrag:draggableObjects from:aView offset:anOffset atEnd:aFourArgEndBlock |
|
467 |
"start a drop at the current pointer position |
|
468 |
When finished, the endAction is called with four args: |
|
469 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
470 |
the dropPoint in root-coordinates and the dropPoint within the targetView |
|
471 |
" |
|
472 |
^ self startDrag:draggableObjects |
|
1166 | 473 |
from:aView |
474 |
offset:anOffset |
|
475 |
atEnd:aFourArgEndBlock |
|
476 |
display:draggableObjects |
|
874 | 477 |
|
478 |
" |
|
479 |
EXAMPLE: |
|
480 |
||
481 |
|button| |
|
482 |
||
483 |
button := (Button label:'press me'). |
|
484 |
||
485 |
button pressAction:[ |
|
1166 | 486 |
DragAndDropManager startDrag:(DropObject newFile:('.')) |
487 |
from:button |
|
488 |
offset:(-10 @ -10) |
|
489 |
atEnd:[:targetView :targetViewId :screenPoint :targetPoint| |
|
490 |
Transcript showCR:'target view: ', targetView printString. |
|
491 |
Transcript showCR:'target id: ', targetViewId printString. |
|
492 |
Transcript showCR:'point screen: ', screenPoint printString. |
|
493 |
Transcript showCR:'point target: ', targetPoint printString. |
|
494 |
]. |
|
495 |
button turnOff |
|
874 | 496 |
]. |
497 |
||
498 |
button openAt:100@100 |
|
499 |
" |
|
500 |
||
501 |
! |
|
502 |
||
503 |
startDrag:draggableObjects from:aView offset:anOffset atEnd:aFourArgEndBlock display:something |
|
504 |
"start a drop at the current pointer position |
|
505 |
When finished, the endAction is called with four args: |
|
506 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
507 |
the dropPoint in root-coordinates and the dropPoint within the targetView |
|
508 |
" |
|
509 |
|manager| |
|
510 |
||
511 |
manager := self new. |
|
512 |
||
513 |
manager startDrag:draggableObjects |
|
1166 | 514 |
from:aView |
515 |
offset:anOffset |
|
516 |
atEnd:aFourArgEndBlock |
|
517 |
display:something. |
|
874 | 518 |
|
519 |
^ manager |
|
520 |
||
521 |
" |
|
522 |
EXAMPLE: |
|
523 |
||
524 |
|button| |
|
525 |
||
526 |
button := (Button label:'press me'). |
|
527 |
||
528 |
button pressAction:[ |
|
1166 | 529 |
DragAndDropManager startDrag:(DropObject newFile:('.')) |
530 |
from:button |
|
531 |
offset:(-10 @ -10) |
|
532 |
atEnd:[:targetView :targetViewId :screenPoint :targetPoint| |
|
533 |
Transcript showCR:'target view: ', targetView printString. |
|
534 |
Transcript showCR:'target id: ', targetViewId printString. |
|
535 |
Transcript showCR:'point screen: ', screenPoint printString. |
|
536 |
Transcript showCR:'point target: ', targetPoint printString. |
|
537 |
] |
|
538 |
display:(Array with:'String' with:(Image fromFile:('xpmBitmaps/QUESTION3.xpm'))). |
|
539 |
button turnOff |
|
874 | 540 |
]. |
541 |
||
542 |
button openAt:100@100 |
|
543 |
" |
|
544 |
||
545 |
! |
|
546 |
||
547 |
startDrag:draggableObjects from:aView offset:anOffset display:something |
|
548 |
"start a drop at the current pointer position |
|
549 |
" |
|
550 |
^ self startDrag:draggableObjects |
|
1166 | 551 |
from:aView |
552 |
offset:anOffset |
|
553 |
atEnd:nil |
|
554 |
display:something |
|
874 | 555 |
|
556 |
" |
|
557 |
EXAMPLE: |
|
558 |
||
559 |
|dropObj topView pannel icon buttonAction addButton| |
|
560 |
||
561 |
topView := StandardSystemView new. |
|
562 |
pannel := VerticalPanelView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0) in:topView. |
|
563 |
pannel horizontalLayout:#fit. |
|
564 |
pannel verticalLayout:#fitSpace. |
|
565 |
||
566 |
icon := Image fromFile:('xpmBitmaps/QUESTION3.xpm'). |
|
567 |
dropObj := DropObject newFile:('.'). |
|
568 |
||
569 |
addButton := [:offset :label :dispObj| |button| |
|
1166 | 570 |
button := Button label:label in:pannel. |
874 | 571 |
|
1166 | 572 |
button pressAction:[ |
573 |
DragAndDropManager startDrag:dropObj from:button offset:offset display:dispObj. |
|
574 |
button turnOff. |
|
575 |
] |
|
874 | 576 |
]. |
577 |
||
578 |
addButton value:#topLeft value:'String' value:'String'. |
|
579 |
addButton value:#topRight value:'Text' value:(Text string:'hello' emphasis:#bold). |
|
580 |
addButton value:#bottomLeft value:'Icon' value:icon. |
|
581 |
addButton value:#bottomRight value:'LabelAndIcon' value:(LabelAndIcon icon:icon string:'Label & Icon'). |
|
582 |
addButton value:#center value:'Mixed' value:(Array with:'String' with:icon). |
|
583 |
||
584 |
topView label:'Drag & Drop'. |
|
585 |
topView openWithExtent:200@200. |
|
586 |
" |
|
587 |
||
588 |
! ! |
|
589 |
||
590 |
!DragAndDropManager class methodsFor:'simple start - lines'! |
|
397 | 591 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
592 |
startArrowDragIn:aView at:dragPoint atEnd:aFourArgBlock |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
593 |
"start a rubber-arrow-line dragging in aView at dragPoint. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
594 |
When finished, evaluate the fourArgBlock with targetView, |
874 | 595 |
targetID, screenPosition and targetViewPosition as arguments |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
596 |
" |
874 | 597 |
^ self new startArrowDragIn:aView at:dragPoint atEnd:aFourArgBlock |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
598 |
|
874 | 599 |
" |
600 |
EXAMPLE: |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
601 |
|
874 | 602 |
|button| |
397 | 603 |
|
874 | 604 |
button := (Button label:'press me'). |
861 | 605 |
|
874 | 606 |
button pressAction:[ |
1166 | 607 |
button turnOff. |
861 | 608 |
|
1166 | 609 |
DragAndDropManager startArrowDragIn:button |
610 |
at:(button preferredExtent // 2) |
|
611 |
atEnd:[:targetView :targetViewId :screenPoint :targetPoint| |
|
612 |
targetView isNil ifTrue:[ |
|
613 |
Transcript show:'alien view' |
|
614 |
] ifFalse:[ |
|
615 |
Transcript showCR:'target: ', targetView printString |
|
616 |
]. |
|
617 |
Transcript showCR:'point screen: ', screenPoint printString. |
|
618 |
Transcript showCR:'point target: ', targetPoint printString. |
|
619 |
] |
|
874 | 620 |
]. |
621 |
button openAt:100@100 |
|
622 |
" |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
623 |
! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
624 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
625 |
startLineDragIn:aView at:dragPoint atEnd:aFourArgBlock |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
626 |
"start a rubber-line dragging in aView at dragPoint. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
627 |
When finished, evaluate the fourArgBlock with targetView, |
874 | 628 |
targetID, screenPosition and targetViewPosition as arguments |
629 |
" |
|
630 |
^ self new startLineDragIn:aView at:dragPoint atEnd:aFourArgBlock |
|
631 |
||
632 |
" |
|
633 |
EXAMPLE: |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
634 |
|
874 | 635 |
|button| |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
636 |
|
874 | 637 |
button := (Button label:'press me'). |
638 |
||
639 |
button pressAction:[ |
|
1166 | 640 |
button turnOff. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
641 |
|
1166 | 642 |
DragAndDropManager startLineDragIn:button |
643 |
at:(button preferredExtent // 2) |
|
644 |
atEnd:[:targetView :targetViewId :screenPoint :targetPoint| |
|
645 |
targetView isNil ifTrue:[ |
|
646 |
Transcript show:'alien view' |
|
647 |
] ifFalse:[ |
|
648 |
Transcript showCR:'target: ', targetView printString |
|
649 |
]. |
|
650 |
Transcript showCR:'point screen: ', screenPoint printString. |
|
651 |
Transcript showCR:'point target: ', targetPoint printString. |
|
652 |
] |
|
874 | 653 |
]. |
654 |
button openAt:100@100 |
|
655 |
" |
|
397 | 656 |
! ! |
657 |
||
1511 | 658 |
!DragAndDropManager class methodsFor:'translation'! |
659 |
||
660 |
translatePointFromScreen:aPoint toView:aView |
|
661 |
"translate a point to screen |
|
662 |
" |
|
663 |
|device trans point offset| |
|
664 |
||
665 |
device := aView device. |
|
666 |
||
667 |
"/ |
|
668 |
"/ translate to view |
|
669 |
"/ |
|
1517
5f4d38273014
use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
670 |
offset := device translatePoint:0@0 fromView:(device rootView) toView:aView. |
1511 | 671 |
point := aPoint + offset. |
672 |
||
673 |
"/ |
|
674 |
"/ get device coordinates |
|
675 |
"/ |
|
676 |
(trans := aView transformation) notNil ifTrue:[ |
|
677 |
point := trans applyInverseTo:point |
|
678 |
]. |
|
679 |
^ point |
|
680 |
! |
|
681 |
||
682 |
translatePointToScreen:aPoint from:aView |
|
683 |
"translate a point to screen |
|
684 |
" |
|
685 |
|device trans point offset| |
|
686 |
||
687 |
device := aView device. |
|
688 |
"/ |
|
689 |
"/ get device coordinates |
|
690 |
"/ |
|
691 |
(trans := aView transformation) notNil ifTrue:[ |
|
692 |
point := trans applyTo:aPoint |
|
693 |
] ifFalse:[ |
|
694 |
point := aPoint |
|
695 |
]. |
|
696 |
"/ |
|
697 |
"/ translate to screen |
|
698 |
"/ |
|
1517
5f4d38273014
use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
699 |
offset := device translatePoint:0@0 fromView:aView toView:(device rootView). |
1511 | 700 |
^ offset + point |
701 |
! ! |
|
702 |
||
394 | 703 |
!DragAndDropManager methodsFor:'accessing'! |
704 |
||
861 | 705 |
device |
706 |
"returns the device of the source view |
|
707 |
" |
|
708 |
^ dragView device |
|
709 |
||
710 |
||
711 |
! |
|
712 |
||
874 | 713 |
dropContext |
714 |
"return the current context |
|
715 |
" |
|
716 |
^ dropContext |
|
717 |
! |
|
718 |
||
397 | 719 |
dropObjects |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
720 |
"return the current dropObject collection" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
721 |
|
874 | 722 |
^ dropContext dropObjects |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
723 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
724 |
"Modified: 19.4.1997 / 10:19:06 / cg" |
397 | 725 |
! |
726 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
727 |
dropObjects:aCollectionOfDropObjects |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
728 |
"set the current dropObject collection" |
397 | 729 |
|
874 | 730 |
^ dropContext dropObjects:aCollectionOfDropObjects |
861 | 731 |
! |
732 |
||
733 |
font |
|
734 |
"returns the font of the source view |
|
735 |
" |
|
736 |
^ dragView font |
|
737 |
||
738 |
||
874 | 739 |
! |
740 |
||
1661
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
741 |
passiveAction:aBlockOrNil |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
742 |
self removePassiveAction. |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
743 |
aBlockOrNil notNil ifTrue:[ |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
744 |
passiveAction := Processor addTimedBlock:aBlockOrNil afterMilliseconds:100 |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
745 |
]. |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
746 |
! |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
747 |
|
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
748 |
removePassiveAction |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
749 |
passiveAction notNil ifTrue:[ |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
750 |
Processor removeTimeoutWithID:passiveAction. |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
751 |
passiveAction := nil. |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
752 |
]. |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
753 |
! |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
754 |
|
874 | 755 |
sourceWidget |
756 |
^ dragView |
|
757 |
! ! |
|
758 |
||
1397 | 759 |
!DragAndDropManager methodsFor:'accessing-cursor'! |
874 | 760 |
|
761 |
alienCursor:aCursorOrImage |
|
762 |
"set the cursor used for an alien widget; not an ST/X view |
|
763 |
" |
|
764 |
aCursorOrImage isImage ifTrue:[ |
|
1166 | 765 |
alienCursor := Cursor fromImage:aCursorOrImage |
874 | 766 |
] ifFalse:[ |
1166 | 767 |
(aCursorOrImage isMemberOf:Cursor) ifTrue:[ |
768 |
alienCursor := aCursorOrImage |
|
769 |
] ifFalse:[ |
|
770 |
"/ |
|
771 |
"/ use disabled cursor |
|
772 |
"/ |
|
773 |
alienCursor := nil |
|
774 |
] |
|
874 | 775 |
] |
776 |
! |
|
777 |
||
778 |
disabledCursor:aCursorOrImage |
|
779 |
"set the cursor for an ST/X view, which can not drop the objects |
|
780 |
" |
|
781 |
aCursorOrImage isImage ifTrue:[ |
|
1166 | 782 |
disabledCursor := Cursor fromImage:aCursorOrImage |
874 | 783 |
] ifFalse:[ |
1166 | 784 |
(aCursorOrImage isMemberOf:Cursor) ifTrue:[ |
785 |
disabledCursor := aCursorOrImage |
|
786 |
] |
|
874 | 787 |
] |
788 |
! |
|
789 |
||
790 |
enabledCursor:aCursorOrImage |
|
791 |
"set the cursor for an ST/X view, which can drop the objects |
|
792 |
" |
|
793 |
aCursorOrImage isImage ifTrue:[ |
|
1166 | 794 |
enabledCursor := Cursor fromImage:aCursorOrImage |
874 | 795 |
] ifFalse:[ |
1166 | 796 |
(aCursorOrImage isMemberOf:Cursor) ifTrue:[ |
797 |
enabledCursor := aCursorOrImage |
|
798 |
] |
|
874 | 799 |
] |
800 |
||
801 |
! ! |
|
802 |
||
1678 | 803 |
!DragAndDropManager methodsFor:'dragging-drop source'! |
874 | 804 |
|
805 |
startDragFrom:aView dropSource:aDropSource |
|
806 |
"start a drop at the current pointer position. |
|
807 |
" |
|
808 |
^ self startDragFrom:aView dropSource:aDropSource offset:#topLeft "/ #center |
|
809 |
! |
|
810 |
||
811 |
startDragFrom:aView dropSource:aDropSource offset:anOffset |
|
812 |
"start a drop at the current pointer position. |
|
813 |
" |
|
814 |
dropContext dropSource:aDropSource. |
|
815 |
||
816 |
^ self startDrag:(aDropSource dropObjects) |
|
1166 | 817 |
from:aView |
818 |
offset:anOffset |
|
819 |
atEnd:nil |
|
820 |
display:(aDropSource displayObjects) |
|
874 | 821 |
! ! |
822 |
||
1678 | 823 |
!DragAndDropManager methodsFor:'dragging-easy startup'! |
874 | 824 |
|
825 |
startDrag:draggableObjects from:aView |
|
826 |
"start a drop at the current pointer position |
|
827 |
" |
|
828 |
^ self startDrag:draggableObjects |
|
1166 | 829 |
from:aView |
830 |
offset:0@0 |
|
874 | 831 |
! |
832 |
||
833 |
startDrag:draggableObjects from:aView display:something |
|
834 |
"start a drop at the current pointer position. |
|
835 |
" |
|
836 |
^ self startDrag:draggableObjects |
|
1166 | 837 |
from:aView |
838 |
offset:nil |
|
839 |
atEnd:nil |
|
840 |
display:something |
|
874 | 841 |
! |
842 |
||
843 |
startDrag:draggableObjects from:aView offset:anOffset |
|
844 |
"start a drop at the current pointer position with an offset |
|
845 |
" |
|
846 |
^ self startDrag:draggableObjects |
|
1166 | 847 |
from:aView |
848 |
offset:anOffset |
|
849 |
atEnd:nil |
|
874 | 850 |
! |
851 |
||
852 |
startDrag:draggableObjects from:aView offset:anOffset atEnd:aFourArgEndBlock |
|
853 |
"start a drop at the current pointer position. |
|
854 |
When finished, the endAction is called with four args: |
|
855 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
856 |
the dropPoint in root-coordinates and the dropPoint within the targetView |
|
857 |
" |
|
858 |
^ self startDrag:draggableObjects |
|
1166 | 859 |
from:aView |
860 |
offset:anOffset |
|
861 |
atEnd:aFourArgEndBlock |
|
862 |
display:draggableObjects |
|
874 | 863 |
! |
864 |
||
865 |
startDrag:draggableObjects from:aView offset:anOffset atEnd:aFourArgBlock display:something |
|
866 |
"start a drop at the current pointer position. |
|
867 |
When finished, the endAction is called with four args: |
|
868 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
869 |
the dropPoint in root-coordinates and the dropPoint within the targetView. |
|
870 |
" |
|
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
871 |
|height width fontWdt offset ascent device dispObjs list space| |
874 | 872 |
|
873 |
self dropObjects:draggableObjects. |
|
874 |
||
875 |
self dropObjects size == 0 ifTrue:[ |
|
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
876 |
^ self |
874 | 877 |
]. |
878 |
||
879 |
device := aView device. |
|
880 |
space := 1. |
|
881 |
height := space negated. |
|
882 |
width := 0. |
|
883 |
fontWdt := aView font width. |
|
884 |
ascent := aView font ascent. |
|
885 |
||
886 |
(list := something) isNil ifTrue:[ |
|
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
887 |
list := self dropObjects |
874 | 888 |
] ifFalse:[ |
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
889 |
(list isCollection not or:[list isString]) ifTrue:[ |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
890 |
list := Array with:something |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
891 |
] |
874 | 892 |
]. |
893 |
dispObjs := OrderedCollection new. |
|
894 |
||
895 |
list do:[:el| |
|
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
896 |
|obj asc| |
874 | 897 |
|
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
898 |
obj := self displayObjectFor:el on:device. |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
899 |
asc := (obj respondsTo:#string) ifTrue:[ascent] ifFalse:[0]. |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
900 |
height := height + space. |
874 | 901 |
|
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
902 |
dispObjs add:(Array with:obj with:(0 @ (height + asc))). |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
903 |
width := width max:(obj widthOn:aView). |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
904 |
height := height + (obj heightOn:aView). |
874 | 905 |
]. |
906 |
||
881 | 907 |
anOffset isSymbol ifTrue:[ |
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
908 |
offset := (0@0 extent:(width @ height)) perform:anOffset. |
881 | 909 |
] ifFalse:[ |
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
910 |
offset := anOffset ? (0@0). |
881 | 911 |
]. |
912 |
offset := offset rounded. |
|
874 | 913 |
|
914 |
dispObjs do:[:el| el at:2 put:((el at:2) - offset) ]. |
|
915 |
||
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
916 |
self startOpaqueDrag:[:p :v| |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
917 |
|cursor hX hY pDraw| |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
918 |
|
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
919 |
cursor := dragView cursor. |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
920 |
hX := cursor hotX. |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
921 |
hY := cursor hotY. |
1497
dff682eb74fc
avoid jumping icon while moving
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
922 |
pDraw := p "- (hX@hY) + cursor extent". |
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
923 |
dispObjs do:[:el| (el at:1) displayOn:v |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
924 |
at:pDraw + (el at:2) |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
925 |
] |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
926 |
] |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
927 |
offset:offset |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
928 |
extent:width @ height |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
929 |
in:aView |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
930 |
at:nil |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
931 |
atEnd:aFourArgBlock |
881 | 932 |
|
933 |
"Modified: / 31.3.1998 / 11:18:04 / cg" |
|
874 | 934 |
! |
935 |
||
936 |
startDrag:draggableObjects from:aView offset:anOffset display:something |
|
937 |
"start a drop at the current pointer position. |
|
938 |
" |
|
939 |
^ self startDrag:draggableObjects |
|
1166 | 940 |
from:aView |
941 |
offset:anOffset |
|
942 |
atEnd:nil |
|
943 |
display:something |
|
394 | 944 |
! ! |
945 |
||
1678 | 946 |
!DragAndDropManager methodsFor:'dragging-generic'! |
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
947 |
|
348 | 948 |
startGenericDrag:aTwoArgDragBlock in:aView at:p atEnd:aFourArgEndBlock |
949 |
"start a generic (caller-provided drag); |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
950 |
Here, an inverting drag is initiated (i.e. the drawing is undone |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
951 |
by inverting again). See startOpaqueDrag for another variant. |
348 | 952 |
the dragBlock, aTwoArgDragBlock will be called with two args |
953 |
aPoint and a drawingGC, to perform the drawing at some dragPoint. |
|
954 |
The drag starts in aView at point p. |
|
955 |
When finished, the endAction is called with four args: |
|
956 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
874 | 957 |
the dropPoint in root-coordinates and the dropPoint within the targetView |
958 |
" |
|
959 |
^ self startOpaqueDrag:aTwoArgDragBlock |
|
1166 | 960 |
offset:nil |
961 |
extent:nil |
|
962 |
in:aView |
|
963 |
at:nil |
|
964 |
atEnd:aFourArgEndBlock |
|
394 | 965 |
! |
966 |
||
874 | 967 |
startOpaqueDrag:aDragBlock offset:offs extent:anExtent in:aView at:aDummyPoint atEnd:aFourArgEndBlock |
968 |
"start an opaque or generic opaque (caller-provided drag); |
|
394 | 969 |
opaque drag means, that the drawing cannot be undone by two inverting |
970 |
draws, but instead, the area under the dragged object must be saved |
|
874 | 971 |
and restored. The areas size to be saved/restored is passed in anExtent. |
972 |
the dragBlock, aDragBlock will be called with up to three args aPoint, a |
|
973 |
drawingGC and the display objects, to perform the drawing at some dragPoint. |
|
394 | 974 |
The drag starts in aView at point p. |
975 |
When finished, the endAction is called with four args: |
|
976 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
874 | 977 |
the dropPoint in root-coordinates and the dropPoint within the targetView |
978 |
" |
|
979 |
|handler numArgs dragBlock dobjs| |
|
394 | 980 |
|
874 | 981 |
dragOffset := offs ? (Point x:0 y:0). |
982 |
numArgs := aDragBlock numArgs. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
983 |
|
874 | 984 |
numArgs == 3 ifTrue:[ |
1289 | 985 |
dobjs := self dropObjects. |
986 |
dragBlock := [:p :v| aDragBlock value:p value:v value:dobjs ] |
|
874 | 987 |
] ifFalse:[ |
1289 | 988 |
numArgs == 1 ifTrue:[ |
989 |
dragBlock := [:p :v| aDragBlock value:p ] |
|
990 |
] ifFalse:[ |
|
991 |
dragBlock := aDragBlock |
|
992 |
] |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
993 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
994 |
|
874 | 995 |
anExtent isNil ifTrue:[ |
1289 | 996 |
handler := DragHandler startGenericDrag:dragBlock. |
874 | 997 |
] ifFalse:[ |
1289 | 998 |
handler := DragHandler startOpaqueDrag:dragBlock extent:anExtent offset:dragOffset. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
999 |
]. |
1289 | 1000 |
self doStart:handler for:aView atEnd:aFourArgEndBlock. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1001 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1002 |
! ! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1003 |
|
1678 | 1004 |
!DragAndDropManager methodsFor:'dragging-lines'! |
341 | 1005 |
|
874 | 1006 |
startArrowDragIn:aView at:aStartPoint atEnd:aFourArgEndBlock |
1007 |
"start a line-drag of an arrow-line. |
|
1008 |
The drag starts in aView at point aStartPoint. |
|
1009 |
When finished, the endAction is called with four args: |
|
1010 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
1011 |
the dropPoint in root-coordinates and the dropPoint within the targetView |
|
1012 |
" |
|
1013 |
|p| |
|
341 | 1014 |
|
1511 | 1015 |
p := self class translatePointToScreen:aStartPoint from:aView. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1016 |
|
874 | 1017 |
self doStart:(DragHandler startArrowDragAt:p) |
1511 | 1018 |
for:aView |
1019 |
atEnd:aFourArgEndBlock |
|
341 | 1020 |
! |
1021 |
||
874 | 1022 |
startLineDragIn:aView at:aStartPoint atEnd:aFourArgEndBlock |
1023 |
"start a line-drag of a normal line. |
|
1024 |
The drag starts in aView at point aStartPoint. |
|
348 | 1025 |
When finished, the endAction is called with four args: |
1026 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
874 | 1027 |
the dropPoint in root-coordinates and the dropPoint within the targetView |
1028 |
" |
|
1029 |
|p| |
|
341 | 1030 |
|
1511 | 1031 |
p := self class translatePointToScreen:aStartPoint from:aView. |
348 | 1032 |
|
874 | 1033 |
self doStart:(DragHandler startLineDragAt:p) |
1511 | 1034 |
for:aView |
1035 |
atEnd:aFourArgEndBlock |
|
341 | 1036 |
! ! |
1037 |
||
397 | 1038 |
!DragAndDropManager methodsFor:'drawing'! |
1039 |
||
874 | 1040 |
displayObjectFor:anObject on:aDevice |
1041 |
"converts an object to a display object |
|
1042 |
" |
|
1572 | 1043 |
|obj s1 s2| |
874 | 1044 |
|
1045 |
obj := (anObject respondsTo:#displayObject) ifTrue:[anObject displayObject] |
|
1572 | 1046 |
ifFalse:[anObject]. |
874 | 1047 |
|
1048 |
obj isString ifTrue:[ |
|
1572 | 1049 |
^ obj |
874 | 1050 |
]. |
1051 |
||
1582 | 1052 |
MessageNotUnderstood |
1053 |
ignoreNotUnderstoodOf:#'onDevice:' |
|
1054 |
in:[ |
|
1055 |
obj := obj onDevice:aDevice |
|
1056 |
]. |
|
874 | 1057 |
|
1058 |
obj isImage ifTrue:[ |
|
1572 | 1059 |
^ obj clearMaskedPixels |
874 | 1060 |
]. |
1061 |
||
1062 |
obj class == LabelAndIcon ifTrue:[ |
|
1572 | 1063 |
obj image notNil ifTrue:[obj image clearMaskedPixels]. |
1064 |
obj icon notNil ifTrue:[obj icon clearMaskedPixels]. |
|
874 | 1065 |
^ obj |
1066 |
]. |
|
1067 |
||
1068 |
(obj class == MultiColListEntry) ifFalse:[ |
|
1572 | 1069 |
^ obj |
874 | 1070 |
]. |
1071 |
s1 := obj colAt:1. |
|
1072 |
s2 := obj colAt:2. |
|
1073 |
||
1074 |
s1 isImage ifTrue:[ |
|
1572 | 1075 |
s2 isImage ifTrue:[ ^ self displayObjectFor:(LabelAndIcon form:s1 image:s2) on:aDevice ]. |
1076 |
s2 isString ifTrue:[ ^ self displayObjectFor:(LabelAndIcon icon:s1 string:s2) on:aDevice ]. |
|
1077 |
^ (s1 on:aDevice) clearMaskedPixels |
|
874 | 1078 |
]. |
1079 |
||
1080 |
s2 isImage ifTrue:[ |
|
1572 | 1081 |
s1 isString ifTrue:[ ^ self displayObjectFor:(LabelAndIcon icon:s2 string:s1) on:aDevice ]. |
1082 |
^ (s2 on:aDevice) clearMaskedPixels |
|
874 | 1083 |
]. |
1084 |
||
1085 |
s1 isString ifTrue:[^ s1]. |
|
1086 |
s2 isString ifTrue:[^ s2]. |
|
1087 |
^ obj |
|
1088 |
! |
|
1089 |
||
397 | 1090 |
showDragging:items in:aView at:p |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1091 |
"helper for dragging dragObjects: draw them all" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1092 |
|
397 | 1093 |
|offs| |
1094 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1095 |
offs := 0. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1096 |
items do:[:item | |
1490
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
1097 |
item displayOn:aView at:p + (0@offs). |
b2e1f907060c
care for cursor when drawing dragObjects (avoid overdrawing the cursor)
Claus Gittinger <cg@exept.de>
parents:
1487
diff
changeset
|
1098 |
offs := offs + (item heightOn:self) |
397 | 1099 |
] |
1100 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1101 |
"Modified: 19.4.1997 / 12:41:24 / cg" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1102 |
! ! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1103 |
|
341 | 1104 |
!DragAndDropManager methodsFor:'event catching'! |
1105 |
||
1484 | 1106 |
buttonMotion:buttonState x:x y:y view:aView |
874 | 1107 |
"handle a button motion event |
1108 |
" |
|
1511 | 1109 |
|oldPt oldTgt oldWg oldId newWg newId newTgt screenPoint cursor device isDroppable| |
874 | 1110 |
|
1661
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
1111 |
self removePassiveAction. |
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
1112 |
|
1619 | 1113 |
escapePressed == true ifTrue:[^ self]. |
1114 |
||
874 | 1115 |
device := dragView device. |
1511 | 1116 |
screenPoint := self class translatePointToScreen:(x @ y) from:dragView. |
1497
dff682eb74fc
avoid jumping icon while moving
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
1117 |
"/ cursor := dragView cursor. |
1511 | 1118 |
"/ screenPoint := screenPoint + (cursor hotX @ cursor hotY). |
1497
dff682eb74fc
avoid jumping icon while moving
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
1119 |
|
874 | 1120 |
oldWg := dropContext targetWidget. |
1121 |
oldId := dropContext targetId. |
|
1122 |
oldPt := dropContext rootPoint. |
|
1123 |
||
1511 | 1124 |
dropContext rootPoint:screenPoint. |
874 | 1125 |
|
1511 | 1126 |
newId := device viewIdFromPoint:screenPoint. |
874 | 1127 |
newWg := device viewFromId:newId. |
1128 |
dropContext targetWidget:newWg id:newId. |
|
1129 |
||
1130 |
handler isInterestedInDropTarget ifFalse:[ |
|
1289 | 1131 |
"/ |
1132 |
"/ line or arrow handler |
|
1133 |
"/ |
|
1511 | 1134 |
handler dragTo:screenPoint. |
1289 | 1135 |
^ self |
874 | 1136 |
]. |
1137 |
||
1511 | 1138 |
true "oldWg ~~ newWg" ifTrue:[ |
1289 | 1139 |
"/ |
1140 |
"/ widget has changed: drop target might change |
|
1141 |
"/ |
|
1142 |
oldTgt := dropContext dropTarget. |
|
1511 | 1143 |
newTgt := self doFindDropTargetIn:newWg at:screenPoint. |
874 | 1144 |
|
1289 | 1145 |
newTgt ~= oldTgt ifTrue:[ |
1146 |
"/ |
|
1147 |
"/ drop target changed: handler might restore the screen |
|
1148 |
"/ |
|
1149 |
handler dropTargetWillChange. |
|
341 | 1150 |
|
1289 | 1151 |
oldTgt notNil ifTrue:[ |
1152 |
"/ |
|
1153 |
"/ setup old context |
|
1154 |
"/ |
|
1155 |
dropContext targetWidget:oldWg id:oldId. |
|
1156 |
oldTgt leave:dropContext. |
|
1157 |
dropContext targetWidget:newWg id:newId. |
|
1158 |
]. |
|
1159 |
dropContext dropTarget:newTgt. |
|
1160 |
newTgt notNil ifTrue:[ newTgt enter:dropContext ] |
|
1161 |
] ifFalse:[ |
|
1162 |
dropContext dropTarget:newTgt |
|
1163 |
] |
|
874 | 1164 |
] ifFalse:[ |
1511 | 1165 |
(oldPt notNil and:[(oldPt dist:screenPoint) < 2 ]) ifTrue:[ |
1289 | 1166 |
"/ |
1167 |
"/ ignore the button motion event; restore old rootPoint |
|
1168 |
"/ |
|
1169 |
dropContext rootPoint:oldPt. |
|
1170 |
^ self |
|
1171 |
]. |
|
1172 |
newTgt := dropContext dropTarget |
|
874 | 1173 |
]. |
1174 |
"/ |
|
1175 |
"/ update the cursor |
|
1176 |
"/ |
|
1177 |
(isDroppable := dropContext canDrop) ifTrue:[ |
|
1289 | 1178 |
cursor := enabledCursor |
874 | 1179 |
] ifFalse:[ |
1289 | 1180 |
cursor := dropContext isAlienView ifFalse:[disabledCursor] |
1181 |
ifTrue:[alienCursor] |
|
874 | 1182 |
]. |
1183 |
dragView cursor:cursor now:true. |
|
1184 |
"/ |
|
1185 |
"/ test if droppable state changed |
|
1186 |
"/ |
|
1187 |
canDrop == isDroppable ifFalse:[ |
|
1289 | 1188 |
"/ |
1189 |
"/ droppable state changed: handler might restore the screen |
|
1190 |
"/ |
|
1191 |
canDrop := isDroppable. |
|
1192 |
handler dropTargetWillChange |
|
874 | 1193 |
]. |
394 | 1194 |
|
874 | 1195 |
newTgt notNil ifTrue:[ newTgt over:dropContext ]. |
1511 | 1196 |
handler dragTo:screenPoint. |
874 | 1197 |
! |
394 | 1198 |
|
874 | 1199 |
buttonMultiPress:button x:x y:y view:aView |
1200 |
"discard each buttonMultiPress event |
|
1201 |
" |
|
1202 |
! |
|
1203 |
||
1204 |
buttonPress:button x:x y:y view:aView |
|
1205 |
"discard each buttonPress event |
|
1206 |
" |
|
341 | 1207 |
! |
1208 |
||
1209 |
buttonRelease:button x:x y:y view:aView |
|
874 | 1210 |
"button released; do the drop |
1211 |
" |
|
1661
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
1212 |
|
874 | 1213 |
((button == 2) or:[button == #menu]) ifTrue:[ |
1619 | 1214 |
^ self |
874 | 1215 |
]. |
1661
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
1216 |
|
3092c6bac88e
added passiveAction: invoked if staying over a dropItem for a while
Claus Gittinger <cg@exept.de>
parents:
1638
diff
changeset
|
1217 |
self removePassiveAction. |
874 | 1218 |
"/ |
1219 |
"/ update the context |
|
1220 |
"/ |
|
1221 |
self buttonMotion:button x:x y:y view:aView. |
|
1222 |
||
1223 |
"/ |
|
1224 |
"/ restore source view |
|
1225 |
"/ |
|
1226 |
restoreBlock value. |
|
1619 | 1227 |
escapePressed == true ifTrue:[^ self]. |
394 | 1228 |
|
874 | 1229 |
"/ |
1230 |
"/ at least do the drop operation |
|
1231 |
"/ |
|
1232 |
dropAction isNil ifTrue:[ |
|
1619 | 1233 |
dropContext doDrop |
874 | 1234 |
] ifFalse:[ |
1619 | 1235 |
"/ |
1236 |
"/ initiator wants to do it himself, manually. |
|
1237 |
"/ Thus, no feedBack operation invoked. |
|
1238 |
"/ |
|
1239 |
dropAction value:(dropContext targetWidget) |
|
1240 |
value:(dropContext targetId) |
|
1241 |
value:(dropContext rootPoint) |
|
1242 |
value:(dropContext targetPoint). |
|
874 | 1243 |
] |
341 | 1244 |
! |
1245 |
||
1289 | 1246 |
delegatesTo:someone |
1247 |
^false |
|
1248 |
! |
|
1249 |
||
1685 | 1250 |
escapePressed |
1251 |
"handle key escape |
|
1252 |
" |
|
1253 |
|dropTarget| |
|
1254 |
||
1255 |
escapePressed ~~ true ifTrue:[ |
|
1256 |
escapePressed := true. |
|
1257 |
||
1258 |
handler notNil ifTrue:[ |
|
1259 |
"/ restore handler |
|
1260 |
dropTarget := dropContext dropTarget. |
|
1261 |
handler postDragging. |
|
1262 |
||
1263 |
dropTarget notNil ifTrue:[ |
|
1264 |
"/ invoke leave operation |
|
1265 |
dropTarget leave:dropContext. |
|
1266 |
dropContext dropTarget:nil. |
|
1267 |
]. |
|
1268 |
]. |
|
1269 |
]. |
|
1270 |
! |
|
1271 |
||
341 | 1272 |
handlesButtonMotion:button inView:aView |
1273 |
"query from event processor: am I interested in button-events ? |
|
1274 |
yes I am (to activate the clicked-on field)." |
|
1275 |
||
874 | 1276 |
^ dragView == aView |
1277 |
! |
|
1278 |
||
1279 |
handlesButtonMultiPress:button inView:aView |
|
1280 |
"query from event processor: am I interested in button-events ? |
|
1281 |
yes I am (to activate the clicked-on field)." |
|
341 | 1282 |
|
874 | 1283 |
^ dragView == aView |
1284 |
! |
|
394 | 1285 |
|
874 | 1286 |
handlesButtonPress:button inView:aView |
1287 |
"query from event processor: am I interested in button-events ? |
|
1288 |
yes I am (to activate the clicked-on field)." |
|
1289 |
||
1290 |
^ dragView == aView |
|
341 | 1291 |
! |
1292 |
||
1293 |
handlesButtonRelease:button inView:aView |
|
1294 |
"query from event processor: am I interested in button-events ? |
|
1295 |
yes I am (to activate the clicked-on field)." |
|
1296 |
||
874 | 1297 |
^ dragView == aView |
1619 | 1298 |
! |
1299 |
||
1300 |
handlesKeyPress:aKey inView:aView |
|
1301 |
"query from event processor: am I interested in key-events ? |
|
1302 |
yes I am (to activate the clicked-on field)." |
|
1303 |
||
1304 |
^ dragView == aView |
|
1305 |
! |
|
1306 |
||
1307 |
keyPress:aKey x:x y:y view:aView |
|
1629
9b0f45e63e24
bug fix if operation cancled by #Escape, must invoke #leave
ca
parents:
1619
diff
changeset
|
1308 |
"any key is pressed: |
9b0f45e63e24
bug fix if operation cancled by #Escape, must invoke #leave
ca
parents:
1619
diff
changeset
|
1309 |
#Escape cancel drag & drop operation |
9b0f45e63e24
bug fix if operation cancled by #Escape, must invoke #leave
ca
parents:
1619
diff
changeset
|
1310 |
" |
9b0f45e63e24
bug fix if operation cancled by #Escape, must invoke #leave
ca
parents:
1619
diff
changeset
|
1311 |
escapePressed == true ifTrue:[^ self ]. "/ already canceled |
9b0f45e63e24
bug fix if operation cancled by #Escape, must invoke #leave
ca
parents:
1619
diff
changeset
|
1312 |
|
9b0f45e63e24
bug fix if operation cancled by #Escape, must invoke #leave
ca
parents:
1619
diff
changeset
|
1313 |
aKey == #Escape ifTrue:[ |
1685 | 1314 |
self escapePressed. |
1619 | 1315 |
]. |
874 | 1316 |
! ! |
1317 |
||
1318 |
!DragAndDropManager methodsFor:'initialization'! |
|
341 | 1319 |
|
874 | 1320 |
initialize |
1321 |
super initialize. |
|
394 | 1322 |
|
874 | 1323 |
dragOffset := 0 @ 0. |
1324 |
dropContext := DropContext new. |
|
1618 | 1325 |
dropContext manager:self. |
874 | 1326 |
alienCursor := Cursor questionMark. |
1327 |
enabledCursor := Cursor thumbsUp. |
|
1328 |
disabledCursor := Cursor thumbsDown. |
|
1329 |
canDrop := false. |
|
341 | 1330 |
! ! |
1331 |
||
1332 |
!DragAndDropManager methodsFor:'private'! |
|
1333 |
||
874 | 1334 |
doDrop:aContext in:aWidget |
1335 |
"old drop mechanism |
|
1336 |
" |
|
1337 |
|point| |
|
628 | 1338 |
|
1511 | 1339 |
DragContextQuerySignal answer:aContext do:[ |
1340 |
DragOriginatorQuerySignal answer:dragView do:[ |
|
1341 |
DragOffsetQuerySignal answer:dragOffset do:[ |
|
1342 |
aContext targetWidget == aWidget ifTrue:[ |
|
1343 |
point := aContext targetPoint |
|
1344 |
] ifFalse:[ |
|
1345 |
point := 0@0. "/ nil. |
|
1346 |
"/ |
|
1347 |
"/ FeedBack: set the widget which handles the drop |
|
1348 |
"/ |
|
1349 |
aContext targetWidget:aWidget id:(aWidget id). |
|
1350 |
]. |
|
1351 |
aWidget drop:(aContext dropObjects) at:point |
|
1352 |
] |
|
1353 |
]. |
|
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1354 |
]. |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1355 |
|
1072
be90bc383d83
do not pas nil point to dropDestination
Claus Gittinger <cg@exept.de>
parents:
881
diff
changeset
|
1356 |
"Modified: / 11.9.1998 / 00:53:22 / cg" |
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1357 |
! |
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1358 |
|
874 | 1359 |
doFindDropTargetIn:aView at:aPoint |
1360 |
"get the drop target for a view and source at a point or nil |
|
411 | 1361 |
" |
628 | 1362 |
|
874 | 1363 |
aView isNil ifTrue:[ ^ nil ]. |
1582 | 1364 |
|
874 | 1365 |
"/ |
1366 |
"/ new mechanism to get a dropTarget |
|
1367 |
"/ |
|
1587 | 1368 |
|
1582 | 1369 |
MessageNotUnderstood |
1370 |
ignoreNotUnderstoodOf:#dropTarget |
|
1587 | 1371 |
in:[ |target| |
1582 | 1372 |
target := aView dropTarget. |
1587 | 1373 |
target notNil ifTrue:[ ^ target ]. |
1582 | 1374 |
]. |
1375 |
||
874 | 1376 |
"/ |
1377 |
"/ old mechanism to get a dropTarget |
|
1378 |
"/ |
|
628 | 1379 |
|
1511 | 1380 |
DragContextQuerySignal answer:dropContext do:[ |
1381 |
DragOriginatorQuerySignal answer:dragView do:[ |
|
1382 |
DragOffsetQuerySignal answer:dragOffset do:[ |
|
1587 | 1383 |
|view dobj| |
1384 |
||
1385 |
view := aView. |
|
1386 |
dobj := dropContext dropObjects. |
|
1387 |
[ |
|
1388 |
(view canDrop:dobj) ifTrue:[ |
|
1511 | 1389 |
^ DropTarget receiver:self argument:view dropSelector:#doDrop:in:. |
1390 |
]. |
|
1391 |
(view := view superView) notNil |
|
1392 |
] whileTrue. |
|
1393 |
] |
|
1394 |
]. |
|
874 | 1395 |
]. |
1396 |
^ nil |
|
1397 |
! |
|
628 | 1398 |
|
874 | 1399 |
doStart:aHandler for:aView atEnd:aFourArgEndBlock |
1400 |
"setup a handler and a restore block |
|
628 | 1401 |
" |
1685 | 1402 |
|device savedCursor savedDelegate prevGrab prevKeyb sensor p lastActive| |
628 | 1403 |
|
1512 | 1404 |
device := aView device. |
1685 | 1405 |
lastActive := ActiveDragAndDropManagers at:device ifAbsent:nil. |
1406 |
||
1407 |
lastActive notNil ifTrue:[ |
|
1408 |
"/ self error:'oops - two dnd managers active' mayProceed:true. |
|
1409 |
||
1410 |
lastActive forceGiveUp. |
|
1411 |
'oops - two dnd managers active' printCR. |
|
1487 | 1412 |
]. |
1512 | 1413 |
ActiveDragAndDropManagers at:device put:self. |
1487 | 1414 |
|
874 | 1415 |
dropContext sourceWidget:aView. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1416 |
|
874 | 1417 |
dragOffset isNil ifTrue:[ dragOffset := 0 @ 0 ]. |
1418 |
alienCursor isNil ifTrue:[ alienCursor := disabledCursor ]. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1419 |
|
874 | 1420 |
dragView := aView. |
1421 |
dropAction := aFourArgEndBlock. |
|
1289 | 1422 |
savedCursor := aView cursor. |
1423 |
savedDelegate := aView delegate. |
|
1619 | 1424 |
handler := aHandler. |
1425 |
escapePressed := false. |
|
1426 |
prevGrab := prevKeyb := nil. |
|
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1427 |
|
1162
0539b64679ce
set DragHandler in the DropContext
Claus Gittinger <cg@exept.de>
parents:
1072
diff
changeset
|
1428 |
dropContext dragHandler:aHandler. |
0539b64679ce
set DragHandler in the DropContext
Claus Gittinger <cg@exept.de>
parents:
1072
diff
changeset
|
1429 |
|
874 | 1430 |
restoreBlock := [ |
1512 | 1431 |
ActiveDragAndDropManagers removeKey:device ifAbsent:nil. |
1619 | 1432 |
escapePressed ifFalse:[ |
1433 |
aHandler postDragging |
|
1434 |
]. |
|
1289 | 1435 |
aView delegate:savedDelegate. |
1436 |
aView cursor:savedCursor now:true. |
|
1437 |
prevGrab notNil ifTrue:[ |
|
1438 |
aView forceUngrabPointer. |
|
1439 |
prevGrab grabPointer. |
|
1440 |
] ifFalse:[ |
|
1441 |
aView ungrabPointer. |
|
1442 |
]. |
|
1619 | 1443 |
prevKeyb notNil ifTrue:[ |
1444 |
aView forceUngrabKeyboard. |
|
1445 |
prevKeyb grabKeyboard. |
|
1446 |
] ifFalse:[ |
|
1447 |
aView ungrabKeyboard. |
|
1448 |
]. |
|
874 | 1449 |
]. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1450 |
|
874 | 1451 |
aHandler preDraggingIn:aView. |
1452 |
aView delegate:self. |
|
1512 | 1453 |
prevGrab := device activePointerGrab. |
1619 | 1454 |
prevKeyb := device activeKeyboardGrab. |
1289 | 1455 |
aView grabPointer. |
1619 | 1456 |
aView grabKeyboard. |
1289 | 1457 |
|
1458 |
"/ must wait for all pending motion events to arrive, and ignore them |
|
1459 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1512 | 1460 |
device sync. |
1289 | 1461 |
sensor flushMotionEventsFor:nil. |
1462 |
]. |
|
1463 |
||
1464 |
"/ start with a first draw at the current mouse position |
|
1512 | 1465 |
p := device pointerPosition. |
1517
5f4d38273014
use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1466 |
p := device translatePoint:p fromView:nil toView:aView. |
1289 | 1467 |
self buttonMotion:1 x:p x y:p y view:aView |
1517
5f4d38273014
use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1468 |
|
5f4d38273014
use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1469 |
"Modified: / 10.10.2001 / 14:45:22 / cg" |
1487 | 1470 |
! |
1471 |
||
1685 | 1472 |
forceGiveUp |
1473 |
"called if the DragAndDropManager no longer should be |
|
1474 |
active; a second one is started |
|
1475 |
" |
|
1476 |
self escapePressed. |
|
1477 |
self removePassiveAction. |
|
1478 |
restoreBlock value. |
|
1479 |
! |
|
1480 |
||
1487 | 1481 |
saveDraw:aBlock |
1482 |
handler postDragging. |
|
1483 |
aBlock value. |
|
1638 | 1484 |
|
1485 |
escapePressed == true ifFalse:[ |
|
1486 |
"/ reread and show drag items |
|
1487 |
handler rereadSaveArea. |
|
1488 |
handler restoreFromSaveArea. |
|
1489 |
]. |
|
1587 | 1490 |
! |
1491 |
||
1492 |
xx |
|
1493 |
||
1494 |
Transcript showCR:([-3] on:Error do:[0]). |
|
1495 |
Transcript showCR:([5 printString. 7] on:Error do:[]) |
|
1496 |
||
1497 |
" |
|
1498 |
self new xx |
|
1499 |
" |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1500 |
! ! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1501 |
|
341 | 1502 |
!DragAndDropManager class methodsFor:'documentation'! |
1503 |
||
1504 |
version |
|
1685 | 1505 |
^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.46 2003-01-18 14:28:36 ca Exp $' |
341 | 1506 |
! ! |
1629
9b0f45e63e24
bug fix if operation cancled by #Escape, must invoke #leave
ca
parents:
1619
diff
changeset
|
1507 |
|
628 | 1508 |
DragAndDropManager initialize! |