horizontal scrolling and documentation
authorca
Sat, 28 Sep 2002 08:20:29 +0200
changeset 2229 f1a236f5bd48
parent 2228 5268b9c3be4a
child 2230 8e2b53ecd71b
horizontal scrolling and documentation
HierarchicalListView.st
--- a/HierarchicalListView.st	Sat Sep 28 06:57:55 2002 +0200
+++ b/HierarchicalListView.st	Sat Sep 28 08:20:29 2002 +0200
@@ -77,6 +77,13 @@
         levelOfLastItem     <Integer>              keeps the level of the last item;
                                                    in case of a delete last items from list
                                                    we know were to redraw lines from
+
+        autoScrollHorizontal <Boolean>             true, than automatically scroll horizontal upto
+                                                   the text label of the current selected line.
+
+        expandOnSelect      <Boolean>              true, than the item selected by a buttonPress
+                                                   event will be immediately expanded.
+
     [author:]
         Claus Atzkern
 
@@ -513,8 +520,9 @@
         super lineChangedAt:aLnNr with:arg.
 
         (arg ~~ #redraw and:[widthOfContents notNil]) ifTrue:[
-            x0 := self xOfStringLevel:aLnNr.
-            x0 := x0 + (item widthOn:self) + 5.
+            x0 := (self xOfStringLevel:(item level))
+                + (item widthOn:self)
+                + (viewOrigin x).
 
             x0 > widthOfContents ifTrue:[
                 widthOfContents := x0.
@@ -1333,7 +1341,7 @@
 computeViewOriginXat:aLnrNr
     "compute the visible viewOrigin x for the item at a line
     "
-    |item xLft xRgt xOrg level viewOriginX offset|
+    |item xLft xRgt xOrg level viewOriginX offset used|
 
     aLnrNr == 1 ifTrue:[^ 0].
 
@@ -1362,11 +1370,10 @@
         ^ viewOriginX
     ].
     xOrg := xLft + viewOriginX.
+    used := xRgt - xLft + (width // 4).
 
-    [     (xLft := xLft - offset) >= margin
-     and:[(xRgt := xRgt - offset) > width]
-    ] whileTrue:[
-        xOrg := xOrg + offset
+    [ (used := used + offset) < width ] whileTrue:[
+        xOrg := xOrg - offset.
     ].
     ^ xOrg
 !
@@ -1415,5 +1422,5 @@
 !HierarchicalListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.49 2002-09-27 12:16:14 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.50 2002-09-28 06:20:29 ca Exp $'
 ! !