added passiveAction: invoked if staying over a dropItem for a while
authorClaus Gittinger <cg@exept.de>
Mon, 04 Nov 2002 15:29:55 +0100
changeset 1661 3092c6bac88e
parent 1660 a6e519a4b41f
child 1662 3ee5036d510c
added passiveAction: invoked if staying over a dropItem for a while
DragAndDropManager.st
--- a/DragAndDropManager.st	Thu Oct 31 18:51:09 2002 +0100
+++ b/DragAndDropManager.st	Mon Nov 04 15:29:55 2002 +0100
@@ -15,7 +15,8 @@
 
 Object subclass:#DragAndDropManager
 	instanceVariableNames:'dropContext dragView dropAction dragOffset handler restoreBlock
-		alienCursor enabledCursor disabledCursor canDrop escapePressed'
+		alienCursor enabledCursor disabledCursor canDrop escapePressed
+		passiveAction'
 	classVariableNames:'DragContextQuerySignal DragOriginatorQuerySignal
 		DragOffsetQuerySignal ActiveDragAndDropManagers'
 	poolDictionaries:''
@@ -737,6 +738,20 @@
 
 !
 
+passiveAction:aBlockOrNil
+    self removePassiveAction.
+    aBlockOrNil notNil ifTrue:[
+        passiveAction := Processor addTimedBlock:aBlockOrNil afterMilliseconds:100
+    ].
+!
+
+removePassiveAction
+    passiveAction notNil ifTrue:[
+        Processor removeTimeoutWithID:passiveAction.
+        passiveAction := nil.
+    ].
+!
+
 sourceWidget
     ^ dragView
 ! !
@@ -1093,6 +1108,8 @@
     "
     |oldPt oldTgt oldWg oldId newWg newId newTgt screenPoint cursor device isDroppable|
 
+    self removePassiveAction.
+
     escapePressed == true ifTrue:[^ self].
 
     device := dragView device.
@@ -1192,9 +1209,12 @@
 buttonRelease:button x:x y:y view:aView
     "button released; do the drop
     "
+
     ((button == 2) or:[button == #menu]) ifTrue:[
         ^ self
     ].
+
+    self removePassiveAction.
     "/
     "/ update the context
     "/
@@ -1462,7 +1482,7 @@
 !DragAndDropManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.43 2002-10-22 08:53:02 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.44 2002-11-04 14:29:55 cg Exp $'
 ! !
 
 DragAndDropManager initialize!