Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: fepbase.h
Link against: fepbase.lib

Class CCoeFep

CCoeFep

Support

Supported from 6.0

Description

Abstract base class for all FEPs.

FEP authors must derive a class from CCoeFep. The CCoeFep-derived class should implement all of its pure virtual functions including the ones which CCoeFep inherits from its base classes. For information on these functions, see the documentation of the base classes. The global NewFepL() function is used to create a fully initialised object of the derived class.

FEPs should own a CCoeControl-derived object — this object is referred to as the FEP control. The FEP control can be placed on the control stack so that it receives key events from the window server. It should run at high priority, so that it receives first refusal of key events.

FEPs do not take focus — focus is retained by the underlying application. This has the advantage that the user can see where the output produced by the FEP will be inserted (e.g. the cursor will still be displayed). When focus is switched between controls, the FEP must be notified in case the input capability of the newly focussed control is different. For instance, the FEP needs to avoid the situation where the user composes a large amount of text only for it to be passed to a newly focussed control that cannot accept text input. CCoeFep derives from MCoeFocusObserver, which enables FEPs to receive notification when the focus for the underlying control changes. The implementation of MCoeFocusObserver's functions can call the enquiry functions of class TCoeInputCapabilities to find out what input capabilities are supported by the new target control (you need to get the TCoeInputCapabilities object from the application UI first: see CCoeAppUi::InputCapabilities()).

Note that there can be more than one underlying target control at a time. For instance in an application displaying a dialog, the dialog itself is a focussed control, as is the captioned control, the edit window and other intermediary controls. If a FEP enquires about the input capabilities of such an application (i.e. the merged input capabilities of all its focused controls), it would be returned a TCoeInputCapabilities object whose FepAwareTextEditor() and CaptionRetrieverForFep() member functions return non-NULL, even though these interfaces are implemented by 2 different focused controls.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CCoeFepAbstract base class for all FEPs
MCoeFocusObserverInterface providing notification if any control gains or loses focus or is destroyed
MCoeForegroundObserverInterface providing notification of foreground/background changes
MCoeMessageObserverInterface for handling incoming window server messages
MFepAttributeStorerProtocol for storing, restoring and synchronising FEP attributes

Defined in CCoeFep:
BaseConstructL(), CCoeFep(), CancelTransaction(), EEventWasConsumed, EEventWasNotConsumed, IsOn(), IsOnHasChangedState(), IsSimulatingKeyEvent(), IsTurnedOffByL(), IsTurnedOnByL(), MDeferredFunctionCall, MModifiedCharacter, MakeDeferredFunctionCall(), OfferKeyEventL(), OfferPointerBufferReadyEventL(), OfferPointerEventL(), ReadAllAttributesL(), SimulateKeyEventsL(), TEventResponse, WriteAttributeDataAndBroadcastL(), ~CCoeFep()

Inherited from CBase:
operator new()

Inherited from MCoeFocusObserver:
HandleChangeInFocus(), HandleDestructionOfFocusedItem()

Inherited from MCoeForegroundObserver:
HandleGainingForeground(), HandleLosingForeground()

Inherited from MCoeMessageObserver:
EMessageHandled, EMessageNotHandled, HandleMessageL(), TMessageResponse

Inherited from MFepAttributeStorer:
AttributeAtIndex(), NumberOfAttributes(), ReadAttributeDataFromStreamL(), WriteAttributeDataToStreamL()

See also:


Construction and destruction


CCoeFep()

protected: CCoeFep(CCoeEnv& aConeEnvironment);

Description

Protected C++ constructor. This function should be called from within the FEP's constructor.

Parameters

CCoeEnv& aConeEnvironment

Cone environment. Provides an interface to the window server, so that the FEP control can receive pointer and key events.


BaseConstructL()

protected: void BaseConstructL(const CCoeFepParameters& aFepParameters);

Description

Initialises the FEP's generic settings (whether the FEP is on or off and what key events should turn it on or off). During construction, all FEPs must call this member function. Also initialises the FEP as an observer so that it receives notification of changes from the cone environment. Examples of such changes are the target control gaining or losing focus or changes to the generic FEP settings made by another running instance of the same FEP.

Parameters

const CCoeFepParameters& aFepParameters

Contains the default values for the FEP's generic settings.


~CCoeFep()

virtual ~CCoeFep();

Description

Note:

The destructor removes the FEP from the cone environment's message observer list prior to its destruction.


CancelTransaction()

virtual void CancelTransaction()=0;

Description

Cancels the FEP transaction. Pure virtual function.

A FEP transaction begins when an event is first intercepted by the FEP and ends either when the processed text is committed to the application underneath, or if it is cancelled.

[Top]


Synchronise attributes


ReadAllAttributesL()

protected: void ReadAllAttributesL();

Description

Sets this FEP's attributes with values from the global settings.

Calls the FEP's implementation of MFepAttributeStorer::ReadAttributeDataFromStreamL() for each FEP attribute which needs to be synchronised.


WriteAttributeDataAndBroadcastL()

protected: void WriteAttributeDataAndBroadcastL(TUid aAttributeUid);

Description

After changing the value of a single FEP attribute that needs to be synchronised, call this function to synchronise other running instances of the FEP.

It first calls MFepAttributeStorer::WriteAttributeDataToStreamL() which writes the attribute's new value to the stream and then it causes all other running instances of the FEP to be notified of the change.

Parameters

TUid aAttributeUid

The UID of the attribute that has changed.


WriteAttributeDataAndBroadcastL()

protected: void WriteAttributeDataAndBroadcastL(const TArray<TUid>& aAttributeUids);

Description

After changing the value of multiple FEP attributes that need to be synchronised, call this function to synchronise other running instances of the FEP.

It first calls MFepAttributeStorer::WriteAttributeDataToStreamL() which writes the attributes' new values to the stream and then it causes all other running instances of the FEP to be notified of the changes.

Parameters

const TArray<TUid>& aAttributeUids

Array of UIDs for the attribute that have changed.

[Top]


Key events


SimulateKeyEventsL()

protected: void SimulateKeyEventsL(const TArray<TUint>& aArrayOfCharacters);

Description

Simulates a key event for each of the character codes in the array passed to it.

Notes:

This function should be called in order to send key events to the application underneath the FEP (unless inline editing is taking place, in which case a different mechanism is used). FEPs should not use CCoeEnv::SimulateKeyEventL() to simulate key events.

Parameters

const TArray<TUint>& aArrayOfCharacters

An array of characters.


IsSimulatingKeyEvent()

TBool IsSimulatingKeyEvent() const;

Description

Tests whether or not the FEP is simulating key events.

This function should be called early in the FEP's implementation of OfferKeyEventL(). If it returns ETrue, OfferKeyEventL() should immediately return EKeyWasNotConsumed so that the application gets the key event as intended.

Return value

TBool

ETrue if the FEP is simulating key events, EFalse if not.

Notes:


OfferKeyEventL()

private: virtual void OfferKeyEventL(TEventResponse& aEventResponse, const TKeyEvent& aKeyEvent, TEventCode aEventCode)=0;

Description

This function is provided to support FEPs in OPL. It is called when a FEP running over an OPL application receives key events. This function is completely independent from CCoeControl’s virtual function of the same name but should be implemented in exactly the same way.

A number of things should be done in the implementation of this function:

After this has been done, the FEP can do its own processing of the key event. In general, it is recommended that the implementation of OfferKeyEventL() should be generous in what gets passed on to the application when not inside a FEP transaction, and should block all key events from getting through to the application when it is inside a FEP transaction.

Parameters

TEventResponse& aEventResponse

On return, should be set by the function overriding CCoeFep::OfferKeyEventL() to indicate whether the key event was consumed or not. Must be set to either EEventWasNotConsumed or EEventWasConsumed and this must be done before any function that can leave is called. EEventWasNotConsumed allows the event to be passed on to the application and returning EEventWasConsumed prevents the event from being passed on to the application.

const TKeyEvent& aKeyEvent

The key event.

TEventCode aEventCode

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

See also:


MakeDeferredFunctionCall()

protected: void MakeDeferredFunctionCall(MDeferredFunctionCall& aDeferredFunctionCall);

Description

Uses a high-priority active object to call the specified object's ExecuteFunctionL().

This function must be used to handle an event if that event starts a transaction and if the handling of that event is dependent on the target control's input capabilities. In such a case, MakeDeferredFunctionCall() should be called by the FEP, (passing in the relevant MDeferredFunctionCall-derived object) before calling HandleStartOfTransactionL().

Note:

The reason why key event handling must be done inside a high priority active object is as follows:

In some UI situations, pressing a key should move focus to a previously non-focused or non-existent text editor control, and should insert the character corresponding to that key event into the newly focused control.

When text entry is via a FEP, for this focus-shift to occur at the right time, when the FEP receives its first key event, it should call MCoeFepObserver::HandleStartOfTransactionL(). The implementation of this function should do whatever focus shift is required (e.g. launch the dialog).

However, if it is a waiting dialog, text cannot now be entered into the FEP until the dialog’s RunLD() or ExecuteLD() returns (this occurs when the dialog is either cancelled or committed). Therefore, HandleStartOfTransactionL() will block. The solution is for the FEP to handle the key event from within a high priority active object.

Parameters

MDeferredFunctionCall& aDeferredFunctionCall

Implements key event handling in its ExecuteFunctionL() function. This is deferred in that it is executed when the active object's RunL() is called.

[Top]


On or off


IsTurnedOnByL()

TBool IsTurnedOnByL(const TKeyEvent& aKeyEvent) const;

Description

If the FEP is currently off and is turned on by the key event specified, the function turns all running instances of the FEP on (and returns ETrue). Otherwise, it returns EFalse.

Note:

This function was protected in v6.0.

Parameters

const TKeyEvent& aKeyEvent

The key event of interest.

Return value

TBool

Non-zero if the key event specified is used to turn the FEP on.EFalse if not, or if the FEP is already on.


IsTurnedOffByL()

TBool IsTurnedOffByL(const TKeyEvent& aKeyEvent) const;

Description

If the FEP is currently on and is turned off by the key event specified, the function turns all running instances of the FEP off (and returns ETrue). Otherwise, it returns EFalse.

Note:

This function was protected in v6.0.

Parameters

const TKeyEvent& aKeyEvent

The key event of interest.

Return value

TBool

Non-zero if the key event specified is used to turn the FEP off. EFalse if not, or if the FEP is already off.


IsOn()

protected: TBool IsOn() const;

Description

Tests whether the FEP is on or off.

Return value

TBool

Non-zero if the FEP is on, EFalse if the FEP is off.


IsOnHasChangedState()

private: virtual void IsOnHasChangedState()=0;

Description

Called to notify the FEP that it has either just been turned on or just been turned off (it can find out which by calling CCoeFep::IsOn()). If FEPs want to change their visual appearance when they are off (e.g. make themselves invisible), then they should implement this function accordingly.

[Top]


Pointer events


OfferPointerEventL()

private: virtual void OfferPointerEventL(TEventResponse& aEventResponse, const TPointerEvent& aPointerEvent, const CCoeControl* aWindowOwningControl)=0;

Description

This function is provided to support FEPs in OPL. It is called when a FEP running over an OPL application receives pointer events. It should behave in the same way as the FEP control's HandlePointerEventL().

Parameters

TEventResponse& aEventResponse

On return, should be set by the function overriding CCoeFep::OfferPointerEventL() to indicate whether the pointer event was consumed or not. Must be set to either EEventWasConsumed(if aWindowOwningControl is the target control for the pointer event), otherwise EEventWasNotConsumed and this must be done BEFORE any function that can leave is called. The reason for this is that the FEP framework needs to know whether the pointer event that occurred belonged to the FEP or not, and it needs to know this even if a leave occurs.

const TPointerEvent& aPointerEvent

The pointer event.

const CCoeControl* aWindowOwningControl

The target control for the pointer event.

See also:


OfferPointerBufferReadyEventL()

private: virtual void OfferPointerBufferReadyEventL(TEventResponse& aEventResponse, const CCoeControl* aWindowOwningControl)=0;

Description

This function is provided to support FEPs in OPL. It is called when a FEP running over an OPL application receives buffered drag events (where multiple mouse/pen positions are received in a single event). Buffered drag events are typically used when the application requires a continuous stream of pointer events, such as in handwriting recognition software.

This function should behave in the same way as the FEP control's HandlePointerBufferReadyL(). If buffered drag events are not supported, or if aWindowOwningControl is not the target control for the drag events, this function should set aEventResponse to CCoeFep::EEventWasNotConsumed. Otherwise, set it to CCoeFep::EEventWasConsumed.

Parameters

TEventResponse& aEventResponse

On return, should be set by the function overriding CCoeFep::OfferPointerBufferReadyEventL() to indicate whether the pointer events were consumed or not. Must be set to either EEventWasConsumed (if aWindowOwningControl is the target control), otherwise EEventWasNotConsumed and this must be done BEFORE any function that can leave is called. The reason for this is that the FEP framework needs to know whether the pointer events that occurred belonged to the FEP or not, and it needs to know this even if a leave occurs.

const CCoeControl* aWindowOwningControl

The target control for the drag events.

See also:

[Top]


Enumerations


Enum TEventResponse

TEventResponse

Description

Response to key or pointer event

EEventWasNotConsumed

Indicates that the FEP did not process the event.

EEventWasConsumed

Indicates that the FEP did process the event.

[Top]


Class MDeferredFunctionCall

MDeferredFunctionCall

Support

Supported from 6.0

Description

Enables FEPs to have some code called but not in the context of the current call stack — hence the name "deferred".

For an explanation of the intended use of this class, see the documentation of CCoeFep::MakeDeferredFunctionCall().

Defined in CCoeFep::MDeferredFunctionCall:
ExecuteFunctionL()


ExecuteFunctionL()

virtual void ExecuteFunctionL()=0;

Description

This function is called from within a high-priority active object's RunL() shortly after the active object has been queued by calling CCoeFep::MakeDeferredFunctionCall().

[Top]


Class MModifiedCharacter

MModifiedCharacter

Support

Supported from 6.0

Description

FEPs send character codes to the application underneath them using SimulateKeyEventsL(). Occasionally a FEP may wish to also specify the modifiers (e.g. Fn, ctrl, shift) to be sent with that character code. In this case, they should use the overload of CCoeFep::SimulateKeyEventsL() which takes an array of MModifiedCharacters.

Defined in CCoeFep::MModifiedCharacter:
CharacterCode(), ModifierMask(), ModifierValues()


CharacterCode()

virtual TUint CharacterCode() const=0;

Description

Returns the character code of the key combination.

Return value

TUint

The character code of the key combination.


ModifierMask()

virtual TUint ModifierMask() const=0;

Description

Returns a TUint which indicates which modifiers to override, rather than using the current state of the keyboard's modifiers.

Return value

TUint

The modifiers to override in the key combination.


ModifierValues()

virtual TUint ModifierValues() const=0;

Description

Returns a TUint which indicates which of the modifiers specified in the mask (returned by ModifierMask()) must be on and which must be off.

Return value

TUint

Indicates which of the modifiers specified in the mask (returned by ModifierMask()) must be on and which must be off.