links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
aBookMorph makePageControlsFrom: controlSpec
Last updated at 9:55 pm UTC on 29 August 2016
The method which builds the page controls for a BookMorph according to specifications given in a literal array (shortControlSpecs or fullControlSpecs).

The specs array contains items which are either

The method #uses this to build with AlignmentMorph newRow a navigation tool.

 makePageControlsFrom: controlSpecs
 	"From the controlSpecs, create a set of page control and return them – this method does not add the controls to the receiver."
 	| c col row |
 	c := (color saturation > 0.1) ifTrue: [color slightlyLighter] ifFalse: [color slightlyDarker].
 	col := AlignmentMorph newColumn.
	col color: c; borderWidth: 0; layoutInset: 0.
	col hResizing: #spaceFill; vResizing: #shrinkWrap; extent: 5@5.

	row := AlignmentMorph newRow.
	row color: c; borderWidth: 0; layoutInset: 0.
	row hResizing: #spaceFill; vResizing: #shrinkWrap; extent: 5@5.
	controlSpecs do: [:spec | | lastGuy b |
		spec == #spacer
				[row addTransparentSpacerOfSize: (10 @ 0)]
				[spec == #variableSpacer
						[row addMorphBack: AlignmentMorph newVariableTransparentSpacer]
						[b := SimpleButtonMorph new target: self; borderWidth: 1; 
								borderColor: Color veryLightGray; color: c.
						b label: spec first;
						actionSelector: spec second;
						borderWidth: 0;
	 					setBalloonText: spec third.
						row addMorphBack: b.
						(((lastGuy := spec last asLowercase) includesSubstring: 'menu') or:
								[lastGuy includesSubstring: 'designations'])
							ifTrue: [b actWhen: #buttonDown]]]].  "pop up menu on mouseDown"
		col addMorphBack: row.
	^ col