1.1 --- a/epoc32/include/spriteanimation.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/spriteanimation.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,109 @@
1.4 -spriteanimation.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 __SPRITEANIMATION_H__
1.21 +#define __SPRITEANIMATION_H__
1.22 +
1.23 +#include <animation.h>
1.24 +
1.25 +#include <e32base.h>
1.26 +#include <w32std.h>
1.27 +
1.28 +#include <animationconfig.h>
1.29 +#include <spriteanimationclient.h>
1.30 +
1.31 +class CAnimationDataProvider;
1.32 +class CCoeControl;
1.33 +class CSpriteAnimationExt;
1.34 +
1.35 +/**
1.36 +Implementation of CAnimation for sprite based animations.
1.37 +
1.38 +A sprite animation displays the image using a sprite, which is a server side
1.39 +graphic object. This is likely to be more efficient than a basic animation,
1.40 +and requires slightly less work in the client application. However, it also
1.41 +provides less control over the actual rendering of the image.
1.42 +
1.43 +A sprite animation must be associated with an RWindow. However, no redraw
1.44 +events will be generated for it by the animation, and the client application
1.45 +does not need to take any action once the animation has started. Holding the
1.46 +animation when the sprite is not visible is handled automatically on the server
1.47 +side.
1.48 +
1.49 +@see CAnimationDataProvider
1.50 +@publishedAll
1.51 +@released
1.52 +*/
1.53 +class CSpriteAnimation : public CAnimation, public MAnimationDataProviderObserver
1.54 + {
1.55 +public:
1.56 + IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWsSession, RWindow& aWindow, MAnimationObserver* aObserver = 0);
1.57 + IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWsSession, RWindow& aWindow, const TDesC8& aDataType, MAnimationObserver* aObserver = 0);
1.58 + IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, MAnimationObserver* aObserver = NULL, const CCoeControl* aHost = NULL);
1.59 + IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, const TDesC8& aDataType, MAnimationObserver* aObserver = NULL, const CCoeControl* aHost = NULL);
1.60 + IMPORT_C ~CSpriteAnimation();
1.61 + IMPORT_C TSize Size() const;
1.62 +
1.63 + /** Provides an CSpriteAnimation DataProvider interface to the client application.
1.64 + @return iDataProvider A CAnimationDataProvider */
1.65 + inline CAnimationDataProvider* DataProvider() { return iDataProvider; }
1.66 + // From CAnimationBase:
1.67 + virtual void Start(const TAnimationConfig& aConfig);
1.68 + virtual void Stop();
1.69 + virtual void Pause();
1.70 + virtual void Resume();
1.71 + virtual void Hold();
1.72 + virtual void Unhold();
1.73 + virtual void SetPosition(const TPoint& aPoint);
1.74 + virtual void Freeze();
1.75 + virtual void Unfreeze();
1.76 +public:
1.77 + IMPORT_C virtual void SetHostL(const CCoeControl* aHost);
1.78 +
1.79 +protected:
1.80 + CSpriteAnimation();
1.81 + CSpriteAnimation(CAnimationDataProvider* aDataProvider, RWsSession& aWsSession);
1.82 + CSpriteAnimation(CAnimationDataProvider* aDataProvider, MAnimationObserver* aObserver, const CCoeControl* aHost);
1.83 + void ConstructL(const TPoint& aPoint, RWindow& aWindow, const TDesC8& aDataType, MAnimationObserver* aObserver);
1.84 + virtual void CSpriteAnimation_Reserved2();
1.85 + void ConstructL(const TPoint& aPoint, const TDesC8& aDataType);
1.86 + void ConstructL();
1.87 +private:
1.88 + CSpriteAnimation(const CSpriteAnimation&); // no implementation
1.89 + CSpriteAnimation& operator=(const CSpriteAnimation&); // no implementation
1.90 + void InitializeL();
1.91 + void Reset();
1.92 + // from MAnimationDataProviderObserver
1.93 + virtual void DataProviderEventL(TInt aEvent, TAny* aData, TInt aDataSize);
1.94 +
1.95 +private:
1.96 + enum TFlags
1.97 + {
1.98 + EAnimationInitialized = 0x1 // Is the animation initialized?
1.99 + };
1.100 +private:
1.101 + CSpriteAnimationExt* iSpriteAnimationExt;
1.102 + MAnimationObserver* iObserver;
1.103 +//note the following data member is accessed via an inline function!
1.104 + CAnimationDataProvider* iDataProvider;
1.105 + RWsSession* iWsSession;
1.106 + RWsSprite* iWsSprite;
1.107 + RAnimDll iAnimDll;
1.108 + RSpriteAnimationClient* iClient;
1.109 + const CCoeControl* iHost;
1.110 + TInt iFlags;
1.111 + };
1.112 +
1.113 +#endif