DSVColumnView.st
changeset 1100 376515452be4
parent 1089 931865a72ba7
child 1109 b97053dce48c
equal deleted inserted replaced
1099:dd55d01efdd7 1100:376515452be4
    21 		catchChangeEvents beDependentOfRows bgColor hgLgFgColor
    21 		catchChangeEvents beDependentOfRows bgColor hgLgFgColor
    22 		hgLgBgColor actionBlock builder doubleClickActionBlock
    22 		hgLgBgColor actionBlock builder doubleClickActionBlock
    23 		verticalSpacing horizontalSpacing rowSelectorForm
    23 		verticalSpacing horizontalSpacing rowSelectorForm
    24 		buttonLightColor buttonShadowColor buttonHalfLightColor
    24 		buttonLightColor buttonShadowColor buttonHalfLightColor
    25 		buttonHalfShadowColor checkToggleExtent checkToggleForm
    25 		buttonHalfShadowColor checkToggleExtent checkToggleForm
    26 		checkToggleLevel comboButtonExtent comboButtonForm
    26 		checkToggleActiveImage checkTogglePassiveImage checkToggleLevel
    27 		comboButtonLevel clickPosition dragAccessPoint dragIsActive
    27 		comboButtonExtent comboButtonForm comboButtonLevel clickPosition
    28 		dropTarget dropSource columnAdaptor dataSetView'
    28 		dragAccessPoint dragIsActive dropTarget dropSource columnAdaptor
       
    29 		dataSetView'
    29 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
    30 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
    30 		DefaultHilightForegroundColor DefaultHilightBackgroundColor
    31 		DefaultHilightForegroundColor DefaultHilightBackgroundColor
    31 		RowSelector ButtonLightColor ButtonShadowColor
    32 		RowSelector ButtonLightColor ButtonShadowColor
       
    33 		CheckToggleActiveImage CheckTogglePassiveImage
    32 		ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle'
    34 		ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle'
    33 	poolDictionaries:''
    35 	poolDictionaries:''
    34 	category:'Views-DataSet'
    36 	category:'Views-DataSet'
    35 !
    37 !
    36 
    38 
   197     DefaultHilightBackgroundColor := StyleSheet colorAt:'selection.hilightBackgroundColor' default:DefaultForegroundColor.
   199     DefaultHilightBackgroundColor := StyleSheet colorAt:'selection.hilightBackgroundColor' default:DefaultForegroundColor.
   198 
   200 
   199     DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[
   201     DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[
   200         DefaultHilightBackgroundColor := Color black
   202         DefaultHilightBackgroundColor := Color black
   201     ].
   203     ].
   202     ButtonLightColor      := StyleSheet colorAt:'button.lightColor'.
   204     ButtonLightColor       := StyleSheet colorAt:'button.lightColor'.
   203     ButtonShadowColor     := StyleSheet colorAt:'button.shadowColor'.
   205     ButtonShadowColor      := StyleSheet colorAt:'button.shadowColor'.
   204     ButtonHalfLightColor  := StyleSheet colorAt:'button.halfLightColor'.
   206     ButtonHalfLightColor   := StyleSheet colorAt:'button.halfLightColor'.
   205     ButtonHalfShadowColor := StyleSheet colorAt:'button.halfShadowColor'.
   207     ButtonHalfShadowColor  := StyleSheet colorAt:'button.halfShadowColor'.
   206     ButtonEdgeStyle       := StyleSheet at:'button.edgeStyle'.
   208     ButtonEdgeStyle        := StyleSheet at:'button.edgeStyle'.
       
   209     CheckToggleActiveImage := StyleSheet at:'checkToggle.activeImage'.
       
   210 
       
   211     CheckToggleActiveImage isNil ifTrue:[
       
   212         CheckTogglePassiveImage := nil
       
   213     ] ifFalse:[
       
   214         CheckTogglePassiveImage := StyleSheet at:'checkToggle.passiveImage'.
       
   215 
       
   216         CheckTogglePassiveImage isNil ifTrue:[
       
   217             CheckToggleActiveImage := nil
       
   218         ]
       
   219     ].
   207 
   220 
   208 "
   221 "
   209 self updateStyleCache.
   222 self updateStyleCache.
   210 "
   223 "
   211 
   224 
   514 
   527 
   515 ! !
   528 ! !
   516 
   529 
   517 !DSVColumnView methodsFor:'accessing interactors'!
   530 !DSVColumnView methodsFor:'accessing interactors'!
   518 
   531 
       
   532 checkToggleActiveImage
       
   533     ^ checkToggleActiveImage
       
   534 !
       
   535 
   519 checkToggleExtent
   536 checkToggleExtent
   520     "returns the extent of a checkToggle
   537     "returns the extent of a checkToggle
   521     "
   538     "
   522     ^ checkToggleExtent
   539     ^ checkToggleExtent
   523 !
   540 !
   530 
   547 
   531 checkToggleLevel
   548 checkToggleLevel
   532     "returns the level of a checkToggle button
   549     "returns the level of a checkToggle button
   533     "
   550     "
   534     ^ checkToggleLevel
   551     ^ checkToggleLevel
       
   552 !
       
   553 
       
   554 checkTogglePassiveImage
       
   555     ^ checkTogglePassiveImage
   535 !
   556 !
   536 
   557 
   537 comboButtonExtent
   558 comboButtonExtent
   538     "returns the extent of a comboList or -Box
   559     "returns the extent of a comboList or -Box
   539     "
   560     "
  1150         ^ col
  1171         ^ col
  1151     ].
  1172     ].
  1152     ^ bgColor
  1173     ^ bgColor
  1153 !
  1174 !
  1154 
  1175 
  1155 drawEdgesAtX:x y:y width:w height:h level:aLevel
  1176 drawButtonAt:x y:y width:w height:h level:aLevel rownNumber:aRowNr
  1156     "draw edges
  1177     "draw a button
  1157     "
  1178     "
  1158     self drawEdgesAtX:x y:y width:w height:h level:aLevel on:self
  1179     (self isRowSelected:aRowNr) ifTrue:[
       
  1180         self paint:bgColor.
       
  1181         self fillRectangleX:x y:y width:w height:h.
       
  1182     ].
       
  1183     self drawEdgesAtX:x y:y width:w height:h level:aLevel on:self.
       
  1184     self paint:fgColor on:bgColor.
       
  1185 
  1159 !
  1186 !
  1160 
  1187 
  1161 drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC
  1188 drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC
  1162     "draw edges
  1189     "draw edges
  1163     "
  1190     "
  1346                 x0 := x1
  1373                 x0 := x1
  1347             ].
  1374             ].
  1348             self clippingRectangle:savClip.
  1375             self clippingRectangle:savClip.
  1349         ]
  1376         ]
  1350     ].
  1377     ].
  1351 !
       
  1352 
       
  1353 setFgBgPaintFor:aRowNr
       
  1354     (self isRowSelected:aRowNr) ifFalse:[self paint:fgColor     on:bgColor]
       
  1355                                  ifTrue:[self paint:hgLgFgColor on:hgLgBgColor].
       
  1356 
       
  1357 
       
  1358 ! !
  1378 ! !
  1359 
  1379 
  1360 !DSVColumnView methodsFor:'enumerating columns'!
  1380 !DSVColumnView methodsFor:'enumerating columns'!
  1361 
  1381 
  1362 columnsDo:aOneArgBlock
  1382 columnsDo:aOneArgBlock
  1754 
  1774 
  1755 ! !
  1775 ! !
  1756 
  1776 
  1757 !DSVColumnView methodsFor:'gc operations'!
  1777 !DSVColumnView methodsFor:'gc operations'!
  1758 
  1778 
       
  1779 imageOnDevice:anImage
       
  1780     "associate image to device and clear pixel mask; returns the new image.
       
  1781     "
       
  1782     |image|
       
  1783 
       
  1784     (image := anImage) notNil ifTrue:[
       
  1785         image device ~~ device ifTrue:[
       
  1786             image := image copy.
       
  1787         ].
       
  1788         image := image on:device.
       
  1789         image isImage ifTrue:[
       
  1790             image := image clearMaskedPixels
       
  1791         ]
       
  1792     ].
       
  1793     ^ image
       
  1794 
       
  1795 !
       
  1796 
  1759 registerImage:anImage key:aKey
  1797 registerImage:anImage key:aKey
  1760     "any row can register an image with a unique identifier a key symbol
  1798     "any row can register an image with a unique identifier a key symbol
  1761     "
  1799     "
  1762     |img|
  1800     |img|
  1763 
  1801 
  1764     (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[
  1802     (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[
  1765         ^ img
  1803         ^ img
  1766     ].
  1804     ].
  1767     img := anImage onDevice:device.
  1805     img := self imageOnDevice:img.
  1768     img clearMaskedPixels.
       
  1769     registererImages at:aKey put:img.
  1806     registererImages at:aKey put:img.
  1770     ^ img
  1807     ^ img
  1771 !
  1808 !
  1772 
  1809 
  1773 registeredImageAt:aKey
  1810 registeredImageAt:aKey
  1801     ].
  1838     ].
  1802 
  1839 
  1803     buttonHalfLightColor notNil ifTrue:[
  1840     buttonHalfLightColor notNil ifTrue:[
  1804         buttonHalfLightColor := buttonHalfLightColor on:device
  1841         buttonHalfLightColor := buttonHalfLightColor on:device
  1805     ].
  1842     ].
       
  1843     rowSelectorForm         := self imageOnDevice:rowSelectorForm.
       
  1844     checkToggleActiveImage  := self imageOnDevice:checkToggleActiveImage.
       
  1845     checkTogglePassiveImage := self imageOnDevice:checkTogglePassiveImage.
       
  1846     comboButtonForm         := self imageOnDevice:comboButtonForm.
       
  1847     checkToggleForm         := self imageOnDevice:checkToggleForm.
       
  1848 
       
  1849 
  1806 !
  1850 !
  1807 
  1851 
  1808 destroy
  1852 destroy
  1809     "remove dependencies
  1853     "remove dependencies
  1810     "
  1854     "
  1814 !
  1858 !
  1815 
  1859 
  1816 initStyle
  1860 initStyle
  1817     "setup colors
  1861     "setup colors
  1818     "
  1862     "
  1819     |v b|
  1863     |button widget|
  1820 
  1864 
  1821     super initStyle.
  1865     super initStyle.
  1822 
  1866 
  1823     DefaultForegroundColor isNil ifTrue:[
  1867     DefaultForegroundColor isNil ifTrue:[
  1824         self class updateStyleCache
  1868         self class updateStyleCache
  1845 
  1889 
  1846         buttonHalfShadowColor isNil ifTrue:[
  1890         buttonHalfShadowColor isNil ifTrue:[
  1847             buttonHalfShadowColor := buttonShadowColor lightened
  1891             buttonHalfShadowColor := buttonShadowColor lightened
  1848         ]
  1892         ]
  1849     ].
  1893     ].
  1850     rowSelectorForm := (self class rowSelector) on:device.
  1894     rowSelectorForm         := self class rowSelector.
  1851 
  1895     checkToggleActiveImage  := CheckToggleActiveImage.
  1852     v := ComboBoxView new.
  1896     checkTogglePassiveImage := CheckTogglePassiveImage.
  1853     b := v menuButton.
  1897 
  1854 
  1898     widget            := ComboListView new.
  1855     (comboButtonForm := b label) isImage ifTrue:[
  1899     button            := widget menuButton.
  1856         comboButtonForm clearMaskedPixels
  1900     comboButtonForm   := button label.
  1857     ].
  1901     comboButtonLevel  := button offLevel.
  1858 
  1902     comboButtonExtent := (button preferredExtent x) @ (widget preferredExtent y).
  1859     comboButtonLevel  := b offLevel.
  1903 
  1860     comboButtonExtent := (b preferredExtent x) @ (v preferredExtent y).
  1904     widget            := CheckToggle new.
  1861 
  1905     checkToggleForm   := widget label.
  1862     b := CheckToggle new.
  1906     checkToggleLevel  := widget offLevel.
  1863 
  1907     checkToggleExtent := widget preferredExtent.
  1864     (checkToggleForm := CheckToggle checkFormOn:device) isImage ifTrue:[
       
  1865         checkToggleForm clearMaskedPixels
       
  1866     ].
       
  1867     checkToggleLevel  := b offLevel.
       
  1868     checkToggleExtent := b preferredExtent.
       
  1869 
  1908 
  1870 
  1909 
  1871 
  1910 
  1872 
  1911 
  1873 
  1912 
  2776 ! !
  2815 ! !
  2777 
  2816 
  2778 !DSVColumnView class methodsFor:'documentation'!
  2817 !DSVColumnView class methodsFor:'documentation'!
  2779 
  2818 
  2780 version
  2819 version
  2781     ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.50 1998-08-24 05:23:38 ca Exp $'
  2820     ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.51 1998-08-29 13:47:49 ca Exp $'
  2782 ! !
  2821 ! !