--- a/DragAndDropManager.st Thu Jun 26 07:54:49 1997 +0200
+++ b/DragAndDropManager.st Thu Jun 26 14:47:08 1997 +0200
@@ -16,9 +16,16 @@
rememberedDelegate dragBlock lineMode dropAction opaque saveUnder
dragSize dragOffset dropObjects saveCursor lastView
lastScreenPosition'
+ classVariableNames:'DragOriginatorQuerySignal'
+ poolDictionaries:''
+ category:'Interface-Support'
+!
+
+View subclass:#DemoView
+ instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
- category:'Interface-Support'
+ privateIn:DragAndDropManager
!
View subclass:#DemoView2
@@ -35,13 +42,6 @@
privateIn:DragAndDropManager
!
-View subclass:#DemoView
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:DragAndDropManager
-!
-
!DragAndDropManager class methodsFor:'documentation'!
copyright
@@ -220,6 +220,22 @@
"
! !
+!DragAndDropManager class methodsFor:'initialization'!
+
+initialize
+ DragOriginatorQuerySignal := QuerySignal new.
+
+ "
+ self initialize
+ "
+! !
+
+!DragAndDropManager class methodsFor:'Signal constants'!
+
+dragOriginatorQuerySignal
+ ^ DragOriginatorQuerySignal
+! !
+
!DragAndDropManager class methodsFor:'simple start'!
startArrowDragIn:aView at:dragPoint atEnd:aFourArgBlock
@@ -383,7 +399,7 @@
newCursor := Cursor questionMark
] ifFalse:[
"/ ST/X view - ask it.
- (view canDrop:dropObjects) ifTrue:[
+ (self askIfCanDrop:dropObjects in:view) ifTrue:[
newCursor := Cursor thumbsUp
] ifFalse:[
newCursor := Cursor thumbsDown
@@ -744,7 +760,7 @@
pnt := aPoint.
[v notNil] whileTrue:[
- (v canDrop:something) ifTrue:[
+ (self askIfCanDrop:something in:v) ifTrue:[
v
drop:something
at:aPoint
@@ -825,6 +841,15 @@
!DragAndDropManager methodsFor:'private'!
+askIfCanDrop:dropObjects in:aView
+ |canDrop|
+
+ DragOriginatorQuerySignal answer:dragView do:[
+ canDrop := aView canDrop:dropObjects
+ ].
+ ^ canDrop
+!
+
callForDragActionAt:aPoint in:aView
"evaluate the user supplied dragAction.
Look how many args it expects and invoke with
@@ -962,24 +987,26 @@
"/ one of my views
"/
- "/
- "/ see if the view itself can drop that stuff ...
- "/
- (destinationView canDrop:dropObjects) ifTrue:[
- destinationView drop:dropObjects at:destinationPoint.
- ^ self.
- ].
-
- "/
- "/ try superViews along the chain ...
- "/
- destinationView := destinationView superView.
- [destinationView notNil] whileTrue:[
+ DragOriginatorQuerySignal answer:dragView do:[
+ "/
+ "/ see if the view itself can drop that stuff ...
+ "/
(destinationView canDrop:dropObjects) ifTrue:[
- destinationView drop:dropObjects at:nil.
+ destinationView drop:dropObjects at:destinationPoint.
^ self.
].
+
+ "/
+ "/ try superViews along the chain ...
+ "/
destinationView := destinationView superView.
+ [destinationView notNil] whileTrue:[
+ (destinationView canDrop:dropObjects) ifTrue:[
+ destinationView drop:dropObjects at:nil.
+ ^ self.
+ ].
+ destinationView := destinationView superView.
+ ].
].
^ self
].
@@ -1010,6 +1037,53 @@
"
! !
+!DragAndDropManager::DemoView class methodsFor:'documentation'!
+
+documentation
+"
+ demonstrates rubber-line dragging.
+
+ See the buttonPress method, where a drag is initiated.
+ At endDrop, look at the transcript.
+
+ [author:]
+ Claus Gittinger
+
+ [start with:]
+ DemoView new open
+"
+! !
+
+!DragAndDropManager::DemoView methodsFor:'events'!
+
+buttonPress:button x:x y:y
+ DragAndDropManager new
+ startLineDragIn:self at:(x@y)
+ atEnd:[:view
+ :viewID
+ :rootPoint
+ :viewPoint |
+
+ Transcript show:'dropped at ';
+ show:viewPoint;
+ show:' (screen: ';
+ show:rootPoint;
+ show:') in '.
+ view notNil ifTrue:[
+ Transcript showCR:view
+ ] ifFalse:[
+ Transcript show:'alien view ';
+ showCR:viewID address
+ ]
+ ].
+
+ "
+ self new open
+ "
+
+ "Modified: 19.4.1997 / 11:40:46 / cg"
+! !
+
!DragAndDropManager::DemoView2 class methodsFor:'documentation'!
documentation
@@ -1100,55 +1174,9 @@
"Modified: 19.4.1997 / 12:45:29 / cg"
! !
-!DragAndDropManager::DemoView class methodsFor:'documentation'!
-
-documentation
-"
- demonstrates rubber-line dragging.
-
- See the buttonPress method, where a drag is initiated.
- At endDrop, look at the transcript.
-
- [author:]
- Claus Gittinger
-
- [start with:]
- DemoView new open
-"
-! !
-
-!DragAndDropManager::DemoView methodsFor:'events'!
-
-buttonPress:button x:x y:y
- DragAndDropManager new
- startLineDragIn:self at:(x@y)
- atEnd:[:view
- :viewID
- :rootPoint
- :viewPoint |
-
- Transcript show:'dropped at ';
- show:viewPoint;
- show:' (screen: ';
- show:rootPoint;
- show:') in '.
- view notNil ifTrue:[
- Transcript showCR:view
- ] ifFalse:[
- Transcript show:'alien view ';
- showCR:viewID address
- ]
- ].
-
- "
- self new open
- "
-
- "Modified: 19.4.1997 / 11:40:46 / cg"
-! !
-
!DragAndDropManager class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.15 1997-06-18 08:22:15 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.16 1997-06-26 12:47:08 ca Exp $'
! !
+DragAndDropManager initialize!