epoc32/include/mw/basicanimation.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 // Copyright (c) 2004-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 __BASICANIMATION_H__
    17 #define __BASICANIMATION_H__
    18 
    19 #include <animation.h>
    20 #include <w32std.h>
    21 
    22 class RWsSession;
    23 class RWindow;
    24 class CWindowGc;
    25 class CFbsBitmap;
    26 class CFbsBitmapDevice;
    27 class CFbsBitGc;
    28 class CAnimationDataProvider;
    29 class CAnimator;
    30 class TAnimationConfig;
    31 class CAnimationTls;
    32 class CAnimationTicker;
    33 class CBasicAnimationExt;
    34 class CCoeControl;
    35 
    36 /**
    37 Implementation of CAnimation for purely client side animations.
    38 
    39 A basic animation accepts a data provider during construction, loads the
    40 appropriate animator plugin, and implements the interface defined in
    41 CAnimation.
    42 
    43 A basic animation must be associated with an RWindow.  Redraw events will be
    44 received by the client application whenever the animation needs to draw a new
    45 frame, and it is the applications responsibility to call Draw() while handling
    46 these events.  It is also the client applications responsibility to handle
    47 visibility events and place the animation on hold when it isn't visible. This
    48 saves on CPU usage and ultimately prolongs battery life.
    49 
    50 @see CAnimationDataProvider
    51 @publishedAll
    52 @released
    53 */
    54 class CBasicAnimation : public CAnimation, public MAnimationDrawer, public MAnimationDataProviderObserver
    55 	{
    56 private:
    57 	enum TFlags
    58 		{
    59 		EAnimationInitialised	=	0x0001,
    60 		};
    61 public:
    62 	IMPORT_C static CBasicAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWs, RWindow& aWindow, MAnimationObserver* aObserver = 0);
    63 	IMPORT_C static CBasicAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWs, RWindow& aWindow, const TDesC8& aDataType, MAnimationObserver* aObserver = 0);
    64 	IMPORT_C static CBasicAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, MAnimationObserver* aObserver, const CCoeControl* aHost);
    65 	IMPORT_C static CBasicAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, const TDesC8& aDataType, MAnimationObserver* aObserver, const CCoeControl* aHost);
    66 	IMPORT_C ~CBasicAnimation();
    67 	
    68 	IMPORT_C void Draw(CWindowGc& aGc) const;
    69 	
    70 	/** Provides an CAnimationDataProvider interface to the client application.
    71 	@return iDataProvider A CAnimationDataProvider */
    72 	inline CAnimationDataProvider* DataProvider() { return iDataProvider; }
    73 
    74 	/** Returns the current drawing position.
    75 	@return ipoint const Tpoint& */
    76 	inline const TPoint& Position() const { return iPoint; }
    77 	
    78 	/** Gets the size of the smallest bounding rectangle that will be required to render the animation.
    79 
    80 	This function is called when the animator is ready to begin animating. The animator cannot be started 
    81 	until it has called this function.  
    82 	@return iSize The size of the smallest bounding rectangle */
    83 	inline const TSize& Size() const { return iSize; }
    84 	// From CAnimation:
    85 	virtual void Start(const TAnimationConfig& aConfig);
    86 	virtual void Stop();
    87 	virtual void Pause();
    88 	virtual void Resume();
    89 	virtual void Hold();
    90 	virtual void Unhold();
    91 	virtual void SetPosition(const TPoint& aPoint);
    92 	virtual void Freeze();
    93 	virtual void Unfreeze();
    94 public:
    95 	IMPORT_C void SetHostL(const CCoeControl* aHost);
    96 protected:
    97 	CBasicAnimation(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession* aWs, RWindow* aWindow, MAnimationObserver* aObserver);
    98 	CBasicAnimation();
    99 	CBasicAnimation(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, MAnimationObserver* aObserver);
   100 	void ConstructL(const TDesC8& aDataType);
   101 	IMPORT_C virtual void CBasicAnimation_Reserved1();
   102 	IMPORT_C virtual void CBasicAnimation_Reserved2();
   103 	void ConstructL(const TDesC8& aDataType,const CCoeControl* aHost);
   104 private:
   105 	CBasicAnimation(const CBasicAnimation&); // no implementation
   106 	CBasicAnimation& operator=(const CBasicAnimation&);		 // no implementation
   107 	// from MAnimationDataProviderObserver
   108 	virtual void DataProviderEventL(TInt aEvent, TAny* aData, TInt aDataSize);
   109 	// From MAnimatorDrawer
   110 	virtual void AnimatorDraw();
   111 	virtual void AnimatorInitialisedL(const TSize& aSize);
   112 	virtual void AnimatorResetL();
   113 	virtual const TPtrC8 AnimatorDataType() const;
   114 	virtual CAnimationTicker& AnimatorTicker();
   115 private:
   116 	CBasicAnimationExt* iBasicAnimationExt;
   117 	MAnimationObserver* iObserver;
   118 	CAnimationDataProvider* iDataProvider;
   119 	CAnimationTls* iTls;
   120 	TPoint iPoint;
   121 	RWsSession* iWs;
   122 	RWindow* iWindow;
   123 	HBufC8* iDataType;
   124 	TInt iFreezeCount;
   125 	TInt iFlags;
   126 	TSize iSize;	
   127 	CAnimator* iAnimator;
   128 	CFbsBitmap* iBitmap;
   129 	CFbsBitmap* iMask;
   130 	CFbsBitmapDevice* iBitmapDevice;
   131 	CFbsBitmapDevice* iMaskDevice;
   132 	CFbsBitGc* iRenderGc;
   133 	};
   134 
   135 #endif