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.
ProtoObjectObjectTObjectTFrameTPrimitiveTPrimitiveText
| paragraph | text | textAlign | textBounds | textColor | textInset | textStyle |
| instance | class |
|---|---|
| accessing initialize render | no messages
|
| paragraph |
|---|
| text |
|---|
| textAlign |
|---|
| textBounds |
|---|
| textColor |
|---|
| textInset |
|---|
| textStyle |
|---|
| 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. |