Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: BasicAnimation.h
Link against: animation.lib

Class CBasicAnimation

class CBasicAnimation : public CAnimation, public MAnimationDrawer, public MAnimationDataProviderObserver;

Description

Implementation of CAnimation for purely client side animations.

A basic animation accepts a data provider during construction, loads the appropriate animator plugin, and implements the interface defined in CAnimation.

A basic animation must be associated with an RWindow. Redraw events will be received by the client application whenever the animation needs to draw a new frame, and it is the applications responsibility to call Draw() while handling these events. It is also the client applications responsibility to handle visibility events and place the animation on hold when it isn't visible. This saves on CPU usage and ultimately prolongs battery life.

Derivation

Members

Defined in CBasicAnimation:
AnimatorDataType(), AnimatorDraw(), AnimatorInitialisedL(), AnimatorResetL(), AnimatorTicker(), CBasicAnimation_Reserved1(), CBasicAnimation_Reserved2(), DataProvider(), DataProviderEventL(), Draw(), Freeze(), Hold(), NewL(), NewL(), NewL(), NewL(), Pause(), Position(), Resume(), SetHostL(), SetPosition(), Size(), Start(), Stop(), Unfreeze(), Unhold(), ~CBasicAnimation()

Inherited from CBase:
Delete(), Extension_(), operator new()

Inherited from MAnimationDataProviderObserver:
MAnimationDataProviderObserver_Reserved1(), MAnimationDataProviderObserver_Reserved2()

Inherited from MAnimationDrawer:
MAnimationDrawer_Reserved1(), MAnimationDrawer_Reserved2()

See also

See also:


Construction and destruction


NewL()

static IMPORT_C CBasicAnimation *NewL(CAnimationDataProvider *aDataProvider, const TPoint &aPoint, RWsSession &aWs, RWindow &aWindow, MAnimationObserver *aObserver=0);

Description

Two stage constructor.

This creates and returns a new basic animation.

Parameters

CAnimationDataProvider *aDataProvider

The data provider from which the animation contents will be obtained. The animation takes ownership of this object

const TPoint &aPoint

The starting position of the animation in the window (top left corner)

RWsSession &aWs

A session with the window server

RWindow &aWindow

The window in which the animation will be drawn

MAnimationObserver *aObserver

An optional receiver of animation events (such as errors)

Return value

CBasicAnimation *

The new object


NewL()

static IMPORT_C CBasicAnimation *NewL(CAnimationDataProvider *aDataProvider, const TPoint &aPoint, RWsSession &aWs, RWindow &aWindow, const TDesC8 &aDataType, MAnimationObserver *aObserver=0);

Description

Two stage constructor.

This is identical to the other NewL except that it allows an alternative data type to be specified. Unless you are trying to use a custom animator class the other form of constructor should be used.

Parameters

CAnimationDataProvider *aDataProvider

The data provider from which the animation contents will be obtained. The animation takes ownership of this object

const TPoint &aPoint

The starting position of the animation in the window (top left corner)

RWsSession &aWs

A session with the window server

RWindow &aWindow

The window in which the animation will be drawn

const TDesC8 &aDataType

Overrides the data type specified by the data provider

MAnimationObserver *aObserver

An optional receiver of animation events (such as errors)

Return value

CBasicAnimation *

The new object


NewL()

static IMPORT_C CBasicAnimation *NewL(CAnimationDataProvider *aDataProvider, const TPoint &aPoint, MAnimationObserver *aObserver, const CCoeControl *aHost);

Description

Two stage constructor. This creates and returns a new basic animation.

Parameters

CAnimationDataProvider *aDataProvider

The data provider from which the animation contents will be obtained. The animation takes ownership of this object

const TPoint &aPoint

The starting position of the animation in the window (top left corner)

MAnimationObserver *aObserver

An optional receiver of animation events (such as errors)

const CCoeControl *aHost

The CCoeControl responsible for drawing this animation

Return value

CBasicAnimation *

The new object


NewL()

static IMPORT_C CBasicAnimation *NewL(CAnimationDataProvider *aDataProvider, const TPoint &aPoint, const TDesC8 &aDataType, MAnimationObserver *aObserver, const CCoeControl *aHost);

Description

Two stage constructor.

This is identical to the other NewL except that it allows an alternative data type to be specified. Unless you are trying to use a custom animator class the other form of constructor should be used.

Parameters

CAnimationDataProvider *aDataProvider

The data provider from which the animation contents will be obtained. The animation takes ownership of this object

const TPoint &aPoint

The starting position of the animation in the window (top left corner)

const TDesC8 &aDataType

Overrides the data type specified by the data provider

MAnimationObserver *aObserver

An optional receiver of animation events (such as errors)

const CCoeControl *aHost

The CCoeControl responsible for drawing this animation

Return value

CBasicAnimation *

The new object


~CBasicAnimation()

IMPORT_C ~CBasicAnimation();

Description

Destructor.

[Top]


Member functions


Draw()

IMPORT_C void Draw(CWindowGc &aGc) const;

Description

This function should be called with a valid graphics context whenever a redraw event is received for the window this animation resides in.

The graphics context attributes will not be modified, which means effects such as opacity can be applied to it before the call to Draw.

Parameters

CWindowGc &aGc

A graphics context which will be used for blitting the animation frame onto the window


DataProvider()

inline CAnimationDataProvider *DataProvider();

Description

Provides an CAnimationDataProvider interface to the client application.

Return value

CAnimationDataProvider *

iDataProvider A CAnimationDataProvider


Position()

inline const TPoint &Position() const;

Description

Returns the current drawing position.

Return value

const TPoint &

ipoint const Tpoint&


Size()

inline const TSize &Size() const;

Description

Gets the size of the smallest bounding rectangle that will be required to render the animation.

This function is called when the animator is ready to begin animating. The animator cannot be started until it has called this function.

Return value

const TSize &

iSize The size of the smallest bounding rectangle


Start()

virtual void Start(const TAnimationConfig &aConfig);

Description

Implements CAnimation::Start.

Parameters

const TAnimationConfig &aConfig

Flags and possibly data regarding the way in which the animation should be run


Stop()

virtual void Stop();

Description

Implements CAnimation::Stop.


Pause()

virtual void Pause();

Description

Implements CAnimation::Pause.


Resume()

virtual void Resume();

Description

Implements CAnimation::Resume.


Hold()

virtual void Hold();

Description

Implements CAnimation::Hold.


Unhold()

virtual void Unhold();

Description

Implements CAnimation::Unhold.


SetPosition()

virtual void SetPosition(const TPoint &aPoint);

Description

Implements CAnimation::SetPosition.

Parameters

const TPoint &aPoint

The new location of the top left corner of the animation, relative to the window in which it is to be drawn


Freeze()

virtual void Freeze();

Description

Implements CAnimation::Freeze.


Unfreeze()

virtual void Unfreeze();

Description

Implements CAnimation::Unfreeze.


SetHostL()

IMPORT_C void SetHostL(const CCoeControl *aHost);

Description

This function lets you set the host at a later stage if you haven't got access to it during construction, or if you for some reason need to change it in run time.

Parameters

const CCoeControl *aHost


CBasicAnimation_Reserved1()

protected: virtual IMPORT_C void CBasicAnimation_Reserved1();

Description

Reserved for future use


CBasicAnimation_Reserved2()

protected: virtual IMPORT_C void CBasicAnimation_Reserved2();

Description

Reserved for future use


DataProviderEventL()

private: virtual void DataProviderEventL(TInt aEvent, TAny *aData, TInt aDataSize);

Description

Receives an event from a data provider.

Parameters

TInt aEvent

The event code.

TAny *aData

Any data associated with the event. Can be NULL.

TInt aDataSize

The size in bytes of the item pointed to by aData.


AnimatorDraw()

private: virtual void AnimatorDraw();

Description

Called by the animator when it needs to draw a new frame


AnimatorInitialisedL()

private: virtual void AnimatorInitialisedL(const TSize &aSize);

Description

Called by the animator when it is ready to begin running.

Parameters

const TSize &aSize

The size of the smallest bounding rectangle that will be required to render the animation


AnimatorResetL()

private: virtual void AnimatorResetL();

Description

Called by the animator when it is no longer ready, usually in response to TAnimationEvent::EAnimationDataChanged


AnimatorDataType()

private: virtual const TPtrC8 AnimatorDataType() const;

Description

Called by the animator plugin loading routine to determine the type of data for which an animator is required.

Return value

const TPtrC8

An 8 bit descriptor containing the data type.


AnimatorTicker()

private: virtual CAnimationTicker &AnimatorTicker();

Description

Called by the animator to obtain an AnimatorTicker, to which it will add itself whenever it is running.

Return value

CAnimationTicker &

A reference to a CAnimationTicker.