epoc32/include/mw/spriteanimation.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __SPRITEANIMATION_H__
    17 #define __SPRITEANIMATION_H__
    18 
    19 #include <animation.h>
    20 
    21 #include <e32base.h>
    22 #include <w32std.h>
    23 
    24 #include <animationconfig.h>
    25 
    26 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    27 #include <spriteanimationclient.h>
    28 #endif // SYMBIAN_ENABLE_SPLIT_HEADERS
    29 
    30 class CAnimationDataProvider;
    31 class CCoeControl;
    32 class CSpriteAnimationExt;
    33 class RSpriteAnimationClient;
    34 
    35 /**
    36 Implementation of CAnimation for sprite based animations.
    37 
    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.
    42 
    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
    47 side.
    48 
    49 @see CAnimationDataProvider
    50 @publishedAll
    51 @released
    52 */
    53 class CSpriteAnimation : public CAnimation, public MAnimationDataProviderObserver
    54 	{
    55 public:
    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;
    62 
    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);
    68 	virtual void Stop();
    69 	virtual void Pause();
    70 	virtual void Resume();
    71 	virtual void Hold();
    72 	virtual void Unhold();
    73 	virtual void SetPosition(const TPoint& aPoint);
    74 	virtual void Freeze();
    75 	virtual void Unfreeze();	
    76 public:
    77 	IMPORT_C virtual void SetHostL(const CCoeControl* aHost);
    78 		
    79 protected:
    80 	CSpriteAnimation();
    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);
    86 	void ConstructL();
    87 private:
    88 	CSpriteAnimation(const CSpriteAnimation&);	// no implementation
    89 	CSpriteAnimation& operator=(const CSpriteAnimation&);			// no implementation
    90 	void InitializeL();
    91 	void Reset();
    92 	// from MAnimationDataProviderObserver
    93 	virtual void DataProviderEventL(TInt aEvent, TAny* aData, TInt aDataSize);
    94 
    95 private:
    96 	enum TFlags 
    97 		{
    98 		EAnimationInitialized = 0x1	// Is the animation initialized?
    99 		};
   100 private:
   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;
   107 	RAnimDll iAnimDll;
   108 	RSpriteAnimationClient* iClient;
   109 	const CCoeControl* iHost;
   110 	TInt iFlags;
   111 	};
   112 
   113 #endif