class: GradientBackground
comment/format in: #horizontal:to:
changed:
#asFormOn:
#fillRectangleX:y:width:height:in:
--- a/GradientBackground.st Fri Feb 22 12:45:43 2013 +0100
+++ b/GradientBackground.st Fri Feb 22 13:35:02 2013 +0100
@@ -60,6 +60,14 @@
v viewBackground:bg.
v open.
"
+ "
+ |bg v|
+
+ bg := GradientBackground horizontal:Color red to:Color yellow.
+ v := View new extent:300@300.
+ v viewBackground:bg.
+ v open.
+ "
!
vertical:color1 to:color2
@@ -155,15 +163,20 @@
!GradientBackground methodsFor:'converting'!
asFormOn:aDevice
- |h w|
+ |h w len|
+
+ usedLength == #full ifTrue:[self halt. ^ nil].
cachedForm isNil ifTrue:[
+ (len := usedLength) == #full ifTrue:[
+ len := nil
+ ].
(direction == #northSouth or:[direction == nil]) ifTrue:[
- h := usedLength ? (Display height). "/ aView height.
+ h := len ? (Display height). "/ aView height.
w := 8.
] ifFalse:[
h := 8.
- w := usedLength ? (Display width). "/ aView width.
+ w := len ? (Display width). "/ aView width.
].
cachedForm := Form width:w height:h depth:aDevice depth onDevice:aDevice.
"/ cachedForm clear.
@@ -194,10 +207,17 @@
"/ always take the full-screen as reference
"/ (so we do not have to care for changed gradient, when view changes size)
usedLength notNil ifTrue:[
- hAll := usedLength.
- wAll := usedLength.
- scaleStartX := 0.
- scaleStartY := 0.
+ usedLength == #full ifTrue:[
+ hAll := aView height.
+ wAll := aView width.
+ scaleStartX := 0.
+ scaleStartY := 0.
+ ] ifFalse:[
+ hAll := usedLength.
+ wAll := usedLength.
+ scaleStartX := 0.
+ scaleStartY := 0.
+ ]
] ifFalse:[
hAll := Display height. "/ aView height.
wAll := Display width. "/ aView width.
@@ -306,7 +326,11 @@
!GradientBackground class methodsFor:'documentation'!
+version
+ ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.15 2013-02-22 12:35:02 cg Exp $'
+!
+
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.14 2013-02-22 11:45:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.15 2013-02-22 12:35:02 cg Exp $'
! !