DataSetColumn.st
changeset 883 0a790ad56286
parent 882 60984f178b0a
child 891 f4d2ed9d3b88
equal deleted inserted replaced
882:60984f178b0a 883:0a790ad56286
    15 
    15 
    16 Object subclass:#DataSetColumn
    16 Object subclass:#DataSetColumn
    17 	instanceVariableNames:'columnNumber dataSet labelExtent minWidth width description form
    17 	instanceVariableNames:'columnNumber dataSet labelExtent minWidth width description form
    18 		buttonInset buttonExtent textInset drawableAction toggleExtent
    18 		buttonInset buttonExtent textInset drawableAction toggleExtent
    19 		rendererType backgroundColor foregroundColor fgSelector
    19 		rendererType backgroundColor foregroundColor fgSelector
    20 		bgSelector'
    20 		bgSelector columnAlignment'
    21 	classVariableNames:''
    21 	classVariableNames:''
    22 	poolDictionaries:''
    22 	poolDictionaries:''
    23 	category:'Views-DataSet'
    23 	category:'Views-DataSet'
    24 !
    24 !
    25 
    25 
   217      h  "{ Class:SmallInteger }"
   217      h  "{ Class:SmallInteger }"
   218      n  "{ Class:SmallInteger }"
   218      n  "{ Class:SmallInteger }"
   219      y  "{ Class:SmallInteger }"
   219      y  "{ Class:SmallInteger }"
   220      x  "{ Class:SmallInteger }"
   220      x  "{ Class:SmallInteger }"
   221      xI "{ Class:SmallInteger }"
   221      xI "{ Class:SmallInteger }"
   222      xCol
   222      xCol "{ Class:SmallInteger }"
   223      colAlign spacing|
   223      spacing "{ Class:SmallInteger }"|
   224 
       
   225     colAlign := #left.
       
   226     "/ colAlign := #right.
       
   227     "/ colAlign := #center.
       
   228 
   224 
   229     h  := dataSet rowHeight.
   225     h  := dataSet rowHeight.
   230 
   226 
   231     (bg := backgroundColor) isNil ifTrue:[
   227     (bg := backgroundColor) isNil ifTrue:[
   232         bg := bgColor
   228         bg := bgColor
   254             rendererType == #rowSelector ifTrue:[
   250             rendererType == #rowSelector ifTrue:[
   255                 lbl := form
   251                 lbl := form
   256             ] ifFalse:[
   252             ] ifFalse:[
   257                 lbl isText ifTrue:[lbl := lbl string]
   253                 lbl isText ifTrue:[lbl := lbl string]
   258             ].
   254             ].
   259             lbl notNil ifTrue:[
   255             lblBg := dkCol.
   260                 dataSet paint:lgCol on:dkCol.
   256             lblFg := lgCol.
   261             ]
       
   262         ] ifFalse:[
   257         ] ifFalse:[
   263             (bgSelector notNil and:[(lblBg := row perform:bgSelector) notNil]) ifTrue:[
   258             (bgSelector notNil and:[(lblBg := row perform:bgSelector) notNil]) ifTrue:[
   264                 dataSet paint:(lblBg := dataSet colorOnDevice:lblBg).
   259                 dataSet paint:(lblBg := dataSet colorOnDevice:lblBg).
   265                 dataSet fillRectangleX:x0 y:y - textInset width:width height:(h - 2).                
   260                 dataSet fillRectangleX:x0 y:y - textInset width:width height:(h - 2).                
   266             ] ifFalse:[
   261             ] ifFalse:[
   267                 lblBg := bg
   262                 lblBg := bg
   268             ].
   263             ].
   269             lbl notNil ifTrue:[
   264             lbl notNil ifTrue:[
   270                 (fgSelector notNil and:[(lblFg := row perform:fgSelector) notNil]) ifFalse:[
   265                 (fgSelector notNil and:[(lblFg := row perform:fgSelector) notNil]) ifFalse:[
   271                     dataSet paint:fg on:lblBg.
   266                     lblFg := fg.
   272                 ] ifTrue:[
   267                 ] ifTrue:[
   273                     dataSet paint:(dataSet colorOnDevice:lblFg) on:lblBg.
   268                     lblFg := dataSet colorOnDevice:lblFg.
   274                 ].
   269                 ].
   275             ]
   270             ]
   276         ].
   271         ].
   277         lbl notNil ifTrue:[
   272         lbl notNil ifTrue:[
   278             xCol := x.
   273             columnAlignment == #left ifTrue:[
   279             colAlign == #right ifTrue:[
   274                 xCol := x
   280                 xCol := x0 + (width - (lbl widthOn:dataSet)) - spacing.
       
   281                 xCol := xCol max:0
       
   282             ] ifFalse:[
   275             ] ifFalse:[
   283                 colAlign == #center ifTrue:[
   276                 xCol := width - (lbl widthOn:dataSet).
   284                     xCol := x0 + ((width - (lbl widthOn:dataSet)) // 2).
   277 
   285                     xCol := xCol max:0
   278                 columnAlignment == #right ifTrue:[xCol := xCol - spacing]
   286                 ]
   279                                          ifFalse:[xCol := xCol // 2].
       
   280 
       
   281                 xCol := (x0 + xCol) max:0.
   287             ].
   282             ].
       
   283             dataSet paint:lblFg on:lblBg.
   288             lbl displayOn:dataSet x:xCol y:y
   284             lbl displayOn:dataSet x:xCol y:y
   289         ].
   285         ].
   290         y := y + h.
   286         y := y + h.
   291         n := n + 1.
   287         n := n + 1.
   292     ].
   288     ].
   481     bgSelector      := description backgroundSelector.
   477     bgSelector      := description backgroundSelector.
   482     backgroundColor := description backgroundColor.
   478     backgroundColor := description backgroundColor.
   483     foregroundColor := description foregroundColor.
   479     foregroundColor := description foregroundColor.
   484     buttonExtent    := 0 @ 0.
   480     buttonExtent    := 0 @ 0.
   485     labelExtent     := 0 @ 0.
   481     labelExtent     := 0 @ 0.
       
   482     columnAlignment := #left.
   486 
   483 
   487     backgroundColor notNil ifTrue:[
   484     backgroundColor notNil ifTrue:[
   488         backgroundColor := backgroundColor on:dataSet device
   485         backgroundColor := backgroundColor on:dataSet device
   489     ].
   486     ].
   490     foregroundColor notNil ifTrue:[
   487     foregroundColor notNil ifTrue:[
   529     ].
   526     ].
   530 
   527 
   531     (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[
   528     (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[
   532         form := dataSet comboButtonForm.
   529         form := dataSet comboButtonForm.
   533         buttonExtent := dataSet comboButtonExtent.
   530         buttonExtent := dataSet comboButtonExtent.
       
   531     ] ifFalse:[
       
   532         columnAlignment := description columnAlignment
   534     ].
   533     ].
   535 
   534 
   536     selector := description printSelector.
   535     selector := description printSelector.
   537 
   536 
   538     selector notNil ifTrue:[
   537     selector notNil ifTrue:[
   658 ! !
   657 ! !
   659 
   658 
   660 !DataSetColumn class methodsFor:'documentation'!
   659 !DataSetColumn class methodsFor:'documentation'!
   661 
   660 
   662 version
   661 version
   663     ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.19 1998-05-06 13:37:40 ps Exp $'
   662     ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.20 1998-05-07 12:43:22 ca Exp $'
   664 ! !
   663 ! !