--- a/ProgressIndicator.st Wed Oct 22 17:47:35 1997 +0200
+++ b/ProgressIndicator.st Wed Oct 22 21:10:51 1997 +0200
@@ -38,6 +38,11 @@
"
a view showing a rectangle filled according the percentage value.
Can be used as a progress indicator a la MSwindows.
+ Can be used as a widget within an application, or
+ via the convenient #inBox: instance creation messages,
+ which shows a progressDisplay in a modalBox, while some
+ action is performed.
+ See examples.
[author:]
Claus Gittinger
@@ -314,7 +319,12 @@
!ProgressIndicator class methodsFor:'instance creation'!
inBox
- ^ self inBoxWithLabel:'executing ...' abortable:false
+ "create a topView containing an instance of myself,
+ for later use with #showProgressOf:"
+
+ ^ self inBoxWithLabel:'executing ...' abortable:false
+
+ "Modified: 22.10.1997 / 21:08:37 / cg"
!
inBoxWithLabel:aLabel
@@ -511,17 +521,23 @@
!ProgressIndicator methodsFor:'change & update'!
update:aspect with:aParameter from:changedObject
+ "react upon value changes of my model"
+
(aspect == aspectMsg
and:[changedObject == model]) ifTrue:[
- self percentage:(model perform:aspectMsg).
- ^ self
+ self percentage:(model perform:aspectMsg).
+ ^ self
].
^ super update:aspect with:aParameter from:changedObject
+
+ "Modified: 22.10.1997 / 21:05:11 / cg"
! !
!ProgressIndicator methodsFor:'drawing'!
redraw
+ "redraw the percentage bar and optional percentage string"
+
|s rx sx sy sw m w h|
m := margin + 1.
@@ -557,48 +573,60 @@
]
]
- "Modified: 3.4.1997 / 21:15:48 / cg"
+ "Modified: 22.10.1997 / 21:05:31 / cg"
! !
!ProgressIndicator methodsFor:'initialization'!
-initialize
- <resource: #style (#progressIndicatorViewBackground #progressIndicatorForegroundColor)>
+initStyle
+ "initialize styleSheet values"
- super initialize.
+ <resource: #style (#progressIndicator.viewBackground #progressIndicator.foregroundColor)>
+
+ super initStyle.
self is3D ifTrue:[
self level:-1
].
- viewBackground := styleSheet colorAt:'progressIndicatorViewBackground' default:Color white.
+ viewBackground := styleSheet colorAt:'progressIndicator.viewBackground' default:Color white.
- fgColor := styleSheet colorAt:'progressIndicatorForegroundColor' default:Color blue.
+ fgColor := styleSheet colorAt:'progressIndicator.foregroundColor' default:Color blue.
fgColor := fgColor onDevice:device.
- percentage := 0.
showPercentage := true.
- "Modified: 3.4.1997 / 21:15:29 / cg"
+ "Created: 22.10.1997 / 21:06:48 / cg"
+!
+
+initialize
+ super initialize.
+ percentage := 0.
+
+ "Modified: 22.10.1997 / 21:07:06 / cg"
+! !
+
+!ProgressIndicator methodsFor:'private'!
+
+connectToTop:top label:label
+ connectedTop := top.
+ connectedLabel := label
! !
!ProgressIndicator methodsFor:'queries'!
preferredExtent
+ "return my preferred extent"
+
preferredExtent notNil ifTrue:[
^ preferredExtent
].
^ 100 @ (font height + font descent + ((margin + 1) * 2))
- "Modified: 29.3.1997 / 16:09:32 / cg"
+ "Modified: 22.10.1997 / 21:07:17 / cg"
! !
!ProgressIndicator methodsFor:'showing progress'!
-connectToTop:top label:label
- connectedTop := top.
- connectedLabel := label
-!
-
showProgressOf:aBlock
"show progress, while evaluating aBlock.
If the receiver has been created with inBox, show the
@@ -684,5 +712,5 @@
!ProgressIndicator class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.15 1997-04-03 19:26:45 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.16 1997-10-22 19:10:51 cg Exp $'
! !