TDrawTextLayoutContext Class Reference

class TDrawTextLayoutContext

Parameters used by functions that draw text.

An object of this class is passed to CTextLayout::DrawL() and to InvertRangeL(). The draw context includes the view rectangle, the graphics context, the background colour and the margin widths.

You only need to use this class directly when you are using a CTextLayout object which is not owned by a CTextView object.

Public Member Functions
TDrawTextLayoutContext ()
TUint DrawMode ()
IMPORT_C TBool DrawText ()
IMPORT_C TBool IsGutterMargin ()
IMPORT_C TBool IsLabelMargin ()
IMPORT_C TRect LabelMargin ()
IMPORT_C TBool ParagraphFillTextOnly ()
IMPORT_C CGraphicsContext * PrimaryGc ()
IMPORT_C void SetClipping ( TBool )
void SetDrawMode ( TUint )
IMPORT_C void SetDrawTextAndGraphics ()
IMPORT_C void SetDrawTextOnly ()
IMPORT_C void SetGc ( CGraphicsContext *, CGraphicsContext *)
IMPORT_C void SetParagraphFillTextOnly ( TBool )
IMPORT_C void SetTextColorOverride (const TRgb *)
IMPORT_C void SetWindowGc ( CWindowGc *, CWindowGc *)
IMPORT_C TRect TextArea ()
IMPORT_C const TRgb * TextOverrideColor ()
IMPORT_C void TextToWindow ( TPoint &)
IMPORT_C void TextToWindow ( TRect &)
IMPORT_C TPoint TopLeftText ()
IMPORT_C TPoint TopLeftTextArea ()
IMPORT_C TRect TotalMargin ()
IMPORT_C TBool UseBackgroundColor ()
IMPORT_C TBool UseClippingRect ()
IMPORT_C TBool UseGcClear ()
TBool UseWindowGc ()
IMPORT_C void WindowToText ( TPoint &)
IMPORT_C void WindowToText ( TRect &)
Private Member Enumerations
enum TDrawMode {
EFDrawText  = 0x001, EFDrawGraphics  = 0x002, EFUseClippingRect  = 0x004, EFUseWindowGc  = 0x008, EFUseGcClear  = 0x020, EFUseBackgroundColor  = 0x040, EFUseOverrideTextColor  = 0x080, EFParagraphFillTextOnly  = 0x100, EFAllFlags  = 0xfff
}
Public Attributes
TLogicalRgb iBackgroundColor
TInt iGutterMarginWidth
TInt iLabelMarginWidth
TInt iTextStartX
TRect iViewRect
Private Attributes
TUint iDrawMode
CGraphicsContext * iGc
TLogicalRgb iOverrideTextColor
CGraphicsContext * iPictureGc

Constructor & Destructor Documentation

TDrawTextLayoutContext()

IMPORT_C TDrawTextLayoutContext ( )

Default C++ constructor.

This constructs a fully initialized TDrawTextLayoutContext object. Its view rectangle, iLabelMarginWidth and iGutterMarginWidth and iTextStartX are all initialized to zero, the background colour is initialized to the default system background colour, text and graphics are set to be drawn and clipping is set. The graphics context is initialised to null.

Member Functions Documentation

DrawMode()

TUint DrawMode ( ) const

DrawText()

IMPORT_C TBool DrawText ( ) const

IsGutterMargin()

IMPORT_C TBool IsGutterMargin ( ) const

This function is identical to IsLabelMargin() .

IsLabelMargin()

IMPORT_C TBool IsLabelMargin ( ) const

LabelMargin()

IMPORT_C TRect LabelMargin ( ) const

ParagraphFillTextOnly()

IMPORT_C TBool ParagraphFillTextOnly ( ) const

Tests whether the region filled with paragraph fill colour is the area within the paragraph only, or also the area within the left text margin. 7.0

PrimaryGc()

IMPORT_C CGraphicsContext * PrimaryGc ( ) const

SetClipping(TBool)

IMPORT_C void SetClipping ( TBool aClipping )

Parameters

TBool aClipping

SetDrawMode(TUint)

void SetDrawMode ( TUint aDrawMode )

Parameters

TUint aDrawMode

SetDrawTextAndGraphics()

IMPORT_C void SetDrawTextAndGraphics ( )

This function is obsolete. When a text object is drawn, all parts of it are drawn.

SetDrawTextOnly()

IMPORT_C void SetDrawTextOnly ( )

SetGc(CGraphicsContext *, CGraphicsContext *)

IMPORT_C void SetGc ( CGraphicsContext * aGc,
CGraphicsContext * aPictureGc = NULL
)

Sets the graphics context for drawing text and pictures.

Parameters

CGraphicsContext * aGc Pointer to the graphics context for drawing text and pictures.
CGraphicsContext * aPictureGc = NULL This argument is not used - all drawing is done using aGc.

SetParagraphFillTextOnly(TBool)

IMPORT_C void SetParagraphFillTextOnly ( TBool aFillTextOnly )

Sets the horizontal extent of a paragraph to be filled with paragraph fill colour. 7.0

Parameters

TBool aFillTextOnly If true, the region filled with paragraph fill colour is the area within the paragraph only. If false, the left text margin, if present, is also filled.

SetTextColorOverride(const TRgb *)

IMPORT_C void SetTextColorOverride ( const TRgb * aOverrideColor )

Overrides the existing text colour, so that when redrawn, all text has the colour specified, rather than the colour which is set in the text object. To return the text to its original colour, call this function again with an argument of null.

Parameters

const TRgb * aOverrideColor If not NULL, overrides the text colour.

SetWindowGc(CWindowGc *, CWindowGc *)

IMPORT_C void SetWindowGc ( CWindowGc * aGc,
CWindowGc * aPictureGc = NULL
)

Parameters

CWindowGc * aGc
CWindowGc * aPictureGc = NULL

TextArea()

IMPORT_C TRect TextArea ( ) const

Gets the text area. The text area is the view rectangle minus the label and gutter margins.

TextOverrideColor()

IMPORT_C const TRgb * TextOverrideColor ( ) const

If the text colour is overridden, this function gets the text override colour, as set by SetTextColorOverride() .

TextToWindow(TPoint &)

IMPORT_C void TextToWindow ( TPoint & aTextAreaPos ) const

Parameters

TPoint & aTextAreaPos

TextToWindow(TRect &)

IMPORT_C void TextToWindow ( TRect & aRect ) const

Parameters

TRect & aRect

TopLeftText()

IMPORT_C TPoint TopLeftText ( ) const

Gets the window coordinates of the top left hand corner at which text may be drawn. This point has the same vertical coordinate as the top of the text area, but its horizontal coordinate is increased by the left text margin width (iTextStartX). This point is the origin for layout coordinates.

TopLeftTextArea()

IMPORT_C TPoint TopLeftTextArea ( ) const

Gets the (window) coordinates of the top left hand corner of the text area.

TotalMargin()

IMPORT_C TRect TotalMargin ( ) const

Gets the area occupied by the label and gutter margins.

UseBackgroundColor()

IMPORT_C TBool UseBackgroundColor ( ) const

Tests whether the background colour is used, as set by SetDrawToEveryPixel() .

UseClippingRect()

IMPORT_C TBool UseClippingRect ( ) const

Tests whether clipping is set to the intersection of the draw rectangle, (the aDrawRect parameter passed to CTextLayout::DrawL() or InvertRangeL()) and the text area.

UseGcClear()

IMPORT_C TBool UseGcClear ( ) const

Tests if the graphics context for drawing is either CWindowGc or CBitmapContext .

UseWindowGc()

TBool UseWindowGc ( ) const

Tests if a CWindowGc is being used.

WindowToText(TPoint &)

IMPORT_C void WindowToText ( TPoint & aWinPos ) const

Converts a point in window coordinates to layout coordinates. Window coordinates have their origin at the top left corner of the view window. Layout coordinates have their origin at the top left corner of the area within the view rectangle in which text can appear, (this value is returned by TopLeftText() ).

Parameters

TPoint & aWinPos Point in window coordinates. On return, set to layout coordinates.

WindowToText(TRect &)

IMPORT_C void WindowToText ( TRect & aRect ) const

Parameters

TRect & aRect

Member Enumerations Documentation

Enum TDrawMode

Enumerators

EFDrawText = 0x001
EFDrawGraphics = 0x002
EFUseClippingRect = 0x004
EFUseWindowGc = 0x008
EFUseGcClear = 0x020
EFUseBackgroundColor = 0x040
EFUseOverrideTextColor = 0x080
EFParagraphFillTextOnly = 0x100
EFAllFlags = 0xfff

Member Data Documentation

TLogicalRgb iBackgroundColor

TLogicalRgb iBackgroundColor

The background colour for the view rectangle. The background colour is used to fill the parts of the view rectangle in which text cannot appear, for example, below the last line of the document and in the label, line cursor and left text margins.

TUint iDrawMode

TUint iDrawMode [private]

CGraphicsContext * iGc

CGraphicsContext * iGc [private]

TInt iGutterMarginWidth

TInt iGutterMarginWidth

The gutter margin width (also known as the line cursor margin width). By default zero.

TInt iLabelMarginWidth

TInt iLabelMarginWidth

The label margin width. By default zero. Must have the same value as the label margin width as set in the text layout object.

TLogicalRgb iOverrideTextColor

TLogicalRgb iOverrideTextColor [private]

CGraphicsContext * iPictureGc

CGraphicsContext * iPictureGc [private]

TInt iTextStartX

TInt iTextStartX

The horizontal offset between window coordinates and text layout coordinates.

TRect iViewRect

TRect iViewRect

The view rectangle (specified in window coordinates). This is used to set the area in which text can be drawn. Text can only be drawn within the intersection between the text area and the aDrawRect parameter passed to CTextLayout::DrawL() or InvertRangeL().