DSVColumnView.st
changeset 3989 5c6706e4e0d1
parent 3988 b15a3ef546b7
child 3991 c01031ccdbda
--- a/DSVColumnView.st	Thu Jan 20 08:38:11 2011 +0100
+++ b/DSVColumnView.st	Thu Jan 20 08:56:45 2011 +0100
@@ -29,9 +29,9 @@
 		autoScrollBlock needFitColumns scrollWhenUpdating
 		separatorOneDColor selectionForegroundColor
 		selectionForegroundColorNoFocus selectionBackgroundColor
-		selectionBackgroundColorNoFocus previousExtent
-		selectConditionBlock scrollRowWise autoScrollToColumn
-		cachedPreferredExtent'
+		selectionBackgroundColorNoFocus selectionFrameColor
+		selectionFrameColorNoFocus previousExtent selectConditionBlock
+		scrollRowWise autoScrollToColumn cachedPreferredExtent'
 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
 		DefaultHilightForegroundColor DefaultHilightBackgroundColor
 		DefaultHilightFrameColor ButtonLightColor ButtonShadowColor
@@ -208,7 +208,7 @@
 
     DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor' default:DefaultBackgroundColor.
     DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor' default:DefaultForegroundColor.
-    DefaultHilightFrameColor      := StyleSheet colorAt:#'selection.hilightFrameColor' default:DefaultHilightBackgroundColor.
+    DefaultHilightFrameColor      := StyleSheet colorAt:#'selection.hilightFrameColor'. "/ no default; nil means: no frame
 
     DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[
         DefaultHilightBackgroundColor := Color black
@@ -247,7 +247,7 @@
      self updateStyleCache.
     "
 
-    "Modified: / 20-01-2011 / 08:36:59 / cg"
+    "Modified: / 20-01-2011 / 08:44:28 / cg"
 !
 
 verticalSpacing
@@ -713,6 +713,17 @@
     ^ selectionForegroundColorNoFocus.
 !
 
+selectionFrameColor
+    "returns the frame color of a selected row"
+
+    self hasFocus ifTrue:[
+        ^ selectionFrameColor
+    ].
+    ^ selectionFrameColorNoFocus.
+
+    "Created: / 20-01-2011 / 08:45:08 / cg"
+!
+
 separatorDarkColor
     "returns the dark color used for drawing a shadowed separator (3D)"
     
@@ -2003,6 +2014,7 @@
      yBot  "{ Class:SmallInteger }"
      clHg  "{ Class:SmallInteger }"
      size  "{ Class:SmallInteger }"
+     lineColor
     |
 
     shown ifFalse:[^ self].
@@ -2011,11 +2023,12 @@
     columnDescriptors isEmpty ifTrue:[
         ^ self fillRectangleX:x y:y width:w height:h
     ].
+
     size  := list size.
     yTop  := margin - viewOrigin y.                   
     c0    := y - yTop max:0.
     start := (c0 // rowHeight) + 1.
-    stop  := (c0 + h - 1 // rowHeight + 1) min:size.
+    stop  := (((c0 + h - 1) // rowHeight) + 1) min:size.
 
     stop < start ifTrue:[
         ^ self fillRectangleX:x y:y width:w height:h
@@ -2074,20 +2087,29 @@
         self fillRectangleX:x1 y:y width:c0 height:h.
     ].
 
+    lineColor := self selectionFrameColor.
+
     "/ draw the selection in the right part, after the last column
     x1 < (width-margin) ifTrue:[
         self hasRowSelection ifTrue:[
-            self selectionIndicesDo:[:selIdx |
-                |y|
-
-                y := self yVisibleOfRowNr:selIdx.
+            self selectionIndicesDo:[:rowNr |
+                |y colWidth row|
+
+                colWidth := (width-margin-x1).
+                y := self yVisibleOfRowNr:rowNr.
                 self paint:selectionBackgroundColor.
-                self 
-                    fillRectangleX:x1 y:y 
-                    width:(width-margin-x1) height:rowHeight.
+                self fillRectangleX:x1 y:y width:colWidth height:rowHeight.
+
+                row := self at:rowNr ifAbsent:[nil].
+                lineColor notNil ifTrue:[
+                    self paint:lineColor.
+                    self displayRectangleX:x y:y width:colWidth height:h.
+                ]
             ].
         ].
     ].
+
+    "Modified: / 20-01-2011 / 08:55:19 / cg"
 ! !
 
 !DSVColumnView methodsFor:'drawing interactors'!
@@ -3009,6 +3031,7 @@
     bgColor     := bgColor     onDevice:device.
     selectionForegroundColor := selectionForegroundColor onDevice:device.
     selectionBackgroundColor := selectionBackgroundColor onDevice:device.
+    selectionFrameColor notNil ifTrue:[selectionFrameColor := selectionFrameColor onDevice:device].
     selectionForegroundColorNoFocus := selectionForegroundColorNoFocus onDevice:device.
     selectionBackgroundColorNoFocus := selectionBackgroundColorNoFocus onDevice:device.
 
@@ -3029,6 +3052,8 @@
     radioButtonActiveImage  := self imageOnMyDevice:radioButtonActiveImage.
     radioButtonPassiveImage := self imageOnMyDevice:radioButtonPassiveImage.
     comboButtonForm         := self imageOnMyDevice:comboButtonForm.
+
+    "Modified: / 20-01-2011 / 08:43:51 / cg"
 !
 
 initStyle
@@ -3045,6 +3070,7 @@
     bgColor     := DefaultBackgroundColor.
     selectionForegroundColor := DefaultHilightForegroundColor.
     selectionBackgroundColor := DefaultHilightBackgroundColor.
+    selectionFrameColor      := DefaultHilightFrameColor.
 
     shadowColor isNil ifTrue:[
         shadowColor := Color grayPercent:40.
@@ -3074,7 +3100,10 @@
         selectionForegroundColorNoFocus := selectionForegroundColor.
     ].
     selectionBackgroundColorNoFocus isNil ifTrue:[
-        selectionBackgroundColorNoFocus := selectionBackgroundColor lightened.
+        selectionBackgroundColorNoFocus := Color brightness:(selectionBackgroundColor "lightened" brightness).   "/ asGray.
+    ].
+    selectionFrameColorNoFocus isNil ifTrue:[
+        selectionFrameColorNoFocus := Color brightness:(selectionFrameColor "lightened" brightness).   "/ asGray
     ].
 
     rowSelectorForm         := self class rowSelectorImage.
@@ -3107,6 +3136,8 @@
     comboButtonForm   := ComboButtonForm.
     comboButtonLevel  := ComboButtonLevel.
     comboButtonExtent := ComboButtonExtent.
+
+    "Modified: / 20-01-2011 / 08:44:02 / cg"
 !
 
 initialize
@@ -4642,9 +4673,9 @@
 !DSVColumnView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.266 2011-01-20 07:38:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.267 2011-01-20 07:56:45 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.266 2011-01-20 07:38:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.267 2011-01-20 07:56:45 cg Exp $'
 ! !