lafagnosticuifoundation/graphicseffects/ClientInc/GfxTransImpl.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __GFXTRANSEFFECT_IMPL_H__
       
    17 #define __GFXTRANSEFFECT_IMPL_H__
       
    18 
       
    19 
       
    20 #include <coemain.h> // CBase etc
       
    21 #include <e32cmn.h> //RPointerArray
       
    22 
       
    23 #include "GfxTransEffect.h"
       
    24 #include "GfxTransAdapter.h"
       
    25 
       
    26 #include "TransitionControl.h"
       
    27 #include "RegisteredControl.h"
       
    28 #include "PolicyHandler.h"
       
    29 
       
    30 /**
       
    31 Implementation of the GfxTransEffect API, one instance is createed per thread
       
    32 using transitions.
       
    33 
       
    34 @internalTechnology
       
    35 */	
       
    36 NONSHARABLE_CLASS(CGfxTransEffect) : public CCoeStatic,
       
    37 					  public MGfxTransClient,
       
    38 					  MTransitionControlObserver
       
    39 	{
       
    40 public:
       
    41 	// construction/destruction
       
    42 	CGfxTransEffect();
       
    43 	~CGfxTransEffect();
       
    44 	TInt Construct();
       
    45 	static CGfxTransEffect* Static(const CCoeControl* aControl);
       
    46 	static CGfxTransEffect* StaticNoCreate(const CCoeControl * aControl);
       
    47 	static CGfxTransEffect* Static();
       
    48 	static CGfxTransEffect* StaticNoCreate();
       
    49 	
       
    50 	// registration
       
    51 	void Register(const CCoeControl* aKey,const TVwsViewId &aView,TUid aType);
       
    52 	void Register(const CCoeControl* aKey,TUid aType,TBool aNLayered);
       
    53 	TBool IsRegistered(const CCoeControl* aKey);
       
    54 	void Deregister(const CCoeControl* aKey);
       
    55 	// stack
       
    56 	void Begin(const CCoeControl* aKey,TUint aAction);
       
    57 	void BeginLC(const CCoeControl* aKey,TUint aAction);
       
    58 	void End(const CCoeControl* aKey);
       
    59 	void NotifyExternalState(TInt aState, const TDesC8* aArg);
       
    60 	inline TBool InTransition() const;
       
    61 	void Abort(const CCoeControl* aKey);
       
    62 	void AbortCleanup(const CCoeControl* aControl);
       
    63 	void Abort();
       
    64 	// hints
       
    65 	void SetHints(const CCoeControl* aControl,TUint aFlags);
       
    66 	TUint GetHints(const CCoeControl* aControl);
       
    67 	void SetHints(const CCoeControl* aControl,TUid aLayerType);
       
    68 	void Invalidate(const CCoeControl* aControl);
       
    69 	// demarcation
       
    70 	void SetDemarcation(const CCoeControl* aControl,TPoint const &aDemarcation);
       
    71 	void SetDemarcation(TVwsViewId const &aView,TPoint const &aDemarcation);
       
    72 	void SetDemarcation(const CCoeControl* aControl,TRect const &aDemarcation);
       
    73 	void SetDemarcation(TVwsViewId const &aView,TRect const &aDemarcation);
       
    74 	void SetDemarcation(const CCoeControl* aControl,const CCoeControl* aSrc,TRect const &aDemarcation);
       
    75 	void SetDemarcation(TVwsViewId const &aView,const CCoeControl* aSrc,TRect const &aDemarcation);
       
    76 	//Engine state
       
    77 	void Enable();
       
    78 	void Disable();
       
    79 	inline TBool IsEnabled() const;
       
    80 	//API additions
       
    81 	void SetEndDemarcation(const CCoeControl* aControl, const TRect& aDemarcation);
       
    82 	void SetBeginDemarcation(const CCoeControl* aControl, const TRect& aDemarcation);
       
    83 	TInt BeginGroup(); //returns an id for the group.
       
    84 	void EndGroup(TInt aGroupId);
       
    85 	void SetTransitionData(TUint aType, const TDesC8& aData);
       
    86 	void SetTransitionObserver(MGfxTransEffectObserver* aObserver);
       
    87 	//Draw item controls
       
    88 	void RegisterDrawItemControl(const CCoeControl* aControl, TUid aType);          
       
    89 	void BeginDrawItem(const CCoeControl* aControl, TUint aId, TUid aType,TRect &aDrawRect,const TRect* aFromRect, const TRect* aToRect);
       
    90 	void EndDrawItem(const CCoeControl*aControl);
       
    91 	//full screen effects
       
    92 	void BeginFullScreen(TUint aAction, const TRect &aEffectArea);
       
    93 	void BeginFullScreen(TUint aAction, const TRect &aEffectArea, TUint aType, const TDesC8& aParams);
       
    94 	void EndFullScreen();
       
    95 	void AbortFullScreen();
       
    96 
       
    97 	//MGfxTransClient
       
    98 	void TransitionPolicyUpdate(TControlPolicy* aPolicy);
       
    99 	void TransitionFinished(TInt aHandle);
       
   100 	TInt GetTransitionData(TInt aHandle, const CTransitionData*& aTransData);
       
   101 	void ClearAllPolicies();
       
   102 	
       
   103 	//MTransitionControlObserver
       
   104 	void ParticipantUpdated(CTransitionControl* aTransControl, CTransitionParticipant* aParticipant, 
       
   105 							RWsGraphicMsgBuf* aCommandBuffer, const TRect& aDrawRect, const TRect& aBoundingRect);
       
   106 	
       
   107 private:
       
   108 	//UID
       
   109 	static const TUid KTransEffectUid;
       
   110 	// policies
       
   111 	CPolicyHandler*iPolicyHandler;
       
   112 	// registration
       
   113 	RPointerArray<CRegisteredControl> iRegistered;
       
   114 	TInt FindRegistration(const CCoeControl* aControl) const;
       
   115 	TInt FindRegistration(TVwsViewId const &aViewId) const;
       
   116 	// fallback
       
   117 	void Fallback(const CCoeControl* aKey);
       
   118 	//transition handle
       
   119 	TInt CreateTransitionHandle();
       
   120 	TInt iCreateHandle;
       
   121 	// stack
       
   122 	RActiveStack iActiveStack;
       
   123 	// in transition
       
   124 	RInTransitionList iInTransition;
       
   125 	
       
   126 	//Engine Adapter
       
   127 	MGfxTransAdapter* iAdapter;
       
   128 	
       
   129 	// other
       
   130 	TBool iEnabled;
       
   131 	//observer
       
   132 	MGfxTransEffectObserver* iObserver; //not owning
       
   133 	};
       
   134 
       
   135 /*** inlines ***/
       
   136 	
       
   137 TBool CGfxTransEffect::InTransition() const
       
   138 	{
       
   139 	//"InTransition" in API means between begin-end.
       
   140 	return iActiveStack.Count();
       
   141 	}
       
   142 
       
   143 TBool CGfxTransEffect::IsEnabled() const
       
   144 	{
       
   145 	return iEnabled;
       
   146 	}
       
   147 
       
   148 #endif // __GFXTRANSEFFECT_IMPL_H__