CEikLabel Class Reference

API published in: S60 1st Ed

Link against: eikcoctl.lib

Capability Information

Required Capabilities

None


#include <
eiklabel.h>

Inherits CEikAlignedControl.

Inherited by CEikCapCLabel.


Detailed Description

Enables one or more lines of text to be displayed.

Public Types

enum  TTextEmphasis { ENoEmphasis = 0x00, EPartialEmphasis = 0x10, EFullEmphasis = 0x20 }
 Determines text emphasis. More...

Public Member Functions

IMPORT_C ~CEikLabel ()
 Destructor.
IMPORT_C CEikLabel ()
 C++ default constructor.
IMPORT_C void SetLabelAlignment (TInt aAlignment)
 Sets the labels alignment.
IMPORT_C void SetBrushStyle (CWindowGc::TBrushStyle aBrushStyle)
 Sets the brush style to be used from aBrushStyle, this overwrites the brush style set via the Control Context.
IMPORT_C void SetBrushStyleFromContext ()
 Sets the brush style to be used from the Control Context, this overwrites the brush style set via the CEikLabel::SetBrushStyle().
IMPORT_C TSize MinimumSize ()
 From CCoeControl.
IMPORT_C void ConstructFromResourceL (TResourceReader &aReader)
 From CCoeControl.
IMPORT_C void GetColorUseListL (CArrayFix< TCoeColorUse > &aColorUseList) const
 From CCoeControl.
IMPORT_C void HandleResourceChange (TInt aType)
 From CCoeControl.
IMPORT_C void Draw (const TRect &aRect) const
 From CCoeControl.
IMPORT_C void SetTextL (const TDesC &aText)
 Sets the label’s text.
const TDesC * Text () const
 Gets the label’s text.
IMPORT_C void CropText ()
 Sets a flag to indicate that the text needs to be truncated with 3 dots.
IMPORT_C void SetBufferReserveLengthL (TInt aLength)
 Sets the buffer reserve length.
IMPORT_C void SetFont (const CFont *aFont)
 Sets the label’s font.
const CFont * Font () const
 Gets the label’s font.
IMPORT_C void SetEmphasis (TTextEmphasis aEmphasis)
 Sets the label's text emphasis.
IMPORT_C void SetPixelGapBetweenLines (TInt aGap)
 Sets the gap between lines.
IMPORT_C TInt PixelGapBetweenLines () const
 Gets the number of pixels between two lines of text.
TBool IsUnderlined () const
 Tests whether the label is underlined.
IMPORT_C void SetUnderlining (TBool aUnderLining)
 Sets the label underlining.
TBool IsStrikethrough () const
 Tests label strike-through.
IMPORT_C void SetStrikethrough (TBool aStrikethrough)
 Sets the label strike-through.
IMPORT_C TSize CalcMinimumSize (TPtrC &aText) const
 Gets the minimum size required to draw the specified text.
TUint8 NumberOfLines ()
 Gets the number of lines of text in the label.
IMPORT_C TInt BufferReserveLength () const
 Gets the buffer reserve length.
IMPORT_C void UseLogicalToVisualConversion (TBool aUseConversion)
 Enables or disables logical to visual conversion when label text is drawn.
IMPORT_C TBool LogicalToVisualConversionUsed () const
 Gets information whether label is performing logical to visual conversion or not.
IMPORT_C void EnablePictographsL (CAknPictographInterface &aInterface)
 Enables pictograph drawing in the label text.
IMPORT_C void DisablePictographs ()
 Disables pictograph drawing in the label text.
IMPORT_C void HandlePointerEventL (const TPointerEvent &aPointerEvent)
 From CCoeControl.

Protected Types

enum  TLabelFlags { EUnderlining = 0x02, EStrikethrough = 0x04, EUseLogicalToVisualConversion = 0x08 }
 Determines whether text is drawn with underlining or strike-through. More...

Protected Member Functions

IMPORT_C void WriteInternalStateL (RWriteStream &aWriteStream) const
 From CCoeControl.

Protected Attributes

HBufC * iText
 The label’s text.
const CFont * iFont
 The label’s font.
TUint8 iNumberOfLines
 The label’s number of lines of text.
TUint8 iLabFlags
 The label’s flags.
TInt iGapBetweenLines
 The number of pixels between lines of text.

Member Enumeration Documentation

enum CEikLabel::TLabelFlags [protected]
 

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

Enumerator:
EUnderlining  Text is drawn with underlining.
EStrikethrough  Text is drawn with strike-through.
EUseLogicalToVisualConversion  Determines that bi-directional algorithm still needs to be run against the set text string.

This flag allows app to do logical-to-visual conversion in the application side -- since the bi-directional algorithm can only be run once for every text string, we need flagging like this to control whether the algorithm is run inside label or whether the application has already run it and we should not return the algorithm.

enum CEikLabel::TTextEmphasis
 

Determines text emphasis.

Enumerator:
ENoEmphasis  No emphasis.
EPartialEmphasis  Partial emphasis.
EFullEmphasis  Full emphasis.

Constructor & Destructor Documentation

IMPORT_C CEikLabel::~CEikLabel  ) 
 

Destructor.

IMPORT_C CEikLabel::CEikLabel  ) 
 

C++ default constructor.


Member Function Documentation

IMPORT_C TInt CEikLabel::BufferReserveLength  )  const
 

Gets the buffer reserve length.

Returns:
The buffer reserve length.
IMPORT_C TSize CEikLabel::CalcMinimumSize TPtrC &  aText  )  const
 

Gets the minimum size required to draw the specified text.

Parameters:
aText The text to be drawn.
Returns:
The minimum size required to draw the text.
IMPORT_C void CEikLabel::ConstructFromResourceL TResourceReader &  aReader  ) 
 

From CCoeControl.

Constructs the control from a resource file.

Parameters:
aReader Interprets resource data read from a resource file.
IMPORT_C void CEikLabel::CropText  ) 
 

Sets a flag to indicate that the text needs to be truncated with 3 dots.

IMPORT_C void CEikLabel::DisablePictographs  ) 
 

Disables pictograph drawing in the label text.

Only effective in Japanese variant. By default, it is disabled.

IMPORT_C void CEikLabel::Draw const TRect &  aRect  )  const
 

From CCoeControl.

Draw a control - called by window server. All controls, except blank controls, should implement this function. The default implementation draws a blank control.

This function is used for window server-initiated redrawing of controls, and for some application-initiated drawing. It should be implemented by each control, but is only called from within CCoeControl's member functions, and not from the derived class. For this reason it is a private member function of CCoeControl.

Parameters:
aRect The region of the control to be redrawn. Co-ordinates are relative to the control's origin (top left corner).
Panic:
EEikPanicLabelNullText Panics if label text has not been defined.

Reimplemented in CEikCapCLabel.

IMPORT_C void CEikLabel::EnablePictographsL CAknPictographInterface aInterface  ) 
 

Enables pictograph drawing in the label text.

Only effective in Japanese variant. By default, it is disabled.

Parameters:
aInterface Used pictograph interface owned by the caller.
const CFont * CEikLabel::Font  )  const [inline]
 

Gets the label’s font.

Returns:
The label’s font.
IMPORT_C void CEikLabel::GetColorUseListL CArrayFix< TCoeColorUse > &  aColorUseList  )  const
 

From CCoeControl.

Gets the list of logical colours used to draw the control.

Parameters:
aColorUseList The colour list.
IMPORT_C void CEikLabel::HandlePointerEventL const TPointerEvent &  aPointerEvent  ) 
 

From CCoeControl.

Handles pointer events. This function gets called whenever a pointer event occurs in the control, i.e. when the pointer is within the control's extent, or when the control has grabbed the pointer. The control should implement this function to handle pointer events.

Note: events of type EButton1Down are processed before HandlePointerEventL() is called, in order to transfer keyboard focus to the control in which the EButton1Down event occurred.

If overriding HandlePointerEventL(), the implementation must include a base call to CCoeControl's HandlePointerEventL().

Parameters:
aPointerEvent The pointer event.

Reimplemented from CEikAlignedControl.

IMPORT_C void CEikLabel::HandleResourceChange TInt  aType  ) 
 

From CCoeControl.

Handles a change to the control's resources.

Parameters:
aType A message UID value.
TBool CEikLabel::IsStrikethrough  )  const [inline]
 

Tests label strike-through.

Returns:
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.

TBool CEikLabel::IsUnderlined  )  const [inline]
 

Tests whether the label is underlined.

Returns:
ETrue if the label is set as underlined.

EFalse if the label is not set as underlined.

IMPORT_C TBool CEikLabel::LogicalToVisualConversionUsed  )  const
 

Gets information whether label is performing logical to visual conversion or not.

Returns:
ETrue if label does logical to visual conversion.

EFalse if not.

IMPORT_C TSize CEikLabel::MinimumSize  ) 
 

From CCoeControl.

Sets the control's minimum required size.

Returns:
Minimum size required by the control.
TUint8 CEikLabel::NumberOfLines  )  [inline]
 

Gets the number of lines of text in the label.

Returns:
The number of lines of text.
IMPORT_C TInt CEikLabel::PixelGapBetweenLines  )  const
 

Gets the number of pixels between two lines of text.

Returns:
The number of pixels between two lines of text.
IMPORT_C void CEikLabel::SetBrushStyle CWindowGc::TBrushStyle  aBrushStyle  ) 
 

Sets the brush style to be used from aBrushStyle, this overwrites the brush style set via the Control Context.

Parameters:
aBrushStyle A brush style.
IMPORT_C void CEikLabel::SetBrushStyleFromContext  ) 
 

Sets the brush style to be used from the Control Context, this overwrites the brush style set via the CEikLabel::SetBrushStyle().

IMPORT_C void CEikLabel::SetBufferReserveLengthL TInt  aLength  ) 
 

Sets the buffer reserve length.

Parameters:
aLength The buffer reserve length.
IMPORT_C void CEikLabel::SetEmphasis TTextEmphasis  aEmphasis  ) 
 

Sets the label's text emphasis.

Parameters:
aEmphasis The label's text emphasis.
IMPORT_C void CEikLabel::SetFont const CFont *  aFont  ) 
 

Sets the label’s font.

Parameters:
aFont The label's font.
IMPORT_C void CEikLabel::SetLabelAlignment TInt  aAlignment  ) 
 

Sets the labels alignment.

Overwrites alignment set via CEikAlignedControl.

Parameters:
aAlignment Should be one of { ELayoutAlignNone, ELayoutAlignCenter, ELayoutAlignLeft, ELayoutAlignRight, ELayoutAlignBidi } defined in Avkon.hrh.
IMPORT_C void CEikLabel::SetPixelGapBetweenLines TInt  aGap  ) 
 

Sets the gap between lines.

Gap has a particular definition here. It is defined to be: "baselines separation" - CFont::HeightInPixels()

Parameters:
aGap Pixels gap to set between lines.
IMPORT_C void CEikLabel::SetStrikethrough TBool  aStrikethrough  ) 
 

Sets the label strike-through.

Parameters:
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.
IMPORT_C void CEikLabel::SetTextL const TDesC &  aText  ) 
 

Sets the label’s text.

Parameters:
aText The label’s text.
Panic:
EEikPanicLabelNullText Panics if label text has not been defined.
IMPORT_C void CEikLabel::SetUnderlining TBool  aUnderLining  ) 
 

Sets the label underlining.

Parameters:
aUnderLining ETrue to set the label as underlined. EFalse to set the label as not underlined.
const TDesC * CEikLabel::Text  )  const [inline]
 

Gets the label’s text.

Returns:
The label’s text.
IMPORT_C void CEikLabel::UseLogicalToVisualConversion TBool  aUseConversion  ) 
 

Enables or disables logical to visual conversion when label text is drawn.

By default, it is enabled. If you perform the conversion yourself and give visual text (in scrictly left-to-right order) to label, you should disable the conversion in label. Note that label does not perform cropping if logical to visual conversion is disabled.

Parameters:
aUseConversion Whether label should perform logical to visual conversion or not.
IMPORT_C void CEikLabel::WriteInternalStateL RWriteStream &  aWriteStream  )  const [protected]
 

From CCoeControl.

Writes the internal state of the control and its components to a stream. Does nothing in release mode. Designed to be overidden and base called by subclasses.

Parameters:
aWriteStream The write stream.

Reimplemented from CEikAlignedControl.


Field Documentation

const CFont* CEikLabel::iFont [protected]
 

The label’s font.

TInt CEikLabel::iGapBetweenLines [protected]
 

The number of pixels between lines of text.

TUint8 CEikLabel::iLabFlags [protected]
 

The label’s flags.

These are used to set text emphasis and characteristics, such as underlining, and strikethrough.

TUint8 CEikLabel::iNumberOfLines [protected]
 

The label’s number of lines of text.

HBufC* CEikLabel::iText [protected]
 

The label’s text.


The documentation for this class was generated from the following file:

Copyright © Nokia Corporation 2001-2008
Back to top