--- a/ProgressIndicator.st Mon Mar 30 14:07:50 1998 +0200
+++ b/ProgressIndicator.st Mon Mar 30 14:27:33 1998 +0200
@@ -11,8 +11,8 @@
"
View subclass:#ProgressIndicator
- instanceVariableNames:'percentage showPercentage fgColor connectedTop connectedLabel
- collector finishAction closeTopWhenDone'
+ instanceVariableNames:'percentage showPercentage fgColor bgColor connectedTop
+ connectedLabel collector finishAction closeTopWhenDone'
classVariableNames:''
poolDictionaries:''
category:'Views-Misc'
@@ -355,22 +355,22 @@
top := Dialog new.
top label:aLabel.
top cursor:(Cursor wait).
-
+ y2 := 0.
anIcon notNil ifTrue:[
- y := top yPosition.
- l := top addTextLabel:anIcon.
- l borderWidth:0.
- l adjust:#left.
- l cursor:(Cursor wait).
- y2 := top yPosition.
- top yPosition:y.
+ y := top yPosition.
+ l := top addTextLabel:anIcon.
+ l borderWidth:0.
+ l adjust:#left.
+ l cursor:(Cursor wait).
+ y2 := top yPosition.
+ top yPosition:y.
].
l := top addTextLabel:text.
l borderWidth:0.
l adjust:#left.
l cursor:(Cursor wait).
- l leftInset:(anIcon width + 10).
+ anIcon notNil ifTrue: [l leftInset:(anIcon width + 10)].
top yPosition:(top yPosition max:y2).
@@ -388,13 +388,13 @@
top addComponent:p.
additionalView notNil ifTrue:[
- top addComponent:additionalView.
- additionalView extent:(1.0 @ additionalView preferredExtent y).
+ top addComponent:additionalView.
+ additionalView extent:(1.0 @ additionalView preferredExtent y).
].
abortable ifTrue:[
- top addVerticalSpace.
- top addAbortButton
+ top addVerticalSpace.
+ top addAbortButton
].
^ p
@@ -480,6 +480,26 @@
!ProgressIndicator methodsFor:'accessing - look'!
+backgroundColor
+ "return the percentage displays background color"
+
+ ^ bgColor
+
+!
+
+backgroundColor:aColor
+ "set the percentage displays background color"
+
+ aColor ~~ bgColor ifTrue:[
+ bgColor := aColor.
+
+ shown ifTrue:[
+ self invalidate
+ ]
+ ].
+
+!
+
foregroundColor
"return the percentage displays foreground color"
@@ -549,31 +569,31 @@
rx := (w * percentage / 100) rounded.
- self paint:viewBackground.
+ self paint:bgColor.
self fillRectangleX:m y:m width:w height:h.
showPercentage ifTrue:[
- s := percentage printString , ' %'.
- sw := font widthOf:s.
- sx := (width - sw) // 2.
- sy := height // 2 + font descent + 2.
+ s := percentage printString , ' %'.
+ sw := font widthOf:s.
+ sx := (width - sw) // 2.
+ sy := height // 2 + font descent + 2.
- rx <= (sx+sw) ifTrue:[
- self paint:Color black.
- self displayString:s x:sx y:sy.
- ]
+ rx <= (sx+sw) ifTrue:[
+ self paint:Color black.
+ self displayString:s x:sx y:sy.
+ ]
].
self paint:fgColor.
self fillRectangleX:m y:m width:rx height:h.
showPercentage ifTrue:[
- rx >= sx ifTrue:[
- self clippingRectangle:(m@m corner:rx+1 @ h).
- self paint:Color white.
- self displayString:s x:sx y:sy.
- self clippingRectangle:nil
- ]
+ rx >= sx ifTrue:[
+ self clippingRectangle:(m@m corner:rx+1 @ h).
+ self paint:Color white.
+ self displayString:s x:sx y:sy.
+ self clippingRectangle:nil
+ ]
]
"Modified: 22.10.1997 / 21:05:31 / cg"
@@ -585,28 +605,27 @@
"initialize styleSheet values"
<resource: #style (#'progressIndicator.viewBackground'
- #'progressIndicator.foregroundColor')>
+ #'progressIndicator.foregroundColor')>
super initStyle.
self is3D ifTrue:[
- self level:-1
+ self level:-1
].
- viewBackground := styleSheet colorAt:'progressIndicator.viewBackground' default:Color white.
+ bgColor := styleSheet colorAt:'progressIndicator.viewBackground' default:Color white.
fgColor := styleSheet colorAt:'progressIndicator.foregroundColor' default:Color blue.
fgColor := fgColor onDevice:device.
showPercentage := true.
- "Created: 22.10.1997 / 21:06:48 / cg"
!
initialize
+
super initialize.
+
percentage := 0.
-
- "Modified: 22.10.1997 / 21:07:06 / cg"
! !
!ProgressIndicator methodsFor:'private'!
@@ -716,5 +735,5 @@
!ProgressIndicator class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.18 1997-12-15 11:13:28 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.19 1998-03-30 12:27:33 tz Exp $'
! !