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