Squeak Class Documentation category index | class index  
 
Paragraph
  category: ST80-Support
  superclass: DisplayText
  subclasses: ListParagraph

I represent displayable text that has been decoraged with margin alignment, line leading, and tab settings.

instance methods
  accessing
  backgroundColor
clippingRectangle
clippingRectangle:
compositionRectangle
compositionRectangle:
destinationForm
fillColor
fillColor:
height
indentationOfLineIndex:ifBlank:
mask
numberOfLines
replaceFrom:to:with:displaying:
rule
rule:
stringAtLineNumber:
text:

  alignment
  centered
justified
leftFlush
rightFlush
toggleAlignment

  character location
  characterBlockAtPoint:
characterBlockForIndex:
defaultCharacterBlock

  composition
  composeAll
wrappingBox:clippingBox:

  converting
  asForm
asString
asText

  display box access
  boundingBox
computeBoundingBox

  displaying
  displayOn:
displayOn:at:
displayOn:at:clippingBox:rule:fillColor:
displayOn:transformation:clippingBox:align:with:rule:fillColor:

  indicating
  flash
outline

  private
  bottomAtLineIndex:
compositionRectangle:text:style:offset:
compositionRectangleDelta
displayLines:
displayLines:affectedRectangle:
displayOn:lines:
leftMarginForCompositionForLine:
leftMarginForDisplayForLine:
lineAt:put:
lineIndexOfCharacterIndex:
lineIndexOfTop:
lines
moveBy:
rightMarginForComposition
rightMarginForDisplay
setWithText:style:
setWithText:style:compositionRectangle:clippingRectangle:
setWithText:style:compositionRectangle:clippingRectangle:foreColor:backColor:
topAtLineIndex:
topAtLineIndex:using:and:
trimLinesTo:
updateCompositionHeight
withClippingRectangle:do:

  scrolling
  scrollBy:
scrollBy:withSelectionFrom:to:
scrollDelta
scrollUncheckedBy:withSelectionFrom:to:

  selecting
  caretFormForDepth:
clickAt:for:controller:
extendSelectionAt:endBlock:
hiliteRect:
mouseMovedFrom:pivotBlock:showingCaret:
mouseSelect
mouseSelect:
reverseFrom:to:
selectionRectsFrom:to:

  utilities
  clearVisibleRectangle
deepCopy
destinationForm:
fit
lines:
visibleRectangle

class methods
  examples
  example

  instance creation
  new
withText:
withText:style:
withText:style:compositionRectangle:clippingRectangle:foreColor:backColor:

instance methods
  accessing top  
 

backgroundColor


 

clippingRectangle

Answer the rectangle, defined in absolute coordinates, whose
intersection with the destinationForm is the area in which the characters
are constrained to display.


 

clippingRectangle:


 

compositionRectangle

Answer the rectangle whose width is the dimension, modified by
indents and tabsLevels, against which line wraparound is measured. The
height of the compositionRectangle is reset each time recomposition is
required.


 

compositionRectangle:

Set the rectangle whose width is the dimension, modified by indents and
tabsLevels, against which line wraparound is measured.


 

destinationForm

Answer the Form into which the characters are scanned.


 

fillColor

Answer the Form with which each character is combined by the scanner
before applying the rule for display.


 

fillColor:

Set the argument, maskForm, to be the form with which each character
is combined by the scanner before applying the rule for display.


 

height

Answer the height of the composition rectangle.


 

indentationOfLineIndex:ifBlank:

Answer the number of leading tabs in the line at lineIndex. If there are
no visible characters, pass the number of tabs to aBlock and return its value.
If the line is word-wrap overflow, back up a line and recur.


 

mask

Answer the Form with which each character is combined by the scanner
before applying the rule for display.


 

numberOfLines

Answer the number of lines of text in the receiver.


 

replaceFrom:to:with:displaying:

Replace the receiver's text starting at position start, stopping at stop, by
the characters in aText. It is expected that most requirements for
modifications to the receiver will call this code. Certainly all cut's or
paste's.


 

rule

Answer the rule according to which character display behaves. For
example, rule may equal over, under, reverse.


 

rule:

Set the rule according to which character display behaves.


 

stringAtLineNumber:


 

text:

Set the argument, aText, to be the text for the receiver.


  alignment top  
 

centered

Set the alignment for the style with which the receiver displays its text
so that text is centered in the composition rectangle.


 

justified

Set the alignment for the style with which the receiver displays its text
so that the characters in each of text end on an even border in the
composition rectangle.


 

leftFlush

Set the alignment for the style with which the receiver displays its text
so that the characters in each of text begin on an even border in the
composition rectangle. This is also known as ragged-right.


 

rightFlush

Set the alignment for the style with which the receiver displays its text
so that the characters in each of text end on an even border in the
composition rectangle but the beginning of each line does not. This is
also known as ragged-left.


 

toggleAlignment

Set the alignment for the style with which the receiver displays its text
so that it moves from centered to justified to leftFlush to rightFlush and
back to centered again.


  character location top  
 

characterBlockAtPoint:

Answer a CharacterBlock for characters in the text at point aPoint. It is
assumed that aPoint has been transformed into coordinates appropriate to
the receiver's destinationForm rectangle and the compositionRectangle.


 

characterBlockForIndex:

Answer a CharacterBlock for character in the text at targetIndex. The
coordinates in the CharacterBlock will be appropriate to the intersection
of the destinationForm rectangle and the compositionRectangle.


 

defaultCharacterBlock


  composition top  
 

composeAll

Compose a collection of characters into a collection of lines.


 

wrappingBox:clippingBox:

Set the composition rectangle for the receiver so that the lines wrap
within the rectangle, compositionRect, and the display of the text is
clipped by the rectangle, clippingRect.


  converting top  
 

asForm

Answer a Form made up of the bits that represent the receiver's displayable text.


 

asString

Answer the string of characters of the receiver's text.


 

asText

Answer the receiver's text.


  display box access top  
 

boundingBox

Refer to the comment in DisplayObject|boundingBox.


 

computeBoundingBox

Compute minimum enclosing rectangle around characters.


  displaying top  
 

displayOn:

Because Paragraphs cache so much information, computation is avoided
and displayAt: 0@0 is not appropriate here.


 

displayOn:at:

Use internal clippingRect; destination cliping is done during actual display.


 

displayOn:at:clippingBox:rule:fillColor:

Default display message when aDisplayPoint is in absolute screen
coordinates.


 

displayOn:transformation:clippingBox:align:with:rule:fillColor:

Assumes offset has been set!!!!!


  indicating top  
 

flash

Complement twice the visible area in which the receiver displays.


 

outline

Display a border around the visible area in which the receiver presents
its text.


  private top  
 

bottomAtLineIndex:

Answer the bottom y of given line.


 

compositionRectangle:text:style:offset:


 

compositionRectangleDelta

A handy number -- mostly for scrolling.


 

displayLines:


 

displayLines:affectedRectangle:

This is the first level workhorse in the display portion of the TextForm routines.
It checks to see which lines in the interval are actually visible, has the
CharacterScanner display only those, clears out the areas in which display will
occur, and clears any space remaining in the visibleRectangle following the space
occupied by lastLine.


 

displayOn:lines:


 

leftMarginForCompositionForLine:

Build the left margin for composition of a line. Depends upon
marginTabsLevel and the indent.


 

leftMarginForDisplayForLine:

Build the left margin for display of a line. Depends upon
leftMarginForComposition, compositionRectangle left and the alignment.


 

lineAt:put:

Store a line, track last, and grow lines if necessary.


 

lineIndexOfCharacterIndex:

Answer the line index for a given characterIndex.


 

lineIndexOfTop:

Answer the line index at a given top y.


 

lines


 

moveBy:


 

rightMarginForComposition

Build the right margin for a line. Depends upon compositionRectangle
width, marginTabsLevel, and right indent.


 

rightMarginForDisplay

Build the right margin for a line. Depends upon compositionRectangle
rightSide, marginTabsLevel, and right indent.


 

setWithText:style:

Set text and adjust bounding rectangles to fit.


 

setWithText:style:compositionRectangle:clippingRectangle:

Set text and using supplied parameters. Answer max composition width.


 

setWithText:style:compositionRectangle:clippingRectangle:foreColor:backColor:

Set text and using supplied parameters. Answer max composition width.


 

topAtLineIndex:

Answer the top y of given line.


 

topAtLineIndex:using:and:

Answer the top y of given line.


 

trimLinesTo:


 

updateCompositionHeight

Mainly used to insure that intersections with compositionRectangle work.


 

withClippingRectangle:do:


  scrolling top  
 

scrollBy:


 

scrollBy:withSelectionFrom:to:

Translate the composition rectangle up (dy<0) by heightToMove.
Repainting text as necessary, and selection if blocks not nil.
Return true unless scrolling limits have been reached.


 

scrollDelta

By comparing this before and after, you know if scrolling happened


 

scrollUncheckedBy:withSelectionFrom:to:

Scroll by the given amount. Copy bits where possible, display the rest.
If selection blocks are not nil, then select the newly visible text as well.


  selecting top  
 

caretFormForDepth:

Return a caret form for the given depth.


 

clickAt:for:controller:

Give sensitive text a chance to fire. Display flash: (100@100 extent: 100@100).


 

extendSelectionAt:endBlock:

Answer with an Array of two CharacterBlocks that represent the text
selection that the user makes.


 

hiliteRect:


 

mouseMovedFrom:pivotBlock:showingCaret:


 

mouseSelect

Answer with an Array of two CharacterBlocks that represent the text
selection that the user makes. Return quickly if the button is noticed up
to make double-click more responsive.


 

mouseSelect:

Track text selection and answer with an Array of two CharacterBlocks.


 

reverseFrom:to:

Reverse area between the two character blocks given as arguments.


 

selectionRectsFrom:to:

Return an array of rectangles representing the area between the two character blocks given as arguments.


  utilities top  
 

clearVisibleRectangle

Display the area in which the receiver presents its text so that the area
is all one tone--in this case, all white.


 

deepCopy

Don't want to copy the destForm (Display) or fonts in the TextStyle. 9/13/96 tk


 

destinationForm:


 

fit

Make the bounding rectangle of the receiver contain all the text without
changing the width of the receiver's composition rectangle.


 

lines:


 

visibleRectangle

May be less than the clippingRectangle if text ends part way down.
Also some fearful history includes Display intersection;
it shouldn't be necessary


class methods
  examples top  
 

example

This simple example illustrates how to display a few lines of text on the screen at the current cursor point.
Fixed.


  instance creation top  
 

new

Do not allow an uninitialized view. Create with text that has no
characters.


 

withText:

Answer an instance of me with text set to aText and style set to the
system's default text style.


 

withText:style:

Answer an instance of me with text set to aText and style set to
aTextStyle.


 

withText:style:compositionRectangle:clippingRectangle:foreColor:backColor:

Answer an instance of me with text set to aText and style set to
aTextStyle, composition rectangle is compRect and the clipping rectangle
is clipRect.