CTextLayout::TRangeChange Class Reference
class CTextLayout::TRangeChange |
Specifies the range of characters involved when setting or clearing a text selection.
This class is used in the CTextLayout::Highlight() function. The following code demonstrates how it should be used to clear an existing highlight and set a new one:
CTextLayout::TRangeChange oldHighlight(anchorPos, old_cursorPos,
CTextLayout::TRangeChange::EClear); // existing highlight
CTextLayout::TRangeChange newHighlight(anchorPos, new_cursorPos,
CTextLayout::TRangeChange::ESet); // new one
newHighlight.OptimizeWith(oldHighlight); // doesn't matter which range is
the parameter and which is the calling object
layout.Highlight(oldHighlight,drawRect,context); // doesn't matter in which
order this and following line occur
layout.Highlight(newHighlight,drawRect,context);
CTextLayout::Highlight()
Constructor & Destructor Documentation
TRangeChange(TInt, TInt, TChangeType)
Constructor with a start and end position and whether the highlighting in the range should be set or cleared.
The start and end positions can be specified in any order.
Parameters
TInt aStart | The start position. |
TInt aEnd | The end position. |
TChangeType aChange | Specifies whether the highlighting should be set or cleared. |
Member Functions Documentation
IsJoinedTo(const TRangeChange)
NonNull()
IMPORT_C TBool | NonNull | ( | ) | const |
OptimizeWith(TRangeChange &)
Try to cancel out sections of the ranges that overlap Merges two ranges of characters.
Two successive calls to CTextLayout::Highlight() could cause unecessary flicker or redrawing if the arguments to each call overlap. For example, if extending a highlight involved removing the old highlight and then drawing the new one, this would cause visible flicker. This can be eliminated by calling this function to remove any overlap between the two ranges. If there is overlap, this range is set to the result of the merge, and the other range (aBuddy) is set to zero.
When calling this function, it does not matter whether or not the two ranges overlap. Also it does not matter which range is the parameter and which is the calling object. After calling OptimizeWith(), it is guaranteed that the resulting ranges will not overlap, and they will represent the same change to the highlight as the original two ranges.
See the code fragment in the class description for TRangeChange for an example of how this function is used.
Parameters
TRangeChange & aBuddy | The range of characters to combine with this range. |
Set(TInt, TInt, TChangeType)
Member Enumerations Documentation
Enum TChangeType
Enumerates the possible change types.
Enumerators
ESet |
The object is being used to set a range.
|
EClear |
The object is being used to clear a range.
|
Member Data Documentation
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.