Add disabled flag. If enabled (=true) the handling of button motion
authorab
Mon, 30 May 2005 18:38:33 +0200
changeset 2042 00fd3e50afdd
parent 2041 fd1527246662
child 2043 72801901ff1c
Add disabled flag. If enabled (=true) the handling of button motion events will be suppressed until it is set to false again. Default is disabled (nil).
DragAndDropManager.st
--- a/DragAndDropManager.st	Wed May 04 10:16:17 2005 +0200
+++ b/DragAndDropManager.st	Mon May 30 18:38:33 2005 +0200
@@ -16,7 +16,7 @@
 Object subclass:#DragAndDropManager
 	instanceVariableNames:'dropContext dragView dropAction dragOffset handler restoreBlock
 		alienCursor enabledCursor disabledCursor canDrop escapePressed
-		passiveAction autoScrollTask'
+		passiveAction autoScrollTask disabledFlag'
 	classVariableNames:'DragContextQuerySignal DragOriginatorQuerySignal
 		DragOffsetQuerySignal ActiveDragAndDropManagers'
 	poolDictionaries:''
@@ -279,6 +279,33 @@
 
 !DragAndDropManager class methodsFor:'helpers'!
 
+disabledFlag:aBoolean device:aDevice
+    |activeManager|
+
+    activeManager := ActiveDragAndDropManagers at:aDevice ifAbsent:nil.
+    activeManager notNil ifTrue:[
+        activeManager disabledFlag: aBoolean
+    ].
+!
+
+postDraggingOnDevice:aDevice
+    |activeManager|
+
+    activeManager := ActiveDragAndDropManagers at:aDevice ifAbsent:nil.
+    activeManager notNil ifTrue:[
+        activeManager dragHandler postDragging
+    ].
+!
+
+rereadSaveAreaOnDevice:aDevice
+    |activeManager|
+
+    activeManager := ActiveDragAndDropManagers at:aDevice ifAbsent:nil.
+    activeManager notNil ifTrue:[
+        activeManager dragHandler flushSaveArea; rereadSaveArea
+    ].
+!
+
 saveDraw:aBlock device:aDevice
     |activeManager|
 
@@ -719,6 +746,14 @@
 
 !
 
+disabledFlag
+    ^ disabledFlag ? false
+!
+
+disabledFlag:something
+    disabledFlag := something.
+!
+
 dragHandler
     "returns the current active handler which is responsible for drawing ..."
 
@@ -1127,6 +1162,9 @@
 buttonMotion:button x:x y:y view:aView
     |device screenPoint oldWg oldId oldPt newId newWg oldTgt newTgt isDroppable cursor|
 
+    self disabledFlag ifTrue: [
+        ^ self
+    ].
     escapePressed == true ifTrue:[
         self removePassiveAction.
         ^ self
@@ -1518,7 +1556,7 @@
 !DragAndDropManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.59 2004-11-20 12:05:16 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.60 2005-05-30 16:38:33 ab Exp $'
 ! !
 
 DragAndDropManager initialize!