'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 12 May 2008 at 4:19 am'!
!classDefinition: #PersonView category: #'LightWidgets-Examples'!
CompositeLW subclass: #PersonView
	instanceVariableNames: 'nameLW birthdayLW ageLW hideNameLW hide sliderLW genderLW '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'LightWidgets-Examples'!

!PersonView methodsFor: 'initialization'!
initialize
	"initialize the state of the receiver"
	| n b a  g |
	super initialize.
	bounds _ 10@10 extent: 450@400.
	
	n _ LabelLW label:  'Name:'.
	n bounds: ((10@20) extent: 90@40).
	nameLW _ EntryFieldLW new
		aspect: #name;
		action: #name:;
		bounds: (115 @20 extent: 200@40).
	hide _ false.
	hideNameLW _ ButtonLW  target: self action:#toogleHideName label:'Hide name'.	
	hideNameLW bounds: ((115+205) @20 extent: 120@40).
	
	b _ LabelLW label:  'Birthday:'.
	b bounds: ((10@65) extent: 100@40).
	birthdayLW _ EntryFieldLW new
		aspect: #birthday adaptor: #asString action: #birthday: adaptor: #asDate;
		bounds: (115@65 extent: 200@40).
	
	a _ LabelLW label:  'Age:'.
	a bounds: ((10@115) extent: 50@40).
	ageLW _ EntryFieldLW new
		aspect: #age adaptor: #asString action: #age: adaptor: #asNumber;
		bounds: (115@115 extent: 200@40).
	sliderLW _ SliderLW new
		target: target aspect:#age action: #age:;
		bounds:( 115@160 extent: 200@40).
	 
	g _ LabelLW label:  'Gender:'.
	g bounds: ((10@210) extent: 100@40).
	genderLW_ ListLW new.
	genderLW
		bounds: (115@255 extent: 200@55);	
		addItem: 'Male' action: #male;
		addItem: 'Female' action: #female.
	self 
		addMorphBack: n; addMorphBack: nameLW;
		addMorphBack:b; addMorphBack: birthdayLW;addMorphBack: hideNameLW;
		addMorphBack: a; addMorphBack: ageLW;addMorphBack: sliderLW;
		addMorphBack: g; addMorphBack: genderLW.
	
	ActiveHand navigationFocus: nameLW! !

!PersonView methodsFor: 'user commands' stamp: 'F Olivero 5/12/2008 04:14'!
female
! !

!PersonView methodsFor: 'user commands' stamp: 'F Olivero 5/12/2008 04:14'!
male
! !

!PersonView methodsFor: 'user commands'!
toogleHideName
	hide _ hide not.
	self updateView! !

!PersonView methodsFor: 'updating'!
updateView
	| hideLabel |
	nameLW target: target.
	hide
		ifTrue:[	nameLW  hideValue]
		ifFalse:[	nameLW  showValue].
	
	
	birthdayLW target: target.
	ageLW target: target.
	sliderLW target: target.

	hide
		ifTrue:[hideLabel _ 'Show Name']
		ifFalse:[hideLabel_ 'Hide Name'].
	hideNameLW
		target: self;
		label:  hideLabel.
		

! !

!classDefinition: #PersonView category: #'LightWidgets-Examples'!
CompositeLW subclass: #PersonView
	instanceVariableNames: 'nameLW birthdayLW ageLW sliderLW hideNameLW hide genderLW'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'LightWidgets-Examples'!

!PersonView reorganize!
('drawing' drawOn:)
('initialization' initialize)
('user commands' female male toogleHideName)
('updating' updateView)
!

