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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __SPRITEANIMATION_H__
17 #define __SPRITEANIMATION_H__
19 #include <animation.h>
24 #include <animationconfig.h>
25 #include <spriteanimationclient.h>
27 class CAnimationDataProvider;
29 class CSpriteAnimationExt;
32 Implementation of CAnimation for sprite based animations.
34 A sprite animation displays the image using a sprite, which is a server side
35 graphic object. This is likely to be more efficient than a basic animation,
36 and requires slightly less work in the client application. However, it also
37 provides less control over the actual rendering of the image.
39 A sprite animation must be associated with an RWindow. However, no redraw
40 events will be generated for it by the animation, and the client application
41 does not need to take any action once the animation has started. Holding the
42 animation when the sprite is not visible is handled automatically on the server
45 @see CAnimationDataProvider
49 class CSpriteAnimation : public CAnimation, public MAnimationDataProviderObserver
52 IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWsSession, RWindow& aWindow, MAnimationObserver* aObserver = 0);
53 IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWsSession, RWindow& aWindow, const TDesC8& aDataType, MAnimationObserver* aObserver = 0);
54 IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, MAnimationObserver* aObserver = NULL, const CCoeControl* aHost = NULL);
55 IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, const TDesC8& aDataType, MAnimationObserver* aObserver = NULL, const CCoeControl* aHost = NULL);
56 IMPORT_C ~CSpriteAnimation();
57 IMPORT_C TSize Size() const;
59 /** Provides an CSpriteAnimation DataProvider interface to the client application.
60 @return iDataProvider A CAnimationDataProvider */
61 inline CAnimationDataProvider* DataProvider() { return iDataProvider; }
62 // From CAnimationBase:
63 virtual void Start(const TAnimationConfig& aConfig);
66 virtual void Resume();
68 virtual void Unhold();
69 virtual void SetPosition(const TPoint& aPoint);
70 virtual void Freeze();
71 virtual void Unfreeze();
73 IMPORT_C virtual void SetHostL(const CCoeControl* aHost);
77 CSpriteAnimation(CAnimationDataProvider* aDataProvider, RWsSession& aWsSession);
78 CSpriteAnimation(CAnimationDataProvider* aDataProvider, MAnimationObserver* aObserver, const CCoeControl* aHost);
79 void ConstructL(const TPoint& aPoint, RWindow& aWindow, const TDesC8& aDataType, MAnimationObserver* aObserver);
80 virtual void CSpriteAnimation_Reserved2();
81 void ConstructL(const TPoint& aPoint, const TDesC8& aDataType);
84 CSpriteAnimation(const CSpriteAnimation&); // no implementation
85 CSpriteAnimation& operator=(const CSpriteAnimation&); // no implementation
88 // from MAnimationDataProviderObserver
89 virtual void DataProviderEventL(TInt aEvent, TAny* aData, TInt aDataSize);
94 EAnimationInitialized = 0x1 // Is the animation initialized?
97 CSpriteAnimationExt* iSpriteAnimationExt;
98 MAnimationObserver* iObserver;
99 //note the following data member is accessed via an inline function!
100 CAnimationDataProvider* iDataProvider;
101 RWsSession* iWsSession;
102 RWsSprite* iWsSprite;
104 RSpriteAnimationClient* iClient;
105 const CCoeControl* iHost;