|
1 /* |
|
2 * Copyright (c) 2007-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: Implementation for peninput animation command |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "peninputanimcommand.h" |
|
19 #include "rpeninputanim.h" |
|
20 #include <peninputcmd.h> |
|
21 #include "peninputcmdparamext.h" |
|
22 // --------------------------------------------------------------------------- |
|
23 // TAnimCmd::TAnimCmd |
|
24 // Default constructor |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 //#define UPDATE_MORE_SMALL_AREA |
|
28 TAnimCmd::TAnimCmd(RPeninputAnim& aAnim,TBool aFlag) |
|
29 : iAnim(aAnim),iReady(aFlag) |
|
30 { |
|
31 } |
|
32 |
|
33 |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // TAnimCmd::ExecuteAnimCommand |
|
37 // Execute animation command |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 TBool TAnimCmd::ExecuteAnimCommand() const |
|
41 { |
|
42 //do nothing |
|
43 return ETrue; |
|
44 } |
|
45 |
|
46 |
|
47 //class TAimActivateUiCmd |
|
48 // --------------------------------------------------------------------------- |
|
49 // TAnimActivateUiCmd::TAnimActivateUiCmd |
|
50 // Default constructor |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 TAnimActivateUiCmd::TAnimActivateUiCmd(RPeninputAnim& aAnim, |
|
54 TBool aFlag,TBool aReadyFlag) |
|
55 : TAnimCmd(aAnim,aReadyFlag),iActiveFlag(aFlag) |
|
56 { |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // TAnimActivateUiCmd::ExecuteAnimCommand |
|
61 // Execute animation command |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 TBool TAnimActivateUiCmd :: ExecuteAnimCommand() const |
|
65 { |
|
66 if(!iReady) |
|
67 return EFalse; |
|
68 |
|
69 if(iActiveFlag) |
|
70 { |
|
71 iAnim.Activate(); |
|
72 } |
|
73 else |
|
74 { |
|
75 iAnim.Deactivate(); |
|
76 } |
|
77 return ETrue; |
|
78 } |
|
79 |
|
80 |
|
81 //class TAnimChangeSizeCmd |
|
82 // --------------------------------------------------------------------------- |
|
83 // TAnimChangeSizeCmd::TAnimChangeSizeCmd |
|
84 // Default constructor |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 TAnimChangeSizeCmd::TAnimChangeSizeCmd(RPeninputAnim& aAnim, |
|
88 const TSize& aSize) : TAnimCmd(aAnim),iSize(aSize) |
|
89 { |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // TAnimChangeSizeCmd::ExecuteAnimCommand |
|
94 // Execute animation command |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 TBool TAnimChangeSizeCmd ::ExecuteAnimCommand() const |
|
98 { |
|
99 TRAP_IGNORE(iAnim.LayoutSizeChangedL(iSize)); |
|
100 return ETrue; |
|
101 } |
|
102 |
|
103 //class TAnimSetPosCmd |
|
104 // --------------------------------------------------------------------------- |
|
105 // TAnimSetPosCmd::TAnimSetPosCmd |
|
106 // Default constructor |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 TAnimSetPosCmd::TAnimSetPosCmd(RPeninputAnim& aAnim,const TPoint& aPt) |
|
110 : TAnimCmd(aAnim),iPos(aPt) |
|
111 { |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // TAnimSetPosCmd::ExecuteAnimCommand |
|
116 // Execute animation command |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 TBool TAnimSetPosCmd ::ExecuteAnimCommand() const |
|
120 { |
|
121 iAnim.SetUiLayoutPos(iPos); |
|
122 return ETrue; |
|
123 } |
|
124 |
|
125 |
|
126 //class TAnimChangeDispModeCmd |
|
127 // --------------------------------------------------------------------------- |
|
128 // TAnimChangeDispModeCmd::TAnimChangeDispModeCmd |
|
129 // Default constructor |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 TAnimChangeDispModeCmd::TAnimChangeDispModeCmd(RPeninputAnim& aAnim, |
|
133 RWsSprite& aSprite,TSpriteMember& aMember) |
|
134 : TAnimCmd(aAnim), iSprite(aSprite), |
|
135 iSpriteMember(aMember) |
|
136 { |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // TAnimChangeDispModeCmd::ExecuteAnimCommand |
|
141 // Execute animation command |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 TBool TAnimChangeDispModeCmd :: ExecuteAnimCommand() const |
|
145 { |
|
146 iSprite.UpdateMember(0, iSpriteMember); |
|
147 return ETrue; |
|
148 } |
|
149 |
|
150 |
|
151 //class TAnimUpdateUiRectCmd |
|
152 // --------------------------------------------------------------------------- |
|
153 // TAnimUpdateUiRectCmd::TAnimUpdateUiRectCmd |
|
154 // Default constructor |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 TAnimUpdateUiRectCmd::TAnimUpdateUiRectCmd(RPeninputAnim& aAnim, |
|
158 const TRect& aRect,TBool aFullFlag) |
|
159 :TAnimCmd(aAnim) |
|
160 { |
|
161 TUpdateArea area = |
|
162 { |
|
163 aRect,aFullFlag |
|
164 }; |
|
165 iArea.Append(area); |
|
166 } |
|
167 |
|
168 // --------------------------------------------------------------------------- |
|
169 // TAnimUpdateUiRectCmd::TAnimUpdateUiRectCmd |
|
170 // c++ constructor |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 TAnimUpdateUiRectCmd::TAnimUpdateUiRectCmd(RPeninputAnim& aAnim, |
|
174 TUpdateArea *aArea,TInt aNum) |
|
175 : TAnimCmd(aAnim), iRectNum(aNum) |
|
176 { |
|
177 for(TInt i = 0 ; i < aNum; ++i) |
|
178 { |
|
179 TUpdateArea area = |
|
180 { |
|
181 aArea[i].iRect, |
|
182 aArea[i].iFullUpdateFlag |
|
183 }; |
|
184 iArea.Append(area); |
|
185 } |
|
186 } |
|
187 |
|
188 TAnimUpdateUiRectCmd::~TAnimUpdateUiRectCmd() |
|
189 { |
|
190 iArea.Close(); |
|
191 } |
|
192 // --------------------------------------------------------------------------- |
|
193 // TAnimUpdateUiRectCmd::ExecuteAnimCommand |
|
194 // Execute animation command |
|
195 // --------------------------------------------------------------------------- |
|
196 // |
|
197 TBool TAnimUpdateUiRectCmd ::ExecuteAnimCommand() const |
|
198 { |
|
199 if (iArea.Count()) |
|
200 { |
|
201 #ifdef UPDATE_MORE_SMALL_AREA |
|
202 iAnim.UpdateArea(iArea); |
|
203 #else |
|
204 TUpdateArea area = iArea[0]; |
|
205 for( TInt i = 1; i < iArea.Count(); ++i ) |
|
206 { |
|
207 area.iRect.BoundingRect(iArea[i].iRect); |
|
208 } |
|
209 iArea.Reset(); |
|
210 iArea.Append( area ); |
|
211 iAnim.UpdateArea(iArea); |
|
212 #endif //UPDATE_MORE_SMALL_AREA |
|
213 } |
|
214 |
|
215 //otherwise it's already updated. |
|
216 iArea.Close(); |
|
217 return ETrue; |
|
218 } |
|
219 |
|
220 //class TAnimCapturePtCmd |
|
221 // --------------------------------------------------------------------------- |
|
222 // TAnimCapturePtCmd::TAnimCapturePtCmd |
|
223 // Default constructor |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 TAnimCapturePtCmd::TAnimCapturePtCmd(RPeninputAnim& aAnim,TBool aFlag, TInt aCaptureCtrlID) |
|
227 : TAnimCmd(aAnim),iCaptureFlag(aFlag), iCaptureCtrlID(aCaptureCtrlID) |
|
228 { |
|
229 } |
|
230 |
|
231 |
|
232 // --------------------------------------------------------------------------- |
|
233 // TAnimCapturePtCmd::ExecuteAnimCommand |
|
234 // Execute animation command |
|
235 // --------------------------------------------------------------------------- |
|
236 // |
|
237 TBool TAnimCapturePtCmd :: ExecuteAnimCommand() const |
|
238 { |
|
239 iAnim.CapturePointer(iCaptureFlag, iCaptureCtrlID); |
|
240 return ETrue; |
|
241 } |
|
242 |
|
243 |
|
244 //class TAnimSimulateEventCmd |
|
245 // --------------------------------------------------------------------------- |
|
246 // TAnimSimulateEventCmd::TAnimSimulateEventCmd |
|
247 // Default constructor |
|
248 // --------------------------------------------------------------------------- |
|
249 // |
|
250 TAnimSimulateEventCmd::TAnimSimulateEventCmd( |
|
251 RPeninputAnim& aAnim,const TRawEvent& aEvent) |
|
252 : TAnimCmd(aAnim),iEvent(aEvent) |
|
253 { |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // TAnimSimulateEventCmd::ExecuteAnimCommand |
|
258 // Execute animation command |
|
259 // --------------------------------------------------------------------------- |
|
260 // |
|
261 TBool TAnimSimulateEventCmd :: ExecuteAnimCommand() const |
|
262 { |
|
263 iAnim.SimulateEvent(iEvent); |
|
264 return ETrue; |
|
265 } |
|
266 |
|
267 |
|
268 //class TAnimFlushWsSessionCmd |
|
269 // --------------------------------------------------------------------------- |
|
270 // TAnimFlushWsSessionCmd::TAnimFlushWsSessionCmds |
|
271 // Default constructor |
|
272 // --------------------------------------------------------------------------- |
|
273 // |
|
274 TAnimFlushWsSessionCmd::TAnimFlushWsSessionCmd(RPeninputAnim& aAnim, |
|
275 RWsSession& aWs) |
|
276 : TAnimCmd(aAnim),iWs(aWs) |
|
277 { |
|
278 } |
|
279 |
|
280 // --------------------------------------------------------------------------- |
|
281 // TAnimFlushWsSessionCmd::ExecuteAnimCommand |
|
282 // Execute animation command |
|
283 // --------------------------------------------------------------------------- |
|
284 // |
|
285 TBool TAnimFlushWsSessionCmd :: ExecuteAnimCommand() const |
|
286 { |
|
287 iWs.Flush(); |
|
288 return ETrue; |
|
289 } |
|
290 |
|
291 |
|
292 #ifdef RD_TACTILE_FEEDBACK |
|
293 |
|
294 //class TAnimFeedbackAreaCmd |
|
295 // --------------------------------------------------------------------------- |
|
296 // TAnimFlushWsSessionCmd::TAnimFeedbackAreaCmd |
|
297 // Execute animation command |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 TAnimFeedbackAreaCmd::TAnimFeedbackAreaCmd(RPeninputAnim& aAnim, |
|
301 const TTactileFeedbackArea &aArea, |
|
302 TFeedbackAreaOpEnum aOp,TBool aReplyFlag) |
|
303 : TAnimCmd(aAnim),iAreaCount(0),iCmdOp(aOp), |
|
304 iCmdReplyFlag(aReplyFlag) |
|
305 { |
|
306 iFeedbackAreaArray[iAreaCount++] = aArea; |
|
307 } |
|
308 |
|
309 |
|
310 /*TAnimFeedbackAreaCmd::TAnimFeedbackAreaCmd(RPeninputAnim& aAnim, |
|
311 const RArray<TTactileFeedbackArea>& aArea, |
|
312 TFeedbackAreaOpEnum aOp,TBool aReplyFlag) |
|
313 : TAnimCmd(aAnim),iAreaCount(0),iCmdOp(aOp), |
|
314 iCmdReplyFlag(aReplyFlag) |
|
315 { |
|
316 for(TInt i = 0; i < aArea.Count(); ++i) |
|
317 { |
|
318 iFeedbackAreaArray[iAreaCount++] = aArea[i]; |
|
319 } |
|
320 }*/ |
|
321 |
|
322 TBool TAnimFeedbackAreaCmd :: ExecuteAnimCommand() const |
|
323 { |
|
324 switch(iCmdOp) |
|
325 { |
|
326 case TFeedbackAreaOpAdd: |
|
327 TRAP_IGNORE(iAnim.AddFeedbackAreaL(iFeedbackAreaArray,iAreaCount,iCmdReplyFlag)); |
|
328 break; |
|
329 case TFeedbackAreaOpRemove: |
|
330 TRAP_IGNORE(iAnim.RemoveFeedbackAreaL(iFeedbackAreaArray,iAreaCount,iCmdReplyFlag)); |
|
331 break; |
|
332 case TFeedbackAreaOpChange: |
|
333 TRAP_IGNORE(iAnim.ChangeFeedbackAreaL(iFeedbackAreaArray,iAreaCount,iCmdReplyFlag)); |
|
334 break; |
|
335 case TFeedbackTypeOpChange: |
|
336 TRAP_IGNORE(iAnim.ChangeFeedbackTypeL(iFeedbackAreaArray,iAreaCount,iCmdReplyFlag)); |
|
337 break; |
|
338 default: |
|
339 return EFalse; |
|
340 } |
|
341 |
|
342 return ETrue; |
|
343 } |
|
344 #endif // RD_TACTILE_FEEDBACK |
|
345 TAnimEnableSpriteCmd::TAnimEnableSpriteCmd(RPeninputAnim& aAnim,TBool aFlag) |
|
346 : TAnimCmd(aAnim),iSpriteFlag(aFlag) |
|
347 { |
|
348 } |
|
349 |
|
350 TBool TAnimEnableSpriteCmd :: ExecuteAnimCommand() const |
|
351 { |
|
352 iAnim.EnableSprite(iSpriteFlag); |
|
353 return ETrue; |
|
354 } |
|
355 |