txtshell
: Text Content and Views example
codetxtshell
is an application that provides a shell for
the text example code to run in. It provides four concrete text example
controls, CGlobalControl
, CRichControl
,
CStyleControl
and CViewControl
, all derived from the
abstract base class CGraphicExampleControl
. Each of these controls
implements an UpdateModelL()
function that is called each time the
current step in the example is advanced. Each step modifies the content,
formatting, or display of the text in a different way. For details, see the
appropriate control example.
Each of these controls illustrates a different set of operations which can be performed on a text object or a text view.
CGlobalControl
)Illustrates the following:
Adding and deleting global text
Getting information about the text object, e.g. the number of words and paragraphs.
Applying formatting
Inserting fields
Storing and restoring text
CRichControl
)Illustrates the following:
Adding and deleting rich text
Applying paragraph formatting to individual paragraphs
Applying character formatting to individual characters
Storing and restoring rich text
CStyleControl
)Illustrates the following:
Creating paragraph styles
Applying paragraph styles to individual paragraphs
Applying specific formatting to styled paragraphs
Applying a style to text with specific formatting
CViewControl
)The example illustrates the following text view and layout operations:
Banded layout
Reformatting the text view
Wrapping
Using an I-beam cursor
Using a line cursor
Text selection
Resizing the viewing rectangle
Scrolling
Press F1
to get the menu which lists the
examples. Select the appropriate example, and then press
space
to advance through a set of steps that illustrate
features of that example.
All of the examples use the following classes:
TRect
: rectangle (through which to view
text)
CCharFormatLayer
: character format layer
TCharFormat
: character format container
TCharFormatMask
: character format mask
CParaFormatLayer
: paragraph format layer
CParaFormat
: paragraph format container
TParaFormatMask
: paragraph format mask
CTextLayout
: text layout
CTextView
: text view
Additionally, each control illustrates particular classes.
CGlobalControl
illustrates CGlobalText
(global text) and CPlainText
(plain text without
formatting).
CRichControl
illustrates CRichText
(rich
text).
CStyleControl
illustrates CParagraphStyle
(paragraph style information), and CStyleList
(list of paragraph
styles).
CViewControl
illustrates TCursorPosition
(cursor position), TCursorSelection
(cursor and anchor position
for selection) and TViewYPosQualifier
(vertical view
control).