williamr@2
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __SPRITEANIMATION_H__
|
williamr@2
|
17 |
#define __SPRITEANIMATION_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <animation.h>
|
williamr@2
|
20 |
|
williamr@2
|
21 |
#include <e32base.h>
|
williamr@2
|
22 |
#include <w32std.h>
|
williamr@2
|
23 |
|
williamr@2
|
24 |
#include <animationconfig.h>
|
williamr@4
|
25 |
|
williamr@4
|
26 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
williamr@2
|
27 |
#include <spriteanimationclient.h>
|
williamr@4
|
28 |
#endif // SYMBIAN_ENABLE_SPLIT_HEADERS
|
williamr@2
|
29 |
|
williamr@2
|
30 |
class CAnimationDataProvider;
|
williamr@2
|
31 |
class CCoeControl;
|
williamr@2
|
32 |
class CSpriteAnimationExt;
|
williamr@4
|
33 |
class RSpriteAnimationClient;
|
williamr@2
|
34 |
|
williamr@2
|
35 |
/**
|
williamr@2
|
36 |
Implementation of CAnimation for sprite based animations.
|
williamr@2
|
37 |
|
williamr@2
|
38 |
A sprite animation displays the image using a sprite, which is a server side
|
williamr@2
|
39 |
graphic object. This is likely to be more efficient than a basic animation,
|
williamr@2
|
40 |
and requires slightly less work in the client application. However, it also
|
williamr@2
|
41 |
provides less control over the actual rendering of the image.
|
williamr@2
|
42 |
|
williamr@2
|
43 |
A sprite animation must be associated with an RWindow. However, no redraw
|
williamr@2
|
44 |
events will be generated for it by the animation, and the client application
|
williamr@2
|
45 |
does not need to take any action once the animation has started. Holding the
|
williamr@2
|
46 |
animation when the sprite is not visible is handled automatically on the server
|
williamr@2
|
47 |
side.
|
williamr@2
|
48 |
|
williamr@2
|
49 |
@see CAnimationDataProvider
|
williamr@2
|
50 |
@publishedAll
|
williamr@2
|
51 |
@released
|
williamr@2
|
52 |
*/
|
williamr@2
|
53 |
class CSpriteAnimation : public CAnimation, public MAnimationDataProviderObserver
|
williamr@2
|
54 |
{
|
williamr@2
|
55 |
public:
|
williamr@2
|
56 |
IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWsSession, RWindow& aWindow, MAnimationObserver* aObserver = 0);
|
williamr@2
|
57 |
IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, RWsSession& aWsSession, RWindow& aWindow, const TDesC8& aDataType, MAnimationObserver* aObserver = 0);
|
williamr@2
|
58 |
IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, MAnimationObserver* aObserver = NULL, const CCoeControl* aHost = NULL);
|
williamr@2
|
59 |
IMPORT_C static CSpriteAnimation* NewL(CAnimationDataProvider* aDataProvider, const TPoint& aPoint, const TDesC8& aDataType, MAnimationObserver* aObserver = NULL, const CCoeControl* aHost = NULL);
|
williamr@2
|
60 |
IMPORT_C ~CSpriteAnimation();
|
williamr@2
|
61 |
IMPORT_C TSize Size() const;
|
williamr@2
|
62 |
|
williamr@2
|
63 |
/** Provides an CSpriteAnimation DataProvider interface to the client application.
|
williamr@2
|
64 |
@return iDataProvider A CAnimationDataProvider */
|
williamr@2
|
65 |
inline CAnimationDataProvider* DataProvider() { return iDataProvider; }
|
williamr@2
|
66 |
// From CAnimationBase:
|
williamr@2
|
67 |
virtual void Start(const TAnimationConfig& aConfig);
|
williamr@2
|
68 |
virtual void Stop();
|
williamr@2
|
69 |
virtual void Pause();
|
williamr@2
|
70 |
virtual void Resume();
|
williamr@2
|
71 |
virtual void Hold();
|
williamr@2
|
72 |
virtual void Unhold();
|
williamr@2
|
73 |
virtual void SetPosition(const TPoint& aPoint);
|
williamr@2
|
74 |
virtual void Freeze();
|
williamr@2
|
75 |
virtual void Unfreeze();
|
williamr@2
|
76 |
public:
|
williamr@2
|
77 |
IMPORT_C virtual void SetHostL(const CCoeControl* aHost);
|
williamr@2
|
78 |
|
williamr@2
|
79 |
protected:
|
williamr@2
|
80 |
CSpriteAnimation();
|
williamr@2
|
81 |
CSpriteAnimation(CAnimationDataProvider* aDataProvider, RWsSession& aWsSession);
|
williamr@2
|
82 |
CSpriteAnimation(CAnimationDataProvider* aDataProvider, MAnimationObserver* aObserver, const CCoeControl* aHost);
|
williamr@2
|
83 |
void ConstructL(const TPoint& aPoint, RWindow& aWindow, const TDesC8& aDataType, MAnimationObserver* aObserver);
|
williamr@2
|
84 |
virtual void CSpriteAnimation_Reserved2();
|
williamr@2
|
85 |
void ConstructL(const TPoint& aPoint, const TDesC8& aDataType);
|
williamr@2
|
86 |
void ConstructL();
|
williamr@2
|
87 |
private:
|
williamr@2
|
88 |
CSpriteAnimation(const CSpriteAnimation&); // no implementation
|
williamr@2
|
89 |
CSpriteAnimation& operator=(const CSpriteAnimation&); // no implementation
|
williamr@2
|
90 |
void InitializeL();
|
williamr@2
|
91 |
void Reset();
|
williamr@2
|
92 |
// from MAnimationDataProviderObserver
|
williamr@2
|
93 |
virtual void DataProviderEventL(TInt aEvent, TAny* aData, TInt aDataSize);
|
williamr@2
|
94 |
|
williamr@2
|
95 |
private:
|
williamr@2
|
96 |
enum TFlags
|
williamr@2
|
97 |
{
|
williamr@2
|
98 |
EAnimationInitialized = 0x1 // Is the animation initialized?
|
williamr@2
|
99 |
};
|
williamr@2
|
100 |
private:
|
williamr@2
|
101 |
CSpriteAnimationExt* iSpriteAnimationExt;
|
williamr@2
|
102 |
MAnimationObserver* iObserver;
|
williamr@2
|
103 |
//note the following data member is accessed via an inline function!
|
williamr@2
|
104 |
CAnimationDataProvider* iDataProvider;
|
williamr@2
|
105 |
RWsSession* iWsSession;
|
williamr@2
|
106 |
RWsSprite* iWsSprite;
|
williamr@2
|
107 |
RAnimDll iAnimDll;
|
williamr@2
|
108 |
RSpriteAnimationClient* iClient;
|
williamr@2
|
109 |
const CCoeControl* iHost;
|
williamr@2
|
110 |
TInt iFlags;
|
williamr@2
|
111 |
};
|
williamr@2
|
112 |
|
williamr@2
|
113 |
#endif
|