|
1 /* |
|
2 * Copyright (c) 2006-2007 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __HUITIMEDPOINT_H__ |
|
21 #define __HUITIMEDPOINT_H__ |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <uiacceltk/HuiTimedValue.h> |
|
26 #include <uiacceltk/HuiRealPoint.h> |
|
27 |
|
28 |
|
29 /** |
|
30 * X/Y coordinate pair using timed values. |
|
31 * |
|
32 * @see THuiTimedValue |
|
33 */ |
|
34 class THuiTimedPoint |
|
35 { |
|
36 public: |
|
37 |
|
38 /* Constructors and destructor. */ |
|
39 |
|
40 IMPORT_C THuiTimedPoint(); |
|
41 |
|
42 /** |
|
43 * Constructor that sets default values. |
|
44 * |
|
45 * @param aX Sets the timed value's initial X component. |
|
46 * @param aY Sets the timed value's initial Y component. |
|
47 */ |
|
48 IMPORT_C THuiTimedPoint(TReal32 aX, TReal32 aY) __SOFTFP; |
|
49 |
|
50 |
|
51 /* Methods. */ |
|
52 |
|
53 /** |
|
54 * Sets the interpolation style of both components of the point. |
|
55 * |
|
56 * @param aStyle Timed value interpolation style. |
|
57 */ |
|
58 IMPORT_C void SetStyle(THuiInterpolationStyle aStyle); |
|
59 |
|
60 /** |
|
61 * Sets the mapping function for both the X and Y components. For |
|
62 * example you can use a mapping function to constrain your |
|
63 * visuals onto a path. |
|
64 * |
|
65 * @note If the mapping function does not support multiple modes |
|
66 * (mode for X calculation and mode for Y calculation), both the |
|
67 * X and Y components of the timed point will share the same value. |
|
68 * |
|
69 * The mapping component/mode parameter used to calculate |
|
70 * value for X is mode 0, and the value for U is mode 1. |
|
71 * @see MHuiMappingFunction::MapValue() is called twice with mode |
|
72 * 0 for X and mode 1 for Y. |
|
73 * @see CHuiCurvePath for curve path mapping fuction. |
|
74 */ |
|
75 IMPORT_C void SetFunction(MHuiMappingFunction* aFunction); |
|
76 |
|
77 /** |
|
78 * Sets the target for the timed point. |
|
79 * |
|
80 * @param aPoint Target point. |
|
81 * @param aTransitionTime Duration for reaching the target. |
|
82 */ |
|
83 IMPORT_C void Set(const THuiRealPoint& aPoint, TInt aTransitionTime = 0); |
|
84 |
|
85 /** |
|
86 * Sets the target value of both components of the timed point. |
|
87 * |
|
88 * @param aValue New target value. |
|
89 * @param aTransitionTime Duration for reaching the target. |
|
90 */ |
|
91 IMPORT_C void Set(TReal32 aValue, TInt aTransitionTime = 0) __SOFTFP; |
|
92 |
|
93 /** |
|
94 * Sets the target value for the timed point, with a transition that is |
|
95 * done using a specific speed. |
|
96 * |
|
97 * @param aPoint Target point. |
|
98 * @param aUnitsPerSecond Units per second during the transition. |
|
99 */ |
|
100 IMPORT_C void SetWithSpeed(const THuiRealPoint& aPoint, TReal32 aUnitsPerSecond) __SOFTFP; |
|
101 |
|
102 /** |
|
103 * Sets the target value of both components of the timed point. |
|
104 * |
|
105 * @param aValue New target value. |
|
106 * @param aUnitsPerSecond Speed of change. |
|
107 */ |
|
108 IMPORT_C void SetWithSpeed(TReal32 aValue, TReal32 aUnitsPerSecond) __SOFTFP; |
|
109 |
|
110 /** |
|
111 * Returns the current interpolatad value of the point rounded to nearest |
|
112 * integer values. Note that the THuiTimedPoint values are |
|
113 * floating-point. |
|
114 * |
|
115 * @see RealNow() For returning the floating-point current value. |
|
116 * |
|
117 * @return Current values as a regular TPoint. |
|
118 */ |
|
119 IMPORT_C TPoint Now() const; |
|
120 |
|
121 /** |
|
122 * Returns the current value of the point. |
|
123 * |
|
124 * @return Current values as a regular THuiRealPoint. |
|
125 */ |
|
126 IMPORT_C THuiRealPoint RealNow() const __SOFTFP; |
|
127 |
|
128 /** |
|
129 * Returns the target value of the point rounded to nearest |
|
130 * integer values. Note that the THuiTimedPoint values are |
|
131 * floating-point. |
|
132 * |
|
133 * @see RealTarget() For returning the floating-point values. |
|
134 * |
|
135 * @return Target values as a normal TPoint - target value rounded to |
|
136 * nearest integer. |
|
137 */ |
|
138 IMPORT_C TPoint Target() const; |
|
139 |
|
140 /** |
|
141 * Returns the target value of the point. |
|
142 * |
|
143 * @return Target as a THuiRealPoint. |
|
144 */ |
|
145 IMPORT_C THuiRealPoint RealTarget() const __SOFTFP; |
|
146 |
|
147 /** |
|
148 * Finishes the current interpolation. |
|
149 */ |
|
150 IMPORT_C void Finish(); |
|
151 |
|
152 /** |
|
153 * Checks if the point has been changed. |
|
154 * |
|
155 * @return ETrue if X or Y values have changed, EFalse if not. |
|
156 * |
|
157 * @see THuiTimedValue::Changed() |
|
158 */ |
|
159 TBool Changed() const; |
|
160 |
|
161 /** |
|
162 * Clears the changed flags for X and Y values. |
|
163 * |
|
164 * @see THuiTimedValue::Changed() |
|
165 */ |
|
166 void ClearChanged(); |
|
167 |
|
168 |
|
169 private: |
|
170 |
|
171 /* Private methods. */ |
|
172 |
|
173 |
|
174 public: |
|
175 |
|
176 /* Public member variables. */ |
|
177 |
|
178 /** X coordinate. */ |
|
179 THuiTimedValue iX; |
|
180 |
|
181 /** Y coordinate. */ |
|
182 THuiTimedValue iY; |
|
183 |
|
184 private: |
|
185 TInt iSpare1; |
|
186 TInt iSpare2; |
|
187 }; |
|
188 |
|
189 #endif // __HUITIMEDPOINT_H__ |