[Cuis-dev] [ChangeSet] TextParagraphMorph

Hilaire Fernandes hilaire at drgeo.eu
Fri Nov 26 02:32:44 PST 2021


Hi Juan,

Here is a small change set over your recent TextParagraphMorph to add 
background and border by inheriting from WidgetMorph.

I want to use this morph has a status bar information widget in DrGeo 
window.

There is still an issue I can't fix: the text is drawn over the border, 
not sure there is an elegant way to solve it without redrawing the 
border, which ruin the inheritance. It is a bit like 
#textComposition:bounds:color:selectionColor: is not strickly honoring 
the bounds argument.

I let check out. I have another change of the drawnOn: method but you 
may have better idea

Hilaire

-- 
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211126/28053c0c/attachment.htm>
-------------- next part --------------
'From Cuis 5.0 [latest update: #4978] on 26 November 2021 at 11:11:57 am'!

!TextParagraphMorph methodsFor: 'drawing' stamp: 'hlsf 11/26/2021 10:59:52'!
drawOn: aCanvas
	super drawOn: aCanvas.
	aCanvas
		textComposition: textComposition
		bounds: (self morphLocalBounds insetBy: borderWidth * 2)
		color: Theme current text
		selectionColor: `Color red`.! !

!TextParagraphMorph methodsFor: 'geometry' stamp: 'hlsf 11/26/2021 11:09:33'!
adjustExtent
	"This is just a suggestion. If we do wordwrap, the width will be honored.
	But the height is whatever is appropriate for the contents!! See #fit"
	self morphExtent: owner viewableExtent! !

!TextParagraphMorph methodsFor: 'geometry' stamp: 'hlsf 11/26/2021 11:06:43'!
privateExtent: aPoint
	| newExtent |

	newExtent _ aPoint.
	(owner is: #ScrollPane) ifTrue: [
		"We decide our own height"
		newExtent _ aPoint x truncated @ extent y ].
	^ super privateExtent: newExtent ! !



More information about the Cuis-dev mailing list