'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 31 May 2008 at 11:00:54 am'!
!classDefinition: #LabelLW category: #'LightWidgets-Kernel'!
LightWidget subclass: #LabelLW
	instanceVariableNames: 'font contents fontColor'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'LightWidgets-Kernel'!
!classDefinition: #ProgressBarLW category: #'LightWidgets-Kernel'!
LightWidget subclass: #ProgressBarLW
	instanceVariableNames: 'displayTextFlag'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'LightWidgets-Kernel'!

!ButtonLW methodsFor: 'as yet unclassified' stamp: 'jdb 5/27/2008 08:24'!
keyStroke: anEvent	
	
		(anEvent commandKeyPressed and: [anEvent keyValue = 13]) ifTrue: [
		ActiveHand navigationFocus notNil ifTrue: [
			ActiveHand navigationFocus: self].
		(target notNil and: [action notNil])
			ifTrue:[target perform: action].
		
		self updateView].
	super keyStroke: anEvent
	! !


!LabelLW methodsFor: 'accessing' stamp: 'jdb 5/27/2008 16:25'!
fontColor

	fontColor ifNil: [fontColor := Color blue].
	^fontColor! !

!LabelLW methodsFor: 'accessing' stamp: 'jdb 5/27/2008 16:25'!
fontColor: aColor

	fontColor := aColor! !

!LabelLW methodsFor: 'drawing' stamp: 'jdb 5/27/2008 16:26'!
drawOn: aCanvas

	aCanvas drawString: contents asString at: bounds topLeft font: font color: (self fontColor)! !


!ProgressBarLW methodsFor: 'initialization' stamp: 'jdb 5/27/2008 08:39'!
initialize
	super initialize.
	bounds _ 10@10 extent: 200@30.
	displayTextFlag := false.
! !

!ProgressBarLW methodsFor: 'drawing' stamp: 'jdb 5/27/2008 08:41'!
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).	
	fillBounds _bounds origin extent: ( progressExtent@bounds extent y).
	aCanvas fillRectangle:  fillBounds  color: self fillColor.
	
	displayTextFlag ifTrue:[
		str _ pp 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
	
! !

!ProgressBarLW methodsFor: 'accessing' stamp: 'jdb 5/27/2008 08:39'!
displayTextFlag
	"Answer the value of displayTextFlag"

	^ displayTextFlag! !

!ProgressBarLW methodsFor: 'accessing' stamp: 'jdb 5/27/2008 08:39'!
displayTextFlag: anObject
	"Set the value of displayTextFlag"

	displayTextFlag _ anObject! !

