DataSetColumn.st
changeset 584 1426fe34f4e8
parent 568 d037dc821ed6
child 595 586b5300d1be
--- a/DataSetColumn.st	Tue Oct 28 21:08:03 1997 +0100
+++ b/DataSetColumn.st	Wed Oct 29 08:42:29 1997 +0100
@@ -15,7 +15,8 @@
 
 Object subclass:#DataSetColumn
 	instanceVariableNames:'dataSet label minWidth width description form form2 formInset
-		textInset writeSelector drawableAction'
+		textInset writeSelector drawableAction backgroundColor
+		foregroundColor'
 	classVariableNames:'FormComboView FormToggleOn FormToggleOff FormRowSelector'
 	poolDictionaries:''
 	category:'Views-DataSet'
@@ -178,6 +179,14 @@
     ]
 !
 
+backgroundColor
+    ^ backgroundColor
+!
+
+foregroundColor
+    ^ foregroundColor
+!
+
 label
     "get the label assigned to the column
     "
@@ -245,10 +254,10 @@
 
 !DataSetColumn methodsFor:'drawing'!
 
-drawFrom:start to:stop yTop:yTop yBot:yBot with:fg and:bg
+drawFrom:start to:stop yTop:yTop yBot:yBot with:fgColor and:bgColor
     "redraw rows between start and stop
     "
-    |lgCol dkCol isLast selRowNr selRowY label drawColSep n
+    |lgCol dkCol isLast fg bg selRowNr selRowY label drawColSep n
      rowHeight "{ Class:SmallInteger }"
      nTimes    "{ Class:SmallInteger }"
      y         "{ Class:SmallInteger }"
@@ -257,6 +266,22 @@
     rowHeight := dataSet rowHeight.
     nTimes    := stop - start + 1.
 
+    backgroundColor notNil ifTrue:[
+        bg := backgroundColor.
+        dataSet paint:bg.
+
+        dataSet fillRectangleX:0 y:yTop
+                          width:width 
+                         height:(stop - start + 1 * rowHeight).
+
+        dataSet paint:bg.
+    ] ifFalse:[
+        bg := bgColor
+    ].
+
+    foregroundColor isNil ifTrue:[fg := fgColor]
+                         ifFalse:[fg := foregroundColor].
+
     y := yTop + textInset.
     x := dataSet horizontalSpacing.
     selRowNr := dataSet selectedRowIndexInColumn:self.
@@ -286,10 +311,9 @@
     ] ifFalse:[
         selRowY := nil
     ].
+    dataSet paint:fg on:bg.
 
     drawableAction notNil ifTrue:[
-        dataSet paint:fg on:bg.
-
         start to:stop do:[:aRowNr|
             (     selRowNr ~~ aRowNr
              and:[(label := drawableAction value:aRowNr) notNil]
@@ -444,6 +468,10 @@
 
             (lbl isString or:[lbl isNumber]) ifTrue:[
                 textInset := aTextInset
+            ] ifFalse:[
+                (lbl isNil and:[description printSelector isNil]) ifTrue:[
+                    textInset := aTextInset.
+                ]
             ]
         ].
 
@@ -502,14 +530,23 @@
     "
     |rendererType device selector formatStr idx|
 
-    dataSet        := aDSVColumnView.
-    description    := aDescription.
-    rendererType   := description rendererType.
-    form           := width := form2 := nil.
-    device         := dataSet device.
-    label          := description label.
-    drawableAction := nil.
-    writeSelector  := description writeSelector.
+    dataSet         := aDSVColumnView.
+    description     := aDescription.
+    rendererType    := description rendererType.
+    form            := width := form2 := nil.
+    device          := dataSet device.
+    label           := description label.
+    drawableAction  := nil.
+    writeSelector   := description writeSelector.
+    backgroundColor := description backgroundColor.
+    foregroundColor := description foregroundColor.
+
+    backgroundColor notNil ifTrue:[
+        backgroundColor := backgroundColor on:aDSVColumnView device
+    ].
+    foregroundColor notNil ifTrue:[
+        foregroundColor := foregroundColor on:aDSVColumnView device
+    ].
 
     label isImage ifTrue:[
         label := label onDevice:device
@@ -653,5 +690,5 @@
 !DataSetColumn class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.5 1997-10-22 13:24:48 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.6 1997-10-29 07:41:30 ca Exp $'
 ! !