'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 6 March 2009 at 9:23:54 am'!

!ProgressBarLW methodsFor: 'drawing' stamp: 'jmv 3/6/2009 09:23'!
drawOn: aCanvas
	| fillBounds pp progressExtent bw xOffset str bc font pos |
	bw _ self borderWidth.
	bc _ self borderColor.
	font _ self defaultFont.
	
	aCanvas fillRectangle: bounds color: self backgroundColor.
	
	fillBounds _ bounds .
	pp _ self progressPercentage .
	progressExtent _ (pp  * (bounds extent x/100)) rounded.	
	fillBounds _bounds origin extent: ( progressExtent@bounds extent y).
	aCanvas fillRectangle:  fillBounds  color: self fillColor.
	
	displayTextFlag ifTrue:[
		str _ pp rounded asString , '%'.
		pp  < 50 ifTrue:[xOffset _ progressExtent +  bw ]
			     	ifFalse:[xOffset _  progressExtent - (font widthOfString: str)].
		pos _  bounds origin + (xOffset@bw).
		aCanvas drawString: str at: pos font: font color: bc].
	
	aCanvas frameRectangle: bounds width: bw color: bc
	
! !

