|
1 /* |
|
2 * Copyright (c) 2007-2009 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: This file defines class CESMRFieldCommandEvent. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CESMRFIELDCOMMANDEVENT_H |
|
20 #define CESMRFIELDCOMMANDEVENT_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "mesmrfieldevent.h" |
|
24 |
|
25 /** |
|
26 * Event class for sending command events from field to its observers. |
|
27 * |
|
28 * @code |
|
29 * TESMRFieldCommandEvent event( <command_id> ); |
|
30 * CESMRField::NotifyEvent( event ); |
|
31 * @endcode |
|
32 * |
|
33 * @lib esmrfieldbuildercommon.lib |
|
34 */ |
|
35 NONSHARABLE_CLASS( CESMRFieldCommandEvent ) : public CBase, |
|
36 public MESMRFieldEvent |
|
37 { |
|
38 |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 * |
|
44 * @param aCommand the command id. |
|
45 * @return command event. |
|
46 */ |
|
47 IMPORT_C static CESMRFieldCommandEvent* NewL( MESMRFieldEventNotifier* aSource, |
|
48 TInt aCommand ); |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * |
|
53 * @param aCommand the command id. |
|
54 * @return command event. |
|
55 */ |
|
56 IMPORT_C static CESMRFieldCommandEvent* NewLC( MESMRFieldEventNotifier* aSource, |
|
57 TInt aCommand ); |
|
58 |
|
59 /** |
|
60 * Destructor |
|
61 */ |
|
62 virtual ~CESMRFieldCommandEvent(); |
|
63 |
|
64 // from base class MESMRFieldEvent |
|
65 |
|
66 /** |
|
67 * From MESMRFieldEvent. |
|
68 * Gets event type. |
|
69 * |
|
70 * @return MESMRFieldEvent::EESMRFieldCommandEvent |
|
71 */ |
|
72 MESMRFieldEvent::TEventType Type() const; |
|
73 |
|
74 /** |
|
75 * From MESMRFieldEvent. |
|
76 * Gets the event source. |
|
77 * |
|
78 * @return pointer to the sender or NULL. |
|
79 */ |
|
80 MESMRFieldEventNotifier* Source() const; |
|
81 |
|
82 /** |
|
83 * Gets the parameter count. |
|
84 * @return 1. |
|
85 */ |
|
86 TInt ParamCount() const; |
|
87 |
|
88 /** |
|
89 * Gets the event parameter. |
|
90 * Index 0 returns the command id as TInt. |
|
91 * |
|
92 * @param aIndex parameter index. |
|
93 * @return the parameter. |
|
94 */ |
|
95 TAny* Param( TInt aIndex ) const; |
|
96 |
|
97 private: |
|
98 |
|
99 CESMRFieldCommandEvent( MESMRFieldEventNotifier* aSource ); |
|
100 |
|
101 void ConstructL( TInt aCommand ); |
|
102 |
|
103 private: // data |
|
104 |
|
105 /** |
|
106 * Source. |
|
107 * Not owned. |
|
108 */ |
|
109 MESMRFieldEventNotifier* iSource; |
|
110 |
|
111 /** |
|
112 * Command id. |
|
113 * Own. |
|
114 */ |
|
115 TInt* iCommand; |
|
116 |
|
117 }; |
|
118 |
|
119 #endif // CESMRFIELDCOMMANDEVENT_H |