williamr@2
|
1 |
// Copyright (c) 1995-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@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 |
// Header for writing animated DLL add ons
|
williamr@2
|
15 |
//
|
williamr@2
|
16 |
//
|
williamr@2
|
17 |
|
williamr@2
|
18 |
#if !defined(__W32ADLL_H__)
|
williamr@2
|
19 |
#define __W32ADLL_H__
|
williamr@2
|
20 |
|
williamr@2
|
21 |
#if !defined(__W32STD_H__)
|
williamr@2
|
22 |
#include <w32std.h>
|
williamr@2
|
23 |
#endif
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#if !defined(__BITSTD_H__)
|
williamr@2
|
26 |
#include <bitstd.h>
|
williamr@2
|
27 |
#endif
|
williamr@2
|
28 |
|
williamr@2
|
29 |
/**
|
williamr@2
|
30 |
@publishedAll
|
williamr@2
|
31 |
@deprecated
|
williamr@2
|
32 |
*/
|
williamr@2
|
33 |
const TUint KWservAnimDllUidValue8=268435858;
|
williamr@2
|
34 |
|
williamr@2
|
35 |
/**
|
williamr@2
|
36 |
@publishedAll
|
williamr@2
|
37 |
@deprecated
|
williamr@2
|
38 |
*/
|
williamr@2
|
39 |
const TUid KWservAnimDllUid8={KWservAnimDllUidValue8};
|
williamr@2
|
40 |
|
williamr@2
|
41 |
/**
|
williamr@2
|
42 |
@publishedAll
|
williamr@2
|
43 |
@released
|
williamr@2
|
44 |
*/
|
williamr@2
|
45 |
const TUint KWservAnimDllUidValue16=268450594;
|
williamr@2
|
46 |
|
williamr@2
|
47 |
/**
|
williamr@2
|
48 |
@publishedAll
|
williamr@2
|
49 |
@released
|
williamr@2
|
50 |
*/
|
williamr@2
|
51 |
const TUid KWservAnimDllUid16={KWservAnimDllUidValue16};
|
williamr@2
|
52 |
|
williamr@2
|
53 |
/**
|
williamr@2
|
54 |
@publishedAll
|
williamr@2
|
55 |
@released
|
williamr@2
|
56 |
*/
|
williamr@2
|
57 |
const TUint KWservAnimDllUidValue=KWservAnimDllUidValue16;
|
williamr@2
|
58 |
|
williamr@2
|
59 |
/**
|
williamr@2
|
60 |
@publishedAll
|
williamr@2
|
61 |
@released
|
williamr@2
|
62 |
*/
|
williamr@2
|
63 |
const TUid KWservAnimDllUid={KWservAnimDllUidValue};
|
williamr@2
|
64 |
|
williamr@2
|
65 |
//
|
williamr@2
|
66 |
// Contains functions callable from animated DLLs
|
williamr@2
|
67 |
//
|
williamr@2
|
68 |
|
williamr@2
|
69 |
|
williamr@2
|
70 |
class TWindowInfo
|
williamr@2
|
71 |
/** Animation window information.
|
williamr@2
|
72 |
|
williamr@2
|
73 |
Stores the window position and display mode for the animation.
|
williamr@2
|
74 |
During a redraw of the animation window, the redraw regions
|
williamr@2
|
75 |
can be retrieved by calling GetRedrawRegionAndRedrawShadowRegion().
|
williamr@2
|
76 |
|
williamr@2
|
77 |
@publishedAll
|
williamr@2
|
78 |
@released
|
williamr@2
|
79 |
@see TWindowInfo::GetRedrawRegionAndRedrawShadowRegion() */
|
williamr@2
|
80 |
{
|
williamr@2
|
81 |
public:
|
williamr@2
|
82 |
/** The screen position. */
|
williamr@2
|
83 |
TRect iScreenPos;
|
williamr@2
|
84 |
/** The display mode.
|
williamr@2
|
85 |
|
williamr@2
|
86 |
This is the minimum display mode that the screen has to be in to display this window. */
|
williamr@2
|
87 |
TDisplayMode iMode;
|
williamr@2
|
88 |
public:
|
williamr@2
|
89 |
/** Constructs an animation window information object. */
|
williamr@2
|
90 |
inline TWindowInfo() : iRegionPair(NULL) {}
|
williamr@2
|
91 |
public:
|
williamr@2
|
92 |
/** Stores a pair of region pointers. */
|
williamr@2
|
93 |
struct TRegionPair
|
williamr@2
|
94 |
{
|
williamr@2
|
95 |
const TRegion* iRegion1;
|
williamr@2
|
96 |
const TRegion* iRegion2;
|
williamr@2
|
97 |
};
|
williamr@2
|
98 |
/** Returns the current redraw region and redraw shadow region.
|
williamr@2
|
99 |
This function must only be called from an override of CWindowAnim's pure virtual Redraw function.
|
williamr@2
|
100 |
The region pointers retrieved must not be used beyond the end of the Redraw override.
|
williamr@2
|
101 |
@param aRedrawRegion The redraw region in screen coordinates.
|
williamr@2
|
102 |
@param aRedrawShadowRegion The redraw shadow region in screen coordinates. */
|
williamr@2
|
103 |
inline void GetRedrawRegionAndRedrawShadowRegion(const TRegion*& aRedrawRegion, const TRegion*& aRedrawShadowRegion) const
|
williamr@2
|
104 |
{
|
williamr@2
|
105 |
if (iRegionPair)
|
williamr@2
|
106 |
{
|
williamr@2
|
107 |
aRedrawRegion=iRegionPair->iRegion1;
|
williamr@2
|
108 |
aRedrawShadowRegion=iRegionPair->iRegion2;
|
williamr@2
|
109 |
iRegionPair=NULL;
|
williamr@2
|
110 |
}
|
williamr@2
|
111 |
else
|
williamr@2
|
112 |
{
|
williamr@2
|
113 |
aRedrawRegion=NULL;
|
williamr@2
|
114 |
aRedrawShadowRegion=NULL;
|
williamr@2
|
115 |
}
|
williamr@2
|
116 |
}
|
williamr@2
|
117 |
private:
|
williamr@2
|
118 |
mutable const TRegionPair* iRegionPair;
|
williamr@2
|
119 |
TAny *iFree2;
|
williamr@2
|
120 |
friend class CWsAnim;
|
williamr@2
|
121 |
};
|
williamr@2
|
122 |
|
williamr@2
|
123 |
|
williamr@2
|
124 |
class MEventHandler
|
williamr@2
|
125 |
/** Event handler interface.
|
williamr@2
|
126 |
|
williamr@2
|
127 |
The interface provides a function to handle raw events, e.g. key presses,
|
williamr@2
|
128 |
pen events, power buttons etc. Raw events are passed to the OfferRawEvent()
|
williamr@2
|
129 |
function when the MAnimGeneralFunctions::GetRawEvents() function has been
|
williamr@2
|
130 |
called.
|
williamr@2
|
131 |
|
williamr@2
|
132 |
@publishedAll
|
williamr@2
|
133 |
@released */
|
williamr@2
|
134 |
{
|
williamr@2
|
135 |
public:
|
williamr@2
|
136 |
/** Handles raw events.
|
williamr@2
|
137 |
|
williamr@2
|
138 |
If the incoming event can be handled, the function should
|
williamr@2
|
139 |
process it and then return true. If it cannot be processed the function should
|
williamr@2
|
140 |
return false, and the event will be passed to other event handling code.
|
williamr@2
|
141 |
|
williamr@2
|
142 |
This function must be implemented in every animation DLL. If event
|
williamr@2
|
143 |
handling is not required, the function should simply return false.
|
williamr@2
|
144 |
|
williamr@2
|
145 |
@param aRawEvent The raw event to be processed
|
williamr@2
|
146 |
@return ETrue if the raw event is handled by this function, EFalse if the function
|
williamr@2
|
147 |
chooses not to process it. */
|
williamr@2
|
148 |
virtual TBool OfferRawEvent(const TRawEvent &aRawEvent)=0;
|
williamr@2
|
149 |
};
|
williamr@2
|
150 |
|
williamr@2
|
151 |
enum TAnimNotifications
|
williamr@2
|
152 |
/** Bit flags to be used by anims when registering for notifications */
|
williamr@2
|
153 |
{
|
williamr@2
|
154 |
/** Notify when direct screen access begins or ends.*/
|
williamr@2
|
155 |
EDirectScreenAccess = 0x0001,
|
williamr@2
|
156 |
/** Notify when the wserv heartbeat timer starts or stops. */
|
williamr@2
|
157 |
EHeartbeatTimer = 0x0002,
|
williamr@2
|
158 |
/** Notify when screen device changes.*/
|
williamr@2
|
159 |
EScreenDeviceChange = 0x0004
|
williamr@2
|
160 |
};
|
williamr@2
|
161 |
//Forward Declaration.
|
williamr@2
|
162 |
class MAnimGeneralFunctionsWindowExtension;
|
williamr@2
|
163 |
class MAnimGeneralFunctionsEventExtension ;
|
williamr@2
|
164 |
|
williamr@2
|
165 |
class MAnimGeneralFunctions
|
williamr@2
|
166 |
/** General animation utility functions interface.
|
williamr@2
|
167 |
|
williamr@2
|
168 |
The interface provides functions to set the animation timing,
|
williamr@2
|
169 |
event functions, and other general functions.
|
williamr@2
|
170 |
|
williamr@2
|
171 |
You do not have to create an object of this type. The class is implemented
|
williamr@2
|
172 |
by the window server and provides utility functions to all CAnim-derived
|
williamr@2
|
173 |
classes via the CAnim::iFunctions pointer.
|
williamr@2
|
174 |
|
williamr@2
|
175 |
It is not intended for user derivation.
|
williamr@2
|
176 |
|
williamr@2
|
177 |
@publishedAll
|
williamr@2
|
178 |
@released */
|
williamr@2
|
179 |
{
|
williamr@2
|
180 |
public:
|
williamr@2
|
181 |
/** Animation synchronisation flags.
|
williamr@2
|
182 |
|
williamr@2
|
183 |
The animation can be synchronised to any of these values;
|
williamr@2
|
184 |
the Animate() call will take place at the start of the new unit (day, hour, etc...). */
|
williamr@2
|
185 |
enum TAnimSync
|
williamr@2
|
186 |
{
|
williamr@2
|
187 |
/** Not synchronised. Animate() is called after some number of flash cycles -
|
williamr@2
|
188 |
set by SetSync(). */
|
williamr@2
|
189 |
ESyncNone,
|
williamr@2
|
190 |
/** Animate() every flash tick. This occurs twice a second, on the second and after
|
williamr@2
|
191 |
7/12ths of a second, e.g. the function is called in a flash-on (7/12 seconds) -
|
williamr@2
|
192 |
flash-off (5/12 seconds) cycle. */
|
williamr@2
|
193 |
ESyncFlash,
|
williamr@2
|
194 |
/** Animate() called as soon after every second as system activity allows. */
|
williamr@2
|
195 |
ESyncSecond,
|
williamr@2
|
196 |
/** Animate() called as soon after every minute as system activity allows. */
|
williamr@2
|
197 |
ESyncMinute,
|
williamr@2
|
198 |
/** Animate() called as soon after midnight every day as system activity allows. */
|
williamr@2
|
199 |
ESyncDay,
|
williamr@2
|
200 |
};
|
williamr@2
|
201 |
enum
|
williamr@2
|
202 |
{
|
williamr@2
|
203 |
ENumberOfExtendedInterfaces=0,
|
williamr@2
|
204 |
EWindowExtensionInterface,
|
williamr@2
|
205 |
EEventExtentionInterface,
|
williamr@2
|
206 |
EInterfaceCount, // Always keep at the end.
|
williamr@2
|
207 |
};
|
williamr@2
|
208 |
//Timing functions
|
williamr@2
|
209 |
/** Calls the DLL's Animate() function then deactivates the graphics context.
|
williamr@2
|
210 |
|
williamr@2
|
211 |
This allows users to do drawing from their own active object.
|
williamr@2
|
212 |
|
williamr@2
|
213 |
Note:
|
williamr@2
|
214 |
|
williamr@2
|
215 |
If the user calls the CAnim-derived classes' Animate() function directly,
|
williamr@2
|
216 |
or otherwise does drawing from their own active object, then this will not
|
williamr@2
|
217 |
deactivate the graphics context. This causes the window server to panic the
|
williamr@2
|
218 |
client.
|
williamr@2
|
219 |
|
williamr@2
|
220 |
Alternatively, use CFreeTimerWindowAnim, which allows you to deactivate the
|
williamr@2
|
221 |
graphics context yourself.
|
williamr@2
|
222 |
|
williamr@2
|
223 |
@param aDateTime The parameter passed into the animation DLL's Animate()
|
williamr@2
|
224 |
function. */
|
williamr@2
|
225 |
virtual void Animate(TDateTime *aDateTime)=0;
|
williamr@2
|
226 |
/** Sets the synchronisation mode.
|
williamr@2
|
227 |
|
williamr@2
|
228 |
This determines the time intervals between calls to the Animate() function.
|
williamr@2
|
229 |
|
williamr@2
|
230 |
@param aSyncMode The synchronisation mode. */
|
williamr@2
|
231 |
virtual void SetSync(TAnimSync aSyncMode)=0;
|
williamr@2
|
232 |
/** Sets the repeat interval.
|
williamr@2
|
233 |
|
williamr@2
|
234 |
If the synchronisation mode is TAnimSync::ESyncNone, then the Animate() function
|
williamr@2
|
235 |
is called at intervals defined by some number of flash ticks. There are two
|
williamr@2
|
236 |
flash ticks a second, with a 7/12 second - 5/12 second cycle. If the function
|
williamr@2
|
237 |
is called when the synchronisation mode is not TAnimSync::ESyncNone, then
|
williamr@2
|
238 |
the window server panics the client.
|
williamr@2
|
239 |
|
williamr@2
|
240 |
If the new interval is greater than the current countdown, then the call does
|
williamr@2
|
241 |
not affect the current countdown. For example, if the countdown has 10 flash
|
williamr@2
|
242 |
ticks remaining, and the interval is set to 20, the new interval does not
|
williamr@2
|
243 |
apply until the current countdown is complete.
|
williamr@2
|
244 |
|
williamr@2
|
245 |
However if the new interval is less the current countdown, then the new interval
|
williamr@2
|
246 |
applies immediately i.e. the countdown is reset to the interval value.
|
williamr@2
|
247 |
|
williamr@2
|
248 |
If the interval is set to zero the countdown stops, and the Animate() function
|
williamr@2
|
249 |
is no longer called.
|
williamr@2
|
250 |
|
williamr@2
|
251 |
@param aInterval The number of flash ticks between calls to the Animate()
|
williamr@2
|
252 |
function. */
|
williamr@2
|
253 |
virtual void SetInterval(TInt aInterval)=0;
|
williamr@2
|
254 |
/** Sets the next interval.
|
williamr@2
|
255 |
|
williamr@2
|
256 |
This function immediately resets the current countdown to the specified number
|
williamr@2
|
257 |
of flash ticks, irrespective of its current value. After the countdown expires,
|
williamr@2
|
258 |
the interval returns to its usual rate. Note that this may be zero (i.e.
|
williamr@2
|
259 |
not at all).
|
williamr@2
|
260 |
|
williamr@2
|
261 |
To call this function, the synchronisation mode must be TAnimSync::ESyncNone,
|
williamr@2
|
262 |
otherwise the window server panics the client.
|
williamr@2
|
263 |
|
williamr@2
|
264 |
Note: there are two flash ticks a second, with a 7/12 second - 5/12 second cycle.
|
williamr@2
|
265 |
|
williamr@2
|
266 |
@param aInterval The interval to the next Animate(). If the value is less
|
williamr@2
|
267 |
than 1, it automatically gets set to 1.
|
williamr@2
|
268 |
@see SetInterval() */
|
williamr@2
|
269 |
virtual void SetNextInterval(TInt aInterval)=0;
|
williamr@2
|
270 |
/** Gets the system time as it was when Animate() was last called.
|
williamr@2
|
271 |
|
williamr@2
|
272 |
@return The system time when Animate() was last called. */
|
williamr@2
|
273 |
virtual TDateTime SystemTime() const=0;
|
williamr@2
|
274 |
/** Tests the flash cycle state.
|
williamr@2
|
275 |
|
williamr@2
|
276 |
The flash cycle has 2 states: on (7/12 second) or off (5/12 second).
|
williamr@2
|
277 |
|
williamr@2
|
278 |
@return ETrue if in the on part of the flash cycle, otherwise EFalse. */
|
williamr@2
|
279 |
virtual TBool FlashStateOn() const=0;
|
williamr@2
|
280 |
/** Gets the current synchronisation mode.
|
williamr@2
|
281 |
|
williamr@2
|
282 |
@return The current sync mode. */
|
williamr@2
|
283 |
virtual TAnimSync Sync() const=0;
|
williamr@2
|
284 |
//Other functions generally useful
|
williamr@2
|
285 |
/** Gets a pointer to the screen device.
|
williamr@2
|
286 |
|
williamr@2
|
287 |
For example, this might be used to gain access to twips to pixel conversion functions.
|
williamr@2
|
288 |
|
williamr@2
|
289 |
@return A pointer to the screen device. */
|
williamr@2
|
290 |
virtual const CFbsScreenDevice *ScreenDevice()=0;
|
williamr@2
|
291 |
/** Creates and duplicates a bitmap from a handle.
|
williamr@2
|
292 |
|
williamr@2
|
293 |
This function might be used to duplicate client side bitmaps on the server side.
|
williamr@2
|
294 |
|
williamr@2
|
295 |
@param aHandle A handle to the bitmap to be duplicated.
|
williamr@2
|
296 |
@return A pointer to the duplicate bitmap. */
|
williamr@2
|
297 |
virtual CFbsBitmap *DuplicateBitmapL(TInt aHandle)=0;
|
williamr@2
|
298 |
/** Creates and duplicates a font from a handle.
|
williamr@2
|
299 |
|
williamr@2
|
300 |
This function might be used to duplicate client side fonts on the server side.
|
williamr@2
|
301 |
|
williamr@2
|
302 |
@param aHandle A handle to the font to be duplicated.
|
williamr@2
|
303 |
@return A pointer to the duplicate font. */
|
williamr@2
|
304 |
virtual CFbsFont *DuplicateFontL(TInt aHandle)=0;
|
williamr@2
|
305 |
/** Closes a duplicate font.
|
williamr@2
|
306 |
|
williamr@2
|
307 |
@param Pointer to the duplicate font.
|
williamr@2
|
308 |
@see DuplicateFontL() */
|
williamr@2
|
309 |
virtual void CloseFont(CFbsFont *)=0;
|
williamr@2
|
310 |
/** Gets a reference to the calling client's thread.
|
williamr@2
|
311 |
|
williamr@2
|
312 |
@return A reference to the calling client's thread. */
|
williamr@2
|
313 |
virtual const RThread &Client()=0;
|
williamr@2
|
314 |
virtual void ReplyBuf(const TDesC8 &aDes)=0; // Reply a buffer to the client
|
williamr@2
|
315 |
virtual void ReplyBuf(const TDesC16 &aDes)=0; // Reply a buffer to the client
|
williamr@2
|
316 |
/** Panics the client.
|
williamr@2
|
317 |
|
williamr@2
|
318 |
This will result in the client thread being destroyed. */
|
williamr@2
|
319 |
virtual void Panic() const=0;
|
williamr@2
|
320 |
//Event functions
|
williamr@2
|
321 |
/** Switches animation raw event handling on and off.
|
williamr@2
|
322 |
|
williamr@2
|
323 |
If raw event handling is switched on, then raw events, e.g. pointer, key, or power events
|
williamr@2
|
324 |
are all offered to the animation event handling code's MEventHandler::OfferRawEvent().
|
williamr@2
|
325 |
|
williamr@2
|
326 |
@param aGetEvents If ETrue, raw events are passed to the animation
|
williamr@2
|
327 |
event handling code. If EFalse, events are not passed to the animation. */
|
williamr@2
|
328 |
virtual void GetRawEvents(TBool aGetEvents) const=0;
|
williamr@2
|
329 |
/** Posts a raw event, just as if it had come from the kernel.
|
williamr@2
|
330 |
|
williamr@2
|
331 |
@param aRawEvent The raw event */
|
williamr@2
|
332 |
virtual void PostRawEvent(const TRawEvent &aRawEvent) const=0;
|
williamr@2
|
333 |
/** Posts a key event.
|
williamr@2
|
334 |
|
williamr@2
|
335 |
The function is similar to PostRawEvent() but should be
|
williamr@2
|
336 |
used for posting key events.
|
williamr@2
|
337 |
|
williamr@2
|
338 |
@param aRawEvent The key event. */
|
williamr@2
|
339 |
virtual void PostKeyEvent(const TKeyEvent &aRawEvent) const=0;
|
williamr@2
|
340 |
/** Get the address of an object which can retrieve information from and send
|
williamr@2
|
341 |
information to the client-side.
|
williamr@2
|
342 |
|
williamr@2
|
343 |
@return A pointer to RMessagePtr2. Complete must be called on the returned object (or a
|
williamr@2
|
344 |
copy of it) if and only if Message is called from an override of CAnim's CommandReplyL which
|
williamr@2
|
345 |
has been caused by a client-side RAnim::AsyncCommandReply call. If Message is called outside
|
williamr@2
|
346 |
an override of CAnim's CommandReplyL or outside an override of CWindowAnim's ConstructL or
|
williamr@2
|
347 |
CSpriteAnim's ConstructL, the it returns NULL.
|
williamr@2
|
348 |
@see RMessagePtr2 */
|
williamr@2
|
349 |
virtual const RMessagePtr2* Message()=0; // replaces Reserved1
|
williamr@2
|
350 |
/**Returns an extension interface, maybe extended further in the future.
|
williamr@2
|
351 |
@param aInterfaceId The ID of the interface to return.
|
williamr@2
|
352 |
@return A pointer to the extension interface.
|
williamr@2
|
353 |
When aInterface=0 (ENumberOfExtendedInterfaces), the number of interfaces is returned (currently 2).
|
williamr@2
|
354 |
When aInterface=1 (EWindowExtensionInterface), a pointer to the Window Extension interface is returned.
|
williamr@2
|
355 |
When aInterface=2 (EEventExtentionInterface), a pointer to the Event Extension interface is returned.
|
williamr@2
|
356 |
*/
|
williamr@2
|
357 |
virtual TAny* ExtendedInterface(TInt aInterface)=0; // replaces Reserved2
|
williamr@2
|
358 |
|
williamr@2
|
359 |
/** Register to receive notifications.
|
williamr@2
|
360 |
@param aNotifications A bitset of TAnimNotifications values indicating which notifications are required
|
williamr@2
|
361 |
@return One of the system wide error codes
|
williamr@2
|
362 |
*/
|
williamr@2
|
363 |
virtual TInt RegisterForNotifications(TUint32 aNotifications)=0;
|
williamr@2
|
364 |
/*
|
williamr@2
|
365 |
Return number of ExtendedInterfaces. */
|
williamr@2
|
366 |
inline TInt NumberOfExtendedInterfaces()
|
williamr@2
|
367 |
{
|
williamr@2
|
368 |
return reinterpret_cast<TInt>(ExtendedInterface(ENumberOfExtendedInterfaces));
|
williamr@2
|
369 |
}
|
williamr@2
|
370 |
/** Gets access to Window Extension utility functions.
|
williamr@2
|
371 |
@return A pointer to a class containing functions for working with Window. */
|
williamr@2
|
372 |
inline MAnimGeneralFunctionsWindowExtension* WindowExtension()
|
williamr@2
|
373 |
{
|
williamr@2
|
374 |
return static_cast<MAnimGeneralFunctionsWindowExtension*>(ExtendedInterface(EWindowExtensionInterface));
|
williamr@2
|
375 |
}
|
williamr@2
|
376 |
/** Gets access to EventExtension utility functions.
|
williamr@2
|
377 |
@return A pointer to a class containing functions for working with Event. */
|
williamr@2
|
378 |
inline MAnimGeneralFunctionsEventExtension* EventExtension()
|
williamr@2
|
379 |
{
|
williamr@2
|
380 |
return static_cast<MAnimGeneralFunctionsEventExtension*>(ExtendedInterface(EEventExtentionInterface));
|
williamr@2
|
381 |
}
|
williamr@2
|
382 |
private:
|
williamr@2
|
383 |
virtual void Reserved1() const;
|
williamr@2
|
384 |
virtual void Reserved2() const;
|
williamr@2
|
385 |
virtual void Reserved3() const;
|
williamr@2
|
386 |
};
|
williamr@2
|
387 |
|
williamr@2
|
388 |
/* Structure for passing window configuration information. Currently transparancey
|
williamr@2
|
389 |
related configuration information is supported, though this may be added to, as
|
williamr@2
|
390 |
apprioriate.
|
williamr@2
|
391 |
|
williamr@2
|
392 |
@publishedAll
|
williamr@2
|
393 |
@released
|
williamr@2
|
394 |
*/
|
williamr@2
|
395 |
class TWindowConfig
|
williamr@2
|
396 |
{
|
williamr@2
|
397 |
public:
|
williamr@2
|
398 |
/** Transparency flags.
|
williamr@2
|
399 |
|
williamr@2
|
400 |
Used to represent transparency configuration of the window. */
|
williamr@2
|
401 |
enum
|
williamr@2
|
402 |
{
|
williamr@2
|
403 |
/** Transparency is enabled on the window. */
|
williamr@2
|
404 |
ETransparencyEnabled=0x0001,
|
williamr@2
|
405 |
/** Window transparency uses alpha blending channel. */
|
williamr@2
|
406 |
EAlphaBlendedTransparency=0x0002,
|
williamr@2
|
407 |
};
|
williamr@2
|
408 |
public:
|
williamr@2
|
409 |
/** Indicate configuration of window, using enumerations defined within this class. */
|
williamr@2
|
410 |
TInt iFlags;
|
williamr@2
|
411 |
private:
|
williamr@2
|
412 |
TInt iReserved0;
|
williamr@2
|
413 |
TInt iReserved1;
|
williamr@2
|
414 |
TInt iReserved2;
|
williamr@2
|
415 |
};
|
williamr@2
|
416 |
|
williamr@2
|
417 |
class MAnimGeneralFunctionsWindowExtension
|
williamr@2
|
418 |
/** General Window utility functions interface.
|
williamr@2
|
419 |
|
williamr@2
|
420 |
The member functions define the interface for querying and manipulating
|
williamr@2
|
421 |
the window and screen attributes.
|
williamr@2
|
422 |
|
williamr@2
|
423 |
You obtain one by calling: iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface)
|
williamr@2
|
424 |
and casting the result.
|
williamr@2
|
425 |
|
williamr@2
|
426 |
It is not intended for user derivation.
|
williamr@2
|
427 |
|
williamr@2
|
428 |
@publishedAll
|
williamr@2
|
429 |
@released */
|
williamr@2
|
430 |
{
|
williamr@2
|
431 |
public:
|
williamr@2
|
432 |
/** Class contains the information pertaining to a window group: name, priority,
|
williamr@2
|
433 |
focusability. */
|
williamr@2
|
434 |
class TWindowGroupInfo
|
williamr@2
|
435 |
{
|
williamr@2
|
436 |
public:
|
williamr@2
|
437 |
enum
|
williamr@2
|
438 |
{
|
williamr@2
|
439 |
/** Window is focusable flag. */
|
williamr@2
|
440 |
EIsFocusable=0x0001,
|
williamr@2
|
441 |
};
|
williamr@2
|
442 |
public:
|
williamr@2
|
443 |
/** Returns whether or not the window is focusable.
|
williamr@2
|
444 |
@return ETrue if focusable, else returns EFalse. */
|
williamr@2
|
445 |
inline TBool IsFocusable() const {return iFlags&EIsFocusable;}
|
williamr@2
|
446 |
public:
|
williamr@2
|
447 |
/* Window group attributes. */
|
williamr@2
|
448 |
TInt iId;
|
williamr@2
|
449 |
TUint32 iFlags;
|
williamr@2
|
450 |
TInt iOrdinalPriority;
|
williamr@2
|
451 |
TInt iNameLength;
|
williamr@2
|
452 |
TInt iParentId;
|
williamr@2
|
453 |
};
|
williamr@2
|
454 |
public:
|
williamr@2
|
455 |
/** Returns the total number of screens.
|
williamr@2
|
456 |
@return The total number of screens. */
|
williamr@2
|
457 |
virtual TInt Screens() const=0;
|
williamr@2
|
458 |
|
williamr@2
|
459 |
/** Returns the number of the screen which is currently in focus.
|
williamr@2
|
460 |
@return The number of the screen which is currently in focus.*/
|
williamr@2
|
461 |
virtual TInt FocusScreens() const=0;
|
williamr@2
|
462 |
|
williamr@2
|
463 |
/** Changes the focused screen.
|
williamr@2
|
464 |
@param aScreenNo New screen number. */
|
williamr@2
|
465 |
virtual void SetFocusScreen(TInt aScreenNo)=0;
|
williamr@2
|
466 |
|
williamr@2
|
467 |
/** Returns the number of window groups available for the specified screen.
|
williamr@2
|
468 |
|
williamr@2
|
469 |
@param aScreen The screen number.
|
williamr@2
|
470 |
@return The number of window groups. */
|
williamr@2
|
471 |
virtual TInt WindowGroups(TInt aScreen) const=0;
|
williamr@2
|
472 |
|
williamr@2
|
473 |
/** Takes a screen number and an ordinal position and returns the complete window
|
williamr@2
|
474 |
group information of the specified window. If the window group does not exist, the
|
williamr@2
|
475 |
function returns EFalse.
|
williamr@2
|
476 |
|
williamr@2
|
477 |
Note: the ordinal position specified should be the total or full ordinal position
|
williamr@2
|
478 |
of all group windows of all priorities on that screen.
|
williamr@2
|
479 |
|
williamr@2
|
480 |
@param aInfo on return, complete window information.
|
williamr@2
|
481 |
@param aScreen Screen number.
|
williamr@2
|
482 |
@param aFullOrdinalPosition Ordinal position of the window.
|
williamr@2
|
483 |
@return ETrue if window group information exists, EFalse otherwise. */
|
williamr@2
|
484 |
virtual TBool WindowGroupInfo(TWindowGroupInfo& aInfo,TInt aScreen,TInt aFullOrdinalPosition) const=0;
|
williamr@2
|
485 |
|
williamr@2
|
486 |
/** Takes a screen number and an ordinal position and returns the window group name.
|
williamr@2
|
487 |
If the window group does not exist, the function returns false.
|
williamr@2
|
488 |
|
williamr@2
|
489 |
Note: the ordinal position specified should be the total or full ordinal position of
|
williamr@2
|
490 |
all group windows of all priorities on that screen.
|
williamr@2
|
491 |
|
williamr@2
|
492 |
Note: if the name does not fit into the descriptor provided then it will be truncated.
|
williamr@2
|
493 |
|
williamr@2
|
494 |
@param aWindowName On return, the window group name.
|
williamr@2
|
495 |
@param aScreen The screen number.
|
williamr@2
|
496 |
@param aFullOrdinalPosition The ordinal position of the window.
|
williamr@2
|
497 |
@return ETrue if the window group name exists, EFalse otherwise. */
|
williamr@2
|
498 |
virtual TBool WindowGroupName(TPtrC& aWindowName,TInt aScreen,TInt aFullOrdinalPosition) const=0;
|
williamr@2
|
499 |
|
williamr@2
|
500 |
/** Changes the ordinal position and priority of the window group with the specified ID.
|
williamr@2
|
501 |
|
williamr@2
|
502 |
@param aWindowGroupId The window group ID.
|
williamr@2
|
503 |
@param aPos The ordinal position to move the window to.
|
williamr@2
|
504 |
@param aOrdinalPriority The new ordinal priority of the window.
|
williamr@2
|
505 |
@return KErrNotFound if there is no window group with the specified ID, KErrNone otherwise. */
|
williamr@2
|
506 |
virtual TInt SetOrdinalPosition(TInt aWindowGroupId,TInt aPos,TInt aOrdinalPriority)=0;
|
williamr@2
|
507 |
|
williamr@2
|
508 |
/** Accessor for window configuration.
|
williamr@2
|
509 |
|
williamr@2
|
510 |
@param aWindowConfig Gets filled in with window configuration details. */
|
williamr@2
|
511 |
virtual void WindowConfig(TWindowConfig& aWindowConfig) const=0;
|
williamr@2
|
512 |
|
williamr@2
|
513 |
private:
|
williamr@2
|
514 |
virtual void Reserved1() const;
|
williamr@2
|
515 |
virtual void Reserved2() const;
|
williamr@2
|
516 |
virtual void Reserved3() const;
|
williamr@2
|
517 |
};
|
williamr@2
|
518 |
|
williamr@2
|
519 |
class MAnimGeneralFunctionsEventExtension
|
williamr@2
|
520 |
/** Event utility functions interface.
|
williamr@2
|
521 |
|
williamr@2
|
522 |
The member functions define the interface for generate repeated key events .
|
williamr@2
|
523 |
|
williamr@2
|
524 |
It is not intended for user derivation.
|
williamr@2
|
525 |
*/
|
williamr@2
|
526 |
{
|
williamr@2
|
527 |
public:
|
williamr@2
|
528 |
/** Posts a key event.
|
williamr@2
|
529 |
|
williamr@2
|
530 |
The function is similar to PostKeyEvent() but should be
|
williamr@2
|
531 |
used for posting repeated key events.
|
williamr@2
|
532 |
|
williamr@2
|
533 |
@param aRawEvent The key event.
|
williamr@2
|
534 |
@param aRepeats value */
|
williamr@2
|
535 |
virtual void PostKeyEvent(const TKeyEvent& aRawEvent, TInt aRepeats) const=0;
|
williamr@2
|
536 |
|
williamr@2
|
537 |
private:
|
williamr@2
|
538 |
virtual void Reserved1() const;
|
williamr@2
|
539 |
virtual void Reserved2() const;
|
williamr@2
|
540 |
};
|
williamr@2
|
541 |
|
williamr@2
|
542 |
class MAnimWindowFunctions
|
williamr@2
|
543 |
/** Window utility functions interface.
|
williamr@2
|
544 |
|
williamr@2
|
545 |
The member functions define the interface for querying and manipulating
|
williamr@2
|
546 |
the window in which the animation takes place.
|
williamr@2
|
547 |
|
williamr@2
|
548 |
You do not have to create an object of this type. The class is implemented
|
williamr@2
|
549 |
by the window server, and provides these utility functions to all CWindowAnim
|
williamr@2
|
550 |
and CFreeTimerWindowAnim derived classes via the iWindowFunctions pointer.
|
williamr@2
|
551 |
|
williamr@2
|
552 |
It is not intended for user derivation.
|
williamr@2
|
553 |
|
williamr@2
|
554 |
@publishedAll
|
williamr@2
|
555 |
@released */
|
williamr@2
|
556 |
{
|
williamr@2
|
557 |
public:
|
williamr@2
|
558 |
/** Activates the graphics context.
|
williamr@2
|
559 |
|
williamr@2
|
560 |
This function should be called to enable drawing in the CAnim-derived classes'
|
williamr@2
|
561 |
Command(), CommandReplyL(), Animate(), or FocusChanged() functions.
|
williamr@2
|
562 |
|
williamr@2
|
563 |
Note: this function is called automatically by the animation DLL framework in the
|
williamr@2
|
564 |
Redraw() function. */
|
williamr@2
|
565 |
virtual void ActivateGc()=0;
|
williamr@2
|
566 |
/** Sets the rectangle that this animation is to draw to.
|
williamr@2
|
567 |
|
williamr@2
|
568 |
This function must be called as part of the initialisation/construction of
|
williamr@2
|
569 |
the CAnim-derived object, i.e. in CAnim::ConstructL(). This is so that the
|
williamr@2
|
570 |
window server knows which area the animation is operating in.
|
williamr@2
|
571 |
|
williamr@2
|
572 |
@param aRect The rectangle to be drawn to. */
|
williamr@2
|
573 |
virtual void SetRect(const TRect &aRect)=0;
|
williamr@2
|
574 |
/** Gets the window size.
|
williamr@2
|
575 |
|
williamr@2
|
576 |
@return The window size, in pixels. */
|
williamr@2
|
577 |
virtual TSize WindowSize() const=0;
|
williamr@2
|
578 |
/** Tests whether to draw the animation.
|
williamr@2
|
579 |
|
williamr@2
|
580 |
If the window is completely hidden, there is normally no need to draw
|
williamr@2
|
581 |
the animation. However in some conditions the animation should be drawn even
|
williamr@2
|
582 |
if it is obscured. The window server is aware of these cases, and returns
|
williamr@2
|
583 |
ETrue if it is not safe to draw the animation.
|
williamr@2
|
584 |
|
williamr@2
|
585 |
@return True if the window is completely hidden and there is no requirement
|
williamr@2
|
586 |
to continue drawing the animation, otherwise false. */
|
williamr@2
|
587 |
virtual TBool IsHidden()=0;
|
williamr@2
|
588 |
/** Sets the visibility of the window the animation is drawing to.
|
williamr@2
|
589 |
|
williamr@2
|
590 |
This does the same as RWindowBase::SetVisible().
|
williamr@2
|
591 |
|
williamr@2
|
592 |
@param aState True for visible, false otherwise. */
|
williamr@2
|
593 |
virtual void SetVisible(TBool aState)=0;
|
williamr@2
|
594 |
/** Forces a redraw of a rectangular part of the window.
|
williamr@2
|
595 |
|
williamr@2
|
596 |
The function causes a redraw message on the part of the window specified,
|
williamr@2
|
597 |
which provides a non-immediate way to do drawing.
|
williamr@2
|
598 |
|
williamr@2
|
599 |
It can be used to redraw the whole of the window, not just the part used by
|
williamr@2
|
600 |
the animation.
|
williamr@2
|
601 |
|
williamr@2
|
602 |
@param aRect The rectangle to be redrawn. These co-ordinates are relative
|
williamr@2
|
603 |
to the origin of the window. */
|
williamr@2
|
604 |
virtual void Invalidate(const TRect &aRect)=0;
|
williamr@2
|
605 |
/** Gets window information.
|
williamr@2
|
606 |
|
williamr@2
|
607 |
@param aData The window information. */
|
williamr@2
|
608 |
virtual void Parameters(TWindowInfo &aData)=0;
|
williamr@2
|
609 |
/** Gets the visible region.
|
williamr@2
|
610 |
|
williamr@2
|
611 |
This region is the area of the visible window which
|
williamr@2
|
612 |
is currently unshadowed. If there is not enough memory to calculate this region
|
williamr@2
|
613 |
then aRegion's error flag is set.
|
williamr@2
|
614 |
|
williamr@2
|
615 |
@param aRegion The visible region. */
|
williamr@2
|
616 |
virtual void VisibleRegion(TRegion& aRegion)=0;
|
williamr@2
|
617 |
//virtual void CopyScreen(CFbsBitGc *aBitmapGc,TRect aRect)=0;
|
williamr@2
|
618 |
private:
|
williamr@2
|
619 |
virtual void Reserved() const;
|
williamr@2
|
620 |
virtual void Reserved1() const;
|
williamr@2
|
621 |
virtual void Reserved2() const;
|
williamr@2
|
622 |
virtual void Reserved3() const;
|
williamr@2
|
623 |
};
|
williamr@2
|
624 |
|
williamr@2
|
625 |
|
williamr@2
|
626 |
class MAnimFreeTimerWindowFunctions : public MAnimWindowFunctions
|
williamr@2
|
627 |
/** Free timer animation utility functions interface.
|
williamr@2
|
628 |
|
williamr@2
|
629 |
The class inherits functions from MAnimWindowFunctions, and defines the additional
|
williamr@2
|
630 |
interface required for window operations which support animations with their
|
williamr@2
|
631 |
own timers.
|
williamr@2
|
632 |
|
williamr@2
|
633 |
You do NOT have to create an object of this type. The class is implemented
|
williamr@2
|
634 |
by the window server, and provides utility functions to all CFreeTimerWindowAnim
|
williamr@2
|
635 |
derived classes via the WindowFunctions() member.
|
williamr@2
|
636 |
|
williamr@2
|
637 |
It is not intended for user derivation.
|
williamr@2
|
638 |
|
williamr@2
|
639 |
@publishedAll
|
williamr@2
|
640 |
@released */
|
williamr@2
|
641 |
{
|
williamr@2
|
642 |
public:
|
williamr@2
|
643 |
/** Deactivates the graphics context.
|
williamr@2
|
644 |
|
williamr@2
|
645 |
This function is used in the context of a CFreeTimerWindowAnim derived class
|
williamr@2
|
646 |
when writing animation DLLs with their own timer. Within the timer's RunL(),
|
williamr@2
|
647 |
the ActivateGc() function should be called prior to drawing to the window.
|
williamr@2
|
648 |
DeactivateGc() should be called after drawing is finished. */
|
williamr@2
|
649 |
virtual void DeactivateGc()=0;
|
williamr@2
|
650 |
/** Forces the screen to update. */
|
williamr@2
|
651 |
virtual void Update()=0;
|
williamr@2
|
652 |
private:
|
williamr@2
|
653 |
virtual void Reserved3() const;
|
williamr@2
|
654 |
};
|
williamr@2
|
655 |
|
williamr@2
|
656 |
class MAnimSpriteFunctions
|
williamr@2
|
657 |
/** Sprite animation utility functions interface.
|
williamr@2
|
658 |
|
williamr@2
|
659 |
The interface includes functions for querying and manipulating a sprite.
|
williamr@2
|
660 |
|
williamr@2
|
661 |
You do NOT have to create an object of this type. The class is implemented
|
williamr@2
|
662 |
by the window server, and provides utility functions to all CSpriteAnim derived
|
williamr@2
|
663 |
classes via the CSpriteAnim::iSpriteFunctions pointer.
|
williamr@2
|
664 |
|
williamr@2
|
665 |
It is not intended for user derivation.
|
williamr@2
|
666 |
|
williamr@2
|
667 |
@publishedAll
|
williamr@2
|
668 |
@released */
|
williamr@2
|
669 |
{
|
williamr@2
|
670 |
public:
|
williamr@2
|
671 |
/** Gets sprite member data.
|
williamr@2
|
672 |
|
williamr@2
|
673 |
Each member of the sprite is effectively a bitmap, which is displayed for a
|
williamr@2
|
674 |
different amount of time.
|
williamr@2
|
675 |
|
williamr@2
|
676 |
@param aMember The index of the sprite member for which information is required.
|
williamr@2
|
677 |
@return A pointer to the sprite member. */
|
williamr@2
|
678 |
virtual TSpriteMember *GetSpriteMember(TInt aMember) const=0;
|
williamr@2
|
679 |
/** Redraws part of a sprite.
|
williamr@2
|
680 |
|
williamr@2
|
681 |
WSERV1:
|
williamr@2
|
682 |
|
williamr@2
|
683 |
The updates a sprite on the screen, possibly after the bitmap for a particular
|
williamr@2
|
684 |
sprite member has been changed.
|
williamr@2
|
685 |
|
williamr@2
|
686 |
Two types of redraw are possible. A full update takes the bitmap off the screen
|
williamr@2
|
687 |
and then re-draws it. This is 'safe' in that the screen always reflects
|
williamr@2
|
688 |
the contents of the sprite bitmap. However it can result in flicker. Use the
|
williamr@2
|
689 |
aRect parameter to specify the (small) part of the sprite which has been changed,
|
williamr@2
|
690 |
then any flicker will only occur in this rectangle.
|
williamr@2
|
691 |
|
williamr@2
|
692 |
A full update is required if you have removed pixels from the mask, i.e. made
|
williamr@2
|
693 |
pixels in the sprite transparent when they were not before. If drawing is
|
williamr@2
|
694 |
additive, e.g. you are using a mask or the draw mode is EDrawModePEN, a partial
|
williamr@2
|
695 |
update is possible. Otherwise the aFullUpdate argument is ignored and a full
|
williamr@2
|
696 |
update is always done.
|
williamr@2
|
697 |
|
williamr@2
|
698 |
Note: if the sprite member aMember is not visible then there is no need for a change
|
williamr@2
|
699 |
to the display, so the aRect and aFullUpdate parameters are ignored.
|
williamr@2
|
700 |
|
williamr@2
|
701 |
param aMember The index of the sprite member that is to be updated.
|
williamr@2
|
702 |
param aRect The part of the sprite member which has changed.
|
williamr@2
|
703 |
param aFullUpdate ETrue for a full update, EFalse otherwise.
|
williamr@2
|
704 |
|
williamr@2
|
705 |
WSERV2:
|
williamr@2
|
706 |
|
williamr@2
|
707 |
Updates a sprite on the screen, possibly after the bitmap for a particular
|
williamr@2
|
708 |
sprite member has been changed.
|
williamr@2
|
709 |
|
williamr@2
|
710 |
Use the aRect parameter to specify the (small) part of the sprite which has been changed,
|
williamr@2
|
711 |
then any flicker will only occur in this rectangle.
|
williamr@2
|
712 |
|
williamr@2
|
713 |
A full update used to be required if you had removed pixels from the mask, i.e. made
|
williamr@2
|
714 |
pixels in the sprite transparent when they were not before. If drawing is
|
williamr@2
|
715 |
additive, e.g. you are using a mask or the draw mode is EDrawModePEN, a partial
|
williamr@2
|
716 |
update used to be possible. But newer versions of the window-server always do full back to front rendering.
|
williamr@2
|
717 |
|
williamr@2
|
718 |
Note: if the sprite member aMember is not visible then there is no need for a change
|
williamr@2
|
719 |
to the display, so the aRect and aFullUpdate parameters are ignored.
|
williamr@2
|
720 |
|
williamr@2
|
721 |
@param aMember The index of the sprite member that is to be updated.
|
williamr@2
|
722 |
@param aRect The part of the sprite member which has changed.
|
williamr@2
|
723 |
@param aFullUpdate Not used. Wserv now always do full back to front rendering. */
|
williamr@2
|
724 |
virtual void UpdateMember(TInt aMember,const TRect& aRect,TBool aFullUpdate)=0;
|
williamr@2
|
725 |
/** Turns a sprite on or off.
|
williamr@2
|
726 |
|
williamr@2
|
727 |
In effect this makes the sprite bitmap visible.
|
williamr@2
|
728 |
|
williamr@2
|
729 |
@param aActive ETrue to turn sprite on. EFalse to turn it off. */
|
williamr@2
|
730 |
virtual void Activate(TBool aActive)=0;
|
williamr@2
|
731 |
/** Finishes constructing the sprite.
|
williamr@2
|
732 |
|
williamr@2
|
733 |
It also sets the currently displayed sprite member to zero.
|
williamr@2
|
734 |
|
williamr@2
|
735 |
This function must be called after members change size. */
|
williamr@2
|
736 |
virtual void SizeChangedL()=0;
|
williamr@2
|
737 |
/** Set the sprite's position.
|
williamr@2
|
738 |
|
williamr@2
|
739 |
@param aPos The new position of the sprite. */
|
williamr@2
|
740 |
virtual void SetPosition(const TPoint &aPos)=0;
|
williamr@2
|
741 |
private:
|
williamr@2
|
742 |
virtual void Reserved() const;
|
williamr@2
|
743 |
public:
|
williamr@2
|
744 |
/** Returns the visibility of the sprite.
|
williamr@2
|
745 |
|
williamr@2
|
746 |
A sprite can be seen if it is neither obscured by another window nor hidden.
|
williamr@2
|
747 |
|
williamr@2
|
748 |
@return ETrue if the sprite can be seen, EFalse otherwise. */
|
williamr@2
|
749 |
virtual TBool SpriteCanBeSeen() const = 0;
|
williamr@2
|
750 |
private:
|
williamr@2
|
751 |
virtual void Reserved2() const;
|
williamr@2
|
752 |
virtual void Reserved3() const;
|
williamr@2
|
753 |
virtual void Reserved4() const;
|
williamr@2
|
754 |
};
|
williamr@2
|
755 |
|
williamr@2
|
756 |
|
williamr@2
|
757 |
class CAnimGc : public CBitmapContext
|
williamr@2
|
758 |
/** Animation graphics context.
|
williamr@2
|
759 |
|
williamr@2
|
760 |
An object of this type is linked into CAnim by the window server, which allows
|
williamr@2
|
761 |
you to draw to the animation window. The object's functions allow you to set
|
williamr@2
|
762 |
and cancel the clipping region, and to draw to the visible window using
|
williamr@2
|
763 |
the inherited CBitmapContext functions.
|
williamr@2
|
764 |
|
williamr@2
|
765 |
@publishedAll
|
williamr@2
|
766 |
@released */
|
williamr@2
|
767 |
{
|
williamr@2
|
768 |
public:
|
williamr@2
|
769 |
/** Sets the clipping region.
|
williamr@2
|
770 |
|
williamr@2
|
771 |
Only the parts of the animation which are within the clipping region are drawn.
|
williamr@2
|
772 |
|
williamr@2
|
773 |
@param aRegion The clipping region. */
|
williamr@2
|
774 |
virtual TInt SetClippingRegion(const TRegion &aRegion)=0;
|
williamr@2
|
775 |
/** Cancels the clipping region.
|
williamr@2
|
776 |
|
williamr@2
|
777 |
@see SetClippingRegion() */
|
williamr@2
|
778 |
virtual void CancelClippingRegion()=0;
|
williamr@2
|
779 |
};
|
williamr@2
|
780 |
|
williamr@2
|
781 |
class CWsAnim; // Forward ref for friend declaration
|
williamr@2
|
782 |
|
williamr@2
|
783 |
|
williamr@2
|
784 |
class CAnim : public CBase , public MEventHandler
|
williamr@2
|
785 |
/** Server side animated object base interface.
|
williamr@2
|
786 |
|
williamr@2
|
787 |
Animations implement this interface, which is called by the window server
|
williamr@2
|
788 |
to pass commands from clients, perform a step in the animation, or to pass
|
williamr@2
|
789 |
window server events (if required) so that the animation can handle them
|
williamr@2
|
790 |
before the application.
|
williamr@2
|
791 |
|
williamr@2
|
792 |
The functions are all pure virtual, and must be implemented in
|
williamr@2
|
793 |
the derived class to provide server side behaviour. The functions will be
|
williamr@2
|
794 |
called by the window server with optional arguments passed in from the client
|
williamr@2
|
795 |
side animation class RAnim.
|
williamr@2
|
796 |
|
williamr@2
|
797 |
You should derive from CWindowAnim, CFreeTimerWindowAnim or CSpriteAnim,
|
williamr@2
|
798 |
depending on whether the animation is to draw to a sprite or a window,
|
williamr@2
|
799 |
rather than directly from this class.
|
williamr@2
|
800 |
|
williamr@2
|
801 |
The derived class is constructed in the DLL factory class CAnimDll::CreateInstanceL()
|
williamr@2
|
802 |
function.
|
williamr@2
|
803 |
|
williamr@2
|
804 |
The operation to perform an animation step is called by the window server
|
williamr@2
|
805 |
on a timer. The timing properties are set through an MAnimGeneralFunctions
|
williamr@2
|
806 |
member, which also provides other utility functions.
|
williamr@2
|
807 |
|
williamr@2
|
808 |
@publishedAll
|
williamr@2
|
809 |
@released */
|
williamr@2
|
810 |
{
|
williamr@2
|
811 |
public:
|
williamr@2
|
812 |
/** Implements client-side initiated commands, returning a value.
|
williamr@2
|
813 |
|
williamr@2
|
814 |
The window server calls this function in response to application calls to
|
williamr@2
|
815 |
the client side command function RAnim::CommandReplyL(). The arguments passed
|
williamr@2
|
816 |
to the function by the window server are the same as were used on the client
|
williamr@2
|
817 |
side function call.
|
williamr@2
|
818 |
|
williamr@2
|
819 |
This function returns values to the client side, and should be used to return
|
williamr@2
|
820 |
error codes for commands which might leave.
|
williamr@2
|
821 |
|
williamr@2
|
822 |
@param aOpcode Opcode understood by the class.
|
williamr@2
|
823 |
@param aArgs Arguments packaged on the client side, for example as a struct
|
williamr@2
|
824 |
of a type determined by the aOpcode argument. These mirror the aArgs argument
|
williamr@2
|
825 |
passed in to RAnim::CommandReply().
|
williamr@2
|
826 |
@return Value passed back to client side function when this function completes.
|
williamr@2
|
827 |
Typically this would be KErrNone or another of the system-wide error codes.
|
williamr@2
|
828 |
However any value may be returned to the client side.
|
williamr@2
|
829 |
@see RAnim */
|
williamr@2
|
830 |
virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs)=0;
|
williamr@2
|
831 |
/** Implements client-side initiated commands.
|
williamr@2
|
832 |
|
williamr@2
|
833 |
The window server calls this function in response to application calls to
|
williamr@2
|
834 |
the client side command function RAnim::Command(). The arguments passed to
|
williamr@2
|
835 |
the function by the window server are the same as were used on the client
|
williamr@2
|
836 |
side function call.
|
williamr@2
|
837 |
|
williamr@2
|
838 |
Because this function does not return errors, it is not safe for commands
|
williamr@2
|
839 |
which might leave.
|
williamr@2
|
840 |
|
williamr@2
|
841 |
@param aOpcode Opcode understood by the class
|
williamr@2
|
842 |
@param aArgs Arguments packaged on the client side, for example as a struct
|
williamr@2
|
843 |
of a type determined by the aOpcode argument. These mirror the aArgs argument
|
williamr@2
|
844 |
passed in to RAnim::Command().
|
williamr@2
|
845 |
@see RAnim */
|
williamr@2
|
846 |
virtual void Command(TInt aOpcode, TAny *aArgs)=0;
|
williamr@2
|
847 |
/** Main animation function, called by the window server.
|
williamr@2
|
848 |
|
williamr@2
|
849 |
The drawing code which implements a given animation should be provided here.
|
williamr@2
|
850 |
|
williamr@2
|
851 |
This function is called at a frequency determined by the SetSync() helper
|
williamr@2
|
852 |
function. Note that if sync is not set, then this function will never be
|
williamr@2
|
853 |
called. This effect can be exploited to use the animation framework, with
|
williamr@2
|
854 |
its server side speed, for what are strictly not animations, e.g. for streaming
|
williamr@2
|
855 |
video images.
|
williamr@2
|
856 |
|
williamr@2
|
857 |
The aDateTime parameter will be null if the current time (as determined by
|
williamr@2
|
858 |
the window server) matches the time implied by the sync period, modulo normalisation,
|
williamr@2
|
859 |
otherwise it will contain a valid (non-normalised) time.
|
williamr@2
|
860 |
|
williamr@2
|
861 |
Normalisation is to some specified granularity, for example if one minute
|
williamr@2
|
862 |
is specified as the animation frequency, then in effect the window server
|
williamr@2
|
863 |
will decide whether the implied time is correct to the minute, but not to
|
williamr@2
|
864 |
the second.
|
williamr@2
|
865 |
|
williamr@2
|
866 |
Implied time is the time implied by the (normalised) actual time of the previous
|
williamr@2
|
867 |
animation call plus the sync interval. For example if the last call was at
|
williamr@2
|
868 |
time 't' and the sync interval is 1 second then if the time at this call
|
williamr@2
|
869 |
is t + 1 second, then actual time and implied time match and the value placed
|
williamr@2
|
870 |
into aDateTime will be NULL.
|
williamr@2
|
871 |
|
williamr@2
|
872 |
Cases in which the two may not match include, for example, system time having
|
williamr@2
|
873 |
been reset between animation calls (perhaps British Summer Time or other daylight
|
williamr@2
|
874 |
saving time has just come into effect). The intention is that when system
|
williamr@2
|
875 |
time changes, a mechanism is provided to alert the animation code and allow
|
williamr@2
|
876 |
it to reset itself. The assumption is that somewhere in its initialisation
|
williamr@2
|
877 |
code, the animation will have performed a CAnimFunctions utility call to set
|
williamr@2
|
878 |
a base time, which is then implicitly tracked by incrementing by a suitable
|
williamr@2
|
879 |
interval; when aDateTime is non-NULL after a call to Animate(), base time
|
williamr@2
|
880 |
should be reset.
|
williamr@2
|
881 |
|
williamr@2
|
882 |
@param aDateTime Null if the current time w.r.t. the window server matches
|
williamr@2
|
883 |
the time implied by the synch period. Otherwise a valid (non-normalised) time. */
|
williamr@2
|
884 |
virtual void Animate(TDateTime *aDateTime)=0;
|
williamr@2
|
885 |
virtual void HandleNotification(const TWsEvent& /*aEvent*/) {};
|
williamr@2
|
886 |
private:
|
williamr@2
|
887 |
inline CAnim() {}
|
williamr@2
|
888 |
virtual void Reserved1() const {};
|
williamr@2
|
889 |
virtual void Reserved2() const {};
|
williamr@2
|
890 |
virtual void Reserved3() const {};
|
williamr@2
|
891 |
protected:
|
williamr@2
|
892 |
/** Pointer to a class containing functions implemented by the window server.
|
williamr@2
|
893 |
|
williamr@2
|
894 |
These are available to any CAnim derived class.
|
williamr@2
|
895 |
|
williamr@2
|
896 |
Note that this value is automatically set for you by the animation framework.
|
williamr@2
|
897 |
You do not need to assign a value to this pointer.
|
williamr@2
|
898 |
@publishedAll
|
williamr@2
|
899 |
@released */
|
williamr@2
|
900 |
MAnimGeneralFunctions *iFunctions;
|
williamr@2
|
901 |
friend class CWsAnim;
|
williamr@2
|
902 |
friend class CWindowAnim;
|
williamr@2
|
903 |
friend class CSpriteAnim;
|
williamr@2
|
904 |
};
|
williamr@2
|
905 |
|
williamr@2
|
906 |
|
williamr@2
|
907 |
class CWindowAnim : public CAnim
|
williamr@2
|
908 |
/** Window animation interface.
|
williamr@2
|
909 |
|
williamr@2
|
910 |
This interface is provided to create animations other than sprites. A window
|
williamr@2
|
911 |
animation can be provided by deriving from this class.
|
williamr@2
|
912 |
|
williamr@2
|
913 |
The interface inherits from CAnim and has access to its functions. It additionally
|
williamr@2
|
914 |
can access an interface for querying and manipulating the window in which
|
williamr@2
|
915 |
the animation takes place, using its iWindowFunctions member.
|
williamr@2
|
916 |
|
williamr@2
|
917 |
The derived class is constructed in the DLL factory class CAnimDll::CreateInstanceL().
|
williamr@2
|
918 |
|
williamr@2
|
919 |
@publishedAll
|
williamr@2
|
920 |
@released
|
williamr@2
|
921 |
@see CFreeTimerWindowAnim
|
williamr@2
|
922 |
@see CSpriteAnim */
|
williamr@2
|
923 |
{
|
williamr@2
|
924 |
public:
|
williamr@2
|
925 |
/** Server side construction and initialisation of an animation class.
|
williamr@2
|
926 |
|
williamr@2
|
927 |
Note: the aHasFocus argument allows the animation to start in a known focus state.
|
williamr@2
|
928 |
For example, an animation may or may not have focus, depending on how it was
|
williamr@2
|
929 |
started. Together with the FocusChanged() function, this allows an animation
|
williamr@2
|
930 |
to always know its focus state.
|
williamr@2
|
931 |
|
williamr@2
|
932 |
@param aArgs Packaged arguments which may be required during construction.
|
williamr@2
|
933 |
These are transferred from the aParams argument of the client side constructor's
|
williamr@2
|
934 |
RAnim::Construct().
|
williamr@2
|
935 |
@param aHasFocus Specifies whether or not the animation has window server focus. */
|
williamr@2
|
936 |
virtual void ConstructL(TAny *aArgs, TBool aHasFocus)=0;
|
williamr@2
|
937 |
/** Redraws the objects.
|
williamr@2
|
938 |
|
williamr@2
|
939 |
The function is called by the window server when it needs to redraw the object.
|
williamr@2
|
940 |
The object must provide all the low level drawing code. */
|
williamr@2
|
941 |
virtual void Redraw()=0;
|
williamr@2
|
942 |
/** Notifies change of focus.
|
williamr@2
|
943 |
|
williamr@2
|
944 |
The function is called by the window server to notify a change of focus,
|
williamr@2
|
945 |
allowing the animation code to track whether it does or does not have focus,
|
williamr@2
|
946 |
and to change its appearance accordingly.
|
williamr@2
|
947 |
|
williamr@2
|
948 |
@param aState Indicates whether the focus has or has not changed. */
|
williamr@2
|
949 |
virtual void FocusChanged(TBool aState)=0;
|
williamr@2
|
950 |
protected:
|
williamr@2
|
951 |
/** Protected constructor.
|
williamr@2
|
952 |
|
williamr@2
|
953 |
Prevents objects of this class being directly constructed. */
|
williamr@2
|
954 |
inline CWindowAnim() {}
|
williamr@2
|
955 |
private:
|
williamr@2
|
956 |
virtual void ReservedW1() const {};
|
williamr@2
|
957 |
virtual void ReservedW2() const {};
|
williamr@2
|
958 |
protected:
|
williamr@2
|
959 |
/** Pointer to a class containing functions implemented by the window server.
|
williamr@2
|
960 |
|
williamr@2
|
961 |
These are available to any CWindowAnim-derived class.
|
williamr@2
|
962 |
|
williamr@2
|
963 |
Note that this and the iGc pointer are automatically set for you by the
|
williamr@2
|
964 |
animation framework - you do not need to assign a value to them.*/
|
williamr@2
|
965 |
MAnimWindowFunctions *iWindowFunctions;
|
williamr@2
|
966 |
/** Pointer to the graphics context. */
|
williamr@2
|
967 |
CAnimGc *iGc;
|
williamr@2
|
968 |
friend class CWsAnim;
|
williamr@2
|
969 |
};
|
williamr@2
|
970 |
|
williamr@2
|
971 |
|
williamr@2
|
972 |
class CFreeTimerWindowAnim : public CWindowAnim
|
williamr@2
|
973 |
/** Free timer animation interface.
|
williamr@2
|
974 |
|
williamr@2
|
975 |
This interface allows animations to have their own timers or other active
|
williamr@2
|
976 |
objects, and to draw to the window when the timer completes. The implication
|
williamr@2
|
977 |
of this is that animations derived from this class can have an extremely short
|
williamr@2
|
978 |
user-defined time between calls to the Animate() function, unlike the
|
williamr@2
|
979 |
other animation classes, which are tied to the (approximately) half second
|
williamr@2
|
980 |
flash cycle.
|
williamr@2
|
981 |
|
williamr@2
|
982 |
The interface inherits from CWindowAnim and has access to its functions. It
|
williamr@2
|
983 |
additionally can access functions declared in the MAnimFreeTimerWindowFunctions
|
williamr@2
|
984 |
interface, using WindowFunctions().
|
williamr@2
|
985 |
|
williamr@2
|
986 |
In order to draw to the window inside the RunL() of your own timer, you will
|
williamr@2
|
987 |
need call the ActivateGc() function before doing any drawing, and the DeactivateGc()
|
williamr@2
|
988 |
function after finishing the drawing.
|
williamr@2
|
989 |
|
williamr@2
|
990 |
@publishedAll
|
williamr@2
|
991 |
@released
|
williamr@2
|
992 |
@see CSpriteAnim */
|
williamr@2
|
993 |
{
|
williamr@2
|
994 |
protected:
|
williamr@2
|
995 |
inline MAnimFreeTimerWindowFunctions* WindowFunctions()
|
williamr@2
|
996 |
/** Gets the free timer utility functions.
|
williamr@2
|
997 |
|
williamr@2
|
998 |
These functions include all the MAnimWindowFunctions,
|
williamr@2
|
999 |
and additional functions to deactivate the graphics context and to force the
|
williamr@2
|
1000 |
screen to update.
|
williamr@2
|
1001 |
|
williamr@2
|
1002 |
@return A pointer to the free timer utility functions. */
|
williamr@2
|
1003 |
{return STATIC_CAST(MAnimFreeTimerWindowFunctions*,iWindowFunctions);}
|
williamr@2
|
1004 |
private:
|
williamr@2
|
1005 |
virtual void ReservedF1() const {};
|
williamr@2
|
1006 |
};
|
williamr@2
|
1007 |
|
williamr@2
|
1008 |
|
williamr@2
|
1009 |
class CSpriteAnim : public CAnim
|
williamr@2
|
1010 |
/** Sprite animation interface.
|
williamr@2
|
1011 |
|
williamr@2
|
1012 |
Sprites are bitmaps that can overlay a window or the screen. A sprite animation
|
williamr@2
|
1013 |
can be provided by deriving from this class.
|
williamr@2
|
1014 |
|
williamr@2
|
1015 |
The interface inherits from CAnim and has access to its functions. It additionally
|
williamr@2
|
1016 |
can access an interface for querying and manipulating a sprite, using its
|
williamr@2
|
1017 |
iSpriteFunctions member.
|
williamr@2
|
1018 |
|
williamr@2
|
1019 |
The derived class is constructed in the DLL factory class CAnimDll::CreateInstanceL()
|
williamr@2
|
1020 |
function.
|
williamr@2
|
1021 |
|
williamr@2
|
1022 |
@publishedAll
|
williamr@2
|
1023 |
@released
|
williamr@2
|
1024 |
@see CFreeTimerWindowAnim
|
williamr@2
|
1025 |
@see CWindowAnim */
|
williamr@2
|
1026 |
{
|
williamr@2
|
1027 |
public:
|
williamr@2
|
1028 |
/** Server side construction and initialisation of an animation class.
|
williamr@2
|
1029 |
|
williamr@2
|
1030 |
@param aArgs Packaged arguments which may be required during construction.
|
williamr@2
|
1031 |
These are transferred from the aParams argument of the client side constructor's
|
williamr@2
|
1032 |
RAnim::Construct(). */
|
williamr@2
|
1033 |
virtual void ConstructL(TAny *aArgs)=0;
|
williamr@2
|
1034 |
protected:
|
williamr@2
|
1035 |
inline CSpriteAnim()
|
williamr@2
|
1036 |
/** Protected constructor.
|
williamr@2
|
1037 |
|
williamr@2
|
1038 |
Ensures that only derived classes can be constructed. */
|
williamr@2
|
1039 |
{}
|
williamr@2
|
1040 |
private:
|
williamr@2
|
1041 |
virtual void ReservedS1() const {};
|
williamr@2
|
1042 |
virtual void ReservedS2() const {};
|
williamr@2
|
1043 |
protected:
|
williamr@2
|
1044 |
/** Pointer to a class containing functions implemented by the window server.
|
williamr@2
|
1045 |
|
williamr@2
|
1046 |
These are available to any CSpriteAnim-derived class.
|
williamr@2
|
1047 |
|
williamr@2
|
1048 |
Note that this value is automatically set for you by the animation framework.
|
williamr@2
|
1049 |
You do not need to assign a value to this pointer. */
|
williamr@2
|
1050 |
MAnimSpriteFunctions *iSpriteFunctions;
|
williamr@2
|
1051 |
friend class CWsAnim;
|
williamr@2
|
1052 |
};
|
williamr@2
|
1053 |
|
williamr@2
|
1054 |
|
williamr@2
|
1055 |
class CAnimDll : public CBase
|
williamr@2
|
1056 |
/** Animation DLL factory interface.
|
williamr@2
|
1057 |
|
williamr@2
|
1058 |
An animation DLL class must be a derived class of CAnimDll, and can be thought
|
williamr@2
|
1059 |
of as a server side factory class. CAnimDll consists of a single pure virtual
|
williamr@2
|
1060 |
factory function, CreateInstanceL(TInt aType), which is used to create new
|
williamr@2
|
1061 |
instances of animation objects of type CAnim contained in the DLL. Animation
|
williamr@2
|
1062 |
DLL objects are created by the CreateCAnimDllL() function, which is called
|
williamr@2
|
1063 |
by the window server at the request of the client.
|
williamr@2
|
1064 |
|
williamr@2
|
1065 |
For efficiency reasons, it makes sense to collect multiple animation classes
|
williamr@2
|
1066 |
into a single DLL, even if they are otherwise logically quite separate classes.
|
williamr@2
|
1067 |
|
williamr@2
|
1068 |
@publishedAll
|
williamr@2
|
1069 |
@released */
|
williamr@2
|
1070 |
{
|
williamr@2
|
1071 |
public:
|
williamr@2
|
1072 |
/** Factory function for animation DLLs.
|
williamr@2
|
1073 |
|
williamr@2
|
1074 |
It must be provided in the derived class.
|
williamr@2
|
1075 |
|
williamr@2
|
1076 |
The parameter can be used to differentiate between multiple animation
|
williamr@2
|
1077 |
classes contained in the same animation DLL.
|
williamr@2
|
1078 |
|
williamr@2
|
1079 |
@param aType Identifies an animation class to be constructed. This is the
|
williamr@2
|
1080 |
same value as the aType argument of the client side animation constructor
|
williamr@2
|
1081 |
RAnim::Construct(). It is passed from the client side by the animation framework.
|
williamr@2
|
1082 |
@return Pointer to a CAnim-derived animation class object. */
|
williamr@2
|
1083 |
virtual CAnim *CreateInstanceL(TInt aType)=0;
|
williamr@2
|
1084 |
};
|
williamr@2
|
1085 |
|
williamr@2
|
1086 |
#endif
|