Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: w32adll.h
Link against: N/A

Class CAnim

CAnim

Support

Supported from 5.0

Description

Server side animated object base interface.

Animations implement this interface, which is called by the window server to pass commands from clients, perform a step in the animation, or to pass window server events (if required) — so that the animation can handle them before the application.

The class functions are all pure virtual, and must be implemented by the user in the derived class to provide server side behaviour. The functions will be called by the window server with optional arguments passed in from the client side animation class RAnim.

ER5 developer's should derive animation classes directly from this class. Developers for releases after ER5, should derive from CWindowAnim, CFreeTimerWindowAnim or CSpriteAnim — depending on whether the animation is to draw to a sprite or a window.

The derived class is constructed in the DLL factory class CAnimDll::CreateInstanceL() function, as explained in its description.

The operation to perform an animation step is called by the window server on a timer. The timing properties are set through an MAnimGeneralFunctions member, which also provides other utility functions. In ER5, the timer and utility functions are accessed via the CAnimFunctions member.

Derivation

CAnimServer side animated object base interface
CBaseBase class for all classes to be instantiated on the heap
MEventHandlerEvent handler interface

Defined in CAnim:
Animate(), Command(), CommandReplyL(), ConstructL(), FocusChanged(), Redraw(), iFunctions, iGc

Inherited from CBase:
operator new()

Inherited from MEventHandler:
OfferRawEvent()


Construction and destruction


ConstructL()

virtual void ConstructL(TAny* aArgs, TBool aHasFocus)=0;

Support

Withdrawn in 5.1

Description

Server side construction and initialisation of an animation class.

Implementations of this function should call CAnimFunctions::SetRect() or MAnimWindowFunctions::SetRect() to inform the window server of the area in which the animation will be operating.

Note:

Parameters

TAny* aArgs

Packaged arguments which may be required during construction. These are transferred from aParams argument of the client side constructor — RAnim::Construct().

TBool aHasFocus

Specifies whether or not the animation has window server focus. This is set by the animation framework.

[Top]


Member functions


Animate()

virtual void Animate(TDateTime* aDateTime)=0;

Description

Main animation function — called by the window server.

The drawing code which implements a given animation should be provided here.

This function is called at a frequency determined by the SetSync() helper function. Note that if synch is not set, then this function will never be called. This effect can be exploited to use the animation framework — with its server side speed — for what are strictly not animations, e.g. for streaming video images.

The aDateTime parameter will be null if the current time (as determined by the window server) matches the time implied by the synch period, modulo normalisation, otherwise it will contain a valid (non-normalised) time.

Normalisation is to some specified granularity, for example if one minute is specified as the animation frequency, then in effect the window server will decide whether the implied time is correct to the minute, but not to the second.

Implied time is the time implied by the (normalised) actual time of the previous animation call plus the synch interval. For example if the last call was at time 't' and the synch interval is 1 second then if the time at this call is t + 1 second, then actual time and implied time match and the value placed into aDateTime will be NULL.

Cases in which the two may not match include, for example, system time having been reset between animation calls (perhaps British Summer Time or other daylight saving time has just come into effect). The intention is that when system time changes, a mechanism is provided to alert the animation code and allow it to reset itself. The assumption is that somewhere in its initialisation code, the animation will have performed a CAnimFunctions utility call to set a base time, which is then implicitly tracked by incrementing by a suitable interval; when aDateTime is non-NULL after a call to Animate(), base time should be reset.

Parameters

TDateTime* aDateTime

Null if the current time w.r.t. the window server matches the time implied by the synch period. Otherwise a valid (non-normalised) time.


Command()

virtual void Command(TInt aOpcode, TAny *aArgs)=0;

Description

Implements client-side initiated commands.

The window server calls this function in response to application calls to the client side command function RAnim::Command(). The arguments passed to the function by the window server are the same as were used on the client side function call.

Because this function does not return errors, it is not safe for commands which might leave.

Parameters

TInt aOpcode

Opcode understood by the class

TAny *aArgs

Arguments packaged on the client side, for example as a struct of a type determined by the aOpcode argument. These mirror the aArgs argument passed in to RAnim::Command().

See also:


CommandReplyL()

virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs)=0;

Description

Implements client-side initiated commands, returning a value.

The window server calls this function in response to application calls to the client side command function RAnim::CommandReplyL(). The arguments passed to the function by the window server are the same as were used on the client side function call.

This function returns values to the client side, and should be used to return error codes for commands which might leave.

Parameters

TInt aOpcode

Opcode understood by the class.

TAny *aArgs

Arguments packaged on the client side, for example as a struct of a type determined by the aOpcode argument. These mirror the aArgs argument passed in to RAnim::CommandReply().

Return value

TInt

Value passed back to client side function when this function completes. Typically this would be KErrNone or another of the system-wide error codes — however any value may be returned to the client side.

See also:


FocusChanged()

virtual void FocusChanged(TBool aState)=0;

Support

Withdrawn in 5.1

Description

Notifies change of focus.

The function is called by the window server to notify a change of focus — allowing the animation code to track whether it does or does not have focus.

Note:

Parameters

TBool aState

Focus has or has not changed.


Redraw()

virtual void Redraw()=0;

Support

Withdrawn in 5.1

Description

Redraws the object.

The function is called by the window server when it needs to redraw the object — the object must provide all the low level drawing code.

Note:

[Top]


Protected data members

Description

These data members point to a graphics context and utility functions maintained by the server. They are automatically pointed to the correct location, by the animation framework, when this object is created.


iFunctions

CAnimFunctions* iFunctions

Support

Withdrawn in 5.1

Description

Pointer to a class containing functions implemented by the window server. These are available to any CAnim derived class.

Note that this value is automatically set for you by the animation framework — you do not need to assign a value to this pointer.


iGc

CAnimGc* iGc

Support

Withdrawn in 5.1

Description

Pointer to the graphics context.

Note that this value is automatically set for you by the animation framework — you do not need to assign a value to this pointer.


iFunctions

MAnimGeneralFunctions* iFunctions

Support

Supported from 5.1

Description

Pointer to a class containing functions implemented by the window server. These are available to any CAnim derived class.

Note that this value is automatically set for you by the animation framework — you do not need to assign a value to this pointer.