double click on expandable item does not perform
doubleClick action (but expands/unexpands only)
--- a/SelectionInTreeView.st Mon Aug 21 13:20:55 2000 +0200
+++ b/SelectionInTreeView.st Mon Aug 21 13:22:52 2000 +0200
@@ -15,9 +15,9 @@
SelectionInListView subclass:#SelectionInTreeView
instanceVariableNames:'validateDoubleClickBlock selectionHolder rootHolder imageWidth
- showLines listOfNodes imageInset textInset labelOffsetY lineMask
- itemClass lineColor computeResources showRoot
- showDirectoryIndicator closeIndicator openIndicator
+ showLines showLinesForRoot listOfNodes imageInset textInset
+ labelOffsetY lineMask itemClass lineColor computeResources
+ showRoot showDirectoryIndicator closeIndicator openIndicator
showDirectoryIndicatorForRoot imageOpened imageClosed imageItem
discardMotionEvents registeredImages supportsExpandAll
buildInArray drawVLinesFromLevel highlightMode editorWidget
@@ -537,6 +537,21 @@
].
!
+showLinesForRoot
+ "returns true if root-lines are shown
+ "
+ ^ showLinesForRoot
+!
+
+showLinesForRoot:aState
+ "show or hide lines for root(s)
+ "
+ aState ~~ showLinesForRoot ifTrue:[
+ showLinesForRoot := aState.
+ self invalidate
+ ].
+!
+
showRoot
"list with or without root
"
@@ -902,7 +917,9 @@
[((p1 := p2 parent) notNil and:[(x := x - widthLvl) >= limitLvX])] whileTrue:[
(p1 basicLastChild ~~ p2 and:[x <= x1]) ifTrue:[
x >= startLvX ifTrue:[
- self displayLineFromX:x y:yTop toX:x y:yBot
+ (isFirst not or:[showLinesForRoot]) ifTrue:[
+ self displayLineFromX:x y:yTop toX:x y:yBot
+ ]
] ifFalse:[
buildInArray at:lv put:yBot
].
@@ -928,7 +945,6 @@
x := x + widthLvl.
].
self mask:nil.
-
!
drawVisibleLineSelected:visLineNr with:fg and:bg
@@ -1310,7 +1326,7 @@
"handle a double click; collapse or expand selected entry
in case of having children
"
- |node|
+ |node |
(node := self selectedNode) notNil ifTrue:[
(validateDoubleClickBlock isNil
@@ -1319,7 +1335,9 @@
or:[(validateExpandabilityBlock value:node) ~~ false]) ifTrue:[
self selectedNodeExpand:(node isExpandable).
].
- super doubleClicked
+ node hasChildren ifFalse:[
+ super doubleClicked
+ ]
]
]
@@ -1587,7 +1605,7 @@
supportsExpandAll := true.
self bitGravity:#NorthWest.
showRoot := showDirectoryIndicatorForRoot := showLines := computeResources := true.
- showDirectoryIndicator := discardMotionEvents := false.
+ showDirectoryIndicator := discardMotionEvents := showLinesForRoot := false.
leftMargin := 2.
lineMask := Form width:2 height:2 fromArray:#[16rAA 16r55].
registeredImages := IdentityDictionary new.
@@ -2357,5 +2375,5 @@
!SelectionInTreeView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.89 2000-08-19 18:28:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.90 2000-08-21 11:22:52 cg Exp $'
! !