class CTextView : public CBase |
Lays out formatted text for display.
The class provides functions to:
convert between document positions and x,y coordinates
set the dimensions of the rectangle in which text can be viewed (the view rectangle)
set margin widths
do horizontal and vertical scrolling
do text selection
set the cursor position and appearance
After a change has been made to the text layout, a reformat and redraw should normally take place. CTextView provides functions which are optimised to reformat the minimum amount necessary. For example, when a global formatting parameter is changed (e.g. the wrap width), the whole document's layout needs to be recalculated, so HandleGlobalChangeL() should be called. If the change involves the insertion or deletion of a single character, only a single line may be affected; for this, HandleCharEditL() is appropriate. Most CTextView reformatting functions do scrolling (using block transfer), if necessary, and a redraw.
For maximum responsiveness, CTextView uses an active object to carry out reformatting as a background task, so that the application can continue to receive user input. Many CTextView functions force background formatting to complete before they take effect.
When scrolling vertically, positive numbers of pixels, lines, paragraphs, pages, etc., mean that the text moves down, and vice versa. When scrolling horizontally, positive numbers of pixels mean that the text moves left and vice versa.
A text view can display up to two cursors and up to three margins. The cursors are the text cursor and the line cursor. The purpose of the line cursor is to make it easier to see which line the text cursor (or the selection extension point) is on. The three margins are the label margin (for paragraph labels), the line cursor margin (for the line cursor) and the left text margin (the gap between the edge of the page and the text). All are optional, but if present, they appear in that order, starting at the left edge of the view rectangle.
An object of class CTextLayout is used by the text view to calculate changes to the layout. This object must be specified when constructing the text view. It is also used to set layout attributes, including the wrap width, the height of the visible portion of the document (the "band"), whether formatting is set to the band or to the whole document and the text object which is the source of the text and formatting information.
The x-y pixel coordinates used by CTextView are called window coordinates. Window coordinates have their origin at the top left corner of the view window (unlike class CTextLayout whose coordinates have their origin at the top left corner of the area within the view rectangle in which text can appear). As in most bitmap graphics systems, x coordinates increase rightwards and y coordinates increase downwards.
Public Member Enumerations | |
---|---|
enum | anonymous { EFFirstCharOnLine = -1000000, EFLastCharOnLine = 1000000 } |
enum | TBeforeAfter { EFCharacterBefore = ETrue, EFCharacterAfter = EFalse } |
enum | TDiscard { EFViewDiscardAllFormat, EFViewDontDiscardFormat, EFViewDiscardAllNoRedraw, EFViewDontDiscardFullRedraw } |
enum | TDoHorizontalScroll { EFNoHorizontalScroll = EFalse, EFCheckForHorizontalScroll = ETrue } |
enum | TPriorities { EFBackgroundFormattingPriority = (CActive::EPriorityIdle + CActive::EPriorityLow) / 2 } |
Private Member Enumerations | |
---|---|
enum | anonymous { EFSelectionVisible = 1, EFPictureFrameEnabled = 2, EFEverythingVisible = 3, EFFlickerFreeRedraw = 4, EFTextVisible = 8 } |
enum | TDrawParameters { EFDrawAllWindow = CLayoutData::EFLargeNumber } |
enum | TExtendedHighlightRedraw { EFTopEdge = 0x0001, EFBottomEdge = 0x0002 } |
enum | THorizontalScroll { EFNoPreviousHorizontalScroll = 0, EFPreviousHorizontalScroll } |
enum | THorizontalScrollJump { EFDefaultHorizontalScrollJump = 20 } |
enum | TMemoryStatus { EFMemoryOK, EFOutOfMemory, EFRecovering } |
enum | TPictureFrameBlobWidths { EFFrameVisibleBlobWidth = 10, EFFrameActiveBlobWidth = 20 } |
void | AdjustRectForScrolling | ( | TRect & | aRect, |
TInt | aScrollY, | |||
TInt | aScrollX | |||
) | const [private] |
IMPORT_C void | AlterViewRect | ( | const TRect & | aViewRect | ) |
const TRect & aViewRect |
TInt | CalculateBaseLinePos | ( | TTmDocPos & | aDocPos | ) | [private] |
TTmDocPos & aDocPos |
void | CalculateHorizontalExtremes | ( | TInt & | aLeftX, |
TInt & | aRightX, | |||
TBool | aOnlyVisibleLines | |||
) | [private] |
IMPORT_C void | CalculateHorizontalExtremesL | ( | TInt & | aLeftX, |
TInt & | aRightX, | |||
TBool | aOnlyVisibleLines | |||
) |
TInt | CheckHorizontalScroll | ( | const TTmDocPos & | aDocPos | ) | [private] |
const TTmDocPos & aDocPos |
IMPORT_C void | ConstructL | ( | CTextLayout * | aLayout, |
const TRect & | aDisplay, | |||
CBitmapDevice * | aGd, | |||
MGraphicsDeviceMap * | aDeviceMap, | |||
RWindow * | aWin, | |||
RWindowGroup * | aGroupWin, | |||
RWsSession * | aSession | |||
) | [private] |
CTextLayout * aLayout | |
const TRect & aDisplay | |
CBitmapDevice * aGd | |
MGraphicsDeviceMap * aDeviceMap | |
RWindow * aWin | |
RWindowGroup * aGroupWin | |
RWsSession * aSession |
void | DoClearSelectionL | ( | const TCursorSelection & | aSelection, |
TBool | aIsPictureFrame | |||
) | [private] |
const TCursorSelection & aSelection | |
TBool aIsPictureFrame |
void | DoDrawTextSupportL | ( | const TRect & | aRect, |
const TCursorSelection * | aHighlight | |||
) | [private] |
const TRect & aRect | |
const TCursorSelection * aHighlight |
void | DoDrawTextSupportOpaqueL | ( | const TRect & | aRect, |
const TCursorSelection * | aHighlight | |||
) | [private] |
const TRect & aRect | |
const TCursorSelection * aHighlight |
TPoint | DoHandleGlobalChangeL | ( | TViewYPosQualifier | aYPosQualifier, |
CTextView::TDiscard | aDiscard | |||
) | [private] |
TViewYPosQualifier aYPosQualifier | |
CTextView::TDiscard aDiscard |
TInt | DoHorizontalScrollDisplayL | ( | TCursorPosition::TMovementType | aMovement, |
CTextLayout::TAllowDisallow | aScrollBlankSpace | |||
) | [private] |
TCursorPosition::TMovementType aMovement | |
CTextLayout::TAllowDisallow aScrollBlankSpace |
TPoint | DoMoveCursorL | ( | TBool | aDragSelectOn, |
TCursorPosition::TMovementType & | aMovement, | |||
TBool | aAllowPictureFrame | |||
) | [private] |
TBool aDragSelectOn | |
TCursorPosition::TMovementType & aMovement | |
TBool aAllowPictureFrame |
TInt | DoScrollDisplayL | ( | TCursorPosition::TMovementType | aMovement, |
CTextLayout::TAllowDisallow | aScrollBlankSpace | |||
) | [private] |
TCursorPosition::TMovementType aMovement | |
CTextLayout::TAllowDisallow aScrollBlankSpace |
TInt | DrawAfterCursorMoveL | ( | TInt | aVerticalScrollBy | ) | [private] |
TInt aVerticalScrollBy |
void | DrawCursor | ( | TUint | aCursors = TCursor::EFBothCursors | ) | [private] |
TUint aCursors = TCursor::EFBothCursors |
IMPORT_C void | DrawL | ( | TRect | aRect, |
CBitmapContext & | aGc | |||
) |
TRect aRect | |
CBitmapContext & aGc |
void | DrawPictureFrameL | ( | TRect & | aClipRect | ) | [private] |
TRect & aClipRect |
void | DrawTextSupportL | ( | const TRect & | aRect, |
const TCursorSelection * | aHighlight | |||
) | [private] |
const TRect & aRect | |
const TCursorSelection * aHighlight |
IMPORT_C TBool | FindDocPosL | ( | const TTmDocPosSpec & | aDocPos, |
TTmPosInfo2 & | aPosInfo, | |||
TTmLineInfo * | aLineInfo = NULL | |||
) |
const TTmDocPosSpec & aDocPos | |
TTmPosInfo2 & aPosInfo | |
TTmLineInfo * aLineInfo = NULL |
IMPORT_C TBool | FindXyPosL | ( | const TPoint & | aXyPos, |
TTmPosInfo2 & | aPosInfo, | |||
TTmLineInfo * | aLineInfo = NULL | |||
) |
const TPoint & aXyPos | |
TTmPosInfo2 & aPosInfo | |
TTmLineInfo * aLineInfo = NULL |
IMPORT_C void | GetCursorPos | ( | TTmDocPos & | aPos | ) | const |
TTmDocPos & aPos |
void | GetOrigin | ( | TPoint & | aPoint | ) | const [inline] |
Gets the origin of the cursor.
TPoint & aPoint | On return, the cursor origin. |
IMPORT_C TBool | GetPictureRectangleL | ( | TInt | aDocPos, |
TRect & | aPictureRect, | |||
TBool * | aCanScaleOrCrop = NULL | |||
) | const |
IMPORT_C TBool | GetPictureRectangleL | ( | TPoint | aXyPos, |
TRect & | aPictureRect, | |||
TBool * | aCanScaleOrCrop = NULL | |||
) |
TPoint | HandleBlockChangeL | ( | TCursorSelection | aSelection, |
TInt | aOldCharsChanged, | |||
TBool | aFormatChanged | |||
) | [private] |
TCursorSelection aSelection | |
TInt aOldCharsChanged | |
TBool aFormatChanged |
IMPORT_C TInt | HandleCharEditL | ( | TUint | aType = CTextLayout::EFCharacterInsert, |
TBool | aFormatChanged = EFalse | |||
) |
IMPORT_C void | HandleGlobalChangeL | ( | TViewYPosQualifier | aYPosQualifier = TViewYPosQualifier() | ) |
TViewYPosQualifier aYPosQualifier = TViewYPosQualifier() |
IMPORT_C void | HandleGlobalChangeNoRedrawL | ( | TViewYPosQualifier | aYPosQualifier = TViewYPosQualifier() | ) |
TViewYPosQualifier aYPosQualifier = TViewYPosQualifier() |
IMPORT_C TPoint | HandleInsertDeleteL | ( | TCursorSelection | aSelection, |
TInt | aDeletedChars, | |||
TBool | aFormatChanged = EFalse | |||
) |
TCursorSelection aSelection | |
TInt aDeletedChars | |
TBool aFormatChanged = EFalse |
IMPORT_C TPoint | HandleRangeFormatChangeL | ( | TCursorSelection | aSelection, |
TBool | aFormatChanged = EFalse | |||
) |
TCursorSelection aSelection | |
TBool aFormatChanged = EFalse |
void | HighlightUsingExtensions | ( | CTextLayout::TRangeChange | aOptimizedRange, |
CTextLayout::TRangeChange | aOriginalRange | |||
) | [private] |
CTextLayout::TRangeChange aOptimizedRange | |
CTextLayout::TRangeChange aOriginalRange |
IMPORT_C TBool | IsPictureFrameSelected | ( | TRect & | aPictureFrameRect, |
TInt & | aDocPos | |||
) | const |
const CTextLayout * | Layout | ( | ) | const [inline] |
Returns a pointer to the text layout object used by the text view. A pointer to the text layout object used by the text view.
IMPORT_C void | MatchCursorHeightL | ( | const TFontSpec & | aFontSpec | ) |
const TFontSpec & aFontSpec |
IMPORT_C void | MatchCursorHeightToAdjacentChar | ( | TBeforeAfter | aBasedOn = EFCharacterBefore | ) |
TBeforeAfter aBasedOn = EFCharacterBefore |
IMPORT_C TPoint | MoveCursorL | ( | TCursorPosition::TMovementType & | aMovement, |
TBool | aDragSelectOn | |||
) |
TCursorPosition::TMovementType & aMovement | |
TBool aDragSelectOn |
IMPORT_C CTextView * | NewL | ( | CTextLayout * | aLayout, |
const TRect & | aDisplay, | |||
CBitmapDevice * | aGd, | |||
MGraphicsDeviceMap * | aDeviceMap, | |||
RWindow * | aWin, | |||
RWindowGroup * | aGroupWin, | |||
RWsSession * | aSession | |||
) | [static] |
CTextLayout * aLayout | |
const TRect & aDisplay | |
CBitmapDevice * aGd | |
MGraphicsDeviceMap * aDeviceMap | |
RWindow * aWin | |
RWindowGroup * aGroupWin | |
RWsSession * aSession |
void | ResetExternalDraw | ( | TAny * | aTextView | ) | [private, static] |
TAny * aTextView |
void | ResetOffScreenBitmapContext | ( | TAny * | aTextView | ) | [private, static] |
TAny * aTextView |
IMPORT_C TInt | ScrollDisplayL | ( | TCursorPosition::TMovementType | aMovement, |
CTextLayout::TAllowDisallow | aScrollBlankSpace = CTextLayout::EFDisallowScrollingBlankSpace | |||
) |
TCursorPosition::TMovementType aMovement | |
CTextLayout::TAllowDisallow aScrollBlankSpace = CTextLayout::EFDisallowScrollingBlankSpace |
IMPORT_C TInt | ScrollDisplayLinesL | ( | TInt & | aDeltaLines, |
CTextLayout::TAllowDisallow | aScrollBlankSpace = CTextLayout::EFDisallowScrollingBlankSpace | |||
) |
TInt & aDeltaLines | |
CTextLayout::TAllowDisallow aScrollBlankSpace = CTextLayout::EFDisallowScrollingBlankSpace |
IMPORT_C TInt | ScrollDisplayParagraphsL | ( | TInt & | aDeltaParas, |
CTextLayout::TAllowDisallow | aScrollBlankSpace = CTextLayout::EFDisallowScrollingBlankSpace | |||
) |
TInt & aDeltaParas | |
CTextLayout::TAllowDisallow aScrollBlankSpace = CTextLayout::EFDisallowScrollingBlankSpace |
IMPORT_C void | ScrollDisplayPixelsL | ( | TInt & | aDeltaY | ) |
TInt & aDeltaY |
IMPORT_C void | ScrollDisplayPixelsNoLimitBorderL | ( | TInt | aDeltaY | ) |
TInt aDeltaY |
void | ScrollRect | ( | TRect & | aRect, |
TInt | aScrollY, | |||
TInt | aFrom, | |||
TInt | aScrollX, | |||
TBool | aScrollBackground | |||
) | [private] |
void | ScrollTextL | ( | TInt | aScrollY, |
TInt | aFrom, | |||
TInt | aScrollX, | |||
TBool | aScrollBackground | |||
) | [private] |
IMPORT_C void | SetCursorExtensions | ( | TInt | aFirstExtension, |
TInt | aSecondExtension | |||
) |
IMPORT_C void | SetCursorPlacement | ( | TTmCursorPlacement | aPlacement | ) |
TTmCursorPlacement aPlacement |
IMPORT_C void | SetCursorPositioningHintL | ( | TCursorPosition::TPosHint | aHint | ) |
TCursorPosition::TPosHint aHint |
IMPORT_C void | SetCursorVisibilityL | ( | TUint | aLineCursor, |
TUint | aTextCursor | |||
) |
IMPORT_C void | SetCursorWidthTypeL | ( | TTextCursor::EType | aType, |
TInt | aWidth = 0 | |||
) |
TTextCursor::EType aType | |
TInt aWidth = 0 |
IMPORT_C void | SetDisplayContextL | ( | CBitmapDevice * | aGd, |
RWindow * | aWin, | |||
RWindowGroup * | aGroupWin, | |||
RWsSession * | aSession | |||
) |
CBitmapDevice * aGd | |
RWindow * aWin | |
RWindowGroup * aGroupWin | |
RWsSession * aSession |
IMPORT_C TPoint | SetDocPosL | ( | const TTmDocPosSpec & | aDocPos, |
TBool | aDragSelectOn = EFalse | |||
) |
const TTmDocPosSpec & aDocPos | |
TBool aDragSelectOn = EFalse |
IMPORT_C TPoint | SetDocPosL | ( | const TTmDocPos & | aDocPos, |
TBool | aDragSelectOn = EFalse | |||
) |
IMPORT_C void | SetExcessHeightRequired | ( | TInt | aExcessHeightRequired | ) |
TInt aExcessHeightRequired |
IMPORT_C void | SetHighlightExtensions | ( | TInt | aLeftExtension, |
TInt | aRightExtension, | |||
TInt | aTopExtension, | |||
TInt | aBottomExtension | |||
) |
IMPORT_C void | SetHorizontalScrollJump | ( | TInt | aScrollJump | ) |
TInt aScrollJump |
IMPORT_C void | SetLayout | ( | CTextLayout * | aLayout | ) |
CTextLayout * aLayout |
IMPORT_C void | SetLineCursorBitmap | ( | const CFbsBitmap * | aLineCursorBitmap | ) |
const CFbsBitmap * aLineCursorBitmap |
void | SetObserver | ( | MObserver * | aObserver | ) | [inline] |
Sets a text view observer. This provides notification to the owner of the text view object of changes to the formatting. Its OnReformatL() function is called after reformatting but before redisplay, so that edit windows etc. can be resized.
MObserver * aObserver | Pointer to text view observer object. |
IMPORT_C void | SetParagraphFillTextOnly | ( | TBool | aFillTextOnly | ) |
TBool aFillTextOnly |
IMPORT_C void | SetPendingSelection | ( | const TCursorSelection & | aSelection | ) |
const TCursorSelection & aSelection |
IMPORT_C TPoint | SetSelectionL | ( | const TCursorSelection & | aSelection | ) |
const TCursorSelection & aSelection |
IMPORT_C void | SetSelectionVisibilityL | ( | TBool | aSelectionVisible | ) |
TBool aSelectionVisible |
IMPORT_C void | SetTextColorOverride | ( | const TRgb * | aOverrideColor = NULL | ) |
const TRgb * aOverrideColor = NULL |
IMPORT_C TPoint | SetViewL | ( | TInt | aDocPos, |
TInt & | aYPos, | |||
TViewYPosQualifier | aYPosQualifier = TViewYPosQualifier(), | |||
TDiscard | aDiscardFormat = EFViewDontDiscardFormat, | |||
TDoHorizontalScroll | aDoHorizontalScroll = EFCheckForHorizontalScroll | |||
) |
TInt aDocPos | |
TInt & aYPos | |
TViewYPosQualifier aYPosQualifier = TViewYPosQualifier() | |
TDiscard aDiscardFormat = EFViewDontDiscardFormat | |
TDoHorizontalScroll aDoHorizontalScroll = EFCheckForHorizontalScroll |
IMPORT_C void | SetViewRect | ( | const TRect & | aDisplay | ) |
const TRect & aDisplay |
IMPORT_C TPoint | SetXyPosL | ( | TPoint | aPos, |
TBool | aDragSelectOn, | |||
TRect *& | aPictureRect, | |||
TInt & | aPictureFrameEdges | |||
) |
TPoint | ViewL | ( | const TTmDocPos & | aDocPos, |
TInt & | aYPos, | |||
TViewYPosQualifier | aYPosQualifier = TViewYPosQualifier(), | |||
CTextView::TDiscard | aDiscardFormat = EFViewDontDiscardFormat, | |||
TDoHorizontalScroll | aHorizontalScroll = EFCheckForHorizontalScroll | |||
) | [private] |
const TTmDocPos & aDocPos | |
TInt & aYPos | |
TViewYPosQualifier aYPosQualifier = TViewYPosQualifier() | |
CTextView::TDiscard aDiscardFormat = EFViewDontDiscardFormat | |
TDoHorizontalScroll aHorizontalScroll = EFCheckForHorizontalScroll |
TPoint | ViewTopOfLineL | ( | const TTmDocPos & | aDocPos, |
TInt & | aYPos, | |||
CTextView::TDiscard | aDiscardFormat = EFViewDontDiscardFormat, | |||
TDoHorizontalScroll | aHorizontalScroll = EFCheckForHorizontalScroll | |||
) | [private] |
const TTmDocPos & aDocPos | |
TInt & aYPos | |
CTextView::TDiscard aDiscardFormat = EFViewDontDiscardFormat | |
TDoHorizontalScroll aHorizontalScroll = EFCheckForHorizontalScroll |
IMPORT_C const TTmDocPos & | VisualEndOfRunL | ( | const TTmDocPos & | aStart, |
const TTmDocPos & | aEnd, | |||
TCursorPosition::TVisualEnd | aDirection | |||
) |
const TTmDocPos & aStart | |
const TTmDocPos & aEnd | |
TCursorPosition::TVisualEnd aDirection |
EFSelectionVisible = 1 | |
EFPictureFrameEnabled = 2 | |
EFEverythingVisible = 3 | |
EFFlickerFreeRedraw = 4 | |
EFTextVisible = 8 |
Cursor height matching.
Passed as an argument to MatchCursorHeightToAdjacentChar().
EFCharacterBefore = ETrue |
Text cursor height is matched to preceding character. |
EFCharacterAfter = EFalse |
Text cursor height is matched to following character. |
Whether to reformat and redraw. Argument to SetViewL().
EFViewDiscardAllFormat |
Discard all formatting; redraw. |
EFViewDontDiscardFormat |
Do not discard all formatting; redraw. |
EFViewDiscardAllNoRedraw |
Discard all formatting; no redraw. |
EFViewDontDiscardFullRedraw |
Do not discard all formatting; redraw. |
EFNoHorizontalScroll = EFalse | |
EFCheckForHorizontalScroll = ETrue |
EFBackgroundFormattingPriority = (CActive::EPriorityIdle + CActive::EPriorityLow) / 2 |
TDrawTextLayoutContext | iDrawTextLayoutContext | [private] |