--- a/HierarchicalListView.st Sat Oct 10 16:53:40 2015 +0200
+++ b/HierarchicalListView.st Sat Oct 10 16:53:50 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1999 by eXept Software AG
All Rights Reserved
@@ -1464,7 +1466,9 @@
widthOfWidestLineBetween:firstLine and:lastLine
"returns the width of the longest line in pixels in a range
- "
+ - used to optimize scrolling, by limiting the scrolled area;
+ not for scrollbar or other width related stuff which should be exact."
+
|parent item textX level width widthOfLabel|
width := listRenderer widthOfWidestLineBetween:firstLine and:lastLine.
@@ -1473,45 +1477,45 @@
width := 20.
alignTextRight ifTrue:[
- parent := nil.
- level := 1.
+ parent := nil.
+ level := 1.
- firstLine to:lastLine do:[:idx|
- item := self at:idx ifAbsent:nil.
+ firstLine to:lastLine do:[:idx|
+ item := self at:idx ifAbsent:nil.
- item notNil ifTrue:[
- width := (listRenderer widthFor:item) max:width.
+ item notNil ifTrue:[
+ width := (listRenderer widthFor:item) max:width.
- item parent ~~ parent ifTrue:[
- level := item level max:level.
- parent := item parent.
- ].
- ].
- ].
- maxWidthOfText := maxWidthOfText max:width.
- textX := self xVisibleOfIconAtLevel:(level + 1).
+ item parent ~~ parent ifTrue:[
+ level := item level max:level.
+ parent := item parent.
+ ].
+ ].
+ ].
+ maxWidthOfText := maxWidthOfText max:width.
+ textX := self xVisibleOfIconAtLevel:(level + 1).
- alignTextRightX < textX ifTrue:[
- alignTextRightX := textX.
- self invalidate.
- ].
- ^ alignTextRightX + width
+ alignTextRightX < textX ifTrue:[
+ alignTextRightX := textX.
+ self invalidate.
+ ].
+ ^ alignTextRightX + width
].
parent := 4711. "/ force a computation
firstLine to:lastLine do:[:idx|
- item := self at:idx ifAbsent:nil.
+ item := self at:idx ifAbsent:nil.
- item notNil ifTrue:[
- item parent ~~ parent ifTrue:[
- textX := self xVisibleOfTextAtLevel:(item level).
- parent := item parent.
- ].
- widthOfLabel := listRenderer widthFor:item.
- maxWidthOfText := maxWidthOfText max:widthOfLabel.
- width := widthOfLabel + textX max:width
- ].
+ item notNil ifTrue:[
+ item parent ~~ parent ifTrue:[
+ textX := self xVisibleOfTextAtLevel:(item level).
+ parent := item parent.
+ ].
+ widthOfLabel := listRenderer widthFor:item.
+ maxWidthOfText := maxWidthOfText max:widthOfLabel.
+ width := widthOfLabel + textX max:width
+ ].
].
^ width + viewOrigin x.
!