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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __SPRITEANIMATION_H__
17 #define __SPRITEANIMATION_H__
19 #include <animation.h>
24 #include <animationconfig.h>
26 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
27 #include <spriteanimationclient.h>
28 #endif // SYMBIAN_ENABLE_SPLIT_HEADERS
30 class CAnimationDataProvider;
32 class CSpriteAnimationExt;
33 class RSpriteAnimationClient;
36 Implementation of CAnimation for sprite based animations.
38 A sprite animation displays the image using a sprite, which is a server side
39 graphic object. This is likely to be more efficient than a basic animation,
40 and requires slightly less work in the client application. However, it also
41 provides less control over the actual rendering of the image.
43 A sprite animation must be associated with an RWindow. However, no redraw
44 events will be generated for it by the animation, and the client application
45 does not need to take any action once the animation has started. Holding the
46 animation when the sprite is not visible is handled automatically on the server
49 @see CAnimationDataProvider
53 class CSpriteAnimation : public CAnimation, public MAnimationDataProviderObserver
56 IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWsSession, RWindow& aWindow, MAnimationObserver* aObserver = 0);
57 IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWsSession, RWindow& aWindow, const TDesC8& aDataType, MAnimationObserver* aObserver = 0);
58 IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, MAnimationObserver* aObserver = NULL, const CCoeControl* aHost = NULL);
59 IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, const TDesC8& aDataType, MAnimationObserver* aObserver = NULL, const CCoeControl* aHost = NULL);
60 IMPORT_C ~CSpriteAnimation();
61 IMPORT_C TSize Size() const;
63 /** Provides an CSpriteAnimation DataProvider interface to the client application.
64 @return iDataProvider A CAnimationDataProvider */
65 inline CAnimationDataProvider* DataProvider() { return iDataProvider; }
66 // From CAnimationBase:
67 virtual void Start(const TAnimationConfig& aConfig);
70 virtual void Resume();
72 virtual void Unhold();
73 virtual void SetPosition(const TPoint& aPoint);
74 virtual void Freeze();
75 virtual void Unfreeze();
77 IMPORT_C virtual void SetHostL(const CCoeControl* aHost);
81 CSpriteAnimation(CAnimationDataProvider* aDataProvider, RWsSession& aWsSession);
82 CSpriteAnimation(CAnimationDataProvider* aDataProvider, MAnimationObserver* aObserver, const CCoeControl* aHost);
83 void ConstructL(const TPoint& aPoint, RWindow& aWindow, const TDesC8& aDataType, MAnimationObserver* aObserver);
84 virtual void CSpriteAnimation_Reserved2();
85 void ConstructL(const TPoint& aPoint, const TDesC8& aDataType);
88 CSpriteAnimation(const CSpriteAnimation&); // no implementation
89 CSpriteAnimation& operator=(const CSpriteAnimation&); // no implementation
92 // from MAnimationDataProviderObserver
93 virtual void DataProviderEventL(TInt aEvent, TAny* aData, TInt aDataSize);
98 EAnimationInitialized = 0x1 // Is the animation initialized?
101 CSpriteAnimationExt* iSpriteAnimationExt;
102 MAnimationObserver* iObserver;
103 //note the following data member is accessed via an inline function!
104 CAnimationDataProvider* iDataProvider;
105 RWsSession* iWsSession;
106 RWsSprite* iWsSprite;
108 RSpriteAnimationClient* iClient;
109 const CCoeControl* iHost;