Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: eiklabel.h
Link against: eikcoctl.lib

Class CEikLabel

CEikLabel

Support

Supported from 6.0

Description

This class enables you to display one or more lines of text. It is usually used for buttons and file name labels.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CCoeControlControl base class from which all other controls are derived
CEikAlignedControlThis class extends the CCoeControl class in order to support extra functionality such as control alignment and margins
CEikLabelThis class enables you to display one or more lines of text
MCoeControlContextInterface to allow sharing of graphics settings between controls

Defined in CEikLabel:
BufferReserveLength(), CEikLabel(), CalcMinimumSize(), ConstructFromResourceL(), Draw(), EFullEmphasis, ENoEmphasis, EPartialEmphasis, EStrikethrough, EUnderlining, Font(), GetColorUseListL(), HandleResourceChange(), IsStrikethrough(), IsUnderlined(), MinimumSize(), NumberOfLines(), PixelGapBetweenLines(), SetBufferReserveLengthL(), SetEmphasis(), SetFont(), SetPixelGapBetweenLines(), SetStrikethrough(), SetTextL(), SetUnderlining(), TLabelFlags, TTextEmphasis, Text(), iFont, iGapBetweenLines, iLabFlags, iNumberOfLines, iText, ~CEikLabel()

Inherited from CBase:
operator new()

Inherited from CCoeControl:
ActivateGc(), ActivateL(), BackedUpWindow(), CapturesPointer(), ClaimPointerGrab(), CloseWindow(), ComponentControl(), ControlContext(), ControlEnv(), CopyControlContextFrom(), CountComponentControls(), CreateBackedUpWindowL(), CreateWindowL(), DeactivateGc(), DrawDeferred(), DrawNow(), DrawableWindow(), EnableDragEvents(), FocusChanged(), GetColor(), GetHelpContext(), GrabbingComponent(), HandleComponentControlsResourceChange(), HandlePointerBufferReadyL(), HandlePointerEventL(), HandleRedrawEvent(), HasBorder(), IgnoreEventsUntilNextPointerUp(), Index(), InputCapabilities(), IsActivated(), IsBackedUp(), IsBeingDestroyed(), IsBlank(), IsDimmed(), IsFocused(), IsNonFocusing(), IsReadyToDraw(), IsVisible(), MakeVisible(), Observer(), OfferKeyEventL(), OverrideColorL(), OwnsWindow(), Position(), PositionChanged(), PositionRelativeToScreen(), PrepareForFocusGainL(), PrepareForFocusLossL(), Rect(), RecursivelyMergedInputCapabilities(), ReportEventL(), ResetGc(), SetAdjacent(), SetAllowStrayPointers(), SetBlank(), SetCanDrawOutsideRect(), SetComponentsToInheritVisibility(), SetContainerWindow(), SetContainerWindowL(), SetControlContext(), SetCornerAndSize(), SetCornerAndSizeL(), SetDimmed(), SetExtent(), SetExtentL(), SetExtentToWholeScreen(), SetExtentToWholeScreenL(), SetFocus(), SetFocusing(), SetGloballyCapturing(), SetNeighbor(), SetNonFocusing(), SetObserver(), SetPointerCapture(), SetPosition(), SetRect(), SetRectL(), SetSize(), SetSizeL(), SetSizeWithoutNotification(), SetSizeWithoutNotificationL(), Size(), SizeChanged(), SizeChangedL(), SystemGc(), Window()

Inherited from CEikAlignedControl:
SetAlignment(), SetAllMarginsTo(), iAlignment, iMargin

Inherited from MCoeControlContext:
ActivateContext(), PrepareContext(), ResetContext()


Construction and destruction


CEikLabel()

CEikLabel();

Description

Default constructor.


ConstructFromResourceL()

void ConstructFromResourceL(TResourceReader& aReader);

Description

Constructs a label from resource using the specified resource reader.

Parameters

TResourceReader& aReader

The resource reader to use.


~CEikLabel()

~CEikLabel();

Description

Destructor.

[Top]


Text attributes


SetTextL()

void SetTextL(const TDesC& aText);

Description

Sets the label’s text.

Parameters

const TDesC& aText

The label’s text.


Text()

const TDesC* Text() const;

Description

Gets the label’s text.

Return value

TDesC*

The label’s text.


NumberOfLines()

TUint8 NumberOfLines();

Description

Gets the number of lines of text in the label.

Return value

TUint8

The number of lines of text.


SetFont()

void SetFont(const CFont* aFont);

Description

Sets the label’s font.

Parameters

const CFont* aFont

The label’s font.


Font()

const CFont* Font() const;

Description

Gets the label’s font.

Return value

CFont*

The label’s font.


SetEmphasis()

void SetEmphasis(TTextEmphasis aEmphasis);

Description

Sets the label's text emphasis.

Parameters

TTextEmphasis aEmphasis

The label's text emphasis.


SetPixelGapBetweenLines()

void SetPixelGapBetweenLines(TInt aGap);

Description

Sets the gap between the label’s text lines in pixels.

Parameters

TInt aGap

The number of pixels between two lines of text.


PixelGapBetweenLines()

TInt PixelGapBetweenLines() const;

Description

Gets the number of pixels between two lines of text.

Return value

TInt

The number of pixels between two lines of text.


IsUnderlined()

TBool IsUnderlined() const;

Description

Tests whether the label is underlined.

Return value

TBool

ETrue if the label is set as underlined, EFalse if the label is not set as underlined.


SetUnderlining()

void SetUnderlining(TBool aUnderLining);

Description

Sets label underlining.

Parameters

TBool aUnderLining

ETrue to set the label as underlined, EFalse to set the label as not underlined.


IsStrikethrough()

TBool IsStrikethrough() const;

Description

Tests label strike-through.

Return value

TBool

ETrue if the label is set to be drawn with a line through it, EFalse if the label is not set to be drawn with a line through it.


SetStrikethrough()

void SetStrikethrough(TBool aStrikethrough);

Description

Sets label strike-through.

Parameters

TBool aStrikethrough

ETrue to set the label to be drawn with a line through it, EFalse to set the label to not be drawn with a line through it.

[Top]


Buffer reserve


BufferReserveLength()

TInt BufferReserveLength() const;

Description

Gets the buffer reserve length.

Return value

TInt

The buffer reserve length.


SetBufferReserveLengthL()

void SetBufferReserveLengthL(TInt aLength);

Description

Sets the buffer reserve length.

Parameters

TInt aLength

The buffer reserve length.

[Top]


Obtaining minimum sizes


MinimumSize()

TSize MinimumSize();

Description

Gets the minimum size required to draw the label.

Return value

TSize

The minimum size required to draw the label.


CalcMinimumSize()

TSize CalcMinimumSize(TPtrC& aText) const;

Description

Gets the minimum size required to draw the specified text.

Parameters

TPtrC& aText

The text to be drawn.

Return value

TSize

The minimum size required to draw the text.

[Top]


Colour use


GetColorUseListL()

void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;

Description

Gets the list of logical colours used to draw the control. The list is appended to aColorUseList and paired with an explanation of how the colours are used.

Parameters

CArrayFix<TCoeColorUse>& aColorUseList

List of logical colours.

[Top]


Handling resource changes


HandleResourceChange()

void HandleResourceChange(TInt aType);

Description

Handles a change in the control's resources which are shared across the environment. Colours or fonts for example.

Parameters

TInt aType

The type of resource that has changed.

[Top]


Drawing


Draw()

void Draw(const TRect& aRect) const;

Description

Draws the control.

Parameters

const TRect& aRect

Optional. If supplied, the rectangle in which the control is drawn.

[Top]


Public enumeration constants


Enum TTextEmphasis

TTextEmphasis

Description

Determines text emphasis.

ENoEmphasis

Text is drawn with no emphasis.

EPartialEmphasis

Text is drawn partially emphasised.

EFullEmphasis

Text is drawn with full emphasis.

[Top]


Protected enumeration constants


Enum TLabelFlags

TLabelFlags

Description

Determines whether text is drawn with underlining and strike-through.

EUnderlining

Text is drawn with underlining.

EStrikethrough

Text is drawn with strike-through.

[Top]


Protected member data

Description

Specifies various label attributes.


iText

protected: HBufC* iText

Description

The label’s text.


iFont

protected: const CFont* iFont

Description

The label’s font.


iNumberOfLines

protected: TUint8 iNumberOfLines

Description

The label’s number of lines of text.


iLabFlags

protected: TUint8 iLabFlags

Description

The label’s flags. These are used to set text emphasis and characteristics, such as underlining, and strikethrough.


iGapBetweenLines

protected: TInt iGapBetweenLines

Description

The number of pixels between lines of text.