|
1 /* |
|
2 * Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Base class for animation timing models. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef AKNSALTIMINGMODEL_H |
|
19 #define AKNSALTIMINGMODEL_H |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32std.h> |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 class MAknsRlParameterIterator; |
|
26 |
|
27 // CONSTANTS |
|
28 /** |
|
29 * Maximum value of relative value. Relative value is in 16.16 fixed point |
|
30 * format. Relative value range [0, KMaxRelative] maps to floating point |
|
31 * range [0, 1]. |
|
32 */ |
|
33 const TInt KAlMaxRelative = 65536; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 /** |
|
37 * Base class for animation timing models. Implementing class may choose what |
|
38 * ticking method is supported (real-time or timestamped or both). |
|
39 * |
|
40 * @since 3.0 |
|
41 */ |
|
42 class MAknsAlTimingModel |
|
43 { |
|
44 public: |
|
45 inline virtual ~MAknsAlTimingModel() {} |
|
46 |
|
47 public: |
|
48 /** |
|
49 * Sets the parameters for this timing model. |
|
50 * |
|
51 * If any parameter appears more than once in the given iterator (or in |
|
52 * iterators given in more than one call to this method), the latest |
|
53 * parameter value must be used. Already set parameters can not be |
|
54 * removed, but their values can be updated. |
|
55 * |
|
56 * Any parameters not supported by this timing model at all (i.e., the |
|
57 * name of the parameter is not recognized) must be ignored silently. |
|
58 * If parameter type or value is not supported, the plugin may leave |
|
59 * with @c KErrArgument. |
|
60 * |
|
61 * If a particular combination of parameters is not supported (and |
|
62 * further calls to this method can not change the situation), the |
|
63 * timing model may leave with @c KErrArgument. |
|
64 * |
|
65 * @c SetParametersL should also leave if the parameter values can not |
|
66 * be stored, e.g. because of an OOM condition. |
|
67 * |
|
68 * @param aParameters Iterator to the parameters. The iterator (and all |
|
69 * the returned values) is guaranteed to be valid during the call |
|
70 * to this method. No ownership is transferred, unless specified |
|
71 * otherwise in iterator API. |
|
72 * |
|
73 * @par Exceptions: |
|
74 * If parameter setup fails (i.e. this method leaves with an error |
|
75 * code), the animation creation will fail. |
|
76 */ |
|
77 virtual void SetParametersL( MAknsRlParameterIterator& aParameters ) =0; |
|
78 |
|
79 /** |
|
80 * Advances the timing model. |
|
81 * |
|
82 * @param aDeltaTime The time difference between the this and the last |
|
83 * update, in milliseconds. |
|
84 */ |
|
85 virtual void Tick( const TInt aDeltaTime ) =0; |
|
86 |
|
87 /** |
|
88 * Ticks the timing model to the point in time defined by the timestamp. |
|
89 */ |
|
90 virtual void Tick( const TTime& aStamp ) =0; |
|
91 |
|
92 /** |
|
93 * @return The current relative value. Fixed point, 16.16 format, always |
|
94 * in range [0, 1] (when interpreted as a real number). |
|
95 */ |
|
96 virtual TUint32 RelativeValue() const =0; |
|
97 |
|
98 /** |
|
99 * @return ETrue if the animation has finished, otherwise EFalse. |
|
100 */ |
|
101 virtual TBool IsFinished() const =0; |
|
102 |
|
103 /** |
|
104 * Restores the model state to the beginning of time span. |
|
105 */ |
|
106 virtual void Begin() =0; |
|
107 |
|
108 public: |
|
109 inline static void CleanupOp( TAny* aItem ) |
|
110 { |
|
111 MAknsAlTimingModel* model = |
|
112 static_cast<MAknsAlTimingModel*>( aItem ); |
|
113 delete model; |
|
114 } |
|
115 |
|
116 }; |
|
117 |
|
118 #endif // AKNSALTIMINGMODEL_H |
|
119 |
|
120 // End of File |