|
~~~ CExampleFep.h ~~~ //////////////// #if !defined(__E32BASE_H__) #include <E32BASE.H> #endif
#if !defined(__W32STD_H__) #include <W32STD.H> #endif
#if !defined(__FRMTLAY_H__) #include <FRMTLAY.H> #endif
#if !defined(__COEMAIN_H__) #include <COEMAIN.H> #endif
#if !defined(__COECNTRL_H__) #include <COECNTRL.H> #endif
#if !defined(__FEPBASE_H__) #include <FEPBASE.H> #endif
#if !defined(__FEPITFR_H__) #include <FEPITFR.H> #endif
#if !defined(__EIKDIALG_H__) #include <EIKDIALG.H> #endif
#if !defined(__EIKMOBS_H__) #include <EIKMOBS.H> #endif ////////////////
class CExampleFepControl;
class CExampleFep : public CCoeFep { public: CExampleFep(CCoeEnv& aConeEnvironment); void ConstructL(const CCoeFepParameters& aFepParameters); virtual ~CExampleFep();
// from CCoeFep // virtual void CancelTransaction(); inline void SimulateKeyEventsL(const TArray<TUint>& aArrayOfCharacters) {CCoeFep::SimulateKeyEventsL(aArrayOfCharacters);} inline void SimulateKeyEventsL(const TArray<MModifiedCharacter>& aArrayOfModifiedCharacters) {CCoeFep::SimulateKeyEventsL(aArrayOfModifiedCharacters);} inline TBool IsSimulatingKeyEvent() const {return CCoeFep::IsSimulatingKeyEvent();} inline void WriteAttributeDataAndBroadcastL(TUid aAttributeUid) {CCoeFep::WriteAttributeDataAndBroadcastL(aAttributeUid);} inline TBool IsTurnedOnByL(const TKeyEvent& aKeyEvent) const {return CCoeFep::IsTurnedOnByL(aKeyEvent);} inline TBool IsTurnedOffByL(const TKeyEvent& aKeyEvent) const {return CCoeFep::IsTurnedOffByL(aKeyEvent);} inline TBool IsOn() const {return CCoeFep::IsOn();} private: // from CCoeFep virtual void CancelTransaction(); virtual void IsOnHasChangedState(); virtual void OfferKeyEventL(TEventResponse& aEventResponse, const TKeyEvent& aKeyEvent, TEventCode aEventCode); virtual void OfferPointerEventL(TEventResponse& aEventResponse, const TPointerEvent& aPointerEvent, const CCoeControl* aWindowOwningControl); virtual void OfferPointerBufferReadyEventL(TEventResponse& aEventResponse, const CCoeControl* aWindowOwningControl);
// from MCoeFocusObserver virtual void HandleChangeInFocus(); virtual void HandleDestructionOfFocusedItem();
// from MCoeForegroundObserver virtual void HandleGainingForeground(); virtual void HandleLosingForeground();
// from MFepAttributeStorer (via CCoeFep) virtual TInt NumberOfAttributes() const; virtual TUid AttributeAtIndex(TInt aIndex) const; virtual void WriteAttributeDataToStreamL(TUid aAttributeUid, RWriteStream& aStream) const; virtual void ReadAttributeDataFromStreamL(TUid aAttributeUid, RReadStream& aStream);
private: CExampleFepControl* iFepControl; };
~~~ CExampleFep.cpp ~~~ //////////////// #include <eikappui.h> #include <eikenv.h> //CEikonEnv #include <FEPBASE.H> #include <w32std.h> #include <frmtlay.h> #include <QuartzFepDescription.h>
#include "fepexample.h" #include "fepcontrol.h" ////////////////
GLDEF_C TInt E32Dll(TDllReason) { return KErrNone; }
// the exported functions /** * Main Fep construction - defined in COEFEPU.DEF */ EXPORT_C CCoeFep* NewFepL(CCoeEnv& aConeEnvironment, const TDesC& /*aFullFileNameOfDll*/, const CCoeFepParameters& aFepParameters) { CExampleFep* const fep = new(ELeave) CExampleFep(aConeEnvironment); CleanupStack::PushL(fep); fep->ConstructL(aFepParameters); CleanupStack::Pop(); // fep return fep; } /** * Export defined in COEFEPU.DEF - unused */ EXPORT_C void SynchronouslyExecuteSettingsDialogL(CCoeEnv& /*aConeEnvironment*/, const TDesC& /*aFullFileNameOfDll*/) { } /** * Reserved exports defined in COEFEPU.DEF - unused */ EXPORT_C void Reserved_1(){} EXPORT_C void Reserved_2(){} EXPORT_C void Reserved_3(){} EXPORT_C void Reserved_4(){} EXPORT_C void Reserved_5(){} EXPORT_C void Reserved_6(){} EXPORT_C void Reserved_7(){} EXPORT_C void Reserved_8(){}
EXPORT_C void QuartzFepDescription(TQuartzFepDescription& aFepDescription ) { aFepDescription.iFepName.Zero(); aFepDescription.iFepName.Copy(_L("FepEx")); aFepDescription.iFepType = TQuartzFepDescription::EFepTypeFloatingInABox; }
///////////////////////////////////////////////////////////////////////////////// // //Class CExampleFep // /////////////////////////////////////////////////////////////////////////////////
CExampleFep::CExampleFep(CCoeEnv& aConeEnvironment) :CCoeFep(aConeEnvironment) { }
void CExampleFep::ConstructL(const CCoeFepParameters& aFepParameters) { BaseConstructL(aFepParameters); iFepControl = CExampleFepControl::NewL(*this); iFepControl->ActivateL(); }
CExampleFep::~CExampleFep() { if (iFepControl) delete iFepControl; }
TInt CExampleFep::NumberOfAttributes() const { return 0; }
TUid CExampleFep::AttributeAtIndex(TInt /*aIndex*/) const { return KNullUid; }
void CExampleFep::WriteAttributeDataToStreamL(TUid /*aAttributeUid*/, RWriteStream& /*aStream*/) const {
}
void CExampleFep::ReadAttributeDataFromStreamL(TUid /*aAttributeUid*/, RReadStream& /*aStream*/) {
}
void CExampleFep::OfferKeyEventL(TEventResponse& aEventResponse,const TKeyEvent& aKeyEvent, TEventCode aEventCode) { aEventResponse=EEventWasNotConsumed; switch (iFepControl->OfferKeyEventL(aKeyEvent, aEventCode)) { case EKeyWasNotConsumed: aEventResponse=EEventWasNotConsumed; break; case EKeyWasConsumed: aEventResponse=EEventWasConsumed; break; default: aEventResponse=EEventWasNotConsumed; break; } }
void CExampleFep::OfferPointerEventL(TEventResponse& aEventResponse,const TPointerEvent& aPointerEvent, const CCoeControl* /*aWindowOwningControl*/) { aEventResponse = EEventWasNotConsumed; if(iFepControl) { iFepControl->HandlePointerEventL(aPointerEvent); aEventResponse=EEventWasConsumed; } }
void CExampleFep::OfferPointerBufferReadyEventL(TEventResponse& aEventResponse, const CCoeControl* /*aWindowOwningControl*/) { aEventResponse = EEventWasNotConsumed; if(iFepControl) { iFepControl->HandlePointerBufferReadyL(); aEventResponse=EEventWasConsumed; } }
void CExampleFep::HandleChangeInFocus() { if(iFepControl) iFepControl->HandleChangeInFocus(); }
void CExampleFep::HandleDestructionOfFocusedItem() { }
void CExampleFep::HandleGainingForeground() { if(iFepControl) iFepControl->HandleGainingForeground(); }
void CExampleFep::HandleLosingForeground() { }
void CExampleFep::CancelTransaction() { }
void CExampleFep::IsOnHasChangedState() { }
|