Back: BLOX.BSpline-accessing Up: BLOX package Forward: BLOX.BText class-accessing   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.42 BLOX.BText

Defined in namespace BLOX
Superclass: BLOX.BViewport
Category: Graphics-Windows

I represent a text viewer with pretty good formatting options.

1.42.1 BLOX.BText class: accessing  (class)
1.42.2 BLOX.BText class: instance creation  (class)
1.42.3 BLOX.BText: accessing  (instance)
1.42.4 BLOX.BText: attributes  (instance)
1.42.5 BLOX.BText: geometry management  (instance)
1.42.6 BLOX.BText: images  (instance)
1.42.7 BLOX.BText: inserting text  (instance)
1.42.8 BLOX.BText: position & lines  (instance)


1.42.1 BLOX.BText class: accessing

emacsLike
Answer whether we are using Emacs or Motif key bindings.

emacsLike: aBoolean
Set whether we are using Emacs or Motif key bindings.


1.42.2 BLOX.BText class: instance creation

newReadOnly: parent
Answer a new read-only text widget (read-only is achieved simply by setting its state to be disabled)


1.42.3 BLOX.BText: accessing

backgroundColor
Answer the value of the backgroundColor option for the widget.

Specifies the normal background color to use when displaying the widget.

backgroundColor: value
Set the value of the backgroundColor option for the widget.

Specifies the normal background color to use when displaying the widget.

callback
Answer a DirectedMessage that is sent when the receiver is modified, or nil if none has been set up.

callback: aReceiver message: aSymbol
Set up so that aReceiver is sent the aSymbol message (the name of a zero- or one-argument selector) when the receiver is modified. If the method accepts an argument, the receiver is passed.

contents
Return the contents of the widget

contents: aString
Set the contents of the widget

font
Answer the value of the font option for the widget.

Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string.

X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding.

Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words.

font: value
Set the value of the font option for the widget.

Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string.

X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding.

Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words.

foregroundColor
Answer the value of the foregroundColor option for the widget.

Specifies the normal foreground color to use when displaying the widget.

foregroundColor: value
Set the value of the foregroundColor option for the widget.

Specifies the normal foreground color to use when displaying the widget.

getSelection
Answer an empty string if the widget has no selection, else answer the currently selected text

selectBackground
Answer the value of the selectBackground option for the widget.

Specifies the background color to use when displaying selected parts of the widget.

selectBackground: value
Set the value of the selectBackground option for the widget.

Specifies the background color to use when displaying selected parts of the widget.

selectForeground
Answer the value of the selectForeground option for the widget.

Specifies the foreground color to use when displaying selected parts of the widget.

selectForeground: value
Set the value of the selectForeground option for the widget.

Specifies the foreground color to use when displaying selected parts of the widget.

wrap
Answer the value of the wrap option for the widget.

Specifies how to handle lines in the text that are too long to be displayed in a single line of the text's window. The value must be #none or #char or #word. A wrap mode of none means that each line of text appears as exactly one line on the screen; extra characters that do not fit on the screen are not displayed. In the other modes each line of text will be broken up into several screen lines if necessary to keep all the characters visible. In char mode a screen line break may occur after any character; in word mode a line break will only be made at word boundaries.

wrap: value
Set the value of the wrap option for the widget.

Specifies how to handle lines in the text that are too long to be displayed in a single line of the text's window. The value must be #none or #char or #word. A wrap mode of none means that each line of text appears as exactly one line on the screen; extra characters that do not fit on the screen are not displayed. In the other modes each line of text will be broken up into several screen lines if necessary to keep all the characters visible. In char mode a screen line break may occur after any character; in word mode a line break will only be made at word boundaries.


1.42.4 BLOX.BText: attributes

insertAtEnd: aString attribute: attr
Clear the selection and append aString at the end of the widget. Use the given attributes to format the text.

insertText: aString attribute: attr
Insert aString in the widget at the current insertion point, replacing the currently selected text (if any). Use the given attributes to format the text.

removeAttributes
Remove any kind of formatting from the text in the widget

removeAttributesFrom: aPoint to: endPoint
Remove any kind of formatting from the text in the widget between the given endpoints. The two endpoints are Point objects in which both coordinates are 1-based: the first line is line 1, and the first character in the first line is character 1.

setAttributes: attr from: aPoint to: endPoint
Add the formatting given by attr to the text in the widget between the given endpoints. The two endpoints are Point objects in which both coordinates are 1-based: the first line is line 1, and the first character in the first line is character 1.


1.42.5 BLOX.BText: geometry management

child: child height: value
Set the height of the given child to be `value' pixels.

child: child heightOffset: value
Adjust the height of the given child to be given by `value' more pixels.

child: child width: value
Set the width of the given child to be `value' pixels.

child: child widthOffset: value
Adjust the width of the given child to be given by `value' more pixels.

child: child x: value
Never fail and do nothing, the children stay where the text ended at the time each child was added in the widget

child: child xOffset: value
This method should not be called for instances of this class.

child: child y: value
Never fail and do nothing, the children stay where the text ended at the time each child was added in the widget

child: child yOffset: value
This method should not be called for instances of this class.

heightChild: child
Answer the given child's height in pixels.

widthChild: child
Answer the given child's width in pixels.

xChild: child
Answer the given child's top-left border's x coordinate. We always answer 0 since the children actually move when the text widget scrolls

yChild: child
Answer the given child's top-left border's y coordinate. We always answer 0 since the children actually move when the text widget scrolls


1.42.6 BLOX.BText: images

insertImage: anObject
Insert an image where the insertion point currently lies in the widget. anObject can be a String containing image data (either Base-64 encoded GIF data, XPM data, or PPM data), or the result or registering an image with #registerImage:

insertImage: anObject at: position
Insert an image at the given position in the widget. The position is a Point object in which both coordinates are 1-based: the first line is line 1, and the first character in the first line is character 1.

anObject can be a String containing image data (either Base-64 encoded GIF data, XPM data, or PPM data), or the result or registering an image with #registerImage:

insertImageAtEnd: anObject
Insert an image at the end of the widgets text. anObject can be a String containing image data (either Base-64 encoded GIF data, XPM data, or PPM data), or the result or registering an image with #registerImage:

registerImage: anObject
Register an image (whose data is in anObject, a String including Base-64 encoded GIF data, XPM data, or PPM data) to be used in the widget. If the same image must be used a lot of times, it is better to register it once and then pass the result of #registerImage: to the image insertion methods.

Registered image are private within each BText widget. Registering an image with a widget and using it with another could give unpredictable results.


1.42.7 BLOX.BText: inserting text

insertAtEnd: aString
Clear the selection and append aString at the end of the widget.

insertSelectedText: aString
Insert aString in the widget at the current insertion point, leaving the currently selected text (if any) in place, and selecting the text.

insertText: aString
Insert aString in the widget at the current insertion point, replacing the currently selected text (if any).

insertText: aString at: position
Insert aString in the widget at the given position, replacing the currently selected text (if any). The position is a Point object in which both coordinates are 1-based: the first line is line 1, and the first character in the first line is character 1.

insertTextSelection: aString
Insert aString in the widget after the current selection, leaving the currently selected text (if any) intact.

invokeCallback
Generate a synthetic callback.

nextPut: aCharacter
Clear the selection and append aCharacter at the end of the widget.

nextPutAll: aString
Clear the selection and append aString at the end of the widget.

nl
Clear the selection and append a linefeed character at the end of the widget.

refuseTabs
Arrange so that Tab characters, instead of being inserted in the widget, traverse the widgets in the parent window.

replaceSelection: aString
Insert aString in the widget at the current insertion point, replacing the currently selected text (if any), and leaving the text selected.

searchString: aString
Search aString in the widget. If it is not found, answer zero, else answer the 1-based line number and move the insertion point to the place where the string was found.

space
Clear the selection and append a space at the end of the widget.


1.42.8 BLOX.BText: position & lines

charsInLine: number
Answer how many characters are there in the number-th line

currentColumn
Answer the 1-based column number where the insertion point currently lies.

currentLine
Answer the 1-based line number where the insertion point currently lies.

currentPosition
Answer a Point representing where the insertion point currently lies. Both coordinates in the answer are 1-based: the first line is line 1, and the first character in the first line is character 1.

currentPosition: aPoint
Move the insertion point to the position given by aPoint. Both coordinates in aPoint are interpreted as 1-based: the first line is line 1, and the first character in the first line is character 1.

gotoLine: line end: aBoolean
If aBoolean is true, move the insertion point to the last character of the line-th line (1 being the first line in the widget); if aBoolean is false, move it to the start of the line-th line.

indexAt: point
Answer the position of the character that covers the pixel whose coordinates within the text's window are given by the supplied Point object.

lineAt: number
Answer the number-th line of text in the widget

numberOfLines
Answer the number of lines in the widget

selectFrom: first to: last
Select the text between the given endpoints. The two endpoints are Point objects in which both coordinates are 1-based: the first line is line 1, and the first character in the first line is character 1.

setToEnd
Move the insertion point to the end of the widget



Back: BLOX.BText-inserting text Up: BLOX.BText Forward: BLOX.BTextAttributes   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on July, 23 2009 using texi2html