1.1 --- a/epoc32/include/basicanimation.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/basicanimation.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,135 @@
1.4 -basicanimation.h
1.5 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#ifndef __BASICANIMATION_H__
1.21 +#define __BASICANIMATION_H__
1.22 +
1.23 +#include <animation.h>
1.24 +#include <w32std.h>
1.25 +
1.26 +class RWsSession;
1.27 +class RWindow;
1.28 +class CWindowGc;
1.29 +class CFbsBitmap;
1.30 +class CFbsBitmapDevice;
1.31 +class CFbsBitGc;
1.32 +class CAnimationDataProvider;
1.33 +class CAnimator;
1.34 +class TAnimationConfig;
1.35 +class CAnimationTls;
1.36 +class CAnimationTicker;
1.37 +class CBasicAnimationExt;
1.38 +class CCoeControl;
1.39 +
1.40 +/**
1.41 +Implementation of CAnimation for purely client side animations.
1.42 +
1.43 +A basic animation accepts a data provider during construction, loads the
1.44 +appropriate animator plugin, and implements the interface defined in
1.45 +CAnimation.
1.46 +
1.47 +A basic animation must be associated with an RWindow. Redraw events will be
1.48 +received by the client application whenever the animation needs to draw a new
1.49 +frame, and it is the applications responsibility to call Draw() while handling
1.50 +these events. It is also the client applications responsibility to handle
1.51 +visibility events and place the animation on hold when it isn't visible. This
1.52 +saves on CPU usage and ultimately prolongs battery life.
1.53 +
1.54 +@see CAnimationDataProvider
1.55 +@publishedAll
1.56 +@released
1.57 +*/
1.58 +class CBasicAnimation : public CAnimation, public MAnimationDrawer, public MAnimationDataProviderObserver
1.59 + {
1.60 +private:
1.61 + enum TFlags
1.62 + {
1.63 + EAnimationInitialised = 0x0001,
1.64 + };
1.65 +public:
1.66 + IMPORT_C static CBasicAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWs, RWindow& aWindow, MAnimationObserver* aObserver = 0);
1.67 + IMPORT_C static CBasicAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWs, RWindow& aWindow, const TDesC8& aDataType, MAnimationObserver* aObserver = 0);
1.68 + IMPORT_C static CBasicAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, MAnimationObserver* aObserver, const CCoeControl* aHost);
1.69 + IMPORT_C static CBasicAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, const TDesC8& aDataType, MAnimationObserver* aObserver, const CCoeControl* aHost);
1.70 + IMPORT_C ~CBasicAnimation();
1.71 +
1.72 + IMPORT_C void Draw(CWindowGc& aGc) const;
1.73 +
1.74 + /** Provides an CAnimationDataProvider interface to the client application.
1.75 + @return iDataProvider A CAnimationDataProvider */
1.76 + inline CAnimationDataProvider* DataProvider() { return iDataProvider; }
1.77 +
1.78 + /** Returns the current drawing position.
1.79 + @return ipoint const Tpoint& */
1.80 + inline const TPoint& Position() const { return iPoint; }
1.81 +
1.82 + /** Gets the size of the smallest bounding rectangle that will be required to render the animation.
1.83 +
1.84 + This function is called when the animator is ready to begin animating. The animator cannot be started
1.85 + until it has called this function.
1.86 + @return iSize The size of the smallest bounding rectangle */
1.87 + inline const TSize& Size() const { return iSize; }
1.88 + // From CAnimation:
1.89 + virtual void Start(const TAnimationConfig& aConfig);
1.90 + virtual void Stop();
1.91 + virtual void Pause();
1.92 + virtual void Resume();
1.93 + virtual void Hold();
1.94 + virtual void Unhold();
1.95 + virtual void SetPosition(const TPoint& aPoint);
1.96 + virtual void Freeze();
1.97 + virtual void Unfreeze();
1.98 +public:
1.99 + IMPORT_C void SetHostL(const CCoeControl* aHost);
1.100 +protected:
1.101 + CBasicAnimation(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession* aWs, RWindow* aWindow, MAnimationObserver* aObserver);
1.102 + CBasicAnimation();
1.103 + CBasicAnimation(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, MAnimationObserver* aObserver);
1.104 + void ConstructL(const TDesC8& aDataType);
1.105 + IMPORT_C virtual void CBasicAnimation_Reserved1();
1.106 + IMPORT_C virtual void CBasicAnimation_Reserved2();
1.107 + void ConstructL(const TDesC8& aDataType,const CCoeControl* aHost);
1.108 +private:
1.109 + CBasicAnimation(const CBasicAnimation&); // no implementation
1.110 + CBasicAnimation& operator=(const CBasicAnimation&); // no implementation
1.111 + // from MAnimationDataProviderObserver
1.112 + virtual void DataProviderEventL(TInt aEvent, TAny* aData, TInt aDataSize);
1.113 + // From MAnimatorDrawer
1.114 + virtual void AnimatorDraw();
1.115 + virtual void AnimatorInitialisedL(const TSize& aSize);
1.116 + virtual void AnimatorResetL();
1.117 + virtual const TPtrC8 AnimatorDataType() const;
1.118 + virtual CAnimationTicker& AnimatorTicker();
1.119 +private:
1.120 + CBasicAnimationExt* iBasicAnimationExt;
1.121 + MAnimationObserver* iObserver;
1.122 + CAnimationDataProvider* iDataProvider;
1.123 + CAnimationTls* iTls;
1.124 + TPoint iPoint;
1.125 + RWsSession* iWs;
1.126 + RWindow* iWindow;
1.127 + HBufC8* iDataType;
1.128 + TInt iFreezeCount;
1.129 + TInt iFlags;
1.130 + TSize iSize;
1.131 + CAnimator* iAnimator;
1.132 + CFbsBitmap* iBitmap;
1.133 + CFbsBitmap* iMask;
1.134 + CFbsBitmapDevice* iBitmapDevice;
1.135 + CFbsBitmapDevice* iMaskDevice;
1.136 + CFbsBitGc* iRenderGc;
1.137 + };
1.138 +
1.139 +#endif