|
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: Definition of THuiCommand and derived command classes. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __HUICOMMAND_H__ |
|
21 #define __HUICOMMAND_H__ |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 #include <uiacceltk/HuiImage.h> |
|
27 #include <uiacceltk/HuiTimedValue.h> |
|
28 #include <uiacceltk/HuiTimedPoint.h> |
|
29 |
|
30 |
|
31 /* Forward declarations. */ |
|
32 class CHuiEnv; |
|
33 class CHuiControlGroup; |
|
34 class CHuiControl; |
|
35 class CHuiDisplay; |
|
36 class CHuiVisual; |
|
37 class CHuiImageVisual; |
|
38 class CHuiTextVisual; |
|
39 class CHuiTransformation; |
|
40 class THuiObjectCommand; |
|
41 class THuiEvent; |
|
42 class MHuiEventHandler; |
|
43 |
|
44 |
|
45 /** |
|
46 * Command types. |
|
47 * All the commands that can be executed by the toolkit are enumerated here. |
|
48 */ |
|
49 enum THuiCommandType |
|
50 { |
|
51 |
|
52 /** None corresponds the base class (THuiCommand). */ |
|
53 EHuiCommandTypeNone = 0, |
|
54 |
|
55 EHuiCommandTypeObject, |
|
56 |
|
57 EHuiCommandTypeAction, |
|
58 |
|
59 EHuiCommandTypeGroup, |
|
60 |
|
61 EHuiCommandTypeControl, |
|
62 |
|
63 EHuiCommandTypeVisual, |
|
64 |
|
65 EHuiCommandTypeImage, |
|
66 |
|
67 EHuiCommandTypeText, |
|
68 |
|
69 EHuiCommandTypeValue, |
|
70 |
|
71 EHuiCommandTypePoint, |
|
72 |
|
73 EHuiCommandTypeTransformation, |
|
74 |
|
75 EHuiCommandTypeCustomEvent, |
|
76 |
|
77 /** Marker command type. Types up from here will be used for markers only. */ |
|
78 EHuiCommandTypeMarkerFirst = 10000, |
|
79 EHuiCommandTypeMarker0 = EHuiCommandTypeMarkerFirst, |
|
80 EHuiCommandTypeMarker1, |
|
81 EHuiCommandTypeMarker2, |
|
82 EHuiCommandTypeMarker3, |
|
83 EHuiCommandTypeMarker4, |
|
84 EHuiCommandTypeMarker5, |
|
85 EHuiCommandTypeMarker6, |
|
86 EHuiCommandTypeMarker7, |
|
87 EHuiCommandTypeMarker8, |
|
88 EHuiCommandTypeMarker9, |
|
89 EHuiCommandTypeMarker10 |
|
90 }; |
|
91 |
|
92 |
|
93 /** |
|
94 * Command operations. |
|
95 */ |
|
96 enum THuiOp |
|
97 { |
|
98 EHuiOpNone = 0, |
|
99 |
|
100 /* Control Group operations. */ |
|
101 EHuiOpHide = 1000, |
|
102 EHuiOpShow, |
|
103 EHuiOpEnableInput, |
|
104 EHuiOpDisableInput, |
|
105 |
|
106 /* Control operations. */ |
|
107 /* (start from 2000) */ // None defined yet. |
|
108 |
|
109 /* Visual operations. */ |
|
110 EHuiOpRemoveAndDestroyAll = 3000, |
|
111 EHuiOpModifyFlags, |
|
112 EHuiOpSetPrimaryImage, |
|
113 EHuiOpSetSecondaryImage, |
|
114 EHuiOpSetText, |
|
115 EHuiOpEnableTransformation, |
|
116 EHuiOpDisableTransformation, |
|
117 |
|
118 /* Timed value operations. */ |
|
119 EHuiOpSet = 4000, |
|
120 EHuiOpSetWithSpeed, |
|
121 |
|
122 /* Timed value style operations. The actual is: |
|
123 THuiInterpolationStyle(iOperation - EHuiOpSetStyle) */ |
|
124 EHuiOpSetStyle = 5000, |
|
125 |
|
126 /* Transformation operations. */ |
|
127 EHuiOpLoadIdentity = 6000, |
|
128 EHuiOpTranslate, |
|
129 EHuiOpScale, |
|
130 EHuiOpRotate |
|
131 }; |
|
132 |
|
133 |
|
134 /** |
|
135 * Object types. |
|
136 * These are the different types of objects which can issue and receive commands. |
|
137 */ |
|
138 enum THuiCommandObjectType |
|
139 { |
|
140 EHuiCommandObjectTypeNone, |
|
141 |
|
142 /** This object is a visual. */ |
|
143 EHuiCommandObjectTypeVisual, |
|
144 |
|
145 /** This object is a control. */ |
|
146 EHuiCommandObjectTypeControl, |
|
147 |
|
148 /** This object is a control group. */ |
|
149 EHuiCommandObjectTypeControlGroup |
|
150 }; |
|
151 |
|
152 |
|
153 |
|
154 /** |
|
155 * THuiCommand is the base class of all commands. A command is an |
|
156 * instruction to some class that can be set to occur some time in the future. |
|
157 * Each command stores information about an operation. Each command is also responsible for |
|
158 * the execution of the command. |
|
159 * Commands are processed by the class's OfferEventL() method. |
|
160 */ |
|
161 class THuiCommand |
|
162 { |
|
163 public: |
|
164 |
|
165 /* Destructor. */ |
|
166 |
|
167 IMPORT_C virtual ~THuiCommand(); |
|
168 |
|
169 |
|
170 /* Methods. */ |
|
171 |
|
172 /** |
|
173 * Returns a pointer to the command casted to THuiObjectCommand. |
|
174 * If this is not possible (the command is not derived from |
|
175 * THuiObjectCommand), returns NULL instead. |
|
176 */ |
|
177 IMPORT_C virtual const THuiObjectCommand* ObjectCommand() const; |
|
178 |
|
179 /** |
|
180 * Executes the command. |
|
181 * |
|
182 * @param aEnv The environment in which the command is being executed. |
|
183 */ |
|
184 virtual void ExecuteL(CHuiEnv& aEnv) const = 0; |
|
185 |
|
186 /** |
|
187 * Returns the size of the command. |
|
188 */ |
|
189 virtual TInt Size() const = 0; |
|
190 |
|
191 /** |
|
192 * Sets the sender object of the command. |
|
193 * The sender must not be deleted while the command is pending execution in a scheduler. |
|
194 * |
|
195 * @param aType Sender type. |
|
196 * @param aSender Pointer to sender. |
|
197 */ |
|
198 IMPORT_C void SetSender(THuiCommandObjectType aType, TAny* aSender); |
|
199 |
|
200 /** |
|
201 * Determines the type of the command. |
|
202 * |
|
203 * @return Command type. |
|
204 */ |
|
205 IMPORT_C THuiCommandType Type() const; |
|
206 |
|
207 /** |
|
208 * Determines the type of the object that sent the command. |
|
209 * |
|
210 * @return Sender object type. |
|
211 */ |
|
212 IMPORT_C THuiCommandObjectType SenderType() const; |
|
213 |
|
214 /** |
|
215 * Returns the sender object. This is the object which issued |
|
216 * the command originally. |
|
217 * |
|
218 * @return the object which sent the command. |
|
219 */ |
|
220 IMPORT_C TAny* Sender() const; |
|
221 |
|
222 /** |
|
223 * Returns the sender visual. Returns NULL if the sender is not a visual. |
|
224 * |
|
225 * @return Visual, or NULL. |
|
226 * @see Sender() |
|
227 */ |
|
228 IMPORT_C CHuiVisual* SenderVisual() const; |
|
229 |
|
230 /** |
|
231 * Returns the sender control. Returns NULL if the sender is not a control. |
|
232 * |
|
233 * @return Control, or NULL. |
|
234 * @see Sender() |
|
235 */ |
|
236 IMPORT_C CHuiControl* SenderControl() const; |
|
237 |
|
238 /** |
|
239 * Returns the sender control group. Returns NULL if the sender is not a control group. |
|
240 * |
|
241 * @return Control group, or NULL. |
|
242 * @see Sender() |
|
243 */ |
|
244 IMPORT_C CHuiControlGroup* SenderControlGroup() const; |
|
245 |
|
246 |
|
247 protected: |
|
248 |
|
249 /* Constructor. */ |
|
250 |
|
251 /** |
|
252 * Protected constructor. |
|
253 * |
|
254 * @param aType Type of the command. |
|
255 */ |
|
256 IMPORT_C THuiCommand(THuiCommandType aType); |
|
257 |
|
258 IMPORT_C virtual void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
259 |
|
260 |
|
261 private: |
|
262 |
|
263 /* These member variables are shared by all commands. */ |
|
264 |
|
265 /** Type of the command. Depends on the command class. */ |
|
266 THuiCommandType iType; |
|
267 |
|
268 /** Type of the object that sent the command. */ |
|
269 THuiCommandObjectType iSenderType; |
|
270 |
|
271 /** Object that sent this command. Must exist. */ |
|
272 TAny* iSender; |
|
273 |
|
274 private: |
|
275 TInt iSpare1; |
|
276 TInt iSpare2; |
|
277 |
|
278 }; |
|
279 |
|
280 |
|
281 /** |
|
282 * THuiActionCommand is a simple action that triggers an action notification. |
|
283 */ |
|
284 class THuiActionCommand : public THuiCommand |
|
285 { |
|
286 public: |
|
287 |
|
288 /* Constructor. */ |
|
289 |
|
290 /** |
|
291 * Constructs a new action command. |
|
292 * |
|
293 * @param aId Identifier of the action. |
|
294 */ |
|
295 IMPORT_C THuiActionCommand(TInt aId); |
|
296 |
|
297 |
|
298 /* Methods. */ |
|
299 |
|
300 /* Implementation of THuiCommand::ExecuteL(). */ |
|
301 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
302 |
|
303 /* Implementation of THuiCommand::Size(). */ |
|
304 IMPORT_C TInt Size() const; |
|
305 |
|
306 /** |
|
307 * Determines the action identifier of the command. |
|
308 * |
|
309 * @param Action identifier. |
|
310 */ |
|
311 IMPORT_C TInt Id() const; |
|
312 |
|
313 protected: |
|
314 |
|
315 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
316 |
|
317 private: |
|
318 |
|
319 /** Action identifier. */ |
|
320 TInt iId; |
|
321 |
|
322 private: |
|
323 TInt iSpare1; |
|
324 TInt iSpare2; |
|
325 }; |
|
326 |
|
327 |
|
328 /** |
|
329 * THuiObjectCommand is the base class for commands that modify data owned by |
|
330 * an object. If the object gets deleted and the scheduler is notified of this, |
|
331 * the command will be automatically canceled. |
|
332 */ |
|
333 class THuiObjectCommand : public THuiCommand |
|
334 { |
|
335 public: |
|
336 |
|
337 /* Methods. */ |
|
338 |
|
339 IMPORT_C const THuiObjectCommand* ObjectCommand() const; |
|
340 |
|
341 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
342 |
|
343 IMPORT_C TInt Size() const; |
|
344 |
|
345 /** |
|
346 * Returns the data owner object of the command. |
|
347 */ |
|
348 IMPORT_C TAny* Object() const; |
|
349 |
|
350 /** |
|
351 * Returns the operation of the command. |
|
352 */ |
|
353 IMPORT_C THuiOp Operation() const; |
|
354 |
|
355 |
|
356 protected: |
|
357 |
|
358 /* Constructor. */ |
|
359 |
|
360 /** |
|
361 * Protected constructor. |
|
362 * |
|
363 * @param aType Type of the command. |
|
364 * @param aDataOwnerObject Object that owns the data this command handles. |
|
365 * @param aOperation Operation being done on the object. |
|
366 */ |
|
367 IMPORT_C THuiObjectCommand(THuiCommandType aType, TAny* aDataOwnerObject, THuiOp aOperation); |
|
368 |
|
369 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
370 |
|
371 private: |
|
372 |
|
373 /** Object that owns the data this command handles. */ |
|
374 TAny* iObject; |
|
375 |
|
376 /** Operation being done on the object. */ |
|
377 THuiOp iOperation; |
|
378 |
|
379 }; |
|
380 |
|
381 |
|
382 /** |
|
383 * THuiGroupCommand is an object command that operates on a control group. |
|
384 */ |
|
385 class THuiGroupCommand : public THuiObjectCommand |
|
386 { |
|
387 public: |
|
388 |
|
389 /* Constructor. */ |
|
390 |
|
391 /** |
|
392 * Constructs a new control group command. |
|
393 * |
|
394 * @param aGroup Control group. |
|
395 * @param aDisplay Display associated with the command. |
|
396 * @param aOperation Operation to do on the group. |
|
397 */ |
|
398 IMPORT_C THuiGroupCommand(CHuiControlGroup& aGroup, THuiOp aOperation, |
|
399 CHuiDisplay* aDisplay = NULL); |
|
400 |
|
401 /* Implementation of THuiCommand::ExecuteL(). */ |
|
402 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
403 |
|
404 /* Implementation of THuiCommand::Size(). */ |
|
405 IMPORT_C TInt Size() const; |
|
406 |
|
407 |
|
408 /* Methods. */ |
|
409 |
|
410 /** |
|
411 * Returns the control group that the command operates on. |
|
412 */ |
|
413 IMPORT_C CHuiControlGroup& ControlGroup() const; |
|
414 |
|
415 /** |
|
416 * Returns the display associated with the command. |
|
417 */ |
|
418 IMPORT_C CHuiDisplay* Display() const; |
|
419 |
|
420 protected: |
|
421 |
|
422 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
423 |
|
424 private: |
|
425 |
|
426 /** Display associated with the command. */ |
|
427 CHuiDisplay* iDisplay; |
|
428 |
|
429 private: |
|
430 TInt iSpare1; |
|
431 TInt iSpare2; |
|
432 }; |
|
433 |
|
434 |
|
435 /** |
|
436 * THuiControlCommand is an object command that operates on a control. |
|
437 */ |
|
438 class THuiControlCommand : public THuiObjectCommand |
|
439 { |
|
440 public: |
|
441 |
|
442 /* Constructor. */ |
|
443 |
|
444 /** |
|
445 * Constructs a new control command. |
|
446 * |
|
447 * @param aControl Control. |
|
448 * @param aOperation Operation to do on the control. |
|
449 */ |
|
450 IMPORT_C THuiControlCommand(CHuiControl& aControl, THuiOp aOperation); |
|
451 |
|
452 /* Implementation of THuiCommand::ExecuteL(). */ |
|
453 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
454 |
|
455 /* Implementation of THuiCommand::Size(). */ |
|
456 IMPORT_C TInt Size() const; |
|
457 |
|
458 |
|
459 /* Methods. */ |
|
460 |
|
461 /** |
|
462 * Returns the control that the command operates on. |
|
463 */ |
|
464 IMPORT_C CHuiControl& Control() const; |
|
465 |
|
466 protected: |
|
467 |
|
468 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
469 |
|
470 private: |
|
471 TInt iSpare1; |
|
472 TInt iSpare2; |
|
473 }; |
|
474 |
|
475 |
|
476 /** |
|
477 * THuiVisualCommand is an object command that operates on a visual. |
|
478 */ |
|
479 class THuiVisualCommand : public THuiObjectCommand |
|
480 { |
|
481 public: |
|
482 |
|
483 /* Constructor. */ |
|
484 |
|
485 /** |
|
486 * Constructs a new visual command. |
|
487 * |
|
488 * @param aVisual Visual. |
|
489 * @param aOperation Operation to do on the visual. |
|
490 */ |
|
491 IMPORT_C THuiVisualCommand(CHuiVisual& aVisual, THuiOp aOperation, |
|
492 TInt aSetFlags = 0, TInt aClearFlags = 0); |
|
493 |
|
494 /* Implementation of THuiCommand::ExecuteL(). */ |
|
495 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
496 |
|
497 /* Implementation of THuiCommand::Size(). */ |
|
498 IMPORT_C TInt Size() const; |
|
499 |
|
500 |
|
501 /* Methods. */ |
|
502 |
|
503 /** |
|
504 * Returns the visual that the command operates on. |
|
505 */ |
|
506 IMPORT_C CHuiVisual& Visual() const; |
|
507 |
|
508 /** |
|
509 * Returns the flags that will be set by the command. |
|
510 */ |
|
511 IMPORT_C TInt FlagsToSet() const; |
|
512 |
|
513 /** |
|
514 * Returns the flags that will be cleared by the command. |
|
515 */ |
|
516 IMPORT_C TInt FlagsToClear() const; |
|
517 |
|
518 protected: |
|
519 |
|
520 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
521 |
|
522 private: |
|
523 |
|
524 /** Flags to set. */ |
|
525 TInt iSetFlags; |
|
526 |
|
527 /** Flags to clear. */ |
|
528 TInt iClearFlags; |
|
529 |
|
530 private: |
|
531 TInt iSpare1; |
|
532 TInt iSpare2; |
|
533 }; |
|
534 |
|
535 |
|
536 /** |
|
537 * THuiImageCommand is a command that operaters on an image visual. |
|
538 */ |
|
539 class THuiImageCommand : public THuiObjectCommand |
|
540 { |
|
541 public: |
|
542 |
|
543 /* Constructor. */ |
|
544 |
|
545 /** |
|
546 * Constructs a new image command. |
|
547 * |
|
548 * @param aImageVisual Image visual. |
|
549 * @param aImage Image. |
|
550 * @param aOperation Operation to do on the visual. |
|
551 */ |
|
552 IMPORT_C THuiImageCommand(CHuiImageVisual& aImageVisual, const THuiImage& aImage, |
|
553 THuiOp aOperation = EHuiOpSetPrimaryImage); |
|
554 |
|
555 /* Implementation of THuiCommand::ExecuteL(). */ |
|
556 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
557 |
|
558 /* Implementation of THuiCommand::Size(). */ |
|
559 IMPORT_C TInt Size() const; |
|
560 |
|
561 |
|
562 /* Methods. */ |
|
563 |
|
564 /** |
|
565 * Returns the visual that the command operates on. |
|
566 */ |
|
567 IMPORT_C CHuiImageVisual& ImageVisual() const; |
|
568 |
|
569 /** |
|
570 * Returns a reference to the image of the visual. |
|
571 */ |
|
572 IMPORT_C const THuiImage& Image() const; |
|
573 |
|
574 protected: |
|
575 |
|
576 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
577 |
|
578 private: |
|
579 |
|
580 /** Image of the command. */ |
|
581 THuiImage iImage; |
|
582 |
|
583 private: |
|
584 TInt iSpare1; |
|
585 TInt iSpare2; |
|
586 }; |
|
587 |
|
588 |
|
589 /** |
|
590 * THuiTextCommand is a command that operaters on a text visual. |
|
591 */ |
|
592 class THuiTextCommand : public THuiObjectCommand |
|
593 { |
|
594 public: |
|
595 |
|
596 /* Constructor. */ |
|
597 |
|
598 /** |
|
599 * Constructs a new text command. |
|
600 * |
|
601 * @param aTextVisual Text visual. |
|
602 * @param aText Text. |
|
603 * @param aOperation Operation to perform. |
|
604 */ |
|
605 IMPORT_C THuiTextCommand(CHuiTextVisual& aTextVisual, const TDesC& aText, |
|
606 THuiOp aOperation = EHuiOpSetText); |
|
607 |
|
608 /* Implementation of THuiCommand::ExecuteL(). */ |
|
609 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
610 |
|
611 /* Implementation of THuiCommand::Size(). */ |
|
612 IMPORT_C TInt Size() const; |
|
613 |
|
614 |
|
615 /* Methods. */ |
|
616 |
|
617 /** |
|
618 * Returns the visual that the command operates on. |
|
619 */ |
|
620 IMPORT_C CHuiTextVisual& TextVisual() const; |
|
621 |
|
622 /** |
|
623 * Returns a reference to the image of the visual. |
|
624 */ |
|
625 IMPORT_C const TDesC& Text() const; |
|
626 |
|
627 protected: |
|
628 |
|
629 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
630 |
|
631 private: |
|
632 |
|
633 /** Text of the command. */ |
|
634 const TDesC& iText; |
|
635 |
|
636 private: |
|
637 TInt iSpare1; |
|
638 TInt iSpare2; |
|
639 }; |
|
640 |
|
641 |
|
642 /** |
|
643 * THuiValueCommand is a command that operates on a single timed value. |
|
644 */ |
|
645 class THuiValueCommand : public THuiObjectCommand |
|
646 { |
|
647 public: |
|
648 |
|
649 /* Constructor. */ |
|
650 |
|
651 /** |
|
652 * Constructs a new value command. |
|
653 * |
|
654 * @param aOwner Owner of the timed value. Allowed to be NULL. |
|
655 * @param aValue Timed value to modify (owned by aOwner). |
|
656 * @param aTarget Target value |
|
657 * @param aTransitionTime Time (in milliseconds) for the transition to occur. |
|
658 */ |
|
659 IMPORT_C THuiValueCommand(TAny* aOwner, THuiTimedValue& aValue, |
|
660 TReal32 aTarget, TInt aTransitionTime = 0) __SOFTFP; |
|
661 |
|
662 /** |
|
663 * Constructs a new value command. This constructor takes an operation |
|
664 * parameter in addition to the target and timing values. |
|
665 * |
|
666 * @param aOwner Owner of the timed value. Allowed to be NULL. |
|
667 * @param aValue Timed value to modify (owned by aOwner). |
|
668 * @param aOperation Operation to perform. |
|
669 * @param aTarget Target value |
|
670 * @param aTiming Time (in milliseconds) for the transition to occur. |
|
671 */ |
|
672 IMPORT_C THuiValueCommand(TAny* aOwner, THuiTimedValue& aValue, |
|
673 THuiOp aOperation = EHuiOpSet, |
|
674 TReal32 aTarget = 0.0, TReal32 aTiming = 0.0) __SOFTFP; |
|
675 |
|
676 /* Implementation of THuiCommand::ExecuteL(). */ |
|
677 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
678 |
|
679 /* Implementation of THuiCommand::Size(). */ |
|
680 IMPORT_C TInt Size() const; |
|
681 |
|
682 |
|
683 /* Methods. */ |
|
684 |
|
685 /** |
|
686 * Returns the visual that the command operates on. |
|
687 */ |
|
688 IMPORT_C THuiTimedValue& TimedValue() const; |
|
689 |
|
690 /** |
|
691 * Returns the target value. |
|
692 */ |
|
693 IMPORT_C TReal32 Target() const __SOFTFP; |
|
694 |
|
695 /** |
|
696 * Returns the transition time. |
|
697 */ |
|
698 IMPORT_C TInt TransitionTime() const; |
|
699 |
|
700 /** |
|
701 * Returns the transition speed. Zero, if not set. |
|
702 */ |
|
703 IMPORT_C TReal32 Speed() const __SOFTFP; |
|
704 |
|
705 protected: |
|
706 |
|
707 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
708 |
|
709 private: |
|
710 |
|
711 /** Timed value being operated on. */ |
|
712 THuiTimedValue& iTimedValue; |
|
713 |
|
714 /** Target value. */ |
|
715 TReal32 iTarget; |
|
716 |
|
717 /** Transition time in milliseconds. */ |
|
718 TInt iTransitionTime; |
|
719 |
|
720 /** Optionally, transition speed in units/second. */ |
|
721 TReal32 iSpeed; |
|
722 |
|
723 private: |
|
724 TInt iSpare1; |
|
725 TInt iSpare2; |
|
726 }; |
|
727 |
|
728 |
|
729 /** |
|
730 * THuiPointCommand is a command that operates on a timed point. |
|
731 */ |
|
732 class THuiPointCommand : public THuiObjectCommand |
|
733 { |
|
734 public: |
|
735 |
|
736 /* Constructor. */ |
|
737 |
|
738 /** |
|
739 * Constructs a new timed point command. |
|
740 * |
|
741 * @param aOwner Owner of the timed point. Allowed to be NULL. |
|
742 * @param aValue Timed point to modify. |
|
743 * @param aPoint Point to execute the command on. |
|
744 * @param aOperation Operation to perform. |
|
745 */ |
|
746 IMPORT_C THuiPointCommand(TAny* aOwner, THuiTimedPoint& aPoint, |
|
747 THuiOp aOperation); |
|
748 |
|
749 /** |
|
750 * Constructs a new timed point command. |
|
751 * |
|
752 * @param aOwner Owner of the timed value. Allowed to be NULL. |
|
753 * @param aPoint Point to execute the command on. |
|
754 * @param aValue Timed value to modify (owned by aOwner). |
|
755 * @param aTarget Target value |
|
756 * @param aTransitionTime Time (in milliseconds) for the transition to occur. |
|
757 */ |
|
758 IMPORT_C THuiPointCommand(TAny* aOwner, THuiTimedPoint& aPoint, |
|
759 THuiRealPoint aTarget, TInt aTransitionTime = 0) __SOFTFP; |
|
760 |
|
761 /** |
|
762 * Constructs a new timed point command. This constructor takes an operation |
|
763 * parameter in addition to the target and timing values. |
|
764 * |
|
765 * @param aOwner Owner of the timed value. Allowed to be NULL. |
|
766 * @param aPoint Point to execute the command on. |
|
767 * @param aValue Timed value to modify (owned by aOwner). |
|
768 * @param aOperation Operation to perform. |
|
769 * @param aTarget Target value. |
|
770 * @param aTiming Time (in milliseconds) for the transition to occur. |
|
771 */ |
|
772 IMPORT_C THuiPointCommand(TAny* aOwner, THuiTimedPoint& aPoint, |
|
773 THuiOp aOperation, |
|
774 THuiRealPoint aTarget, TReal32 aTiming = 0.0) __SOFTFP; |
|
775 |
|
776 /* Implementation of THuiCommand::ExecuteL(). */ |
|
777 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
778 |
|
779 /* Implementation of THuiCommand::Size(). */ |
|
780 IMPORT_C TInt Size() const; |
|
781 |
|
782 |
|
783 /* Methods. */ |
|
784 |
|
785 /** |
|
786 * Returns the timed point that the command operates on. |
|
787 * @return The point that the command operates on. |
|
788 */ |
|
789 IMPORT_C THuiTimedPoint& TimedPoint() const; |
|
790 |
|
791 /** |
|
792 * Returns the target value. |
|
793 * @return The real point that the command operates on. |
|
794 */ |
|
795 IMPORT_C THuiRealPoint Target() const __SOFTFP; |
|
796 |
|
797 /** |
|
798 * Returns the transition time of this point command. |
|
799 * @return The transition time in milliseconds. |
|
800 */ |
|
801 IMPORT_C TInt TransitionTime() const; |
|
802 |
|
803 /** |
|
804 * Returns the transition speed of this point command. |
|
805 * @return the transition speed. Zero, if not set. |
|
806 */ |
|
807 IMPORT_C TReal32 Speed() const __SOFTFP; |
|
808 |
|
809 protected: |
|
810 |
|
811 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
812 |
|
813 private: |
|
814 |
|
815 /** Timed value being operated on. */ |
|
816 THuiTimedPoint& iTimedPoint; |
|
817 |
|
818 /** Target value. */ |
|
819 THuiRealPoint iTarget; |
|
820 |
|
821 /** Transition time in milliseconds. */ |
|
822 TInt iTransitionTime; |
|
823 |
|
824 /** Optionally, transition speed in units/second. */ |
|
825 TReal32 iSpeed; |
|
826 |
|
827 private: |
|
828 TInt iSpare1; |
|
829 TInt iSpare2; |
|
830 }; |
|
831 |
|
832 |
|
833 |
|
834 /** |
|
835 * THuiTransformationCommand is a command that operaters on a transformation. |
|
836 */ |
|
837 class THuiTransformationCommand : public THuiObjectCommand |
|
838 { |
|
839 public: |
|
840 |
|
841 enum |
|
842 { |
|
843 /** Used in the aStep parameter to specify that no step index is |
|
844 specified. */ |
|
845 EStepNone = -1 |
|
846 }; |
|
847 |
|
848 |
|
849 /* Constructor. */ |
|
850 |
|
851 /** |
|
852 * Constructs a new transformation command. |
|
853 * |
|
854 * @param aOwner Owner of the transformation. Allowed be NULL. |
|
855 * @param aTransformation Transformation to operate on. |
|
856 * @param aOperation Operation to perform. |
|
857 * @param aStep Step index in the transformation. |
|
858 */ |
|
859 IMPORT_C THuiTransformationCommand(TAny* aOwner, CHuiTransformation& aTransformation, |
|
860 THuiOp aOperation = EHuiOpLoadIdentity, |
|
861 TInt aStep = EStepNone); |
|
862 |
|
863 /* Implementation of THuiCommand::ExecuteL(). */ |
|
864 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
865 |
|
866 /* Implementation of THuiCommand::Size(). */ |
|
867 IMPORT_C TInt Size() const; |
|
868 |
|
869 /* Methods. */ |
|
870 |
|
871 /** |
|
872 * Returns the transformation that the command operates on. |
|
873 */ |
|
874 IMPORT_C CHuiTransformation& Transformation() const; |
|
875 |
|
876 /** |
|
877 * Returns the transformation step index. |
|
878 */ |
|
879 IMPORT_C TInt Step() const; |
|
880 |
|
881 /** |
|
882 * Sets the X component. |
|
883 * |
|
884 * @param aValue Value. |
|
885 */ |
|
886 IMPORT_C void SetX(const THuiTimedValue& aValue); |
|
887 |
|
888 /** |
|
889 * Returns a reference to the Y component. |
|
890 */ |
|
891 IMPORT_C void SetY(const THuiTimedValue& aValue); |
|
892 |
|
893 /** |
|
894 * Returns a reference to the Z component. |
|
895 */ |
|
896 IMPORT_C void SetZ(const THuiTimedValue& aValue); |
|
897 |
|
898 /** |
|
899 * Returns a reference to the angle component. |
|
900 */ |
|
901 IMPORT_C void SetAngle(const THuiTimedValue& aValue); |
|
902 |
|
903 protected: |
|
904 |
|
905 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
906 |
|
907 private: |
|
908 |
|
909 /** Image of the command. */ |
|
910 CHuiTransformation& iTransformation; |
|
911 |
|
912 /** Step index. */ |
|
913 TInt iStep; |
|
914 |
|
915 /** X component. Suspended. */ |
|
916 THuiTimedValue iX; |
|
917 |
|
918 /** Y component. Suspended. */ |
|
919 THuiTimedValue iY; |
|
920 |
|
921 /** Z component. Suspended. */ |
|
922 THuiTimedValue iZ; |
|
923 |
|
924 /** Angle component. Suspended. */ |
|
925 THuiTimedValue iAngle; |
|
926 |
|
927 private: |
|
928 TInt iSpare1; |
|
929 TInt iSpare2; |
|
930 }; |
|
931 |
|
932 |
|
933 /** |
|
934 * THuiMarkerCommand is a special marker command that has no functionality, |
|
935 * but can be entered into the scheduler to mark a specific point in time. |
|
936 */ |
|
937 class THuiMarkerCommand : public THuiCommand |
|
938 { |
|
939 public: |
|
940 |
|
941 /* Constructor. */ |
|
942 |
|
943 /** |
|
944 * Constructs a new marker command. |
|
945 * |
|
946 * @param aId Identifier of the marker. |
|
947 */ |
|
948 IMPORT_C THuiMarkerCommand(TInt aId); |
|
949 |
|
950 |
|
951 /* Methods. */ |
|
952 |
|
953 /* Implementation of THuiCommand::ExecuteL(). */ |
|
954 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
955 |
|
956 /* Implementation of THuiCommand::Size(). */ |
|
957 IMPORT_C TInt Size() const; |
|
958 |
|
959 /** |
|
960 * Determines the identifier of the marker. |
|
961 * |
|
962 * @param Marker identifier. |
|
963 */ |
|
964 IMPORT_C TInt Id() const; |
|
965 |
|
966 protected: |
|
967 |
|
968 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
969 |
|
970 private: |
|
971 TInt iSpare1; |
|
972 TInt iSpare2; |
|
973 }; |
|
974 |
|
975 |
|
976 /** |
|
977 * THuiCustomEventCommand is a command that sends a custom event. The command |
|
978 * can be sent to any individual MHuiEventHandler derived object or broadcasted to |
|
979 * all CHuiControl derived objects. |
|
980 */ |
|
981 class THuiCustomEventCommand : public THuiObjectCommand |
|
982 { |
|
983 public: |
|
984 |
|
985 /* Constructor. */ |
|
986 |
|
987 /** |
|
988 * Constructs a new custom event command. |
|
989 * |
|
990 * @param aEventParam Parameter of the custom event. |
|
991 * @param aRecipient Optional recipient of the event. If NULL then event is broadcasted. |
|
992 * |
|
993 * @todo It would be good to be able to specify more information to |
|
994 * be sent with the custom event, e.g., a pointer. Also check |
|
995 * out THuiEvent. |
|
996 */ |
|
997 IMPORT_C THuiCustomEventCommand(TInt aEventParam, MHuiEventHandler* aRecipient = NULL); |
|
998 |
|
999 |
|
1000 /* Methods. */ |
|
1001 |
|
1002 /* Implementation of THuiCommand::ExecuteL(). */ |
|
1003 IMPORT_C void ExecuteL(CHuiEnv& aEnv) const; |
|
1004 |
|
1005 /* Implementation of THuiCommand::Size(). */ |
|
1006 IMPORT_C TInt Size() const; |
|
1007 |
|
1008 /** |
|
1009 * Returns the recipient of the event, or NULL if none defined. |
|
1010 */ |
|
1011 IMPORT_C MHuiEventHandler* Recipient() const; |
|
1012 |
|
1013 /** |
|
1014 * Determines the custom event parameter of the command. |
|
1015 * |
|
1016 * @return Parameter. |
|
1017 */ |
|
1018 IMPORT_C TInt Param() const; |
|
1019 |
|
1020 protected: |
|
1021 |
|
1022 IMPORT_C void CommandExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
1023 |
|
1024 private: |
|
1025 |
|
1026 /** Custom event parameter. Application cau use re_interpret_cast to send pointer as param */ |
|
1027 TInt iEventParam; |
|
1028 |
|
1029 TInt iSpare1; |
|
1030 TInt iSpare2; |
|
1031 }; |
|
1032 |
|
1033 #endif // __HUICOMMAND_H__ |