TPrimitiveText


Croquet-Teapot

Comment:

Main comment stating the purpose of this class and relevant relationship to other classes.

Possible useful expressions for doIt or printIt.

Structure:
 instVar1		type -- comment about the purpose of instVar1
 instVar2		type -- comment about the purpose of instVar2

Any further useful comments about the general approach of this implementation.

Hierarchy:

ProtoObject
Object
TObject
TFrame
TPrimitive
TPrimitiveText

Summary:

instance variables:

paragraph text textAlign textBounds textColor textInset textStyle

methods:

instance class
accessing initialize render no messages

Detail:

instance variables:

paragraph
text
textAlign
textBounds
textColor
textInset
textStyle

instance methods:

accessing
text

	^text
text: aText

	text := aText asText.
	self boundsChanged.
textAlign

	^textAlign
textAlign: aSymbol

	textAlign := aSymbol.
	self boundsChanged.
textBounds

	^textBounds ifNil:[paragraph bounds]
textBounds: aRectangle

	textBounds := aRectangle.
	self boundsChanged.
textColor

	^textColor
textColor: aColor

	textColor := aColor.
	self boundsChanged.

initialize
initialize

	super initialize.
	textColor := Color black.
	textStyle := TextStyle default.
	textInset := 3@3.
	"textBounds := 0@0 extent: 100@50."
	self text: ''.
	^self

render
boundsChanged

	super boundsChanged.
	paragraph := NewParagraph new.
	paragraph wantsColumnBreaks: false.
	paragraph compose: text style: textStyle copy from: 1 in: (textBounds ifNil:[0@0 extent: 99999@99999])
renderPrimitive: ogl

	| box |
	box := self textBounds outsetBy: textInset.
	ogl 
		glDisable: GLLighting;
		drawStringRect: box at: 0@0@0 color: Color white align: textAlign;
		frameStringRect: box at: 0@0@0 color: Color black align: textAlign;
	"	drawString: text asString at: 0@0@0 font: nil color: textColor align: textAlign;"
		drawParagraph: paragraph color: textColor at: 0@0@0 align: textAlign;
		glEnable: GLLighting.

class methods:

^top


- made by Dandelion -