author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:58:58 +0300 | |
branch | RCL_3 |
changeset 35 | 3321d3e205b6 |
parent 34 | 5456b4e8b3a8 |
permissions | -rw-r--r-- |
34 | 1 |
/* |
2 |
* Copyright (c) 2008 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: Key event dispatcher header |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef __XNKEYEVENTDISPATCHER_H__ |
|
20 |
#define __XNKEYEVENTDISPATCHER_H__ |
|
21 |
||
22 |
// System includes |
|
23 |
#include <e32base.h> |
|
24 |
#include <coecntrl.h> |
|
25 |
#include <eikmobs.h> |
|
26 |
||
27 |
// Uder includes |
|
28 |
#include "xnviewmanager.h" |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
29 |
#include "xnuistatelistener.h" |
34 | 30 |
|
31 |
// Forward declarations |
|
32 |
class CXnNode; |
|
33 |
class CXnUiEngine; |
|
34 |
class CEikButtonGroupContainer; |
|
35 |
class CXnViewData; |
|
36 |
class CXnPluginData; |
|
37 |
||
38 |
// Class declaration |
|
39 |
||
40 |
/** |
|
41 |
* Control adapter class implementation. |
|
42 |
* |
|
43 |
* @ingroup group_xnlayoutengine |
|
44 |
* @lib xn3layoutengine.lib |
|
45 |
* @since Series 60 3.1 |
|
46 |
*/ |
|
47 |
NONSHARABLE_CLASS( CXnKeyEventDispatcher ) : public CCoeControl, |
|
48 |
public MCoeMessageMonitorObserver, |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
49 |
public MXnUiResourceChangeObserver, |
34 | 50 |
public MXnViewObserver |
51 |
{ |
|
52 |
public: |
|
53 |
// Constructors and destructor |
|
54 |
||
55 |
/** |
|
56 |
* Two-phased constructor. |
|
57 |
*/ |
|
58 |
static CXnKeyEventDispatcher* NewL( CXnUiEngine& aUiEngine ); |
|
59 |
||
60 |
/** |
|
61 |
* Destructor. |
|
62 |
*/ |
|
63 |
~CXnKeyEventDispatcher(); |
|
64 |
||
65 |
private: |
|
66 |
// From CCoeControl |
|
67 |
||
68 |
/** |
|
69 |
* @see CCoeControl |
|
70 |
*/ |
|
71 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
72 |
TEventCode aType ); |
|
73 |
||
74 |
private: |
|
75 |
// from MCoeMessageMonitorObserver |
|
76 |
||
77 |
/** |
|
78 |
* @see MCoeMessageMonitorObserver |
|
79 |
*/ |
|
80 |
void MonitorWsMessage( const TWsEvent& aEvent ); |
|
81 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
82 |
private: |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
83 |
// from MXnUiResourceChangeObserver |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
84 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
85 |
/** |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
86 |
* @see MXnUiResourceChangeObserver |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
87 |
*/ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
88 |
void NotifyStatusPaneSizeChanged(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
89 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
90 |
/** |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
91 |
* @see MXnUiResourceChangeObserver |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
92 |
*/ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
93 |
void NotifyResourceChanged( TInt aType ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
94 |
|
34 | 95 |
public: |
96 |
// New functions |
|
97 |
||
98 |
/** |
|
99 |
* Set the node to which key events are given |
|
100 |
* |
|
101 |
* @since Series 60 3.1 |
|
102 |
* @param aNode Node to set |
|
103 |
* @param aSource A source of event that triggered focus change. |
|
104 |
*/ |
|
105 |
void SetNodeL( CXnNode* aNode, TInt aSource = 0 ); |
|
106 |
||
107 |
/** |
|
108 |
* Set the node to which key events are given, but do not notify. |
|
109 |
* |
|
110 |
* @since Series 60 3.1 |
|
111 |
* @param aNode Node to set |
|
112 |
*/ |
|
113 |
void SetNodeWithoutNotificationL( CXnNode* aNode ); |
|
114 |
||
115 |
/** |
|
116 |
* Get the node to which holds focus |
|
117 |
* |
|
118 |
* @since Series 60 3.1 |
|
119 |
* @return Focused node, NULL if no focus. |
|
120 |
*/ |
|
121 |
CXnNode* FocusedNode() const; |
|
122 |
||
123 |
/** |
|
124 |
* Set the node to which menu events are given |
|
125 |
* |
|
126 |
* @since Series 60 3.1 |
|
127 |
* @param aNode Node to set |
|
128 |
*/ |
|
129 |
void SetMenuNodeL( CXnNode* aNode ); |
|
130 |
||
131 |
/** |
|
132 |
* Removes the node to which menu events are given |
|
133 |
* |
|
134 |
* @since Series 60 3.2 |
|
135 |
*/ |
|
136 |
void ResetMenuNodeL(); |
|
137 |
||
138 |
/** |
|
139 |
* Refresh current menu |
|
140 |
* |
|
141 |
* @since Series 60 3.1 |
|
142 |
*/ |
|
143 |
void RefreshMenuL(); |
|
144 |
||
145 |
/** |
|
146 |
* Checks whether the menu is focused. |
|
147 |
* |
|
148 |
* @since S60 3.1 |
|
149 |
* @return ETrue if menu is focused. |
|
150 |
*/ |
|
151 |
TBool IsMenuFocused() const; |
|
152 |
||
153 |
/** |
|
154 |
* Set node as passive, and add it to the passive focused node array. |
|
155 |
* |
|
156 |
* @since Series 60 3.2 |
|
157 |
* @param aNode Node to use. |
|
158 |
*/ |
|
159 |
void AddPassiveFocusedNodeL( CXnNode* aNode ); |
|
160 |
||
161 |
/** |
|
162 |
* Unset the passive focus from the node, and remove it from the passive |
|
163 |
* focused node array. |
|
164 |
* |
|
165 |
* @since Series 60 3.2 |
|
166 |
* @param aNode Node to use. |
|
167 |
*/ |
|
168 |
void RemovePassiveFocusedNodeL( CXnNode* aNode ); |
|
169 |
||
170 |
/** |
|
171 |
* Clear the passive focused node array, and unset the passive focus |
|
172 |
* states. |
|
173 |
* |
|
174 |
* @since Series 60 3.2 |
|
175 |
*/ |
|
176 |
void ClearPassiveFocusedNodesL(); |
|
177 |
||
178 |
/** |
|
179 |
* Clears dispatcher's internal state. |
|
180 |
* |
|
181 |
* @since S60 5.2 |
|
182 |
*/ |
|
183 |
void ClearStateL(); |
|
184 |
||
185 |
/** |
|
186 |
* Returns the last pointer event |
|
187 |
* |
|
188 |
* @since S60 5.2 |
|
189 |
* @return Last pointer event |
|
190 |
*/ |
|
191 |
const TPointerEvent& PointerEvent() const; |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
192 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
193 |
/** |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
194 |
* Sets activate text editor |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
195 |
* |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
196 |
* @since S60 5.2 |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
197 |
* @param aNode Editor Node |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
198 |
* @param TBool True if text editor should be activated |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
199 |
*/ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
200 |
void SetTextEditorActive( CXnNode* aNode, TBool aActivate ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
201 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
202 |
/** |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
203 |
* Queries whether a text editor is active |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
204 |
* |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
205 |
* @since S60 5.2 |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
206 |
* @return ETrue if text editor is active, EFalse otherwise |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
207 |
*/ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
208 |
TBool IsTextEditorActive() const; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
209 |
|
34 | 210 |
private: |
211 |
// new functions |
|
212 |
||
213 |
void SetNodeL( CXnNode* aToLose, CXnNode* aToGain, TBool aNotify, |
|
214 |
TInt aSource = 0 ); |
|
215 |
||
216 |
void ResolveAndSetFocusL(); |
|
217 |
||
218 |
protected: |
|
219 |
// New functions |
|
220 |
||
221 |
/** |
|
222 |
* C++ default constructor. |
|
223 |
*/ |
|
224 |
CXnKeyEventDispatcher( CXnUiEngine& aUiEngine ); |
|
225 |
||
226 |
/** |
|
227 |
* Two-phased constructor. |
|
228 |
*/ |
|
229 |
void ConstructL(); |
|
230 |
||
231 |
private: |
|
232 |
// from MXnViewObserver |
|
233 |
||
234 |
void NotifyViewActivatedL( const CXnViewData& aViewData ); |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
235 |
void NotifyViewLoadedL( const CXnViewData& /*aViewData*/ ) {}; |
34 | 236 |
|
237 |
void NotifyViewDeactivatedL( const CXnViewData& aViewData ); |
|
238 |
||
239 |
void NotifyConfigureWidgetL( const CHsContentInfo& aContentInfo, |
|
240 |
CXnPluginData& aPluginData ); |
|
241 |
||
242 |
void NotifyWidgetAdditionL( const CXnPluginData& aPluginData ); |
|
243 |
void NotifyWidgetRemovalL( const CXnPluginData& aPluginData ); |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
244 |
void NotifyViewAdditionL( const CXnViewData& /*aViewData*/ ){}; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
245 |
void NotifyViewRemovalL( const CXnViewData& /*aViewData*/ ){}; |
34 | 246 |
void NotifyAllViewsLoadedL(){}; |
247 |
void NotifyContainerActivatedL( const CXnViewData& /*aViewData*/ ){}; |
|
248 |
||
249 |
private: |
|
250 |
// Data |
|
251 |
||
252 |
/** Reference to uiengine */ |
|
253 |
CXnUiEngine& iUiEngine; |
|
254 |
/** Losefocus trigger, owned */ |
|
255 |
CXnNode* iLoseFocus; |
|
256 |
/** Gainfocus trigger, owned */ |
|
257 |
CXnNode* iGainFocus; |
|
258 |
/** Node that receives key events */ |
|
259 |
CXnNode* iNode; |
|
260 |
/** Previous key event receiver */ |
|
261 |
CXnNode* iPreviousNode; |
|
262 |
/** Node that receives menu events */ |
|
263 |
CXnNode* iMenuNode; |
|
264 |
/** Node that was focused when keyevent started */ |
|
265 |
CXnNode* iKeyEventNode; |
|
266 |
/** Event code for keyevents */ |
|
267 |
TEventCode iEventCode; |
|
268 |
/** Focused node is changed during keyevent process */ |
|
269 |
TBool iFocusChanged; |
|
270 |
/** Command button array for softkeys, not owned */ |
|
271 |
CEikButtonGroupContainer* iCbaContainer; |
|
272 |
/** For storing the nodes that have passive focus. */ |
|
273 |
RPointerArray< CXnNode > iPassiveFocusedNodes; |
|
274 |
/** Last pointer event */ |
|
275 |
TPointerEvent iPointerEvent; |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
276 |
/** Active text editor node, not owned */ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
277 |
CXnNode* iActiveTextEditor; |
34 | 278 |
}; |
279 |
||
280 |
#endif //__XNKEYEVENTDISPATCHER_H__ |