DataSetColumn.st
changeset 883 0a790ad56286
parent 882 60984f178b0a
child 891 f4d2ed9d3b88
--- a/DataSetColumn.st	Wed May 06 15:37:40 1998 +0200
+++ b/DataSetColumn.st	Thu May 07 14:43:22 1998 +0200
@@ -17,7 +17,7 @@
 	instanceVariableNames:'columnNumber dataSet labelExtent minWidth width description form
 		buttonInset buttonExtent textInset drawableAction toggleExtent
 		rendererType backgroundColor foregroundColor fgSelector
-		bgSelector'
+		bgSelector columnAlignment'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-DataSet'
@@ -219,12 +219,8 @@
      y  "{ Class:SmallInteger }"
      x  "{ Class:SmallInteger }"
      xI "{ Class:SmallInteger }"
-     xCol
-     colAlign spacing|
-
-    colAlign := #left.
-    "/ colAlign := #right.
-    "/ colAlign := #center.
+     xCol "{ Class:SmallInteger }"
+     spacing "{ Class:SmallInteger }"|
 
     h  := dataSet rowHeight.
 
@@ -256,9 +252,8 @@
             ] ifFalse:[
                 lbl isText ifTrue:[lbl := lbl string]
             ].
-            lbl notNil ifTrue:[
-                dataSet paint:lgCol on:dkCol.
-            ]
+            lblBg := dkCol.
+            lblFg := lgCol.
         ] ifFalse:[
             (bgSelector notNil and:[(lblBg := row perform:bgSelector) notNil]) ifTrue:[
                 dataSet paint:(lblBg := dataSet colorOnDevice:lblBg).
@@ -268,23 +263,24 @@
             ].
             lbl notNil ifTrue:[
                 (fgSelector notNil and:[(lblFg := row perform:fgSelector) notNil]) ifFalse:[
-                    dataSet paint:fg on:lblBg.
+                    lblFg := fg.
                 ] ifTrue:[
-                    dataSet paint:(dataSet colorOnDevice:lblFg) on:lblBg.
+                    lblFg := dataSet colorOnDevice:lblFg.
                 ].
             ]
         ].
         lbl notNil ifTrue:[
-            xCol := x.
-            colAlign == #right ifTrue:[
-                xCol := x0 + (width - (lbl widthOn:dataSet)) - spacing.
-                xCol := xCol max:0
+            columnAlignment == #left ifTrue:[
+                xCol := x
             ] ifFalse:[
-                colAlign == #center ifTrue:[
-                    xCol := x0 + ((width - (lbl widthOn:dataSet)) // 2).
-                    xCol := xCol max:0
-                ]
+                xCol := width - (lbl widthOn:dataSet).
+
+                columnAlignment == #right ifTrue:[xCol := xCol - spacing]
+                                         ifFalse:[xCol := xCol // 2].
+
+                xCol := (x0 + xCol) max:0.
             ].
+            dataSet paint:lblFg on:lblBg.
             lbl displayOn:dataSet x:xCol y:y
         ].
         y := y + h.
@@ -483,6 +479,7 @@
     foregroundColor := description foregroundColor.
     buttonExtent    := 0 @ 0.
     labelExtent     := 0 @ 0.
+    columnAlignment := #left.
 
     backgroundColor notNil ifTrue:[
         backgroundColor := backgroundColor on:dataSet device
@@ -531,6 +528,8 @@
     (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[
         form := dataSet comboButtonForm.
         buttonExtent := dataSet comboButtonExtent.
+    ] ifFalse:[
+        columnAlignment := description columnAlignment
     ].
 
     selector := description printSelector.
@@ -660,5 +659,5 @@
 !DataSetColumn class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.19 1998-05-06 13:37:40 ps Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.20 1998-05-07 12:43:22 ca Exp $'
 ! !