|
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 CESMRFieldEventQueue. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CESMRFIELDEVENTQUEUE_H |
|
20 #define CESMRFIELDEVENTQUEUE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "mesmrfieldeventqueue.h" |
|
25 |
|
26 /** |
|
27 * CESMRFieldEventQueue defines an field event queue for ESMR GUI. |
|
28 * |
|
29 * @code |
|
30 * |
|
31 * @endcode |
|
32 * |
|
33 * @lib esmrgui.lib |
|
34 */ |
|
35 NONSHARABLE_CLASS( CESMRFieldEventQueue ) : public CBase, |
|
36 public MESMRFieldEventQueue |
|
37 { |
|
38 |
|
39 public: |
|
40 |
|
41 static CESMRFieldEventQueue* NewL(); |
|
42 static CESMRFieldEventQueue* NewLC(); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 virtual ~CESMRFieldEventQueue(); |
|
48 |
|
49 // from base class MESMRFieldEventQueue |
|
50 |
|
51 /** |
|
52 * From MESMRFieldEventQueue. |
|
53 * Adds observer to the event queue. |
|
54 * |
|
55 * @param aObserver the observer. |
|
56 */ |
|
57 void AddObserverL( MESMRFieldEventObserver* aObserver ); |
|
58 |
|
59 /** |
|
60 * From MESMRFieldEventQueue. |
|
61 * Removes observer from the event queue. |
|
62 * |
|
63 * @param aObserver the observer. |
|
64 */ |
|
65 void RemoveObserver( MESMRFieldEventObserver* aObserver ); |
|
66 |
|
67 /** |
|
68 * From MESMRFieldEventQueue. |
|
69 * Notifies event to the event observers in the queue. |
|
70 * Event is notified synchronously. |
|
71 * |
|
72 * @param aEvent the event. |
|
73 */ |
|
74 void NotifyEventL( const MESMRFieldEvent& aEvent ); |
|
75 |
|
76 /** |
|
77 * From MESMRFieldEventQueue. |
|
78 * Enques event to event queue and notifies it asynchronously to |
|
79 * the observers. Ownership of the event is transferred to the queue. |
|
80 * |
|
81 * @param aEvent the event to enque to the event queue. |
|
82 */ |
|
83 void NotifyEventAsyncL( MESMRFieldEvent* aEvent ); |
|
84 |
|
85 /** |
|
86 * From MESMRFieldEventQueue. |
|
87 * Removes event from the event queue. |
|
88 * |
|
89 * @param aEvent the event to remove from the event queue. |
|
90 */ |
|
91 void CancelEvent( MESMRFieldEvent* aEvent ); |
|
92 |
|
93 private: |
|
94 |
|
95 CESMRFieldEventQueue(); |
|
96 |
|
97 void ConstructL(); |
|
98 |
|
99 static TInt NotifyCallBack( TAny* aPtr ); |
|
100 |
|
101 void DoNotifyEventAsyncL(); |
|
102 |
|
103 TBool HasEvents() const; |
|
104 |
|
105 void Start(); |
|
106 |
|
107 private: // data |
|
108 |
|
109 /** |
|
110 * Observer array |
|
111 */ |
|
112 RPointerArray< MESMRFieldEventObserver > iObservers; |
|
113 |
|
114 /** |
|
115 * Event queue |
|
116 */ |
|
117 RPointerArray< MESMRFieldEvent > iEventQueue; |
|
118 |
|
119 /** |
|
120 * Current observer index |
|
121 */ |
|
122 TInt iNotifyIndex; |
|
123 |
|
124 /** |
|
125 * Idle callback. Own. |
|
126 */ |
|
127 CIdle* iIdle; |
|
128 }; |
|
129 |
|
130 #endif // CESMRFIELDEVENTQUEUE_H |