--- a/DataSetColumn.st Mon May 17 18:53:24 2004 +0200
+++ b/DataSetColumn.st Thu May 27 16:26:48 2004 +0200
@@ -57,7 +57,7 @@
width <Integer> width of column
- description <DataSetColumnSpec> the column description
+ description <DataSetColumnSpec> the column description (a spec)
buttonExtent <Point> extent of drawable form
@@ -183,11 +183,9 @@
!
description
- "returns the column description
+ "returns the column spec
"
^ description
-
-
!
label
@@ -213,9 +211,7 @@
backgroundColor
"returns the background color or nil
"
- ^ backgroundColor == dataSet backgroundColor ifTrue:[nil]
- ifFalse:[backgroundColor]
-
+ ^ backgroundColor == dataSet backgroundColor ifTrue:[nil] ifFalse:[backgroundColor]
!
backgroundColor: aColor
@@ -256,9 +252,7 @@
foregroundColor
"returns the foreground color or nil
"
- ^ foregroundColor == dataSet foregroundColor ifTrue:[nil]
- ifFalse:[foregroundColor]
-
+ ^ foregroundColor == dataSet foregroundColor ifTrue:[nil] ifFalse:[foregroundColor]
!
foregroundColor: aColor
@@ -285,6 +279,58 @@
]
].
^ foregroundColor
+!
+
+selectedBackgroundColorFor:aRow at:aRowNr
+ "returns the selected background color for a row at list index a rowNr
+ "
+ |bgSelector bg|
+
+ bgSelector := description selectedBackgroundSelector.
+ bgSelector notNil ifTrue:[
+ columnAdaptor notNil ifTrue:[
+ bg := columnAdaptor perform:bgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet
+ ] ifFalse:[
+ bg := aRow perform:bgSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet
+ ].
+ bg notNil ifTrue:[
+ (bg isColor or:[bg isImageOrForm]) ifTrue:[
+ ^ bg
+ ].
+ self halt:'unexpected bg (not color or image)'.
+ ]
+ ].
+ bg := description selectedBackgroundColor.
+ bg isNil ifTrue:[
+ bg := dataSet selectionBackgroundColor
+ ].
+ ^ bg
+!
+
+selectedForegroundColorFor:aRow at:aRowNr
+ "returns the selected foreground color for a row at list index a rowNr
+ "
+ |fgSelector fg|
+
+ fgSelector := description selectedForegroundSelector.
+ fgSelector notNil ifTrue:[
+ columnAdaptor notNil ifTrue:[
+ fg := columnAdaptor perform:fgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet
+ ] ifFalse:[
+ fg := aRow perform:fgSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet
+ ].
+ fg notNil ifTrue:[
+ (fg isColor or:[fg isImageOrForm]) ifTrue:[
+ ^ fg
+ ].
+ self halt:'unexpected fg (not color or image)'.
+ ]
+ ].
+ fg := description selectedForegroundColor.
+ fg isNil ifTrue:[
+ fg := dataSet selectionForegroundColor
+ ].
+ ^ fg
! !
!DataSetColumn methodsFor:'accessing-dimension'!
@@ -478,8 +524,8 @@
y := yT.
x := xLeft.
- "/ GET BACKGROUND AND FOREGROUND-COLOR
- "/ ===================================
+ "/ GET BACKGROUND AND FOREGROUND-COLOR
+ "/ ===================================
isSel := dataSet isSelected:aRowNr inColumn:columnNumber.
@@ -494,8 +540,8 @@
(isSel and:[description showSelectionHighLighted]) ifTrue:[
"/ SHOW SELECTED( MUST REDRAW BACKGROUND )
"/ =======================================
- fg := dataSet selectionForegroundColor.
- bg := dataSet selectionBackgroundColor.
+ bg := self selectedBackgroundColorFor:row at:aRowNr.
+ fg := self selectedForegroundColorFor:row at:aRowNr.
dataSet paint:bg.
dataSet fillRectangleX:x y:y width:width height:h.
@@ -1117,5 +1163,5 @@
!DataSetColumn class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.96 2004-04-02 14:42:29 werner Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.97 2004-05-27 14:26:48 cg Exp $'
! !