SelectionInListModelView.st
changeset 3338 01ad784543fc
parent 3275 e40404564ccc
child 3345 088090deaffb
--- a/SelectionInListModelView.st	Mon Feb 11 15:34:11 2008 +0100
+++ b/SelectionInListModelView.st	Mon Feb 11 15:37:00 2008 +0100
@@ -390,6 +390,10 @@
     ].
 !
 
+highlightWithUnderline
+    ^ false
+!
+
 hilightBackgroundColor
     "returns the color used for the hilighted background
     "
@@ -941,21 +945,24 @@
         self displayLineFromX:xOut0 y:y0 toX:xOut1 y:y0.
     ].
 
-    cursorItem == item ifFalse:[
+    cursorItem == item ifTrue:[
+        "/ textStartLeft
+        self setMaskOrigin:((self viewOrigin + (0 @ 1)) \\ (lineMask extent)).
+        self mask:lineMask.
+        w := renderer widthFor:item.
+        self displayRectangleX:x -1 y:(y+2) width:w+2 height:(h - 4).
+        self mask:nil.
+    ] ifFalse:[
         enterItem == item ifTrue:[
-            y0 := y + h - 2.
-            x1 := x + (renderer widthFor:item).
-
-            self displayLineFromX:x y:y0 toX:x1 y:y0.
+            self highlightWithUnderline ifTrue:[
+                "/ underline the hilite...
+                y0 := y + h - 2.
+                x1 := x + (renderer widthFor:item).
+
+                self displayLineFromX:x y:y0 toX:x1 y:y0.
+            ]
         ].
-        ^ self
     ].
-"/ textStartLeft
-    self setMaskOrigin:((self viewOrigin + (0 @ 1)) \\ (lineMask extent)).
-    self mask:lineMask.
-    w := renderer widthFor:item.
-    self displayRectangleX:x -1 y:(y+2) width:w+2 height:(h - 4).
-    self mask:nil.
 !
 
 drawSelectionFrameAt:lnNr x:x w:w
@@ -1549,6 +1556,16 @@
     "Modified: / 15-09-2006 / 11:26:29 / User"
 !
 
+invalidateLineOfItem:anItem
+    |lnNr x|
+
+    lnNr := self identityIndexOf:enterItem.
+    lnNr notNil ifTrue:[
+        x := self xVisibleOfItem:enterItem.
+        self invalidateLineAt:lnNr fromX:x
+    ].
+!
+
 keyPress:aKey x:x y:y
     "a key was pressed - handle page-keys here
     "
@@ -1713,7 +1730,7 @@
 pointerEntersItem:anItemOrNil
     "the pointer moves over an item or nil
     "
-    |lnNr x newItem|
+    |newItem|
 
     (shown and:[self size ~~ 0]) ifFalse:[
         enterItem := nil.
@@ -1725,17 +1742,9 @@
 
     anItemOrNil == enterItem ifTrue:[ ^ self ].
 
-    2 timesRepeat:[
-        enterItem notNil ifTrue:[
-            lnNr := self identityIndexOf:enterItem.
-            lnNr notNil ifTrue:[
-                x := self xVisibleOfItem:enterItem.
-                self invalidateLineAt:lnNr fromX:x
-            ].
-        ].
-        "/ set the new item
-        enterItem := anItemOrNil.
-    ].
+    enterItem notNil ifTrue:[ self invalidateLineOfItem:enterItem ].
+    enterItem := anItemOrNil.
+    enterItem notNil ifTrue:[ self invalidateLineOfItem:enterItem ].
 !
 
 pointerLeave:state
@@ -2418,5 +2427,5 @@
 !SelectionInListModelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.122 2007-11-13 06:03:40 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.123 2008-02-11 14:37:00 cg Exp $'
 ! !