icon handling; default icons can be undefined
authorca
Sun, 26 Mar 2000 12:09:17 +0200
changeset 1746 0a4f786f8c9a
parent 1745 4eb3b6b12c99
child 1747 f46c5941c028
icon handling; default icons can be undefined
HierarchicalListView.st
--- a/HierarchicalListView.st	Fri Mar 24 15:55:53 2000 +0100
+++ b/HierarchicalListView.st	Sun Mar 26 12:09:17 2000 +0200
@@ -230,6 +230,8 @@
     aDictionary keysAndValuesDo:[:aKey :anImage|
         (image := self imageOnDevice:anImage) notNil ifTrue:[
             icons at:aKey put:image
+        ] ifFalse:[
+            icons removeKey:aKey ifAbsent:nil
         ]
     ]
 
@@ -730,7 +732,7 @@
     lineColor      := lineColor onDevice:device.
     openIndicator  := self imageOnDevice:openIndicator.
     closeIndicator := self imageOnDevice:closeIndicator.
-    imageWidth     := 4.
+    imageWidth     := 2.
 
     icons keysAndValuesDo:[:aKey :anImage|
         anImage isNil ifTrue:[
@@ -741,16 +743,8 @@
             imageWidth := image width max:imageWidth.
         ]
     ].
+    imageWidth      := imageWidth + 1 // 2 * 2.
     alignTextRightX := imageWidth + 20.
-
-    alignTextRight ifTrue:[
-        imageWidth := (icons at:#expanded)  width.
-        imageWidth := ((icons at:#collapsed) width) max:imageWidth.
-    ] ifFalse:[
-        imageWidth := imageWidth // 2.
-        imageWidth odd ifTrue:[imageWidth := imageWidth + 1].
-        imageWidth := imageWidth * 2.
-    ]
 ! !
 
 !HierarchicalListView methodsFor:'initialize / release'!
@@ -781,7 +775,7 @@
     useDefaultIcons    := true.
     showLines          := true.
     imageInset         := 4.
-    imageWidth         := 8.    "/ default
+    imageWidth         := 4.    "/ default
     alignTextRight     := false.
     alignTextRightX    := 8.
     maxWidthOfText     := 0.
@@ -822,7 +816,7 @@
     ] ifFalse:[
         key := #empty
     ].
-    ^ icons at:key
+    ^ icons at:key ifAbsent:nil
 !
 
 heightOfLineAt:aLineNr
@@ -999,5 +993,5 @@
 !HierarchicalListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.21 2000-03-21 10:05:29 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.22 2000-03-26 10:09:17 ca Exp $'
 ! !