author | ca |
Mon, 09 Mar 1998 17:06:35 +0100 | |
changeset 861 | 10bbb13fcb05 |
parent 680 | 6157661790fd |
child 874 | 0730cf44f593 |
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 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
3 |
All Rights Reserved |
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 |
|
341 | 14 |
Object subclass:#DragAndDropManager |
15 |
instanceVariableNames:'dragView motionAction releaseAction initialPoint previousPoint |
|
394 | 16 |
rememberedDelegate dragBlock lineMode dropAction opaque saveUnder |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
17 |
dragSize dragOffset dropObjects saveCursor lastView |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
18 |
lastScreenPosition' |
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
19 |
classVariableNames:'DragOriginatorQuerySignal DragOffsetQuerySignal' |
628 | 20 |
poolDictionaries:'' |
21 |
category:'Interface-Support' |
|
22 |
! |
|
23 |
||
24 |
View subclass:#DemoView |
|
25 |
instanceVariableNames:'' |
|
341 | 26 |
classVariableNames:'' |
27 |
poolDictionaries:'' |
|
628 | 28 |
privateIn:DragAndDropManager |
341 | 29 |
! |
30 |
||
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
31 |
View subclass:#DemoView2 |
397 | 32 |
instanceVariableNames:'' |
33 |
classVariableNames:'' |
|
34 |
poolDictionaries:'' |
|
35 |
privateIn:DragAndDropManager |
|
36 |
! |
|
37 |
||
513 | 38 |
View subclass:#DemoView3 |
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
39 |
instanceVariableNames:'' |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
40 |
classVariableNames:'' |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
41 |
poolDictionaries:'' |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
42 |
privateIn:DragAndDropManager |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
43 |
! |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
44 |
|
341 | 45 |
!DragAndDropManager class methodsFor:'documentation'! |
46 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
47 |
copyright |
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 |
COPYRIGHT (c) 1996 by eXept Software AG / Claus Gittinger |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
50 |
All Rights Reserved |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
51 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
52 |
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
|
53 |
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
|
54 |
inclusion of the above copyright notice. This software may not |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
55 |
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
|
56 |
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
|
57 |
hereby transferred. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
58 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
59 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
60 |
! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
61 |
|
348 | 62 |
documentation |
63 |
" |
|
64 |
this class provides low-level drag & drop mechanisms. |
|
65 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
66 |
Easy to use interface interfaces: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
67 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
68 |
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
|
69 |
when a selection is moved (for example, SelectionInListView can |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
70 |
be initializd to do so). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
71 |
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
|
72 |
and starts the drag operation with: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
73 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
74 |
DragAndDropManager startDrag:collectionOfDragObjects from:aView. |
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 |
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
|
77 |
into the target view. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
78 |
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
|
79 |
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
|
80 |
is shown for alien views (which means: we dont know). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
81 |
Alien view drop is supported (but no 'canDrop' query). |
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 |
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
|
84 |
provided: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
85 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
86 |
DragAndDropManager |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
87 |
startLineDragIn:aView at:position |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
88 |
atEnd:aFourArgEndBlock |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
89 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
90 |
and: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
91 |
DragAndDropManager |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
92 |
startArrowDragIn:aView at:position |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
93 |
atEnd:aFourArgEndBlock |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
94 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
95 |
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
|
96 |
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
|
97 |
on the screen and within the target view as arguments. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
98 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
99 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
100 |
Expert interface: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
101 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
102 |
More control over the dragging (i.e. the drawing procedure) |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
103 |
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
|
104 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
105 |
aDragAndDropMgr := DragAndDropManager new. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
106 |
aDragAndDropMgr dropObjects:(self collectionOfDragObjects). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
107 |
aDragAndDropMgr |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
108 |
startOpaqueDrag:[:aPoint :aView :dropObjects | |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
109 |
self |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
110 |
showDragging:dropObjects |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
111 |
in:aView |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
112 |
at:aPoint - (xOffset@0) |
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 |
offset:clickOffset |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
115 |
extent:saveUnderExtent |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
116 |
in:self |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
117 |
at:clickPoint |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
118 |
atEnd:[:v :vId :posScreen :posView | ... ] |
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 |
the arguments are: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
121 |
startOpaqueDrag: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
122 |
a 3-arg block, which is evaluated by the d&d manager whenever the |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
123 |
mouse moves; it is supposed to draw the dropObjects at some position |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
124 |
in the passed view. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
125 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
126 |
offset: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
127 |
a clickOffset; drawing is offset by this amount |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
128 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
129 |
extent: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
130 |
a save extent; the size of the screen area that must be saved during |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
131 |
the drag operation |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
132 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
133 |
in: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
134 |
initiating view |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
135 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
136 |
at: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
137 |
position where d&d operation starts |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
138 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
139 |
atEnd: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
140 |
a 4-arg block that is evaluated when the d&d is finished. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
141 |
It gets the target view (or nil, for alien views), the targets |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
142 |
view ID (needed if its an alien view), the screen position and the |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
143 |
relative position within the target view of the drop as arguments. |
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 |
For internal (ST/X) views, the dropBlock should perform |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
146 |
a simple canDrop:/doDrop message. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
147 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
148 |
For alien views, the Displays d&d functions can be used. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
149 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
150 |
|
348 | 151 |
[author:] |
152 |
Claus Gittinger |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
153 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
154 |
[see also:] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
155 |
DemoView DemoView2 DemoView3 - examples |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
156 |
SelectionInListView FileBrowser - for a concrete example |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
157 |
|
348 | 158 |
" |
159 |
||
160 |
! |
|
161 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
162 |
examples |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
163 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
164 |
a button, which initiates dragging of a file-object |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
165 |
Notice that this can be dropped into the launchers panel, |
549 | 166 |
to open a fileBrowser on that directory ... |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
167 |
[exBegin] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
168 |
|o top v| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
169 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
170 |
top := StandardSystemView new. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
171 |
v := Button label:'press for drag' in:top. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
172 |
v pressAction:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
173 |
|o| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
174 |
o := DropObject newFile:('/etc'). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
175 |
DragAndDropManager startDrag:o from:v. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
176 |
v turnOff |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
177 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
178 |
top openWithExtent:200@200 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
179 |
[exEnd] |
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 |
initiate a drag with some offset: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
182 |
[exBegin] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
183 |
|o top v| |
341 | 184 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
185 |
top := StandardSystemView new. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
186 |
v := Button label:'press for drag' in:top. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
187 |
v pressAction:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
188 |
|o| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
189 |
o := DropObject newFile:('.'). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
190 |
DragAndDropManager startDrag:o from:v offset:10@10. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
191 |
v turnOff |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
192 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
193 |
top openWithExtent:200@200 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
194 |
[exEnd] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
195 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
196 |
initiate a line drag: |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
197 |
[exBegin] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
198 |
|o top v endAction| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
199 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
200 |
endAction := [ :v :vID :sPos :vPos | |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
201 |
Transcript show:'end drag in '. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
202 |
v isNil ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
203 |
Transcript show:'alien view' |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
204 |
] ifFalse:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
205 |
Transcript show:v |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
206 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
207 |
Transcript show:' at screen: '; show:sPos; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
208 |
show:' in view: '; showCR:vPos |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
209 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
210 |
top := StandardSystemView new. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
211 |
v := Button label:'press for drag' in:top. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
212 |
v pressAction:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
213 |
DragAndDropManager |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
214 |
startLineDragIn:v at:10@10 atEnd:endAction. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
215 |
v turnOff |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
216 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
217 |
top openWithExtent:200@200 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
218 |
[exEnd] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
219 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
220 |
" |
341 | 221 |
! ! |
222 |
||
628 | 223 |
!DragAndDropManager class methodsFor:'initialization'! |
224 |
||
225 |
initialize |
|
226 |
DragOriginatorQuerySignal := QuerySignal new. |
|
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
227 |
DragOffsetQuerySignal := QuerySignal new. |
628 | 228 |
|
229 |
" |
|
230 |
self initialize |
|
231 |
" |
|
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
232 |
|
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
233 |
"Modified: 11.8.1997 / 00:54:21 / cg" |
628 | 234 |
! ! |
235 |
||
236 |
!DragAndDropManager class methodsFor:'Signal constants'! |
|
237 |
||
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
238 |
dragOffsetQuerySignal |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
239 |
^ DragOffsetQuerySignal |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
240 |
|
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
241 |
"Created: 11.8.1997 / 00:54:10 / cg" |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
242 |
! |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
243 |
|
628 | 244 |
dragOriginatorQuerySignal |
245 |
^ DragOriginatorQuerySignal |
|
246 |
! ! |
|
247 |
||
397 | 248 |
!DragAndDropManager class methodsFor:'simple start'! |
249 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
250 |
startArrowDragIn:aView at:dragPoint atEnd:aFourArgBlock |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
251 |
"start a rubber-arrow-line dragging in aView at dragPoint. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
252 |
When finished, evaluate the fourArgBlock with targetView, |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
253 |
targetID, screenPosition and targetViewPosition as arguments" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
254 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
255 |
^ self new |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
256 |
startArrowDragIn:aView at:dragPoint atEnd:aFourArgBlock |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
257 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
258 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
259 |
|o v| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
260 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
261 |
v := Button label:'press me'. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
262 |
v pressAction:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
263 |
|o| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
264 |
o := DropObject newFile:('.'). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
265 |
v turnOff; repairDamage. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
266 |
DragAndDropManager |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
267 |
startArrowDragIn:v |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
268 |
at:0@0 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
269 |
atEnd:[:v :vID :sPos :vPos | |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
270 |
v isNil ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
271 |
Transcript show:'alien view' |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
272 |
] ifFalse:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
273 |
Transcript show:'view: '; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
274 |
show:v |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
275 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
276 |
Transcript show:' screen: '; show:sPos; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
277 |
show:' inView: '; showCR:vPos. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
278 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
279 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
280 |
v openAt:100@100 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
281 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
282 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
283 |
"Modified: 19.4.1997 / 12:04:08 / cg" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
284 |
! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
285 |
|
397 | 286 |
startDrag:anObjectOrCollection from:aView |
287 |
"start a drop at the current pointer position" |
|
288 |
||
861 | 289 |
self startDrag:anObjectOrCollection from:aView offset:0@0 atEnd:nil |
397 | 290 |
|
291 |
" |
|
292 |
|o v| |
|
293 |
||
294 |
v := (Button label:'press me'). |
|
295 |
v pressAction:[ |
|
296 |
|o| |
|
297 |
o := DropObject newFile:('.'). |
|
298 |
DragAndDropManager startDrag:o from:v. |
|
299 |
v turnOff |
|
300 |
]. |
|
301 |
v openAt:100@100 |
|
302 |
" |
|
303 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
304 |
"Modified: 19.4.1997 / 11:42:40 / cg" |
861 | 305 |
|
306 |
! |
|
307 |
||
308 |
startDrag:anObjectOrCollection from:aView atEnd:aFourArgEndBlock |
|
309 |
"start a drop at the current pointer position |
|
310 |
When finished, the endAction is called with four args: |
|
311 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
312 |
the dropPoint in root-coordinates and the dropPoint within the targetView" |
|
313 |
||
314 |
self startDrag:anObjectOrCollection from:aView offset:0@0 atEnd:aFourArgEndBlock |
|
315 |
||
316 |
! |
|
317 |
||
318 |
startDrag:anObjectOrCollection from:aView atEnd:aFourArgEndBlock useIcon:anIcon |
|
319 |
"start a drop at the current pointer position |
|
320 |
When finished, the endAction is called with four args: |
|
321 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
322 |
the dropPoint in root-coordinates and the dropPoint within the targetView" |
|
323 |
||
324 |
self startDrag:anObjectOrCollection from:aView offset:0@0 atEnd:aFourArgEndBlock useIcon:anIcon |
|
325 |
||
397 | 326 |
! |
327 |
||
328 |
startDrag:anObjectOrCollection from:aView offset:offset |
|
329 |
"start a drop at the current pointer position" |
|
330 |
||
861 | 331 |
self startDrag:anObjectOrCollection from:aView offset:offset atEnd:nil |
397 | 332 |
|
333 |
" |
|
334 |
|o v| |
|
335 |
||
336 |
v := (Button label:'press me'). |
|
337 |
v pressAction:[ |
|
338 |
|o| |
|
339 |
o := DropObject newFile:('.'). |
|
340 |
DragAndDropManager startDrag:o from:v offset:10@10. |
|
341 |
v turnOff |
|
342 |
]. |
|
343 |
v openAt:100@100 |
|
344 |
" |
|
345 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
346 |
"Modified: 19.4.1997 / 11:42:45 / cg" |
861 | 347 |
|
348 |
! |
|
349 |
||
350 |
startDrag:anObjectOrCollection from:aView offset:offset atEnd:aFourArgEndBlock |
|
351 |
"start a drop at the current pointer position |
|
352 |
When finished, the endAction is called with four args: |
|
353 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
354 |
the dropPoint in root-coordinates and the dropPoint within the targetView" |
|
355 |
||
356 |
||
357 |
(self new) startDrag:anObjectOrCollection from:aView offset:offset atEnd:aFourArgEndBlock |
|
358 |
||
359 |
||
360 |
! |
|
361 |
||
362 |
startDrag:anObjectOrCollection from:aView offset:anOffset atEnd:aFourArgEndBlock useIcon:anIcon |
|
363 |
||
364 |
(self new) startDrag:anObjectOrCollection |
|
365 |
from:aView |
|
366 |
offset:anOffset |
|
367 |
atEnd:aFourArgEndBlock |
|
368 |
useIcon:anIcon |
|
369 |
||
370 |
||
371 |
! |
|
372 |
||
373 |
startDrag:anObjectOrCollection from:aView useIcon:anIcon |
|
374 |
"start a drop at the current pointer position" |
|
375 |
||
376 |
self startDrag:anObjectOrCollection from:aView offset:0@0 atEnd:nil useIcon:anIcon |
|
377 |
||
378 |
" |
|
379 |
|o v| |
|
380 |
||
381 |
v := (Button label:'press me'). |
|
382 |
v pressAction:[ |
|
383 |
|o| |
|
384 |
o := DropObject newFile:('.'). |
|
385 |
DragAndDropManager startDrag:o from:v useIcon:( |
|
386 |
Image fromFile:('xpmBitmaps/cursors/hand_with_document.xpm') |
|
387 |
). |
|
388 |
v turnOff |
|
389 |
]. |
|
390 |
v openAt:100@100 |
|
391 |
" |
|
392 |
||
393 |
"Modified: 19.4.1997 / 11:42:40 / cg" |
|
394 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
395 |
! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
396 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
397 |
startLineDragIn:aView at:dragPoint atEnd:aFourArgBlock |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
398 |
"start a rubber-line dragging in aView at dragPoint. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
399 |
When finished, evaluate the fourArgBlock with targetView, |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
400 |
targetID, screenPosition and targetViewPosition as arguments" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
401 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
402 |
^ self new |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
403 |
startLineDragIn:aView at:dragPoint atEnd:aFourArgBlock |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
404 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
405 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
406 |
|o v| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
407 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
408 |
v := (Button label:'press me'). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
409 |
v pressAction:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
410 |
|o| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
411 |
o := DropObject newFile:('.'). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
412 |
v turnOff; repairDamage. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
413 |
DragAndDropManager |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
414 |
startLineDragIn:v |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
415 |
at:0@0 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
416 |
atEnd:[:v :vID :sPos :vPos | |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
417 |
v isNil ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
418 |
Transcript show:'alien view' |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
419 |
] ifFalse:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
420 |
Transcript show:'view: '; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
421 |
show:v |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
422 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
423 |
Transcript show:' screen: '; show:sPos; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
424 |
show:' inView: '; showCR:vPos. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
425 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
426 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
427 |
v openAt:100@100 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
428 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
429 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
430 |
"Modified: 19.4.1997 / 12:02:02 / cg" |
397 | 431 |
! ! |
432 |
||
394 | 433 |
!DragAndDropManager methodsFor:'accessing'! |
434 |
||
861 | 435 |
device |
436 |
"returns the device of the source view |
|
437 |
" |
|
438 |
^ dragView device |
|
439 |
||
440 |
||
441 |
! |
|
442 |
||
397 | 443 |
dropObjects |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
444 |
"return the current dropObject collection" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
445 |
|
397 | 446 |
^ dropObjects |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
447 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
448 |
"Modified: 19.4.1997 / 10:19:06 / cg" |
397 | 449 |
! |
450 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
451 |
dropObjects:aCollectionOfDropObjects |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
452 |
"set the current dropObject collection" |
397 | 453 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
454 |
aCollectionOfDropObjects isCollection ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
455 |
dropObjects := aCollectionOfDropObjects |
397 | 456 |
] ifFalse:[ |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
457 |
dropObjects := Array with:aCollectionOfDropObjects |
397 | 458 |
]. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
459 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
460 |
"Modified: 19.4.1997 / 10:19:33 / cg" |
861 | 461 |
! |
462 |
||
463 |
font |
|
464 |
"returns the font of the source view |
|
465 |
" |
|
466 |
^ dragView font |
|
467 |
||
468 |
||
394 | 469 |
! ! |
470 |
||
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
471 |
!DragAndDropManager methodsFor:'dragging - generic'! |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
472 |
|
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
473 |
doGenericDragX:x y:y |
515 | 474 |
"drag to x/y; see if the target view allows a drop |
475 |
and change the mouse pointer as appropriate" |
|
476 |
||
477 |
|view newCursor| |
|
394 | 478 |
|
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
479 |
previousPoint notNil ifTrue:[ |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
480 |
(opaque and:[dragSize notNil]) ifTrue:[ |
394 | 481 |
self restoreGenericAt:previousPoint |
482 |
] ifFalse:[ |
|
483 |
self invertGenericAt:previousPoint |
|
484 |
] |
|
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
485 |
]. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
486 |
previousPoint := x @ y. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
487 |
lastScreenPosition := nil. |
394 | 488 |
|
489 |
view := self destinationViewAt:previousPoint. |
|
490 |
view ~~ lastView ifTrue:[ |
|
397 | 491 |
view isNil ifTrue:[ |
515 | 492 |
"/ alien view - dont know if it likes a drop |
493 |
newCursor := Cursor questionMark |
|
394 | 494 |
] ifFalse:[ |
515 | 495 |
"/ ST/X view - ask it. |
628 | 496 |
(self askIfCanDrop:dropObjects in:view) ifTrue:[ |
515 | 497 |
newCursor := Cursor thumbsUp |
397 | 498 |
] ifFalse:[ |
515 | 499 |
newCursor := Cursor thumbsDown |
397 | 500 |
] |
394 | 501 |
]. |
515 | 502 |
dragView cursor:newCursor now:true. |
394 | 503 |
lastView := view |
504 |
]. |
|
505 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
506 |
(opaque and:[dragSize notNil]) ifTrue:[ |
394 | 507 |
self drawGenericAt:previousPoint. |
508 |
] ifFalse:[ |
|
509 |
self invertGenericAt:previousPoint |
|
510 |
]. |
|
515 | 511 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
512 |
"Modified: 19.4.1997 / 11:33:54 / cg" |
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
513 |
! |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
514 |
|
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
515 |
endGenericDragX:x y:y |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
516 |
"finish a drag; restore from saveUnder (or reinvert), |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
517 |
then call for the endAction" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
518 |
|
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
519 |
previousPoint notNil ifTrue:[ |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
520 |
(opaque and:[dragSize notNil]) ifTrue:[ |
394 | 521 |
self restoreGenericAt:previousPoint |
522 |
] ifFalse:[ |
|
523 |
self invertGenericAt:previousPoint |
|
524 |
] |
|
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
525 |
]. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
526 |
previousPoint := nil. |
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
527 |
self uncatchEvents. |
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
528 |
self endDragAt:x @ y |
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
529 |
|
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
530 |
"Created: 26.10.1996 / 15:17:20 / cg" |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
531 |
"Modified: 19.4.1997 / 10:41:57 / cg" |
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
532 |
! |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
533 |
|
348 | 534 |
startGenericDrag:aTwoArgDragBlock in:aView at:p atEnd:aFourArgEndBlock |
535 |
"start a generic (caller-provided drag); |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
536 |
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
|
537 |
by inverting again). See startOpaqueDrag for another variant. |
348 | 538 |
the dragBlock, aTwoArgDragBlock will be called with two args |
539 |
aPoint and a drawingGC, to perform the drawing at some dragPoint. |
|
540 |
The drag starts in aView at point p. |
|
541 |
When finished, the endAction is called with four args: |
|
542 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
543 |
the dropPoint in root-coordinates and the dropPoint within the targetView" |
|
544 |
||
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
545 |
self catchEventsFrom:aView. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
546 |
motionAction := #doGenericDragX:y:. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
547 |
releaseAction := #endGenericDragX:y:. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
548 |
initialPoint := p. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
549 |
previousPoint := nil. |
348 | 550 |
dragBlock := aTwoArgDragBlock. |
551 |
dropAction := aFourArgEndBlock. |
|
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
552 |
|
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
553 |
"Created: 26.10.1996 / 15:16:13 / cg" |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
554 |
"Modified: 19.4.1997 / 10:44:32 / cg" |
394 | 555 |
! |
556 |
||
557 |
startOpaqueDrag:aTwoArgDragBlock offset:offs extent:ext in:aView at:p atEnd:aFourArgEndBlock |
|
558 |
"start a generic opaque (caller-provided drag); |
|
559 |
opaque drag means, that the drawing cannot be undone by two inverting |
|
560 |
draws, but instead, the area under the dragged object must be saved |
|
561 |
and restored. The areas size to be saved/restored is passed in ext. |
|
562 |
the dragBlock, aTwoArgDragBlock will be called with two args |
|
563 |
aPoint and a drawingGC, to perform the drawing at some dragPoint. |
|
564 |
The drag starts in aView at point p. |
|
565 |
When finished, the endAction is called with four args: |
|
566 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
567 |
the dropPoint in root-coordinates and the dropPoint within the targetView" |
|
568 |
||
569 |
self catchEventsFrom:aView. |
|
570 |
motionAction := #doGenericDragX:y:. |
|
571 |
releaseAction := #endGenericDragX:y:. |
|
572 |
initialPoint := p. |
|
573 |
previousPoint := nil. |
|
574 |
dragBlock := aTwoArgDragBlock. |
|
575 |
dropAction := aFourArgEndBlock. |
|
576 |
opaque := true. |
|
577 |
dragSize := ext. |
|
578 |
dragOffset := offs. |
|
579 |
||
580 |
"Modified: 26.10.1996 / 15:09:26 / cg" |
|
581 |
"Created: 26.10.1996 / 15:16:13 / cg" |
|
582 |
||
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
583 |
! ! |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
584 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
585 |
!DragAndDropManager methodsFor:'dragging - generic - inverting'! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
586 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
587 |
invertGenericAt:ip |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
588 |
"draw for a generic inverting drag" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
589 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
590 |
|t offs p rootView| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
591 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
592 |
rootView := dragView device rootView. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
593 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
594 |
(p := lastScreenPosition) isNil ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
595 |
p := ip. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
596 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
597 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
598 |
get device coordinates |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
599 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
600 |
(t := dragView transformation) notNil ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
601 |
p := t applyTo:p. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
602 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
603 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
604 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
605 |
translate to screen |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
606 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
607 |
offs := dragView device |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
608 |
translatePoint:0@0 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
609 |
from:(dragView id) to:(rootView id). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
610 |
p := p + offs. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
611 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
612 |
lastScreenPosition := p. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
613 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
614 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
615 |
rootView clippedByChildren:false. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
616 |
rootView xoring:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
617 |
rootView lineWidth:0. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
618 |
self callForDragActionAt:p in:rootView. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
619 |
rootView flush |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
620 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
621 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
622 |
"Created: 26.10.1996 / 15:15:26 / cg" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
623 |
"Modified: 19.4.1997 / 11:35:33 / cg" |
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 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
626 |
!DragAndDropManager methodsFor:'dragging - generic - opaque'! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
627 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
628 |
drawGenericAt:ip |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
629 |
"draw for a generic opaque drag" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
630 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
631 |
|t offs p rootView szX szY| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
632 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
633 |
rootView := dragView device rootView. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
634 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
635 |
p := ip. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
636 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
637 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
638 |
"/ get device coordinates |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
639 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
640 |
(t := dragView transformation) notNil ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
641 |
p := t applyTo:p. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
642 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
643 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
644 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
645 |
"/ translate to screen |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
646 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
647 |
offs := dragView device |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
648 |
translatePoint:0@0 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
649 |
from:(dragView id) to:(rootView id). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
650 |
p := p + offs. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
651 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
652 |
rootView clippedByChildren:false. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
653 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
654 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
655 |
"/ copy from screen to saveUnder |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
656 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
657 |
szX := dragSize x. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
658 |
szY := dragSize y. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
659 |
saveUnder isNil ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
660 |
saveUnder := Form |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
661 |
width:szX |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
662 |
height:szY |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
663 |
depth:rootView device depth |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
664 |
on:dragView device. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
665 |
saveUnder clippedByChildren:false. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
666 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
667 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
668 |
lastScreenPosition := p - dragOffset. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
669 |
saveUnder |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
670 |
copyFrom:rootView |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
671 |
x:lastScreenPosition x |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
672 |
y:lastScreenPosition y |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
673 |
toX:0 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
674 |
y:0 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
675 |
width:szX |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
676 |
height:szY. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
677 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
678 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
679 |
"/ draw using the dragAction block |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
680 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
681 |
rootView lineWidth:0. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
682 |
self callForDragActionAt:p in:rootView. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
683 |
rootView flush |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
684 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
685 |
"Modified: 19.4.1997 / 10:45:48 / cg" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
686 |
! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
687 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
688 |
restoreGenericAt:ip |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
689 |
"restore from saveUnder for a generic opaque drag" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
690 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
691 |
|rootView| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
692 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
693 |
rootView := dragView device rootView. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
694 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
695 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
696 |
"/ copy from saveUnder back to screen |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
697 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
698 |
rootView clippedByChildren:false. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
699 |
rootView |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
700 |
copyFrom:saveUnder |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
701 |
x:0 y:0 |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
702 |
toX:lastScreenPosition x y:lastScreenPosition y |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
703 |
width:dragSize x |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
704 |
height:dragSize y. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
705 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
706 |
"Modified: 19.4.1997 / 10:46:39 / cg" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
707 |
! ! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
708 |
|
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
709 |
!DragAndDropManager methodsFor:'dragging - lines'! |
341 | 710 |
|
711 |
doLineDragX:x y:y |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
712 |
"do a line drag - invert previous and draw at new position" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
713 |
|
341 | 714 |
previousPoint notNil ifTrue:[ |
715 |
self invertLineFrom:initialPoint to:previousPoint |
|
716 |
]. |
|
717 |
previousPoint := x @ y. |
|
718 |
self invertLineFrom:initialPoint to:previousPoint |
|
719 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
720 |
"Modified: 19.4.1997 / 12:39:43 / cg" |
341 | 721 |
! |
722 |
||
723 |
endLineDragX:x y:y |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
724 |
"end a line drag - invert previous, deinstall event catcher |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
725 |
and call for endDrag action" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
726 |
|
341 | 727 |
previousPoint notNil ifTrue:[ |
728 |
self invertLineFrom:initialPoint to:previousPoint |
|
729 |
]. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
730 |
|
341 | 731 |
previousPoint := nil. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
732 |
dragView device sync. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
733 |
|
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
734 |
self uncatchEvents. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
735 |
self endDragAt:x @ y. |
341 | 736 |
|
737 |
"Created: 26.10.1996 / 15:17:20 / cg" |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
738 |
"Modified: 19.4.1997 / 12:40:14 / cg" |
341 | 739 |
! |
740 |
||
741 |
invertLineFrom:ip1 to:ip2 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
742 |
"invert for a line drag" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
743 |
|
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
744 |
|t offs p1 p2 rootView a| |
341 | 745 |
|
746 |
rootView := dragView device rootView. |
|
747 |
||
748 |
p1 := ip1. |
|
749 |
p2 := ip2. |
|
750 |
||
751 |
" |
|
752 |
get device coordinates |
|
753 |
" |
|
754 |
(t := dragView transformation) notNil ifTrue:[ |
|
755 |
p1 := t applyTo:p1. |
|
756 |
p2 := t applyTo:p2. |
|
757 |
]. |
|
758 |
||
759 |
" |
|
760 |
translate to screen |
|
761 |
" |
|
762 |
offs := dragView device |
|
763 |
translatePoint:0@0 |
|
764 |
from:(dragView id) to:(rootView id). |
|
765 |
p1 := p1 + offs. |
|
766 |
p2 := p2 + offs. |
|
767 |
||
768 |
rootView clippedByChildren:false. |
|
769 |
rootView xoring:[ |
|
770 |
rootView lineWidth:0. |
|
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
771 |
lineMode == #arrow ifTrue:[ |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
772 |
a := Arrow from:p1 to:p2. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
773 |
a arrowHeadLength:(rootView device horizontalPixelPerMillimeter * 4) rounded. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
774 |
a displayFilledOn:rootView. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
775 |
] ifFalse:[ |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
776 |
rootView displayLineFrom:p1 to:p2. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
777 |
]. |
341 | 778 |
rootView flush |
779 |
]. |
|
780 |
||
781 |
"Created: 26.10.1996 / 15:15:26 / cg" |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
782 |
"Modified: 19.4.1997 / 12:40:29 / cg" |
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
783 |
! |
341 | 784 |
|
345 | 785 |
startArrowDragIn:aView at:p atEnd:aBlock |
348 | 786 |
"start a line-drag of an arrow-line. |
787 |
The drag starts in aView at point p. |
|
788 |
When finished, the endAction is called with four args: |
|
789 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
790 |
the dropPoint in root-coordinates and the dropPoint within the targetView" |
|
791 |
||
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
792 |
self catchEventsFrom:aView. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
793 |
motionAction := #doLineDragX:y:. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
794 |
releaseAction := #endLineDragX:y:. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
795 |
initialPoint := p. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
796 |
previousPoint := nil. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
797 |
dragBlock := nil. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
798 |
lineMode := #arrow. |
345 | 799 |
dropAction := aBlock. |
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
800 |
|
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
801 |
"Modified: 26.10.1996 / 15:09:26 / cg" |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
802 |
"Created: 26.10.1996 / 15:16:13 / cg" |
394 | 803 |
|
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
804 |
! |
341 | 805 |
|
348 | 806 |
startLineDragIn:aView at:p atEnd:aFourArgEndBlock |
807 |
"start a line-drag of a normal line. |
|
808 |
The drag starts in aView at point p. |
|
809 |
When finished, the endAction is called with four args: |
|
810 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
811 |
the dropPoint in root-coordinates and the dropPoint within the targetView" |
|
812 |
||
341 | 813 |
self catchEventsFrom:aView. |
814 |
motionAction := #doLineDragX:y:. |
|
815 |
releaseAction := #endLineDragX:y:. |
|
816 |
initialPoint := p. |
|
342
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
817 |
previousPoint := nil. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
818 |
dragBlock := nil. |
7563cbf04502
added genericDrag & arrowDrag
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
819 |
lineMode := nil. |
348 | 820 |
dropAction := aFourArgEndBlock. |
341 | 821 |
|
822 |
"Modified: 26.10.1996 / 15:09:26 / cg" |
|
823 |
"Created: 26.10.1996 / 15:16:13 / cg" |
|
394 | 824 |
|
341 | 825 |
! ! |
826 |
||
397 | 827 |
!DragAndDropManager methodsFor:'drawing'! |
828 |
||
829 |
showDragging:items in:aView at:p |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
830 |
"helper for dragging dragObjects: draw them all" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
831 |
|
397 | 832 |
|offs| |
833 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
834 |
offs := 0. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
835 |
items do:[:item | |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
836 |
item displayOn:aView at:p + (0@offs). |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
837 |
offs := offs + (item heightOn:self) |
397 | 838 |
] |
839 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
840 |
"Modified: 19.4.1997 / 12:41:24 / cg" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
841 |
! ! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
842 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
843 |
!DragAndDropManager methodsFor:'dropping'! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
844 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
845 |
drop:something in:targetView at:aPoint from:sourceView ifOk:okAction ifFail:failAction |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
846 |
"try to drop some object in a targetView; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
847 |
if any view along the targetViews superView chain takes it, |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
848 |
the okAction is evaluated; if not, failAction is evaluated. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
849 |
This may be sent from a drag initiators endDrag block." |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
850 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
851 |
|v pnt| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
852 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
853 |
v := targetView. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
854 |
pnt := aPoint. |
397 | 855 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
856 |
[v notNil] whileTrue:[ |
628 | 857 |
(self askIfCanDrop:something in:v) ifTrue:[ |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
858 |
v |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
859 |
drop:something |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
860 |
at:aPoint |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
861 |
from:sourceView |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
862 |
with:[:o | okAction. ^ true] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
863 |
ifFail:[:o | failAction. ^ false]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
864 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
865 |
v := v superView. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
866 |
pnt := nil |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
867 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
868 |
failAction value. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
869 |
^ false |
397 | 870 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
871 |
"Modified: 19.4.1997 / 12:42:36 / cg" |
397 | 872 |
! ! |
873 |
||
874 |
!DragAndDropManager methodsFor:'easy drag & drop'! |
|
875 |
||
861 | 876 |
startDrag:anObjectOrCollection from:aView offset:anOffset |
397 | 877 |
"start a drop at the current pointer position" |
878 |
||
861 | 879 |
self startDrag:anObjectOrCollection from:aView offset:anOffset atEnd:nil |
880 |
||
881 |
! |
|
882 |
||
883 |
startDrag:anObjectOrCollection from:aView offset:anOffset atEnd:aFourArgEndBlock |
|
884 |
"start a drop at the current pointer position. |
|
885 |
When finished, the endAction is called with four args: |
|
886 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
887 |
the dropPoint in root-coordinates and the dropPoint within the targetView" |
|
888 |
||
889 |
||
890 |
|x y pos displayObjects device width height| |
|
397 | 891 |
|
892 |
self dropObjects:anObjectOrCollection. |
|
893 |
||
894 |
device := aView device. |
|
895 |
pos := device translatePoint:(device pointerPosition) |
|
896 |
from:(device rootView id) |
|
897 |
to:(aView id). |
|
898 |
||
899 |
displayObjects := dropObjects collect:[:each | each displayObject on:device]. |
|
900 |
height := displayObjects inject:0 into:[:sum :each | sum + (each heightOn:aView)]. |
|
901 |
width := displayObjects inject:0 into:[:max :each | max max:(each widthOn:aView)]. |
|
902 |
||
861 | 903 |
x := anOffset x. |
904 |
y := anOffset y. |
|
905 |
||
906 |
(displayObjects at:1) class == LabelAndIcon ifTrue:[ |
|
907 |
y := y + aView font ascent. |
|
908 |
width := width * 2. |
|
909 |
]. |
|
910 |
||
911 |
self startOpaqueDrag:[:aPoint :aView|self showDragging:displayObjects in:aView at:(aPoint - anOffset)] |
|
912 |
offset:(x @ y) |
|
397 | 913 |
extent:(width @ height) |
914 |
in:aView |
|
915 |
at:pos |
|
861 | 916 |
atEnd:aFourArgEndBlock. |
917 |
||
918 |
! |
|
919 |
||
920 |
startDrag:anObjectOrCollection from:aView offset:anOffset atEnd:aFourArgEndBlock useIcon:anIcon |
|
921 |
"start a drop at the current pointer position. |
|
922 |
When finished, the endAction is called with four args: |
|
923 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
924 |
the dropPoint in root-coordinates and the dropPoint within the targetView" |
|
925 |
||
926 |
||
927 |
|pos displayObjects device| |
|
928 |
||
929 |
self dropObjects:anObjectOrCollection. |
|
930 |
||
931 |
device := aView device. |
|
932 |
pos := device translatePoint:(device pointerPosition) |
|
933 |
from:(device rootView id) |
|
934 |
to:(aView id). |
|
935 |
||
936 |
displayObjects := Array with:(anIcon on:device). |
|
937 |
||
938 |
self startOpaqueDrag:[:aPoint :aView|self showDragging:displayObjects in:aView at:(aPoint - anOffset)] |
|
939 |
offset:anOffset |
|
940 |
extent:(anIcon extent) |
|
941 |
in:aView |
|
942 |
at:pos |
|
943 |
atEnd:aFourArgEndBlock. |
|
944 |
||
945 |
! |
|
946 |
||
947 |
startDrag:anObjectOrCollection from:aView offset:anOffset useIcon:anIcon |
|
948 |
"start a drop at the current pointer position. |
|
949 |
When finished, the endAction is called with four args: |
|
950 |
the targetView, the targetViews windowID (useful, if its an alien view), |
|
951 |
the dropPoint in root-coordinates and the dropPoint within the targetView" |
|
952 |
||
953 |
self startDrag:anObjectOrCollection from:aView offset:anOffset atEnd:nil useIcon:anIcon |
|
397 | 954 |
! ! |
955 |
||
341 | 956 |
!DragAndDropManager methodsFor:'event catching'! |
957 |
||
958 |
buttonMotion:button x:x y:y view:aView |
|
959 |
self perform:motionAction with:x with:y |
|
960 |
||
961 |
"Created: 26.10.1996 / 15:09:00 / cg" |
|
394 | 962 |
|
963 |
||
341 | 964 |
! |
965 |
||
966 |
buttonRelease:button x:x y:y view:aView |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
967 |
self perform:releaseAction with:x with:y. |
394 | 968 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
969 |
"Modified: 19.4.1997 / 12:37:02 / cg" |
341 | 970 |
! |
971 |
||
972 |
handlesButtonMotion:button inView:aView |
|
973 |
"query from event processor: am I interested in button-events ? |
|
974 |
yes I am (to activate the clicked-on field)." |
|
975 |
||
976 |
^ aView == dragView |
|
977 |
||
978 |
"Created: 26.10.1996 / 15:05:36 / cg" |
|
394 | 979 |
|
341 | 980 |
! |
981 |
||
982 |
handlesButtonRelease:button inView:aView |
|
983 |
"query from event processor: am I interested in button-events ? |
|
984 |
yes I am (to activate the clicked-on field)." |
|
985 |
||
986 |
^ aView == dragView |
|
987 |
||
988 |
"Created: 26.10.1996 / 15:05:48 / cg" |
|
394 | 989 |
|
341 | 990 |
! ! |
991 |
||
992 |
!DragAndDropManager methodsFor:'private'! |
|
993 |
||
628 | 994 |
askIfCanDrop:dropObjects in:aView |
995 |
|canDrop| |
|
996 |
||
997 |
DragOriginatorQuerySignal answer:dragView do:[ |
|
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
998 |
DragOffsetQuerySignal answer:dragOffset do:[ |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
999 |
canDrop := aView canDrop:dropObjects |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1000 |
]. |
628 | 1001 |
]. |
1002 |
^ canDrop |
|
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1003 |
|
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1004 |
"Modified: 11.8.1997 / 00:55:10 / cg" |
628 | 1005 |
! |
1006 |
||
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1007 |
callForDragActionAt:aPoint in:aView |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1008 |
"evaluate the user supplied dragAction. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1009 |
Look how many args it expects and invoke with |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1010 |
position |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1011 |
dragView |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1012 |
dragObjects" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1013 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1014 |
|numArgs| |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1015 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1016 |
(numArgs := dragBlock numArgs) == 1 ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1017 |
dragBlock value:aPoint |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1018 |
] ifFalse:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1019 |
numArgs == 2 ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1020 |
dragBlock value:aPoint value:aView |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1021 |
] ifFalse:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1022 |
dragBlock value:aPoint value:aView value:dropObjects. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1023 |
] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1024 |
] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1025 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1026 |
"Created: 19.4.1997 / 10:05:55 / cg" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1027 |
! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1028 |
|
341 | 1029 |
catchEventsFrom:aView |
394 | 1030 |
dragView := aView. |
1031 |
saveCursor := dragView cursor. |
|
1032 |
||
341 | 1033 |
rememberedDelegate := aView delegate. |
394 | 1034 |
aView delegate:self. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1035 |
aView device grabPointerInView:aView. |
341 | 1036 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1037 |
"Modified: 19.4.1997 / 12:36:04 / cg" |
394 | 1038 |
! |
1039 |
||
1040 |
destinationViewAt:ip |
|
1041 |
|rootPoint t viewId offs destinationId lastViewId destinationView |
|
1042 |
rootView destinationPoint device| |
|
1043 |
||
1044 |
device := dragView device. |
|
1045 |
rootView := device rootView. |
|
1046 |
rootPoint := ip. |
|
1047 |
||
1048 |
" |
|
1049 |
get device coordinates |
|
1050 |
" |
|
1051 |
(t := dragView transformation) notNil ifTrue:[ |
|
1052 |
rootPoint := t applyTo:ip. |
|
1053 |
]. |
|
1054 |
viewId := rootView id. |
|
1055 |
||
1056 |
" |
|
1057 |
translate to screen |
|
1058 |
" |
|
1059 |
offs := device translatePoint:0@0 from:(dragView id) to:viewId. |
|
1060 |
rootPoint := rootPoint + offs. |
|
1061 |
||
1062 |
"search view the drop is in" |
|
1063 |
||
1064 |
[viewId notNil] whileTrue:[ |
|
1065 |
destinationId := device viewIdFromPoint:rootPoint in:viewId. |
|
1066 |
lastViewId := viewId. |
|
1067 |
viewId := destinationId |
|
1068 |
]. |
|
1069 |
^ device viewFromId:lastViewId |
|
341 | 1070 |
! |
1071 |
||
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1072 |
endDragAt:ip |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1073 |
|rootPoint t rootId viewId offs destinationId lastViewId destinationView |
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1074 |
rootView destinationPoint device| |
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1075 |
|
394 | 1076 |
dragView cursor:saveCursor now:true. |
1077 |
device := dragView device. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1078 |
device ungrabPointer. |
394 | 1079 |
rootView := device rootView. |
1080 |
rootPoint := ip. |
|
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1081 |
|
394 | 1082 |
" |
1083 |
get device coordinates |
|
1084 |
" |
|
1085 |
(t := dragView transformation) notNil ifTrue:[ |
|
1086 |
rootPoint := t applyTo:ip. |
|
1087 |
]. |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1088 |
viewId := rootId := rootView id. |
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1089 |
|
394 | 1090 |
" |
1091 |
translate to screen |
|
1092 |
" |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1093 |
offs := device translatePoint:0@0 from:(dragView id) to:rootId. |
394 | 1094 |
rootPoint := rootPoint + offs. |
1095 |
||
1096 |
"search view the drop is in" |
|
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1097 |
|
394 | 1098 |
[viewId notNil] whileTrue:[ |
1099 |
destinationId := device viewIdFromPoint:rootPoint in:viewId. |
|
1100 |
lastViewId := viewId. |
|
1101 |
viewId := destinationId |
|
1102 |
]. |
|
1103 |
destinationView := device viewFromId:lastViewId. |
|
1104 |
destinationId := lastViewId. |
|
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1105 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1106 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1107 |
"/ translate to destination view |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1108 |
"/ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1109 |
destinationPoint := device translatePoint:rootPoint from:rootId to:destinationId. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1110 |
|
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1111 |
"/ |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1112 |
"/ if the destinationView has a transformation, |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1113 |
"/ also translate to logical coordinates .. |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1114 |
"/ |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1115 |
destinationView notNil ifTrue:[ |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1116 |
(t := destinationView transformation) notNil ifTrue:[ |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1117 |
destinationPoint := t applyInverseTo:destinationPoint |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1118 |
] |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1119 |
]. |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1120 |
|
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1121 |
"/ |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1122 |
"/ if this dragOperation has an explicit dropAction, |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1123 |
"/ perform it. |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1124 |
"/ |
513 | 1125 |
dropAction notNil ifTrue:[ |
1126 |
"/ initiator wants to do it himself, manually. |
|
1127 |
||
1128 |
dropAction value:destinationView |
|
1129 |
value:destinationId |
|
1130 |
value:rootPoint |
|
1131 |
value:destinationPoint. |
|
1132 |
^ self |
|
1133 |
]. |
|
1134 |
||
1135 |
"/ default drop behavior: |
|
1136 |
"/ if its one of my own views, ask if dropping is ok. |
|
1137 |
"/ if not, ask the device to drop it. |
|
1138 |
||
394 | 1139 |
destinationView notNil ifTrue:[ |
513 | 1140 |
"/ |
1141 |
"/ one of my views |
|
1142 |
"/ |
|
1143 |
||
628 | 1144 |
DragOriginatorQuerySignal answer:dragView do:[ |
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1145 |
DragOffsetQuerySignal answer:dragOffset do:[ |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1146 |
"/ |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1147 |
"/ see if the view itself can drop that stuff ... |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1148 |
"/ |
628 | 1149 |
(destinationView canDrop:dropObjects) ifTrue:[ |
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1150 |
destinationView drop:dropObjects at:destinationPoint. |
628 | 1151 |
^ self. |
1152 |
]. |
|
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1153 |
|
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1154 |
"/ |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1155 |
"/ try superViews along the chain ... |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1156 |
"/ |
628 | 1157 |
destinationView := destinationView superView. |
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1158 |
[destinationView notNil] whileTrue:[ |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1159 |
(destinationView canDrop:dropObjects) ifTrue:[ |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1160 |
destinationView drop:dropObjects at:nil. |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1161 |
^ self. |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1162 |
]. |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1163 |
destinationView := destinationView superView. |
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1164 |
]. |
628 | 1165 |
]. |
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1166 |
]. |
394 | 1167 |
^ self |
1168 |
]. |
|
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1169 |
|
513 | 1170 |
"/ |
1171 |
"/ not one of my views |
|
1172 |
"/ |
|
1173 |
||
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1174 |
"/ external clipboard mechanism via display |
513 | 1175 |
device |
1176 |
drop:dropObjects |
|
1177 |
inWindowID:destinationId |
|
1178 |
position:destinationPoint |
|
1179 |
rootPosition:rootPoint |
|
1180 |
||
680
6157661790fd
keep dragOffset - provide querySignal
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1181 |
"Modified: 11.8.1997 / 00:55:41 / cg" |
346
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1182 |
! |
1612c23d9c5d
pass all dropInfo to an end-action
Claus Gittinger <cg@exept.de>
parents:
345
diff
changeset
|
1183 |
|
341 | 1184 |
uncatchEvents |
1185 |
dragView delegate:rememberedDelegate. |
|
1186 |
||
1187 |
"Created: 26.10.1996 / 15:22:29 / cg" |
|
394 | 1188 |
|
411 | 1189 |
" |
1190 |
DragAndDropManager allInstancesDo:[:m | |
|
1191 |
m uncatchEvents |
|
1192 |
] |
|
1193 |
" |
|
341 | 1194 |
! ! |
1195 |
||
628 | 1196 |
!DragAndDropManager::DemoView class methodsFor:'documentation'! |
1197 |
||
1198 |
documentation |
|
1199 |
" |
|
1200 |
demonstrates rubber-line dragging. |
|
1201 |
||
1202 |
See the buttonPress method, where a drag is initiated. |
|
1203 |
At endDrop, look at the transcript. |
|
1204 |
||
1205 |
[author:] |
|
1206 |
Claus Gittinger |
|
1207 |
||
1208 |
[start with:] |
|
1209 |
DemoView new open |
|
1210 |
" |
|
1211 |
! ! |
|
1212 |
||
1213 |
!DragAndDropManager::DemoView methodsFor:'events'! |
|
1214 |
||
1215 |
buttonPress:button x:x y:y |
|
1216 |
DragAndDropManager new |
|
1217 |
startLineDragIn:self at:(x@y) |
|
1218 |
atEnd:[:view |
|
1219 |
:viewID |
|
1220 |
:rootPoint |
|
1221 |
:viewPoint | |
|
1222 |
||
1223 |
Transcript show:'dropped at '; |
|
1224 |
show:viewPoint; |
|
1225 |
show:' (screen: '; |
|
1226 |
show:rootPoint; |
|
1227 |
show:') in '. |
|
1228 |
view notNil ifTrue:[ |
|
1229 |
Transcript showCR:view |
|
1230 |
] ifFalse:[ |
|
1231 |
Transcript show:'alien view '; |
|
1232 |
showCR:viewID address |
|
1233 |
] |
|
1234 |
]. |
|
1235 |
||
1236 |
" |
|
1237 |
self new open |
|
1238 |
" |
|
1239 |
||
1240 |
"Modified: 19.4.1997 / 11:40:46 / cg" |
|
1241 |
! ! |
|
1242 |
||
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1243 |
!DragAndDropManager::DemoView2 class methodsFor:'documentation'! |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1244 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1245 |
documentation |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1246 |
" |
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1247 |
demonstrates string dragging. |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1248 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1249 |
See the buttonPress method, where a drag is initiated. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1250 |
At endDrop, look at the transcript. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1251 |
|
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1252 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1253 |
[author:] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1254 |
Claus Gittinger |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1255 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1256 |
[start with:] |
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1257 |
DemoView2 new open |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1258 |
" |
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1259 |
|
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1260 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1261 |
! ! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1262 |
|
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1263 |
!DragAndDropManager::DemoView2 methodsFor:'events'! |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1264 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1265 |
buttonPress:button x:x y:y |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1266 |
DragAndDropManager new |
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1267 |
startGenericDrag:[:p :v | v displayString:'hello' at:p] |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1268 |
in:self |
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1269 |
at:(x@y) |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1270 |
atEnd:[:view |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1271 |
:viewID |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1272 |
:rootPoint |
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1273 |
:viewPoint | ] |
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1274 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1275 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1276 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1277 |
self new open |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1278 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1279 |
|
609
1343bda17876
pass logical coordinates to dropAction.
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
1280 |
|
548
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1281 |
! ! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1282 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1283 |
!DragAndDropManager::DemoView3 class methodsFor:'documentation'! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1284 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1285 |
documentation |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1286 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1287 |
demonstrates arrow-line dragging. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1288 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1289 |
See the buttonPress method, where a drag is initiated. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1290 |
At endDrop, look at the transcript. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1291 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1292 |
[author:] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1293 |
Claus Gittinger |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1294 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1295 |
[start with:] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1296 |
DemoView3 new open |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1297 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1298 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1299 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1300 |
! ! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1301 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1302 |
!DragAndDropManager::DemoView3 methodsFor:'events'! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1303 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1304 |
buttonPress:button x:x y:y |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1305 |
DragAndDropManager new |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1306 |
startArrowDragIn:self |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1307 |
at:(x@y) |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1308 |
atEnd:[:view |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1309 |
:viewID |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1310 |
:rootPoint |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1311 |
:viewPoint | |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1312 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1313 |
Transcript show:'dropped at '; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1314 |
show:viewPoint; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1315 |
show:' (screen: '; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1316 |
show:rootPoint; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1317 |
show:') in '. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1318 |
view notNil ifTrue:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1319 |
Transcript showCR:view |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1320 |
] ifFalse:[ |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1321 |
Transcript show:'alien view '; |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1322 |
showCR:viewID address |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1323 |
] |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1324 |
]. |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1325 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1326 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1327 |
self new open |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1328 |
" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1329 |
|
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1330 |
"Modified: 19.4.1997 / 12:45:29 / cg" |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1331 |
! ! |
1a81d6be65b4
added comments & docu, examples.
Claus Gittinger <cg@exept.de>
parents:
515
diff
changeset
|
1332 |
|
341 | 1333 |
!DragAndDropManager class methodsFor:'documentation'! |
1334 |
||
1335 |
version |
|
861 | 1336 |
^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.18 1998-03-09 16:06:35 ca Exp $' |
341 | 1337 |
! ! |
628 | 1338 |
DragAndDropManager initialize! |