support sutoScroll during drag & drop
authorca
Tue, 28 Oct 2003 10:05:29 +0100
changeset 2575 fe15b02fbaf6
parent 2574 366e5807711f
child 2576 0ec2d4db2bc2
support sutoScroll during drag & drop
DSVColumnView.st
--- a/DSVColumnView.st	Sat Oct 25 15:04:04 2003 +0200
+++ b/DSVColumnView.st	Tue Oct 28 10:05:29 2003 +0100
@@ -1482,6 +1482,33 @@
 
 !
 
+dragAutoScroll:aContext
+    "called by the DragAndDropManager to scroll during a drag/drop operation
+     if necassery (decided by the widget itself); If a scroll is done return
+     true otherwise false (used to restore the background)
+    "
+    |yInset absLnNr y|
+
+    y := aContext targetPoint y.
+    yInset := margin + rowHeight.
+    y > yInset ifTrue:[
+        y >= (height - yInset) ifFalse:[^ false].
+    ].
+
+    absLnNr := self yVisibleToRowNr:y.
+    absLnNr isNil ifTrue:[^ false].
+
+    (absLnNr > 1 and:[absLnNr < self size]) ifFalse:[
+        ^ false
+    ].
+    aContext contentsWillChange.
+
+    y > yInset ifTrue:[self scrollDown:rowHeight]
+              ifFalse:[self scrollUp:rowHeight].
+
+    ^ true
+!
+
 dropSource
     "returns the dropSource or nil
     "
@@ -3871,5 +3898,5 @@
 !DSVColumnView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.173 2003-07-17 11:36:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.174 2003-10-28 09:05:29 ca Exp $'
 ! !