DSVColumnView.st
changeset 3138 bf718db445b5
parent 3130 30ac624dd866
child 3140 6f2bc099fb35
--- a/DSVColumnView.st	Tue Nov 07 17:21:48 2006 +0100
+++ b/DSVColumnView.st	Tue Nov 07 17:22:02 2006 +0100
@@ -27,8 +27,9 @@
 		columnAdaptor tabAtEndAction tabAtStartAction modifiedChannel
 		autoScroll autoScrollBlock needFitColumns scrollWhenUpdating
 		separatorOneDColor selectionForegroundColor
-		selectionBackgroundColor previousExtent selectConditionBlock
-		scrollRowWise autoScrollToColumn'
+		selectionForegroundColorNoFocus selectionBackgroundColor
+		selectionBackgroundColorNoFocus previousExtent
+		selectConditionBlock scrollRowWise autoScrollToColumn'
 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
 		DefaultHilightForegroundColor DefaultHilightBackgroundColor
 		ButtonLightColor ButtonShadowColor CheckToggleActiveImage
@@ -661,13 +662,19 @@
 selectionBackgroundColor
     "returns the background color of a selected row"
     
-    ^ selectionBackgroundColor
+    self hasFocus ifTrue:[
+        ^ selectionBackgroundColor
+    ].
+    ^ selectionBackgroundColorNoFocus.
 !
 
 selectionForegroundColor
     "returns the foreground color of a selected row"
-    
-    ^ selectionForegroundColor
+
+    self hasFocus ifTrue:[
+        ^ selectionForegroundColor
+    ].
+    ^ selectionForegroundColorNoFocus.
 !
 
 separatorDarkColor
@@ -1794,6 +1801,16 @@
     ]
 !
 
+invalidateSelection
+    shown ifTrue:[ |colIndex|
+        colIndex := self selectedColIndex ? 0.
+
+        self selectionIndicesDo:[:aRowIndex|
+            self invalidateRowAt:aRowIndex colAt:colIndex.
+        ].
+    ]
+!
+
 invalidateVisibleRow:aRow 
     "redraw row if visible"
     
@@ -2686,6 +2703,16 @@
     ^ false
 !
 
+showFocus:explicit
+    self invalidateSelection.
+    super showFocus:explicit
+!
+
+showNoFocus:explicit
+    self invalidateSelection.
+    super showNoFocus:explicit
+!
+
 wantsFocusWithPointerEnter
     "views which like to take the keyboard focus
      when the pointer enters can do so by redefining this
@@ -2754,6 +2781,8 @@
     bgColor     := bgColor     onDevice:device.
     selectionForegroundColor := selectionForegroundColor onDevice:device.
     selectionBackgroundColor := selectionBackgroundColor onDevice:device.
+    selectionForegroundColorNoFocus := selectionForegroundColorNoFocus onDevice:device.
+    selectionBackgroundColorNoFocus := selectionBackgroundColorNoFocus onDevice:device.
 
     buttonShadowColor := buttonShadowColor onDevice:device.
     buttonLightColor  := buttonLightColor onDevice:device.
@@ -2811,6 +2840,13 @@
         buttonHalfShadowColor := Color gray
     ].
 
+    selectionForegroundColorNoFocus isNil ifTrue:[
+        selectionForegroundColorNoFocus := selectionForegroundColor.
+    ].
+    selectionBackgroundColorNoFocus isNil ifTrue:[
+        selectionBackgroundColorNoFocus := selectionBackgroundColor lightened.
+    ].
+
     rowSelectorForm         := self class rowSelectorImage.
     checkToggleActiveImage  := CheckToggleActiveImage.
     checkTogglePassiveImage := CheckTogglePassiveImage.
@@ -4162,5 +4198,5 @@
 !DSVColumnView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.217 2006-10-23 08:56:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.218 2006-11-07 16:22:02 ca Exp $'
 ! !