lafagnosticuifoundation/animation/inc/AnimationMixins.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     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 __ANIMATIONMIXINS_H__
       
    17 #define __ANIMATIONMIXINS_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <animationdataloaderobserver.h>
       
    21 
       
    22 /** Interface from a data provider to an animation
       
    23 
       
    24 An animation which has a data provider receives information from it via this
       
    25 interface.
       
    26 
       
    27 You do not need to derive an implementation from this class unless you are
       
    28 writing a new animation type.
       
    29 
       
    30 @publishedAll 
       
    31 @released
       
    32 @see CAnimationDataProvider
       
    33 @see CAnimation
       
    34 @see CAnimator*/
       
    35 class MAnimationDataProviderObserver
       
    36 	{
       
    37 public:
       
    38 	/** Receives an event from a data provider.
       
    39 	@param aEvent The event code.
       
    40 	@param aData Any data associated with the event. Can be NULL.
       
    41 	@param aDataSize The size in bytes of the item pointed to by aData.*/
       
    42 	virtual void DataProviderEventL(TInt aEvent, TAny* aData, TInt aDataSize) = 0;
       
    43 protected:
       
    44 	IMPORT_C virtual void MAnimationDataProviderObserver_Reserved1();
       
    45 	IMPORT_C virtual void MAnimationDataProviderObserver_Reserved2();
       
    46 	};
       
    47 
       
    48 class CAnimationTicker;
       
    49 
       
    50 /** Interface used by an animator to during the rendering process.
       
    51 
       
    52 A class implementing this interface is provided to an animator by an animation.
       
    53 It may or may not be the animation itself.
       
    54 
       
    55 You do not need to derive an implementation from this class unless you are
       
    56 writing a new animation type.
       
    57 
       
    58 @publishedAll 
       
    59 @released
       
    60 @see CAnimator*/
       
    61 class MAnimationDrawer
       
    62 	{
       
    63 public:
       
    64 	/** Called by the animator when it needs to draw a new frame */
       
    65 	virtual void AnimatorDraw() = 0;
       
    66 	/** Called by the animator when it is ready to begin running. 
       
    67 	@param aSize The size of the smallest bounding rectangle that will be required to render the animation */
       
    68 	virtual void AnimatorInitialisedL(const TSize& aSize) = 0;
       
    69 	/** Called by the animator when it is no longer ready, usually in
       
    70 	response to TAnimationEvent::EAnimationDataChanged */
       
    71 	virtual void AnimatorResetL() = 0;
       
    72 	/** Called by the animator plugin loading routine to determine the type
       
    73 	of data for which an animator is required.
       
    74 	@return An 8 bit descriptor containing the data type.*/
       
    75 	virtual const TPtrC8 AnimatorDataType() const = 0;
       
    76 	/** Called by the animator to obtain an AnimatorTicker, to which it will
       
    77 	add itself whenever it is running.
       
    78 	@return A reference to a CAnimationTicker.*/
       
    79 	virtual CAnimationTicker& AnimatorTicker() = 0;
       
    80 private:
       
    81 	IMPORT_C virtual void MAnimationDrawer_Reserved1();
       
    82 	IMPORT_C virtual void MAnimationDrawer_Reserved2();
       
    83 	};
       
    84 
       
    85 class CAnimation;
       
    86 
       
    87 /** Interface used by an animation to report events to the client application.
       
    88 
       
    89 An animation can inform the client application of particular events through this
       
    90 mechanism.  Only errors are reported in this way in v9.1, but more events may
       
    91 be added in future.
       
    92 
       
    93 Use of this interface by the client application is optional.
       
    94 
       
    95 @publishedAll 
       
    96 @released
       
    97 @see CAnimation*/
       
    98 class MAnimationObserver
       
    99 	{
       
   100 public:
       
   101 	/** Represents generic events which can be sent to the observer. */
       
   102 	enum TEvent
       
   103 		{
       
   104 		/** Indicates that an error has occurred in the data provider.
       
   105 		For events of this type, aData is a pointer to a TInt error code. */
       
   106 		EDataProviderError,
       
   107 		/** Indicates that the animator initialised (and therefore knows it's size) */
       
   108 		EAnimationInitialized=0x01,
       
   109 		/** Any user defined animations introducing new events should use
       
   110 		values greater than EReserved */
       
   111 		EReserved=0xFFFF,
       
   112 		};
       
   113 public:
       
   114 	/** Receives events from an animation.
       
   115 	
       
   116 	The receiver is not required to take any action atall in response to this
       
   117 	call.  The receiver should not delete the animation whilst responding
       
   118 	to this call.
       
   119 	
       
   120 	@param aSender A reference to the animation which sent the event.
       
   121 	@param aEvent The event code.
       
   122 	@param aData An event specific data item.*/
       
   123 	virtual void AnimationEvent(CAnimation& aSender, TInt aEvent, TAny* aData) = 0;
       
   124 protected:
       
   125 	IMPORT_C virtual void MAnimationObserver_Reserved1();
       
   126 	IMPORT_C virtual void MAnimationObserver_Reserved2();
       
   127 	};
       
   128 
       
   129 /** Interface used for receiving animation ticks.
       
   130 
       
   131 Animators receive regular ticks, during which they perform any required processing.
       
   132 
       
   133 You do not need to derive an implementation from this class unless you are writing
       
   134 a new animator type.
       
   135 
       
   136 @publishedAll 
       
   137 @released
       
   138 @see CAnimator
       
   139 @see CAnimationTicker*/
       
   140 class MAnimationTickee
       
   141 	{
       
   142 public:
       
   143 	/** This function is called regularly by any ticker to which the tickee
       
   144 	has been added */
       
   145 	virtual void Tick() = 0;
       
   146 protected:
       
   147 	IMPORT_C virtual void MAnimationTickee_Reserved1();
       
   148 	IMPORT_C virtual void MAnimationTickee_Reserved2();
       
   149 	};
       
   150 
       
   151 #endif //__ANIMATIONMIXINS_H__