Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: eikedwin.h
Link against: eikcoctl.lib

Class CEikEdwin

CEikEdwin

Support

Supported from 6.0

Description

Base class for controls that display and allow manipulation of text. The properties of a particular Edwin object can be set using bitwise flags, which are defined in member enums (see TFlags for example).

Edwins support Front End Processors if present on the target machine, and so are a highly effective way of getting textual data from the user. The text currently being composed by the user is called the composition text.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CCoeControlControl base class from which all other controls are derived
CEikBorderedControlA control which is drawn surrounded by a rectangular border
CEikEdwinBase class for controls that display and allow manipulation of text
MEikScrollBarObserverThis mixin is implemented by classes wishing to receive notification about scroll events from a scroll bar

Defined in CEikEdwin:
ActivateL(), AddEdwinObserverL(), AvgCharsPerLine(), AvgLinesInViewRect(), BaseConstructL(), CEikEdwin(), CalculateWidth(), CanUndo(), CancelFepTransaction(), CancelInsertCharFormat(), CancelSelectionL(), CheckNotReadOnlyL(), CheckRemovePictures(), CheckValidityOfChars(), ClearSelectionL(), ClearUndo(), ClipboardL(), ConstructFromResourceL(), ConstructL(), CopyDocumentContentL(), CopyToStoreL(), CountWords(), CreatePreAllocatedScrollBarFrameL(), CreateScrollBarFrameL(), CreateTextViewL(), CursorPos(), DeleteHighlightL(), DeleteL(), DisplayFindTextNotFound(), Draw(), DrawContents(), EAllowPictures, EAllowUndo, EAlwaysShowSelection, EChunkPara, EChunkWord, ECopy, ECopyText, ECut, EDisplayOnly, EDoesNotOwnText, EEnd, EFindAgain, EFindCaseSensitive, EFindDirectionUp, EFindWholeWord, EHotKeyBold, EHotKeyCopy, EHotKeyCut, EHotKeyEditObject, EHotKeyFind, EHotKeyFont, EHotKeyFormatObject, EHotKeyInsertChar, EHotKeyInsertObject, EHotKeyItalic, EHotKeyPaste, EHotKeyUnderline, EHotKeyUndo, EIgnoreVirtualCursor, EInclusiveSizeFixed, EJustAutoCurEnd, EKeepDocument, ELineCursor, ENoAutoSelection, ENoBusyMessage, ENoClipboard, ENoHorizScrolling, ENoLineOrParaBreaks, ENoWrap, EOnlyASCIIChars, EOwnsText, EOwnsWindow, EPaste, EReadOnly, EResizable, ESegmentedStorage, EStart, EUseText, EUserSuppliedText, EWidthInPixels, FindL(), FindTextL(), FocusChanged(), ForceScrollBarUpdateL(), FormatTextL(), GetColorUseListL(), GetFindText(), GetText(), GetTextInHBufL(), GetWordInfo(), HandlePointerEventL(), HandleResourceChange(), HandleScrollEventL(), HandleSizeChangedL(), HandleTextChangedL(), HandleTextPastedL(), InputCapabilities(), InsertDeleteCharsL(), InsertFieldL(), InsertFromTextFileL(), IsReadOnly(), IsValidChar(), LayoutWidth(), LineCursorWidth(), LowerPartialFormattingLength(), Margins(), MaximumHeight(), MinimumHeight(), MinimumSize(), MoveCursorL(), MoveCursorToChunkStartL(), MoveDisplayL(), NonPrintingCharsVisibility(), NotifyNewDocumentL(), NotifyNewFormatL(), OfferKeyEventL(), OkToDeleteSelectionL(), OnReformatL(), OnlyASCIIChars(), PasteFromStoreL(), PlaceDataOnClipboardL(), ReceiveDataOverIrL(), RemoveEdwinObserver(), ReplaceAllL(), ReplaceL(), ReportEdwinEventL(), RunCharMapDialogL(), ScrollBarFrame(), SelectAllL(), Selection(), SelectionLength(), SendDataOverIrL(), SetAllowPictures(), SetAllowUndo(), SetAmountToFormatL(), SetAvgCharsPerLine(), SetAvgLinesInViewRect(), SetBackgroundColorL(), SetBorderViewMargins(), SetContainerWindowL(), SetCursorPosL(), SetDimmed(), SetDocumentContentL(), SetDocumentOwnership(), SetEdwinObserver(), SetEdwinSizeObserver(), SetInputCapabilitiesL(), SetLineCursorDetailsL(), SetMaximumHeight(), SetMinimumHeight(), SetNonPrintingCharsVisibility(), SetOnlyASCIIChars(), SetPasteFromIrStore(), SetReadOnly(), SetRightWrapGutter(), SetSelectionL(), SetTextL(), SetTextLimit(), SetWordDelimiters(), SetWordWrapL(), SetWysiwygModeOff(), SetWysiwygModeOn(), SetZoomFactorL(), SupportsUndo(), TChunkSize, TClipboardFunc, TEdwinHotKeys, TEnd, TFindFlags, TFlags, TOwnershipType, TSetContent, Text(), TextLength(), TrappedDraw(), TrappedSizeChanged(), UndoL(), UpdateAllFieldsL(), UpdateCurrentFieldL(), UpdateLayoutWidth(), UpdateScrollBarsL(), UpperFullFormattingLength(), iEdwinInternalFlags, iEdwinUserFlags, iLastPointerDocPos, iLayout, iMargins, iNumberOfLines, iText, iTextLimit, iTextView, iZoomFactor, ~CEikEdwin()

Inherited from CBase:
operator new()

Inherited from CCoeControl:
ActivateGc(), BackedUpWindow(), CapturesPointer(), ClaimPointerGrab(), CloseWindow(), ComponentControl(), ControlContext(), ControlEnv(), CopyControlContextFrom(), CountComponentControls(), CreateBackedUpWindowL(), CreateWindowL(), DeactivateGc(), DrawDeferred(), DrawNow(), DrawableWindow(), EnableDragEvents(), GetColor(), GetHelpContext(), GrabbingComponent(), HandleComponentControlsResourceChange(), HandlePointerBufferReadyL(), HandleRedrawEvent(), IgnoreEventsUntilNextPointerUp(), Index(), IsActivated(), IsBackedUp(), IsBeingDestroyed(), IsBlank(), IsDimmed(), IsFocused(), IsNonFocusing(), IsReadyToDraw(), IsVisible(), MakeVisible(), Observer(), OverrideColorL(), OwnsWindow(), Position(), PositionChanged(), PositionRelativeToScreen(), PrepareForFocusGainL(), PrepareForFocusLossL(), Rect(), RecursivelyMergedInputCapabilities(), ReportEventL(), ResetGc(), SetAllowStrayPointers(), SetBlank(), SetCanDrawOutsideRect(), SetComponentsToInheritVisibility(), SetContainerWindow(), SetControlContext(), SetCornerAndSize(), SetCornerAndSizeL(), 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 CEikBorderedControl:
Border(), HasBorder(), SetAdjacent(), SetBorder(), iBorder

Inherited from MEikScrollBarObserver:
EEikScrollBottom, EEikScrollDown, EEikScrollEnd, EEikScrollHome, EEikScrollLeft, EEikScrollPageDown, EEikScrollPageLeft, EEikScrollPageRight, EEikScrollPageUp, EEikScrollRight, EEikScrollThumbDragHoriz, EEikScrollThumbDragVert, EEikScrollThumbReleaseHoriz, EEikScrollThumbReleaseVert, EEikScrollTop, EEikScrollUp, TEikScrollEvent


Construction and destruction


CEikEdwin()

CEikEdwin();

Description

Default constructor. Creates a new Edwin, FEP support for the new editor will not be present if there is insufficient memory.


CEikEdwin()

CEikEdwin(const TGulBorder& aBorder);

Description

Creates a new Edwin, specifying the border to use. As with the default constructor, FEP support for the new editor will not be present if there is insufficient memory.

Parameters

const TGulBorder& aBorder

The Edwin border.


ConstructL()

void ConstructL(TInt aEdwinFlags=0,TInt aWidthInChars=0,TInt aTextLimit=0,TInt aNumberOfLines=0);

Description

Completes construction of a new Edwin, initialising its heap-stored members from the supplied arguments. This function will leave if any of the pointer members being constructed leave.

Parameters

TInt aEdwinFlags=0

Bitwise ORed combination of flags from TFlags.

TInt aWidthInChars=0

Specifies the width for the Edwin, in characters or pixels: see the EWidthInPixels flag.

TInt aTextLimit=0

Maximum length for the text to present as editable.

TInt aNumberOfLines=0

Height for the Edwin, in lines.


ConstructFromResourceL()

void ConstructFromResourceL(TResourceReader& aReader);

Description

Completes the construction of a new Edwin. This function initialises the heap-stored members from an EDWIN resource and will leave if any of the pointer members being constructed leave.

Parameters

TResourceReader& aReader

A reader positioned for reading from an EDWIN resource.


BaseConstructL()

protected: void BaseConstructL();

Description

Completes the second-phase construction of a CEikEdwin object. This protected function is called by ConstructL() and ConstructFromResourceL() after the Edwin’s size, flags and text limit have been set. Derived classes should call either this function or CEikEdwin’s ConstructL() or ConstructFromResourceL() functions during their construction before initialising their own members.


SetEdwinObserver()

void SetEdwinObserver(MEikEdwinObserver* aObserver);

Description

Sets the Edwin observer. The Edwin’s observer will be called back with control events associated with the Edwin.

Parameters

MEikEdwinObserver* aObserver

New observer.


AddEdwinObserverL()

void AddEdwinObserverL(MEikEdwinObserver* aEdwinObserver);

Description

Adds an observer of standard Edwin events to the list of observers, creating the list if necessary. May be called any number of times and is independent of calls to SetEdwinObserver.

Parameters

MEikEdwinObserver* aEdwinObserver

The observer to add to the list of observers.


RemoveEdwinObserver()

void RemoveEdwinObserver(MEikEdwinObserver* aEdwinObserver);

Description

Removes the specified observer from the list of observers. Does nothing if aEdwinObserver is not an observer.

Parameters

MEikEdwinObserver* aEdwinObserver

The observer to remove from the list of observers.


SetContainerWindowL()

void SetContainerWindowL();

Description

Sets the containing window for the Edwin.


SetContainerWindowL()

void SetContainerWindowL(const CCoeControl& aParent);

Description

Sets the containing window for the Edwin by copying it from the specified parent. Also copies a control context from aParent if one has not been previously set.

Parameters

const CCoeControl& aParent

The control to set as this Edwin’s parent.


SetDocumentContentL()

void SetDocumentContentL(CGlobalText& aText,TSetContent aContent);

Description

Sets the Edwin’s editable content. Before calling this function you must get the iText pointer as iText is replaced by aText. You must also free the memory by deleting the previous iText contents.

Parameters

CGlobalText& aText

New value for the content.

TSetContent aContent

Specifies whether to use aText itself, or to copy its content.


~CEikEdwin()

~CEikEdwin();

Description

Deletes objects and frees resources owned by this object. The Edwin’s editable text is freed if the EKeepDocument flag is not set.

[Top]


Construction support

Description

The following functions are used during construction.


CalculateWidth()

void CalculateWidth(TInt aWidthInChars);

Description

Recalculates the screen width of an Edwin from the specified number of character widths. This is called during construction. If the Edwin only allows editing of numbers, the width of the zero character (0) is used; otherwise CFont::MaxNormalCharWidthInPixels() is used.

If the EWidthInPixels flag has been set, the aWidthInChars argument is measured in pixels, not characters.

Parameters

TInt aWidthInChars

Width in either pixels or chars.


CreateTextViewL()

void CreateTextViewL();

Description

Allocates memory for the Edwin text view.

[Top]


Settings

Description

Miscellaneous flag and behaviour setting for Edwins.


SetDocumentOwnership()

void SetDocumentOwnership(TOwnershipType aOwner);

Description

Sets whether the Edwin owns a document. Edwins can either be used as a standalone text editor control, or as an editor for text owned by another object. The document ownership setting determines whether the Edwin or another object owns the document.

Parameters

TOwnershipType aOwner

Whether Edwin or another object owns the document. See TOwnershipType.


SetWordWrapL()

void SetWordWrapL(TBool aWrapIsOn);

Description

Sets word wrapping on or off.

Parameters

TBool aWrapIsOn

ETrue enables word wrapping, EFalse disables word wrapping.


SetAllowPictures()

void SetAllowPictures(TBool aAllow);

Description

Sets whether the document accepts pictures.

Parameters

TBool aAllow

ETrue sets the document to accept pictures, EFalse sets the document to not accept pictures.


SetRightWrapGutter()

void SetRightWrapGutter(TInt aGap);

Description

Sets the minimum gap between text and the right hand edge of the Edwin when text is wrapped. This value is used to calculate the layout area for text.

Parameters

TInt aGap

Size of the gutter in pixels.


SetWordDelimiters()

void SetWordDelimiters(TBool aPicture,TBool aPunctuation);

Description

Sets whether picture characters and/or punctuation should be treated as word delimiters in addition to whitespace.

Parameters

TBool aPicture

ETrue if picture characters should be treated as delimiters for words.

TBool aPunctuation

ETrue if punctuation should be treated as delimiters for words.


MaximumHeight()

TInt MaximumHeight() const;

Description

Gets the maximum Edwin height.

Return value

TInt

The maximum Edwin height.


SetMaximumHeight()

void SetMaximumHeight(TInt aHeight);

Description

Sets the maximum Edwin height. This function also decreases the minimum Edwin height if its value is greater than aHeight.

Parameters

TInt aHeight

The maximum Edwin height.


MinimumHeight()

TInt MinimumHeight() const;

Description

Gets the minimum Edwin height.

Return value

TInt

The minimum Edwin height.


SetMinimumHeight()

void SetMinimumHeight(TInt aHeight);

Description

Sets the minimum Edwin height. This function also increases the maximum Edwin height if its value is less than aHeight.

Parameters

TInt aHeight

The minimum Edwin height.


SetEdwinSizeObserver()

void SetEdwinSizeObserver(MEikEdwinSizeObserver* aEdwinSizeObserver);

Description

Sets the Edwin size observer. Does not imply transfer of ownership.

Parameters

MEikEdwinSizeObserver* aEdwinSizeObserver

The Edwin size observer.

[Top]


Read-only flag


SetReadOnly()

void SetReadOnly(TBool aReadOnly);

Description

Sets the Edwin’s read-only flag so that documents displayed by Edwin cannot be edited by users.

Parameters

TBool aReadOnly

ETrue to set Edwin to display documents as read-only. EFalse otherwise.

See also:


IsReadOnly()

TBool IsReadOnly() const;

Description

Determines whether the document being edited with Edwin is read-only.

Return value

TBool

ETrue if the document being edited is read-only. EFalse otherwise.


CheckNotReadOnlyL()

void CheckNotReadOnlyL();

Description

Determines whether the document being edited is read only. Displays a message with CEikonEnv::InfoMsg() if the document is set as read-only.

[Top]


Editable text access

Description

The editable text in a CEikEdwin is stored in an object of class CPlainText (or one of its subclasses). The following methods provide a standard interface to this protected field.


TextLength()

TInt TextLength() const;

Description

Gets the number of characters in the document.

Return value

TInt

The number of characters in the document.

See also:


GetTextInHBufL()

HBufC* GetTextInHBufL() const;

Description

Gets a new buffer containing a copy of the whole text document.

Return value

HBufC*

A new copy of the document text.


GetText()

void GetText(TDes& aDes) const;

Description

Copies the entire document’s content into a descriptor. It is the caller's responsibility to provide a large enough buffer.

Parameters

TDes& aDes

An initialised descriptor which on return contains a copy of the content of this Edwin.


SetTextL()

void SetTextL(const TDesC* aDes);

Description

Sets the document text of this Edwin from the contents of a descriptor. This function removes any pictures, any invalid characters and cancels any previous selection.

Parameters

const TDesC* aDes

Descriptor from which to copy.


CountWords()

TInt CountWords();

Description

Counts and returns the number of words in the document.

Return value

TInt

The number of words in the document.


Text()

CPlainText* Text() const;

Description

Gets a pointer to the Edwin’s document contents.

Return value

CPlainText*

A CPlainText pointer which contains the document.

[Top]


Current selection


SelectionLength()

TInt SelectionLength() const;

Description

Gets the number of characters including non-printing characters within the selection.

Return value

TInt

The number of characters within the selection


Selection()

TCursorSelection Selection() const;

Description

Gets the cursor selection. If no text view is associated to the Edwin this returns TCursorSelection(0,0).

Return value

TCursorSelection

The current selection.


ClearSelectionL()

void ClearSelectionL();

Description

Removes the selection and any composition text. The cursor position is unaffected. If there is no selected region, this function has no effect.


SetSelectionL()

void SetSelectionL(TInt aCursorPos, TInt aAnchorPos);

Description

Sets the text selection. Highlights the selected area and makes the new cursor position visible. Any previous selection is cancelled. This function also updates the scroll bar thumbs if present.

Parameters

TInt aCursorPos

The cursor’s position.

TInt aAnchorPos

The anchor’s position.


SelectAllL()

void SelectAllL();

Description

Selects the entire document.

[Top]


Cursor position


CursorPos()

TInt CursorPos() const;

Description

Gets the cursor’s position within the document.

Return value

TInt

The cursor’s position within the document.


SetCursorPosL()

void SetCursorPosL(TInt aCursorPos, TBool aSelect);

Description

Sets the cursor’s position within the document. If the new position is not visible the text is scrolled so that the line containing the cursor is visible. This function also updates the scroll bar thumbs if present.

Parameters

TInt aCursorPos

New cursor position.

TBool aSelect

ETrue to extend the cursor’s selection to the new position. EFalse otherwise.

See also:

[Top]


Infrared


SendDataOverIrL()

void SendDataOverIrL();

Description

Sends the Edwin’s document using an infra red beamer.

Leave codes

 

This function leaves if there are not enough resources to allocate an infra red beamer object.


ReceiveDataOverIrL()

void ReceiveDataOverIrL();

Description

Receives an Edwin document using an infra red beamer.

Leave codes

 

This function will leave if the data received is not a suitable type to be pasted into the Edwin.

[Top]


Clipboard operations and inserting text


ClipboardL()

void ClipboardL(TClipboardFunc aClipboardFunc);

Description

Handles cut, copy and paste commands. This function also reports a change of state of the control to the observer when necessary.

Parameters

TClipboardFunc aClipboardFunc

Clipboard operation.


PlaceDataOnClipboardL()

void PlaceDataOnClipboardL();

Description

Copies the contents of the cursor selection onto the clipboard.

See also:


PasteFromStoreL()

void PasteFromStoreL(CStreamStore& aStore,CStreamDictionary& aDict);

Description

Copies the contents of a stream store to the current cursor position, replacing any selected text. This function is used to paste data from the clipboard.

Parameters

CStreamStore& aStore

Store from which to read.

CStreamDictionary& aDict

Stream dictionary.

Leave codes

 

This function will leave after displaying an information message if there is nothing to paste.

See also:


CopyToStoreL()

void CopyToStoreL(CStreamStore& aStore,CStreamDictionary& aDict);

Description

Copies the highlighted text into a stream store.

Parameters

CStreamStore& aStore

Store to write to.

CStreamDictionary& aDict

Stream dictionary.


InsertFromTextFileL()

void InsertFromTextFileL
    (const TFileName &aFileName,
     const CPlainText::TTextOrganisation aTextOrganisation
        = CPlainText::EOrganiseByLine);

Description

Inserts the contents of a text file into the text being edited at the current cursor position.

Parameters

const TFileName &aFileName

The file to open and read.

const CPlainText::TTextOrganisation aTextOrganisation= CPlainText::EOrganiseByLine

How to handle line breaks.


SetTextLimit()

void SetTextLimit(TInt aLimit);

Description

Sets the maximum number of characters that can be inserted.

Parameters

TInt aLimit

New maximum for the number of characters that can be inserted.


InsertDeleteCharsL()

void InsertDeleteCharsL(TInt aInsertPos,const TDesC& aText,const TCursorSelection& aDelete);

Description

Replaces the cursor selection with the identified text.

Parameters

TInt aInsertPos

The position at which text will be inserted.

const TDesC& aText

The text to insert.

const TCursorSelection& aDelete

The cursor-selected text that will be replaced by aText.

[Top]


Text fields


InsertFieldL()

void InsertFieldL(CTextField* aField,TUid aFieldType);

Description

Inserts a field at the current cursor position. If a selection was made the field replaces that selection.

Parameters

CTextField* aField

Text field to insert.

TUid aFieldType

Type of the field.

See also:


UpdateAllFieldsL()

void UpdateAllFieldsL();

Description

Updates all the fields in the document.


UpdateCurrentFieldL()

void UpdateCurrentFieldL();

Description

Updates any text field at the current cursor position. Updating involves calculating the new value for the field, and replacing the field’s existing text content with the new text.

This function does nothing if the cursor is not within a text field.

[Top]


FEP support


CancelFepTransaction()

void CancelFepTransaction();

Description

Cancels any current transaction with the Edwin’s front-end processor. Any front-end input windows are removed, and any highlighted text being edited in the Edwin is removed. The Edwin is rolled back to the state it was in before the FEP transaction started. This function is called by CEikEdwin itself when the document content, the cursor position or the current selection is changed.

Cancelling outstanding FEP transactions before performing operations on the text programmatically is particularly important when the front-end processor is inline-editing an Edwin.

See also:

[Top]


Sizes and colours

Description

The following functions provide information for the on-screen display of the Edwin.


LineCursorWidth()

virtual TInt LineCursorWidth() const;

Description

Gets the width of a line cursor in pixels.

Return value

TInt

The width of the line cursor in pixels.


LayoutWidth()

TInt LayoutWidth() const;

Description

Gets the width used for laying out the text inside the Edwin in pixels. This may be larger or smaller than the width of the Edwin itself. See SetWysiwygModeOn() for example.

Return value

TInt

Width of the text layout area in pixels.


Margins()

TMargins8 Margins() const;

Description

Gets the text view margins.

Return value

TMargins8

The text view margins.

See also:


SetBorderViewMargins()

void SetBorderViewMargins(TMargins8 aMargins);

Description

Sets the text view margins.

Parameters

TMargins8 aMargins

New value for the view’s margins.

See also:


SetBackgroundColorL()

void SetBackgroundColorL(TRgb aBackground);

Description

Sets the Edwin’s background colour.

Parameters

TRgb aBackground

New value for the background colour.

[Top]


Zooming


SetZoomFactorL()

void SetZoomFactorL(TZoomFactor* aZoomFactor);

Description

Sets the zoom factor of the document and reformats the document.

Parameters

TZoomFactor* aZoomFactor

New value for the zooming factor.

[Top]


Search and replace


FindL()

TBool FindL(const TDesC* aFindText,TInt aFindFlags=0);

Description

Gets true if a substring is present in the text being edited before or after the cursor position. If aFindText is NULL, then the current word or selection will be searched for again.

Parameters

const TDesC* aFindText

The substring to search for.

TInt aFindFlags = 0

See TFindFlags.

Return value

TBool

Whether aFindText could be found.

See also:


FindTextL()

TInt FindTextL(const TDesC* aFindText,TInt aPos,TInt aFindFlags);

Description

Gets the cursor position of the matching text in the document. The search starts from aPos. If aFindText is NULL, then the current word or selection will be searched for. If the substring cannot be found, this function returns KErrNotFound.

Parameters

const TDesC* aFindText

The substring to search for.

TInt aPos

Starting position for the find.

TInt aFindFlags

See TFindFlags.

Return value

TInt

KErrNotFound if the text was not found, otherwise the position of the matched substring.

See also:


ReplaceL()

void ReplaceL(SEdwinFindModel* aFindModel);

Description

Replaces the highlighted text. See SEdwinFindModel struct.

Parameters

SEdwinFindModel* aFindModel

Pointer to the replacement text.


ReplaceAllL()

void ReplaceAllL(SEdwinFindModel* aFindModel);

Description

Replaces all occurrences of a string with new text. Both old and new text are held in aFindModel.

Parameters

SEdwinFindModel* aFindModel

Describes the operation.

Leave codes

 

This function will leave if the replace operation fails unexpectedly.


GetFindText()

void GetFindText(TDes* aFindText);

Description

Gets the current word or selection and searches for it. This function is called by FindL() and FindTextL() when no text to search for is given.

Parameters

TDes* aFindText

An empty descriptor.

[Top]


Scroll bars

Description

Scroll bars are updated asynchronously using the private function CIdle. Scroll bar calculations are time consuming, so the task of updating them is performed in the background at a lower priority.


UpdateScrollBarsL()

void UpdateScrollBarsL();

Description

Updates the scroll bars asynchronously. This function returns immediately after generating a call back to update the scroll bars if there is not one waiting to be serviced already.


ForceScrollBarUpdateL()

void ForceScrollBarUpdateL();

Description

Forces the scrollbars to update now; this is a synchronous function.


CreateScrollBarFrameL()

CEikScrollBarFrame* CreateScrollBarFrameL();

Description

Creates the Edwin scroll bar frame with no pre-allocation of memory for scroll bars.

Return value

CEikScrollBarFrame*

The scroll bar frame.


CreateScrollBarFrameL()

CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc);

Description

Creates the Edwin scroll bar frame with an option to pre-allocate memory for the scroll bars.

Parameters

TBool aPreAlloc

ETrue to pre-allocate memory for the scroll bars.

Return value

CEikScrollBarFrame*

The scroll bar frame.


CreatePreAllocatedScrollBarFrameL()

CEikScrollBarFrame* CreatePreAllocatedScrollBarFrameL();

Description

Creates a pre-allocated scroll bar frame.

Return value

CEikScrollBarFrame*

Pre-allocated scroll bar frame.


ScrollBarFrame()

CEikScrollBarFrame* ScrollBarFrame();

Description

Gets the scroll bar frame surrounding this Edwin.

Return value

CEikScrollBarFrame*

Pointer to this Edwin’s scroll bar frame.

[Top]


WYSIWYG mode

Description

WYSIWYG mode depends on a text layout being set. These methods will panic in debug builds with a code of EEikPanicEdwinNoLayout if the Edwin’s text layout has not been set.


SetWysiwygModeOn()

void SetWysiwygModeOn(TInt aLayoutWidth, MGraphicsDeviceMap* aDevice);

Description

Sets the format mode to be WYSIWYG.

Parameters

TInt aLayoutWidth

Formatting width in twips.

MGraphicsDeviceMap* aDevice

Mapping between twips and pixels on the target device.


SetWysiwygModeOff()

void SetWysiwygModeOff();

Description

Switches off the WYSIWYG mode. This function sets the new format mode to be EFScreenMode.


UpdateLayoutWidth()

void UpdateLayoutWidth(TInt aLayoutWidth);

Description

Updates the text wrap width. This function is for use in WYSIWYG mode only.

Parameters

TInt aLayoutWidth

New width to wrap text at in WYSIWYG mode in twips.

[Top]


Formatting


OnReformatL()

void OnReformatL(const CTextView* aTextView);

Description

Responds to text height change. Reports the event EEventSizeChanging to the Edwin observer when the text view height changes. This function checks the new height is within the minimum and maximum Edwin height limits and redraws the Edwin within those limits.

Parameters

const CTextView* aTextView

The text view for which height has changed.


SetAmountToFormatL()

void SetAmountToFormatL(TBool aIsNewDoc = EFalse);

Description

Sets the amount to format. This function is called by NotifyNewDocumentL(), OfferKeyEventL() and other functions, and sets an appropriate amount of the document for formatting. At least the portion of text currently displayed will be marked as formattable.

Parameters

TBool aIsNewDoc = EFalse

If ETrue, a new document has just been inserted and a full reformat should be done. Normally this will be called with the default argument.


NotifyNewDocumentL()

void NotifyNewDocumentL();

Description

Formats and draws a new document, updates scrollbars if necessary.


NotifyNewFormatL()

void NotifyNewFormatL();

Description

Reformats and redraws the document, updates scrollbars if necessary.


FormatTextL()

protected: void FormatTextL();

Description

Formats all the text in the text view. Called by several functions, for example by CEikEdwin::HandleTextChangedL() and CEikEdwin::SetTextL().


HandleTextChangedL()

void HandleTextChangedL();

Description

Handles all modifications made by reformatting the entire document. Calls CEikEdwin::FormatText() and redraws Edwin contents and scroll bars if they are ready to be redrawn.

[Top]


Utility functions


SetNonPrintingCharsVisibility()

void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility aVisibility);

Description

Sets non-printing characters’ visibility.

Parameters

TNonPrintingCharVisibility aVisibility

Non-printing characters’ visibility.


NonPrintingCharsVisibility()

TNonPrintingCharVisibility NonPrintingCharsVisibility();

Description

Gets non-printing characters’ visibility.

Parameters

TNonPrintingCharVisibility

Non-printing characters’ visibility.


RunCharMapDialogL()

void RunCharMapDialogL();

Description

Displays a dialog allowing the user to choose a character from the character map. The selected character is inserted into the Edwin at the current cursor position.


CheckRemovePictures()

void CheckRemovePictures(TInt aStartPos, TInt aLength);

Description

Removes unwanted pictures. If EAllowPictures has been set, returns immediately. Otherwise, this function checks the document text between two bounds and removes all pictures in that range.

Parameters

TInt aStartPos

Where to start looking for unwanted pictures.

TInt aLength

Where to stop.


GetWordInfo()

void GetWordInfo(TInt aCurrentPos,TInt& aStartPos,TInt& aLength) const;

Description

Gets the start position and the length of the word in which the specified document position is located.

Parameters

TInt aCurrentPos

A position within a word in the text.

TInt& aStartPos

Returns the start position of the word.

TInt& aLength

Returns the word’s length.

[Top]


Undoing


UndoL()

void UndoL();

Description

Undoes the most recent text operation when the Edwin supports this feature and when the undo store is not empty.


ClearUndo()

void ClearUndo();

Description

Deletes the undo store.


SetAllowUndo()

void SetAllowUndo(TBool aAllow);

Description

Sets whether the undo operation is permitted.

Parameters

TBool aAllow

ETrue to permit undo operations. EFalse to not permit undo operations.


SupportsUndo()

TBool SupportsUndo() const;

Description

Gets whether Edwin is set to support the undo command.

Return value

TBool

ETrue if edits can be undone. EFalse if edits cannot be undone.


CanUndo()

TBool CanUndo() const;

Description

Tests whether an undo is possible. Returns ETrue only if the undo store is available to Edwin.

Return value

TBool

ETrue if the undo store is available. EFalse if the undo store is not available.

[Top]


User command handling

Description

The following functions are used by OfferKeyEventL() and HandlePointerEventL() to perform a user’s commands.


MoveCursorL()

void MoveCursorL(TCursorPosition::TMovementType aMovement,TBool aSelect);

Description

Sets the new cursor position. If the cursor is no longer visible the document is scrolled to display the line containing the new cursor position. Scrollbars are also updated if present.

Parameters

TCursorPosition::TMovementType aMovement

The cursor movement.

TBool aSelect

If ETrue, the selection is extended. This corresponds to holding down the Shift key on a machine keyboard.


MoveDisplayL()

void MoveDisplayL(TCursorPosition::TMovementType aMovement);

Description

Scrolls the text either horizontally or vertically without affecting the cursor’s position.

Parameters

TCursorPosition::TMovementType aMovement

The cursor’s movement.

[Top]


MEikScrollBarObserver implementation


HandleScrollEventL()

void HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType);

Description

Handles scroll bar events passed by this Edwin’s scroll bars.

Parameters

CEikScrollBar* aScrollBar

The scroll bar on which the event occurred.

TEikScrollEvent aEventType

The type of event to which a response is required.

[Top]


CCoeControl implementation

Description

The following functions provide appropriate implementations of functions declared virtual in CCoeControl. Full descriptions of their behaviour are given in the documentation for that class.


ActivateL()

void ActivateL();

Description

Sets the Edwin as ready for drawing.


OfferKeyEventL()

TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);

Description

Handles key events.

Parameters

const TKeyEvent& aKeyEvent

The key event.

TEventCode aType

The type of the event: EEventKeyDown, EEventKeyUp or EEventKey.

Return value

TKeyResponse

A suitable response code.

See also:


HandlePointerEventL()

void HandlePointerEventL(const TPointerEvent& aPointerEvent);

Description

Handles pointer events.

Parameters

const TPointerEvent& aPointerEvent

Pointer event to respond to.

See also:


FocusChanged()

void FocusChanged(TDrawNow aDrawNow);

Description

Responds to focus-changed events.

Parameters

TDrawNow aDrawNow

Whether to redraw the Edwin.

See also:


MinimumSize()

TSize MinimumSize();

Description

Gets the minimum size of this Edwin for automatic-layout control contexts such as dialogs.

Return value

TSize

Minimum size for the control.


Draw()

void Draw(const TRect& aRect) const;

Description

Draws the control on request.

Parameters

const TRect& aRect

Optional. If supplied, the rectangle in which to draw the Edwin.

See also:


SetDimmed()

void SetDimmed(TBool aDimmed);

Description

Dims or undims the Edwin.

Parameters

TBool aDimmed

ETrue to dim the Edwin. EFalse to undim the Edwin.

See also:


SetInputCapabilitiesL()

void SetInputCapabilitiesL(const TCoeInputCapabilities& aInputCapabilities);

Description

Sets the Edwin’s input capabilities.

Parameters

const TCoeInputCapabilities& aInputCapabilities

The Edwin’s input capabilities.

[Top]


Protected draw routines


TrappedDraw()

protected: void TrappedDraw(const TRect& aRect) const;

Description

Draws the visible text and the cursor for DrawL(), but does not draw the border. The DrawL() function is trapped to handle problems due to insufficient resources being available.

Parameters

const TRect& aRect

Rectangle in which to draw.


DrawContents()

protected: void DrawContents();

Description

Draws the visible text and the cursor.

[Top]


Other member functions


AvgCharsPerLine()

TInt AvgCharsPerLine() const;

Description

Gets the average number of characters on a line.

Return value

TInt

The average number of characters on a line.


AvgLinesInViewRect()

TInt AvgLinesInViewRect() const;

Description

Gets the average number of lines shown in Edwin’s view.

Return value

TInt

The average number of lines.


CheckValidityOfChars()

void CheckValidityOfChars(TInt aStartPos,TInt aLength);

Description

Removes all non-ASCII characters from the specified text. This can be used to remove Unicode characters where they are not valid characters for example.

Parameters

TInt aStartPos

The start position in the text.

TInt aLength

The number of characters, beginning with aStartPos to check.


GetColorUseListL()

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

Description

Gets the list of logical colours employed in the drawing of the control, paired with an explanation of how they are used. Appends the list to aColorUseList.

Parameters

CArrayFix<TCoeColorUse>& aColorUseList

The list of logical colours.


HandleResourceChange()

void HandleResourceChange(TInt aType);

Description

Handles a change to Edwin’s resources which are shared across the environment. Colours or fonts for example.

Parameters

TInt aType

The type of resource that has changed.


InputCapabilities()

TCoeInputCapabilities InputCapabilities() const;

Description

Gets Edwin’s input capabilities.

Return value

TCoeInputCapabilities

The Edwin input capabilities.


IsValidChar()

TBool IsValidChar(TInt aChar) const;

Description

Checks whether the specified character is an ASCII character.

Parameters

TInt aChar

The character to check.

Return value

TBool

ETrue if the specified character is an ASCII character. EFalse if the specified character is not an ASCII character.


UpperFullFormattingLength()

TInt UpperFullFormattingLength() const;

Description

Gets the upper limit for formatting. This returns the value of KFullFormattingUpperThreshold which determines the maximum number of characters that can be formatted, if it is exceeded then only visible text is formatted. This is used with KPartialFormattingLowerThreshold to control the extent of text formatting.

Return value

TInt

The value of KFullFormattingUpperThreshold.


LowerPartialFormattingLength()

TInt LowerPartialFormattingLength() const;

Description

Gets the lower limit for formatting. This returns the value of KPartialFormattingLowerThreshold which determines when a switch is made from formatting only visible text to formatting all text. When the text length exceeds the KFullFormattingUpperThreshold only visible text is formatted. If some characters are deleted so that the text length is less than KFullFormattingUpperThreshold the entire text is still not formatted. Instead, reformatting occurs only when the number of characters is less than the value of KPartialFormattingLowerThreshold.

Return value

TInt

The value of KPartialFormattingLowerThreshold.


OnlyASCIIChars()

TBool OnlyASCIIChars() const;

Description

Tests whether the EOnlyASCIIChars flag is set.

Return value

TBool

ETrue if the EOnlyASCIIChars flag is set.

See also:


SetOnlyASCIIChars()

void SetOnlyASCIIChars(TBool aASCIIOnly);

Description

Sets the EOnlyASCIIChars flag.

Parameters

TBool aASCIIOnly

If ETrue the EOnlyASCIIChars flag will be set. If EFalse the EOnlyASCIIChars flag will be removed.

See also:


SetAvgCharsPerLine()

void SetAvgCharsPerLine(TInt aAvgChars);

Description

Sets the average number of characters per line.

Parameters

TInt aAvgChars

The average number of characters per line.


SetAvgLinesInViewRect()

void SetAvgLinesInViewRect(TInt aAvgLines);

Description

Sets the average number of lines displayed in Edwin’s view.

Parameters

TInt aAvgLines

The average number of lines to display.


SetPasteFromIrStore()

void SetPasteFromIrStore(TBool aPasteFromIrStore);

Description

Sets the EPasteFromIrStore flag.

Parameters

TBool aPasteFromIrStore

ETrue to set the EPasteFromIrStore flag. EFalse to remove the EPasteFromIrStore flag.

[Top]


Protected member functions


CancelInsertCharFormat()

protected: void CancelInsertCharFormat();

Description

Cancels the insertion of a character format. This can be used for rich text only.


CancelSelectionL()

protected: void CancelSelectionL(TEnd aEndOfSelectionToLeaveCursor);

Description

Cancels the selection and any FEP composition text. This function then repositions the cursor at the specified end of the currently selected text.

Parameters

TEnd aEndOfSelectionToLeaveCursor

The end of the current selection at which the cursor is repositioned.


CopyDocumentContentL()

void CopyDocumentContentL(CGlobalText& aInText,CGlobalText& aOutText);

Description

Replaces the current Edwin text.

Parameters

CGlobalText& aInText

Text with which the current text is replaced.

CGlobalText& aOutText

On return, the replaced text.


DeleteHighlightL()

protected:
    TInt DeleteHighlightL
        (TBool& aChanged,
         TBool aIsBackSpace,
         TBool aPromptConfirmation);

Description

Deletes the text under the cursor selection, also cancelling the selection. This function asks the user to confirm this action if aPromptConfirmation is ETrue.

Parameters

TBool& aChanged

On return, ETrue if the text was changed.

TBool aIsBackSpace

ETrue if this is in response to backspace being pressed. Determines whether character formatting is preserved or not.

TBool aPromptConfirmation

Optional. ETrue to ask the user to confirm this action.

Return value

TInt

The cursor position in the text after deletion.


DeleteL()

void DeleteL (TBool& aChanged,const TCursorSelection& aSelection,TBool aIsBackSpace,TBool aAllowUndo);

Description

Deletes the cursor’s selection. If no selection is made, this function deletes only one character. The argument aIsBackSpace determines whether to preserve the character formatting or not.

Parameters

TBool& aChanged

On return, whether the text was changed.

const TCursorSelection& aSelection

The cursor selection describing the position to be deleted.

TBool aIsBackSpace

ETrue if this in response to backspace being pressed. Determines whether character formatting is preserved or not.

TBool aAllowUndo

ETrue if the user is permitted to undo this change.


DisplayFindTextNotFound()

void DisplayFindTextNotFound(TDes& aFindText);

Description

Displays an information message to indicate that the specified text could not be found. The information message is constructed from R_EIK_TBUF_CANNOT_FIND_TEXT.

Parameters

TDes& aFindText

The text that could not be found.


HandleSizeChangedL()

void HandleSizeChangedL();

Description

Handles a change in Edwin’s size. This function accounts for text wrap settings and whether the Edwin is ready to be redrawn and also calls functions to reformat text and to update the Edwin’s scroll bars.


HandleTextPastedL()

void HandleTextPastedL(TInt,TInt&)

Description

Handles pasting of text. The default implementation of this function is empty.

Parameters

TInt

The start position of the pasted text.

TInt&

The length of the pasted text.


MoveCursorToChunkStartL()

void MoveCursorToChunkStartL(TBool aSelect,TChunkSize aChunkSize,TEnd aEndScanningTowards);

Description

Moves the cursor to the beginning of the next word or paragraph. This function cancels any front end processing transaction currently in progress for the Edwin.

Parameters

TBool aSelect

If ETrue the chunk is selected, otherwise EFalse.

TChunkSize aChunkSize

The chunk size, this can be either a word or a paragraph. See TChunkSize enum.

TEnd aEndScanningTowards

Which direction to scan towards, the start or the end of the document.


OkToDeleteSelectionL()

protected: TBool OkToDeleteSelectionL();

Description

Confirms whether deletion of the user’s selection is required.

If the user’s selection is less than KBlockDeleteWarningSize and does not contain a picture, this function returns ETrue.

If the user’s selection is greater than KBlockDeleteWarningSize or contains a picture, this function asks the user to confirm deletion of their selection and then returns the user’s response.

Return value

TBool

ETrue if deletion is required. EFalse if deletion is not required.


ReportEdwinEventL()

void ReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType);

Description

Reports an Edwin event of the specified type. The Edwin event is passed first to the Edwin observer and then to the list of observers, even if the first Edwin observer is not set. If the Edwin has a custom drawer, and the event is of type EEventFormatChanged, the event is passed to the custom drawer. If the Edwin has an observer the event is passed to that observer. If no observer is set for the Edwin, this function passes the event to each observer in the observer list.

Parameters

MEikEdwinObserver::TEdwinEvent aEventType

The type of event to report.


SetLineCursorDetailsL()

void SetLineCursorDetailsL();

Description

Sets margin widths and line cursor width.


TrappedSizeChanged()

void TrappedSizeChanged();

Description

Handles errors that occur when handling a change in Edwin’s size. Calls CEikonEnv::NotifyIdleErrorWhileRedrawing().

[Top]


Public enums


Enum TOwnershipType

TOwnershipType

Description

Specifies whether the Edwin owns the document it is being used to edit. If the Edwin owns the document, the document object is destroyed on destruction.

EOwnsText

Document is owned by the Edwin.

EDoesNotOwnText

Document is owned by some other object.


Enum TFlags

TFlags

Description

The following flags may be combined with a bitwise OR to form the aEdwinFlags argument to ConstructL(TInt, ...) or the flags field of an EDWIN resource structure run through ConstructFromResourceL().

These flags are duplicated in uikon.hrh (see EEikEdwinKeepDocument etc.)

EKeepDocument

If set, CEikEdwin does not destroy its content on destruction.

ESegmentedStorage

If set, the content buffer uses segmented storage (see CEditableText::ESegmentedStorage).

EWidthInPixels

The size specified in the resource used to construct the object is given in pixels, not character widths.

ENoAutoSelection

No automatic selection takes place. Normally the entire text is selected whenever the Edwin is created, resized or has its text set as one operation.

EJustAutoCurEnd

If set, then whenever the control is activated the cursor is moved to the end of the text.

ENoWrap

Do not wrap the text being edited.

ELineCursor

Use a line cursor instead of a block cursor.

ENoHorizScrolling

Do not perform horizontal scrolling.

EInclusiveSizeFixed

If set, scroll bars required to edit long documents appear inside the Edwin. This reduces the area used to display the Edwin. If not set, scroll bars appear outside the Edwin.

EUserSuppliedText

Set the Edwin’s height according to the number of lines of text supplied by the user.

EOwnsWindow

The Edwin is a window-owning control.

EDisplayOnly

The Edwin does not respond to input at all.

EAlwaysShowSelection

Do not hide the selection if the Edwin loses focus.

EReadOnly

The Edwin is read-only so users cannot add text to any document it displays. A user attempt to add text results in a message to notify them that the Edwin is read-only.

EAllowPictures

If set, no special attempt to delete embedded pictures cleanly will be made. This flag does not apply to Edwins which do not edit rich text.

EAllowUndo

The Edwin supports undo operations.

ENoLineOrParaBreaks

Do not allow line or paragraph breaks in the text being edited.

EOnlyASCIIChars

Allow only ASCII characters.

EResizable

The Edwin is resizable.

EIgnoreVirtualCursor

The Edwin ignores the virtual cursor.


Enum TFindFlags

TFindFlags

Description

The following flags may be ORed together for text searches (see FindL() for example).

EFindDirectionUp

Search progresses up the screen.

EFindWholeWord

Only whole-word matches count.

EFindCaseSensitive

Search is case-sensitive.

EFindAgain

Find again.

ENoBusyMessage

Don’t display a busy message.

[Top]


Protected enums


Enum TChunkSize

TChunkSize

Description

Specifies the chunk size as either a word, or a paragraph.

EChunkWord

A word.

EChunkPara

A paragraph.


Enum TEnd

TEnd

Description

Specifies the end points of the editable area.

EStart

The start of the editable area.

EEnd

The end of the editable area.


Enum TEdwinHotKeys

TEdwinHotKeys

Description

Order of hotkeys defined an Edwin resource structure. Not all are applicable to plain text editors.

EHotKeyCut

Cut.

EHotKeyCopy

Copy.

EHotKeyPaste

Paste.

EHotKeyUndo

Undo.

EHotKeyFind

Find.

EHotKeyInsertChar

Insert a character.

EHotKeyBold

Bold.

EHotKeyItalic

Italic.

EHotKeyUnderline

Underline.

EHotKeyFont

Font.

EHotKeyInsertObject

Insert an object.

EHotKeyEditObject

Edit an object.

EHotKeyFormatObject

Format an object.


Enum TClipboardFunc

TClipboardFunc

Description

The following symbols specify actions for ClipboardL().

ENoClipboard

Do nothing.

ECut

Cut.

ECopy

Copy.

EPaste

Paste.


Enum TSetContent

TSetContent

Description

When content is supplied to an Edwin using SetDocumentContentL(), the Edwin can either copy the supplied content into its existing content, or it can replace its existing content with the supplied content.

EUseText

Replace the Edwin’s existing content.

ECopyText

Copy the supplied content into the existing content.

[Top]


Protected data members

Description

These data members specify various Edwin attributes.


iEdwinInternalFlags

TUint32 iEdwinInternalFlags

Description

Internal flags for the Edwin.


iEdwinUserFlags

TUint32 iEdwinUserFlags

Description

See TFlags.


iLastPointerDocPos

TInt iLastPointerDocPos

Description

The last pointer event position. When a pointer event occurs in a different location, a navigation event is sent to the Edwin observer.


iLayout

CTextLayout* iLayout

Description

The text layout.


iMargins

TMargins8 iMargins

Description

The text margins.


iNumberOfLines

TInt iNumberOfLines

Description

The number of lines in a document.


iText

CPlainText* iText

Description

The text being edited.


iTextLimit

TInt iTextLimit

Description

The maximum number of characters that can be inserted into Edwin.


iTextView

CTextView* iTextView

Description

The text view.


iZoomFactor

MGraphicsDeviceMap* iZoomFactor

Description

Edwin’s zoom factor.

[Top]


Struct SEdwinFindModel

struct SEdwinFindModel;

Description

This struct describes the features of a search-and-replace operation on a CEikEdwin. See CEikEdwin::ReplaceL().

Defined in SEdwinFindModel:
iFlags, iReplaceOption, iReplaceText, iText

[Top]


Members


iFlags

TInt iFlags

Description

Flags for the search (see CEikEdwin::TFindFlags)


iText

TBuf<EEikEdwinFindStringMaxLen> iText

Description

Text to search for.


iReplaceText

TBuf<EEikEdwinFindStringMaxLen> iReplaceText

Description

Text to replace it with.


iReplaceOption

TReplaceOption iReplaceOption

Description

Replace options.