'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 16 October 2008 at 2:45:51 pm'!
!classDefinition: #ButtonLW category: #'LightWidgets-Kernel'!
LightWidget subclass: #ButtonLW
	instanceVariableNames: 'actionArgument pressed contentsOrGetter font label selectedBackColor backColor selectedForeColor foreColor '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'LightWidgets-Kernel'!

!ButtonLW methodsFor: 'accessing' stamp: 'jmv 10/16/2008 10:50'!
backColor
	^self hasNavigationFocus
		ifTrue: [ selectedBackColor ]
		ifFalse: [ backColor ]! !

!ButtonLW methodsFor: 'accessing' stamp: 'jmv 10/16/2008 10:51'!
backColor: aColor
	backColor _ aColor! !

!ButtonLW methodsFor: 'accessing' stamp: 'jmv 10/16/2008 10:50'!
foreColor
	^self hasNavigationFocus
		ifTrue: [ selectedForeColor ]
		ifFalse: [ foreColor ]! !

!ButtonLW methodsFor: 'accessing' stamp: 'jmv 10/16/2008 10:51'!
foreColor: aColor
	foreColor _ aColor! !

!ButtonLW methodsFor: 'accessing' stamp: 'jmv 10/16/2008 10:50'!
selectedBackColor: aColor
	selectedBackColor _ aColor! !

!ButtonLW methodsFor: 'accessing' stamp: 'jmv 10/16/2008 10:50'!
selectedForeColor: aColor
	selectedForeColor _ aColor! !

!ButtonLW methodsFor: 'drawing' stamp: 'jmv 10/16/2008 10:55'!
drawHighlightOn: aCanvas
	"Nothing to do. This class does highlighting in #drawOn:"! !

!ButtonLW methodsFor: 'drawing' stamp: 'jmv 10/16/2008 10:55'!
drawOn: aCanvas
	| w h c border |
	c _ self backColor.
	border _ pressed
		ifTrue: [self pressedBorderStyleWith: c]
		ifFalse: [self borderStyleWith: c].
	aCanvas fillRectangle: bounds fillStyle: c borderStyle: border.
	w _ (font widthOfString: label) // 2.
	h _ font ascent // 2.
	pressed ifTrue: [
		w _ w - 1.
		h _ h - 1].
	aCanvas drawString: label at: bounds center - (w@h) font: font color: self foreColor! !

!ButtonLW methodsFor: 'initialization' stamp: 'jmv 10/16/2008 11:02'!
initialize
	super initialize.
	target _ 'I am the target'.
	action _ #show.
	bounds _ 10@10 extent: 60@30.
	label _ 'button label'.
	font _ (TextStyle named: 'Vera') fontNamed: 'Vera 16'.
	foreColor _ Color white.
	selectedForeColor _ Color white.
	backColor _ Color r: 0.32 g: 0.39 b: 0.63.
	selectedBackColor _ Color r: 0.42 g: 0.5 b: 0.81.
	pressed _ false! !


!LabelLW methodsFor: 'accessing' stamp: 'jmv 10/16/2008 11:15'!
font
	^font! !

!LabelLW methodsFor: 'accessing' stamp: 'jmv 10/16/2008 11:13'!
fontColor

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

!LabelLW methodsFor: 'accessing' stamp: 'jmv 10/16/2008 11:17'!
labelHeight
	^ font height! !

!LabelLW methodsFor: 'accessing' stamp: 'jmv 10/16/2008 11:17'!
labelWidth
	^ font widthOfString: target! !

!classDefinition: #ButtonLW category: #'LightWidgets-Kernel'!
LightWidget subclass: #ButtonLW
	instanceVariableNames: 'actionArgument pressed contentsOrGetter font label foreColor backColor selectedForeColor selectedBackColor'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'LightWidgets-Kernel'!
