'From Cuis 1.0 of 2 July 2009 [latest update: #215] on 6 July 2009 at 2:39:13 pm'!

!ScrollPane methodsFor: 'geometry' stamp: 'jmv 7/6/2009 14:39'!
layoutChanged
	| t topLeft newScrollRange |
	super layoutChanged.
	
	hideScrollBars ifTrue: [^self].
	
	newScrollRange _ self hTotalScrollRange @ self vTotalScrollRange.
	currentScrollRange = newScrollRange ifFalse: [
		WorldState addDeferredUIMessage: [ self setScrollDeltas ].
		currentScrollRange _ newScrollRange ].
	
	t _ Preferences scrollbarThickness.

	topLeft _ scrollBarOnLeft ifTrue: [
		"scrollbarOnLeft => retractableScrollBar"
		bounds topLeft + (0-t @ borderWidth)]
	ifFalse: [
		retractableScrollBar 
			ifTrue: [bounds topRight + (0-borderWidth @ borderWidth)]
			ifFalse: [bounds topRight + (0-t-borderWidth @ borderWidth)]].
	scrollBar 
		bounds: (topLeft extent: t @ self vScrollBarHeight).

	topLeft _ retractableScrollBar
				ifTrue: [bounds bottomLeft + (borderWidth @ borderWidth negated)]
				ifFalse: [bounds bottomLeft + (borderWidth @ (t + borderWidth) negated)].
	hScrollBar bounds: (topLeft extent: self hScrollBarWidth@ t)! !


!TextMorph methodsFor: 'private' stamp: 'jmv 7/6/2009 14:39'!
paragraph
	"Paragraph instantiation is lazy -- create it only when needed"
	paragraph ifNotNil: [^ paragraph].

self setProperty: #CreatingParagraph toValue: true.

	self setDefaultContentsIfNil.

	"...Code here to recreate the paragraph..."
	paragraph _ (self paragraphClass new textOwner: self owner).
	paragraph focused: self hasKeyboardFocus.
	paragraph
		compose: text
		style: textStyle copy
		in: self container.
	wrapFlag ifFalse: [
		"Was given huge container at first... now adjust"
		paragraph adjustRightX].
	self fit.
self removeProperty: #CreatingParagraph.


	^ paragraph! !

