TDrawTextLayoutContext Class Reference

#include <frmtlay.h>

Link against: form.lib

class TDrawTextLayoutContext

Detailed Description

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.

Member Attribute Documentation

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.

iGutterMarginWidth

TInt iGutterMarginWidth

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

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.

iTextStartX

TInt iTextStartX

The horizontal offset between window coordinates and text layout coordinates.

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().

Constructor & Destructor Documentation

TDrawTextLayoutContext ( )

IMPORT_CTDrawTextLayoutContext()

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 Function Documentation

DisplayHeight ( )

IMPORT_C TIntDisplayHeight()const

Gets the display height in pixels. The display height is the same as the view rectangle height.

Return Value
The display height.

DrawGraphics ( )

IMPORT_C TBoolDrawGraphics()const

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

DrawMode ( )

TUint DrawMode()const

Returns the flags that identify the current drawing mode.

DrawText ( )

IMPORT_C TBoolDrawText()const

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

GutterMargin ( )

IMPORT_C TRectGutterMargin()const

Gets the area occupied by the gutter margin.

Return Value
Rectangle representing the gutter margin.

IsGutterMargin ( )

IMPORT_C TBoolIsGutterMargin()const

This function is identical to IsLabelMargin().

Return Value
True if a label margin has been set, false if not.

IsLabelMargin ( )

IMPORT_C TBoolIsLabelMargin()const

Tests whether a label margin has been set.

Return Value
True if a label margin has been set. False if not.

LabelMargin ( )

IMPORT_C TRectLabelMargin()const

Gets the area occupied by the label margin.

Return Value
Rectangle representing the label margin.

ParagraphFillTextOnly ( )

IMPORT_C TBoolParagraphFillTextOnly()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. Deprecated7.0

Return Value
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.

PictureGc ( )

IMPORT_C CGraphicsContext *PictureGc()const

PrimaryGc ( )

IMPORT_C CGraphicsContext *PrimaryGc()const

Gets the graphics context for drawing the text and pictures.

Return Value
The graphics context.

SetBitmapGc ( CBitmapContext *, CBitmapContext * )

IMPORT_C voidSetBitmapGc(CBitmapContext *aGc,
CBitmapContext *aPictureGc = 0
)

SetClipping ( TBool )

IMPORT_C voidSetClipping(TBoolaClipping)

Sets whether drawing should be clipped to the intersection of the draw rectangle (the aDrawRect parameter passed to CTextLayout::DrawL() or InvertRangeL()) and the text area.

Parameters
aClippingTrue to clip drawing to the clip rectangle. False to ignore the clip rectangle.

SetDrawGraphicsOnly ( )

IMPORT_C voidSetDrawGraphicsOnly()

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

SetDrawMode ( TUint )

voidSetDrawMode(TUintaDrawMode)

Returns the current drawing mode flags.

SetDrawTextAndGraphics ( )

IMPORT_C voidSetDrawTextAndGraphics()

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

SetDrawTextOnly ( )

IMPORT_C voidSetDrawTextOnly()

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

SetDrawToEveryPixel ( TBool )

IMPORT_C voidSetDrawToEveryPixel(TBoolaDrawToEveryPixel)

Sets whether the background colour as specified by iBackgroundColor should be drawn.

Parameters
aDrawToEveryPixelSpecify ETrue to draw the background colour, EFalse to draw no background colour.

SetGc ( CGraphicsContext *, CGraphicsContext * )

IMPORT_C voidSetGc(CGraphicsContext *aGc,
CGraphicsContext *aPictureGc = 0
)

Sets the graphics context for drawing text and pictures.

Parameters
aGcPointer to the graphics context for drawing text and pictures.
aPictureGcThis argument is not used - all drawing is done using aGc.

SetParagraphFillTextOnly ( TBool )

IMPORT_C voidSetParagraphFillTextOnly(TBoolaFillTextOnly)

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

Parameters
aFillTextOnlyIf 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 voidSetTextColorOverride(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
aOverrideColorIf not NULL, overrides the text colour.

SetWindowGc ( CWindowGc *, CWindowGc * )

IMPORT_C voidSetWindowGc(CWindowGc *aGc,
CWindowGc *aPictureGc = 0
)

TextArea ( )

IMPORT_C TRectTextArea()const

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

Return Value
The text area.

TextOverrideColor ( )

IMPORT_C const TRgb *TextOverrideColor()const

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

Return Value
Text override colour. NULL if no text override colour is in use.

TextToWindow ( TPoint & )

IMPORT_C voidTextToWindow(TPoint &aTextAreaPos)const

Converts a point in layout coordinates to window coordinates.

Parameters
aTextAreaPosA point in layout coordinates. On return, set to window coordinates.

TextToWindow ( TRect & )

IMPORT_C voidTextToWindow(TRect &aRect)const

Converts a rectangle in layout coordinates to window coordinates.

Parameters
aRectRectangle in layout coordinates. On return, set to window coordinates.

TopLeftText ( )

IMPORT_C TPointTopLeftText()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.

Return Value
The coordinates of the top left hand point at which text can be drawn.

TopLeftTextArea ( )

IMPORT_C TPointTopLeftTextArea()const

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

Return Value
The top left hand corner of the text area.

TotalMargin ( )

IMPORT_C TRectTotalMargin()const

Gets the area occupied by the label and gutter margins.

Return Value
Rectangle representing the label and gutter margins.

UseBackgroundColor ( )

IMPORT_C TBoolUseBackgroundColor()const

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

Return Value
True if the background colour is used. False if not.

UseClippingRect ( )

IMPORT_C TBoolUseClippingRect()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.

Return Value
True if clipping set to clip rectangle, false if not.

UseGcClear ( )

IMPORT_C TBoolUseGcClear()const

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

Return Value
True if the graphics context is either CWindowGc or CBitmapContext. False otherwise.

UseWindowGc ( )

TBool UseWindowGc()const

Tests if a CWindowGc is being used.

WindowToText ( TPoint & )

IMPORT_C voidWindowToText(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
aWinPosPoint in window coordinates. On return, set to layout coordinates.

WindowToText ( TRect & )

IMPORT_C voidWindowToText(TRect &aRect)const

Converts a rectangle 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
aRectRectangle in window coordinates. On return, set to layout coordinates.