SelectionInListModelView.st
changeset 1557 e3feb8bc17b0
parent 1554 c45cac3c4d31
child 1561 edac7f38341b
--- a/SelectionInListModelView.st	Thu Sep 23 09:00:34 1999 +0200
+++ b/SelectionInListModelView.st	Thu Sep 23 10:18:38 1999 +0200
@@ -265,7 +265,7 @@
         multipleSelectOk ifTrue:[^ #()].
         ^ useIndex ifTrue:[0] ifFalse:[nil]
     ].
-    useIndex ifTrue:[^ selection].
+    useIndex ifTrue:[^ selection copy].
 
     multipleSelectOk ifFalse:[
         ^ list at:selection ifAbsent:nil
@@ -278,11 +278,6 @@
     "
     |value nsel|
 
-    model isNil ifTrue:[
-        ^ nil
-    ].
-    self syncFlushEvent:#setSelection:.
-
     ((value := model value) isNil or:[value == 0]) ifTrue:[
         ^ nil
     ].
@@ -501,9 +496,11 @@
 drawFrom:start to:stop x:x y:y w:w
     "draw the lines between start to stop without clearing the background
     "
-    self selectionDo:[:lnNr|
-        (lnNr between:start and:stop) ifTrue:[
-            self drawSelectionFrameAt:lnNr x:x w:w
+    highlightMode notNil ifTrue:[
+        self selectionDo:[:lnNr|
+            (lnNr between:start and:stop) ifTrue:[
+                self drawSelectionFrameAt:lnNr x:x w:w
+            ]
         ]
     ].
     self drawElementsFrom:start to:stop x:x y:y w:w.
@@ -517,14 +514,15 @@
     |item|
 
     item := list at:anIndex ifAbsent:nil.
-    item isNil ifTrue:[^ self].
 
-    (self isInSelection:anIndex) ifTrue:[
-        self paint:hilightFgColor on:hilightBgColor
-    ] ifFalse:[
-        self paint:fgColor on:bgColor.
-    ].
-    self displayElement:item x:x y:y h:h.
+    item notNil ifTrue:[
+        (highlightMode notNil and:[self isInSelection:anIndex]) ifTrue:[
+            self paint:hilightFgColor on:hilightBgColor
+        ] ifFalse:[
+            self paint:fgColor on:bgColor.
+        ].
+        self displayElement:item x:x y:y h:h.
+    ]
 
 
 !
@@ -611,7 +609,10 @@
 redrawSelectionAt:aLineNr
     "called to redraw a line caused by a change of the selection
     "
-    self redrawLineAt:aLineNr.
+    highlightMode notNil ifTrue:[
+        self redrawLineAt:aLineNr
+    ].
+
 ! !
 
 !SelectionInListModelView methodsFor:'event handling'!
@@ -916,7 +917,7 @@
     hilightFrameColor := nil.
     hilightLevel      := 0.
     hilightStyle      := DefaultHilightStyle.
-    highlightMode     := #line.
+    highlightMode     := #label.
     textStartLeft     := 4.
 
     device hasGrayscales ifTrue:[
@@ -1294,6 +1295,6 @@
 !SelectionInListModelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.18 1999-09-22 10:08:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.19 1999-09-23 08:18:38 cg Exp $'
 ! !
 SelectionInListModelView initialize!