Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: frmtlay.h
Link against: form.lib

Class TDrawTextLayoutContext

TDrawTextLayoutContext

Support

Supported from 5.0

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.

Defined in TDrawTextLayoutContext:
DisplayHeight(), DrawGraphics(), DrawText(), GutterMargin(), IsGutterMargin(), IsLabelMargin(), LabelMargin(), ParagraphFillTextOnly(), PrimaryGc(), SetBitmapGc(), SetClipping(), SetDrawGraphicsOnly(), SetDrawTextAndGraphics(), SetDrawTextOnly(), SetDrawToEveryPixel(), SetGc(), SetParagraphFillTextOnly(), SetTextColorOverride(), SetWindowGc(), TDrawTextLayoutContext(), TextArea(), TextOverrideColor(), TextToWindow(), TopLeftText(), TopLeftTextArea(), TotalMargin(), UseBackgroundColor(), UseClippingRect(), WindowToText(), iBackgroundColor, iGutterMarginWidth, iLabelMarginWidth, iTextStartX, iViewRect


Construction


TDrawTextLayoutContext()

TDrawTextLayoutContext();

Description

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.

[Top]


Graphics context


SetGc()

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

Description

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.


SetBitmapGc()

void SetBitmapGc(CBitmapContext* aGc,CBitmapContext* aPictureGc=NULL);

Description

Obsolete function. This function is identical to SetGc().


SetWindowGc()

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

Description

Obsolete function.

This function is identical to SetGc() except that it sets a flag to ensure that drawing uses the clip rectangle.


PrimaryGc()

CGraphicsContext* PrimaryGc() const;

Description

Gets the graphics context for drawing the text and pictures.

Return value

CGraphicsContext*

The graphics context.

[Top]


Background colour


SetDrawToEveryPixel()

void SetDrawToEveryPixel(TBool aDrawToEveryPixel);

Description

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

Parameters

TBool aDrawToEveryPixel

Specify ETrue to draw the background colour, EFalse to draw no background colour.


UseBackgroundColor()

TBool UseBackgroundColor() const;

Description

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

Return value

TBool

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


SetParagraphFillTextOnly()

void SetParagraphFillTextOnly(TBool aFillTextOnly);

Description

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

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.


ParagraphFillTextOnly()

TBool ParagraphFillTextOnly() const;

Description

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.

Return value

TBool

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.

[Top]


Text colour


SetTextColorOverride()

void SetTextColorOverride(const TRgb *aOverrideColor);

Description

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.


TextOverrideColor()

const TRgb* TextOverrideColor() const;

Description

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

Return value

TRgb*

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

[Top]


Drawing


SetDrawTextOnly()

void SetDrawTextOnly();

Description

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


SetDrawGraphicsOnly()

void SetDrawGraphicsOnly();

Description

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


SetDrawTextAndGraphics()

void SetDrawTextAndGraphics();

Description

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


SetClipping()

void SetClipping(TBool aClipping);

Description

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

TBool aClipping

True to clip drawing to the clip rectangle. False to ignore the clip rectangle.


UseClippingRect()

TBool UseClippingRect() const;

Description

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

TBool

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


DrawText()

TBool DrawText() const;

Description

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


DrawGraphics()

TBool DrawGraphics() const;

Description

Obsolete function.

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

[Top]


Text area and margins


TextArea()

TRect TextArea() const;

Description

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

Return value

TRect

The text area.


DisplayHeight()

TInt DisplayHeight() const;

Description

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

Return value

TInt

The display height.


TopLeftTextArea()

TPoint TopLeftTextArea() const;

Description

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

Return value

TPoint

The top left hand corner of the text area.


TotalMargin()

TRect TotalMargin() const;

Description

Gets the area occupied by the label and gutter margins.

Return value

TRect

Rectangle representing the label and gutter margins.


LabelMargin()

TRect LabelMargin() const;

Description

Gets the area occupied by the label margin.

Return value

TRect

Rectangle representing the label margin.


IsLabelMargin()

TBool IsLabelMargin() const;

Description

Tests whether a label margin has been set.

Return value

TBool

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


IsGutterMargin()

TBool IsGutterMargin() const;

Description

This function is identical to IsLabelMargin().

Return value

TBool

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


GutterMargin()

TRect GutterMargin() const;

Description

Gets the area occupied by the gutter margin.

Return value

TRect

Rectangle representing the gutter margin.


TopLeftText()

TPoint TopLeftText() const;

Description

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

TPoint

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

[Top]


Converting coordinates


WindowToText()

void WindowToText(TPoint& aWinPos) const;

Description

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

void WindowToText(TRect& aRect) const;

Description

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

TRect& aRect

Rectangle in window coordinates. On return, set to layout coordinates.


TextToWindow()

void TextToWindow(TPoint& aTextAreaPos) const;

Description

Converts a point in layout coordinates to window coordinates.

Parameters

TPoint& aTextAreaPos

A point in layout coordinates. On return, set to window coordinates.


TextToWindow()

void TextToWindow(TRect& aRect) const;

Description

Converts a rectangle in layout coordinates to window coordinates.

Parameters

TRect& aRect

Rectangle in layout coordinates. On return, set to window coordinates.

[Top]


Member data


iViewRect

TRect iViewRect

Description

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


iLabelMarginWidth

TInt iLabelMarginWidth

Description

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


iGutterMarginWidth

TInt iGutterMarginWidth

Description

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


iTextStartX

TInt iTextStartX

Description

The horizontal offset between window coordinates and text layout coordinates.


iBackgroundColor

TRgb iBackgroundColor

Support

Withdrawn in 6.0

Description

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.


iBackgroundColor

TLogicalRgb iBackgroundColor

Support

Supported from 6.0

Description

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.