draw tabulatorLine on the tootView; do not use a SimpleView
authorClaus Gittinger <cg@exept.de>
Sun, 29 Aug 1999 16:28:56 +0200
changeset 1494 096845be5d75
parent 1493 045378a0c25e
child 1495 edd56c071260
draw tabulatorLine on the tootView; do not use a SimpleView
DSVLabelView.st
--- a/DSVLabelView.st	Sat Aug 28 19:21:34 1999 +0200
+++ b/DSVLabelView.st	Sun Aug 29 16:28:56 1999 +0200
@@ -15,15 +15,15 @@
 
 
 SimpleView subclass:#DSVLabelView
-	instanceVariableNames:'isVisible dataSet tabulator columns selection enabled
+	instanceVariableNames:'isVisible dataSet lineDrag columns selection enabled
 		preferredHeight'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-DataSet'
 !
 
-SimpleView subclass:#Tabulator
-	instanceVariableNames:'column colRight startX transX minRqX'
+Object subclass:#LineDrag
+	instanceVariableNames:'rootView topX topY botY column minX startX transX'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:DSVLabelView
@@ -213,7 +213,7 @@
      redraw thumb at its new position and, if scroll-mode is asynchronous, 
      the scroll action is performed
     "
-    tabulator notNil ifTrue:[tabulator moveToX:x]
+    lineDrag notNil ifTrue:[lineDrag moveToX:x]
 
 
 !
@@ -239,9 +239,13 @@
                     self invalidateItemAt:(selection := index)
                 ]
             ] ifTrue:[
-                tabulator := Tabulator new. 
-                tabulator column:aCol colRight:x1.
-                tabulator openFor:self x:x y:0 h:(self superView height)
+                lineDrag := LineDrag new.
+                lineDrag column:aCol
+                              x:x
+                              y:margin
+                              h:(self height + dataSet height)
+                           minX:(x1 - aCol width + aCol minimumRequiredWidth)
+                             on:self
             ].
             ^ self
         ].
@@ -256,11 +260,11 @@
     |selected index column deltaX|
 
     selection isNil ifTrue:[
-        tabulator notNil ifTrue:[
-            column := tabulator column.
-            deltaX := tabulator deltaX.
-            tabulator destroy.
-            tabulator := nil.
+        lineDrag notNil ifTrue:[
+            lineDrag invertLine.
+            column   := lineDrag column.
+            deltaX   := lineDrag deltaX.
+            lineDrag := nil.
 
             deltaX abs > 2 ifTrue:[
                 dataSet changeWidthOfColumn:column deltaX:deltaX
@@ -368,7 +372,7 @@
     ]
 ! !
 
-!DSVLabelView::Tabulator methodsFor:'accessing'!
+!DSVLabelView::LineDrag methodsFor:'accessing'!
 
 column
     "return the value of the instance variable 'column' (automatically generated)"
@@ -378,58 +382,56 @@
 deltaX
     "returns the distance x between the start and end action
     "
-    ^ self origin x - startX
+    ^ topX - startX
 ! !
 
-!DSVLabelView::Tabulator methodsFor:'dimension'!
-
-moveToX:x
-    |ogX org|
+!DSVLabelView::LineDrag methodsFor:'dragging'!
 
-    ogX := (minRqX max:x) + transX.
-    org := self origin.
+invertLine
+    "invert for a line
+    "
+    rootView clippedByChildren:false.
 
-    org x ~~ ogX ifTrue:[
-        org x:ogX.
-        self origin:org.
-    ]
-
+    rootView xoring:[
+        rootView lineWidth:2.
+        rootView displayLineFromX:topX y:topY toX:topX y:botY.
+        rootView flush
+    ]    
 !
 
-openFor:aView x:x y:y h:h
-    |pnt dev w|
+moveToX:viewX
+    |x|
 
-    dev := aView device.
-    pnt := dev translatePoint:(x@y)
-                         from:(aView id)
-                           to:(dev rootView id).
+    x := (minX max:viewX) + transX.
 
-    minRqX := colRight - column width + column minimumRequiredWidth.
-    transX := pnt x - x.
-    startX := pnt x.
-
-    self origin:pnt extent:(2 @ h).
-    self backgroundColor:(Color black).
-    self openAndWait.
+    x == topX ifFalse:[
+        self invertLine.
+        topX := x.
+        self invertLine.
+    ]
 ! !
 
-!DSVLabelView::Tabulator methodsFor:'initialization'!
+!DSVLabelView::LineDrag methodsFor:'setup'!
 
-column:aColumn colRight:x
-    colRight := x.
-    column   := aColumn.
-!
+column:aColumn x:x y:y h:h minX:aMinX on:aView
+    |device point|
 
-isPopUpView
-    "return true if view is a popup view; without decoration
-     and popUp to top immediately
-    "
-    ^ true
+    column   := aColumn.
+    device   := aView device.
+    rootView := device rootView.
+    point    := device translatePoint:(x@y) from:(aView id) to:(rootView id).
+    topX     := point x.
+    topY     := point y.
+    botY     := topY + h.
+    minX     := aMinX.
+    startX   := topX.
+    transX   := topX - x.
 
+    self invertLine.
 ! !
 
 !DSVLabelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.26 1999-08-28 16:50:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.27 1999-08-29 14:28:56 cg Exp $'
 ! !