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) 2002-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: Implementation part of bridge pattern in CXnNode |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// System includes |
|
19 |
#include <AknUtils.h> |
|
20 |
#include <utf.h> |
|
21 |
#include <mmf/common/mmfcontrollerpluginresolver.h> |
|
22 |
||
23 |
// User includes |
|
24 |
#include "xnnodeimpl.h" |
|
25 |
#include "xnnode.h" |
|
26 |
#include "xnpropertylist.h" |
|
27 |
#include "xnproperty.h" |
|
28 |
#include "xnuiengine.h" |
|
29 |
#include "xnappuiadapter.h" |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
30 |
#include "xnkeyeventdispatcher.h" |
34 | 31 |
#include "xncontroladapter.h" |
32 |
#include "xnpopupcontroladapter.h" |
|
33 |
#include "xnmenuadapter.h" |
|
34 |
#include "xndomlist.h" |
|
35 |
#include "xndomdocument.h" |
|
36 |
#include "xnpointerarray.h" |
|
37 |
#include "xnodt.h" |
|
38 |
#include "xntype.h" |
|
39 |
#include "xndomnode.h" |
|
40 |
#include "xndomattribute.h" |
|
41 |
#include "xndompropertyvalue.h" |
|
42 |
#include "xnpopup.h" |
|
43 |
#include "c_xnutils.h" |
|
44 |
#include "xneditmode.h" |
|
45 |
#include "xneditor.h" |
|
46 |
#include "xntext.h" |
|
47 |
#include "xnscrollablecontroladapter.h" |
|
48 |
#include "xnviewdata.h" |
|
49 |
#include "xnrootdata.h" |
|
50 |
#include "xnpanic.h" |
|
51 |
#include "xnlistquerydialogadapter.h" |
|
52 |
#include "xneffectmanager.h" |
|
53 |
#include "xnviewadapter.h" |
|
54 |
#include "xnbackgroundmanager.h" |
|
55 |
#include "xnitemactivator.h" |
|
56 |
||
57 |
// Local constants |
|
58 |
_LIT8( KId, "id" ); |
|
59 |
_LIT8( KName, "name" ); |
|
60 |
_LIT8( KToolTip, "tooltip" ); |
|
61 |
_LIT8( KMenuBar, "menubar" ); |
|
62 |
_LIT8( KTextEditor, "texteditor" ); |
|
63 |
_LIT8( KPlugin, "plugin" ); |
|
64 |
_LIT8( KTemplate, "template" ); |
|
65 |
_LIT8( KIndex, "index" ); |
|
66 |
||
67 |
_LIT8( KActionsHandler, "actionshandler" ); |
|
68 |
||
69 |
const TInt KUnitMaxLen = 2; |
|
70 |
const TInt KOneView = 1; |
|
71 |
||
72 |
_LIT8( KPseudoClassFocus, "focus" ); |
|
73 |
_LIT8( KPseudoClassPressedDown, "presseddown" ); |
|
74 |
_LIT8( KPseudoClassPassiveFocus, "passivefocus" ); |
|
75 |
_LIT8( KPseudoClassHold, "hold" ); |
|
76 |
_LIT8( KPseudoClassHover, "hover" ); |
|
77 |
_LIT8( KPseudoClassLink, "link" ); |
|
78 |
_LIT8( KPseudoClassVisited, "visited" ); |
|
79 |
_LIT8( KPseudoClassActive, "active" ); |
|
80 |
_LIT8( KPseudoClassEdit, "edit" ); |
|
81 |
||
82 |
_LIT8( KCompound, "compound" ); |
|
83 |
_LIT8( KTrue, "true" ); |
|
84 |
_LIT8( KDisplay, "display" ); |
|
85 |
_LIT8( KBlock, "block" ); |
|
86 |
_LIT8( KNone, "none" ); |
|
87 |
_LIT8( KGainEnd, "gainend" ); |
|
88 |
_LIT8( KLoseEnd, "loseend" ); |
|
89 |
||
90 |
struct CLayoutPropertyCache : public CBase |
|
91 |
{ |
|
92 |
CLayoutPropertyCache() : |
|
93 |
iWidths( 1 ), |
|
94 |
iHeights( 1 ), |
|
95 |
iMarginLefts( 1 ), |
|
96 |
iMarginRights( 1 ), |
|
97 |
iBorderLefts( 1 ), |
|
98 |
iBorderRights( 1 ), |
|
99 |
iPaddingLefts( 1 ), |
|
100 |
iPaddingRights( 1 ), |
|
101 |
iMarginTops( 1 ), |
|
102 |
iMarginBottoms( 1 ), |
|
103 |
iBorderTops( 1 ), |
|
104 |
iBorderBottoms( 1 ), |
|
105 |
iPaddingTops( 1 ), |
|
106 |
iPaddingBottoms( 1 ), |
|
107 |
iBorderWidths( 1 ), |
|
108 |
iBlockProgressions( 1 ), |
|
109 |
iDirections( 1 ), |
|
110 |
iPositions( 1 ), |
|
111 |
iMaxHeights( 1 ), |
|
112 |
iMinHeights( 1 ), |
|
113 |
iMaxWidths( 1 ), |
|
114 |
iMinWidths( 1 ), |
|
115 |
iDisplays( 2 ), |
|
116 |
iVisibilities( 1 ), |
|
117 |
iLefts( 1 ), |
|
118 |
iRights( 1 ), |
|
119 |
iTops( 1 ), |
|
120 |
iBottoms( 1 ), |
|
121 |
iBorderLeftStyles( 1 ), |
|
122 |
iBorderRightStyles( 1 ), |
|
123 |
iBorderTopStyles( 1 ), |
|
124 |
iBorderBottomStyles( 1 ), |
|
125 |
iBorderStyles( 1 ), |
|
126 |
iDisplayPriorities( 1 ), |
|
127 |
iNavIndexes( 1 ), |
|
128 |
iBackgroundColors( 1 ), |
|
129 |
iBackgroundImages( 1 ), |
|
130 |
iFocusBackgrounds( 2 ) |
|
131 |
{ |
|
132 |
} |
|
133 |
||
134 |
~CLayoutPropertyCache() |
|
135 |
{ |
|
136 |
iWidths.Reset(); |
|
137 |
iHeights.Reset(); |
|
138 |
iMarginLefts.Reset(); |
|
139 |
iMarginRights.Reset(); |
|
140 |
iBorderLefts.Reset(); |
|
141 |
iBorderRights.Reset(); |
|
142 |
iPaddingLefts.Reset(); |
|
143 |
iPaddingRights.Reset(); |
|
144 |
iMarginTops.Reset(); |
|
145 |
iMarginBottoms.Reset(); |
|
146 |
iBorderTops.Reset(); |
|
147 |
iBorderBottoms.Reset(); |
|
148 |
iPaddingTops.Reset(); |
|
149 |
iPaddingBottoms.Reset(); |
|
150 |
iBorderWidths.Reset(); |
|
151 |
iBlockProgressions.Reset(); |
|
152 |
iDirections.Reset(); |
|
153 |
iPositions.Reset(); |
|
154 |
iMaxHeights.Reset(); |
|
155 |
iMinHeights.Reset(); |
|
156 |
iMaxWidths.Reset(); |
|
157 |
iMinWidths.Reset(); |
|
158 |
iDisplays.Reset(); |
|
159 |
iVisibilities.Reset(); |
|
160 |
iLefts.Reset(); |
|
161 |
iRights.Reset(); |
|
162 |
iTops.Reset(); |
|
163 |
iBottoms.Reset(); |
|
164 |
iBorderLeftStyles.Reset(); |
|
165 |
iBorderRightStyles.Reset(); |
|
166 |
iBorderTopStyles.Reset(); |
|
167 |
iBorderBottomStyles.Reset(); |
|
168 |
iBorderStyles.Reset(); |
|
169 |
iDisplayPriorities.Reset(); |
|
170 |
iNavIndexes.Reset(); |
|
171 |
iBackgroundColors.Reset(); |
|
172 |
iZIndexes.Reset(); |
|
173 |
iBackgroundImages.Reset(); |
|
174 |
iFocusBackgrounds.Reset(); |
|
175 |
} |
|
176 |
||
177 |
CXnProperty* iWidth; |
|
178 |
RPointerArray< CXnProperty > iWidths; |
|
179 |
CXnProperty* iHeight; |
|
180 |
RPointerArray< CXnProperty > iHeights; |
|
181 |
CXnProperty* iMarginLeft; |
|
182 |
RPointerArray< CXnProperty > iMarginLefts; |
|
183 |
CXnProperty* iMarginRight; |
|
184 |
RPointerArray< CXnProperty > iMarginRights; |
|
185 |
CXnProperty* iBorderLeft; |
|
186 |
RPointerArray< CXnProperty > iBorderLefts; |
|
187 |
CXnProperty* iBorderRight; |
|
188 |
RPointerArray< CXnProperty > iBorderRights; |
|
189 |
CXnProperty* iPaddingLeft; |
|
190 |
RPointerArray< CXnProperty > iPaddingLefts; |
|
191 |
CXnProperty* iPaddingRight; |
|
192 |
RPointerArray< CXnProperty > iPaddingRights; |
|
193 |
CXnProperty* iMarginTop; |
|
194 |
RPointerArray< CXnProperty > iMarginTops; |
|
195 |
CXnProperty* iMarginBottom; |
|
196 |
RPointerArray< CXnProperty > iMarginBottoms; |
|
197 |
CXnProperty* iBorderTop; |
|
198 |
RPointerArray< CXnProperty > iBorderTops; |
|
199 |
CXnProperty* iBorderBottom; |
|
200 |
RPointerArray< CXnProperty > iBorderBottoms; |
|
201 |
CXnProperty* iPaddingTop; |
|
202 |
RPointerArray< CXnProperty > iPaddingTops; |
|
203 |
CXnProperty* iPaddingBottom; |
|
204 |
RPointerArray< CXnProperty > iPaddingBottoms; |
|
205 |
CXnProperty* iBorderWidth; |
|
206 |
RPointerArray< CXnProperty > iBorderWidths; |
|
207 |
CXnProperty* iBlockProgression; |
|
208 |
RPointerArray< CXnProperty > iBlockProgressions; |
|
209 |
CXnProperty* iDirection; |
|
210 |
RPointerArray< CXnProperty > iDirections; |
|
211 |
CXnProperty* iPosition; |
|
212 |
RPointerArray< CXnProperty > iPositions; |
|
213 |
CXnProperty* iMaxHeight; |
|
214 |
RPointerArray< CXnProperty > iMaxHeights; |
|
215 |
CXnProperty* iMinHeight; |
|
216 |
RPointerArray< CXnProperty > iMinHeights; |
|
217 |
CXnProperty* iMaxWidth; |
|
218 |
RPointerArray< CXnProperty > iMaxWidths; |
|
219 |
CXnProperty* iMinWidth; |
|
220 |
RPointerArray< CXnProperty > iMinWidths; |
|
221 |
CXnProperty* iDisplay; |
|
222 |
RPointerArray< CXnProperty > iDisplays; |
|
223 |
CXnProperty* iVisibility; |
|
224 |
RPointerArray< CXnProperty > iVisibilities; |
|
225 |
CXnProperty* iLeft; |
|
226 |
RPointerArray< CXnProperty > iLefts; |
|
227 |
CXnProperty* iRight; |
|
228 |
RPointerArray< CXnProperty > iRights; |
|
229 |
CXnProperty* iTop; |
|
230 |
RPointerArray< CXnProperty > iTops; |
|
231 |
CXnProperty* iBottom; |
|
232 |
RPointerArray< CXnProperty > iBottoms; |
|
233 |
CXnProperty* iBorderLeftStyle; |
|
234 |
RPointerArray< CXnProperty > iBorderLeftStyles; |
|
235 |
CXnProperty* iBorderRightStyle; |
|
236 |
RPointerArray< CXnProperty > iBorderRightStyles; |
|
237 |
CXnProperty* iBorderTopStyle; |
|
238 |
RPointerArray< CXnProperty > iBorderTopStyles; |
|
239 |
CXnProperty* iBorderBottomStyle; |
|
240 |
RPointerArray< CXnProperty > iBorderBottomStyles; |
|
241 |
CXnProperty* iBorderStyle; |
|
242 |
RPointerArray< CXnProperty > iBorderStyles; |
|
243 |
CXnProperty* iBorderImage; |
|
244 |
CXnProperty* iDisplayPriority; |
|
245 |
RPointerArray< CXnProperty > iDisplayPriorities; |
|
246 |
CXnProperty* iNavIndex; |
|
247 |
RPointerArray< CXnProperty > iNavIndexes; |
|
248 |
CXnProperty* iZIndex; |
|
249 |
RPointerArray< CXnProperty > iZIndexes; |
|
250 |
CXnProperty* iBackgroundColor; |
|
251 |
RPointerArray< CXnProperty > iBackgroundColors; |
|
252 |
CXnProperty* iBackgroundImage; |
|
253 |
RPointerArray< CXnProperty > iBackgroundImages; |
|
254 |
CXnProperty* iFocusBackground; |
|
255 |
RPointerArray< CXnProperty > iFocusBackgrounds; |
|
256 |
}; |
|
257 |
||
258 |
// Local function prototypes |
|
259 |
static TBool IsTriggerRunnableL( CXnDomNode& aTriggerNode ); |
|
260 |
static TBool DoMatchTriggerForKeyEventL( |
|
261 |
const TKeyEvent& aKeyEvent, |
|
262 |
TEventCode aType, |
|
263 |
CXnDomNode& aTriggerNode ); |
|
264 |
static void GetFocusCandidatesL( |
|
265 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnDomNode& aEventNode, |
|
266 |
RPointerArray< CXnNode >& aFocusCandidates ); |
|
267 |
static void RunAppUiNotificationL( CXnUiEngine& aEngine, CXnNode& aNode, |
|
268 |
CXnDomNode& aEventNode, CXnDomNode& aTriggerNode, CXnNode& aEventData ); |
|
269 |
static void RunFullScreenEffectL( |
|
270 |
CXnUiEngine& aEngine, CXnDomNode& aEventNode ); |
|
271 |
static void RunActivateNextViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ); |
|
272 |
static void RunActivatePreviousViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ); |
|
273 |
static void RunAddViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ); |
|
274 |
static void RunRemoveViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ); |
|
275 |
static void RunActivateL( |
|
276 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnDomNode& aEventNode ); |
|
277 |
static void RunActivateEditorL( CXnNodeImpl* aThis, CXnNode& aLayoutNode, |
|
278 |
CXnUiEngine& aEngine, CXnDomNode& aEventNode, TBool aActivate ); |
|
279 |
static void RunDeactivateL( |
|
280 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnDomNode& aEventNode ); |
|
281 |
static void RunSystemSetPCDataL( |
|
282 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, const TDesC8& aId, |
|
283 |
const TDesC8& aData ); |
|
284 |
static void GetNumberValues( const TDesC8& aData, TReal& aNumber, |
|
285 |
CXnDomPropertyValue::TPrimitiveValueType& aValueType ); |
|
286 |
static void RunSystemSetNumberL( CXnUiEngine& aEngine, CXnNode* aNode, |
|
287 |
const TDesC8& aName, const RPointerArray< HBufC8 >& aValues ); |
|
288 |
static void RunSystemSetRGBL( CXnUiEngine& aEngine, CXnNode* aNode, |
|
289 |
const TDesC8& aName, const RPointerArray< HBufC8 >& aValues ); |
|
290 |
static void RunSystemSetStringL( |
|
291 |
CXnUiEngine& aEngine, CXnNode* aNode, const TDesC8& aName, |
|
292 |
const RPointerArray< HBufC8 >& aValues, |
|
293 |
const CXnDomPropertyValue::TPrimitiveValueType aValueType ); |
|
294 |
static void GetSystemSetDataL( CXnDomNode& aDomNode, HBufC8*& aId, |
|
295 |
const TDesC8** aPseudoClass = NULL, const TDesC8** aName = NULL, |
|
296 |
RPointerArray< HBufC8 >* aValues = NULL, const TDesC8** aType = NULL, |
|
297 |
TBool aSettings = EFalse, const TDesC8& aProvidedId = KNullDesC8, |
|
298 |
const TDesC8** aClassId = NULL ); |
|
299 |
static void RunSystemSetL( |
|
300 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnDomNode& aEventNode, |
|
301 |
TBool aSettings = EFalse, const TDesC8& aId = KNullDesC8 ); |
|
302 |
static void RunTryDisplayingMenuL( |
|
303 |
CXnUiEngine& aEngine, CXnDomNode& aEventNode ); |
|
304 |
static void RunTryDisplayingStylusPopupL( |
|
305 |
CXnNodeImpl* aThis, CXnNode& aNode, CXnUiEngine& aEngine, |
|
306 |
CXnDomNode& aEventNode ); |
|
307 |
static void RunTryDisplayingListQueryDialogL( |
|
308 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnDomNode& aEventNode ); |
|
309 |
static void RunSetInitialFocusL( CXnUiEngine& aEngine ); |
|
310 |
static TBool RunEventL( |
|
311 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode, |
|
312 |
CXnDomNode& aEventNode, CXnDomNode& aTriggerNode, CXnNode& aEventData ); |
|
313 |
static void RunEventsL( CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode, |
|
314 |
CXnDomNode& aActionNode, CXnDomNode& aTriggerNode, CXnNode& aEventData ); |
|
315 |
static TBool DoMatchTriggerForHighLevelKeyEventL( CXnNode& aNode, |
|
316 |
const TKeyEvent& aKeyEvent, TEventCode aType, const TDesC8& highLevelKey ); |
|
317 |
static TBool MatchTriggerForKeyEventL( |
|
318 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode, |
|
319 |
const TKeyEvent& aKeyEvent, TEventCode aType, |
|
320 |
CXnDomNode& aActionNode, CXnDomNode& aTriggerNode ); |
|
321 |
static TBool MatchTriggerForEventL( |
|
322 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode, |
|
323 |
CXnNode& aEventData, CXnDomNode& aActionNode, CXnDomNode& aTriggerNode, |
|
324 |
TInt aSource ); |
|
325 |
static TBool MatchActionForKeyEventL( |
|
326 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode, |
|
327 |
const TKeyEvent& aKeyEvent, TEventCode aType, CXnDomNode& aActionNode ); |
|
328 |
static TBool IsTriggerActiveL( CXnDomNode& aNode ); |
|
329 |
static TBool MatchActionForEventL( |
|
330 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode, |
|
331 |
CXnNode& aEventData, CXnDomNode& aActionNode, TInt aSource ); |
|
332 |
static CXnNode* FindLoopedFocusableNodeL( CXnNode& aNode, TBool aForward ); |
|
333 |
static CXnNode* FindNextFocusableNodeByNavIndexL( CXnNode& aNode, TBool aForward ); |
|
334 |
static TBool FindNextFocusableNodeL( CXnNode& aNode, TBool aForward ); |
|
335 |
static CXnNode* FindNextNodeFromRightL( |
|
336 |
RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse, CXnUiEngine* aEngine = NULL ); |
|
337 |
static CXnNode* FindNextNodeFromLeftL( |
|
338 |
RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse, CXnUiEngine* aEngine = NULL ); |
|
339 |
static CXnNode* FindNextNodeFromBelowL( |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
340 |
RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse, CXnUiEngine* aEngine = NULL ); |
34 | 341 |
static CXnNode* FindNextNodeFromAboveL( |
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
342 |
RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse, CXnUiEngine* aEngine = NULL ); |
34 | 343 |
static CXnNode* FindPluginNode( CXnNode& aNode ); |
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
344 |
static TBool IsPluginNode( CXnNode& aNode ); |
34 | 345 |
static TBool DoInternalFocusChangeL( |
346 |
CXnUiEngine& aEngine, CXnNode& aNode, const TKeyEvent& aKeyEvent, |
|
347 |
TEventCode aType ); |
|
348 |
static TBool DoTriggerKeyEventL( |
|
349 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode, |
|
350 |
const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
351 |
static void DoTriggerEventL( |
|
352 |
CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode, |
|
353 |
CXnNode& aActionsParent, CXnNode& aEventData, TInt aSource ); |
|
354 |
static TBool DoReceiveFocusL( CXnNode& aNode, CXnUiEngine& aEngine ); |
|
355 |
static void InformPropertyChangeL( CXnNode& aNode, CXnProperty* aProperty = NULL ); |
|
356 |
static CXnNode* BuildEventTypeNodeL( TEventCode aType, CXnUiEngine& aUiEngine ); |
|
357 |
static CXnNode* BuildModifiersNodeL( |
|
358 |
const TKeyEvent& aKeyEvent, CXnUiEngine& aUiEngine ); |
|
359 |
static CXnNode* BuildKeyCodeNodeL( |
|
360 |
const TKeyEvent& aKeyEvent, CXnUiEngine& aUiEngine ); |
|
361 |
static CXnNode* BuildScanCodeNodeL( |
|
362 |
const TKeyEvent& aKeyEvent, CXnUiEngine& aUiEngine ); |
|
363 |
static CXnNode* BuildRepeatsNodeL( |
|
364 |
const TKeyEvent& aKeyEvent, CXnUiEngine& aUiEngine ); |
|
365 |
static void BuildPropertyNodesL( CXnNode& aNode, const TKeyEvent& aKeyEvent, |
|
366 |
TEventCode aType, CXnUiEngine& aUiEngine ); |
|
367 |
static CXnNode* BuildKeyTriggerNodeL( const TKeyEvent& aKeyEvent, TEventCode aType, |
|
368 |
CXnUiEngine& aUiEngine ); |
|
369 |
static CXnDomPropertyValue* GetNavIndexL( CXnNode& aNode ); |
|
370 |
static CXnNode* BackwardL( CXnNode& aNode ); |
|
371 |
static CXnNode* ForwardL( CXnNode& aNode ); |
|
372 |
static CXnNode* BackwardLoopL( CXnNode& aNode ); |
|
373 |
static CXnNode* ForwardLoopL( CXnNode& aNode ); |
|
374 |
static TInt CompareNavIndexesL( |
|
375 |
CXnDomPropertyValue* aCurrentPropertyValue, |
|
376 |
CXnDomPropertyValue* aNextPropertyValue ); |
|
377 |
static void ReplaceOrAppend( |
|
378 |
CXnProperty* aProperty, RPointerArray< CXnProperty >& aArray, |
|
379 |
TBool aAppendOnly ); |
|
380 |
static TBool DisplayValueMatchL( CXnNode& aNode, const TDesC8& aDisplayValue ); |
|
381 |
static void SetStringPropertyToNodeL( |
|
382 |
CXnDomStringPool& aStringPool, CXnNode& aNode, |
|
383 |
const TDesC8& aPropertyName, const TDesC8& aPropertyValue ); |
|
384 |
static void SetFloatPropertyToNodeL( |
|
385 |
CXnDomStringPool& aStringPool, CXnNode& aNode, |
|
386 |
const TDesC8& aPropertyName, TReal aPropertyValue, |
|
387 |
CXnDomPropertyValue::TPrimitiveValueType aValueType ); |
|
388 |
static CXnNode* FindYoungestSiblingWithDisplayL( |
|
389 |
RPointerArray< CXnNode >& aSiblingArray, |
|
390 |
const TDesC8& aDisplayValue, |
|
391 |
TInt& aIndex ); |
|
392 |
static CXnNode* FindOldestSiblingWithDisplayL( |
|
393 |
RPointerArray< CXnNode >& aSiblingArray, |
|
394 |
const TDesC8& aDisplayValue, |
|
395 |
TInt& aIndex ); |
|
396 |
static TBool IsCompoundNodeL( CXnNode* aNode ); |
|
397 |
static void NotifyScrollNodeL( CXnNode* aNode, TBool aBegin, TBool aGainEnd ); |
|
398 |
static void DoCompoundNodeBeginKeyL( |
|
399 |
RPointerArray< CXnNode >& aChildren, CXnNode* aFocusedNode ); |
|
400 |
static void DoCompoundNodeEndKeyL( |
|
401 |
RPointerArray< CXnNode >& aChildren, CXnNode* aFocusedNode ); |
|
402 |
static void DoCompoundNodeScrollingL( |
|
403 |
CXnNode& aFocusedNode, |
|
404 |
const TKeyEvent& aKeyEvent, |
|
405 |
TEventCode aType ); |
|
406 |
static CXnNode* BuildTriggerNodeL( |
|
407 |
CXnUiEngine& aUiEngine, const TDesC8& aTriggerName ); |
|
408 |
static CXnNode* IsNodeNavigableL( CXnNode* aParent ); |
|
409 |
static TBool IsNodeNavigableL( CXnNode& aNode, TBool aIgnoreDropped = EFalse ); |
|
410 |
static TInt DirtyLevelFromPropertyL( CXnNode& aNode, const TDesC8& aPropName ); |
|
411 |
static TBool IsNodeDisplayedL( |
|
412 |
CXnNode& aNode, TBool aCheckVisiblity = EFalse, TBool aCheckParent = ETrue ); |
|
413 |
static void EnableStatePropertyL( |
|
414 |
CXnNode& aNode, |
|
415 |
CXnDomProperty::TPseudoClass aPseudoClass, |
|
416 |
CXnProperty* ( CXnNode::* aGetCachedPropertyL )(), |
|
417 |
CXnProperty*& aProperty, |
|
418 |
RPointerArray< CXnProperty >& aArray, TInt& aLevel, |
|
419 |
TBool aInformChange = EFalse ); |
|
420 |
static void DisableStatePropertyL( |
|
421 |
CXnNode& aNode, |
|
422 |
CXnDomProperty::TPseudoClass aPseudoClass, |
|
423 |
CXnProperty* ( CXnNode::* aGetCachedPropertyL )(), |
|
424 |
CXnProperty*& aProperty, |
|
425 |
RPointerArray< CXnProperty >& aArray, |
|
426 |
RArray< CXnDomProperty::TPseudoClass >& aStates, TInt& aLevel, |
|
427 |
TBool aInformChange = EFalse ); |
|
428 |
static TBool MatchTitleScrollTriggerL( |
|
429 |
CXnNode& aEventData, CXnDomNode& aTriggerNode ); |
|
430 |
static CXnDomNode* GetTemplateEventL( |
|
431 |
const TDesC8& aTemplate, |
|
432 |
CXnNode& aNode, |
|
433 |
CXnDomNode& aEventNode ); |
|
434 |
||
435 |
// ============================= LOCAL FUNCTIONS =============================== |
|
436 |
// ----------------------------------------------------------------------------- |
|
437 |
// GetTemplateEventL |
|
438 |
// ----------------------------------------------------------------------------- |
|
439 |
// |
|
440 |
static CXnDomNode* GetTemplateEventL( const TDesC8& aTemplate, CXnNode& aNode, |
|
441 |
CXnDomNode& aEventNode ) |
|
442 |
{ |
|
443 |
CXnDomNode* retval( NULL ); |
|
444 |
||
445 |
if ( aTemplate == KIndex() ) |
|
446 |
{ |
|
447 |
_LIT8( KTemplateIndex, "(#)" ); |
|
448 |
||
449 |
const TDesC8& eventString( aEventNode.AttributeValue( KName ) ); |
|
450 |
||
451 |
TInt index( eventString.Find( KTemplateIndex ) ); |
|
452 |
||
453 |
CXnNode* parent( aNode.Parent() ); |
|
454 |
||
455 |
if ( index != KErrNotFound && parent ) |
|
456 |
{ |
|
457 |
RPointerArray< CXnNode >& siblings( parent->Children() ); |
|
458 |
||
459 |
TInt itemindex( siblings.Find( &aNode ) ); |
|
460 |
||
461 |
if ( itemindex != KErrNotFound ) |
|
462 |
{ |
|
463 |
TBuf8< 4 > buf; |
|
464 |
buf.AppendNum( itemindex ); |
|
465 |
||
466 |
CXnDomNode* clone( |
|
467 |
aEventNode.CloneL( *aEventNode.StringPool() ) ); |
|
468 |
CleanupStack::PushL( clone ); |
|
469 |
||
470 |
HBufC8* templateString = |
|
471 |
HBufC8::NewLC( eventString.Length() + 4 ); |
|
472 |
||
473 |
TPtr8 ptr( templateString->Des() ); |
|
474 |
||
475 |
ptr.Copy( eventString ); |
|
476 |
ptr.Delete( index + 1, 1 ); |
|
477 |
ptr.Insert( index + 1, buf ); |
|
478 |
||
479 |
CXnDomAttribute* attribute = static_cast< CXnDomAttribute* > |
|
480 |
( clone->AttributeList().FindByName( |
|
481 |
XnPropertyNames::action::event::KName ) ); |
|
482 |
||
483 |
if ( attribute ) |
|
484 |
{ |
|
485 |
attribute->SetValueL( ptr ); |
|
486 |
} |
|
487 |
||
488 |
CleanupStack::PopAndDestroy( templateString ); |
|
489 |
||
490 |
CleanupStack::Pop( clone ); |
|
491 |
retval = clone; |
|
492 |
} |
|
493 |
} |
|
494 |
} |
|
495 |
||
496 |
return retval; |
|
497 |
} |
|
498 |
||
499 |
// ----------------------------------------------------------------------------- |
|
500 |
// ResolveEffectId |
|
501 |
// ----------------------------------------------------------------------------- |
|
502 |
// |
|
503 |
static TInt ResolveEffectId( CXnDomNode& aEventNode ) |
|
504 |
{ |
|
505 |
TInt effect( 0 ); |
|
506 |
const TDesC8& value( aEventNode.AttributeValue( |
|
507 |
XnPropertyNames::common::KEffectId ) ); |
|
508 |
if( value != KNullDesC8 ) |
|
509 |
{ |
|
510 |
TLex8 lex( value ); |
|
511 |
lex.Val( effect ); |
|
512 |
} |
|
513 |
return effect; |
|
514 |
} |
|
515 |
||
516 |
// ----------------------------------------------------------------------------- |
|
517 |
// Checks whether trigger is runnable |
|
518 |
// ----------------------------------------------------------------------------- |
|
519 |
// |
|
520 |
TBool IsTriggerRunnableL( CXnDomNode& aTriggerNode ) |
|
521 |
{ |
|
522 |
TBool ret( ETrue ); |
|
523 |
CXnNode* layoutNode = aTriggerNode.LayoutNode(); |
|
524 |
if ( layoutNode ) |
|
525 |
{ |
|
526 |
CXnProperty* display = |
|
527 |
layoutNode->GetPropertyL( XnPropertyNames::style::common::KDisplay ); |
|
528 |
||
529 |
if ( display && display->StringValue() == |
|
530 |
XnPropertyNames::style::common::display::KNone ) |
|
531 |
{ |
|
532 |
ret = EFalse; |
|
533 |
} |
|
534 |
} |
|
535 |
return ret; |
|
536 |
} |
|
537 |
||
538 |
// ----------------------------------------------------------------------------- |
|
539 |
// DirtyLevelFromPropertyL |
|
540 |
// ----------------------------------------------------------------------------- |
|
541 |
// |
|
542 |
static TInt DirtyLevelFromPropertyL( CXnNode& aNode, const TDesC8& aPropName ) |
|
543 |
{ |
|
544 |
if ( aPropName == XnPropertyNames::style::common::KDisplay || |
|
545 |
aPropName == XnPropertyNames::style::common::KBlockProgression || |
|
546 |
aPropName == XnPropertyNames::style::common::KDirection || |
|
547 |
aPropName == XnPropertyNames::style::common::KPosition || |
|
548 |
aPropName == XnPropertyNames::style::common::KTop || |
|
549 |
aPropName == XnPropertyNames::style::common::KLeft || |
|
550 |
aPropName == XnPropertyNames::style::common::KBottom || |
|
551 |
aPropName == XnPropertyNames::style::common::KRight || |
|
552 |
aPropName == XnPropertyNames::style::common::KWidth || |
|
553 |
aPropName == XnPropertyNames::style::common::KHeight || |
|
554 |
aPropName == XnPropertyNames::style::common::KMinWidth || |
|
555 |
aPropName == XnPropertyNames::style::common::KMaxWidth || |
|
556 |
aPropName == XnPropertyNames::style::common::KMinHeight || |
|
557 |
aPropName == XnPropertyNames::style::common::KMaxHeight || |
|
558 |
aPropName == XnPropertyNames::style::common::KS60DisplayPriority || |
|
559 |
aPropName == XnPropertyNames::style::common::KMarginTop || |
|
560 |
aPropName == XnPropertyNames::style::common::KMarginRight || |
|
561 |
aPropName == XnPropertyNames::style::common::KMarginBottom || |
|
562 |
aPropName == XnPropertyNames::style::common::KMarginLeft || |
|
563 |
aPropName == XnPropertyNames::style::common::KBorderWidth || |
|
564 |
aPropName == XnPropertyNames::style::common::KBorderTopWidth || |
|
565 |
aPropName == XnPropertyNames::style::common::KBorderRightWidth || |
|
566 |
aPropName == XnPropertyNames::style::common::KBorderBottomWidth || |
|
567 |
aPropName == XnPropertyNames::style::common::KBorderLeftWidth || |
|
568 |
aPropName == XnPropertyNames::style::common::KBorderLeftWidth || |
|
569 |
aPropName == XnPropertyNames::style::common::KPaddingRight || |
|
570 |
aPropName == XnPropertyNames::style::common::KPaddingBottom || |
|
571 |
aPropName == XnPropertyNames::style::common::KPaddingLeft ) |
|
572 |
{ |
|
573 |
TInt retval( XnDirtyLevel::ELayoutAndRenderSiblings ); |
|
574 |
||
575 |
CXnProperty* prop( aNode.PositionL() ); |
|
576 |
||
577 |
if ( prop ) |
|
578 |
{ |
|
579 |
const TDesC8& value( prop->StringValue() ); |
|
580 |
||
581 |
if ( value == XnPropertyNames::style::common::position::KAbsolute || |
|
582 |
value == XnPropertyNames::style::common::position::KFloating ) |
|
583 |
{ |
|
584 |
retval = XnDirtyLevel::ELayoutAndRender; |
|
585 |
} |
|
586 |
} |
|
587 |
||
588 |
if ( aNode.Type()->Type() == KToolTip ) |
|
589 |
{ |
|
590 |
retval = XnDirtyLevel::ELayoutAndRender; |
|
591 |
} |
|
592 |
||
593 |
return retval; |
|
594 |
} |
|
595 |
else |
|
596 |
{ |
|
597 |
return XnDirtyLevel::ERender; |
|
598 |
} |
|
599 |
} |
|
600 |
||
601 |
// ----------------------------------------------------------------------------- |
|
602 |
// IsNodeDisplayedL |
|
603 |
// Check whether a node is displayed or not |
|
604 |
// ----------------------------------------------------------------------------- |
|
605 |
// |
|
606 |
static TBool IsNodeDisplayedL( |
|
607 |
CXnNode& aNode, |
|
608 |
TBool aCheckVisiblity, |
|
609 |
TBool aCheckParent ) |
|
610 |
{ |
|
611 |
if ( !aNode.IsLayoutCapable() ) |
|
612 |
{ |
|
613 |
return EFalse; |
|
614 |
} |
|
615 |
||
616 |
if ( aCheckVisiblity ) |
|
617 |
{ |
|
618 |
CXnProperty* visibilityProp( aNode.VisibilityL() ); |
|
619 |
||
620 |
// Am I visible? |
|
621 |
if ( visibilityProp ) |
|
622 |
{ |
|
623 |
const TDesC8& visibility( visibilityProp->StringValue() ); |
|
624 |
||
625 |
if ( visibility != XnPropertyNames::style::common::visibility::KVisible ) |
|
626 |
{ |
|
627 |
return EFalse; |
|
628 |
} |
|
629 |
} |
|
630 |
} |
|
631 |
||
632 |
// Am I displayed? |
|
633 |
CXnProperty* displayProp( aNode.DisplayL() ); |
|
634 |
||
635 |
if ( displayProp ) |
|
636 |
{ |
|
637 |
const TDesC8& display( displayProp->StringValue() ); |
|
638 |
||
639 |
if ( display != XnPropertyNames::style::common::display::KBlock ) |
|
640 |
{ |
|
641 |
return EFalse; |
|
642 |
} |
|
643 |
} |
|
644 |
||
645 |
if ( aCheckParent ) |
|
646 |
{ |
|
647 |
CXnNode* parent( aNode.Parent() ); |
|
648 |
||
649 |
// Is my parent displayed? |
|
650 |
for ( ; parent; parent = parent->Parent() ) |
|
651 |
{ |
|
652 |
CXnProperty* displayProp( parent->DisplayL() ); |
|
653 |
||
654 |
if ( displayProp ) |
|
655 |
{ |
|
656 |
const TDesC8& display( displayProp->StringValue() ); |
|
657 |
||
658 |
if ( display != XnPropertyNames::style::common::display::KBlock ) |
|
659 |
{ |
|
660 |
return EFalse; |
|
661 |
} |
|
662 |
} |
|
663 |
} |
|
664 |
} |
|
665 |
||
666 |
return ETrue; |
|
667 |
} |
|
668 |
||
669 |
// ----------------------------------------------------------------------------- |
|
670 |
// IsNodeNavigableL |
|
671 |
// Check whether a node or its child is navigable, ignores dropped state |
|
672 |
// ----------------------------------------------------------------------------- |
|
673 |
// |
|
674 |
static CXnNode* IsNodeNavigableL( CXnNode* aParent ) |
|
675 |
{ |
|
676 |
if ( IsNodeNavigableL( *aParent, ETrue ) ) |
|
677 |
{ |
|
678 |
return aParent; |
|
679 |
} |
|
680 |
||
681 |
RPointerArray< CXnNode >& children( aParent->Children() ); |
|
682 |
||
683 |
TInt count( children.Count() ); |
|
684 |
||
685 |
CXnNode* retval = NULL; |
|
686 |
for ( TInt i = 0; i < count; i++ ) |
|
687 |
{ |
|
688 |
retval = IsNodeNavigableL( children[i] ); |
|
689 |
if ( retval ) |
|
690 |
{ |
|
691 |
return retval; |
|
692 |
} |
|
693 |
} |
|
694 |
||
695 |
return NULL; |
|
696 |
} |
|
697 |
||
698 |
// ----------------------------------------------------------------------------- |
|
699 |
// IsNodeNavigableL() |
|
700 |
// Check if node can be navigated |
|
701 |
// ----------------------------------------------------------------------------- |
|
702 |
// |
|
703 |
static TBool IsNodeNavigableL( CXnNode& aNode, TBool aIgnoreDropped ) |
|
704 |
{ |
|
705 |
if ( !aNode.IsLayoutCapable() || ( !aIgnoreDropped && aNode.IsDropped() ) ) |
|
706 |
{ |
|
707 |
return EFalse; |
|
708 |
} |
|
709 |
||
710 |
CXnProperty* displayProp( aNode.DisplayL() ); |
|
711 |
||
712 |
if ( displayProp ) |
|
713 |
{ |
|
714 |
const TDesC8& display( displayProp->StringValue() ); |
|
715 |
||
716 |
if ( display != XnPropertyNames::style::common::display::KBlock ) |
|
717 |
{ |
|
718 |
return EFalse; |
|
719 |
} |
|
720 |
} |
|
721 |
||
722 |
CXnProperty* visibilityProp( aNode.VisibilityL() ); |
|
723 |
||
724 |
if ( visibilityProp ) |
|
725 |
{ |
|
726 |
const TDesC8& visibility( visibilityProp->StringValue() ); |
|
727 |
||
728 |
if ( visibility != XnPropertyNames::style::common::visibility::KVisible ) |
|
729 |
{ |
|
730 |
return EFalse; |
|
731 |
} |
|
732 |
} |
|
733 |
||
734 |
CXnProperty* focusableProp( |
|
735 |
aNode.GetPropertyL( XnPropertyNames::common::KFocusable ) ); |
|
736 |
||
737 |
if ( focusableProp ) |
|
738 |
{ |
|
739 |
const TDesC8& focus( focusableProp->StringValue() ); |
|
740 |
||
741 |
if ( focus != XnPropertyNames::KTrue ) |
|
742 |
{ |
|
743 |
return EFalse; |
|
744 |
} |
|
745 |
} |
|
746 |
else |
|
747 |
{ |
|
748 |
return EFalse; |
|
749 |
} |
|
750 |
CXnProperty* disabledProp( |
|
751 |
aNode.GetPropertyL( XnPropertyNames::common::KDisabled ) ); |
|
752 |
||
753 |
if ( disabledProp ) |
|
754 |
{ |
|
755 |
const TDesC8& disabled( disabledProp->StringValue() ); |
|
756 |
||
757 |
if ( disabled == XnPropertyNames::KTrue ) |
|
758 |
{ |
|
759 |
return EFalse; |
|
760 |
} |
|
761 |
} |
|
762 |
||
763 |
// The node can be navigated. Then check parents display and visibilty properties |
|
764 |
CXnNode* parent( aNode.Parent() ); |
|
765 |
||
766 |
for ( ; parent; parent = parent->Parent() ) |
|
767 |
{ |
|
768 |
CXnProperty* displayProp( parent->DisplayL() ); |
|
769 |
||
770 |
if ( displayProp ) |
|
771 |
{ |
|
772 |
const TDesC8& display( displayProp->StringValue() ); |
|
773 |
||
774 |
if ( display != XnPropertyNames::style::common::display::KBlock ) |
|
775 |
{ |
|
776 |
return EFalse; |
|
777 |
} |
|
778 |
} |
|
779 |
||
780 |
CXnProperty* visibilityProp( parent->VisibilityL() ); |
|
781 |
||
782 |
if ( visibilityProp ) |
|
783 |
{ |
|
784 |
const TDesC8& visibility( visibilityProp->StringValue() ); |
|
785 |
||
786 |
if ( visibility != XnPropertyNames::style::common::visibility::KVisible ) |
|
787 |
{ |
|
788 |
return EFalse; |
|
789 |
} |
|
790 |
} |
|
791 |
} |
|
792 |
||
793 |
return ETrue; |
|
794 |
} |
|
795 |
||
796 |
// ----------------------------------------------------------------------------- |
|
797 |
// EnableStatePropertyL() |
|
798 |
// ----------------------------------------------------------------------------- |
|
799 |
// |
|
800 |
static void EnableStatePropertyL( |
|
801 |
CXnNode& aNode, |
|
802 |
CXnDomProperty::TPseudoClass aPseudoClass, |
|
803 |
CXnProperty* ( CXnNode::* aGetCachedPropertyL )(), |
|
804 |
CXnProperty*& aProperty, |
|
805 |
RPointerArray< CXnProperty >& aArray, TInt& aLevel, |
|
806 |
TBool aInformChange ) |
|
807 |
{ |
|
808 |
TBool doInform( EFalse ); |
|
809 |
||
810 |
for ( TInt i = aArray.Count() - 1; i >= 0; --i ) |
|
811 |
{ |
|
812 |
if ( aArray[i]->Property()->PseudoClass() == aPseudoClass ) |
|
813 |
{ |
|
814 |
CXnProperty* temp( aArray[i] ); |
|
815 |
||
816 |
if ( aLevel < XnDirtyLevel::ELayoutAndRenderSiblings || |
|
817 |
aInformChange ) |
|
818 |
{ |
|
819 |
TInt level( XnDirtyLevel::ENone ); |
|
820 |
||
821 |
// Get current cached prop |
|
822 |
CXnProperty* prop( ( aNode.*aGetCachedPropertyL )() ); |
|
823 |
||
824 |
if ( !temp && prop ) |
|
825 |
{ |
|
826 |
level = DirtyLevelFromPropertyL( |
|
827 |
aNode, prop->Property()->Name() ); |
|
828 |
} |
|
829 |
else if ( ( temp && !prop ) || |
|
830 |
( temp && prop && !prop->EqualsL( *temp ) ) ) |
|
831 |
{ |
|
832 |
level = DirtyLevelFromPropertyL( |
|
833 |
aNode, temp->Property()->Name() ); |
|
834 |
} |
|
835 |
||
836 |
if ( aInformChange && ( level != XnDirtyLevel::ENone ) ) |
|
837 |
{ |
|
838 |
doInform = ETrue; |
|
839 |
} |
|
840 |
||
841 |
if ( level > aLevel && aNode.IsLayoutCapable()) |
|
842 |
{ |
|
843 |
aLevel = level; |
|
844 |
} |
|
845 |
} |
|
846 |
||
847 |
aProperty = temp; |
|
848 |
||
849 |
if ( doInform ) |
|
850 |
{ |
|
851 |
// Property is changed |
|
852 |
InformPropertyChangeL( aNode, temp ); |
|
853 |
} |
|
854 |
||
855 |
break; |
|
856 |
} |
|
857 |
} |
|
858 |
} |
|
859 |
||
860 |
// ----------------------------------------------------------------------------- |
|
861 |
// DisableStatePropertyL() |
|
862 |
// ----------------------------------------------------------------------------- |
|
863 |
// |
|
864 |
static void DisableStatePropertyL( |
|
865 |
CXnNode& aNode, |
|
866 |
CXnDomProperty::TPseudoClass aPseudoClass, |
|
867 |
CXnProperty* ( CXnNode::* aGetCachedPropertyL )(), |
|
868 |
CXnProperty*& aProperty, |
|
869 |
RPointerArray< CXnProperty >& aArray, |
|
870 |
RArray< CXnDomProperty::TPseudoClass >& aStates, TInt& aLevel, |
|
871 |
TBool aInformChange ) |
|
872 |
{ |
|
873 |
CXnProperty* currentStateProperty( NULL ); |
|
874 |
||
875 |
TBool doInform( EFalse ); |
|
876 |
||
877 |
if ( aProperty && aProperty->Property()->PseudoClass() == aPseudoClass ) |
|
878 |
{ |
|
879 |
// Is there an other pseudo state where to return? |
|
880 |
for ( TInt i = aArray.Count() - 1; !currentStateProperty && i >= 0; --i ) |
|
881 |
{ |
|
882 |
for ( TInt j = aStates.Count() - 1; j >= 0; --j ) |
|
883 |
{ |
|
884 |
if ( aArray[i]->Property()->PseudoClass() == aStates[j] && |
|
885 |
aArray[i]->Property()->PseudoClass() != aPseudoClass ) |
|
886 |
{ |
|
887 |
currentStateProperty = aArray[i]; |
|
888 |
break; |
|
889 |
} |
|
890 |
} |
|
891 |
} |
|
892 |
||
893 |
// No, use the property from state "none" |
|
894 |
for ( TInt i = aArray.Count() - 1; !currentStateProperty && i >= 0; --i ) |
|
895 |
{ |
|
896 |
for ( TInt j = aStates.Count() - 1; j >= 0; --j ) |
|
897 |
{ |
|
898 |
if ( aArray[i]->Property()->PseudoClass() == CXnDomProperty::ENone && |
|
899 |
aArray[i]->Property()->PseudoClass() != aPseudoClass ) |
|
900 |
{ |
|
901 |
currentStateProperty = aArray[i]; |
|
902 |
break; |
|
903 |
} |
|
904 |
} |
|
905 |
} |
|
906 |
||
907 |
CXnProperty* temp( currentStateProperty ); |
|
908 |
||
909 |
if ( aLevel < XnDirtyLevel::ELayoutAndRenderSiblings || aInformChange ) |
|
910 |
{ |
|
911 |
TInt level( XnDirtyLevel::ENone ); |
|
912 |
||
913 |
// Get current cached prop |
|
914 |
CXnProperty* prop( ( aNode.*aGetCachedPropertyL )() ); |
|
915 |
||
916 |
if ( !temp && prop ) |
|
917 |
{ |
|
918 |
level = DirtyLevelFromPropertyL( aNode, prop->Property()->Name() ); |
|
919 |
} |
|
920 |
else if ( ( temp && !prop ) || ( temp && prop && !prop->EqualsL( *temp ) ) ) |
|
921 |
{ |
|
922 |
level = DirtyLevelFromPropertyL( aNode, temp->Property()->Name() ); |
|
923 |
} |
|
924 |
||
925 |
if ( aInformChange && ( level != XnDirtyLevel::ENone ) ) |
|
926 |
{ |
|
927 |
doInform = ETrue; |
|
928 |
} |
|
929 |
||
930 |
if ( level > aLevel && aNode.IsLayoutCapable()) |
|
931 |
{ |
|
932 |
aLevel = level; |
|
933 |
} |
|
934 |
} |
|
935 |
||
936 |
aProperty = temp; |
|
937 |
||
938 |
if ( doInform ) |
|
939 |
{ |
|
940 |
// Property is changed |
|
941 |
InformPropertyChangeL( aNode, temp ); |
|
942 |
} |
|
943 |
} |
|
944 |
} |
|
945 |
||
946 |
// ----------------------------------------------------------------------------- |
|
947 |
// EnableStatePropertiesL() |
|
948 |
// ----------------------------------------------------------------------------- |
|
949 |
// |
|
950 |
static void EnableStatePropertiesL( |
|
951 |
CXnNode& aNode, |
|
952 |
CXnDomProperty::TPseudoClass aPseudoClass, |
|
953 |
CLayoutPropertyCache*& aLayoutPropertyCache ) |
|
954 |
{ |
|
955 |
if ( !aLayoutPropertyCache ) |
|
956 |
{ |
|
957 |
aLayoutPropertyCache = new ( ELeave ) CLayoutPropertyCache; |
|
958 |
} |
|
959 |
||
960 |
TInt level( XnDirtyLevel::ENone ); |
|
961 |
||
962 |
EnableStatePropertyL( |
|
963 |
aNode, aPseudoClass, &CXnNode::WidthL, |
|
964 |
aLayoutPropertyCache->iWidth, |
|
965 |
aLayoutPropertyCache->iWidths, level ); |
|
966 |
||
967 |
EnableStatePropertyL( |
|
968 |
aNode, aPseudoClass, &CXnNode::HeightL, |
|
969 |
aLayoutPropertyCache->iHeight, |
|
970 |
aLayoutPropertyCache->iHeights, level ); |
|
971 |
||
972 |
EnableStatePropertyL( |
|
973 |
aNode, aPseudoClass, &CXnNode::MarginLeftL, |
|
974 |
aLayoutPropertyCache->iMarginLeft, |
|
975 |
aLayoutPropertyCache->iMarginLefts, level ); |
|
976 |
||
977 |
EnableStatePropertyL( |
|
978 |
aNode, aPseudoClass, &CXnNode::MarginRightL, |
|
979 |
aLayoutPropertyCache->iMarginRight, |
|
980 |
aLayoutPropertyCache->iMarginRights, level ); |
|
981 |
||
982 |
EnableStatePropertyL( |
|
983 |
aNode, aPseudoClass, &CXnNode::BorderLeftL, |
|
984 |
aLayoutPropertyCache->iBorderLeft, |
|
985 |
aLayoutPropertyCache->iBorderLefts, level ); |
|
986 |
||
987 |
EnableStatePropertyL( |
|
988 |
aNode, aPseudoClass, &CXnNode::BorderRightL, |
|
989 |
aLayoutPropertyCache->iBorderRight, |
|
990 |
aLayoutPropertyCache->iBorderRights, level ); |
|
991 |
||
992 |
EnableStatePropertyL( |
|
993 |
aNode, aPseudoClass, &CXnNode::PaddingLeftL, |
|
994 |
aLayoutPropertyCache->iPaddingLeft, |
|
995 |
aLayoutPropertyCache->iPaddingLefts, level ); |
|
996 |
||
997 |
EnableStatePropertyL( |
|
998 |
aNode, aPseudoClass, &CXnNode::PaddingRightL, |
|
999 |
aLayoutPropertyCache->iPaddingRight, |
|
1000 |
aLayoutPropertyCache->iPaddingRights, level ); |
|
1001 |
||
1002 |
EnableStatePropertyL( |
|
1003 |
aNode, aPseudoClass, &CXnNode::MarginTopL, |
|
1004 |
aLayoutPropertyCache->iMarginTop, |
|
1005 |
aLayoutPropertyCache->iMarginTops, level ); |
|
1006 |
||
1007 |
EnableStatePropertyL( |
|
1008 |
aNode, aPseudoClass, &CXnNode::MarginBottomL, |
|
1009 |
aLayoutPropertyCache->iMarginBottom, |
|
1010 |
aLayoutPropertyCache->iMarginBottoms, level ); |
|
1011 |
||
1012 |
EnableStatePropertyL( |
|
1013 |
aNode, aPseudoClass, &CXnNode::BorderTopL, |
|
1014 |
aLayoutPropertyCache->iBorderTop, |
|
1015 |
aLayoutPropertyCache->iBorderTops, level ); |
|
1016 |
||
1017 |
EnableStatePropertyL( |
|
1018 |
aNode, aPseudoClass, &CXnNode::BorderBottomL, |
|
1019 |
aLayoutPropertyCache->iBorderBottom, |
|
1020 |
aLayoutPropertyCache->iBorderBottoms, level ); |
|
1021 |
||
1022 |
EnableStatePropertyL( |
|
1023 |
aNode, aPseudoClass, &CXnNode::PaddingTopL, |
|
1024 |
aLayoutPropertyCache->iPaddingTop, |
|
1025 |
aLayoutPropertyCache->iPaddingTops, level ); |
|
1026 |
||
1027 |
EnableStatePropertyL( |
|
1028 |
aNode, aPseudoClass, &CXnNode::PaddingBottomL, |
|
1029 |
aLayoutPropertyCache->iPaddingBottom, |
|
1030 |
aLayoutPropertyCache->iPaddingBottoms, level ); |
|
1031 |
||
1032 |
EnableStatePropertyL( |
|
1033 |
aNode, aPseudoClass, &CXnNode::BorderWidthL, |
|
1034 |
aLayoutPropertyCache->iBorderWidth, |
|
1035 |
aLayoutPropertyCache->iBorderWidths, level ); |
|
1036 |
||
1037 |
EnableStatePropertyL( |
|
1038 |
aNode, aPseudoClass, &CXnNode::BlockProgressionL, |
|
1039 |
aLayoutPropertyCache->iBlockProgression, |
|
1040 |
aLayoutPropertyCache->iBlockProgressions, level ); |
|
1041 |
||
1042 |
EnableStatePropertyL( |
|
1043 |
aNode, aPseudoClass, &CXnNode::DirectionL, |
|
1044 |
aLayoutPropertyCache->iDirection, |
|
1045 |
aLayoutPropertyCache->iDirections, level ); |
|
1046 |
||
1047 |
EnableStatePropertyL( |
|
1048 |
aNode, aPseudoClass, &CXnNode::PositionL, |
|
1049 |
aLayoutPropertyCache->iPosition, |
|
1050 |
aLayoutPropertyCache->iPositions, level ); |
|
1051 |
||
1052 |
EnableStatePropertyL( |
|
1053 |
aNode, aPseudoClass, &CXnNode::MaxHeightL, |
|
1054 |
aLayoutPropertyCache->iMaxHeight, |
|
1055 |
aLayoutPropertyCache->iMaxHeights, level ); |
|
1056 |
||
1057 |
EnableStatePropertyL( |
|
1058 |
aNode, aPseudoClass, &CXnNode::MinHeightL, |
|
1059 |
aLayoutPropertyCache->iMinHeight, |
|
1060 |
aLayoutPropertyCache->iMinHeights, level ); |
|
1061 |
||
1062 |
EnableStatePropertyL( |
|
1063 |
aNode, aPseudoClass, &CXnNode::MaxWidthL, |
|
1064 |
aLayoutPropertyCache->iMaxWidth, |
|
1065 |
aLayoutPropertyCache->iMaxWidths, level ); |
|
1066 |
||
1067 |
EnableStatePropertyL( |
|
1068 |
aNode, aPseudoClass, &CXnNode::MinWidthL, |
|
1069 |
aLayoutPropertyCache->iMinWidth, |
|
1070 |
aLayoutPropertyCache->iMinWidths, level ); |
|
1071 |
||
1072 |
EnableStatePropertyL( |
|
1073 |
aNode, aPseudoClass, &CXnNode::DisplayL, |
|
1074 |
aLayoutPropertyCache->iDisplay, |
|
1075 |
aLayoutPropertyCache->iDisplays, level, ETrue ); |
|
1076 |
||
1077 |
EnableStatePropertyL( |
|
1078 |
aNode, aPseudoClass, &CXnNode::VisibilityL, |
|
1079 |
aLayoutPropertyCache->iVisibility, |
|
1080 |
aLayoutPropertyCache->iVisibilities, level ); |
|
1081 |
||
1082 |
EnableStatePropertyL( |
|
1083 |
aNode, aPseudoClass, &CXnNode::LeftL, |
|
1084 |
aLayoutPropertyCache->iLeft, |
|
1085 |
aLayoutPropertyCache->iLefts, level ); |
|
1086 |
||
1087 |
EnableStatePropertyL( |
|
1088 |
aNode, aPseudoClass, &CXnNode::RightL, |
|
1089 |
aLayoutPropertyCache->iRight, |
|
1090 |
aLayoutPropertyCache->iRights, level ); |
|
1091 |
||
1092 |
EnableStatePropertyL( |
|
1093 |
aNode, aPseudoClass, &CXnNode::TopL, |
|
1094 |
aLayoutPropertyCache->iTop, |
|
1095 |
aLayoutPropertyCache->iTops, level ); |
|
1096 |
||
1097 |
EnableStatePropertyL( |
|
1098 |
aNode, aPseudoClass, &CXnNode::BottomL, |
|
1099 |
aLayoutPropertyCache->iBottom, |
|
1100 |
aLayoutPropertyCache->iBottoms, level ); |
|
1101 |
||
1102 |
EnableStatePropertyL( |
|
1103 |
aNode, aPseudoClass, &CXnNode::BorderLeftStyleL, |
|
1104 |
aLayoutPropertyCache->iBorderLeftStyle, |
|
1105 |
aLayoutPropertyCache->iBorderLeftStyles, level ); |
|
1106 |
||
1107 |
EnableStatePropertyL( |
|
1108 |
aNode, aPseudoClass, &CXnNode::BorderRightStyleL, |
|
1109 |
aLayoutPropertyCache->iBorderRightStyle, |
|
1110 |
aLayoutPropertyCache->iBorderRightStyles, level ); |
|
1111 |
||
1112 |
EnableStatePropertyL( |
|
1113 |
aNode, aPseudoClass, &CXnNode::BorderTopStyleL, |
|
1114 |
aLayoutPropertyCache->iBorderTopStyle, |
|
1115 |
aLayoutPropertyCache->iBorderTopStyles, level ); |
|
1116 |
||
1117 |
EnableStatePropertyL( |
|
1118 |
aNode, aPseudoClass, &CXnNode::BorderBottomStyleL, |
|
1119 |
aLayoutPropertyCache->iBorderBottomStyle, |
|
1120 |
aLayoutPropertyCache->iBorderBottomStyles, level ); |
|
1121 |
||
1122 |
EnableStatePropertyL( |
|
1123 |
aNode, aPseudoClass, &CXnNode::BorderStyleL, |
|
1124 |
aLayoutPropertyCache->iBorderStyle, |
|
1125 |
aLayoutPropertyCache->iBorderStyles, level ); |
|
1126 |
||
1127 |
EnableStatePropertyL( |
|
1128 |
aNode, aPseudoClass, &CXnNode::DisplayPriorityL, |
|
1129 |
aLayoutPropertyCache->iDisplayPriority, |
|
1130 |
aLayoutPropertyCache->iDisplayPriorities, level ); |
|
1131 |
||
1132 |
EnableStatePropertyL( |
|
1133 |
aNode, aPseudoClass, &CXnNode::NavIndexL, |
|
1134 |
aLayoutPropertyCache->iNavIndex, |
|
1135 |
aLayoutPropertyCache->iNavIndexes, level ); |
|
1136 |
||
1137 |
EnableStatePropertyL( |
|
1138 |
aNode, aPseudoClass, &CXnNode::ZIndexL, |
|
1139 |
aLayoutPropertyCache->iZIndex, |
|
1140 |
aLayoutPropertyCache->iZIndexes, level ); |
|
1141 |
||
1142 |
EnableStatePropertyL( |
|
1143 |
aNode, aPseudoClass, &CXnNode::BackgroundColorL, |
|
1144 |
aLayoutPropertyCache->iBackgroundColor, |
|
1145 |
aLayoutPropertyCache->iBackgroundColors, level ); |
|
1146 |
||
1147 |
EnableStatePropertyL( |
|
1148 |
aNode, aPseudoClass, &CXnNode::BackgroundImageL, |
|
1149 |
aLayoutPropertyCache->iBackgroundImage, |
|
1150 |
aLayoutPropertyCache->iBackgroundImages, level, ETrue ); |
|
1151 |
||
1152 |
EnableStatePropertyL( |
|
1153 |
aNode, aPseudoClass, &CXnNode::FocusBackgroundL, |
|
1154 |
aLayoutPropertyCache->iFocusBackground, |
|
1155 |
aLayoutPropertyCache->iFocusBackgrounds, level ); |
|
1156 |
||
1157 |
aNode.SetDirtyL( level ); |
|
1158 |
} |
|
1159 |
||
1160 |
// ----------------------------------------------------------------------------- |
|
1161 |
// DisableStatePropertiesL() |
|
1162 |
// ----------------------------------------------------------------------------- |
|
1163 |
// |
|
1164 |
static void DisableStatePropertiesL( |
|
1165 |
CXnNode& aNode, |
|
1166 |
CXnDomProperty::TPseudoClass aPseudoClass, |
|
1167 |
RArray< CXnDomProperty::TPseudoClass >& aStates, |
|
1168 |
CLayoutPropertyCache*& aLayoutPropertyCache ) |
|
1169 |
{ |
|
1170 |
if ( !aLayoutPropertyCache ) |
|
1171 |
{ |
|
1172 |
aLayoutPropertyCache = new ( ELeave ) CLayoutPropertyCache; |
|
1173 |
} |
|
1174 |
||
1175 |
TInt level( XnDirtyLevel::ENone ); |
|
1176 |
||
1177 |
DisableStatePropertyL( |
|
1178 |
aNode, aPseudoClass, &CXnNode::WidthL, |
|
1179 |
aLayoutPropertyCache->iWidth, |
|
1180 |
aLayoutPropertyCache->iWidths, aStates, level ); |
|
1181 |
||
1182 |
DisableStatePropertyL( |
|
1183 |
aNode, aPseudoClass, &CXnNode::HeightL, |
|
1184 |
aLayoutPropertyCache->iHeight, |
|
1185 |
aLayoutPropertyCache->iHeights, aStates, level ); |
|
1186 |
||
1187 |
DisableStatePropertyL( |
|
1188 |
aNode, aPseudoClass, &CXnNode::MarginLeftL, |
|
1189 |
aLayoutPropertyCache->iMarginLeft, |
|
1190 |
aLayoutPropertyCache->iMarginLefts, aStates, level ); |
|
1191 |
||
1192 |
DisableStatePropertyL( |
|
1193 |
aNode, aPseudoClass, &CXnNode::MarginRightL, |
|
1194 |
aLayoutPropertyCache->iMarginRight, |
|
1195 |
aLayoutPropertyCache->iMarginRights, aStates, level ); |
|
1196 |
||
1197 |
DisableStatePropertyL( |
|
1198 |
aNode, aPseudoClass, &CXnNode::BorderLeftL, |
|
1199 |
aLayoutPropertyCache->iBorderLeft, |
|
1200 |
aLayoutPropertyCache->iBorderLefts, aStates, level ); |
|
1201 |
||
1202 |
DisableStatePropertyL( |
|
1203 |
aNode, aPseudoClass, &CXnNode::BorderRightL, |
|
1204 |
aLayoutPropertyCache->iBorderRight, |
|
1205 |
aLayoutPropertyCache->iBorderRights, aStates, level ); |
|
1206 |
||
1207 |
DisableStatePropertyL( |
|
1208 |
aNode, aPseudoClass, &CXnNode::PaddingLeftL, |
|
1209 |
aLayoutPropertyCache->iPaddingLeft, |
|
1210 |
aLayoutPropertyCache->iPaddingLefts, aStates, level ); |
|
1211 |
||
1212 |
DisableStatePropertyL( |
|
1213 |
aNode, aPseudoClass, &CXnNode::PaddingRightL, |
|
1214 |
aLayoutPropertyCache->iPaddingRight, |
|
1215 |
aLayoutPropertyCache->iPaddingRights, aStates, level ); |
|
1216 |
||
1217 |
DisableStatePropertyL( |
|
1218 |
aNode, aPseudoClass, &CXnNode::MarginTopL, |
|
1219 |
aLayoutPropertyCache->iMarginTop, |
|
1220 |
aLayoutPropertyCache->iMarginTops, aStates, level ); |
|
1221 |
||
1222 |
DisableStatePropertyL( |
|
1223 |
aNode, aPseudoClass, &CXnNode::MarginBottomL, |
|
1224 |
aLayoutPropertyCache->iMarginBottom, |
|
1225 |
aLayoutPropertyCache->iMarginBottoms, aStates, level ); |
|
1226 |
||
1227 |
DisableStatePropertyL( |
|
1228 |
aNode, aPseudoClass, &CXnNode::BorderTopL, |
|
1229 |
aLayoutPropertyCache->iBorderTop, |
|
1230 |
aLayoutPropertyCache->iBorderTops, aStates, level ); |
|
1231 |
||
1232 |
DisableStatePropertyL( |
|
1233 |
aNode, aPseudoClass, &CXnNode::BorderBottomL, |
|
1234 |
aLayoutPropertyCache->iBorderBottom, |
|
1235 |
aLayoutPropertyCache->iBorderBottoms, aStates, level ); |
|
1236 |
||
1237 |
DisableStatePropertyL( |
|
1238 |
aNode, aPseudoClass, &CXnNode::PaddingTopL, |
|
1239 |
aLayoutPropertyCache->iPaddingTop, |
|
1240 |
aLayoutPropertyCache->iPaddingTops, aStates, level ); |
|
1241 |
||
1242 |
DisableStatePropertyL( |
|
1243 |
aNode, aPseudoClass, &CXnNode::PaddingBottomL, |
|
1244 |
aLayoutPropertyCache->iPaddingBottom, |
|
1245 |
aLayoutPropertyCache->iPaddingBottoms, aStates, level ); |
|
1246 |
||
1247 |
DisableStatePropertyL( |
|
1248 |
aNode, aPseudoClass, &CXnNode::BorderWidthL, |
|
1249 |
aLayoutPropertyCache->iBorderWidth, |
|
1250 |
aLayoutPropertyCache->iBorderWidths, aStates, level ); |
|
1251 |
||
1252 |
DisableStatePropertyL( |
|
1253 |
aNode, aPseudoClass, &CXnNode::BlockProgressionL, |
|
1254 |
aLayoutPropertyCache->iBlockProgression, |
|
1255 |
aLayoutPropertyCache->iBlockProgressions, aStates, level ); |
|
1256 |
||
1257 |
DisableStatePropertyL( |
|
1258 |
aNode, aPseudoClass, &CXnNode::DirectionL, |
|
1259 |
aLayoutPropertyCache->iDirection, |
|
1260 |
aLayoutPropertyCache->iDirections, aStates, level ); |
|
1261 |
||
1262 |
DisableStatePropertyL( |
|
1263 |
aNode, aPseudoClass, &CXnNode::PositionL, |
|
1264 |
aLayoutPropertyCache->iPosition, |
|
1265 |
aLayoutPropertyCache->iPositions, aStates, level ); |
|
1266 |
||
1267 |
DisableStatePropertyL( |
|
1268 |
aNode, aPseudoClass, &CXnNode::MaxHeightL, |
|
1269 |
aLayoutPropertyCache->iMaxHeight, |
|
1270 |
aLayoutPropertyCache->iMaxHeights, aStates, level ); |
|
1271 |
||
1272 |
DisableStatePropertyL( |
|
1273 |
aNode, aPseudoClass, &CXnNode::MinHeightL, |
|
1274 |
aLayoutPropertyCache->iMinHeight, |
|
1275 |
aLayoutPropertyCache->iMinHeights, aStates, level ); |
|
1276 |
||
1277 |
DisableStatePropertyL( |
|
1278 |
aNode, aPseudoClass, &CXnNode::MaxWidthL, |
|
1279 |
aLayoutPropertyCache->iMaxWidth, |
|
1280 |
aLayoutPropertyCache->iMaxWidths, aStates, level ); |
|
1281 |
||
1282 |
DisableStatePropertyL( |
|
1283 |
aNode, aPseudoClass, &CXnNode::MinWidthL, |
|
1284 |
aLayoutPropertyCache->iMinWidth, |
|
1285 |
aLayoutPropertyCache->iMinWidths, aStates, level ); |
|
1286 |
||
1287 |
DisableStatePropertyL( |
|
1288 |
aNode, aPseudoClass, &CXnNode::DisplayL, |
|
1289 |
aLayoutPropertyCache->iDisplay, |
|
1290 |
aLayoutPropertyCache->iDisplays, aStates, level, ETrue ); |
|
1291 |
||
1292 |
DisableStatePropertyL( |
|
1293 |
aNode, aPseudoClass, &CXnNode::VisibilityL, |
|
1294 |
aLayoutPropertyCache->iVisibility, |
|
1295 |
aLayoutPropertyCache->iVisibilities, aStates, level ); |
|
1296 |
||
1297 |
DisableStatePropertyL( |
|
1298 |
aNode, aPseudoClass, &CXnNode::LeftL, |
|
1299 |
aLayoutPropertyCache->iLeft, |
|
1300 |
aLayoutPropertyCache->iLefts, aStates, level ); |
|
1301 |
||
1302 |
DisableStatePropertyL( |
|
1303 |
aNode, aPseudoClass, &CXnNode::RightL, |
|
1304 |
aLayoutPropertyCache->iRight, |
|
1305 |
aLayoutPropertyCache->iRights, aStates, level ); |
|
1306 |
||
1307 |
DisableStatePropertyL( |
|
1308 |
aNode, aPseudoClass, &CXnNode::TopL, |
|
1309 |
aLayoutPropertyCache->iTop, |
|
1310 |
aLayoutPropertyCache->iTops, aStates, level ); |
|
1311 |
||
1312 |
DisableStatePropertyL( |
|
1313 |
aNode, aPseudoClass, &CXnNode::BottomL, |
|
1314 |
aLayoutPropertyCache->iBottom, |
|
1315 |
aLayoutPropertyCache->iBottoms, aStates, level ); |
|
1316 |
||
1317 |
DisableStatePropertyL( |
|
1318 |
aNode, aPseudoClass, &CXnNode::BorderLeftStyleL, |
|
1319 |
aLayoutPropertyCache->iBorderLeftStyle, |
|
1320 |
aLayoutPropertyCache->iBorderLeftStyles, aStates, level ); |
|
1321 |
||
1322 |
DisableStatePropertyL( |
|
1323 |
aNode, aPseudoClass, &CXnNode::BorderRightStyleL, |
|
1324 |
aLayoutPropertyCache->iBorderRightStyle, |
|
1325 |
aLayoutPropertyCache->iBorderRightStyles, aStates, level ); |
|
1326 |
||
1327 |
DisableStatePropertyL( |
|
1328 |
aNode, aPseudoClass, &CXnNode::BorderTopStyleL, |
|
1329 |
aLayoutPropertyCache->iBorderTopStyle, |
|
1330 |
aLayoutPropertyCache->iBorderTopStyles, aStates, level ); |
|
1331 |
||
1332 |
DisableStatePropertyL( |
|
1333 |
aNode, aPseudoClass, &CXnNode::BorderBottomStyleL, |
|
1334 |
aLayoutPropertyCache->iBorderBottomStyle, |
|
1335 |
aLayoutPropertyCache->iBorderBottomStyles, aStates, level ); |
|
1336 |
||
1337 |
DisableStatePropertyL( |
|
1338 |
aNode, aPseudoClass, &CXnNode::BorderStyleL, |
|
1339 |
aLayoutPropertyCache->iBorderStyle, |
|
1340 |
aLayoutPropertyCache->iBorderStyles, aStates, level ); |
|
1341 |
||
1342 |
DisableStatePropertyL( |
|
1343 |
aNode, aPseudoClass, &CXnNode::DisplayPriorityL, |
|
1344 |
aLayoutPropertyCache->iDisplayPriority, |
|
1345 |
aLayoutPropertyCache->iDisplayPriorities, aStates, level ); |
|
1346 |
||
1347 |
DisableStatePropertyL( |
|
1348 |
aNode, aPseudoClass, &CXnNode::NavIndexL, |
|
1349 |
aLayoutPropertyCache->iNavIndex, |
|
1350 |
aLayoutPropertyCache->iNavIndexes, aStates, level ); |
|
1351 |
||
1352 |
DisableStatePropertyL( |
|
1353 |
aNode, aPseudoClass, &CXnNode::ZIndexL, |
|
1354 |
aLayoutPropertyCache->iZIndex, |
|
1355 |
aLayoutPropertyCache->iZIndexes, aStates, level ); |
|
1356 |
||
1357 |
DisableStatePropertyL( |
|
1358 |
aNode, aPseudoClass, &CXnNode::BackgroundColorL, |
|
1359 |
aLayoutPropertyCache->iBackgroundColor, |
|
1360 |
aLayoutPropertyCache->iBackgroundColors, aStates, level ); |
|
1361 |
||
1362 |
DisableStatePropertyL( |
|
1363 |
aNode, aPseudoClass, &CXnNode::BackgroundImageL, |
|
1364 |
aLayoutPropertyCache->iBackgroundImage, |
|
1365 |
aLayoutPropertyCache->iBackgroundImages, aStates, level, ETrue ); |
|
1366 |
||
1367 |
DisableStatePropertyL( |
|
1368 |
aNode, aPseudoClass, &CXnNode::FocusBackgroundL, |
|
1369 |
aLayoutPropertyCache->iFocusBackground, |
|
1370 |
aLayoutPropertyCache->iFocusBackgrounds, aStates, level ); |
|
1371 |
||
1372 |
aNode.SetDirtyL( level ); |
|
1373 |
} |
|
1374 |
||
1375 |
// ----------------------------------------------------------------------------- |
|
1376 |
// AllocateLayoutCache() |
|
1377 |
// ----------------------------------------------------------------------------- |
|
1378 |
// |
|
1379 |
static TBool AllocateLayoutCache( CLayoutPropertyCache*& aLayoutPropertyCache ) |
|
1380 |
{ |
|
1381 |
if ( !aLayoutPropertyCache ) |
|
1382 |
{ |
|
1383 |
aLayoutPropertyCache = new CLayoutPropertyCache; |
|
1384 |
} |
|
1385 |
||
1386 |
return aLayoutPropertyCache ? ETrue : EFalse; |
|
1387 |
} |
|
1388 |
||
1389 |
// ----------------------------------------------------------------------------- |
|
1390 |
// DoSetCachedProperty() |
|
1391 |
// ----------------------------------------------------------------------------- |
|
1392 |
// |
|
1393 |
static void DoSetCachedProperty( |
|
1394 |
CXnProperty* aProperty,\ |
|
1395 |
CXnProperty*& aCachedPropertyToSet, |
|
1396 |
RPointerArray< CXnProperty >& aArray, |
|
1397 |
TBool aInitializing, |
|
1398 |
TBool aArrayOnly ) |
|
1399 |
{ |
|
1400 |
ReplaceOrAppend( aProperty, aArray, aInitializing ); |
|
1401 |
||
1402 |
if ( !aArrayOnly ) |
|
1403 |
{ |
|
1404 |
aCachedPropertyToSet = aProperty; |
|
1405 |
} |
|
1406 |
} |
|
1407 |
||
1408 |
// ----------------------------------------------------------------------------- |
|
1409 |
// SetCachedProperty() |
|
1410 |
// ----------------------------------------------------------------------------- |
|
1411 |
// |
|
1412 |
static void SetCachedProperty( |
|
1413 |
CXnProperty* aProperty, |
|
1414 |
CLayoutPropertyCache*& aLayoutPropertyCache, |
|
1415 |
CXnProperty*& aName, |
|
1416 |
CXnProperty*& aValue, |
|
1417 |
CXnProperty*& aLabel, |
|
1418 |
CXnProperty*& aInitialFocus, |
|
1419 |
CXnProperty*& aClass, |
|
1420 |
CXnProperty*& aId, |
|
1421 |
CXnProperty*& aPath, |
|
1422 |
CXnProperty*& aMaskPath, |
|
1423 |
TBool aInitializing, |
|
1424 |
TBool aArrayOnly) |
|
1425 |
{ |
|
1426 |
const TDesC8& name = aProperty->Property()->Name(); |
|
1427 |
if ( !AllocateLayoutCache( aLayoutPropertyCache ) ) |
|
1428 |
{ |
|
1429 |
return; |
|
1430 |
} |
|
1431 |
if ( name == XnPropertyNames::common::KId ) |
|
1432 |
{ |
|
1433 |
aId = aProperty; |
|
1434 |
} |
|
1435 |
else if ( name == XnPropertyNames::common::KClass ) |
|
1436 |
{ |
|
1437 |
aClass = aProperty; |
|
1438 |
} |
|
1439 |
else if ( name == XnPropertyNames::style::common::KWidth ) |
|
1440 |
{ |
|
1441 |
DoSetCachedProperty( |
|
1442 |
aProperty, |
|
1443 |
aLayoutPropertyCache->iWidth, |
|
1444 |
aLayoutPropertyCache->iWidths, |
|
1445 |
aInitializing, aArrayOnly ); |
|
1446 |
} |
|
1447 |
else if ( name == XnPropertyNames::style::common::KHeight ) |
|
1448 |
{ |
|
1449 |
DoSetCachedProperty( |
|
1450 |
aProperty, |
|
1451 |
aLayoutPropertyCache->iHeight, |
|
1452 |
aLayoutPropertyCache->iHeights, |
|
1453 |
aInitializing, aArrayOnly ); |
|
1454 |
} |
|
1455 |
else if ( name == XnPropertyNames::style::common::KBlockProgression ) |
|
1456 |
{ |
|
1457 |
DoSetCachedProperty( |
|
1458 |
aProperty, |
|
1459 |
aLayoutPropertyCache->iBlockProgression, |
|
1460 |
aLayoutPropertyCache->iBlockProgressions, |
|
1461 |
aInitializing, aArrayOnly ); |
|
1462 |
} |
|
1463 |
else if ( name == XnPropertyNames::style::common::KDirection ) |
|
1464 |
{ |
|
1465 |
DoSetCachedProperty( |
|
1466 |
aProperty, |
|
1467 |
aLayoutPropertyCache->iDirection, |
|
1468 |
aLayoutPropertyCache->iDirections, |
|
1469 |
aInitializing, aArrayOnly ); |
|
1470 |
} |
|
1471 |
else if ( name == XnPropertyNames::style::common::KPosition ) |
|
1472 |
{ |
|
1473 |
DoSetCachedProperty( |
|
1474 |
aProperty, |
|
1475 |
aLayoutPropertyCache->iPosition, |
|
1476 |
aLayoutPropertyCache->iPositions, |
|
1477 |
aInitializing, aArrayOnly ); |
|
1478 |
} |
|
1479 |
else if ( name == XnPropertyNames::style::common::KDisplay ) |
|
1480 |
{ |
|
1481 |
DoSetCachedProperty( |
|
1482 |
aProperty, |
|
1483 |
aLayoutPropertyCache->iDisplay, |
|
1484 |
aLayoutPropertyCache->iDisplays, |
|
1485 |
aInitializing, aArrayOnly ); |
|
1486 |
} |
|
1487 |
else if ( name == XnPropertyNames::style::common::KVisibility ) |
|
1488 |
{ |
|
1489 |
DoSetCachedProperty( |
|
1490 |
aProperty, |
|
1491 |
aLayoutPropertyCache->iVisibility, |
|
1492 |
aLayoutPropertyCache->iVisibilities, |
|
1493 |
aInitializing, aArrayOnly ); |
|
1494 |
} |
|
1495 |
else if ( name == XnPropertyNames::action::KName ) |
|
1496 |
{ |
|
1497 |
aName = aProperty; |
|
1498 |
} |
|
1499 |
else if ( name == XnPropertyNames::action::KValue ) |
|
1500 |
{ |
|
1501 |
aValue = aProperty; |
|
1502 |
} |
|
1503 |
else if ( name == XnPropertyNames::menu::KLabel ) |
|
1504 |
{ |
|
1505 |
aLabel = aProperty; |
|
1506 |
} |
|
1507 |
else if ( name == XnPropertyNames::image::KPath ) |
|
1508 |
{ |
|
1509 |
aPath = aProperty; |
|
1510 |
} |
|
1511 |
else if ( name == XnPropertyNames::image::KMaskPath ) |
|
1512 |
{ |
|
1513 |
aMaskPath = aProperty; |
|
1514 |
} |
|
1515 |
else if ( name == XnPropertyNames::style::common::KMarginLeft ) |
|
1516 |
{ |
|
1517 |
DoSetCachedProperty( |
|
1518 |
aProperty, |
|
1519 |
aLayoutPropertyCache->iMarginLeft, |
|
1520 |
aLayoutPropertyCache->iMarginLefts, |
|
1521 |
aInitializing, aArrayOnly ); |
|
1522 |
} |
|
1523 |
else if ( name == XnPropertyNames::style::common::KMarginRight ) |
|
1524 |
{ |
|
1525 |
DoSetCachedProperty( |
|
1526 |
aProperty, |
|
1527 |
aLayoutPropertyCache->iMarginRight, |
|
1528 |
aLayoutPropertyCache->iMarginRights, |
|
1529 |
aInitializing, aArrayOnly ); |
|
1530 |
} |
|
1531 |
else if ( name == XnPropertyNames::style::common::KBorderLeftWidth ) |
|
1532 |
{ |
|
1533 |
DoSetCachedProperty( |
|
1534 |
aProperty, |
|
1535 |
aLayoutPropertyCache->iBorderLeft, |
|
1536 |
aLayoutPropertyCache->iBorderLefts, |
|
1537 |
aInitializing, aArrayOnly ); |
|
1538 |
} |
|
1539 |
else if ( name == XnPropertyNames::style::common::KBorderRightWidth ) |
|
1540 |
{ |
|
1541 |
DoSetCachedProperty( |
|
1542 |
aProperty, |
|
1543 |
aLayoutPropertyCache->iBorderRight, |
|
1544 |
aLayoutPropertyCache->iBorderRights, |
|
1545 |
aInitializing, aArrayOnly ); |
|
1546 |
} |
|
1547 |
else if ( name == XnPropertyNames::style::common::KPaddingLeft ) |
|
1548 |
{ |
|
1549 |
DoSetCachedProperty( |
|
1550 |
aProperty, |
|
1551 |
aLayoutPropertyCache->iPaddingLeft, |
|
1552 |
aLayoutPropertyCache->iPaddingLefts, |
|
1553 |
aInitializing, aArrayOnly ); |
|
1554 |
} |
|
1555 |
else if ( name == XnPropertyNames::style::common::KPaddingRight ) |
|
1556 |
{ |
|
1557 |
DoSetCachedProperty( |
|
1558 |
aProperty, |
|
1559 |
aLayoutPropertyCache->iPaddingRight, |
|
1560 |
aLayoutPropertyCache->iPaddingRights, |
|
1561 |
aInitializing, aArrayOnly ); |
|
1562 |
} |
|
1563 |
else if ( name == XnPropertyNames::style::common::KMarginTop ) |
|
1564 |
{ |
|
1565 |
DoSetCachedProperty( |
|
1566 |
aProperty, |
|
1567 |
aLayoutPropertyCache->iMarginTop, |
|
1568 |
aLayoutPropertyCache->iMarginTops, |
|
1569 |
aInitializing, aArrayOnly ); |
|
1570 |
} |
|
1571 |
else if ( name == XnPropertyNames::style::common::KMarginBottom ) |
|
1572 |
{ |
|
1573 |
DoSetCachedProperty( |
|
1574 |
aProperty, |
|
1575 |
aLayoutPropertyCache->iMarginBottom, |
|
1576 |
aLayoutPropertyCache->iMarginBottoms, |
|
1577 |
aInitializing, aArrayOnly ); |
|
1578 |
} |
|
1579 |
else if ( name == XnPropertyNames::style::common::KBorderTopWidth ) |
|
1580 |
{ |
|
1581 |
DoSetCachedProperty( |
|
1582 |
aProperty, |
|
1583 |
aLayoutPropertyCache->iBorderTop, |
|
1584 |
aLayoutPropertyCache->iBorderTops, |
|
1585 |
aInitializing, aArrayOnly ); |
|
1586 |
} |
|
1587 |
else if ( name == XnPropertyNames::style::common::KBorderBottomWidth ) |
|
1588 |
{ |
|
1589 |
DoSetCachedProperty( |
|
1590 |
aProperty, |
|
1591 |
aLayoutPropertyCache->iBorderBottom, |
|
1592 |
aLayoutPropertyCache->iBorderBottoms, |
|
1593 |
aInitializing, aArrayOnly ); |
|
1594 |
} |
|
1595 |
else if ( name == XnPropertyNames::style::common::KPaddingTop ) |
|
1596 |
{ |
|
1597 |
DoSetCachedProperty( |
|
1598 |
aProperty, |
|
1599 |
aLayoutPropertyCache->iPaddingTop, |
|
1600 |
aLayoutPropertyCache->iPaddingTops, |
|
1601 |
aInitializing, aArrayOnly ); |
|
1602 |
} |
|
1603 |
else if ( name == XnPropertyNames::style::common::KPaddingBottom ) |
|
1604 |
{ |
|
1605 |
DoSetCachedProperty( |
|
1606 |
aProperty, |
|
1607 |
aLayoutPropertyCache->iPaddingBottom, |
|
1608 |
aLayoutPropertyCache->iPaddingBottoms, |
|
1609 |
aInitializing, aArrayOnly ); |
|
1610 |
} |
|
1611 |
else if ( name == XnPropertyNames::style::common::KBorderWidth ) |
|
1612 |
{ |
|
1613 |
DoSetCachedProperty( |
|
1614 |
aProperty, |
|
1615 |
aLayoutPropertyCache->iBorderWidth, |
|
1616 |
aLayoutPropertyCache->iBorderWidths, |
|
1617 |
aInitializing, aArrayOnly ); |
|
1618 |
} |
|
1619 |
else if ( name == XnPropertyNames::style::common::KMaxHeight ) |
|
1620 |
{ |
|
1621 |
DoSetCachedProperty( |
|
1622 |
aProperty, |
|
1623 |
aLayoutPropertyCache->iMaxHeight, |
|
1624 |
aLayoutPropertyCache->iMaxHeights, |
|
1625 |
aInitializing, aArrayOnly ); |
|
1626 |
} |
|
1627 |
else if ( name == XnPropertyNames::style::common::KMinHeight ) |
|
1628 |
{ |
|
1629 |
DoSetCachedProperty( |
|
1630 |
aProperty, |
|
1631 |
aLayoutPropertyCache->iMinHeight, |
|
1632 |
aLayoutPropertyCache->iMinHeights, |
|
1633 |
aInitializing, aArrayOnly ); |
|
1634 |
} |
|
1635 |
else if ( name == XnPropertyNames::style::common::KMaxWidth ) |
|
1636 |
{ |
|
1637 |
DoSetCachedProperty( |
|
1638 |
aProperty, |
|
1639 |
aLayoutPropertyCache->iMaxWidth, |
|
1640 |
aLayoutPropertyCache->iMaxWidths, |
|
1641 |
aInitializing, aArrayOnly ); |
|
1642 |
} |
|
1643 |
else if ( name == XnPropertyNames::style::common::KMinWidth ) |
|
1644 |
{ |
|
1645 |
DoSetCachedProperty( |
|
1646 |
aProperty, |
|
1647 |
aLayoutPropertyCache->iMinWidth, |
|
1648 |
aLayoutPropertyCache->iMinWidths, |
|
1649 |
aInitializing, aArrayOnly ); |
|
1650 |
} |
|
1651 |
else if ( name == XnPropertyNames::style::common::KLeft ) |
|
1652 |
{ |
|
1653 |
DoSetCachedProperty( |
|
1654 |
aProperty, |
|
1655 |
aLayoutPropertyCache->iLeft, |
|
1656 |
aLayoutPropertyCache->iLefts, |
|
1657 |
aInitializing, aArrayOnly ); |
|
1658 |
} |
|
1659 |
else if ( name == XnPropertyNames::style::common::KRight ) |
|
1660 |
{ |
|
1661 |
DoSetCachedProperty( |
|
1662 |
aProperty, |
|
1663 |
aLayoutPropertyCache->iRight, |
|
1664 |
aLayoutPropertyCache->iRights, |
|
1665 |
aInitializing, aArrayOnly ); |
|
1666 |
} |
|
1667 |
else if ( name == XnPropertyNames::style::common::KTop ) |
|
1668 |
{ |
|
1669 |
DoSetCachedProperty( |
|
1670 |
aProperty, |
|
1671 |
aLayoutPropertyCache->iTop, |
|
1672 |
aLayoutPropertyCache->iTops, |
|
1673 |
aInitializing, aArrayOnly ); |
|
1674 |
} |
|
1675 |
else if ( name == XnPropertyNames::style::common::KBottom ) |
|
1676 |
{ |
|
1677 |
DoSetCachedProperty( |
|
1678 |
aProperty, |
|
1679 |
aLayoutPropertyCache->iBottom, |
|
1680 |
aLayoutPropertyCache->iBottoms, |
|
1681 |
aInitializing, aArrayOnly ); |
|
1682 |
} |
|
1683 |
else if ( name == XnPropertyNames::appearance::common::KBorderLeftStyle ) |
|
1684 |
{ |
|
1685 |
DoSetCachedProperty( |
|
1686 |
aProperty, |
|
1687 |
aLayoutPropertyCache->iBorderLeftStyle, |
|
1688 |
aLayoutPropertyCache->iBorderLeftStyles, |
|
1689 |
aInitializing, aArrayOnly ); |
|
1690 |
} |
|
1691 |
else if ( name == XnPropertyNames::appearance::common::KBorderRightStyle ) |
|
1692 |
{ |
|
1693 |
DoSetCachedProperty( |
|
1694 |
aProperty, |
|
1695 |
aLayoutPropertyCache->iBorderRightStyle, |
|
1696 |
aLayoutPropertyCache->iBorderRightStyles, |
|
1697 |
aInitializing, aArrayOnly ); |
|
1698 |
} |
|
1699 |
else if ( name == XnPropertyNames::appearance::common::KBorderTopStyle ) |
|
1700 |
{ |
|
1701 |
DoSetCachedProperty( |
|
1702 |
aProperty, |
|
1703 |
aLayoutPropertyCache->iBorderTopStyle, |
|
1704 |
aLayoutPropertyCache->iBorderTopStyles, |
|
1705 |
aInitializing, aArrayOnly ); |
|
1706 |
} |
|
1707 |
else if ( name == XnPropertyNames::appearance::common::KBorderBottomStyle ) |
|
1708 |
{ |
|
1709 |
DoSetCachedProperty( |
|
1710 |
aProperty, |
|
1711 |
aLayoutPropertyCache->iBorderBottomStyle, |
|
1712 |
aLayoutPropertyCache->iBorderBottomStyles, |
|
1713 |
aInitializing, aArrayOnly ); |
|
1714 |
} |
|
1715 |
else if ( name == XnPropertyNames::appearance::common::KBorderStyle ) |
|
1716 |
{ |
|
1717 |
DoSetCachedProperty( |
|
1718 |
aProperty, |
|
1719 |
aLayoutPropertyCache->iBorderStyle, |
|
1720 |
aLayoutPropertyCache->iBorderStyles, |
|
1721 |
aInitializing, aArrayOnly ); |
|
1722 |
} |
|
1723 |
else if ( name == XnPropertyNames::appearance::common::KBorderImage ) |
|
1724 |
{ |
|
1725 |
aLayoutPropertyCache->iBorderImage = aProperty; |
|
1726 |
} |
|
1727 |
else if ( name == XnPropertyNames::style::common::KZIndex ) |
|
1728 |
{ |
|
1729 |
DoSetCachedProperty( |
|
1730 |
aProperty, |
|
1731 |
aLayoutPropertyCache->iZIndex, |
|
1732 |
aLayoutPropertyCache->iZIndexes, |
|
1733 |
aInitializing, aArrayOnly ); |
|
1734 |
} |
|
1735 |
else if ( name == XnPropertyNames::appearance::common::KBackGroundColor ) |
|
1736 |
{ |
|
1737 |
DoSetCachedProperty( |
|
1738 |
aProperty, |
|
1739 |
aLayoutPropertyCache->iBackgroundColor, |
|
1740 |
aLayoutPropertyCache->iBackgroundColors, |
|
1741 |
aInitializing, aArrayOnly ); |
|
1742 |
} |
|
1743 |
else if ( name == XnPropertyNames::appearance::common::KBackGroundImage ) |
|
1744 |
{ |
|
1745 |
DoSetCachedProperty( |
|
1746 |
aProperty, |
|
1747 |
aLayoutPropertyCache->iBackgroundImage, |
|
1748 |
aLayoutPropertyCache->iBackgroundImages, |
|
1749 |
aInitializing, aArrayOnly ); |
|
1750 |
} |
|
1751 |
else if ( name == XnPropertyNames::appearance::common::KFocusBackground ) |
|
1752 |
{ |
|
1753 |
DoSetCachedProperty( |
|
1754 |
aProperty, |
|
1755 |
aLayoutPropertyCache->iFocusBackground, |
|
1756 |
aLayoutPropertyCache->iFocusBackgrounds, |
|
1757 |
aInitializing, aArrayOnly ); |
|
1758 |
} |
|
1759 |
else if ( name == XnPropertyNames::style::common::KS60DisplayPriority ) |
|
1760 |
{ |
|
1761 |
DoSetCachedProperty( |
|
1762 |
aProperty, |
|
1763 |
aLayoutPropertyCache->iDisplayPriority, |
|
1764 |
aLayoutPropertyCache->iDisplayPriorities, |
|
1765 |
aInitializing, aArrayOnly ); |
|
1766 |
} |
|
1767 |
else if ( name == XnPropertyNames::common::KInitialFocus ) |
|
1768 |
{ |
|
1769 |
aInitialFocus = aProperty; |
|
1770 |
} |
|
1771 |
else if ( name == XnPropertyNames::style::common::KNavIndex ) |
|
1772 |
{ |
|
1773 |
DoSetCachedProperty( |
|
1774 |
aProperty, |
|
1775 |
aLayoutPropertyCache->iNavIndex, |
|
1776 |
aLayoutPropertyCache->iNavIndexes, |
|
1777 |
aInitializing, aArrayOnly ); |
|
1778 |
} |
|
1779 |
} |
|
1780 |
||
1781 |
// ----------------------------------------------------------------------------- |
|
1782 |
// ReplaceOrAppend() |
|
1783 |
// ----------------------------------------------------------------------------- |
|
1784 |
// |
|
1785 |
static void ReplaceOrAppend( |
|
1786 |
CXnProperty* aProperty, |
|
1787 |
RPointerArray< CXnProperty >& aArray, |
|
1788 |
TBool aAppendOnly ) |
|
1789 |
{ |
|
1790 |
if ( !aAppendOnly ) |
|
1791 |
{ |
|
1792 |
for ( TInt i = aArray.Count() - 1; i >= 0; --i ) |
|
1793 |
{ |
|
1794 |
if ( aArray[i] == aProperty ) |
|
1795 |
{ |
|
1796 |
aArray.Remove( i ); |
|
1797 |
} |
|
1798 |
else if ( aArray[i]->Property()->PseudoClass() == |
|
1799 |
aProperty->Property()->PseudoClass() && |
|
1800 |
aArray[i]->Property()->Name() == |
|
1801 |
aProperty->Property()->Name() ) |
|
1802 |
{ |
|
1803 |
aArray.Remove( i ); |
|
1804 |
} |
|
1805 |
} |
|
1806 |
} |
|
1807 |
aArray.Append( aProperty ); |
|
1808 |
} |
|
1809 |
||
1810 |
// ----------------------------------------------------------------------------- |
|
1811 |
// IsPropertyPseudoClass() |
|
1812 |
// ----------------------------------------------------------------------------- |
|
1813 |
// |
|
1814 |
static TBool IsPropertyPseudoClass( |
|
1815 |
CXnDomProperty::TPseudoClass aPseudoClass, |
|
1816 |
RArray< CXnDomProperty::TPseudoClass >& aArray ) |
|
1817 |
{ |
|
1818 |
for ( TInt i = aArray.Count() - 1; i >= 0; --i ) |
|
1819 |
{ |
|
1820 |
if ( aArray[i] == aPseudoClass ) |
|
1821 |
{ |
|
1822 |
return ETrue; |
|
1823 |
} |
|
1824 |
} |
|
1825 |
return EFalse; |
|
1826 |
} |
|
1827 |
||
1828 |
// ----------------------------------------------------------------------------- |
|
1829 |
// InsertPropertyPseudoClassL() |
|
1830 |
// ----------------------------------------------------------------------------- |
|
1831 |
// |
|
1832 |
static void InsertPropertyPseudoClassL( |
|
1833 |
CXnDomProperty::TPseudoClass aPseudoClass, |
|
1834 |
RArray< CXnDomProperty::TPseudoClass >& aArray ) |
|
1835 |
{ |
|
1836 |
if ( !IsPropertyPseudoClass( aPseudoClass, aArray ) ) |
|
1837 |
{ |
|
1838 |
User::LeaveIfError( aArray.Append( aPseudoClass ) ); |
|
1839 |
} |
|
1840 |
} |
|
1841 |
||
1842 |
// ----------------------------------------------------------------------------- |
|
1843 |
// BuildEventTypeNodeL |
|
1844 |
// ----------------------------------------------------------------------------- |
|
1845 |
// |
|
1846 |
static CXnNode* BuildEventTypeNodeL( TEventCode aType, CXnUiEngine& aUiEngine ) |
|
1847 |
{ |
|
1848 |
CXnNode* node = CXnNode::NewL(); |
|
1849 |
CleanupStack::PushL( node ); |
|
1850 |
CXnType* type = CXnType::NewL( XnPropertyNames::action::KProperty ); |
|
1851 |
CleanupStack::PushL( type ); |
|
1852 |
CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
1853 |
CleanupStack::Pop( type ); |
|
1854 |
node->SetImpl( impl ); |
|
1855 |
node->SetUiEngine( aUiEngine ); |
|
1856 |
CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
1857 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1858 |
CleanupStack::PushL( nameValue ); |
|
1859 |
nameValue->SetStringValueL( |
|
1860 |
CXnDomPropertyValue::EString, |
|
1861 |
XnPropertyNames::action::trigger::name::keyevent::KEventType ); |
|
1862 |
CXnProperty* name = CXnProperty::NewL( |
|
1863 |
XnPropertyNames::action::KName, |
|
1864 |
nameValue, *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1865 |
CleanupStack::Pop( nameValue ); |
|
1866 |
CleanupStack::PushL( name ); |
|
1867 |
node->SetPropertyL( name ); |
|
1868 |
CleanupStack::Pop( name ); |
|
1869 |
CXnDomPropertyValue* valueValue = CXnDomPropertyValue::NewL( |
|
1870 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1871 |
CleanupStack::PushL( valueValue ); |
|
1872 |
valueValue->SetFloatValueL( CXnDomPropertyValue::ENumber, aType ); |
|
1873 |
CXnProperty* value = CXnProperty::NewL( |
|
1874 |
XnPropertyNames::action::KValue, valueValue, |
|
1875 |
*aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1876 |
CleanupStack::Pop( valueValue ); |
|
1877 |
CleanupStack::PushL( value ); |
|
1878 |
node->SetPropertyL( value ); |
|
1879 |
CleanupStack::Pop( value ); |
|
1880 |
CleanupStack::Pop( node ); |
|
1881 |
return node; |
|
1882 |
} |
|
1883 |
||
1884 |
// ----------------------------------------------------------------------------- |
|
1885 |
// BuildModifiersNodeL |
|
1886 |
// ----------------------------------------------------------------------------- |
|
1887 |
// |
|
1888 |
static CXnNode* BuildModifiersNodeL( |
|
1889 |
const TKeyEvent& aKeyEvent, |
|
1890 |
CXnUiEngine& aUiEngine ) |
|
1891 |
{ |
|
1892 |
CXnNode* node = CXnNode::NewL(); |
|
1893 |
CleanupStack::PushL( node ); |
|
1894 |
CXnType* type = CXnType::NewL( XnPropertyNames::action::KProperty ); |
|
1895 |
CleanupStack::PushL( type ); |
|
1896 |
CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
1897 |
CleanupStack::Pop( type ); |
|
1898 |
node->SetImpl( impl ); |
|
1899 |
node->SetUiEngine( aUiEngine ); |
|
1900 |
CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
1901 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1902 |
CleanupStack::PushL( nameValue ); |
|
1903 |
nameValue->SetStringValueL( |
|
1904 |
CXnDomPropertyValue::EString, |
|
1905 |
XnPropertyNames::action::trigger::name::keyevent::KModifiers ); |
|
1906 |
CXnProperty* name = CXnProperty::NewL( |
|
1907 |
XnPropertyNames::action::KName, |
|
1908 |
nameValue, |
|
1909 |
*aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1910 |
CleanupStack::Pop( nameValue ); |
|
1911 |
CleanupStack::PushL( name ); |
|
1912 |
node->SetPropertyL( name ); |
|
1913 |
CleanupStack::Pop( name ); |
|
1914 |
CXnDomPropertyValue* valueValue = CXnDomPropertyValue::NewL( |
|
1915 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1916 |
CleanupStack::PushL( valueValue ); |
|
1917 |
valueValue->SetFloatValueL( |
|
1918 |
CXnDomPropertyValue::ENumber, aKeyEvent.iModifiers ); |
|
1919 |
CXnProperty* value = CXnProperty::NewL( |
|
1920 |
XnPropertyNames::action::KValue, |
|
1921 |
valueValue, |
|
1922 |
*aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1923 |
CleanupStack::Pop( valueValue ); |
|
1924 |
CleanupStack::PushL( value ); |
|
1925 |
node->SetPropertyL( value ); |
|
1926 |
CleanupStack::Pop( value ); |
|
1927 |
CleanupStack::Pop( node ); |
|
1928 |
return node; |
|
1929 |
} |
|
1930 |
||
1931 |
// ----------------------------------------------------------------------------- |
|
1932 |
// BuildKeyCodeNodeL |
|
1933 |
// ----------------------------------------------------------------------------- |
|
1934 |
// |
|
1935 |
static CXnNode* BuildKeyCodeNodeL( |
|
1936 |
const TKeyEvent& aKeyEvent, |
|
1937 |
CXnUiEngine& aUiEngine ) |
|
1938 |
{ |
|
1939 |
CXnNode* node = CXnNode::NewL(); |
|
1940 |
CleanupStack::PushL( node ); |
|
1941 |
CXnType* type = CXnType::NewL( XnPropertyNames::action::KProperty ); |
|
1942 |
CleanupStack::PushL( type ); |
|
1943 |
CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
1944 |
CleanupStack::Pop( type ); |
|
1945 |
node->SetImpl( impl ); |
|
1946 |
node->SetUiEngine( aUiEngine ); |
|
1947 |
CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
1948 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1949 |
CleanupStack::PushL( nameValue ); |
|
1950 |
nameValue->SetStringValueL( |
|
1951 |
CXnDomPropertyValue::EString, |
|
1952 |
XnPropertyNames::action::trigger::name::keyevent::KKeyCode ); |
|
1953 |
CXnProperty* name = CXnProperty::NewL( |
|
1954 |
XnPropertyNames::action::KName, |
|
1955 |
nameValue, |
|
1956 |
*aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1957 |
CleanupStack::Pop( nameValue ); |
|
1958 |
CleanupStack::PushL( name ); |
|
1959 |
node->SetPropertyL( name ); |
|
1960 |
CleanupStack::Pop( name ); |
|
1961 |
CXnDomPropertyValue* valueValue = CXnDomPropertyValue::NewL( |
|
1962 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1963 |
CleanupStack::PushL( valueValue ); |
|
1964 |
valueValue->SetFloatValueL( CXnDomPropertyValue::ENumber, aKeyEvent.iCode ); |
|
1965 |
CXnProperty* value = CXnProperty::NewL( |
|
1966 |
XnPropertyNames::action::KValue, |
|
1967 |
valueValue, |
|
1968 |
*aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1969 |
CleanupStack::Pop( valueValue ); |
|
1970 |
CleanupStack::PushL( value ); |
|
1971 |
node->SetPropertyL( value ); |
|
1972 |
CleanupStack::Pop( value ); |
|
1973 |
CleanupStack::Pop( node ); |
|
1974 |
return node; |
|
1975 |
} |
|
1976 |
||
1977 |
// ----------------------------------------------------------------------------- |
|
1978 |
// BuildScanCodeNodeL |
|
1979 |
// ----------------------------------------------------------------------------- |
|
1980 |
// |
|
1981 |
static CXnNode* BuildScanCodeNodeL( |
|
1982 |
const TKeyEvent& aKeyEvent, |
|
1983 |
CXnUiEngine& aUiEngine ) |
|
1984 |
{ |
|
1985 |
CXnNode* node = CXnNode::NewL(); |
|
1986 |
CleanupStack::PushL( node ); |
|
1987 |
CXnType* type = CXnType::NewL( XnPropertyNames::action::KProperty ); |
|
1988 |
CleanupStack::PushL( type ); |
|
1989 |
CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
1990 |
CleanupStack::Pop( type ); |
|
1991 |
node->SetImpl( impl ); |
|
1992 |
node->SetUiEngine( aUiEngine ); |
|
1993 |
CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
1994 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1995 |
CleanupStack::PushL( nameValue ); |
|
1996 |
nameValue->SetStringValueL( |
|
1997 |
CXnDomPropertyValue::EString, |
|
1998 |
XnPropertyNames::action::trigger::name::keyevent::KScanCode ); |
|
1999 |
CXnProperty* name = CXnProperty::NewL( |
|
2000 |
XnPropertyNames::action::KName, |
|
2001 |
nameValue, |
|
2002 |
*aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2003 |
CleanupStack::Pop( nameValue ); |
|
2004 |
CleanupStack::PushL( name ); |
|
2005 |
node->SetPropertyL( name ); |
|
2006 |
CleanupStack::Pop( name ); |
|
2007 |
CXnDomPropertyValue* valueValue = CXnDomPropertyValue::NewL( |
|
2008 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2009 |
CleanupStack::PushL( valueValue ); |
|
2010 |
valueValue->SetFloatValueL( |
|
2011 |
CXnDomPropertyValue::ENumber, aKeyEvent.iScanCode ); |
|
2012 |
CXnProperty* value = CXnProperty::NewL( |
|
2013 |
XnPropertyNames::action::KValue, |
|
2014 |
valueValue, |
|
2015 |
*aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2016 |
CleanupStack::Pop( valueValue ); |
|
2017 |
CleanupStack::PushL( value ); |
|
2018 |
node->SetPropertyL( value ); |
|
2019 |
CleanupStack::Pop( value ); |
|
2020 |
CleanupStack::Pop( node ); |
|
2021 |
return node; |
|
2022 |
} |
|
2023 |
||
2024 |
// ----------------------------------------------------------------------------- |
|
2025 |
// BuildRepeatsNodeL |
|
2026 |
// ----------------------------------------------------------------------------- |
|
2027 |
// |
|
2028 |
static CXnNode* BuildRepeatsNodeL( |
|
2029 |
const TKeyEvent& aKeyEvent, |
|
2030 |
CXnUiEngine& aUiEngine ) |
|
2031 |
{ |
|
2032 |
CXnNode* node = CXnNode::NewL(); |
|
2033 |
CleanupStack::PushL( node ); |
|
2034 |
CXnType* type = CXnType::NewL( XnPropertyNames::action::KProperty ); |
|
2035 |
CleanupStack::PushL( type ); |
|
2036 |
CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
2037 |
CleanupStack::Pop( type ); |
|
2038 |
node->SetImpl( impl ); |
|
2039 |
node->SetUiEngine( aUiEngine ); |
|
2040 |
CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
2041 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2042 |
CleanupStack::PushL( nameValue ); |
|
2043 |
nameValue->SetStringValueL( |
|
2044 |
CXnDomPropertyValue::EString, |
|
2045 |
XnPropertyNames::action::trigger::name::keyevent::KRepeats ); |
|
2046 |
CXnProperty* name = CXnProperty::NewL( |
|
2047 |
XnPropertyNames::action::KName, |
|
2048 |
nameValue, |
|
2049 |
*aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2050 |
CleanupStack::Pop( nameValue ); |
|
2051 |
CleanupStack::PushL( name ); |
|
2052 |
node->SetPropertyL( name ); |
|
2053 |
CleanupStack::Pop( name ); |
|
2054 |
CXnDomPropertyValue* valueValue = CXnDomPropertyValue::NewL( |
|
2055 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2056 |
CleanupStack::PushL( valueValue ); |
|
2057 |
valueValue->SetFloatValueL( |
|
2058 |
CXnDomPropertyValue::ENumber, aKeyEvent.iRepeats ); |
|
2059 |
CXnProperty* value = CXnProperty::NewL( |
|
2060 |
XnPropertyNames::action::KValue, |
|
2061 |
valueValue, |
|
2062 |
*aUiEngine.ODT()->DomDocument().StringPool()) ; |
|
2063 |
CleanupStack::Pop( valueValue ); |
|
2064 |
CleanupStack::PushL( value ); |
|
2065 |
node->SetPropertyL( value ); |
|
2066 |
CleanupStack::Pop( value ); |
|
2067 |
CleanupStack::Pop( node ); |
|
2068 |
return node; |
|
2069 |
} |
|
2070 |
||
2071 |
// ----------------------------------------------------------------------------- |
|
2072 |
// BuildPropertyNodesL |
|
2073 |
// ----------------------------------------------------------------------------- |
|
2074 |
// |
|
2075 |
static void BuildPropertyNodesL( |
|
2076 |
CXnNode& aNode, |
|
2077 |
const TKeyEvent& aKeyEvent, |
|
2078 |
TEventCode aType, |
|
2079 |
CXnUiEngine& aUiEngine ) |
|
2080 |
{ |
|
2081 |
CXnNode* eventType = BuildEventTypeNodeL( aType, aUiEngine ); |
|
2082 |
CleanupStack::PushL( eventType ); |
|
2083 |
aNode.AddChildL( eventType ); |
|
2084 |
CleanupStack::Pop( eventType ); |
|
2085 |
CXnNode* modifiers = BuildModifiersNodeL( aKeyEvent, aUiEngine ); |
|
2086 |
CleanupStack::PushL( modifiers ); |
|
2087 |
aNode.AddChildL( modifiers ); |
|
2088 |
CleanupStack::Pop( modifiers ); |
|
2089 |
CXnNode* keyCode = BuildKeyCodeNodeL( aKeyEvent, aUiEngine ); |
|
2090 |
CleanupStack::PushL( keyCode ); |
|
2091 |
aNode.AddChildL( keyCode ); |
|
2092 |
CleanupStack::Pop( keyCode ); |
|
2093 |
CXnNode* scanCode = BuildScanCodeNodeL( aKeyEvent, aUiEngine ); |
|
2094 |
CleanupStack::PushL( scanCode ); |
|
2095 |
aNode.AddChildL( scanCode ); |
|
2096 |
CleanupStack::Pop( scanCode ); |
|
2097 |
CXnNode* repeats = BuildRepeatsNodeL( aKeyEvent, aUiEngine ); |
|
2098 |
CleanupStack::PushL( repeats ); |
|
2099 |
aNode.AddChildL( repeats ); |
|
2100 |
CleanupStack::Pop( repeats ); |
|
2101 |
} |
|
2102 |
||
2103 |
// ----------------------------------------------------------------------------- |
|
2104 |
// BuildKeyTriggerNodeL |
|
2105 |
// ----------------------------------------------------------------------------- |
|
2106 |
// |
|
2107 |
static CXnNode* BuildKeyTriggerNodeL( |
|
2108 |
const TKeyEvent& aKeyEvent, |
|
2109 |
TEventCode aType, |
|
2110 |
CXnUiEngine& aUiEngine ) |
|
2111 |
{ |
|
2112 |
CXnNode* node = CXnNode::NewL(); |
|
2113 |
CleanupStack::PushL( node ); |
|
2114 |
CXnType* type = CXnType::NewL( XnPropertyNames::action::KTrigger ); |
|
2115 |
CleanupStack::PushL( type ); |
|
2116 |
CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
2117 |
CleanupStack::Pop( type ); |
|
2118 |
node->SetImpl( impl ); |
|
2119 |
node->SetUiEngine( aUiEngine ); |
|
2120 |
CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
2121 |
aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2122 |
CleanupStack::PushL( nameValue ); |
|
2123 |
nameValue->SetStringValueL( |
|
2124 |
CXnDomPropertyValue::EString, |
|
2125 |
XnPropertyNames::action::trigger::name::KKeyEvent ); |
|
2126 |
CXnProperty* name = CXnProperty::NewL( |
|
2127 |
XnPropertyNames::action::trigger::KName, |
|
2128 |
nameValue, |
|
2129 |
*aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2130 |
CleanupStack::Pop( nameValue ); |
|
2131 |
CleanupStack::PushL( name ); |
|
2132 |
node->SetPropertyL( name ); |
|
2133 |
CleanupStack::Pop( name ); |
|
2134 |
BuildPropertyNodesL( *node, aKeyEvent, aType, aUiEngine ); |
|
2135 |
CleanupStack::Pop( node ); |
|
2136 |
return node; |
|
2137 |
} |
|
2138 |
||
2139 |
// ----------------------------------------------------------------------------- |
|
2140 |
// PseudoClassFromName |
|
2141 |
// ----------------------------------------------------------------------------- |
|
2142 |
// |
|
2143 |
static CXnDomProperty::TPseudoClass PseudoClassFromName( const TDesC8& aName ) |
|
2144 |
{ |
|
2145 |
if ( aName == KPseudoClassFocus ) |
|
2146 |
{ |
|
2147 |
return CXnDomProperty::EFocus; |
|
2148 |
} |
|
2149 |
else if ( aName == KPseudoClassPassiveFocus ) |
|
2150 |
{ |
|
2151 |
return CXnDomProperty::EPassiveFocus; |
|
2152 |
} |
|
2153 |
else if ( aName == KPseudoClassHold ) |
|
2154 |
{ |
|
2155 |
return CXnDomProperty::EHold; |
|
2156 |
} |
|
2157 |
else if ( aName == KPseudoClassHover ) |
|
2158 |
{ |
|
2159 |
return CXnDomProperty::EHover; |
|
2160 |
} |
|
2161 |
else if ( aName == KPseudoClassLink ) |
|
2162 |
{ |
|
2163 |
return CXnDomProperty::ELink; |
|
2164 |
} |
|
2165 |
else if ( aName == KPseudoClassVisited ) |
|
2166 |
{ |
|
2167 |
return CXnDomProperty::EVisited; |
|
2168 |
} |
|
2169 |
else if ( aName == KPseudoClassActive ) |
|
2170 |
{ |
|
2171 |
return CXnDomProperty::EActive; |
|
2172 |
} |
|
2173 |
else if ( aName == KPseudoClassEdit ) |
|
2174 |
{ |
|
2175 |
return CXnDomProperty::EEdit; |
|
2176 |
} |
|
2177 |
else if ( aName == KPseudoClassPressedDown ) |
|
2178 |
{ |
|
2179 |
return CXnDomProperty::EPressedDown; |
|
2180 |
} |
|
2181 |
return CXnDomProperty::ENone; |
|
2182 |
} |
|
2183 |
||
2184 |
// ----------------------------------------------------------------------------- |
|
2185 |
// PseudoClassName |
|
2186 |
// ----------------------------------------------------------------------------- |
|
2187 |
// |
|
2188 |
static const TDesC8& PseudoClassName( CXnDomProperty::TPseudoClass aPseudoClass ) |
|
2189 |
{ |
|
2190 |
switch ( aPseudoClass ) |
|
2191 |
{ |
|
2192 |
case CXnDomProperty::EFocus: |
|
2193 |
return KPseudoClassFocus; |
|
2194 |
case CXnDomProperty::EPassiveFocus: |
|
2195 |
return KPseudoClassPassiveFocus; |
|
2196 |
case CXnDomProperty::EHold: |
|
2197 |
return KPseudoClassHold; |
|
2198 |
case CXnDomProperty::EHover: |
|
2199 |
return KPseudoClassHover; |
|
2200 |
case CXnDomProperty::ELink: |
|
2201 |
return KPseudoClassLink; |
|
2202 |
case CXnDomProperty::EVisited: |
|
2203 |
return KPseudoClassVisited; |
|
2204 |
case CXnDomProperty::EActive: |
|
2205 |
return KPseudoClassActive; |
|
2206 |
case CXnDomProperty::EEdit: |
|
2207 |
return KPseudoClassEdit; |
|
2208 |
default: |
|
2209 |
return KNullDesC8; |
|
2210 |
} |
|
2211 |
} |
|
2212 |
||
2213 |
// ----------------------------------------------------------------------------- |
|
2214 |
// DoMatchTriggerForKeyEventL |
|
2215 |
// ----------------------------------------------------------------------------- |
|
2216 |
// |
|
2217 |
static TBool DoMatchTriggerForKeyEventL( |
|
2218 |
const TKeyEvent& aKeyEvent, TEventCode aType, |
|
2219 |
CXnDomNode& aTriggerNode ) |
|
2220 |
{ |
|
2221 |
TInt triggerEventType = EEventKeyDown; |
|
2222 |
TInt triggerKeyCode = 0; |
|
2223 |
TInt triggerScanCode = 0; |
|
2224 |
TInt triggerModifiers = 0; |
|
2225 |
CXnDomList& triggerChildren = aTriggerNode.ChildNodes(); |
|
2226 |
TInt triggerCount = triggerChildren.Length(); |
|
2227 |
TBool triggerScanCodeSet = EFalse; |
|
2228 |
TBool triggerKeyCodeSet = EFalse; |
|
2229 |
for ( TInt i = 0; i < triggerCount; ++i ) |
|
2230 |
{ |
|
2231 |
CXnDomNode* node = static_cast< CXnDomNode* >( |
|
2232 |
triggerChildren.Item( i ) ); |
|
2233 |
CXnDomList& attrs = node->AttributeList(); |
|
2234 |
CXnDomAttribute* nameAttribute = static_cast< CXnDomAttribute* >( |
|
2235 |
attrs.FindByName( XnPropertyNames::action::KName ) ); |
|
2236 |
CXnDomAttribute* valueAttribute = static_cast< CXnDomAttribute* >( |
|
2237 |
attrs.FindByName( XnPropertyNames::action::KValue ) ); |
|
2238 |
if ( !nameAttribute || !valueAttribute ) |
|
2239 |
{ |
|
2240 |
continue; |
|
2241 |
} |
|
2242 |
if ( nameAttribute->Value() == |
|
2243 |
XnPropertyNames::action::trigger::name::keyevent::KEventType ) |
|
2244 |
{ |
|
2245 |
TLex8 lex( valueAttribute->Value() ); |
|
2246 |
lex.Val( triggerEventType ); |
|
2247 |
} |
|
2248 |
else if ( nameAttribute->Value() == |
|
2249 |
XnPropertyNames::action::trigger::name::keyevent::KModifiers ) |
|
2250 |
{ |
|
2251 |
TLex8 lex( valueAttribute->Value() ); |
|
2252 |
lex.Val( triggerModifiers ); |
|
2253 |
} |
|
2254 |
else if ( nameAttribute->Value() == |
|
2255 |
XnPropertyNames::action::trigger::name::keyevent::KKeyCode ) |
|
2256 |
{ |
|
2257 |
TLex8 lex( valueAttribute->Value() ); |
|
2258 |
lex.Val( triggerKeyCode ); |
|
2259 |
triggerKeyCodeSet = ETrue; |
|
2260 |
} |
|
2261 |
else if ( nameAttribute->Value() == |
|
2262 |
XnPropertyNames::action::trigger::name::keyevent::KScanCode ) |
|
2263 |
{ |
|
2264 |
TLex8 lex( valueAttribute->Value() ); |
|
2265 |
lex.Val( triggerScanCode ); |
|
2266 |
triggerScanCodeSet = ETrue; |
|
2267 |
} |
|
2268 |
} |
|
2269 |
return |
|
2270 |
aType == triggerEventType && |
|
2271 |
( triggerKeyCodeSet ? ( aKeyEvent.iCode == triggerKeyCode ) : ETrue ) && |
|
2272 |
( triggerScanCodeSet ? ( aKeyEvent.iScanCode == triggerScanCode ) : ETrue ) && |
|
2273 |
( ( aKeyEvent.iModifiers & 0xFFFFFFFE ) == ( triggerModifiers & 0xFFFFFFFE ) ); |
|
2274 |
} |
|
2275 |
||
2276 |
// ----------------------------------------------------------------------------- |
|
2277 |
// MatchTriggerForKeyEventL |
|
2278 |
// ----------------------------------------------------------------------------- |
|
2279 |
// |
|
2280 |
static TBool MatchTriggerForKeyEventL( |
|
2281 |
CXnNodeImpl* aThis, |
|
2282 |
CXnUiEngine& aEngine, |
|
2283 |
CXnNode& aNode, |
|
2284 |
const TKeyEvent& aKeyEvent, |
|
2285 |
TEventCode aType, |
|
2286 |
CXnDomNode& aActionNode, |
|
2287 |
CXnDomNode& aTriggerNode ) |
|
2288 |
{ |
|
2289 |
CXnDomList& attrs = aTriggerNode.AttributeList(); |
|
2290 |
CXnDomAttribute* attribute = static_cast< CXnDomAttribute* >( |
|
2291 |
attrs.FindByName(XnPropertyNames::action::trigger::KName ) ); |
|
2292 |
if ( !attribute ) |
|
2293 |
{ |
|
2294 |
return EFalse; |
|
2295 |
} |
|
2296 |
||
2297 |
const TDesC8& nameString = attribute->Value(); |
|
2298 |
if ( nameString == KNullDesC8 ) |
|
2299 |
{ |
|
2300 |
return EFalse; |
|
2301 |
} |
|
2302 |
if ( nameString == XnPropertyNames::action::trigger::name::KKeyEvent ) |
|
2303 |
{ |
|
2304 |
TBool match = DoMatchTriggerForKeyEventL( aKeyEvent, aType, aTriggerNode ); |
|
2305 |
if ( match ) |
|
2306 |
{ |
|
2307 |
CXnNode* eventNode = BuildKeyTriggerNodeL( aKeyEvent, aType, aEngine ); |
|
2308 |
CleanupStack::PushL( eventNode ); |
|
2309 |
RunEventsL( aThis, aEngine, aNode, aActionNode, aTriggerNode, *eventNode ); |
|
2310 |
CleanupStack::PopAndDestroy( eventNode ); |
|
2311 |
} |
|
2312 |
return match; |
|
2313 |
} |
|
2314 |
else if ( aType == EEventKey && |
|
2315 |
( nameString == XnPropertyNames::action::trigger::name::KUp || |
|
2316 |
nameString == XnPropertyNames::action::trigger::name::KDown || |
|
2317 |
nameString == XnPropertyNames::action::trigger::name::KLeft || |
|
2318 |
nameString == XnPropertyNames::action::trigger::name::KRight ) ) |
|
2319 |
{ |
|
2320 |
TBool match = DoMatchTriggerForHighLevelKeyEventL( |
|
2321 |
aNode, aKeyEvent, aType, nameString ); |
|
2322 |
if ( match ) |
|
2323 |
{ |
|
2324 |
CXnNode* eventNode = BuildKeyTriggerNodeL( aKeyEvent, aType, aEngine ); |
|
2325 |
CleanupStack::PushL( eventNode ); |
|
2326 |
RunEventsL( aThis, aEngine, aNode, aActionNode, aTriggerNode, *eventNode ); |
|
2327 |
CleanupStack::PopAndDestroy( eventNode ); |
|
2328 |
} |
|
2329 |
return match; |
|
2330 |
} |
|
2331 |
else if ( aKeyEvent.iScanCode == EStdKeyDevice3 && |
|
2332 |
aKeyEvent.iRepeats > 0 && |
|
2333 |
nameString == XnPropertyNames::action::trigger::name::KHold ) |
|
2334 |
{ |
|
2335 |
CXnNode* eventNode = BuildKeyTriggerNodeL( aKeyEvent, aType, aEngine ); |
|
2336 |
CleanupStack::PushL( eventNode ); |
|
2337 |
RunEventsL( aThis, aEngine, aNode, aActionNode, aTriggerNode, *eventNode ); |
|
2338 |
CleanupStack::PopAndDestroy( eventNode ); |
|
2339 |
return ETrue; |
|
2340 |
} |
|
2341 |
else if ( ( ( aKeyEvent.iScanCode == EStdKeyDevice0 ) || |
|
2342 |
( aKeyEvent.iScanCode == EStdKeyDevice1 ) ) && |
|
2343 |
aKeyEvent.iRepeats > 0 && |
|
2344 |
nameString == XnPropertyNames::action::trigger::name::KHold ) |
|
2345 |
{ |
|
2346 |
CXnNode* eventNode = BuildKeyTriggerNodeL( aKeyEvent, aType, aEngine ); |
|
2347 |
CleanupStack::PushL( eventNode ); |
|
2348 |
RunEventsL( aThis, aEngine, aNode, aActionNode, aTriggerNode, *eventNode ); |
|
2349 |
CleanupStack::PopAndDestroy( eventNode ); |
|
2350 |
return ETrue; |
|
2351 |
} |
|
2352 |
return EFalse; |
|
2353 |
} |
|
2354 |
||
2355 |
// ----------------------------------------------------------------------------- |
|
2356 |
// MatchActivateTriggerPropertiesL |
|
2357 |
// Checks if triggered node properties match |
|
2358 |
// ones defined in theme |
|
2359 |
// ----------------------------------------------------------------------------- |
|
2360 |
// |
|
2361 |
static TBool MatchActivateTriggerPropertiesL( |
|
2362 |
CXnNode& aEventData, |
|
2363 |
CXnDomNode& aTriggerNode ) |
|
2364 |
{ |
|
2365 |
RPointerArray< CXnNode >& eventChildren = aEventData.Children(); |
|
2366 |
TInt eventCount = eventChildren.Count(); |
|
2367 |
||
2368 |
if ( eventCount ) |
|
2369 |
{ |
|
2370 |
CXnNode* node = eventChildren[0]; |
|
2371 |
CXnProperty* nameProperty = node->NameL(); |
|
2372 |
CXnProperty* valueProperty = node->ValueL(); |
|
2373 |
||
2374 |
if ( !nameProperty || !valueProperty ) |
|
2375 |
{ |
|
2376 |
return EFalse; |
|
2377 |
} |
|
2378 |
||
2379 |
const TDesC8& name = nameProperty->StringValue(); |
|
2380 |
||
2381 |
if ( name == XnPropertyNames::action::trigger::name::keyevent::KEventType ) |
|
2382 |
{ |
|
2383 |
const TDesC8& valueName = valueProperty->StringValue(); |
|
2384 |
||
2385 |
CXnDomList& children = aTriggerNode.ChildNodes(); |
|
2386 |
TInt count = children.Length(); |
|
2387 |
||
2388 |
if ( ( valueName == _L8( "3" ) ) ) //keydown |
|
2389 |
{ |
|
2390 |
// check that no eventype has been defined |
|
2391 |
if ( !count ) |
|
2392 |
{ |
|
2393 |
return EFalse; |
|
2394 |
} |
|
2395 |
} |
|
2396 |
else if ( ( valueName == _L8( "2" ) ) ) //keyup |
|
2397 |
{ |
|
2398 |
///check that some eventtype has been defined |
|
2399 |
if ( !count ) |
|
2400 |
{ |
|
2401 |
return EFalse; |
|
2402 |
} |
|
2403 |
||
2404 |
CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( 0 ) ); |
|
2405 |
CXnDomList& attrs = node->AttributeList(); |
|
2406 |
CXnDomAttribute* nameAttribute = static_cast< CXnDomAttribute* >( |
|
2407 |
attrs.FindByName( XnPropertyNames::action::KName ) ); |
|
2408 |
CXnDomAttribute* valueAttribute = static_cast< CXnDomAttribute* >( |
|
2409 |
attrs.FindByName( XnPropertyNames::action::KValue ) ); |
|
2410 |
||
2411 |
if ( !nameAttribute || !valueAttribute ) |
|
2412 |
{ |
|
2413 |
return EFalse; |
|
2414 |
} |
|
2415 |
||
2416 |
const TDesC8& name = nameAttribute->Value(); |
|
2417 |
||
2418 |
// check that eventype name matches |
|
2419 |
if ( name != |
|
2420 |
XnPropertyNames::action::trigger::name::keyevent::KEventType ) |
|
2421 |
{ |
|
2422 |
return EFalse; |
|
2423 |
} |
|
2424 |
else |
|
2425 |
{ |
|
2426 |
//check that eventype value matches |
|
2427 |
const TDesC8& valueName = valueAttribute->Value(); |
|
2428 |
if ( valueName != _L8( "2" ) ) |
|
2429 |
{ |
|
2430 |
return EFalse; |
|
2431 |
} |
|
2432 |
} |
|
2433 |
} |
|
2434 |
} |
|
2435 |
} |
|
2436 |
||
2437 |
return ETrue; |
|
2438 |
} |
|
2439 |
||
2440 |
// ----------------------------------------------------------------------------- |
|
2441 |
// MatchScreenDeviceChangePropertiesL |
|
2442 |
// Checks if triggered node properties match |
|
2443 |
// ones defined in theme |
|
2444 |
// ----------------------------------------------------------------------------- |
|
2445 |
// |
|
2446 |
static TBool MatchScreenDeviceChangePropertiesL( |
|
2447 |
CXnNode& aEventData, |
|
2448 |
CXnDomNode& aTriggerNode ) |
|
2449 |
{ |
|
2450 |
CXnDomList& attributeList( aTriggerNode.AttributeList() ); |
|
2451 |
||
2452 |
const TDesC8& reason( |
|
2453 |
XnPropertyNames::action::trigger::name::orientation::KReason ); |
|
2454 |
||
2455 |
CXnDomAttribute* attribute( static_cast< CXnDomAttribute* > |
|
2456 |
( attributeList.FindByName( reason ) ) ); |
|
2457 |
||
2458 |
if ( !attribute ) |
|
2459 |
{ |
|
2460 |
// Reason not defined, run events for plain screendevicechange trigger |
|
2461 |
return ETrue; |
|
2462 |
} |
|
2463 |
||
2464 |
const TDesC8& value( attribute->Value() ); |
|
2465 |
||
2466 |
if ( value == |
|
2467 |
XnPropertyNames::action::trigger::name::orientation::reason::KLandscape || |
|
2468 |
value == |
|
2469 |
XnPropertyNames::action::trigger::name::orientation::reason::KPortrait ) |
|
2470 |
{ |
|
2471 |
CXnProperty* reasonProp( aEventData.GetPropertyL( reason ) ); |
|
2472 |
||
2473 |
if ( reasonProp ) |
|
2474 |
{ |
|
2475 |
const TDesC8& reasonValue( reasonProp->StringValue() ); |
|
2476 |
||
2477 |
if ( reasonValue == value ) |
|
2478 |
{ |
|
2479 |
return ETrue; |
|
2480 |
} |
|
2481 |
} |
|
2482 |
} |
|
2483 |
||
2484 |
return EFalse; |
|
2485 |
} |
|
2486 |
||
2487 |
// ----------------------------------------------------------------------------- |
|
2488 |
// MatchSwipeTriggerL |
|
2489 |
// Check if trigger matches the one defined in theme |
|
2490 |
// ----------------------------------------------------------------------------- |
|
2491 |
// |
|
2492 |
static TBool MatchSwipeTriggerL( |
|
2493 |
CXnNode& aEventData, |
|
2494 |
CXnDomNode& aTriggerNode ) |
|
2495 |
{ |
|
2496 |
CXnDomList& attributeList( aTriggerNode.AttributeList() ); |
|
2497 |
||
2498 |
const TDesC8& reason( XnPropertyNames::action::trigger::name::swipe::KDirection); |
|
2499 |
||
2500 |
CXnDomAttribute* attribute( static_cast< CXnDomAttribute* > |
|
2501 |
( attributeList.FindByName( reason ) ) ); |
|
2502 |
||
2503 |
if ( !attribute ) |
|
2504 |
{ |
|
2505 |
// Reason not defined |
|
2506 |
return EFalse; |
|
2507 |
} |
|
2508 |
||
2509 |
const TDesC8& value( attribute->Value() ); |
|
2510 |
||
2511 |
if ( value == XnPropertyNames::action::trigger::name::swipe::direction::KLeft || |
|
2512 |
value == XnPropertyNames::action::trigger::name::swipe::direction::KRight ) |
|
2513 |
{ |
|
2514 |
CXnProperty* reasonProp( aEventData.GetPropertyL( reason ) ); |
|
2515 |
||
2516 |
if ( reasonProp ) |
|
2517 |
{ |
|
2518 |
const TDesC8& reasonValue( reasonProp->StringValue() ); |
|
2519 |
||
2520 |
if ( reasonValue == value ) |
|
2521 |
{ |
|
2522 |
return ETrue; |
|
2523 |
} |
|
2524 |
} |
|
2525 |
} |
|
2526 |
||
2527 |
return EFalse; |
|
2528 |
} |
|
2529 |
||
2530 |
// ----------------------------------------------------------------------------- |
|
2531 |
// MatchValueAttributeTriggerL |
|
2532 |
// Check if trigger matches the one defined in theme |
|
2533 |
// ----------------------------------------------------------------------------- |
|
2534 |
// |
|
2535 |
static TBool MatchValueAttributeTriggerL( CXnNode& aEventData, |
|
2536 |
CXnDomNode& aTriggerNode ) |
|
2537 |
{ |
|
2538 |
CXnDomList& attributeList( aTriggerNode.AttributeList() ); |
|
2539 |
||
2540 |
const TDesC8& reason( XnPropertyNames::action::KValue ); |
|
2541 |
||
2542 |
CXnDomAttribute* attribute( static_cast< CXnDomAttribute* > |
|
2543 |
( attributeList.FindByName( reason ) ) ); |
|
2544 |
||
2545 |
if ( !attribute ) |
|
2546 |
{ |
|
2547 |
// Reason not defined |
|
2548 |
return EFalse; |
|
2549 |
} |
|
2550 |
||
2551 |
const TDesC8& value( attribute->Value() ); |
|
2552 |
||
2553 |
CXnProperty* reasonProp( aEventData.GetPropertyL( reason ) ); |
|
2554 |
||
2555 |
if ( reasonProp ) |
|
2556 |
{ |
|
2557 |
const TDesC8& reasonValue( reasonProp->StringValue() ); |
|
2558 |
||
2559 |
if ( reasonValue == value ) |
|
2560 |
{ |
|
2561 |
return ETrue; |
|
2562 |
} |
|
2563 |
} |
|
2564 |
||
2565 |
return EFalse; |
|
2566 |
} |
|
2567 |
||
2568 |
// ----------------------------------------------------------------------------- |
|
2569 |
// MatchTitleScrollTriggerL |
|
2570 |
// ----------------------------------------------------------------------------- |
|
2571 |
// |
|
2572 |
static TBool MatchTitleScrollTriggerL(CXnNode& aEventData, |
|
2573 |
CXnDomNode& aTriggerNode ) |
|
2574 |
{ |
|
2575 |
CXnDomList& attributeList( aTriggerNode.AttributeList() ); |
|
2576 |
||
2577 |
const TDesC8& reason( XnPropertyNames::action::trigger::name::KTitleIndex ); |
|
2578 |
||
2579 |
CXnDomAttribute* attribute( static_cast< CXnDomAttribute* > |
|
2580 |
( attributeList.FindByName( reason ) ) ); |
|
2581 |
||
2582 |
if ( !attribute ) |
|
2583 |
{ |
|
2584 |
// Reason not defined |
|
2585 |
return ETrue; |
|
2586 |
} |
|
2587 |
else |
|
2588 |
{ |
|
2589 |
const TDesC8& value( attribute->Value() ); |
|
2590 |
||
2591 |
CXnProperty* reasonProp( aEventData.GetPropertyL( reason ) ); |
|
2592 |
||
2593 |
if ( reasonProp ) |
|
2594 |
{ |
|
2595 |
const TDesC8& reasonValue( reasonProp->StringValue() ); |
|
2596 |
||
2597 |
if ( reasonValue == value ) |
|
2598 |
{ |
|
2599 |
return ETrue; |
|
2600 |
} |
|
2601 |
} |
|
2602 |
} |
|
2603 |
||
2604 |
return EFalse; |
|
2605 |
} |
|
2606 |
||
2607 |
// ----------------------------------------------------------------------------- |
|
2608 |
// MatchTriggerForEventL |
|
2609 |
// ----------------------------------------------------------------------------- |
|
2610 |
// |
|
2611 |
static TBool MatchTriggerForEventL( |
|
2612 |
CXnNodeImpl* aThis, |
|
2613 |
CXnUiEngine& aEngine, |
|
2614 |
CXnNode& aNode, |
|
2615 |
CXnNode& aEventData, |
|
2616 |
CXnDomNode& aActionNode, |
|
2617 |
CXnDomNode& aTriggerNode, |
|
2618 |
TInt /*aSource*/ ) |
|
2619 |
{ |
|
2620 |
const TDesC8& nameString( aTriggerNode.AttributeValue( KName ) ); |
|
2621 |
||
2622 |
if ( nameString == KNullDesC8 ) |
|
2623 |
{ |
|
2624 |
return EFalse; |
|
2625 |
} |
|
2626 |
||
2627 |
CXnProperty* eventName( aEventData.NameL() ); |
|
2628 |
const TDesC8& eventNameString( eventName->StringValue() ); |
|
2629 |
||
2630 |
if ( nameString == eventNameString ) |
|
2631 |
{ |
|
2632 |
// Check if triggernode properties match the ones defined in theme |
|
2633 |
// This is for identifying keyup in activate-trigger |
|
2634 |
if ( nameString == XnPropertyNames::action::trigger::name::KActivate ) |
|
2635 |
{ |
|
2636 |
if ( !MatchActivateTriggerPropertiesL( aEventData, aTriggerNode ) ) |
|
2637 |
{ |
|
2638 |
return EFalse; |
|
2639 |
} |
|
2640 |
} |
|
2641 |
else if ( nameString == XnPropertyNames::action::trigger::name::KTitleToScroll || |
|
2642 |
nameString == XnPropertyNames::action::trigger::name::KTitleScrolled ) |
|
2643 |
{ |
|
2644 |
if ( !MatchTitleScrollTriggerL( aEventData, aTriggerNode ) ) |
|
2645 |
{ |
|
2646 |
return EFalse; |
|
2647 |
} |
|
2648 |
} |
|
2649 |
else if ( nameString == |
|
2650 |
XnPropertyNames::action::trigger::name::KScreenDeviceChange ) |
|
2651 |
{ |
|
2652 |
if ( !MatchScreenDeviceChangePropertiesL( aEventData, aTriggerNode ) ) |
|
2653 |
{ |
|
2654 |
return EFalse; |
|
2655 |
} |
|
2656 |
} |
|
2657 |
else if ( nameString == XnPropertyNames::action::trigger::name::KSwipe ) |
|
2658 |
{ |
|
2659 |
if ( !MatchSwipeTriggerL( aEventData, aTriggerNode ) ) |
|
2660 |
{ |
|
2661 |
return EFalse; |
|
2662 |
} |
|
2663 |
} |
|
2664 |
else if ( nameString == XnPropertyNames::action::trigger::name::KWidgetAmount || |
|
2665 |
nameString == XnPropertyNames::action::trigger::name::KCallState || |
|
2666 |
nameString == XnPropertyNames::action::trigger::name::KEditMode ) |
|
2667 |
{ |
|
2668 |
if ( !MatchValueAttributeTriggerL( aEventData, aTriggerNode ) ) |
|
2669 |
{ |
|
2670 |
return EFalse; |
|
2671 |
} |
|
2672 |
} |
|
2673 |
||
2674 |
RunEventsL( aThis, aEngine, aNode, aActionNode, aTriggerNode, aEventData ); |
|
2675 |
||
2676 |
return ETrue; |
|
2677 |
} |
|
2678 |
||
2679 |
return EFalse; |
|
2680 |
} |
|
2681 |
||
2682 |
// ----------------------------------------------------------------------------- |
|
2683 |
// GetFocusCandidatesL |
|
2684 |
// ----------------------------------------------------------------------------- |
|
2685 |
// |
|
2686 |
static void GetFocusCandidatesL( |
|
2687 |
CXnNodeImpl* aThis, |
|
2688 |
CXnUiEngine& aEngine, |
|
2689 |
CXnDomNode& aEventNode, |
|
2690 |
RPointerArray< CXnNode >& aFocusCandidates ) |
|
2691 |
{ |
|
2692 |
CXnDomList& children( aEventNode.ChildNodes() ); |
|
2693 |
||
2694 |
TInt count( children.Length() ); |
|
2695 |
||
2696 |
for ( TInt i = 0; i < count; ++i ) |
|
2697 |
{ |
|
2698 |
CXnDomNode* dnode( static_cast< CXnDomNode* >( children.Item( i ) ) ); |
|
2699 |
||
2700 |
const TDesC8& type( dnode->Name() ); |
|
2701 |
||
2702 |
// Is the event's node child a property? |
|
2703 |
if ( type == XnPropertyNames::action::KProperty ) |
|
2704 |
{ |
|
2705 |
CXnDomList& attributeList( dnode->AttributeList() ); |
|
2706 |
||
2707 |
CXnDomAttribute* attribute( static_cast< CXnDomAttribute* > |
|
2708 |
( attributeList.FindByName( XnPropertyNames::action::KValue ) ) ); |
|
2709 |
||
2710 |
if ( attribute ) |
|
2711 |
{ |
|
2712 |
CXnNode* node( aEngine.FindNodeByIdL( |
|
2713 |
attribute->Value(), aThis->Namespace() ) ); |
|
2714 |
||
2715 |
if ( node ) |
|
2716 |
{ |
|
2717 |
aFocusCandidates.AppendL( node ); |
|
2718 |
} |
|
2719 |
} |
|
2720 |
} |
|
2721 |
} |
|
2722 |
} |
|
2723 |
||
2724 |
// ----------------------------------------------------------------------------- |
|
2725 |
// RunPassiveFocusChangeL |
|
2726 |
// ----------------------------------------------------------------------------- |
|
2727 |
// |
|
2728 |
static void RunPassiveFocusChangeL( |
|
2729 |
CXnNodeImpl* aThis, |
|
2730 |
CXnUiEngine& aEngine, |
|
2731 |
CXnDomNode& aEventNode, |
|
2732 |
const TDesC8& aString ) |
|
2733 |
{ |
|
2734 |
CXnDomList& children = aEventNode.ChildNodes(); |
|
2735 |
TInt count = children.Length(); |
|
2736 |
for ( TInt i = 0; i < count; ++i ) |
|
2737 |
{ |
|
2738 |
CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
2739 |
const TDesC8& type = dnode->Name(); |
|
2740 |
if ( type == XnPropertyNames::action::KProperty ) |
|
2741 |
{ |
|
2742 |
CXnDomList& attrs = dnode->AttributeList(); |
|
2743 |
CXnDomAttribute* attribute = static_cast< CXnDomAttribute* >( |
|
2744 |
attrs.FindByName(XnPropertyNames::action::KValue ) ); |
|
2745 |
if ( attribute ) |
|
2746 |
{ |
|
2747 |
CXnNode* node = aEngine.FindNodeByIdL( |
|
2748 |
attribute->Value(), aThis->Namespace() ); |
|
2749 |
if ( node ) |
|
2750 |
{ |
|
2751 |
if ( aString == XnPropertyNames::action::event::KSetPassiveFocus ) |
|
2752 |
{ |
|
2753 |
aEngine.AddPassiveFocusedNodeL( node ); |
|
2754 |
} |
|
2755 |
else if ( aString == XnPropertyNames::action::event::KResetPassiveFocus ) |
|
2756 |
{ |
|
2757 |
aEngine.RemovePassiveFocusedNodeL( node ); |
|
2758 |
} |
|
2759 |
else if ( aString == XnPropertyNames::action::event::KSetActiveFocus ) |
|
2760 |
{ |
|
2761 |
CXnNode* previousNode = aEngine.FocusedNode(); |
|
2762 |
if ( previousNode && previousNode != node ) |
|
2763 |
{ |
|
2764 |
if ( IsNodeNavigableL( *node ) ) |
|
2765 |
{ |
|
2766 |
node->SetStateL( XnPropertyNames::style::common::KFocus ); |
|
2767 |
aEngine.AddPassiveFocusedNodeL( previousNode ); |
|
2768 |
break; |
|
2769 |
} |
|
2770 |
} |
|
2771 |
} |
|
2772 |
} |
|
2773 |
} |
|
2774 |
} |
|
2775 |
} |
|
2776 |
} |
|
2777 |
||
2778 |
// ----------------------------------------------------------------------------- |
|
2779 |
// RunAppUiNotificationL |
|
2780 |
// ----------------------------------------------------------------------------- |
|
2781 |
// |
|
2782 |
static void RunAppUiNotificationL( |
|
2783 |
CXnUiEngine& aEngine, |
|
2784 |
CXnNode& aNode, |
|
2785 |
CXnDomNode& aEventNode, |
|
2786 |
CXnDomNode& aTriggerNode, |
|
2787 |
CXnNode& aEventData ) |
|
2788 |
{ |
|
2789 |
CXnAppUiAdapter& adapter( aEngine.AppUiAdapter() ); |
|
2790 |
||
2791 |
// Check if event is template |
|
2792 |
const TDesC8& templateEvent( aEventNode.AttributeValue( KTemplate ) ); |
|
2793 |
||
2794 |
if ( templateEvent != KNullDesC8() ) |
|
2795 |
{ |
|
2796 |
CXnDomNode* event( |
|
2797 |
GetTemplateEventL( templateEvent, aNode, aEventNode ) ); |
|
2798 |
CleanupStack::PushL( event ); |
|
2799 |
||
2800 |
if ( event ) |
|
2801 |
{ |
|
2802 |
adapter.HandleXuikonEventL( |
|
2803 |
aNode.AppIfL(), aEventData.AppIfL(), aTriggerNode, *event ); |
|
2804 |
} |
|
2805 |
||
2806 |
CleanupStack::PopAndDestroy( event ); |
|
2807 |
} |
|
2808 |
else |
|
2809 |
{ |
|
2810 |
adapter.HandleXuikonEventL( |
|
2811 |
aNode.AppIfL(), aEventData.AppIfL(), aTriggerNode, aEventNode ); |
|
2812 |
} |
|
2813 |
} |
|
2814 |
||
2815 |
// ----------------------------------------------------------------------------- |
|
2816 |
// RunFullScreenEffectL |
|
2817 |
// ----------------------------------------------------------------------------- |
|
2818 |
// |
|
2819 |
static void RunFullScreenEffectL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
2820 |
{ |
|
2821 |
TInt effectId = ResolveEffectId( aEventNode ); |
|
2822 |
if( effectId ) |
|
2823 |
{ |
|
2824 |
aEngine.AppUiAdapter().EffectManager()->BeginFullscreenEffectL( |
|
2825 |
effectId, aEngine.ViewManager()->ActiveViewData() ); |
|
2826 |
} |
|
2827 |
} |
|
2828 |
||
2829 |
// ----------------------------------------------------------------------------- |
|
2830 |
// RunActivateNextViewL |
|
2831 |
// ----------------------------------------------------------------------------- |
|
2832 |
// |
|
2833 |
static void RunActivateNextViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
2834 |
{ |
|
2835 |
TInt effectid = ResolveEffectId( aEventNode ); |
|
2836 |
aEngine.ViewManager()->ActivateNextViewL( /*effectid*/ ); |
|
2837 |
} |
|
2838 |
||
2839 |
// ----------------------------------------------------------------------------- |
|
2840 |
// RunActivatePreviousViewL |
|
2841 |
// ----------------------------------------------------------------------------- |
|
2842 |
// |
|
2843 |
static void RunActivatePreviousViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
2844 |
{ |
|
2845 |
TInt effectid = ResolveEffectId( aEventNode ); |
|
2846 |
aEngine.ViewManager()->ActivatePreviousViewL( /*effectid*/ ); |
|
2847 |
} |
|
2848 |
||
2849 |
// ----------------------------------------------------------------------------- |
|
2850 |
// RunAddViewL |
|
2851 |
// ----------------------------------------------------------------------------- |
|
2852 |
// |
|
2853 |
static void RunAddViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
2854 |
{ |
|
2855 |
TInt effectid = ResolveEffectId( aEventNode ); |
|
2856 |
aEngine.ViewManager()->AddViewL( effectid ); |
|
2857 |
} |
|
2858 |
||
2859 |
// ----------------------------------------------------------------------------- |
|
2860 |
// RunRemoveViewL |
|
2861 |
// ----------------------------------------------------------------------------- |
|
2862 |
// |
|
2863 |
static void RunRemoveViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
2864 |
{ |
|
2865 |
TInt effectid = ResolveEffectId( aEventNode ); |
|
2866 |
aEngine.ViewManager()->RemoveViewL( effectid ); |
|
2867 |
} |
|
2868 |
||
2869 |
// ----------------------------------------------------------------------------- |
|
2870 |
// RunActivateL |
|
2871 |
// ----------------------------------------------------------------------------- |
|
2872 |
// |
|
2873 |
static void RunActivateL( |
|
2874 |
CXnNodeImpl* aThis, |
|
2875 |
CXnUiEngine& aEngine, |
|
2876 |
CXnDomNode& aEventNode ) |
|
2877 |
{ |
|
2878 |
CXnDomList& children = aEventNode.ChildNodes(); |
|
2879 |
TInt count = children.Length(); |
|
2880 |
for ( TInt i = 0; i < count; ++i ) |
|
2881 |
{ |
|
2882 |
CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
2883 |
const TDesC8& type = dnode->Name(); |
|
2884 |
if ( type == XnPropertyNames::action::KProperty ) |
|
2885 |
{ |
|
2886 |
const TDesC8& id = dnode->AttributeValue( KId ); |
|
2887 |
CXnNode* node = aEngine.FindNodeByIdL( id, aThis->Namespace() ); |
|
2888 |
if ( node ) |
|
2889 |
{ |
|
2890 |
node->SetStateL( XnPropertyNames::style::common::KActive ); |
|
2891 |
return; |
|
2892 |
} |
|
2893 |
} |
|
2894 |
} |
|
2895 |
||
2896 |
CXnNode* focused( aEngine.FocusedNode() ); |
|
2897 |
||
2898 |
if ( focused ) |
|
2899 |
{ |
|
2900 |
focused->SetStateL( XnPropertyNames::style::common::KActive ); |
|
2901 |
} |
|
2902 |
} |
|
2903 |
||
2904 |
// ----------------------------------------------------------------------------- |
|
2905 |
// RunActivateEditorL |
|
2906 |
// ----------------------------------------------------------------------------- |
|
2907 |
// |
|
2908 |
static void RunActivateEditorL( |
|
2909 |
CXnNodeImpl* aThis, |
|
2910 |
CXnNode& aLayoutNode, |
|
2911 |
CXnUiEngine& aEngine, |
|
2912 |
CXnDomNode& aEventNode, |
|
2913 |
TBool aActivate ) |
|
2914 |
{ |
|
2915 |
CXnNode* editorNode( NULL ); |
|
2916 |
CXnDomList& children = aEventNode.ChildNodes(); |
|
2917 |
TInt count = children.Length(); |
|
2918 |
for ( TInt i = 0; i < count; ++i ) |
|
2919 |
{ |
|
2920 |
CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
2921 |
const TDesC8& type = dnode->Name(); |
|
2922 |
if ( type == XnPropertyNames::action::KProperty ) |
|
2923 |
{ |
|
2924 |
const TDesC8& id = dnode->AttributeValue( KId ); |
|
2925 |
CXnNode* node = aEngine.FindNodeByIdL( id, aThis->Namespace() ); |
|
2926 |
if( node && node->Type()->Type() == KTextEditor ) |
|
2927 |
{ |
|
2928 |
editorNode = node; |
|
2929 |
break; |
|
2930 |
} |
|
2931 |
} |
|
2932 |
} |
|
2933 |
||
2934 |
if( !editorNode && aLayoutNode.Type()->Type() == KTextEditor ) |
|
2935 |
{ |
|
2936 |
editorNode = &aLayoutNode; |
|
2937 |
} |
|
2938 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2939 |
if ( editorNode ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2940 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2941 |
CXnKeyEventDispatcher* eventDispatcher( |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2942 |
aEngine.AppUiAdapter().ViewAdapter().EventDispatcher() ); |
34 | 2943 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2944 |
if ( eventDispatcher ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2945 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2946 |
if ( aActivate ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2947 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2948 |
eventDispatcher->SetTextEditorActive( editorNode, ETrue ); |
34 | 2949 |
} |
2950 |
else |
|
2951 |
{ |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2952 |
eventDispatcher->SetTextEditorActive( NULL, EFalse ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2953 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
2954 |
} |
34 | 2955 |
} |
2956 |
} |
|
2957 |
||
2958 |
// ----------------------------------------------------------------------------- |
|
2959 |
// RunEditL |
|
2960 |
// ----------------------------------------------------------------------------- |
|
2961 |
// |
|
2962 |
static void RunEditL( |
|
2963 |
CXnNodeImpl* aThis, |
|
2964 |
CXnUiEngine& aEngine, |
|
2965 |
CXnDomNode& aEventNode ) |
|
2966 |
{ |
|
2967 |
aEngine.DisableRenderUiLC(); |
|
2968 |
||
2969 |
// Set plugins to edit state |
|
2970 |
RPointerArray< CXnPluginData >& views( |
|
2971 |
aEngine.ViewManager()->ActiveAppData().PluginData() ); |
|
2972 |
||
2973 |
CXnViewData* view( NULL ); |
|
2974 |
||
2975 |
for ( TInt i = 0; i < views.Count(); i++ ) |
|
2976 |
{ |
|
2977 |
view = static_cast< CXnViewData* >( views[i] ); |
|
2978 |
||
2979 |
CXnPluginData* plugin( view->Plugin( aThis->Node() ) ); |
|
2980 |
||
2981 |
if ( plugin && plugin == view ) |
|
2982 |
{ |
|
2983 |
break; |
|
2984 |
} |
|
2985 |
} |
|
2986 |
||
2987 |
if ( !view ) |
|
2988 |
{ |
|
2989 |
return; |
|
2990 |
} |
|
2991 |
||
2992 |
RPointerArray< CXnPluginData >& plugins( view->PluginData() ); |
|
2993 |
||
2994 |
CXnDomStringPool* sp( aEventNode.StringPool() ); |
|
2995 |
||
2996 |
CXnDomList& children( aEventNode.ChildNodes() ); |
|
2997 |
||
2998 |
TInt count( children.Length() ); |
|
2999 |
||
3000 |
for ( TInt i = 0; i < count; ++i ) |
|
3001 |
{ |
|
3002 |
CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
3003 |
const TDesC8& type = dnode->Name(); |
|
3004 |
||
3005 |
if ( type == XnPropertyNames::action::KProperty ) |
|
3006 |
{ |
|
3007 |
const TDesC8& name = dnode->AttributeValue( |
|
3008 |
XnPropertyNames::action::event::systemset::KName ); |
|
3009 |
const TDesC8& value = dnode->AttributeValue( |
|
3010 |
XnPropertyNames::action::event::systemset::KValue ); |
|
3011 |
||
3012 |
if ( name != KNullDesC8 && value != KNullDesC8 ) |
|
3013 |
{ |
|
3014 |
// Find node by id |
|
3015 |
if ( name == XnPropertyNames::common::KId ) |
|
3016 |
{ |
|
3017 |
CXnNode* node( aEngine.FindNodeByIdL( value, aThis->Namespace() ) ); |
|
3018 |
||
3019 |
if ( node ) |
|
3020 |
{ |
|
3021 |
node->SetStateL( XnPropertyNames::style::common::KEdit ); |
|
3022 |
} |
|
3023 |
} |
|
3024 |
// Find nodes by class |
|
3025 |
else if ( name == XnPropertyNames::common::KClass ) |
|
3026 |
{ |
|
3027 |
CXnPointerArray* array = aEngine.FindNodeByClassL( value, aThis->Namespace() ); |
|
3028 |
CleanupStack::PushL( array ); |
|
3029 |
||
3030 |
if ( array ) |
|
3031 |
{ |
|
3032 |
const TInt count( array->Container().Count() ); |
|
3033 |
||
3034 |
for ( TInt i = 0; i < count; ++i ) |
|
3035 |
{ |
|
3036 |
CXnNode* node( static_cast< CXnNode* >( |
|
3037 |
array->Container()[i] ) ); |
|
3038 |
||
3039 |
CXnProperty* editable( node->GetPropertyL( |
|
3040 |
XnPropertyNames::style::common::edit::KEditable ) ); |
|
3041 |
||
3042 |
if ( !editable || |
|
3043 |
editable->StringValue() != XnPropertyNames::KFalse ) |
|
3044 |
{ |
|
3045 |
node->SetStateL( XnPropertyNames::style::common::KEdit ); |
|
3046 |
} |
|
3047 |
} |
|
3048 |
} |
|
3049 |
||
3050 |
CleanupStack::PopAndDestroy( array ); |
|
3051 |
} |
|
3052 |
} |
|
3053 |
} |
|
3054 |
} |
|
3055 |
||
3056 |
TBool useEmpty( view->UseEmptyWidget() ); |
|
3057 |
||
3058 |
for ( TInt i = 0; i < plugins.Count(); i++ ) |
|
3059 |
{ |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
3060 |
CXnNode* node( plugins[i]->Owner()->LayoutNode() ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
3061 |
TBool editable = plugins[i]->Editable(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
3062 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
3063 |
if( editable ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
3064 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
3065 |
node->SetStateL( XnPropertyNames::style::common::KEdit ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
3066 |
} |
34 | 3067 |
|
3068 |
if ( !plugins[i]->Occupied() && useEmpty ) |
|
3069 |
{ |
|
3070 |
// Make empty space visible |
|
3071 |
SetStringPropertyToNodeL( *sp, *node, |
|
3072 |
XnPropertyNames::style::common::KVisibility, |
|
3073 |
XnPropertyNames::style::common::visibility::KVisible ); |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
3074 |
} |
34 | 3075 |
} |
3076 |
||
3077 |
aEngine.EditMode()->SetEditModeL( CXnEditMode::EDragAndDrop ); |
|
3078 |
aEngine.AppUiAdapter().ViewAdapter().CloseAllPopupsL(); |
|
3079 |
||
3080 |
CleanupStack::PopAndDestroy(); |
|
3081 |
||
3082 |
aEngine.AppUiAdapter().ViewAdapter().UpdateRskByUiStateL( *view ); |
|
3083 |
} |
|
3084 |
||
3085 |
// ----------------------------------------------------------------------------- |
|
3086 |
// RunResetEditL |
|
3087 |
// ----------------------------------------------------------------------------- |
|
3088 |
// |
|
3089 |
static void RunResetEditL( |
|
3090 |
CXnNodeImpl* aThis, |
|
3091 |
CXnUiEngine& aEngine, |
|
3092 |
CXnDomNode& aEventNode ) |
|
3093 |
{ |
|
3094 |
// Set plugins to edit state |
|
3095 |
RPointerArray< CXnPluginData >& views( |
|
3096 |
aEngine.ViewManager()->ActiveAppData().PluginData() ); |
|
3097 |
||
3098 |
CXnViewData* view( NULL ); |
|
3099 |
||
3100 |
for ( TInt i = 0; i < views.Count(); i++ ) |
|
3101 |
{ |
|
3102 |
view = static_cast< CXnViewData* >( views[i] ); |
|
3103 |
||
3104 |
CXnPluginData* plugin( view->Plugin( aThis->Node() ) ); |
|
3105 |
||
3106 |
if ( plugin && plugin == view ) |
|
3107 |
{ |
|
3108 |
break; |
|
3109 |
} |
|
3110 |
} |
|
3111 |
||
3112 |
if ( !view ) |
|
3113 |
{ |
|
3114 |
return; |
|
3115 |
} |
|
3116 |
||
3117 |
CXnDomList& children( aEventNode.ChildNodes() ); |
|
3118 |
||
3119 |
TInt count( children.Length() ); |
|
3120 |
||
3121 |
for ( TInt i = 0; i < count; ++i ) |
|
3122 |
{ |
|
3123 |
CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
3124 |
const TDesC8& type = dnode->Name(); |
|
3125 |
||
3126 |
if ( type == XnPropertyNames::action::KProperty ) |
|
3127 |
{ |
|
3128 |
const TDesC8& name = dnode->AttributeValue( |
|
3129 |
XnPropertyNames::action::event::systemset::KName ); |
|
3130 |
const TDesC8& value = dnode->AttributeValue( |
|
3131 |
XnPropertyNames::action::event::systemset::KValue ); |
|
3132 |
||
3133 |
if ( name != KNullDesC8 && value != KNullDesC8 ) |
|
3134 |
{ |
|
3135 |
if ( name == XnPropertyNames::common::KId ) |
|
3136 |
{ |
|
3137 |
CXnNode* node( aEngine.FindNodeByIdL( value, aThis->Namespace() ) ); |
|
3138 |
||
3139 |
if ( node ) |
|
3140 |
{ |
|
3141 |
node->UnsetStateL( |
|
3142 |
XnPropertyNames::style::common::KEdit ); |
|
3143 |
} |
|
3144 |
} |
|
3145 |
else if ( name == XnPropertyNames::common::KClass ) |
|
3146 |
{ |
|
3147 |
CXnPointerArray* array( aEngine.FindNodeByClassL( value, aThis->Namespace() ) ); |
|
3148 |
CleanupStack::PushL( array ); |
|
3149 |
||
3150 |
const TInt count = array->Container().Count(); |
|
3151 |
||
3152 |
for ( TInt i = 0; i < count; ++i ) |
|
3153 |
{ |
|
3154 |
CXnNode* node = static_cast< CXnNode* >( |
|
3155 |
array->Container()[i] ); |
|
3156 |
||
3157 |
if ( node && |
|
3158 |
node->IsStateSet( XnPropertyNames::style::common::KEdit ) ) |
|
3159 |
{ |
|
3160 |
node->UnsetStateL( XnPropertyNames::style::common::KEdit ); |
|
3161 |
} |
|
3162 |
} |
|
3163 |
||
3164 |
CleanupStack::PopAndDestroy( array ); |
|
3165 |
} |
|
3166 |
} |
|
3167 |
} |
|
3168 |
} |
|
3169 |
||
3170 |
RPointerArray< CXnPluginData>& plugins( view->PluginData() ); |
|
3171 |
||
3172 |
CXnDomStringPool* sp( aEventNode.StringPool() ); |
|
3173 |
||
3174 |
TBool useEmpty( view->UseEmptyWidget() ); |
|
3175 |
||
3176 |
for ( TInt i = 0; i < plugins.Count(); i++ ) |
|
3177 |
{ |
|
3178 |
CXnNode* node( plugins[i]->Owner()->LayoutNode() ); |
|
3179 |
||
3180 |
node->UnsetStateL( XnPropertyNames::style::common::KEdit ); |
|
3181 |
||
3182 |
if ( !plugins[i]->Occupied() && useEmpty ) |
|
3183 |
{ |
|
3184 |
// Make empty space blank |
|
3185 |
SetStringPropertyToNodeL( *sp, *node, |
|
3186 |
XnPropertyNames::style::common::KVisibility, |
|
3187 |
XnPropertyNames::style::common::visibility::KBlank ); |
|
3188 |
} |
|
3189 |
} |
|
3190 |
||
3191 |
aEngine.EditMode()->SetEditModeL( CXnEditMode::ENone ); |
|
3192 |
||
3193 |
aEngine.AppUiAdapter().ViewAdapter().UpdateRskByUiStateL( *view ); |
|
3194 |
} |
|
3195 |
||
3196 |
// ----------------------------------------------------------------------------- |
|
3197 |
// RunDeactivateL |
|
3198 |
// ----------------------------------------------------------------------------- |
|
3199 |
// |
|
3200 |
static void RunDeactivateL( |
|
3201 |
CXnNodeImpl* aThis, |
|
3202 |
CXnUiEngine& aEngine, |
|
3203 |
CXnDomNode& aEventNode ) |
|
3204 |
{ |
|
3205 |
CXnDomList& children = aEventNode.ChildNodes(); |
|
3206 |
TInt count = children.Length(); |
|
3207 |
for ( TInt i = 0; i < count; ++i ) |
|
3208 |
{ |
|
3209 |
CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
3210 |
const TDesC8& type = dnode->Name(); |
|
3211 |
if ( type == XnPropertyNames::action::KProperty ) |
|
3212 |
{ |
|
3213 |
const TDesC8& id = dnode->AttributeValue( KId ); |
|
3214 |
CXnNode* node = aEngine.FindNodeByIdL( id, aThis->Namespace() ); |
|
3215 |
if ( node ) |
|
3216 |
{ |
|
3217 |
node->UnsetStateL( XnPropertyNames::style::common::KActive ); |
|
3218 |
} |
|
3219 |
} |
|
3220 |
} |
|
3221 |
} |
|
3222 |
||
3223 |
// ----------------------------------------------------------------------------- |
|
3224 |
// RunSystemSetPCDataL |
|
3225 |
// ----------------------------------------------------------------------------- |
|
3226 |
// |
|
3227 |
static void RunSystemSetPCDataL( |
|
3228 |
CXnNodeImpl* aThis, |
|
3229 |
CXnUiEngine& aEngine, |
|
3230 |
const TDesC8& aId, |
|
3231 |
const TDesC8& aData ) |
|
3232 |
{ |
|
3233 |
CXnNode* node = aEngine.FindNodeByIdL( aId, aThis->Namespace() ); |
|
3234 |
||
3235 |
if ( node ) |
|
3236 |
{ |
|
3237 |
node->SetPCDataL( aData ); |
|
3238 |
} |
|
3239 |
} |
|
3240 |
||
3241 |
// ----------------------------------------------------------------------------- |
|
3242 |
// GetNumberValues |
|
3243 |
// ----------------------------------------------------------------------------- |
|
3244 |
// |
|
3245 |
static void GetNumberValues( |
|
3246 |
const TDesC8& aData, |
|
3247 |
TReal& aNumber, |
|
3248 |
CXnDomPropertyValue::TPrimitiveValueType& aValueType ) |
|
3249 |
{ |
|
3250 |
TLex8 lex( aData ); |
|
3251 |
lex.Val( aNumber ); |
|
3252 |
TPtrC8 rest = lex.Remainder(); |
|
3253 |
if ( rest.FindF( _L8( "%" ) ) != KErrNotFound ) |
|
3254 |
{ |
|
3255 |
aValueType = CXnDomPropertyValue::EPercentage; |
|
3256 |
} |
|
3257 |
else if (rest.FindF( _L8( "em" ) ) != KErrNotFound ) |
|
3258 |
{ |
|
3259 |
aValueType = CXnDomPropertyValue::EEms; |
|
3260 |
} |
|
3261 |
else if ( rest.FindF( _L8( "ex" ) ) != KErrNotFound ) |
|
3262 |
{ |
|
3263 |
aValueType = CXnDomPropertyValue::EExs; |
|
3264 |
} |
|
3265 |
else if ( rest.FindF( _L8( "px" ) ) != KErrNotFound ) |
|
3266 |
{ |
|
3267 |
aValueType = CXnDomPropertyValue::EPx; |
|
3268 |
} |
|
3269 |
else if ( rest.FindF( _L8( "u" ) ) != KErrNotFound ) |
|
3270 |
{ |
|
3271 |
aValueType = CXnDomPropertyValue::EUnitValue; |
|
3272 |
} |
|
3273 |
else if ( rest.FindF( _L8( "cm" ) ) != KErrNotFound ) |
|
3274 |
{ |
|
3275 |
aValueType = CXnDomPropertyValue::ECm; |
|
3276 |
} |
|
3277 |
else if ( rest.FindF( _L8( "mm" ) ) != KErrNotFound ) |
|
3278 |
{ |
|
3279 |
aValueType = CXnDomPropertyValue::EMm; |
|
3280 |
} |
|
3281 |
else if ( rest.FindF( _L8( "in" ) ) != KErrNotFound ) |
|
3282 |
{ |
|
3283 |
aValueType = CXnDomPropertyValue::EIn; |
|
3284 |
} |
|
3285 |
else if ( rest.FindF( _L8( "pt" ) ) != KErrNotFound ) |
|
3286 |
{ |
|
3287 |
aValueType = CXnDomPropertyValue::EPt; |
|
3288 |
} |
|
3289 |
else if ( rest.FindF( _L8( "pc" ) ) != KErrNotFound ) |
|
3290 |
{ |
|
3291 |
aValueType = CXnDomPropertyValue::EPc; |
|
3292 |
} |
|
3293 |
else |
|
3294 |
{ |
|
3295 |
aValueType = CXnDomPropertyValue::ENumber; |
|
3296 |
} |
|
3297 |
} |
|
3298 |
||
3299 |
// ----------------------------------------------------------------------------- |
|
3300 |
// RunSystemSetNumberL |
|
3301 |
// ----------------------------------------------------------------------------- |
|
3302 |
// |
|
3303 |
static void RunSystemSetNumberL( |
|
3304 |
CXnUiEngine& aEngine, |
|
3305 |
CXnNode* aNode, |
|
3306 |
const TDesC8& aName, |
|
3307 |
const RPointerArray< HBufC8 >& aValues ) |
|
3308 |
{ |
|
3309 |
if ( aNode ) |
|
3310 |
{ |
|
3311 |
CXnDomStringPool* sp = aEngine.ODT()->DomDocument().StringPool(); |
|
3312 |
CXnDomProperty* prop = CXnDomProperty::NewL( aName, sp ); |
|
3313 |
CleanupStack::PushL( prop ); |
|
3314 |
||
3315 |
for ( TInt i = 0; i < aValues.Count(); i++ ) |
|
3316 |
{ |
|
3317 |
const TDesC8& value = ( *aValues[i] ); |
|
3318 |
||
3319 |
CXnDomPropertyValue* propVal = CXnDomPropertyValue::NewL( sp ); |
|
3320 |
CleanupStack::PushL( propVal ); |
|
3321 |
||
3322 |
CXnDomPropertyValue::TPrimitiveValueType type; |
|
3323 |
TReal realValue; |
|
3324 |
||
3325 |
GetNumberValues( value, realValue, type ); |
|
3326 |
propVal->SetFloatValueL( type, realValue ); |
|
3327 |
||
3328 |
prop->PropertyValueList().AddItemL( propVal ); |
|
3329 |
CleanupStack::Pop( propVal ); |
|
3330 |
} |
|
3331 |
||
3332 |
CXnProperty* propertyValue = CXnProperty::NewL( prop ); |
|
3333 |
||
3334 |
CleanupStack::Pop( prop ); |
|
3335 |
CleanupStack::PushL( propertyValue ); |
|
3336 |
||
3337 |
aNode->SetPropertyL( propertyValue ); |
|
3338 |
||
3339 |
CleanupStack::Pop( propertyValue ); |
|
3340 |
} |
|
3341 |
} |
|
3342 |
||
3343 |
// ----------------------------------------------------------------------------- |
|
3344 |
// RunSystemSetRGBL |
|
3345 |
// ----------------------------------------------------------------------------- |
|
3346 |
// |
|
3347 |
static void RunSystemSetRGBL( |
|
3348 |
CXnUiEngine& aEngine, |
|
3349 |
CXnNode* aNode, |
|
3350 |
const TDesC8& aName, |
|
3351 |
const RPointerArray< HBufC8 >& aValues ) |
|
3352 |
{ |
|
3353 |
if ( aNode ) |
|
3354 |
{ |
|
3355 |
CXnDomStringPool* sp = aEngine.ODT()->DomDocument().StringPool(); |
|
3356 |
CXnDomProperty* prop = CXnDomProperty::NewL( aName, sp ); |
|
3357 |
CleanupStack::PushL( prop ); |
|
3358 |
||
3359 |
for ( TInt i = 0; i < aValues.Count(); i++ ) |
|
3360 |
{ |
|
3361 |
const TDesC8& value = ( *aValues[i] ); |
|
3362 |
||
3363 |
CXnDomPropertyValue* propVal = CXnDomPropertyValue::NewL( sp ); |
|
3364 |
CleanupStack::PushL( propVal ); |
|
3365 |
||
3366 |
TRgb rgb; |
|
3367 |
||
3368 |
if ( CXnUtils::GetRgbValue( rgb, value ) ) |
|
3369 |
{ |
|
3370 |
propVal->SetRgbColorL( rgb ); |
|
3371 |
prop->PropertyValueList().AddItemL( propVal ); |
|
3372 |
CleanupStack::Pop( propVal ); |
|
3373 |
} |
|
3374 |
else |
|
3375 |
{ |
|
3376 |
CleanupStack::PopAndDestroy( propVal ); |
|
3377 |
} |
|
3378 |
} |
|
3379 |
||
3380 |
CXnProperty* propertyValue = CXnProperty::NewL( prop ); |
|
3381 |
||
3382 |
CleanupStack::Pop( prop ); |
|
3383 |
CleanupStack::PushL( propertyValue ); |
|
3384 |
||
3385 |
aNode->SetPropertyL( propertyValue ); |
|
3386 |
||
3387 |
CleanupStack::Pop( propertyValue ); |
|
3388 |
} |
|
3389 |
} |
|
3390 |
||
3391 |
// ----------------------------------------------------------------------------- |
|
3392 |
// RunSystemSetStringL |
|
3393 |
// ----------------------------------------------------------------------------- |
|
3394 |
// |
|
3395 |
static void RunSystemSetStringL( |
|
3396 |
CXnUiEngine& aEngine, |
|
3397 |
CXnNode* aNode, |
|
3398 |
const TDesC8& aName, |
|
3399 |
const RPointerArray< HBufC8 >& aValues, |
|
3400 |
const CXnDomPropertyValue::TPrimitiveValueType aValueType ) |
|
3401 |
{ |
|
3402 |
if ( aNode ) |
|
3403 |
{ |
|
3404 |
CXnDomStringPool* sp = aEngine.ODT()->DomDocument().StringPool(); |
|
3405 |
CXnDomProperty* prop = CXnDomProperty::NewL( aName, sp ); |
|
3406 |
CleanupStack::PushL( prop ); |
|
3407 |
||
3408 |
for ( TInt i = 0; i < aValues.Count(); i++ ) |
|
3409 |
{ |
|
3410 |
const TDesC8& value = ( *aValues[i] ); |
|
3411 |
||
3412 |
CXnDomPropertyValue* propVal = CXnDomPropertyValue::NewL( sp ); |
|
3413 |
CleanupStack::PushL( propVal ); |
|
3414 |
||
3415 |
propVal->SetStringValueL( aValueType, value ); |
|
3416 |
prop->PropertyValueList().AddItemL( propVal ); |
|
3417 |
CleanupStack::Pop( propVal ); |
|
3418 |
} |
|
3419 |
||
3420 |
CXnProperty* propertyValue = CXnProperty::NewL( prop ); |
|
3421 |
||
3422 |
CleanupStack::Pop( prop ); |
|
3423 |
CleanupStack::PushL( propertyValue ); |
|
3424 |
||
3425 |
aNode->SetPropertyL( propertyValue ); |
|
3426 |
||
3427 |
CleanupStack::Pop( propertyValue ); |
|
3428 |
} |
|
3429 |
} |
|
3430 |
||
3431 |
// ----------------------------------------------------------------------------- |
|
3432 |
// GetSystemSetDataL |
|
3433 |
// ----------------------------------------------------------------------------- |
|
3434 |
// |
|
3435 |
static void GetSystemSetDataL( |
|
3436 |
CXnDomNode& aDomNode, |
|
3437 |
HBufC8*& aId, |
|
3438 |
const TDesC8** aPseudoClass, |
|
3439 |
const TDesC8** aName, |
|
3440 |
RPointerArray< HBufC8 >* aValues, |
|
3441 |
const TDesC8** aType, |
|
3442 |
TBool aSettings, |
|
3443 |
const TDesC8& aProvidedId, |
|
3444 |
const TDesC8** aClassId ) |
|
3445 |
{ |
|
3446 |
CXnDomList& children = aDomNode.ChildNodes(); |
|
3447 |
||
3448 |
if ( aSettings ) |
|
3449 |
{ |
|
3450 |
aId = aProvidedId.AllocL(); |
|
3451 |
} |
|
3452 |
||
3453 |
TInt count = children.Length(); |
|
3454 |
||
3455 |
for ( TInt i = 0; i < count; ++i ) |
|
3456 |
{ |
|
3457 |
CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
3458 |
const TDesC8& nodeType = node->Name(); |
|
3459 |
||
3460 |
if ( nodeType == XnPropertyNames::action::KProperty ) |
|
3461 |
{ |
|
3462 |
const TDesC8& name = node->AttributeValue( |
|
3463 |
XnPropertyNames::action::event::systemset::KName ); |
|
3464 |
const TDesC8& value = node->AttributeValue( |
|
3465 |
XnPropertyNames::action::event::systemset::KValue ); |
|
3466 |
||
3467 |
if ( !aSettings && |
|
3468 |
( name == XnPropertyNames::action::event::systemset::KId ) ) |
|
3469 |
{ |
|
3470 |
HBufC8* utfName = HBufC8::NewL( value.Length() ); |
|
3471 |
TPtr8 ptr = utfName->Des(); |
|
3472 |
ptr = value; |
|
3473 |
aId = utfName; |
|
3474 |
} |
|
3475 |
else if ( name == XnPropertyNames::action::event::systemset::KPseudoClass ) |
|
3476 |
{ |
|
3477 |
*aPseudoClass = &value; |
|
3478 |
} |
|
3479 |
else if ( name == XnPropertyNames::action::event::systemset::KName ) |
|
3480 |
{ |
|
3481 |
*aName = &value; |
|
3482 |
} |
|
3483 |
else if ( name == XnPropertyNames::action::event::systemset::KValue ) |
|
3484 |
{ |
|
3485 |
if ( aValues ) |
|
3486 |
{ |
|
3487 |
HBufC8* valueH = HBufC8::NewLC( value.Length() + KUnitMaxLen ); |
|
3488 |
TPtr8 ptr( valueH->Des() ); |
|
3489 |
ptr.Append( value ); |
|
3490 |
aValues->AppendL( valueH ); //take ownership |
|
3491 |
CleanupStack::Pop( valueH ); |
|
3492 |
} |
|
3493 |
} |
|
3494 |
else if ( name == XnPropertyNames::action::event::systemset::KType ) |
|
3495 |
{ |
|
3496 |
*aType = &value; |
|
3497 |
} |
|
3498 |
else if ( name == XnPropertyNames::action::event::systemset::KUnit ) |
|
3499 |
{ |
|
3500 |
if ( value.Length() > KUnitMaxLen ) |
|
3501 |
{ |
|
3502 |
#ifdef _XN_DEBUG_ |
|
3503 |
RDebug::Print( _L( "xnnodeimpl GetSystemSetDataL - unexpected length of type string" ) ); |
|
3504 |
#endif |
|
3505 |
User::Leave( KErrNotSupported ); |
|
3506 |
} |
|
3507 |
if ( aValues ) |
|
3508 |
{ |
|
3509 |
TInt index = aValues->Count() - 1; |
|
3510 |
HBufC8* valueH = ( *aValues )[index]; |
|
3511 |
TPtr8 ptr( valueH->Des() ); |
|
3512 |
ptr.Append( value ); |
|
3513 |
} |
|
3514 |
} |
|
3515 |
else if ( name == XnPropertyNames::action::event::systemset::KClass ) |
|
3516 |
{ |
|
3517 |
*aClassId = &value; |
|
3518 |
} |
|
3519 |
else |
|
3520 |
{ |
|
3521 |
// Everyting is within the same property tag |
|
3522 |
// e.g. <property name="display" value="block" type="string" id="my_id"/> |
|
3523 |
||
3524 |
// Save name... |
|
3525 |
*aName = &name; |
|
3526 |
||
3527 |
// ...and value |
|
3528 |
if ( aValues ) |
|
3529 |
{ |
|
3530 |
HBufC8* valueH = HBufC8::NewLC( value.Length() + KUnitMaxLen ); |
|
3531 |
TPtr8 ptr( valueH->Des() ); |
|
3532 |
ptr.Append( value ); |
|
3533 |
aValues->AppendL( valueH ); //take ownership |
|
3534 |
CleanupStack::Pop( valueH ); |
|
3535 |
} |
|
3536 |
||
3537 |
// ...and type |
|
3538 |
const TDesC8& type = node->AttributeValue( |
|
3539 |
XnPropertyNames::action::event::systemset::KType ); |
|
3540 |
*aType = &type; |
|
3541 |
||
3542 |
// ...and id |
|
3543 |
const TDesC8& id = node->AttributeValue( |
|
3544 |
XnPropertyNames::action::event::systemset::KId ); |
|
3545 |
HBufC8* utfName = HBufC8::NewL( id.Length() ); |
|
3546 |
TPtr8 ptr = utfName->Des(); |
|
3547 |
ptr = id; |
|
3548 |
aId = utfName; |
|
3549 |
} |
|
3550 |
} |
|
3551 |
} |
|
3552 |
} |
|
3553 |
||
3554 |
// ----------------------------------------------------------------------------- |
|
3555 |
// RunTryDisplayingMenuL |
|
3556 |
// ----------------------------------------------------------------------------- |
|
3557 |
// |
|
3558 |
static void RunTryDisplayingMenuL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
3559 |
{ |
|
3560 |
CXnNode* menubar( aEngine.MenuBarNode() ); |
|
3561 |
||
3562 |
if ( menubar ) |
|
3563 |
{ |
|
3564 |
CXnDomList& children( aEventNode.ChildNodes() ); |
|
3565 |
||
3566 |
TInt count( children.Length() ); |
|
3567 |
||
3568 |
for ( TInt i = 0; i < count; ++i ) |
|
3569 |
{ |
|
3570 |
CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
3571 |
||
3572 |
const TDesC8& type( node->Name() ); |
|
3573 |
||
3574 |
if ( type == XnPropertyNames::action::KProperty ) |
|
3575 |
{ |
|
3576 |
const TDesC8& id( node->AttributeValue( XnPropertyNames::action::KValue ) ); |
|
3577 |
||
3578 |
if ( id != KNullDesC8 ) |
|
3579 |
{ |
|
3580 |
HBufC* menuId( CnvUtfConverter::ConvertToUnicodeFromUtf8L( id ) ); |
|
3581 |
CleanupStack::PushL( menuId ); |
|
3582 |
||
3583 |
XnMenuInterface::MXnMenuInterface* menuIf( NULL ); |
|
3584 |
XnComponentInterface::MakeInterfaceL( menuIf, menubar->AppIfL() ); |
|
3585 |
||
3586 |
if ( menuIf ) |
|
3587 |
{ |
|
3588 |
aEngine.Editor()->SetTargetPlugin( aEngine.FocusedNode() ); |
|
3589 |
menuIf->TryDisplayingMenuBarL( *menuId, EFalse ); |
|
3590 |
} |
|
3591 |
||
3592 |
CleanupStack::PopAndDestroy( menuId ); |
|
3593 |
} |
|
3594 |
} |
|
3595 |
} |
|
3596 |
} |
|
3597 |
} |
|
3598 |
||
3599 |
// ----------------------------------------------------------------------------- |
|
3600 |
// RunTryDisplayingListQueryDialogL |
|
3601 |
// ----------------------------------------------------------------------------- |
|
3602 |
// |
|
3603 |
static void RunTryDisplayingListQueryDialogL( |
|
3604 |
CXnNodeImpl* aThis, |
|
3605 |
CXnUiEngine& aEngine, |
|
3606 |
CXnDomNode& aEventNode ) |
|
3607 |
{ |
|
3608 |
CXnDomList& children( aEventNode.ChildNodes() ); |
|
3609 |
||
3610 |
TInt count( children.Length() ); |
|
3611 |
||
3612 |
if ( count > 0 ) |
|
3613 |
{ |
|
3614 |
CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( 0 ) ); |
|
3615 |
||
3616 |
const TDesC8& type( node->Name() ); |
|
3617 |
||
3618 |
if ( type == XnPropertyNames::action::KProperty ) |
|
3619 |
{ |
|
3620 |
const TDesC8& id( |
|
3621 |
node->AttributeValue( XnPropertyNames::action::KValue ) ); |
|
3622 |
||
3623 |
if ( id != KNullDesC8 ) |
|
3624 |
{ |
|
3625 |
CXnNode* dialog( aEngine.FindNodeByIdL( id, aThis->Namespace() ) ); |
|
3626 |
||
3627 |
if ( dialog && dialog->Type()->Type() == XnPropertyNames::listquerydialog::KListQueryDialog ) |
|
3628 |
{ |
|
3629 |
CXnListQueryDialogAdapter* adapter = |
|
3630 |
static_cast< CXnListQueryDialogAdapter* > ( dialog->Control() ); |
|
3631 |
||
3632 |
adapter->TryDisplayingDialogL(); |
|
3633 |
} |
|
3634 |
||
3635 |
} |
|
3636 |
} |
|
3637 |
} |
|
3638 |
} |
|
3639 |
||
3640 |
// ----------------------------------------------------------------------------- |
|
3641 |
// RunTryDisplayingStylusPopupL |
|
3642 |
// ----------------------------------------------------------------------------- |
|
3643 |
// |
|
3644 |
static void RunTryDisplayingStylusPopupL( |
|
3645 |
CXnNodeImpl* aThis, |
|
3646 |
CXnNode& aNode, |
|
3647 |
CXnUiEngine& aEngine, |
|
3648 |
CXnDomNode& aEventNode ) |
|
3649 |
{ |
|
3650 |
CXnDomList& children( aEventNode.ChildNodes() ); |
|
3651 |
||
3652 |
TInt count( children.Length() ); |
|
3653 |
||
3654 |
if ( count > 0 ) |
|
3655 |
{ |
|
3656 |
CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( 0 ) ); |
|
3657 |
||
3658 |
const TDesC8& type( node->Name() ); |
|
3659 |
||
3660 |
if ( type == XnPropertyNames::action::KProperty ) |
|
3661 |
{ |
|
3662 |
const TDesC8& id( node->AttributeValue( |
|
3663 |
XnPropertyNames::action::KValue ) ); |
|
3664 |
||
3665 |
if ( id != KNullDesC8 ) |
|
3666 |
{ |
|
3667 |
CXnNode* popup( aEngine.FindNodeByIdL( id, aThis->Namespace() ) ); |
|
3668 |
||
3669 |
if ( popup && popup->Type()->Type() == _L8("styluspopup") ) |
|
3670 |
{ |
|
3671 |
CXnPopupControlAdapter* adapter = |
|
3672 |
static_cast< CXnPopupControlAdapter* > ( popup->Control() ); |
|
3673 |
||
3674 |
adapter->TryDisplayingStylusPopupL( aNode ); |
|
3675 |
} |
|
3676 |
} |
|
3677 |
} |
|
3678 |
} |
|
3679 |
} |
|
3680 |
||
3681 |
// ----------------------------------------------------------------------------- |
|
3682 |
// RunSetInitialFocusL |
|
3683 |
// ----------------------------------------------------------------------------- |
|
3684 |
// |
|
3685 |
static void RunSetInitialFocusL( CXnUiEngine& aEngine ) |
|
3686 |
{ |
|
3687 |
TBool editState( aEngine.EditMode()->EditState() ); |
|
3688 |
||
3689 |
CXnViewManager* manager( aEngine.ViewManager() ); |
|
3690 |
||
3691 |
RPointerArray< CXnNode >& pluginNodes( manager->PluginNodes() ); |
|
3692 |
||
3693 |
if ( editState ) |
|
3694 |
{ |
|
3695 |
TBool pluginFocused( EFalse ); |
|
3696 |
||
3697 |
for ( TInt i = 0; i < pluginNodes.Count(); i++ ) |
|
3698 |
{ |
|
3699 |
CXnNode* node( pluginNodes[i] ); |
|
3700 |
||
3701 |
if ( node->IsStateSet( XnPropertyNames::style::common::KFocus ) ) |
|
3702 |
{ |
|
3703 |
pluginFocused = ETrue; |
|
3704 |
break; |
|
3705 |
} |
|
3706 |
} |
|
3707 |
||
3708 |
if ( !pluginFocused ) |
|
3709 |
{ |
|
3710 |
for ( TInt i = 0; i < pluginNodes.Count(); i++ ) |
|
3711 |
{ |
|
3712 |
CXnNode* node( pluginNodes[i] ); |
|
3713 |
||
3714 |
node->SetStateWithoutNotificationL( |
|
3715 |
XnPropertyNames::style::common::KFocus ); |
|
3716 |
||
3717 |
if ( node->IsStateSet( |
|
3718 |
XnPropertyNames::style::common::KFocus ) ) |
|
3719 |
{ |
|
3720 |
break; |
|
3721 |
} |
|
3722 |
} |
|
3723 |
} |
|
3724 |
} |
|
3725 |
else |
|
3726 |
{ |
|
3727 |
CXnViewData& viewData( manager->ActiveViewData() ); |
|
3728 |
||
3729 |
RPointerArray< CXnPluginData > plugins; |
|
3730 |
CleanupClosePushL( plugins ); |
|
3731 |
||
3732 |
for( TInt i = 0; i < pluginNodes.Count(); i++ ) |
|
3733 |
{ |
|
3734 |
CXnPluginData* data( viewData.Plugin( pluginNodes[i] ) ); |
|
3735 |
||
3736 |
if( data && data->Occupied() ) |
|
3737 |
{ |
|
3738 |
plugins.AppendL( data ); |
|
3739 |
} |
|
3740 |
} |
|
3741 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
3742 |
plugins.AppendL( &viewData ); |
34 | 3743 |
|
3744 |
RPointerArray< CXnNode > list; |
|
3745 |
CleanupClosePushL( list ); |
|
3746 |
||
3747 |
for( TInt i = 0; i < plugins.Count(); i++ ) |
|
3748 |
{ |
|
3749 |
plugins[i]->InitialFocusNodesL( list ); |
|
3750 |
} |
|
3751 |
||
3752 |
for ( TInt i = 0; i < list.Count(); i++ ) |
|
3753 |
{ |
|
3754 |
CXnNode* node( list[i] ); |
|
3755 |
||
3756 |
node->SetStateWithoutNotificationL( |
|
3757 |
XnPropertyNames::style::common::KFocus ); |
|
3758 |
||
3759 |
if ( node->IsStateSet( XnPropertyNames::style::common::KFocus ) ) |
|
3760 |
{ |
|
3761 |
break; |
|
3762 |
} |
|
3763 |
} |
|
3764 |
||
3765 |
CleanupStack::PopAndDestroy( 2, &plugins ); // list |
|
3766 |
} |
|
3767 |
} |
|
3768 |
||
3769 |
// ----------------------------------------------------------------------------- |
|
3770 |
// RunSystemSetL |
|
3771 |
// ----------------------------------------------------------------------------- |
|
3772 |
// |
|
3773 |
static void RunSystemSetL( |
|
3774 |
CXnNodeImpl* aThis, |
|
3775 |
CXnUiEngine& aEngine, |
|
3776 |
CXnDomNode& aEventNode, |
|
3777 |
TBool aSettings, |
|
3778 |
const TDesC8& aId ) |
|
3779 |
{ |
|
3780 |
HBufC8* id = NULL; |
|
3781 |
const TDesC8* pseudoClass = NULL; |
|
3782 |
const TDesC8* name = NULL; |
|
3783 |
const TDesC8* type = NULL; |
|
3784 |
const TDesC8* classId = NULL; |
|
3785 |
||
3786 |
RPointerArray< HBufC8 > values; |
|
3787 |
CleanupResetAndDestroyPushL( values ); |
|
3788 |
||
3789 |
GetSystemSetDataL( |
|
3790 |
aEventNode, id, &pseudoClass, &name, |
|
3791 |
&values, &type, aSettings, aId, &classId ); |
|
3792 |
||
3793 |
CleanupStack::PushL( id ); |
|
3794 |
||
3795 |
if ( !name && id ) |
|
3796 |
{ |
|
3797 |
for ( TInt i = 0; i < values.Count(); i++ ) |
|
3798 |
{ |
|
3799 |
const TDesC8* value = values[i]; |
|
3800 |
||
3801 |
RunSystemSetPCDataL( aThis, aEngine, *id, *value ); |
|
3802 |
} |
|
3803 |
} |
|
3804 |
else if ( name && id && type ) |
|
3805 |
{ |
|
3806 |
CXnNode* node = aEngine.FindNodeByIdL( *id, aThis->Namespace() ); |
|
3807 |
||
3808 |
if ( *type == XnPropertyNames::action::event::systemset::type::KString ) |
|
3809 |
{ |
|
3810 |
RunSystemSetStringL( |
|
3811 |
aEngine, node, *name, values, CXnDomPropertyValue::EString ); |
|
3812 |
} |
|
3813 |
else if ( *type == |
|
3814 |
XnPropertyNames::action::event::systemset::type::KNumeric ) |
|
3815 |
{ |
|
3816 |
RunSystemSetNumberL( |
|
3817 |
aEngine, node, *name, values ); |
|
3818 |
} |
|
3819 |
else if ( *type == XnPropertyNames::action::event::systemset::type::KRGB ) |
|
3820 |
{ |
|
3821 |
RunSystemSetRGBL( |
|
3822 |
aEngine, node, *name, values ); |
|
3823 |
} |
|
3824 |
else if ( *type == XnPropertyNames::action::event::systemset::type::KUrl ) |
|
3825 |
{ |
|
3826 |
RunSystemSetStringL( |
|
3827 |
aEngine, node, *name, values, CXnDomPropertyValue::EUri ); |
|
3828 |
} |
|
3829 |
else if ( *type == |
|
3830 |
XnPropertyNames::action::event::systemset::type::KAttribute ) |
|
3831 |
{ |
|
3832 |
RunSystemSetStringL( |
|
3833 |
aEngine, node, *name, values, CXnDomPropertyValue::EAttr ); |
|
3834 |
} |
|
3835 |
} |
|
3836 |
else if ( name && classId && type ) |
|
3837 |
{ |
|
3838 |
CXnPointerArray* array = aEngine.FindNodeByClassL( *classId, aThis->Namespace() ); |
|
3839 |
CleanupStack::PushL( array ); |
|
3840 |
||
3841 |
const TInt count = array->Container().Count(); |
|
3842 |
||
3843 |
for ( TInt i = 0; i < count; ++i ) |
|
3844 |
{ |
|
3845 |
CXnNode* node = static_cast< CXnNode* >(array->Container()[i]); |
|
3846 |
if ( *type == XnPropertyNames::action::event::systemset::type::KString ) |
|
3847 |
{ |
|
3848 |
RunSystemSetStringL( |
|
3849 |
aEngine, node, *name, values, CXnDomPropertyValue::EString ); |
|
3850 |
} |
|
3851 |
else if ( *type == |
|
3852 |
XnPropertyNames::action::event::systemset::type::KNumeric ) |
|
3853 |
{ |
|
3854 |
RunSystemSetNumberL( |
|
3855 |
aEngine, node, *name, values ); |
|
3856 |
} |
|
3857 |
else if ( *type == XnPropertyNames::action::event::systemset::type::KRGB ) |
|
3858 |
{ |
|
3859 |
RunSystemSetRGBL( |
|
3860 |
aEngine, node, *name, values ); |
|
3861 |
} |
|
3862 |
else if ( *type == XnPropertyNames::action::event::systemset::type::KUrl ) |
|
3863 |
{ |
|
3864 |
RunSystemSetStringL( |
|
3865 |
aEngine, node, *name, values, CXnDomPropertyValue::EUri ); |
|
3866 |
} |
|
3867 |
else if ( *type == |
|
3868 |
XnPropertyNames::action::event::systemset::type::KAttribute ) |
|
3869 |
{ |
|
3870 |
RunSystemSetStringL( |
|
3871 |
aEngine, node, *name, values, CXnDomPropertyValue::EAttr ); |
|
3872 |
} |
|
3873 |
} |
|
3874 |
CleanupStack::PopAndDestroy( array ); |
|
3875 |
} |
|
3876 |
||
3877 |
CleanupStack::PopAndDestroy( 2, &values ); |
|
3878 |
} |
|
3879 |
||
3880 |
// ----------------------------------------------------------------------------- |
|
3881 |
// RunEventL |
|
3882 |
// ----------------------------------------------------------------------------- |
|
3883 |
// |
|
3884 |
static TBool RunEventL( |
|
3885 |
CXnNodeImpl* aThis, |
|
3886 |
CXnUiEngine& aEngine, |
|
3887 |
CXnNode& aNode, |
|
3888 |
CXnDomNode& aEventNode, |
|
3889 |
CXnDomNode& aTriggerNode, |
|
3890 |
CXnNode& aEventData ) |
|
3891 |
{ |
|
3892 |
const TDesC8& nameString( aEventNode.AttributeValue( KName ) ); |
|
3893 |
||
3894 |
if ( nameString == KNullDesC8 ) |
|
3895 |
{ |
|
3896 |
return EFalse; |
|
3897 |
} |
|
3898 |
||
3899 |
const TDesC8& system( XnPropertyNames::action::event::KSystemPrefix() ); |
|
3900 |
||
3901 |
if ( nameString.Find( system ) != 0 ) |
|
3902 |
{ |
|
3903 |
// event doesn't contain "system/" prefix |
|
3904 |
RunAppUiNotificationL( aEngine, aNode, |
|
3905 |
aEventNode, aTriggerNode, aEventData ); |
|
3906 |
} |
|
3907 |
else if ( nameString == XnPropertyNames::action::event::KSetFocus ) |
|
3908 |
{ |
|
3909 |
RPointerArray< CXnNode > focusCandidates; |
|
3910 |
CleanupClosePushL( focusCandidates ); |
|
3911 |
||
3912 |
GetFocusCandidatesL( aThis, aEngine, aEventNode, focusCandidates ); |
|
3913 |
||
3914 |
TBool retval( aNode.RunFocusChangeL( focusCandidates ) ); |
|
3915 |
||
3916 |
CleanupStack::PopAndDestroy( &focusCandidates ); |
|
3917 |
||
3918 |
return retval; |
|
3919 |
} |
|
3920 |
else if ( nameString == XnPropertyNames::action::event::KSetInitialFocus ) |
|
3921 |
{ |
|
3922 |
RunSetInitialFocusL( aEngine ); |
|
3923 |
return ETrue; |
|
3924 |
} |
|
3925 |
else if ( nameString == XnPropertyNames::action::event::KSet ) |
|
3926 |
{ |
|
3927 |
RunSystemSetL( aThis, aEngine, aEventNode ); |
|
3928 |
return ETrue; |
|
3929 |
} |
|
3930 |
else if ( nameString == XnPropertyNames::action::event::KSetPassiveFocus || |
|
3931 |
nameString == XnPropertyNames::action::event::KResetPassiveFocus || |
|
3932 |
nameString == XnPropertyNames::action::event::KSetActiveFocus ) |
|
3933 |
{ |
|
3934 |
RunPassiveFocusChangeL( aThis, aEngine, aEventNode, nameString ); |
|
3935 |
return ETrue; |
|
3936 |
} |
|
3937 |
else if ( nameString == XnPropertyNames::action::event::KClearPassiveFocuses ) |
|
3938 |
{ |
|
3939 |
aEngine.ClearPassiveFocusedNodesL(); |
|
3940 |
return ETrue; |
|
3941 |
} |
|
3942 |
else if ( nameString == XnPropertyNames::action::event::KSetEditMode ) |
|
3943 |
{ |
|
3944 |
RunEditL( aThis, aEngine, aEventNode ); |
|
3945 |
return ETrue; |
|
3946 |
} |
|
3947 |
else if ( nameString == XnPropertyNames::action::event::KResetEditMode ) |
|
3948 |
{ |
|
3949 |
RunResetEditL( aThis, aEngine, aEventNode ); |
|
3950 |
return ETrue; |
|
3951 |
} |
|
3952 |
else if ( nameString == XnPropertyNames::action::event::KRunAddWidgetQuery ) |
|
3953 |
{ |
|
3954 |
aEngine.Editor()->AddWidgetL(); |
|
3955 |
} |
|
3956 |
else if ( nameString == XnPropertyNames::action::event::KRemoveFocusedWidget ) |
|
3957 |
{ |
|
3958 |
aEngine.Editor()->RemoveWidgetL( aEngine.FocusedNode() ); |
|
3959 |
} |
|
3960 |
else if ( nameString == XnPropertyNames::action::event::KActivateNextView ) |
|
3961 |
{ |
|
3962 |
RunActivateNextViewL( aEngine, aEventNode ); |
|
3963 |
} |
|
3964 |
else if ( nameString == XnPropertyNames::action::event::KActivatePreviousView ) |
|
3965 |
{ |
|
3966 |
RunActivatePreviousViewL( aEngine, aEventNode ); |
|
3967 |
} |
|
3968 |
else if ( nameString == XnPropertyNames::action::event::KAddView ) |
|
3969 |
{ |
|
3970 |
RunAddViewL( aEngine, aEventNode ); |
|
3971 |
} |
|
3972 |
else if ( nameString == XnPropertyNames::action::event::KRemoveView ) |
|
3973 |
{ |
|
3974 |
RunRemoveViewL( aEngine, aEventNode ); |
|
3975 |
} |
|
3976 |
else if ( nameString == XnPropertyNames::action::event::KActivate ) |
|
3977 |
{ |
|
3978 |
RunActivateL( aThis, aEngine, aEventNode ); |
|
3979 |
return ETrue; |
|
3980 |
} |
|
3981 |
else if ( nameString == XnPropertyNames::action::event::KActivateSelectedItem ) |
|
3982 |
{ |
|
3983 |
CXnNode* focusedNode( aEngine.FocusedNode() ); |
|
3984 |
||
3985 |
if ( focusedNode ) |
|
3986 |
{ |
|
3987 |
aEngine.AppUiAdapter().ItemActivator().ActivateL( focusedNode ); |
|
3988 |
} |
|
3989 |
||
3990 |
return ETrue; |
|
3991 |
} |
|
3992 |
else if ( nameString == XnPropertyNames::action::event::KDeactivate ) |
|
3993 |
{ |
|
3994 |
RunDeactivateL( aThis, aEngine, aEventNode ); |
|
3995 |
return ETrue; |
|
3996 |
} |
|
3997 |
else if ( nameString == XnPropertyNames::action::event::KTryDisplayingMenu ) |
|
3998 |
{ |
|
3999 |
RunTryDisplayingMenuL( aEngine, aEventNode ); |
|
4000 |
} |
|
4001 |
else if ( nameString == |
|
4002 |
XnPropertyNames::action::event::KTryDisplayingListQueryDialog ) |
|
4003 |
{ |
|
4004 |
RunTryDisplayingListQueryDialogL( aThis, aEngine, aEventNode ); |
|
4005 |
} |
|
4006 |
else if ( nameString == XnPropertyNames::action::event::KTryDisplayingStylusPopup ) |
|
4007 |
{ |
|
4008 |
RunTryDisplayingStylusPopupL( aThis, aNode, aEngine, aEventNode ); |
|
4009 |
return ETrue; |
|
4010 |
} |
|
4011 |
else if ( nameString == XnPropertyNames::action::event::KToggleWidgetsVisibilty ) |
|
4012 |
{ |
|
4013 |
aEngine.Editor()->ToggleWidgetsVisibiltyL(); |
|
4014 |
||
4015 |
// check if focused widget need to be changed |
|
4016 |
CXnNode* focused( aEngine.FocusedNode() ); |
|
4017 |
||
4018 |
if ( !focused || !IsNodeNavigableL( focused ) ) |
|
4019 |
{ |
|
4020 |
RunSetInitialFocusL( aEngine ); |
|
4021 |
} |
|
4022 |
||
4023 |
return ETrue; |
|
4024 |
} |
|
4025 |
else if ( nameString == XnPropertyNames::action::event::KReportEnterEditMode ) |
|
4026 |
||
4027 |
{ |
|
4028 |
RunFullScreenEffectL( aEngine, aEventNode ); |
|
4029 |
||
4030 |
CXnNode* trigger( BuildTriggerNodeL( aEngine, |
|
4031 |
XnPropertyNames::action::trigger::name::KEditMode ) ); |
|
4032 |
CleanupStack::PushL( trigger ); |
|
4033 |
||
4034 |
CXnDomStringPool* sp( aEngine.ODT()->DomDocument().StringPool() ); |
|
4035 |
||
4036 |
CXnProperty* value( CXnProperty::NewL( |
|
4037 |
XnPropertyNames::action::KValue, |
|
4038 |
XnPropertyNames::action::trigger::name::editmode::KEnter, |
|
4039 |
CXnDomPropertyValue::EString, *sp ) ); |
|
4040 |
CleanupStack::PushL( value ); |
|
4041 |
||
4042 |
trigger->SetPropertyL( value ); |
|
4043 |
CleanupStack::Pop( value ); |
|
4044 |
||
4045 |
aEngine.ActiveView()->ReportXuikonEventL( *trigger ); |
|
4046 |
||
4047 |
CleanupStack::PopAndDestroy( trigger ); |
|
4048 |
||
4049 |
return ETrue; |
|
4050 |
} |
|
4051 |
else if( nameString == XnPropertyNames::action::event::KReportExitEditMode ) |
|
4052 |
{ |
|
4053 |
RunFullScreenEffectL( aEngine, aEventNode ); |
|
4054 |
||
4055 |
CXnNode* trigger( BuildTriggerNodeL( aEngine, |
|
4056 |
XnPropertyNames::action::trigger::name::KEditMode ) ); |
|
4057 |
CleanupStack::PushL( trigger ); |
|
4058 |
||
4059 |
CXnDomStringPool* sp( aEngine.ODT()->DomDocument().StringPool() ); |
|
4060 |
||
4061 |
CXnProperty* value( CXnProperty::NewL( |
|
4062 |
XnPropertyNames::action::KValue, |
|
4063 |
XnPropertyNames::action::trigger::name::editmode::KExit, |
|
4064 |
CXnDomPropertyValue::EString, *sp ) ); |
|
4065 |
CleanupStack::PushL( value ); |
|
4066 |
||
4067 |
trigger->SetPropertyL( value ); |
|
4068 |
CleanupStack::Pop( value ); |
|
4069 |
||
4070 |
aEngine.ActiveView()->ReportXuikonEventL( *trigger ); |
|
4071 |
||
4072 |
CleanupStack::PopAndDestroy( trigger ); |
|
4073 |
||
4074 |
return ETrue; |
|
4075 |
} |
|
4076 |
else if ( nameString == XnPropertyNames::action::event::KSetWallpaper ) |
|
4077 |
{ |
|
4078 |
aEngine.AppUiAdapter().ViewAdapter().BgManager().SetWallpaperL(); |
|
4079 |
return ETrue; |
|
4080 |
} |
|
4081 |
else if ( nameString == XnPropertyNames::action::event::KActivateTextEditor) |
|
4082 |
{ |
|
4083 |
RunActivateEditorL( aThis, aNode, aEngine, aEventNode, ETrue ); |
|
4084 |
return ETrue; |
|
4085 |
} |
|
4086 |
else if ( nameString == XnPropertyNames::action::event::KDeactivateTextEditor) |
|
4087 |
{ |
|
4088 |
RunActivateEditorL( aThis, aNode, aEngine, aEventNode, EFalse ); |
|
4089 |
return ETrue; |
|
4090 |
} |
|
4091 |
return EFalse; |
|
4092 |
} |
|
4093 |
||
4094 |
// ----------------------------------------------------------------------------- |
|
4095 |
// RunEventsL |
|
4096 |
// ----------------------------------------------------------------------------- |
|
4097 |
// |
|
4098 |
static void RunEventsL( |
|
4099 |
CXnNodeImpl* aThis, |
|
4100 |
CXnUiEngine& aEngine, |
|
4101 |
CXnNode& aNode, |
|
4102 |
CXnDomNode& aActionNode, |
|
4103 |
CXnDomNode& aTriggerNode, |
|
4104 |
CXnNode& aEventData ) |
|
4105 |
{ |
|
4106 |
CXnDomList& children = aActionNode.ChildNodes(); |
|
4107 |
TInt count = children.Length(); |
|
4108 |
TBool render = EFalse; |
|
4109 |
for ( TInt i = 0; i < count; ++i ) |
|
4110 |
{ |
|
4111 |
CXnDomNode* node = static_cast< CXnDomNode* >(children.Item( i ) ); |
|
4112 |
const TDesC8& type = node->Name(); |
|
4113 |
if ( type == XnPropertyNames::action::KEvent ) |
|
4114 |
{ |
|
4115 |
TBool tmp = RunEventL( |
|
4116 |
aThis, aEngine, aNode, *node, aTriggerNode, aEventData ); |
|
4117 |
if ( !render ) |
|
4118 |
{ |
|
4119 |
render = tmp; |
|
4120 |
} |
|
4121 |
} |
|
4122 |
} |
|
4123 |
if ( render ) |
|
4124 |
{ |
|
4125 |
aEngine.RenderUIL( NULL ); |
|
4126 |
} |
|
4127 |
} |
|
4128 |
||
4129 |
// ----------------------------------------------------------------------------- |
|
4130 |
// DoMatchTriggerForHighLevelKeyEventL |
|
4131 |
// ----------------------------------------------------------------------------- |
|
4132 |
// |
|
4133 |
static TBool DoMatchTriggerForHighLevelKeyEventL( |
|
4134 |
CXnNode& aNode, |
|
4135 |
const TKeyEvent& aKeyEvent, |
|
4136 |
TEventCode aType, |
|
4137 |
const TDesC8& aHighLevelKey ) |
|
4138 |
{ |
|
4139 |
const TDesC8* key; |
|
4140 |
||
4141 |
switch ( aKeyEvent.iCode ) |
|
4142 |
{ |
|
4143 |
case EKeyLeftArrow: |
|
4144 |
key = &XnPropertyNames::action::trigger::name::KLeft; |
|
4145 |
break; |
|
4146 |
case EKeyRightArrow: |
|
4147 |
key = &XnPropertyNames::action::trigger::name::KRight; |
|
4148 |
break; |
|
4149 |
case EKeyUpArrow: |
|
4150 |
key = &XnPropertyNames::action::trigger::name::KUp; |
|
4151 |
break; |
|
4152 |
case EKeyDownArrow: |
|
4153 |
key = &XnPropertyNames::action::trigger::name::KDown; |
|
4154 |
break; |
|
4155 |
default: |
|
4156 |
key = NULL; |
|
4157 |
break; |
|
4158 |
} |
|
4159 |
||
4160 |
if ( !key || aType != EEventKey ) |
|
4161 |
{ |
|
4162 |
return EFalse; |
|
4163 |
} |
|
4164 |
||
4165 |
CXnNode* parent( aNode.Parent() ); |
|
4166 |
||
4167 |
if ( !parent || aNode.ViewNodeImpl() ) |
|
4168 |
{ |
|
4169 |
if ( *key == aHighLevelKey ) |
|
4170 |
{ |
|
4171 |
return ETrue; |
|
4172 |
} |
|
4173 |
} |
|
4174 |
else |
|
4175 |
{ |
|
4176 |
const TDesC8* direction( |
|
4177 |
&XnPropertyNames::style::common::direction::KLTR ); |
|
4178 |
const TDesC8* orientation( |
|
4179 |
&XnPropertyNames::style::common::block_progression::KTB ); |
|
4180 |
||
4181 |
CXnProperty* directionProperty( parent->DirectionL() ); |
|
4182 |
||
4183 |
if ( directionProperty ) |
|
4184 |
{ |
|
4185 |
direction = &directionProperty->StringValue(); |
|
4186 |
} |
|
4187 |
||
4188 |
CXnProperty* orientationProperty( parent->BlockProgressionL() ); |
|
4189 |
||
4190 |
if ( orientationProperty ) |
|
4191 |
{ |
|
4192 |
orientation = &orientationProperty->StringValue(); |
|
4193 |
} |
|
4194 |
||
4195 |
if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
4196 |
( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
4197 |
*orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
4198 |
{ |
|
4199 |
if ( *key == aHighLevelKey ) |
|
4200 |
{ |
|
4201 |
return ETrue; |
|
4202 |
} |
|
4203 |
} |
|
4204 |
else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
4205 |
( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
4206 |
*orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
4207 |
{ |
|
4208 |
if ( *key == XnPropertyNames::action::trigger::name::KRight && |
|
4209 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KLeft ) |
|
4210 |
{ |
|
4211 |
return ETrue; |
|
4212 |
} |
|
4213 |
||
4214 |
if ( *key == XnPropertyNames::action::trigger::name::KLeft && |
|
4215 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KRight ) |
|
4216 |
{ |
|
4217 |
return ETrue; |
|
4218 |
} |
|
4219 |
||
4220 |
if ( *key == XnPropertyNames::action::trigger::name::KDown && |
|
4221 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KDown ) |
|
4222 |
{ |
|
4223 |
return ETrue; |
|
4224 |
} |
|
4225 |
||
4226 |
if ( *key == XnPropertyNames::action::trigger::name::KUp && |
|
4227 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KUp ) |
|
4228 |
{ |
|
4229 |
return ETrue; |
|
4230 |
} |
|
4231 |
} |
|
4232 |
else if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
4233 |
*orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
4234 |
{ |
|
4235 |
if ( *key == XnPropertyNames::action::trigger::name::KUp && |
|
4236 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KLeft ) |
|
4237 |
{ |
|
4238 |
return ETrue; |
|
4239 |
} |
|
4240 |
||
4241 |
if ( *key == XnPropertyNames::action::trigger::name::KDown && |
|
4242 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KRight ) |
|
4243 |
{ |
|
4244 |
return ETrue; |
|
4245 |
} |
|
4246 |
||
4247 |
if ( *key == XnPropertyNames::action::trigger::name::KLeft && |
|
4248 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KDown ) |
|
4249 |
{ |
|
4250 |
return ETrue; |
|
4251 |
} |
|
4252 |
||
4253 |
if ( *key == XnPropertyNames::action::trigger::name::KRight && |
|
4254 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KUp ) |
|
4255 |
{ |
|
4256 |
return ETrue; |
|
4257 |
} |
|
4258 |
} |
|
4259 |
else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
4260 |
*orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
4261 |
{ |
|
4262 |
if ( *key == XnPropertyNames::action::trigger::name::KDown && |
|
4263 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KLeft ) |
|
4264 |
{ |
|
4265 |
return ETrue; |
|
4266 |
} |
|
4267 |
||
4268 |
if ( *key == XnPropertyNames::action::trigger::name::KUp && |
|
4269 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KRight ) |
|
4270 |
{ |
|
4271 |
return ETrue; |
|
4272 |
} |
|
4273 |
||
4274 |
if ( *key == XnPropertyNames::action::trigger::name::KLeft && |
|
4275 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KDown ) |
|
4276 |
{ |
|
4277 |
return ETrue; |
|
4278 |
} |
|
4279 |
||
4280 |
if ( *key == XnPropertyNames::action::trigger::name::KRight && |
|
4281 |
aHighLevelKey == XnPropertyNames::action::trigger::name::KUp ) |
|
4282 |
{ |
|
4283 |
return ETrue; |
|
4284 |
} |
|
4285 |
} |
|
4286 |
} |
|
4287 |
||
4288 |
return EFalse; |
|
4289 |
} |
|
4290 |
||
4291 |
// ----------------------------------------------------------------------------- |
|
4292 |
// MatchActionForKeyEventL |
|
4293 |
// ----------------------------------------------------------------------------- |
|
4294 |
// |
|
4295 |
static TBool MatchActionForKeyEventL( |
|
4296 |
CXnNodeImpl* aThis, |
|
4297 |
CXnUiEngine& aEngine, |
|
4298 |
CXnNode& aNode, |
|
4299 |
const TKeyEvent& aKeyEvent, TEventCode aType, |
|
4300 |
CXnDomNode& aActionNode ) |
|
4301 |
{ |
|
4302 |
CXnDomList& children = aActionNode.ChildNodes(); |
|
4303 |
TInt count = children.Length(); |
|
4304 |
for ( TInt i = 0; i < count; ++i ) |
|
4305 |
{ |
|
4306 |
CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
4307 |
const TDesC8& type = node->Name(); |
|
4308 |
if ( type == XnPropertyNames::action::KTrigger ) |
|
4309 |
{ |
|
4310 |
if ( node && ( IsTriggerRunnableL( *node ) || IsTriggerActiveL( *node ) ) ) |
|
4311 |
{ |
|
4312 |
TBool match = MatchTriggerForKeyEventL( |
|
4313 |
aThis, aEngine, aNode, aKeyEvent, aType, aActionNode, *node ); |
|
4314 |
if ( match ) |
|
4315 |
{ |
|
4316 |
return match; |
|
4317 |
} |
|
4318 |
} |
|
4319 |
} |
|
4320 |
} |
|
4321 |
return EFalse; |
|
4322 |
} |
|
4323 |
||
4324 |
// ----------------------------------------------------------------------------- |
|
4325 |
// IsTriggerActiveL |
|
4326 |
// ----------------------------------------------------------------------------- |
|
4327 |
// |
|
4328 |
static TBool IsTriggerActiveL( CXnDomNode& aNode ) |
|
4329 |
{ |
|
4330 |
CXnDomList& propList = aNode.PropertyList(); |
|
4331 |
TInt count = propList.Length(); |
|
4332 |
for ( TInt j = 0; j < count; j++ ) |
|
4333 |
{ |
|
4334 |
CXnDomProperty* prop = static_cast< CXnDomProperty* >( propList.Item( j ) ); |
|
4335 |
const TDesC8& propName = prop->Name(); |
|
4336 |
if ( propName == XnPropertyNames::style::common::KDisplay ) |
|
4337 |
{ |
|
4338 |
CXnDomList& propValList = prop->PropertyValueList(); |
|
4339 |
TInt propValCount(propValList.Length()); |
|
4340 |
for ( TInt k = 0; k < propValCount; k++ ) |
|
4341 |
{ |
|
4342 |
CXnDomPropertyValue* propVal = |
|
4343 |
static_cast< CXnDomPropertyValue* >( propValList.Item( k ) ); |
|
4344 |
CXnDomPropertyValue::TPrimitiveValueType type = |
|
4345 |
propVal->PrimitiveValueType(); |
|
4346 |
switch ( type ) |
|
4347 |
{ |
|
4348 |
case CXnDomPropertyValue::EString: |
|
4349 |
case CXnDomPropertyValue::EIdent: |
|
4350 |
case CXnDomPropertyValue::EUri: |
|
4351 |
case CXnDomPropertyValue::EAttr: |
|
4352 |
case CXnDomPropertyValue::EUnknown: |
|
4353 |
{ |
|
4354 |
const TDesC8& value = propVal->StringValueL(); |
|
4355 |
if ( value == XnPropertyNames::style::common::display::KNone ) |
|
4356 |
{ |
|
4357 |
return EFalse; |
|
4358 |
} |
|
4359 |
else |
|
4360 |
{ |
|
4361 |
return ETrue; |
|
4362 |
} |
|
4363 |
} |
|
4364 |
} |
|
4365 |
} |
|
4366 |
} |
|
4367 |
} |
|
4368 |
return ETrue; |
|
4369 |
} |
|
4370 |
||
4371 |
// ----------------------------------------------------------------------------- |
|
4372 |
// MatchActionForEventL |
|
4373 |
// ----------------------------------------------------------------------------- |
|
4374 |
// |
|
4375 |
static TBool MatchActionForEventL( |
|
4376 |
CXnNodeImpl* aThis, |
|
4377 |
CXnUiEngine& aEngine, |
|
4378 |
CXnNode& aNode, |
|
4379 |
CXnNode& aEventData, |
|
4380 |
CXnDomNode& aActionNode, |
|
4381 |
TInt aSource ) |
|
4382 |
{ |
|
4383 |
CXnDomList& children = aActionNode.ChildNodes(); |
|
4384 |
TInt count = children.Length(); |
|
4385 |
for ( TInt i = 0; i < count; ++i ) |
|
4386 |
{ |
|
4387 |
CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
4388 |
const TDesC8& type = node->Name(); |
|
4389 |
if ( type == XnPropertyNames::action::KTrigger && |
|
4390 |
node && IsTriggerRunnableL( *node ) ) |
|
4391 |
{ |
|
4392 |
TBool match = MatchTriggerForEventL( |
|
4393 |
aThis, aEngine, aNode, aEventData, aActionNode, *node, aSource ); |
|
4394 |
if ( match ) |
|
4395 |
{ |
|
4396 |
return match; |
|
4397 |
} |
|
4398 |
} |
|
4399 |
} |
|
4400 |
return EFalse; |
|
4401 |
} |
|
4402 |
||
4403 |
// ----------------------------------------------------------------------------- |
|
4404 |
// FindLoopedFocusableNodeL |
|
4405 |
// ----------------------------------------------------------------------------- |
|
4406 |
// |
|
4407 |
static CXnNode* FindLoopedFocusableNodeL( CXnNode& aNode, TBool aForward ) |
|
4408 |
{ |
|
4409 |
if ( aNode.ViewNodeImpl() ) |
|
4410 |
{ |
|
4411 |
return NULL; |
|
4412 |
} |
|
4413 |
CXnNode* nextNode = NULL; |
|
4414 |
CXnProperty* navLoopProperty = aNode.GetPropertyL( |
|
4415 |
XnPropertyNames::style::common::KS60NavLooping ); |
|
4416 |
if ( navLoopProperty ) |
|
4417 |
{ |
|
4418 |
const TDesC8& loopValue = navLoopProperty->StringValue(); |
|
4419 |
if ( loopValue != KNullDesC8 && |
|
4420 |
loopValue == XnPropertyNames::style::common::s60_focus_looping::KStop ) |
|
4421 |
{ |
|
4422 |
return NULL; |
|
4423 |
} |
|
4424 |
} |
|
4425 |
if ( aForward ) |
|
4426 |
{ |
|
4427 |
nextNode = ForwardLoopL( aNode ); |
|
4428 |
} |
|
4429 |
else |
|
4430 |
{ |
|
4431 |
nextNode = BackwardLoopL( aNode ); |
|
4432 |
} |
|
4433 |
return nextNode; |
|
4434 |
} |
|
4435 |
||
4436 |
// ----------------------------------------------------------------------------- |
|
4437 |
// GetNavIndexL |
|
4438 |
// ----------------------------------------------------------------------------- |
|
4439 |
// |
|
4440 |
static CXnDomPropertyValue* GetNavIndexL( CXnNode& aNode ) |
|
4441 |
{ |
|
4442 |
CXnProperty* navIndexProperty = aNode.NavIndexL(); |
|
4443 |
CXnDomPropertyValue* value = NULL; |
|
4444 |
if ( navIndexProperty ) |
|
4445 |
{ |
|
4446 |
value = static_cast< CXnDomPropertyValue* >( |
|
4447 |
navIndexProperty->Property()->PropertyValueList().Item( 0 ) ); |
|
4448 |
} |
|
4449 |
return value; |
|
4450 |
} |
|
4451 |
||
4452 |
// ----------------------------------------------------------------------------- |
|
4453 |
// ForwardL |
|
4454 |
// ----------------------------------------------------------------------------- |
|
4455 |
// |
|
4456 |
static CXnNode* ForwardL( CXnNode& aNode ) |
|
4457 |
{ |
|
4458 |
RPointerArray< CXnNode >& siblings = aNode.Parent()->Children(); |
|
4459 |
CXnNode* nextNode = NULL; |
|
4460 |
CXnDomPropertyValue* navIndexValue = GetNavIndexL( aNode ); |
|
4461 |
CXnDomPropertyValue* prevIndexValue = NULL; |
|
4462 |
CXnDomPropertyValue* tmpIndexValue = NULL; |
|
4463 |
TInt count = siblings.Count(); |
|
4464 |
TInt nodePosition = count; |
|
4465 |
TBool first = ETrue; |
|
4466 |
for ( TInt i = 0; i < count; ++i ) |
|
4467 |
{ |
|
4468 |
CXnNode* tmpNode = siblings[i]; |
|
4469 |
if ( tmpNode == &aNode ) |
|
4470 |
{ |
|
4471 |
nodePosition = i; |
|
4472 |
continue; |
|
4473 |
} |
|
4474 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4475 |
{ |
|
4476 |
continue; |
|
4477 |
} |
|
4478 |
tmpIndexValue = GetNavIndexL( *tmpNode ); |
|
4479 |
if ( tmpIndexValue ) |
|
4480 |
{ |
|
4481 |
if ( tmpIndexValue->IsNoneIdent() ) |
|
4482 |
{ |
|
4483 |
// nav index set as none, skipping |
|
4484 |
continue; |
|
4485 |
} |
|
4486 |
} |
|
4487 |
if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) == 0 ) && |
|
4488 |
( first || |
|
4489 |
( CompareNavIndexesL( tmpIndexValue, prevIndexValue ) < 0 ) ) && |
|
4490 |
( i > nodePosition ) ) |
|
4491 |
{ |
|
4492 |
first = EFalse; |
|
4493 |
prevIndexValue = tmpIndexValue; |
|
4494 |
nextNode = tmpNode; |
|
4495 |
} |
|
4496 |
else if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) > 0 ) && |
|
4497 |
( first || |
|
4498 |
( CompareNavIndexesL( tmpIndexValue, prevIndexValue ) < 0 ) ) ) |
|
4499 |
{ |
|
4500 |
first = EFalse; |
|
4501 |
prevIndexValue = tmpIndexValue; |
|
4502 |
nextNode = tmpNode; |
|
4503 |
} |
|
4504 |
} |
|
4505 |
return nextNode; |
|
4506 |
} |
|
4507 |
||
4508 |
// ----------------------------------------------------------------------------- |
|
4509 |
// ForwardLoopL |
|
4510 |
// ----------------------------------------------------------------------------- |
|
4511 |
// |
|
4512 |
static CXnNode* ForwardLoopL( CXnNode& aNode ) |
|
4513 |
{ |
|
4514 |
RPointerArray< CXnNode >& siblings = aNode.Parent()->Children(); |
|
4515 |
CXnNode* nextNode = NULL; |
|
4516 |
CXnDomPropertyValue* navIndexValue = GetNavIndexL( aNode ); |
|
4517 |
CXnDomPropertyValue* tmpIndexValue = NULL; |
|
4518 |
CXnDomPropertyValue* prevIndexValue = NULL; |
|
4519 |
TInt count = siblings.Count(); |
|
4520 |
TInt nodePosition = count; |
|
4521 |
TBool first = ETrue; |
|
4522 |
for ( TInt i = 0; i < count; ++i ) |
|
4523 |
{ |
|
4524 |
CXnNode* tmpNode = siblings[i]; |
|
4525 |
if ( tmpNode == &aNode ) |
|
4526 |
{ |
|
4527 |
nodePosition = i; |
|
4528 |
continue; |
|
4529 |
} |
|
4530 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4531 |
{ |
|
4532 |
continue; |
|
4533 |
} |
|
4534 |
tmpIndexValue = GetNavIndexL( *tmpNode ); |
|
4535 |
if ( tmpIndexValue ) |
|
4536 |
{ |
|
4537 |
if ( tmpIndexValue->IsNoneIdent() ) |
|
4538 |
{ |
|
4539 |
// nav index set as none, skipping |
|
4540 |
continue; |
|
4541 |
} |
|
4542 |
} |
|
4543 |
if ( ( CompareNavIndexesL( navIndexValue, tmpIndexValue ) == 0 ) && |
|
4544 |
( first || |
|
4545 |
( CompareNavIndexesL( tmpIndexValue, prevIndexValue ) < 0 ) ) && |
|
4546 |
( i < nodePosition ) ) |
|
4547 |
{ |
|
4548 |
first = EFalse; |
|
4549 |
prevIndexValue = tmpIndexValue; |
|
4550 |
nextNode = tmpNode; |
|
4551 |
} |
|
4552 |
else if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) < 0 ) && |
|
4553 |
( first || |
|
4554 |
( CompareNavIndexesL( tmpIndexValue, prevIndexValue ) < 0 ) ) ) |
|
4555 |
{ |
|
4556 |
first = EFalse; |
|
4557 |
prevIndexValue = tmpIndexValue; |
|
4558 |
nextNode = tmpNode; |
|
4559 |
} |
|
4560 |
} |
|
4561 |
return nextNode; |
|
4562 |
} |
|
4563 |
||
4564 |
// ----------------------------------------------------------------------------- |
|
4565 |
// BackwardL |
|
4566 |
// ----------------------------------------------------------------------------- |
|
4567 |
// |
|
4568 |
static CXnNode* BackwardL( CXnNode& aNode ) |
|
4569 |
{ |
|
4570 |
RPointerArray< CXnNode >& siblings = aNode.Parent()->Children(); |
|
4571 |
CXnNode* nextNode = NULL; |
|
4572 |
CXnDomPropertyValue* navIndexValue = GetNavIndexL( aNode ); |
|
4573 |
CXnDomPropertyValue* tmpIndexValue = NULL; |
|
4574 |
TInt count = siblings.Count(); |
|
4575 |
CXnDomPropertyValue* nextIndexValue = GetNavIndexL( *siblings[count - 1] ); |
|
4576 |
TInt nodePosition = 0; |
|
4577 |
TBool first = ETrue; |
|
4578 |
for ( TInt i = count - 1; i > -1; --i ) |
|
4579 |
{ |
|
4580 |
CXnNode* tmpNode = siblings[i]; |
|
4581 |
if ( tmpNode == &aNode ) |
|
4582 |
{ |
|
4583 |
nodePosition = i; |
|
4584 |
continue; |
|
4585 |
} |
|
4586 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4587 |
{ |
|
4588 |
continue; |
|
4589 |
} |
|
4590 |
tmpIndexValue = GetNavIndexL( *tmpNode ); |
|
4591 |
if ( tmpIndexValue ) |
|
4592 |
{ |
|
4593 |
if ( tmpIndexValue->IsNoneIdent() ) |
|
4594 |
{ |
|
4595 |
// nav index set as none, skipping |
|
4596 |
continue; |
|
4597 |
} |
|
4598 |
} |
|
4599 |
if ( ( CompareNavIndexesL( navIndexValue, tmpIndexValue ) == 0 ) && |
|
4600 |
( first || |
|
4601 |
( CompareNavIndexesL( tmpIndexValue, nextIndexValue ) > 0 ) ) && |
|
4602 |
( i < nodePosition ) ) |
|
4603 |
{ |
|
4604 |
first = EFalse; |
|
4605 |
nextIndexValue = tmpIndexValue; |
|
4606 |
nextNode = tmpNode; |
|
4607 |
} |
|
4608 |
else if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) < 0 ) && |
|
4609 |
( first || |
|
4610 |
( CompareNavIndexesL( tmpIndexValue, nextIndexValue ) > 0 ) ) ) |
|
4611 |
{ |
|
4612 |
first = EFalse; |
|
4613 |
nextIndexValue = tmpIndexValue; |
|
4614 |
nextNode = tmpNode; |
|
4615 |
} |
|
4616 |
} |
|
4617 |
return nextNode; |
|
4618 |
} |
|
4619 |
||
4620 |
// ----------------------------------------------------------------------------- |
|
4621 |
// BackwardLoopL |
|
4622 |
// ----------------------------------------------------------------------------- |
|
4623 |
// |
|
4624 |
static CXnNode* BackwardLoopL( CXnNode& aNode ) |
|
4625 |
{ |
|
4626 |
RPointerArray<CXnNode>& siblings = aNode.Parent()->Children(); |
|
4627 |
CXnNode* nextNode = NULL; |
|
4628 |
CXnDomPropertyValue* navIndexValue = GetNavIndexL( aNode ); |
|
4629 |
CXnDomPropertyValue* tmpIndexValue = NULL; |
|
4630 |
TInt count = siblings.Count(); |
|
4631 |
CXnDomPropertyValue* nextIndexValue = GetNavIndexL( *siblings[count - 1] ); |
|
4632 |
TInt nodePosition = 0; |
|
4633 |
TBool first = ETrue; |
|
4634 |
for ( TInt i = count - 1; i > -1; --i ) |
|
4635 |
{ |
|
4636 |
CXnNode* tmpNode = siblings[i]; |
|
4637 |
if ( tmpNode == &aNode ) |
|
4638 |
{ |
|
4639 |
nodePosition = i; |
|
4640 |
continue; |
|
4641 |
} |
|
4642 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4643 |
{ |
|
4644 |
continue; |
|
4645 |
} |
|
4646 |
tmpIndexValue = GetNavIndexL( *tmpNode ); |
|
4647 |
if ( tmpIndexValue ) |
|
4648 |
{ |
|
4649 |
if ( tmpIndexValue->IsNoneIdent() ) |
|
4650 |
{ |
|
4651 |
// nav index set as none, skipping |
|
4652 |
continue; |
|
4653 |
} |
|
4654 |
} |
|
4655 |
if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) == 0 ) && |
|
4656 |
( first || |
|
4657 |
( CompareNavIndexesL( tmpIndexValue, nextIndexValue ) > 0 ) ) && |
|
4658 |
( i > nodePosition ) ) |
|
4659 |
{ |
|
4660 |
first = EFalse; |
|
4661 |
nextIndexValue = tmpIndexValue; |
|
4662 |
nextNode = tmpNode; |
|
4663 |
} |
|
4664 |
else if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) > 0 ) && |
|
4665 |
( first || |
|
4666 |
( CompareNavIndexesL( tmpIndexValue, nextIndexValue ) > 0 ) ) ) |
|
4667 |
{ |
|
4668 |
first = EFalse; |
|
4669 |
nextIndexValue = tmpIndexValue; |
|
4670 |
nextNode = tmpNode; |
|
4671 |
} |
|
4672 |
} |
|
4673 |
return nextNode; |
|
4674 |
} |
|
4675 |
||
4676 |
// ----------------------------------------------------------------------------- |
|
4677 |
// CompareNavIndexesL |
|
4678 |
// ----------------------------------------------------------------------------- |
|
4679 |
// |
|
4680 |
static TInt CompareNavIndexesL( |
|
4681 |
CXnDomPropertyValue* aCurrentPropertyValue, |
|
4682 |
CXnDomPropertyValue* aNextPropertyValue ) |
|
4683 |
{ |
|
4684 |
if ( !aCurrentPropertyValue && !aNextPropertyValue ) |
|
4685 |
{ |
|
4686 |
return 0; |
|
4687 |
} |
|
4688 |
else if ( aCurrentPropertyValue && !aNextPropertyValue ) |
|
4689 |
{ |
|
4690 |
if ( aCurrentPropertyValue->IsAutoIdent() ) |
|
4691 |
{ |
|
4692 |
return 0; |
|
4693 |
} |
|
4694 |
return 1; |
|
4695 |
} |
|
4696 |
else if ( !aCurrentPropertyValue && aNextPropertyValue ) |
|
4697 |
{ |
|
4698 |
if ( aNextPropertyValue->IsAutoIdent() ) |
|
4699 |
{ |
|
4700 |
return 0; |
|
4701 |
} |
|
4702 |
return -1; |
|
4703 |
} |
|
4704 |
else if ( aCurrentPropertyValue->IsAutoIdent() && |
|
4705 |
aNextPropertyValue->IsAutoIdent() ) |
|
4706 |
{ |
|
4707 |
return 0; |
|
4708 |
} |
|
4709 |
else if ( !aCurrentPropertyValue->IsAutoIdent() && |
|
4710 |
aNextPropertyValue->IsAutoIdent() ) |
|
4711 |
{ |
|
4712 |
return 1; |
|
4713 |
} |
|
4714 |
else if ( aCurrentPropertyValue->IsAutoIdent() && |
|
4715 |
!aNextPropertyValue->IsAutoIdent() ) |
|
4716 |
{ |
|
4717 |
return -1; |
|
4718 |
} |
|
4719 |
else |
|
4720 |
{ |
|
4721 |
return |
|
4722 |
aCurrentPropertyValue->FloatValueL() < aNextPropertyValue->FloatValueL() ? |
|
4723 |
-1 : |
|
4724 |
aCurrentPropertyValue->FloatValueL() == aNextPropertyValue->FloatValueL() ? |
|
4725 |
0 : |
|
4726 |
1; |
|
4727 |
} |
|
4728 |
} |
|
4729 |
||
4730 |
// ----------------------------------------------------------------------------- |
|
4731 |
// FindNextFocusableNodeByNavIndexL |
|
4732 |
// ----------------------------------------------------------------------------- |
|
4733 |
// |
|
4734 |
static CXnNode* FindNextFocusableNodeByNavIndexL( CXnNode& aNode, TBool aForward ) |
|
4735 |
{ |
|
4736 |
if ( aNode.ViewNodeImpl() ) |
|
4737 |
{ |
|
4738 |
return NULL; |
|
4739 |
} |
|
4740 |
CXnNode* nextNode = NULL; |
|
4741 |
if ( aForward ) |
|
4742 |
{ |
|
4743 |
nextNode = ForwardL( aNode ); |
|
4744 |
} |
|
4745 |
else |
|
4746 |
{ |
|
4747 |
nextNode = BackwardL( aNode ); |
|
4748 |
} |
|
4749 |
return nextNode; |
|
4750 |
} |
|
4751 |
||
4752 |
// ----------------------------------------------------------------------------- |
|
4753 |
// FindNextFocusableNodeL |
|
4754 |
// ----------------------------------------------------------------------------- |
|
4755 |
// |
|
4756 |
TBool FindNextFocusableNodeL( CXnNode& aNode, TBool aForward ) |
|
4757 |
{ |
|
4758 |
CXnNode* node( FindNextFocusableNodeByNavIndexL( aNode, aForward ) ); |
|
4759 |
||
4760 |
if ( !node ) |
|
4761 |
{ |
|
4762 |
node = FindLoopedFocusableNodeL( aNode, aForward ); |
|
4763 |
} |
|
4764 |
||
4765 |
if ( node ) |
|
4766 |
{ |
|
4767 |
node->SetStateL( XnPropertyNames::style::common::KFocus ); |
|
4768 |
if( node && node->ScrollableControl() ) |
|
4769 |
{ |
|
4770 |
node->ScrollableControl()->ShowItem( *node ); |
|
4771 |
} |
|
4772 |
return ETrue; |
|
4773 |
} |
|
4774 |
||
4775 |
return EFalse; |
|
4776 |
} |
|
4777 |
||
4778 |
// ----------------------------------------------------------------------------- |
|
4779 |
// FindNextNodeFromRightL |
|
4780 |
// ----------------------------------------------------------------------------- |
|
4781 |
// |
|
4782 |
static CXnNode* FindNextNodeFromRightL( |
|
4783 |
RPointerArray< CXnNode >& aArray, |
|
4784 |
CXnNode& aNode, |
|
4785 |
TBool stayInNamespace, |
|
4786 |
CXnUiEngine* aEngine ) |
|
4787 |
{ |
|
4788 |
CXnNode* nextNode = NULL; |
|
4789 |
TRect rect = aNode.PaddingRect(); |
|
4790 |
||
4791 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
4792 |
{ |
|
4793 |
CXnNode* tmpNode = aArray[i]; |
|
4794 |
if ( tmpNode == &aNode ) |
|
4795 |
{ |
|
4796 |
continue; |
|
4797 |
} |
|
4798 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4799 |
{ |
|
4800 |
continue; |
|
4801 |
} |
|
4802 |
if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
4803 |
{ |
|
4804 |
// do not shift focus to another view |
|
4805 |
continue; |
|
4806 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4807 |
if( aEngine->IsEditMode() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4808 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4809 |
if( !IsPluginNode( *tmpNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4810 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4811 |
// move only between "plugin" nodes in edit mode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4812 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4813 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4814 |
} |
34 | 4815 |
|
4816 |
const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
4817 |
const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
4818 |
||
4819 |
if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
4820 |
{ |
|
4821 |
// if staying in the same namespace is required, |
|
4822 |
// do not shift focus to a different namespace |
|
4823 |
continue; |
|
4824 |
} |
|
4825 |
||
4826 |
// TODO: only plugin widgets are available in edit mode |
|
4827 |
||
4828 |
TRect tmpRect = tmpNode->PaddingRect(); |
|
4829 |
||
4830 |
// temp node qualification: |
|
4831 |
// 1. left edge of temp node is to the right from focused's right edge |
|
4832 |
// 2. top edge of temp node is NOT below the bottom edge of focused node |
|
4833 |
// 3. bottom edge of temp node is NOT above the top edge of focused node |
|
4834 |
if ( rect.iBr.iX - 1 < tmpRect.iTl.iX && |
|
4835 |
rect.iBr.iY - 1 >= tmpRect.iTl.iY && |
|
4836 |
rect.iTl.iY <= tmpRect.iBr.iY - 1 ) |
|
4837 |
{ |
|
4838 |
if ( !nextNode ) |
|
4839 |
{ |
|
4840 |
nextNode = tmpNode; |
|
4841 |
} |
|
4842 |
else |
|
4843 |
{ |
|
4844 |
// left edge of temp node is closer to focused than next node's |
|
4845 |
// left edge |
|
4846 |
if ( tmpRect.iTl.iX < nextNode->PaddingRect().iTl.iX ) |
|
4847 |
{ |
|
4848 |
nextNode = tmpNode; |
|
4849 |
continue; |
|
4850 |
} |
|
4851 |
// left edge of temp and next are at the same level |
|
4852 |
else if ( tmpRect.iTl.iX == nextNode->PaddingRect().iTl.iX ) |
|
4853 |
{ |
|
4854 |
// top edges are at the same level, choose this one |
|
4855 |
if ( tmpRect.iTl.iY == rect.iTl.iY ) |
|
4856 |
{ |
|
4857 |
nextNode = tmpNode; |
|
4858 |
continue; |
|
4859 |
} |
|
4860 |
// top edges are not at the same level |
|
4861 |
else |
|
4862 |
{ |
|
4863 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
4864 |
{ |
|
4865 |
// candidate's top edge is below focused's top edge |
|
4866 |
// and previous candidate's top edge is above |
|
4867 |
// focused's top edge |
|
4868 |
if ( nextNode->PaddingRect().iTl.iY < rect.iTl.iY && |
|
4869 |
tmpRect.iTl.iY > rect.iTl.iY ) |
|
4870 |
{ |
|
4871 |
nextNode = tmpNode; |
|
4872 |
continue; |
|
4873 |
} |
|
4874 |
// previous candidate's top edge is below focused's |
|
4875 |
// top edge. Also, candidate's top edge is below |
|
4876 |
// focused's top edge. Select the highest one. |
|
4877 |
else if ( nextNode->PaddingRect().iTl.iY > rect.iTl.iY && |
|
4878 |
tmpRect.iTl.iY > rect.iTl.iY && |
|
4879 |
tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
4880 |
{ |
|
4881 |
nextNode = tmpNode; |
|
4882 |
continue; |
|
4883 |
} |
|
4884 |
} |
|
4885 |
else // arabic/hebrew layout |
|
4886 |
{ |
|
4887 |
// candidate's top edge is above focused's top edge |
|
4888 |
// and previous candidate's top edge is below |
|
4889 |
// focused's top edge |
|
4890 |
if ( nextNode->PaddingRect().iTl.iY > rect.iTl.iY && |
|
4891 |
tmpRect.iTl.iY < rect.iTl.iY ) |
|
4892 |
{ |
|
4893 |
nextNode = tmpNode; |
|
4894 |
continue; |
|
4895 |
} |
|
4896 |
// candidate's and previous' top edge is below focused's |
|
4897 |
// top edge. Select the highest one. |
|
4898 |
else if ( nextNode->PaddingRect().iTl.iY > rect.iTl.iY && |
|
4899 |
tmpRect.iTl.iY > rect.iTl.iY && |
|
4900 |
tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
4901 |
{ |
|
4902 |
nextNode = tmpNode; |
|
4903 |
continue; |
|
4904 |
} |
|
4905 |
} |
|
4906 |
} |
|
4907 |
} |
|
4908 |
else |
|
4909 |
{ |
|
4910 |
continue; |
|
4911 |
} |
|
4912 |
} |
|
4913 |
} |
|
4914 |
} |
|
4915 |
||
4916 |
// find node below or above to the right |
|
4917 |
if ( !nextNode ) |
|
4918 |
{ |
|
4919 |
CXnNode* candidateAbove = NULL; |
|
4920 |
CXnNode* candidateBelow = NULL; |
|
4921 |
||
4922 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
4923 |
{ |
|
4924 |
CXnNode* tmpNode = aArray[i]; |
|
4925 |
if ( tmpNode == &aNode ) |
|
4926 |
{ |
|
4927 |
continue; |
|
4928 |
} |
|
4929 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4930 |
{ |
|
4931 |
continue; |
|
4932 |
} |
|
4933 |
if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
4934 |
{ |
|
4935 |
// do not shift focus to another view |
|
4936 |
continue; |
|
4937 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4938 |
if( aEngine->IsEditMode() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4939 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4940 |
if( !IsPluginNode( *tmpNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4941 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4942 |
// move only between "plugin" nodes in edit mode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4943 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4944 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
4945 |
} |
34 | 4946 |
|
4947 |
const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
4948 |
const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
4949 |
||
4950 |
if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
4951 |
{ |
|
4952 |
// if staying in the same namespace is required, |
|
4953 |
// do not shift focus to a different namespace |
|
4954 |
continue; |
|
4955 |
} |
|
4956 |
// TODO: only plugin widgets are available in edit mode |
|
4957 |
||
4958 |
TRect tmpRect = tmpNode->PaddingRect(); |
|
4959 |
||
4960 |
// temp node qualification: |
|
4961 |
// left edge of temp node is to the right from focused's right edge |
|
4962 |
if ( rect.iBr.iX - 1 < tmpRect.iTl.iX ) |
|
4963 |
{ |
|
4964 |
// tmp is above the focused node |
|
4965 |
if ( tmpRect.iBr.iY - 1 < rect.iTl.iY ) |
|
4966 |
{ |
|
4967 |
if ( candidateAbove == NULL ) |
|
4968 |
{ |
|
4969 |
candidateAbove = tmpNode; |
|
4970 |
} |
|
4971 |
else |
|
4972 |
{ |
|
4973 |
// use pythagorean theorem to determine the closest node |
|
4974 |
TInt xDistTmp = tmpRect.iTl.iX - rect.iBr.iX; |
|
4975 |
TInt yDistTmp = tmpRect.iBr.iY - rect.iTl.iY; |
|
4976 |
TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
4977 |
||
4978 |
TInt xCand = candidateAbove->PaddingRect().iTl.iX - rect.iBr.iX; |
|
4979 |
TInt yCand = candidateAbove->PaddingRect().iBr.iY - rect.iTl.iY; |
|
4980 |
TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
4981 |
||
4982 |
if ( tmpDist < cDist ) |
|
4983 |
{ |
|
4984 |
candidateAbove = tmpNode; |
|
4985 |
} |
|
4986 |
} |
|
4987 |
} |
|
4988 |
else |
|
4989 |
{ |
|
4990 |
if ( candidateBelow == NULL ) |
|
4991 |
{ |
|
4992 |
candidateBelow = tmpNode; |
|
4993 |
} |
|
4994 |
else |
|
4995 |
{ |
|
4996 |
// use pythagorean theorem to determine the closest node |
|
4997 |
TInt xDistTmp = tmpRect.iTl.iX - rect.iBr.iX; |
|
4998 |
TInt yDistTmp = tmpRect.iTl.iY - rect.iBr.iY; |
|
4999 |
TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5000 |
||
5001 |
TInt xCand = candidateBelow->PaddingRect().iTl.iX - rect.iBr.iX; |
|
5002 |
TInt yCand = candidateBelow->PaddingRect().iTl.iY - rect.iBr.iY; |
|
5003 |
TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5004 |
||
5005 |
if ( tmpDist < cDist ) |
|
5006 |
{ |
|
5007 |
candidateBelow = tmpNode; |
|
5008 |
} |
|
5009 |
} |
|
5010 |
} |
|
5011 |
} |
|
5012 |
} |
|
5013 |
||
5014 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5015 |
{ |
|
5016 |
if ( candidateBelow ) |
|
5017 |
{ |
|
5018 |
nextNode = candidateBelow; |
|
5019 |
} |
|
5020 |
else |
|
5021 |
{ |
|
5022 |
if ( candidateAbove ) |
|
5023 |
{ |
|
5024 |
nextNode = candidateAbove; |
|
5025 |
} |
|
5026 |
} |
|
5027 |
} |
|
5028 |
else |
|
5029 |
{ |
|
5030 |
if ( candidateAbove ) |
|
5031 |
{ |
|
5032 |
nextNode = candidateAbove; |
|
5033 |
} |
|
5034 |
else |
|
5035 |
{ |
|
5036 |
if ( candidateBelow ) |
|
5037 |
{ |
|
5038 |
nextNode = candidateBelow; |
|
5039 |
} |
|
5040 |
} |
|
5041 |
} |
|
5042 |
} |
|
5043 |
||
5044 |
// loop to the right |
|
5045 |
if ( !nextNode ) |
|
5046 |
{ |
|
5047 |
if ( !stayInNamespace && aEngine && |
|
5048 |
aEngine->ViewManager()->ViewAmount() != KOneView ) |
|
5049 |
{ |
|
5050 |
aEngine->ViewManager()->ActivateNextViewL(); |
|
5051 |
return nextNode; |
|
5052 |
} |
|
5053 |
||
5054 |
CXnNode* candidateAbove = NULL; |
|
5055 |
CXnNode* candidateBelow = NULL; |
|
5056 |
||
5057 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5058 |
{ |
|
5059 |
CXnNode* tmpNode = aArray[i]; |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5060 |
|
34 | 5061 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
5062 |
{ |
|
5063 |
continue; |
|
5064 |
} |
|
5065 |
if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5066 |
{ |
|
5067 |
// do not shift focus to another view |
|
5068 |
continue; |
|
5069 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5070 |
if( aEngine->IsEditMode() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5071 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5072 |
if( !IsPluginNode( *tmpNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5073 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5074 |
// move only between "plugin" nodes in edit mode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5075 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5076 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5077 |
} |
34 | 5078 |
|
5079 |
const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5080 |
const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5081 |
||
5082 |
if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5083 |
{ |
|
5084 |
// if staying in the same namespace is required, |
|
5085 |
// do not shift focus to a different namespace |
|
5086 |
continue; |
|
5087 |
} |
|
5088 |
||
5089 |
// TODO: only plugin widgets are available in edit mode |
|
5090 |
TRect tmpRect = tmpNode->PaddingRect(); |
|
5091 |
||
5092 |
// tmp is above the focused node |
|
5093 |
if ( tmpRect.iBr.iY <= rect.iTl.iY ) |
|
5094 |
{ |
|
5095 |
if ( candidateAbove == NULL ) |
|
5096 |
{ |
|
5097 |
candidateAbove = tmpNode; |
|
5098 |
} |
|
5099 |
else |
|
5100 |
{ |
|
5101 |
// use pythagorean theorem to determine the closest node |
|
5102 |
TInt xDistTmp = tmpRect.iTl.iX; |
|
5103 |
TInt yDistTmp = tmpRect.iTl.iY - rect.iTl.iY; |
|
5104 |
TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5105 |
||
5106 |
TInt xCand = candidateAbove->PaddingRect().iTl.iX; |
|
5107 |
TInt yCand = candidateAbove->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5108 |
TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5109 |
||
5110 |
if ( tmpDist < cDist ) |
|
5111 |
{ |
|
5112 |
candidateAbove = tmpNode; |
|
5113 |
} |
|
5114 |
} |
|
5115 |
} |
|
5116 |
else |
|
5117 |
{ |
|
5118 |
if ( candidateBelow == NULL ) |
|
5119 |
{ |
|
5120 |
candidateBelow = tmpNode; |
|
5121 |
} |
|
5122 |
else |
|
5123 |
{ |
|
5124 |
// use pythagorean theorem to determine the closest node |
|
5125 |
TInt xDistTmp = tmpRect.iTl.iX; |
|
5126 |
TInt yDistTmp = rect.iTl.iY - tmpRect.iTl.iY; |
|
5127 |
TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5128 |
||
5129 |
TInt xCand = candidateBelow->PaddingRect().iTl.iX; |
|
5130 |
TInt yCand = rect.iTl.iY - candidateBelow->PaddingRect().iTl.iY; |
|
5131 |
TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5132 |
||
5133 |
if ( tmpDist < cDist ) |
|
5134 |
{ |
|
5135 |
candidateBelow = tmpNode; |
|
5136 |
} |
|
5137 |
} |
|
5138 |
} |
|
5139 |
} |
|
5140 |
||
5141 |
if ( candidateAbove && candidateBelow ) |
|
5142 |
{ |
|
5143 |
CXnNode* pluginAbove = FindPluginNode( *candidateAbove ); |
|
5144 |
CXnNode* pluginBelow = FindPluginNode( *candidateBelow ); |
|
5145 |
||
5146 |
TReal aboveDist = 0; |
|
5147 |
TReal belowDist = 0; |
|
5148 |
||
5149 |
if ( pluginAbove ) |
|
5150 |
{ |
|
5151 |
TInt xAbove = pluginAbove->PaddingRect().iTl.iX; |
|
5152 |
TInt yAbove = 0; |
|
5153 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5154 |
{ |
|
5155 |
yAbove = rect.iTl.iY - pluginAbove->PaddingRect().iTl.iY; |
|
5156 |
} |
|
5157 |
else |
|
5158 |
{ |
|
5159 |
yAbove = rect.iTl.iY - pluginAbove->PaddingRect().iBr.iY; |
|
5160 |
} |
|
5161 |
aboveDist = Abs( ( xAbove * xAbove ) + ( yAbove * yAbove ) ); |
|
5162 |
} |
|
5163 |
else |
|
5164 |
{ |
|
5165 |
TInt xAbove = candidateAbove->PaddingRect().iTl.iX; |
|
5166 |
TInt yAbove = 0; |
|
5167 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5168 |
{ |
|
5169 |
yAbove = rect.iTl.iY - candidateAbove->PaddingRect().iTl.iY; |
|
5170 |
} |
|
5171 |
else |
|
5172 |
{ |
|
5173 |
yAbove = rect.iTl.iY - candidateAbove->PaddingRect().iBr.iY; |
|
5174 |
} |
|
5175 |
||
5176 |
aboveDist = Abs( ( xAbove * xAbove ) + ( yAbove * yAbove ) ); |
|
5177 |
} |
|
5178 |
||
5179 |
if ( pluginBelow ) |
|
5180 |
{ |
|
5181 |
TInt xBelow = pluginBelow->PaddingRect().iTl.iX; |
|
5182 |
TInt yBelow = pluginBelow->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5183 |
belowDist = Abs( ( xBelow * xBelow ) + ( yBelow * yBelow ) ); |
|
5184 |
} |
|
5185 |
else |
|
5186 |
{ |
|
5187 |
TInt xBelow = candidateBelow->PaddingRect().iTl.iX; |
|
5188 |
TInt yBelow = candidateBelow->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5189 |
belowDist = Abs( ( xBelow * xBelow ) + ( yBelow * yBelow ) ); |
|
5190 |
} |
|
5191 |
||
5192 |
if ( aboveDist < belowDist ) |
|
5193 |
{ |
|
5194 |
nextNode = candidateAbove; |
|
5195 |
} |
|
5196 |
else if ( belowDist < aboveDist ) |
|
5197 |
{ |
|
5198 |
nextNode = candidateBelow; |
|
5199 |
} |
|
5200 |
else |
|
5201 |
{ |
|
5202 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5203 |
{ |
|
5204 |
nextNode = candidateBelow; |
|
5205 |
} |
|
5206 |
else |
|
5207 |
{ |
|
5208 |
nextNode = candidateAbove; |
|
5209 |
} |
|
5210 |
} |
|
5211 |
} |
|
5212 |
else if ( candidateAbove ) |
|
5213 |
{ |
|
5214 |
nextNode = candidateAbove; |
|
5215 |
} |
|
5216 |
else if ( candidateBelow ) |
|
5217 |
{ |
|
5218 |
nextNode = candidateBelow; |
|
5219 |
} |
|
5220 |
else |
|
5221 |
{ |
|
5222 |
// do nothing |
|
5223 |
} |
|
5224 |
} |
|
5225 |
||
5226 |
if ( stayInNamespace && !nextNode ) |
|
5227 |
{ |
|
5228 |
return &aNode; |
|
5229 |
} |
|
5230 |
||
5231 |
return nextNode; |
|
5232 |
} |
|
5233 |
||
5234 |
// ----------------------------------------------------------------------------- |
|
5235 |
// FindNextNodeFromLeftL |
|
5236 |
// ----------------------------------------------------------------------------- |
|
5237 |
// |
|
5238 |
static CXnNode* FindNextNodeFromLeftL( |
|
5239 |
RPointerArray< CXnNode >& aArray, |
|
5240 |
CXnNode& aNode, |
|
5241 |
TBool stayInNamespace, |
|
5242 |
CXnUiEngine* aEngine ) |
|
5243 |
{ |
|
5244 |
CXnNode* nextNode = NULL; |
|
5245 |
TRect rect = aNode.PaddingRect(); |
|
5246 |
||
5247 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5248 |
{ |
|
5249 |
CXnNode* tmpNode = aArray[i]; |
|
5250 |
if ( tmpNode == &aNode ) |
|
5251 |
{ |
|
5252 |
continue; |
|
5253 |
} |
|
5254 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5255 |
{ |
|
5256 |
continue; |
|
5257 |
} |
|
5258 |
if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5259 |
{ |
|
5260 |
// do not shift focus to another view |
|
5261 |
continue; |
|
5262 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5263 |
if( aEngine->IsEditMode() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5264 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5265 |
if( !IsPluginNode( *tmpNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5266 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5267 |
// move only between "plugin" nodes in edit mode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5268 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5269 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5270 |
} |
34 | 5271 |
|
5272 |
const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5273 |
const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5274 |
||
5275 |
if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5276 |
{ |
|
5277 |
// if staying in the same namespace is required, |
|
5278 |
// do not shift focus to a different namespace |
|
5279 |
continue; |
|
5280 |
} |
|
5281 |
||
5282 |
// TODO: only plugin widgets are available in edit mode |
|
5283 |
||
5284 |
TRect tmpRect = tmpNode->PaddingRect(); |
|
5285 |
||
5286 |
// temp node qualification: |
|
5287 |
// 1. right edge of temp node is to the left from focused's left edge |
|
5288 |
// 2. top edge of temp node is NOT below the bottom edge of focused node |
|
5289 |
// 3. bottom edge of temp node is NOT above the top edge of focused node |
|
5290 |
if ( rect.iTl.iX > tmpRect.iBr.iX - 1 && |
|
5291 |
rect.iBr.iY - 1 >= tmpRect.iTl.iY && |
|
5292 |
rect.iTl.iY <= tmpRect.iBr.iY - 1 ) |
|
5293 |
{ |
|
5294 |
if ( !nextNode ) |
|
5295 |
{ |
|
5296 |
nextNode = tmpNode; |
|
5297 |
} |
|
5298 |
else |
|
5299 |
{ |
|
5300 |
// right edge of temp node is closer to focused than next node's |
|
5301 |
// right edge |
|
5302 |
if ( tmpRect.iBr.iX - 1 > nextNode->PaddingRect().iBr.iX - 1 ) |
|
5303 |
{ |
|
5304 |
nextNode = tmpNode; |
|
5305 |
continue; |
|
5306 |
} |
|
5307 |
// left edge of temp and next are at the same level |
|
5308 |
else if ( tmpRect.iBr.iX - 1 == nextNode->PaddingRect().iBr.iX - 1 ) |
|
5309 |
{ |
|
5310 |
// top edges are at the same level, choose this one |
|
5311 |
if ( tmpRect.iTl.iY == rect.iTl.iY ) |
|
5312 |
{ |
|
5313 |
nextNode = tmpNode; |
|
5314 |
continue; |
|
5315 |
} |
|
5316 |
// top edges are not at the same level |
|
5317 |
else |
|
5318 |
{ |
|
5319 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5320 |
{ |
|
5321 |
// candidate's top edge is below focused's top edge |
|
5322 |
// and previous candidate's top edge is above focused's |
|
5323 |
// top edge |
|
5324 |
if ( nextNode->PaddingRect().iTl.iY > rect.iTl.iY && |
|
5325 |
tmpRect.iTl.iY < rect.iTl.iY ) |
|
5326 |
{ |
|
5327 |
nextNode = tmpNode; |
|
5328 |
continue; |
|
5329 |
} |
|
5330 |
// candidate's and previous candidate's top edge is |
|
5331 |
// above focused's top edge. Select highest one. |
|
5332 |
else if ( nextNode->PaddingRect().iTl.iY < rect.iTl.iY && |
|
5333 |
tmpRect.iTl.iY < rect.iTl.iY && |
|
5334 |
tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
5335 |
{ |
|
5336 |
nextNode = tmpNode; |
|
5337 |
continue; |
|
5338 |
} |
|
5339 |
} |
|
5340 |
else // arabic/hebrew layout |
|
5341 |
{ |
|
5342 |
// candidate's top edge is below focused's top edge |
|
5343 |
// and previous candidate's top edge is above |
|
5344 |
// focused's top edge |
|
5345 |
if ( nextNode->PaddingRect().iTl.iY < rect.iTl.iY && |
|
5346 |
tmpRect.iTl.iY > rect.iTl.iY ) |
|
5347 |
{ |
|
5348 |
nextNode = tmpNode; |
|
5349 |
continue; |
|
5350 |
} |
|
5351 |
// previous candidate's top edge is below focused's |
|
5352 |
// top edge. Also, candidate's top edge is below |
|
5353 |
// focused's top edge. Select the highest one. |
|
5354 |
else if ( nextNode->PaddingRect().iTl.iY > rect.iTl.iY && |
|
5355 |
tmpRect.iTl.iY > rect.iTl.iY && |
|
5356 |
tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
5357 |
{ |
|
5358 |
nextNode = tmpNode; |
|
5359 |
continue; |
|
5360 |
} |
|
5361 |
} |
|
5362 |
} |
|
5363 |
} |
|
5364 |
else |
|
5365 |
{ |
|
5366 |
continue; |
|
5367 |
} |
|
5368 |
} |
|
5369 |
} |
|
5370 |
} |
|
5371 |
||
5372 |
if ( !nextNode ) |
|
5373 |
{ |
|
5374 |
CXnNode* candidateAbove = NULL; |
|
5375 |
CXnNode* candidateBelow = NULL; |
|
5376 |
||
5377 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5378 |
{ |
|
5379 |
CXnNode* tmpNode = aArray[i]; |
|
5380 |
if ( tmpNode == &aNode ) |
|
5381 |
{ |
|
5382 |
continue; |
|
5383 |
} |
|
5384 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5385 |
{ |
|
5386 |
continue; |
|
5387 |
} |
|
5388 |
if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5389 |
{ |
|
5390 |
// do not shift focus to another view |
|
5391 |
continue; |
|
5392 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5393 |
if( aEngine->IsEditMode() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5394 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5395 |
if( !IsPluginNode( *tmpNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5396 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5397 |
// move only between "plugin" nodes in edit mode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5398 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5399 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5400 |
} |
34 | 5401 |
|
5402 |
const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5403 |
const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5404 |
||
5405 |
if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5406 |
{ |
|
5407 |
// if staying in the same namespace is required, |
|
5408 |
// do not shift focus to a different namespace |
|
5409 |
continue; |
|
5410 |
} |
|
5411 |
||
5412 |
// TODO: only plugin widgets are available in edit mode |
|
5413 |
TRect tmpRect = tmpNode->PaddingRect(); |
|
5414 |
||
5415 |
// temp node qualification: |
|
5416 |
// right edge of temp node is to the left from focused's left edge |
|
5417 |
if ( tmpRect.iBr.iX < rect.iTl.iX - 1 ) |
|
5418 |
{ |
|
5419 |
// tmp is above the focused node |
|
5420 |
if ( tmpRect.iBr.iY < rect.iTl.iY ) |
|
5421 |
{ |
|
5422 |
if ( candidateAbove == NULL ) |
|
5423 |
{ |
|
5424 |
candidateAbove = tmpNode; |
|
5425 |
} |
|
5426 |
else |
|
5427 |
{ |
|
5428 |
// use pythagorean theorem to determine the closest node |
|
5429 |
TInt xDistTmp = rect.iTl.iX - tmpRect.iBr.iX; |
|
5430 |
TInt yDistTmp = rect.iTl.iY - tmpRect.iBr.iY; |
|
5431 |
TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5432 |
||
5433 |
TInt xCand = rect.iTl.iX - candidateAbove->PaddingRect().iTl.iX; |
|
5434 |
TInt yCand = rect.iTl.iY - candidateAbove->PaddingRect().iBr.iY; |
|
5435 |
TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5436 |
||
5437 |
if ( tmpDist < cDist ) |
|
5438 |
{ |
|
5439 |
candidateAbove = tmpNode; |
|
5440 |
} |
|
5441 |
} |
|
5442 |
} |
|
5443 |
else |
|
5444 |
{ |
|
5445 |
if ( candidateBelow == NULL ) |
|
5446 |
{ |
|
5447 |
candidateBelow = tmpNode; |
|
5448 |
} |
|
5449 |
else |
|
5450 |
{ |
|
5451 |
// use pythagorean theorem to determine the closest node |
|
5452 |
TInt xDistTmp = rect.iTl.iX - tmpRect.iBr.iX; |
|
5453 |
TInt yDistTmp = rect.iBr.iY - tmpRect.iTl.iY; |
|
5454 |
TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5455 |
||
5456 |
TInt xCand = rect.iTl.iX - candidateBelow->PaddingRect().iBr.iX; |
|
5457 |
TInt yCand = rect.iBr.iY - candidateBelow->PaddingRect().iTl.iY; |
|
5458 |
TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5459 |
||
5460 |
if ( tmpDist < cDist ) |
|
5461 |
{ |
|
5462 |
candidateBelow = tmpNode; |
|
5463 |
} |
|
5464 |
} |
|
5465 |
} |
|
5466 |
} |
|
5467 |
} |
|
5468 |
||
5469 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5470 |
{ |
|
5471 |
if ( candidateAbove ) |
|
5472 |
{ |
|
5473 |
nextNode = candidateAbove; |
|
5474 |
} |
|
5475 |
else |
|
5476 |
{ |
|
5477 |
if ( candidateBelow ) |
|
5478 |
{ |
|
5479 |
nextNode = candidateBelow; |
|
5480 |
} |
|
5481 |
} |
|
5482 |
} |
|
5483 |
else |
|
5484 |
{ |
|
5485 |
if ( candidateBelow ) |
|
5486 |
{ |
|
5487 |
nextNode = candidateBelow; |
|
5488 |
} |
|
5489 |
else |
|
5490 |
{ |
|
5491 |
if ( candidateAbove ) |
|
5492 |
{ |
|
5493 |
nextNode = candidateAbove; |
|
5494 |
} |
|
5495 |
} |
|
5496 |
} |
|
5497 |
} |
|
5498 |
||
5499 |
// get view width to get looping x point |
|
5500 |
TInt viewWidth = aNode.FindViewNode()->PaddingRect().Width(); |
|
5501 |
||
5502 |
// loop to the left |
|
5503 |
if ( !nextNode ) |
|
5504 |
{ |
|
5505 |
if ( !stayInNamespace && aEngine && |
|
5506 |
aEngine->ViewManager()->ViewAmount() != KOneView ) |
|
5507 |
{ |
|
5508 |
aEngine->ViewManager()->ActivatePreviousViewL(); |
|
5509 |
return nextNode; |
|
5510 |
} |
|
5511 |
||
5512 |
CXnNode* candidateAbove = NULL; |
|
5513 |
CXnNode* candidateBelow = NULL; |
|
5514 |
||
5515 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5516 |
{ |
|
5517 |
CXnNode* tmpNode = aArray[i]; |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5518 |
|
34 | 5519 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
5520 |
{ |
|
5521 |
continue; |
|
5522 |
} |
|
5523 |
if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5524 |
{ |
|
5525 |
// do not shift focus to another view |
|
5526 |
continue; |
|
5527 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5528 |
if( aEngine->IsEditMode() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5529 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5530 |
if( !IsPluginNode( *tmpNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5531 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5532 |
// move only between "plugin" nodes in edit mode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5533 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5534 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5535 |
} |
34 | 5536 |
|
5537 |
const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5538 |
const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5539 |
||
5540 |
if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5541 |
{ |
|
5542 |
// if staying in the same namespace is required, |
|
5543 |
// do not shift focus to a different namespace |
|
5544 |
continue; |
|
5545 |
} |
|
5546 |
||
5547 |
||
5548 |
// TODO: only plugin widgets are available in edit mode |
|
5549 |
TRect tmpRect = tmpNode->PaddingRect(); |
|
5550 |
||
5551 |
// tmp is above the focused node |
|
5552 |
if ( tmpRect.iBr.iY <= rect.iTl.iY ) |
|
5553 |
{ |
|
5554 |
if ( candidateAbove == NULL ) |
|
5555 |
{ |
|
5556 |
candidateAbove = tmpNode; |
|
5557 |
} |
|
5558 |
else |
|
5559 |
{ |
|
5560 |
// use pythagorean theorem to determine the closest node |
|
5561 |
TInt xDistTmp = viewWidth - tmpRect.iBr.iX; |
|
5562 |
TInt yDistTmp = rect.iTl.iY - tmpRect.iBr.iY; |
|
5563 |
TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5564 |
||
5565 |
TInt xCand = viewWidth - candidateAbove->PaddingRect().iBr.iX; |
|
5566 |
TInt yCand = rect.iTl.iY - candidateAbove->PaddingRect().iTl.iY; |
|
5567 |
TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5568 |
||
5569 |
if ( tmpDist < cDist ) |
|
5570 |
{ |
|
5571 |
candidateAbove = tmpNode; |
|
5572 |
} |
|
5573 |
} |
|
5574 |
} |
|
5575 |
else |
|
5576 |
{ |
|
5577 |
if ( candidateBelow == NULL ) |
|
5578 |
{ |
|
5579 |
candidateBelow = tmpNode; |
|
5580 |
} |
|
5581 |
else |
|
5582 |
{ |
|
5583 |
// use pythagorean theorem to determine the closest node |
|
5584 |
TInt xDistTmp = viewWidth - tmpRect.iBr.iX; |
|
5585 |
TInt yDistTmp = tmpRect.iTl.iY - rect.iTl.iY; |
|
5586 |
TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5587 |
||
5588 |
TInt xCand = viewWidth - candidateBelow->PaddingRect().iBr.iX; |
|
5589 |
TInt yCand = candidateBelow->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5590 |
TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5591 |
||
5592 |
if ( tmpDist < cDist ) |
|
5593 |
{ |
|
5594 |
candidateBelow = tmpNode; |
|
5595 |
} |
|
5596 |
} |
|
5597 |
} |
|
5598 |
} |
|
5599 |
||
5600 |
if ( candidateAbove && candidateBelow ) |
|
5601 |
{ |
|
5602 |
CXnNode* pluginAbove = FindPluginNode( *candidateAbove ); |
|
5603 |
CXnNode* pluginBelow = FindPluginNode( *candidateBelow ); |
|
5604 |
||
5605 |
TReal aboveDist = 0; |
|
5606 |
TReal belowDist = 0; |
|
5607 |
||
5608 |
if ( pluginAbove ) |
|
5609 |
{ |
|
5610 |
// compare to bottom right when looping to left |
|
5611 |
TInt xAbove = viewWidth - pluginAbove->PaddingRect().iBr.iX; |
|
5612 |
TInt yAbove = 0; |
|
5613 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5614 |
{ |
|
5615 |
yAbove = rect.iTl.iY - pluginAbove->PaddingRect().iBr.iY; |
|
5616 |
} |
|
5617 |
else |
|
5618 |
{ |
|
5619 |
yAbove = rect.iTl.iY - pluginAbove->PaddingRect().iTl.iY; |
|
5620 |
} |
|
5621 |
||
5622 |
aboveDist = Abs( (xAbove * xAbove) + (yAbove * yAbove) ); |
|
5623 |
} |
|
5624 |
else |
|
5625 |
{ |
|
5626 |
TInt xAbove = viewWidth - candidateAbove->PaddingRect().iBr.iX; |
|
5627 |
TInt yAbove = 0; |
|
5628 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5629 |
{ |
|
5630 |
yAbove = rect.iTl.iY - candidateAbove->PaddingRect().iBr.iY; |
|
5631 |
} |
|
5632 |
else |
|
5633 |
{ |
|
5634 |
yAbove = rect.iTl.iY - candidateAbove->PaddingRect().iTl.iY; |
|
5635 |
} |
|
5636 |
aboveDist = Abs( ( xAbove * xAbove ) + ( yAbove * yAbove ) ); |
|
5637 |
} |
|
5638 |
||
5639 |
if ( pluginBelow ) |
|
5640 |
{ |
|
5641 |
TInt xBelow = viewWidth - pluginBelow->PaddingRect().iBr.iX; |
|
5642 |
TInt yBelow = pluginBelow->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5643 |
belowDist = Abs( ( xBelow * xBelow ) + ( yBelow * yBelow ) ); |
|
5644 |
} |
|
5645 |
else |
|
5646 |
{ |
|
5647 |
TInt xBelow = viewWidth - candidateBelow->PaddingRect().iBr.iX; |
|
5648 |
TInt yBelow = candidateBelow->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5649 |
belowDist = Abs( ( xBelow * xBelow ) + ( yBelow * yBelow ) ); |
|
5650 |
} |
|
5651 |
||
5652 |
if ( aboveDist < belowDist ) |
|
5653 |
{ |
|
5654 |
nextNode = candidateAbove; |
|
5655 |
} |
|
5656 |
else if ( belowDist < aboveDist ) |
|
5657 |
{ |
|
5658 |
nextNode = candidateBelow; |
|
5659 |
} |
|
5660 |
else |
|
5661 |
{ |
|
5662 |
if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5663 |
{ |
|
5664 |
nextNode = candidateBelow; |
|
5665 |
} |
|
5666 |
else |
|
5667 |
{ |
|
5668 |
nextNode = candidateAbove; |
|
5669 |
} |
|
5670 |
} |
|
5671 |
} |
|
5672 |
else if ( candidateAbove ) |
|
5673 |
{ |
|
5674 |
nextNode = candidateAbove; |
|
5675 |
} |
|
5676 |
else if ( candidateBelow ) |
|
5677 |
{ |
|
5678 |
nextNode = candidateBelow; |
|
5679 |
} |
|
5680 |
else |
|
5681 |
{ |
|
5682 |
// do nothing |
|
5683 |
} |
|
5684 |
} |
|
5685 |
||
5686 |
if ( stayInNamespace && !nextNode ) |
|
5687 |
{ |
|
5688 |
return &aNode; |
|
5689 |
} |
|
5690 |
||
5691 |
return nextNode; |
|
5692 |
} |
|
5693 |
||
5694 |
// ----------------------------------------------------------------------------- |
|
5695 |
// FindNextNodeFromBelowL |
|
5696 |
// ----------------------------------------------------------------------------- |
|
5697 |
// |
|
5698 |
static CXnNode* FindNextNodeFromBelowL( |
|
5699 |
RPointerArray< CXnNode >& aArray, |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5700 |
CXnNode& aNode, TBool stayInNamespace, |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5701 |
CXnUiEngine* aEngine ) |
34 | 5702 |
{ |
5703 |
CXnNode* nextNode = NULL; |
|
5704 |
TRect rect = aNode.PaddingRect(); |
|
5705 |
||
5706 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5707 |
{ |
|
5708 |
CXnNode* tmpNode = aArray[i]; |
|
5709 |
if ( tmpNode == &aNode ) |
|
5710 |
{ |
|
5711 |
continue; |
|
5712 |
} |
|
5713 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5714 |
{ |
|
5715 |
continue; |
|
5716 |
} |
|
5717 |
if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5718 |
{ |
|
5719 |
// do not shift focus to another view |
|
5720 |
continue; |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5721 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5722 |
if( aEngine->IsEditMode() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5723 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5724 |
if( !IsPluginNode( *tmpNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5725 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5726 |
// move only between "plugin" nodes in edit mode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5727 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5728 |
} |
34 | 5729 |
} |
5730 |
||
5731 |
const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5732 |
const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5733 |
||
5734 |
if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5735 |
{ |
|
5736 |
// if staying in the same namespace is required, |
|
5737 |
// do not shift focus to a different namespace |
|
5738 |
continue; |
|
5739 |
} |
|
5740 |
||
5741 |
// TODO: only plugin widgets are available in edit mode |
|
5742 |
||
5743 |
TRect tmpRect = tmpNode->PaddingRect(); |
|
5744 |
||
5745 |
// temp node qualification: |
|
5746 |
// 1. top edge of the temp node is below bottom edge of focused node |
|
5747 |
// 2. temp node's right or left edge is between focused's left or right edge |
|
5748 |
if ( tmpRect.iTl.iY > rect.iBr.iY - 1 && |
|
5749 |
tmpRect.iBr.iX - 1 >= rect.iTl.iX && |
|
5750 |
tmpRect.iTl.iX <= rect.iBr.iX - 1 ) |
|
5751 |
{ |
|
5752 |
if ( !nextNode ) |
|
5753 |
{ |
|
5754 |
nextNode = tmpNode; |
|
5755 |
} |
|
5756 |
else |
|
5757 |
{ |
|
5758 |
// temp node is closer than next node |
|
5759 |
if ( tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
5760 |
{ |
|
5761 |
nextNode = tmpNode; |
|
5762 |
continue; |
|
5763 |
} |
|
5764 |
// top edge of temp node and next are at the same level |
|
5765 |
else if ( tmpRect.iTl.iY == nextNode->PaddingRect().iTl.iY ) |
|
5766 |
{ |
|
5767 |
// western layout: take the leftmost one |
|
5768 |
if ( !AknLayoutUtils::LayoutMirrored() && |
|
5769 |
tmpRect.iBr.iX - 1 < nextNode->PaddingRect().iBr.iX - 1 ) |
|
5770 |
{ |
|
5771 |
nextNode = tmpNode; |
|
5772 |
continue; |
|
5773 |
} |
|
5774 |
// arabic/hebrew layout: take the rightmost one |
|
5775 |
if ( AknLayoutUtils::LayoutMirrored() && |
|
5776 |
tmpRect.iBr.iX - 1 > nextNode->PaddingRect().iBr.iX - 1 ) |
|
5777 |
{ |
|
5778 |
nextNode = tmpNode; |
|
5779 |
continue; |
|
5780 |
} |
|
5781 |
} |
|
5782 |
else |
|
5783 |
{ |
|
5784 |
continue; |
|
5785 |
} |
|
5786 |
} |
|
5787 |
} |
|
5788 |
} |
|
5789 |
||
5790 |
// no nodes found on the right, try looping |
|
5791 |
if ( !nextNode ) |
|
5792 |
{ |
|
5793 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5794 |
{ |
|
5795 |
CXnNode* tmpNode = aArray[i]; |
|
5796 |
TRect tmpRect = tmpNode->PaddingRect(); |
|
5797 |
if ( tmpNode == &aNode ) |
|
5798 |
{ |
|
5799 |
continue; |
|
5800 |
} |
|
5801 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5802 |
{ |
|
5803 |
continue; |
|
5804 |
} |
|
5805 |
if ( tmpRect.Intersects( rect ) ) |
|
5806 |
{ |
|
5807 |
continue; |
|
5808 |
} |
|
5809 |
if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5810 |
{ |
|
5811 |
// do not shift focus to another view |
|
5812 |
continue; |
|
5813 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5814 |
if( aEngine->IsEditMode() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5815 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5816 |
if( !IsPluginNode( *tmpNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5817 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5818 |
// move only between "plugin" nodes in edit mode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5819 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5820 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5821 |
} |
34 | 5822 |
|
5823 |
const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5824 |
const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5825 |
||
5826 |
if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5827 |
{ |
|
5828 |
// if staying in the same namespace is required, |
|
5829 |
// do not shift focus to a different namespace |
|
5830 |
continue; |
|
5831 |
} |
|
5832 |
||
5833 |
// TODO: only plugin widgets are available in edit mode |
|
5834 |
||
5835 |
// temp node's right or left edge must be between focused's left or |
|
5836 |
// right edge |
|
5837 |
if ( tmpRect.iBr.iX - 1 >= rect.iTl.iX && |
|
5838 |
tmpRect.iTl.iX <= rect.iBr.iX - 1 ) |
|
5839 |
{ |
|
5840 |
if ( !nextNode ) |
|
5841 |
{ |
|
5842 |
nextNode = tmpNode; |
|
5843 |
} |
|
5844 |
else |
|
5845 |
{ |
|
5846 |
// temp node is closer than next node |
|
5847 |
if ( tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
5848 |
{ |
|
5849 |
nextNode = tmpNode; |
|
5850 |
continue; |
|
5851 |
} |
|
5852 |
// top edge of temp node and next are at the same level |
|
5853 |
else if ( tmpRect.iTl.iY == nextNode->PaddingRect().iTl.iY ) |
|
5854 |
{ |
|
5855 |
// western layout: take the leftmost one |
|
5856 |
if ( !AknLayoutUtils::LayoutMirrored() && |
|
5857 |
tmpRect.iBr.iX - 1 < nextNode->PaddingRect().iBr.iX - 1 ) |
|
5858 |
{ |
|
5859 |
nextNode = tmpNode; |
|
5860 |
continue; |
|
5861 |
} |
|
5862 |
// arabic/hebrew layout: take the rightmost one |
|
5863 |
if ( AknLayoutUtils::LayoutMirrored() && |
|
5864 |
tmpRect.iBr.iX - 1 > nextNode->PaddingRect().iBr.iX - 1 ) |
|
5865 |
{ |
|
5866 |
nextNode = tmpNode; |
|
5867 |
continue; |
|
5868 |
} |
|
5869 |
} |
|
5870 |
else |
|
5871 |
{ |
|
5872 |
continue; |
|
5873 |
} |
|
5874 |
} |
|
5875 |
} |
|
5876 |
} |
|
5877 |
} |
|
5878 |
||
5879 |
if ( stayInNamespace && !nextNode ) |
|
5880 |
{ |
|
5881 |
return &aNode; |
|
5882 |
} |
|
5883 |
||
5884 |
return nextNode; |
|
5885 |
} |
|
5886 |
||
5887 |
// ----------------------------------------------------------------------------- |
|
5888 |
// FindNextNodeFromAboveL |
|
5889 |
// ----------------------------------------------------------------------------- |
|
5890 |
// |
|
5891 |
static CXnNode* FindNextNodeFromAboveL( |
|
5892 |
RPointerArray< CXnNode >& aArray, |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5893 |
CXnNode& aNode, TBool stayInNamespace, |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5894 |
CXnUiEngine* aEngine ) |
34 | 5895 |
{ |
5896 |
CXnNode* nextNode = NULL; |
|
5897 |
TRect rect = aNode.PaddingRect(); |
|
5898 |
||
5899 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5900 |
{ |
|
5901 |
CXnNode* tmpNode = aArray[i]; |
|
5902 |
if ( tmpNode == &aNode ) |
|
5903 |
{ |
|
5904 |
continue; |
|
5905 |
} |
|
5906 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5907 |
{ |
|
5908 |
continue; |
|
5909 |
} |
|
5910 |
if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5911 |
{ |
|
5912 |
// do not shift focus to another view |
|
5913 |
continue; |
|
5914 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5915 |
if( aEngine->IsEditMode() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5916 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5917 |
if( !IsPluginNode( *tmpNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5918 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5919 |
// move only between "plugin" nodes in edit mode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5920 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5921 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
5922 |
} |
34 | 5923 |
|
5924 |
const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5925 |
const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5926 |
||
5927 |
if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5928 |
{ |
|
5929 |
// if staying in the same namespace is required, |
|
5930 |
// do not shift focus to a different namespace |
|
5931 |
continue; |
|
5932 |
} |
|
5933 |
||
5934 |
// TODO: only plugin widgets are available in edit mode |
|
5935 |
TRect tmpRect = tmpNode->PaddingRect(); |
|
5936 |
||
5937 |
// temp node qualification: |
|
5938 |
// 1. bottom edge of the temp node is above the top edge of focused node |
|
5939 |
// 2. temp node's right or left edge is between focused's left or right edge |
|
5940 |
if ( tmpRect.iBr.iY - 1 < rect.iTl.iY && |
|
5941 |
tmpRect.iBr.iX - 1 >= rect.iTl.iX && |
|
5942 |
tmpRect.iTl.iX <= rect.iBr.iX - 1 ) |
|
5943 |
{ |
|
5944 |
if ( !nextNode ) |
|
5945 |
{ |
|
5946 |
nextNode = tmpNode; |
|
5947 |
} |
|
5948 |
else |
|
5949 |
{ |
|
5950 |
// temp node is closer than next node |
|
5951 |
if ( tmpRect.iBr.iY - 1 > nextNode->PaddingRect().iBr.iY - 1 ) |
|
5952 |
{ |
|
5953 |
nextNode = tmpNode; |
|
5954 |
continue; |
|
5955 |
} |
|
5956 |
// bottom edge of temp and next node are at the same level |
|
5957 |
else if ( tmpRect.iBr.iY - 1 == nextNode->PaddingRect().iBr.iY - 1 ) |
|
5958 |
{ |
|
5959 |
// western layout: take the leftmost one |
|
5960 |
if ( !AknLayoutUtils::LayoutMirrored() && |
|
5961 |
tmpRect.iBr.iX - 1 < nextNode->PaddingRect().iBr.iX - 1 ) |
|
5962 |
{ |
|
5963 |
nextNode = tmpNode; |
|
5964 |
continue; |
|
5965 |
} |
|
5966 |
// arabic/hebrew layout: take the rightmost one |
|
5967 |
if ( AknLayoutUtils::LayoutMirrored() && |
|
5968 |
tmpRect.iBr.iX - 1 > nextNode->PaddingRect().iBr.iX - 1 ) |
|
5969 |
{ |
|
5970 |
nextNode = tmpNode; |
|
5971 |
continue; |
|
5972 |
} |
|
5973 |
} |
|
5974 |
else |
|
5975 |
{ |
|
5976 |
continue; |
|
5977 |
} |
|
5978 |
} |
|
5979 |
} |
|
5980 |
} |
|
5981 |
||
5982 |
// no nodes found on the right, try looping |
|
5983 |
if ( !nextNode ) |
|
5984 |
{ |
|
5985 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5986 |
{ |
|
5987 |
CXnNode* tmpNode = aArray[i]; |
|
5988 |
TRect tmpRect = tmpNode->PaddingRect(); |
|
5989 |
if ( tmpNode == &aNode ) |
|
5990 |
{ |
|
5991 |
continue; |
|
5992 |
} |
|
5993 |
if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5994 |
{ |
|
5995 |
continue; |
|
5996 |
} |
|
5997 |
if ( tmpRect.Intersects( rect ) ) |
|
5998 |
{ |
|
5999 |
continue; |
|
6000 |
} |
|
6001 |
if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
6002 |
{ |
|
6003 |
// do not shift focus to another view |
|
6004 |
continue; |
|
6005 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6006 |
if( aEngine->IsEditMode() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6007 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6008 |
if( !IsPluginNode( *tmpNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6009 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6010 |
// move only between "plugin" nodes in edit mode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6011 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6012 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6013 |
} |
34 | 6014 |
|
6015 |
const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
6016 |
const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
6017 |
||
6018 |
if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
6019 |
{ |
|
6020 |
// if staying in the same namespace is required, |
|
6021 |
// do not shift focus to a different namespace |
|
6022 |
continue; |
|
6023 |
} |
|
6024 |
||
6025 |
// TODO: only plugin widgets are available in edit mode |
|
6026 |
||
6027 |
// temp node's right or left edge must be between focused's left or |
|
6028 |
// right edge |
|
6029 |
if ( tmpRect.iBr.iX - 1 >= rect.iTl.iX && |
|
6030 |
tmpRect.iTl.iX <= rect.iBr.iX - 1 ) |
|
6031 |
{ |
|
6032 |
if ( !nextNode ) |
|
6033 |
{ |
|
6034 |
nextNode = tmpNode; |
|
6035 |
} |
|
6036 |
else |
|
6037 |
{ |
|
6038 |
// temp node is closer than next node |
|
6039 |
if ( tmpRect.iBr.iY - 1 > nextNode->PaddingRect().iBr.iY - 1 ) |
|
6040 |
{ |
|
6041 |
nextNode = tmpNode; |
|
6042 |
continue; |
|
6043 |
} |
|
6044 |
// bottom edge of temp and next node are at the same level |
|
6045 |
else if ( tmpRect.iBr.iY - 1 == nextNode->PaddingRect().iBr.iY - 1 ) |
|
6046 |
{ |
|
6047 |
// western layout: take the leftmost one |
|
6048 |
if ( !AknLayoutUtils::LayoutMirrored() && |
|
6049 |
tmpRect.iBr.iX - 1 < nextNode->PaddingRect().iBr.iX - 1 ) |
|
6050 |
{ |
|
6051 |
nextNode = tmpNode; |
|
6052 |
continue; |
|
6053 |
} |
|
6054 |
// arabic/hebrew layout: take the rightmost one |
|
6055 |
if ( AknLayoutUtils::LayoutMirrored() && |
|
6056 |
tmpRect.iBr.iX - 1 > nextNode->PaddingRect().iBr.iX - 1 ) |
|
6057 |
{ |
|
6058 |
nextNode = tmpNode; |
|
6059 |
continue; |
|
6060 |
} |
|
6061 |
} |
|
6062 |
else |
|
6063 |
{ |
|
6064 |
continue; |
|
6065 |
} |
|
6066 |
} |
|
6067 |
} |
|
6068 |
} |
|
6069 |
} |
|
6070 |
||
6071 |
if ( stayInNamespace && !nextNode ) |
|
6072 |
{ |
|
6073 |
return &aNode; |
|
6074 |
} |
|
6075 |
||
6076 |
return nextNode; |
|
6077 |
} |
|
6078 |
||
6079 |
// ----------------------------------------------------------------------------- |
|
6080 |
// FindPluginNode |
|
6081 |
// ----------------------------------------------------------------------------- |
|
6082 |
// |
|
6083 |
static CXnNode* FindPluginNode( CXnNode& aNode ) |
|
6084 |
{ |
|
6085 |
CXnNode* pluginNode = NULL; |
|
6086 |
CXnNode* tmp = &aNode; |
|
6087 |
||
6088 |
while( tmp->Parent() ) |
|
6089 |
{ |
|
6090 |
tmp = tmp->Parent(); |
|
6091 |
const TDesC8& nodeType = tmp->DomNode()->Name(); |
|
6092 |
||
6093 |
if ( nodeType == KPlugin ) |
|
6094 |
{ |
|
6095 |
pluginNode = tmp; |
|
6096 |
break; |
|
6097 |
} |
|
6098 |
} |
|
6099 |
||
6100 |
return pluginNode; |
|
6101 |
} |
|
6102 |
||
6103 |
// ----------------------------------------------------------------------------- |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6104 |
// IsPluginNode |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6105 |
// ----------------------------------------------------------------------------- |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6106 |
// |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6107 |
static TBool IsPluginNode( CXnNode& aNode ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6108 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6109 |
TBool ret = EFalse; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6110 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6111 |
const TDesC8& nodeType = aNode.DomNode()->Name(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6112 |
if( nodeType == KPlugin ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6113 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6114 |
ret = ETrue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6115 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6116 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6117 |
return ret; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6118 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6119 |
|
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6120 |
// ----------------------------------------------------------------------------- |
34 | 6121 |
// DoInternalFocusChangeL |
6122 |
// ----------------------------------------------------------------------------- |
|
6123 |
// |
|
6124 |
static TBool DoInternalFocusChangeL( CXnUiEngine& aEngine, |
|
6125 |
CXnNode& aNode, const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
6126 |
{ |
|
6127 |
if ( aNode.ViewNodeImpl() ) |
|
6128 |
{ |
|
6129 |
return EFalse; |
|
6130 |
} |
|
6131 |
if ( aType != 1 ) |
|
6132 |
{ |
|
6133 |
return EFalse; |
|
6134 |
} |
|
6135 |
if ( aKeyEvent.iScanCode != EStdKeyLeftArrow && |
|
6136 |
aKeyEvent.iScanCode != EStdKeyRightArrow && |
|
6137 |
aKeyEvent.iScanCode != EStdKeyDownArrow && |
|
6138 |
aKeyEvent.iScanCode != EStdKeyUpArrow ) |
|
6139 |
{ |
|
6140 |
return EFalse; |
|
6141 |
} |
|
6142 |
CXnNode* parent = aNode.Parent(); |
|
6143 |
if ( !parent ) |
|
6144 |
{ |
|
6145 |
return EFalse; |
|
6146 |
} |
|
6147 |
||
6148 |
// Handle 'appearance' navigation first, if the current node has |
|
6149 |
// "nav-index: appearance"... |
|
6150 |
CXnProperty* navind = aNode.NavIndexL(); |
|
6151 |
if ( navind && navind->StringValue() == XnPropertyNames::style::common::KAppearance ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6152 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6153 |
CXnAppUiAdapter& appui( aEngine.AppUiAdapter() ); |
34 | 6154 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6155 |
CXnPluginData* plugin( appui.ViewManager().ActiveViewData().Plugin( &aNode ) ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6156 |
|
34 | 6157 |
// find if node is in a widget that contatins some opened popup window |
6158 |
TBool containsPopUp = ( plugin ? plugin->IsDisplayingPopup() : EFalse ); |
|
6159 |
||
6160 |
CXnNode* nextNode( NULL ); |
|
6161 |
RPointerArray< CXnNode >& array = aEngine.ViewManager()->AppearanceNodes(); |
|
6162 |
if ( aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
6163 |
{ |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6164 |
nextNode = FindNextNodeFromBelowL( array, aNode, containsPopUp, &aEngine ); |
34 | 6165 |
} |
6166 |
else if ( aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
6167 |
{ |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6168 |
nextNode = FindNextNodeFromAboveL( array, aNode, containsPopUp, &aEngine ); |
34 | 6169 |
} |
6170 |
else if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
6171 |
{ |
|
6172 |
nextNode = FindNextNodeFromRightL( array, aNode, containsPopUp, &aEngine ); |
|
6173 |
} |
|
6174 |
else if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
6175 |
{ |
|
6176 |
nextNode = FindNextNodeFromLeftL( array, aNode, containsPopUp, &aEngine ); |
|
6177 |
} |
|
6178 |
if ( nextNode ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6179 |
{ |
34 | 6180 |
if( nextNode && nextNode->ScrollableControl() ) |
6181 |
{ |
|
6182 |
nextNode->ScrollableControl()->ShowItem( *nextNode ); |
|
6183 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
6184 |
|
34 | 6185 |
nextNode->SetStateL( XnPropertyNames::style::common::KFocus ); |
6186 |
return ETrue; |
|
6187 |
} |
|
6188 |
} |
|
6189 |
else |
|
6190 |
{ |
|
6191 |
const TDesC8* direction( &XnPropertyNames::style::common::direction::KLTR ); |
|
6192 |
const TDesC8* orientation( &XnPropertyNames::style::common::block_progression::KTB ); |
|
6193 |
||
6194 |
CXnProperty* directionProperty( parent->DirectionL() ); |
|
6195 |
||
6196 |
if ( directionProperty ) |
|
6197 |
{ |
|
6198 |
direction = &directionProperty->StringValue(); |
|
6199 |
} |
|
6200 |
||
6201 |
CXnProperty* orientationProperty( parent->BlockProgressionL() ); |
|
6202 |
||
6203 |
if ( orientationProperty ) |
|
6204 |
{ |
|
6205 |
orientation = &orientationProperty->StringValue(); |
|
6206 |
} |
|
6207 |
||
6208 |
TBool match = EFalse; |
|
6209 |
||
6210 |
if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
6211 |
( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
6212 |
*orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
6213 |
{ |
|
6214 |
if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
6215 |
{ |
|
6216 |
match = FindNextFocusableNodeL( aNode, EFalse ); |
|
6217 |
} |
|
6218 |
if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
6219 |
{ |
|
6220 |
match = FindNextFocusableNodeL( aNode, ETrue ); |
|
6221 |
} |
|
6222 |
} |
|
6223 |
else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
6224 |
( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
6225 |
*orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
6226 |
{ |
|
6227 |
if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
6228 |
{ |
|
6229 |
match = FindNextFocusableNodeL( aNode, EFalse ); |
|
6230 |
} |
|
6231 |
if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
6232 |
{ |
|
6233 |
match = FindNextFocusableNodeL( aNode, ETrue ); |
|
6234 |
} |
|
6235 |
} |
|
6236 |
else if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
6237 |
*orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
6238 |
{ |
|
6239 |
if ( aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
6240 |
{ |
|
6241 |
match = FindNextFocusableNodeL( aNode, EFalse ); |
|
6242 |
} |
|
6243 |
if ( aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
6244 |
{ |
|
6245 |
match = FindNextFocusableNodeL( aNode, ETrue ); |
|
6246 |
} |
|
6247 |
} |
|
6248 |
else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
6249 |
*orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
6250 |
{ |
|
6251 |
if ( aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
6252 |
{ |
|
6253 |
match = FindNextFocusableNodeL( aNode, EFalse ); |
|
6254 |
} |
|
6255 |
if ( aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
6256 |
{ |
|
6257 |
match = FindNextFocusableNodeL( aNode, ETrue ); |
|
6258 |
} |
|
6259 |
} |
|
6260 |
return match; |
|
6261 |
} |
|
6262 |
return EFalse; |
|
6263 |
} |
|
6264 |
||
6265 |
// ----------------------------------------------------------------------------- |
|
6266 |
// DoTriggerKeyEventL |
|
6267 |
// ----------------------------------------------------------------------------- |
|
6268 |
// |
|
6269 |
static TBool DoTriggerKeyEventL( |
|
6270 |
CXnNodeImpl* aThis, |
|
6271 |
CXnUiEngine& aEngine, |
|
6272 |
CXnNode& aNode, |
|
6273 |
const TKeyEvent& aKeyEvent, |
|
6274 |
TEventCode aType ) |
|
6275 |
{ |
|
6276 |
CXnDomNode* domNode = aNode.DomNode(); |
|
6277 |
CXnDomList& children = domNode->ChildNodes(); |
|
6278 |
TInt count = children.Length(); |
|
6279 |
TBool returnValue = EFalse; |
|
6280 |
for ( TInt i = 0; i < count; ++i ) |
|
6281 |
{ |
|
6282 |
CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
6283 |
const TDesC8& type = node->Name(); |
|
6284 |
if ( type == XnPropertyNames::action::KActions ) |
|
6285 |
{ |
|
6286 |
CXnDomList& actionChildren = node->ChildNodes(); |
|
6287 |
TInt actionCount = actionChildren.Length(); |
|
6288 |
for ( TInt j = 0; j < actionCount; ++j ) |
|
6289 |
{ |
|
6290 |
CXnDomNode* actionNode = |
|
6291 |
static_cast< CXnDomNode* >( actionChildren.Item( j ) ); |
|
6292 |
const TDesC8& actionType = actionNode->Name(); |
|
6293 |
if ( actionType == XnPropertyNames::action::KAction ) |
|
6294 |
{ |
|
6295 |
TBool match = MatchActionForKeyEventL( |
|
6296 |
aThis, aEngine, aNode, aKeyEvent, aType, *actionNode ); |
|
6297 |
if ( match ) |
|
6298 |
{ |
|
6299 |
returnValue = ETrue; |
|
6300 |
} |
|
6301 |
} |
|
6302 |
} |
|
6303 |
} |
|
6304 |
} |
|
6305 |
||
6306 |
if ( returnValue ) |
|
6307 |
{ |
|
6308 |
// Return is removed from here to enable auto navigation altough the |
|
6309 |
// action is alreadytriggered. This enables simpler theme definitions |
|
6310 |
// especially in AI2 case. If regression is observed then return should |
|
6311 |
// be restored here. Task ou1s60ui#3386. |
|
6312 |
//return returnValue; |
|
6313 |
} |
|
6314 |
||
6315 |
DoCompoundNodeScrollingL( aNode, aKeyEvent, aType ); |
|
6316 |
||
6317 |
returnValue = DoInternalFocusChangeL( aEngine, aNode, aKeyEvent, aType ); |
|
6318 |
||
6319 |
if ( returnValue ) |
|
6320 |
{ |
|
6321 |
aEngine.RenderUIL(); |
|
6322 |
} |
|
6323 |
||
6324 |
return returnValue; |
|
6325 |
} |
|
6326 |
||
6327 |
// ----------------------------------------------------------------------------- |
|
6328 |
// DoTriggerEventL |
|
6329 |
// ----------------------------------------------------------------------------- |
|
6330 |
// |
|
6331 |
static void DoTriggerEventL( |
|
6332 |
CXnNodeImpl* aThis, |
|
6333 |
CXnUiEngine& aEngine, |
|
6334 |
CXnNode& aNode, |
|
6335 |
CXnNode& aActionsParent, |
|
6336 |
CXnNode& aEventData, |
|
6337 |
TInt aSource ) |
|
6338 |
{ |
|
6339 |
CXnDomList& children( aActionsParent.DomNode()->ChildNodes() ); |
|
6340 |
||
6341 |
TInt count( children.Length() ); |
|
6342 |
||
6343 |
for ( TInt i = 0; i < count; ++i ) |
|
6344 |
{ |
|
6345 |
CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
6346 |
const TDesC8& type = node->Name(); |
|
6347 |
if ( type == XnPropertyNames::action::KActions ) |
|
6348 |
{ |
|
6349 |
CXnDomList& actionChildren = node->ChildNodes(); |
|
6350 |
TInt actionCount = actionChildren.Length(); |
|
6351 |
for ( TInt j = 0; j < actionCount; ++j ) |
|
6352 |
{ |
|
6353 |
CXnDomNode* actionNode = |
|
6354 |
static_cast< CXnDomNode* >( actionChildren.Item( j ) ); |
|
6355 |
const TDesC8& actionType = actionNode->Name(); |
|
6356 |
if ( actionType == XnPropertyNames::action::KAction ) |
|
6357 |
{ |
|
6358 |
TBool match = MatchActionForEventL( |
|
6359 |
aThis, aEngine, aNode, aEventData, *actionNode, aSource ); |
|
6360 |
} |
|
6361 |
} |
|
6362 |
} |
|
6363 |
} |
|
6364 |
} |
|
6365 |
||
6366 |
// ----------------------------------------------------------------------------- |
|
6367 |
// DoReceiveFocusL |
|
6368 |
// ----------------------------------------------------------------------------- |
|
6369 |
// |
|
6370 |
static TBool DoReceiveFocusL( CXnNode& aNode, CXnUiEngine& /*aEngine*/ ) |
|
6371 |
{ |
|
6372 |
CXnProperty* focusable = aNode.GetPropertyL( |
|
6373 |
XnPropertyNames::common::KFocusable ); |
|
6374 |
CXnProperty* disabled = aNode.GetPropertyL( |
|
6375 |
XnPropertyNames::common::KDisabled ); |
|
6376 |
if ( focusable ) |
|
6377 |
{ |
|
6378 |
const TDesC8& focusValue = focusable->StringValue(); |
|
6379 |
if ( focusValue != KNullDesC8 ) |
|
6380 |
{ |
|
6381 |
if ( focusValue != XnPropertyNames::KTrue ) |
|
6382 |
{ |
|
6383 |
return EFalse; |
|
6384 |
} |
|
6385 |
} |
|
6386 |
} |
|
6387 |
else |
|
6388 |
{ |
|
6389 |
return EFalse; |
|
6390 |
} |
|
6391 |
if ( disabled ) |
|
6392 |
{ |
|
6393 |
const TDesC8& disabledValue = disabled->StringValue(); |
|
6394 |
if ( disabledValue != KNullDesC8 ) |
|
6395 |
{ |
|
6396 |
if ( disabledValue == XnPropertyNames::KTrue ) |
|
6397 |
{ |
|
6398 |
return EFalse; |
|
6399 |
} |
|
6400 |
} |
|
6401 |
} |
|
6402 |
if ( !IsNodeNavigableL( aNode ) ) |
|
6403 |
{ |
|
6404 |
return EFalse; |
|
6405 |
} |
|
6406 |
||
6407 |
return ETrue; |
|
6408 |
} |
|
6409 |
||
6410 |
// ----------------------------------------------------------------------------- |
|
6411 |
// Informs the component about the property change. |
|
6412 |
// ----------------------------------------------------------------------------- |
|
6413 |
// |
|
6414 |
static void InformPropertyChangeL( CXnNode& aNode, CXnProperty* aProperty ) |
|
6415 |
{ |
|
6416 |
//Inform the component about the property change. |
|
6417 |
CXnNode* parent( aNode.Parent() ); |
|
6418 |
||
6419 |
if ( parent ) |
|
6420 |
{ |
|
6421 |
if ( parent->Type()->Type() == KMenuBar ) |
|
6422 |
{ |
|
6423 |
CXnMenuAdapter* adapter = |
|
6424 |
static_cast< CXnMenuAdapter* >( parent->Control() ); |
|
6425 |
||
6426 |
if ( adapter ) |
|
6427 |
{ |
|
6428 |
adapter->HandleMenuPropertyChangeL( &aNode.PluginIfL(), aProperty ); |
|
6429 |
} |
|
6430 |
} |
|
6431 |
else if ( aNode.IsLayoutCapable() ) |
|
6432 |
{ |
|
6433 |
CXnControlAdapter* adapter( aNode.Control() ); |
|
6434 |
||
6435 |
if ( adapter ) |
|
6436 |
{ |
|
6437 |
adapter->HandlePropertyChangeL( aProperty ); |
|
6438 |
} |
|
6439 |
} |
|
6440 |
} |
|
6441 |
} |
|
6442 |
||
6443 |
// ----------------------------------------------------------------------------- |
|
6444 |
// Informs parent and its children about the property change. |
|
6445 |
// ----------------------------------------------------------------------------- |
|
6446 |
// |
|
6447 |
static void InformChildrenPropertyChangeL( |
|
6448 |
CXnNode& aParent, |
|
6449 |
CXnProperty* aProperty, |
|
6450 |
TBool aInformParent = ETrue ) |
|
6451 |
{ |
|
6452 |
RPointerArray< CXnNode >& children( aParent.Children() ); |
|
6453 |
if ( aInformParent ) |
|
6454 |
{ |
|
6455 |
InformPropertyChangeL( aParent, aProperty ); |
|
6456 |
} |
|
6457 |
TInt count( children.Count() ); |
|
6458 |
for ( TInt i = 0 ; i < count; i++ ) |
|
6459 |
{ |
|
6460 |
InformChildrenPropertyChangeL( *children[i], aProperty, ETrue ); |
|
6461 |
} |
|
6462 |
} |
|
6463 |
||
6464 |
// ----------------------------------------------------------------------------- |
|
6465 |
// DisplayValueMatchL |
|
6466 |
// ----------------------------------------------------------------------------- |
|
6467 |
// |
|
6468 |
static TBool DisplayValueMatchL( |
|
6469 |
CXnNode& aNode, |
|
6470 |
const TDesC8& aDisplayValue ) |
|
6471 |
{ |
|
6472 |
CXnProperty* display = aNode.GetPropertyL( KDisplay ); |
|
6473 |
if ( display ) |
|
6474 |
{ |
|
6475 |
const TDesC8& value = display->StringValue(); |
|
6476 |
if ( value.Compare( aDisplayValue ) == KErrNone ) |
|
6477 |
{ |
|
6478 |
return ETrue; |
|
6479 |
} |
|
6480 |
} |
|
6481 |
return EFalse; |
|
6482 |
} |
|
6483 |
||
6484 |
// ----------------------------------------------------------------------------- |
|
6485 |
// SetFloatPropertyToNodeL |
|
6486 |
// Set float property to a node |
|
6487 |
// ----------------------------------------------------------------------------- |
|
6488 |
// |
|
6489 |
static void SetFloatPropertyToNodeL( |
|
6490 |
CXnDomStringPool& aStringPool, CXnNode& aNode, |
|
6491 |
const TDesC8& aPropertyName, TReal aPropertyValue, |
|
6492 |
CXnDomPropertyValue::TPrimitiveValueType aValueType ) |
|
6493 |
{ |
|
6494 |
// create property |
|
6495 |
CXnProperty* prop = CXnProperty::NewL( |
|
6496 |
aPropertyName, aPropertyValue, aValueType, aStringPool ); |
|
6497 |
||
6498 |
CleanupStack::PushL( prop ); |
|
6499 |
aNode.SetPropertyL( prop ); |
|
6500 |
CleanupStack::Pop( prop ); |
|
6501 |
} |
|
6502 |
||
6503 |
// ----------------------------------------------------------------------------- |
|
6504 |
// SetStringPropertyToNodeL |
|
6505 |
// Set string property to a node |
|
6506 |
// ----------------------------------------------------------------------------- |
|
6507 |
// |
|
6508 |
static void SetStringPropertyToNodeL( |
|
6509 |
CXnDomStringPool& aStringPool, |
|
6510 |
CXnNode& aNode, |
|
6511 |
const TDesC8& aPropertyName, |
|
6512 |
const TDesC8& aPropertyValue ) |
|
6513 |
{ |
|
6514 |
// create property |
|
6515 |
CXnProperty* prop = CXnProperty::NewL( |
|
6516 |
aPropertyName, aPropertyValue, CXnDomPropertyValue::EString, aStringPool ); |
|
6517 |
||
6518 |
CleanupStack::PushL( prop ); |
|
6519 |
aNode.SetPropertyL( prop ); |
|
6520 |
CleanupStack::Pop( prop ); |
|
6521 |
} |
|
6522 |
||
6523 |
// ----------------------------------------------------------------------------- |
|
6524 |
// FindYoungestSiblingWithDisplayL |
|
6525 |
// Seek youngest sibling node with given display value |
|
6526 |
// ----------------------------------------------------------------------------- |
|
6527 |
// |
|
6528 |
static CXnNode* FindYoungestSiblingWithDisplayL( |
|
6529 |
RPointerArray< CXnNode >& aSiblingArray, |
|
6530 |
const TDesC8& aDisplayValue, |
|
6531 |
TInt& aIndex ) |
|
6532 |
{ |
|
6533 |
aIndex = KErrNotFound; |
|
6534 |
CXnNode* node = NULL; |
|
6535 |
TInt siblingCount( aSiblingArray.Count() ); |
|
6536 |
//Find youngest sibling with display block |
|
6537 |
for ( TInt i = siblingCount; i > 0; ) |
|
6538 |
{ |
|
6539 |
node = aSiblingArray[--i]; |
|
6540 |
if ( DisplayValueMatchL( *node, aDisplayValue ) ) |
|
6541 |
{ |
|
6542 |
aIndex = i; |
|
6543 |
return node; |
|
6544 |
} |
|
6545 |
} |
|
6546 |
return NULL; |
|
6547 |
} |
|
6548 |
||
6549 |
// ----------------------------------------------------------------------------- |
|
6550 |
// FindOldestSiblingWithDisplayL |
|
6551 |
// Seek oldest sibling node with given display value |
|
6552 |
// ----------------------------------------------------------------------------- |
|
6553 |
// |
|
6554 |
static CXnNode* FindOldestSiblingWithDisplayL( |
|
6555 |
RPointerArray< CXnNode >& aSiblingArray, |
|
6556 |
const TDesC8& aDisplayValue, |
|
6557 |
TInt& aIndex ) |
|
6558 |
{ |
|
6559 |
aIndex = KErrNotFound; |
|
6560 |
CXnNode* node = NULL; |
|
6561 |
TInt siblingCount( aSiblingArray.Count() ); |
|
6562 |
//Find oldest sibling with display block |
|
6563 |
for ( TInt i = 0; i < siblingCount; i++ ) |
|
6564 |
{ |
|
6565 |
node = aSiblingArray[i]; |
|
6566 |
if ( DisplayValueMatchL( *node, aDisplayValue ) ) |
|
6567 |
{ |
|
6568 |
aIndex = i; |
|
6569 |
return node; |
|
6570 |
} |
|
6571 |
} |
|
6572 |
return NULL; |
|
6573 |
} |
|
6574 |
||
6575 |
// ----------------------------------------------------------------------------- |
|
6576 |
// ScrollBoxToBeginningL |
|
6577 |
// Show the oldest siblings that fit into the compound box. |
|
6578 |
// ----------------------------------------------------------------------------- |
|
6579 |
// |
|
6580 |
static void ScrollBoxToBeginningL( RPointerArray< CXnNode >& aSiblingArray ) |
|
6581 |
{ |
|
6582 |
CXnNode* node = NULL; |
|
6583 |
TInt toBeDisplayed(0); |
|
6584 |
TInt siblingCount( aSiblingArray.Count() ); |
|
6585 |
for ( TInt i = 0; i < siblingCount; i++ ) |
|
6586 |
{ |
|
6587 |
node = aSiblingArray[i]; |
|
6588 |
if ( DisplayValueMatchL( *node, KBlock ) ) |
|
6589 |
{ |
|
6590 |
CXnDomStringPool* sp = node->DomNode()->StringPool(); |
|
6591 |
//Switch the display to 'none' to visible siblings. |
|
6592 |
SetStringPropertyToNodeL( *sp, *node, KDisplay, KNone ); |
|
6593 |
node = aSiblingArray[toBeDisplayed]; |
|
6594 |
toBeDisplayed++; |
|
6595 |
//Switch the display to 'block' to hidden siblings. |
|
6596 |
SetStringPropertyToNodeL( *sp, *node, KDisplay, KBlock ); |
|
6597 |
} |
|
6598 |
} |
|
6599 |
} |
|
6600 |
||
6601 |
// ----------------------------------------------------------------------------- |
|
6602 |
// ScrollBoxToEndL |
|
6603 |
// Show the youngest siblings that fit into the compound box. |
|
6604 |
// ----------------------------------------------------------------------------- |
|
6605 |
// |
|
6606 |
static void ScrollBoxToEndL( RPointerArray< CXnNode >& aSiblingArray ) |
|
6607 |
{ |
|
6608 |
CXnNode* node = NULL; |
|
6609 |
TInt siblingCount( aSiblingArray.Count() ); |
|
6610 |
TInt toBeDisplayed( siblingCount - 1 ); |
|
6611 |
for ( TInt i = siblingCount; i > 0; ) |
|
6612 |
{ |
|
6613 |
node = aSiblingArray[--i]; |
|
6614 |
if ( DisplayValueMatchL( *node, KBlock ) ) |
|
6615 |
{ |
|
6616 |
CXnDomStringPool* sp = node->DomNode()->StringPool(); |
|
6617 |
//Switch the display to 'none' to visible siblings. |
|
6618 |
SetStringPropertyToNodeL( *sp, *node, KDisplay, KNone ); |
|
6619 |
node = aSiblingArray[toBeDisplayed]; |
|
6620 |
toBeDisplayed--; |
|
6621 |
//Switch the display to 'block' to hidden siblings. |
|
6622 |
SetStringPropertyToNodeL( *sp, *node, KDisplay, KBlock ); |
|
6623 |
} |
|
6624 |
} |
|
6625 |
} |
|
6626 |
||
6627 |
// ----------------------------------------------------------------------------- |
|
6628 |
// IsCompoundNodeL |
|
6629 |
// Checks whether the node is coumound node. |
|
6630 |
// ----------------------------------------------------------------------------- |
|
6631 |
// |
|
6632 |
static TBool IsCompoundNodeL( CXnNode* aNode ) |
|
6633 |
{ |
|
6634 |
if ( !aNode ) |
|
6635 |
{ |
|
6636 |
return EFalse; |
|
6637 |
} |
|
6638 |
CXnProperty* compoundProperty = aNode->GetPropertyL( KCompound ); |
|
6639 |
if ( compoundProperty ) |
|
6640 |
{ |
|
6641 |
const TDesC8& value = compoundProperty->StringValue(); |
|
6642 |
if ( !value.Compare( KTrue ) ) |
|
6643 |
{ |
|
6644 |
return ETrue; |
|
6645 |
} |
|
6646 |
} |
|
6647 |
return EFalse; |
|
6648 |
} |
|
6649 |
||
6650 |
// ----------------------------------------------------------------------------- |
|
6651 |
// IsLoopingSetL |
|
6652 |
// Checks whether the node is set to loop. |
|
6653 |
// ----------------------------------------------------------------------------- |
|
6654 |
// |
|
6655 |
static TBool IsLoopingNodeL( CXnNode* aNode ) |
|
6656 |
{ |
|
6657 |
if ( !aNode ) |
|
6658 |
{ |
|
6659 |
return EFalse; |
|
6660 |
} |
|
6661 |
CXnProperty* navLoopProperty = aNode->GetPropertyL( |
|
6662 |
XnPropertyNames::style::common::KS60NavLooping ); |
|
6663 |
if ( navLoopProperty ) |
|
6664 |
{ |
|
6665 |
const TDesC8& loopValue = navLoopProperty->StringValue(); |
|
6666 |
if ( loopValue == XnPropertyNames::style::common::s60_focus_looping::KStop ) |
|
6667 |
{ |
|
6668 |
return EFalse; |
|
6669 |
} |
|
6670 |
} |
|
6671 |
return ETrue; |
|
6672 |
} |
|
6673 |
||
6674 |
// ----------------------------------------------------------------------------- |
|
6675 |
// NotifyScrollNodeL |
|
6676 |
// Notify scroll node i.e compound box first and last siblings that there is |
|
6677 |
// nothing more to scroll |
|
6678 |
// ----------------------------------------------------------------------------- |
|
6679 |
// |
|
6680 |
static void NotifyScrollNodeL( CXnNode* aNode, TBool aBegin, TBool aGainEnd ) |
|
6681 |
{ |
|
6682 |
RPointerArray< CXnNode >& siblings = aNode->Parent()->Children(); |
|
6683 |
// Last sibling is assumend to be an end scrolling node |
|
6684 |
CXnNode* scrollNode = siblings[0]; |
|
6685 |
if ( !aBegin ) |
|
6686 |
{ |
|
6687 |
scrollNode = siblings[siblings.Count() - 1]; |
|
6688 |
} |
|
6689 |
CXnNode* triggerNode = |
|
6690 |
BuildTriggerNodeL( *scrollNode->UiEngine(), aGainEnd?KGainEnd:KLoseEnd ); |
|
6691 |
triggerNode->SetUiEngine( *scrollNode->UiEngine() ); |
|
6692 |
CleanupStack::PushL( triggerNode ); |
|
6693 |
scrollNode->ReportXuikonEventL( *triggerNode ); |
|
6694 |
CleanupStack::PopAndDestroy( triggerNode ); |
|
6695 |
} |
|
6696 |
||
6697 |
// ----------------------------------------------------------------------------- |
|
6698 |
// DoCompoundNodeBeginKeyL |
|
6699 |
// If key towards begin of list was pressed scroll to that direction |
|
6700 |
// ----------------------------------------------------------------------------- |
|
6701 |
// |
|
6702 |
static void DoCompoundNodeBeginKeyL( |
|
6703 |
RPointerArray< CXnNode >& aChildren, |
|
6704 |
CXnNode* aFocusedNode ) |
|
6705 |
{ |
|
6706 |
TInt oldestIndex( 0 ); |
|
6707 |
// Notify scrollNode if aFocusedNode is node end of the list |
|
6708 |
CXnNode* lastItem = aChildren[aChildren.Count() - 1]; |
|
6709 |
if ( aFocusedNode == lastItem && !IsLoopingNodeL( lastItem ) ) |
|
6710 |
{ |
|
6711 |
NotifyScrollNodeL( aChildren[0]->Parent(), EFalse, EFalse ); |
|
6712 |
} |
|
6713 |
CXnNode* node = FindOldestSiblingWithDisplayL( aChildren, KBlock, oldestIndex ); |
|
6714 |
// Set next node's display to block |
|
6715 |
if ( node && node == aFocusedNode ) |
|
6716 |
{ |
|
6717 |
if ( oldestIndex - 1 >= 0 ) |
|
6718 |
{ |
|
6719 |
node = aChildren[oldestIndex - 1]; |
|
6720 |
CXnDomStringPool* sp = node->DomNode()->StringPool(); |
|
6721 |
SetStringPropertyToNodeL( *sp, *node, KDisplay, KBlock ); |
|
6722 |
// find youngest sibling with display block |
|
6723 |
TInt index( 0 ); |
|
6724 |
node = FindYoungestSiblingWithDisplayL( aChildren, KBlock, index ); |
|
6725 |
if ( node ) |
|
6726 |
{ |
|
6727 |
SetStringPropertyToNodeL( *sp, *node, KDisplay, KNone ); |
|
6728 |
} |
|
6729 |
} |
|
6730 |
else |
|
6731 |
{ |
|
6732 |
if ( IsLoopingNodeL( node ) ) |
|
6733 |
{ |
|
6734 |
ScrollBoxToEndL( aChildren ); |
|
6735 |
} |
|
6736 |
else |
|
6737 |
{ |
|
6738 |
NotifyScrollNodeL( aChildren[0]->Parent(), ETrue, ETrue ); |
|
6739 |
} |
|
6740 |
} |
|
6741 |
} |
|
6742 |
} |
|
6743 |
||
6744 |
// ----------------------------------------------------------------------------- |
|
6745 |
// DoCompoundNodeEndKeyL |
|
6746 |
// If key towards end of list was pressed scroll to that direction |
|
6747 |
// ----------------------------------------------------------------------------- |
|
6748 |
// |
|
6749 |
static void DoCompoundNodeEndKeyL( |
|
6750 |
RPointerArray< CXnNode >& aChildren, |
|
6751 |
CXnNode* aFocusedNode ) |
|
6752 |
{ |
|
6753 |
TInt index( 0 ); |
|
6754 |
TInt siblingCount( aChildren.Count() ); |
|
6755 |
// Notify scrollNode if aFocusedNode is first node of the list |
|
6756 |
CXnNode* firstItem = aChildren[0]; |
|
6757 |
if ( aFocusedNode == firstItem && !IsLoopingNodeL( firstItem ) ) |
|
6758 |
{ |
|
6759 |
NotifyScrollNodeL( aChildren[0]->Parent(), ETrue, EFalse ); |
|
6760 |
} |
|
6761 |
CXnNode* node = FindYoungestSiblingWithDisplayL( aChildren, KBlock, index ); |
|
6762 |
// Set next node's display to block |
|
6763 |
if ( node && node == aFocusedNode ) |
|
6764 |
{ |
|
6765 |
if ( index < siblingCount - 1 ) |
|
6766 |
{ |
|
6767 |
node = aChildren[index + 1]; |
|
6768 |
CXnDomStringPool* sp = node->DomNode()->StringPool(); |
|
6769 |
SetStringPropertyToNodeL( *sp , *node, KDisplay, KBlock ); |
|
6770 |
// find oldest sibling with display block |
|
6771 |
TInt oldestIndex( 0 ); |
|
6772 |
node = FindOldestSiblingWithDisplayL( aChildren, KBlock, oldestIndex ); |
|
6773 |
if ( node ) |
|
6774 |
{ |
|
6775 |
SetStringPropertyToNodeL( *sp, *node, KDisplay, KNone ); |
|
6776 |
} |
|
6777 |
} |
|
6778 |
else // we are end of list |
|
6779 |
{ |
|
6780 |
if ( IsLoopingNodeL( node ) ) |
|
6781 |
{ |
|
6782 |
ScrollBoxToBeginningL( aChildren ); |
|
6783 |
} |
|
6784 |
else |
|
6785 |
{ |
|
6786 |
NotifyScrollNodeL( aChildren[0]->Parent(), EFalse, ETrue ); |
|
6787 |
} |
|
6788 |
} |
|
6789 |
} |
|
6790 |
} |
|
6791 |
||
6792 |
// ----------------------------------------------------------------------------- |
|
6793 |
// DoCompoundNodeScrollingL |
|
6794 |
// Process compound node key events |
|
6795 |
// ----------------------------------------------------------------------------- |
|
6796 |
// |
|
6797 |
static void DoCompoundNodeScrollingL( |
|
6798 |
CXnNode& aFocusedNode, |
|
6799 |
const TKeyEvent& aKeyEvent, |
|
6800 |
TEventCode aType ) |
|
6801 |
{ |
|
6802 |
if ( aType != EEventKey ) |
|
6803 |
{ |
|
6804 |
return; |
|
6805 |
} |
|
6806 |
CXnNode* compoundNode = aFocusedNode.Parent(); |
|
6807 |
if ( IsCompoundNodeL( compoundNode ) ) |
|
6808 |
{ |
|
6809 |
RPointerArray< CXnNode >& children = compoundNode->Children(); |
|
6810 |
||
6811 |
if ( aKeyEvent.iScanCode != EStdKeyLeftArrow && |
|
6812 |
aKeyEvent.iScanCode != EStdKeyRightArrow && |
|
6813 |
aKeyEvent.iScanCode != EStdKeyDownArrow && |
|
6814 |
aKeyEvent.iScanCode != EStdKeyUpArrow ) |
|
6815 |
{ |
|
6816 |
return; |
|
6817 |
} |
|
6818 |
CXnNode* parent = aFocusedNode.Parent(); |
|
6819 |
if ( !parent ) |
|
6820 |
{ |
|
6821 |
return; |
|
6822 |
} |
|
6823 |
else |
|
6824 |
{ |
|
6825 |
const TDesC8* direction( |
|
6826 |
&XnPropertyNames::style::common::direction::KLTR ); |
|
6827 |
const TDesC8* orientation( |
|
6828 |
&XnPropertyNames::style::common::block_progression::KTB ); |
|
6829 |
||
6830 |
CXnProperty* directionProperty( parent->DirectionL() ); |
|
6831 |
||
6832 |
if ( directionProperty ) |
|
6833 |
{ |
|
6834 |
direction = &directionProperty->StringValue(); |
|
6835 |
} |
|
6836 |
||
6837 |
CXnProperty* orientationProperty( parent->BlockProgressionL() ); |
|
6838 |
||
6839 |
if ( orientationProperty ) |
|
6840 |
{ |
|
6841 |
orientation = &orientationProperty->StringValue(); |
|
6842 |
} |
|
6843 |
||
6844 |
if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
6845 |
( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
6846 |
*orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
6847 |
{ |
|
6848 |
if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
6849 |
{ |
|
6850 |
DoCompoundNodeBeginKeyL( children, &aFocusedNode ); |
|
6851 |
} |
|
6852 |
if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
6853 |
{ |
|
6854 |
DoCompoundNodeEndKeyL( children, &aFocusedNode ); |
|
6855 |
} |
|
6856 |
} |
|
6857 |
else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
6858 |
( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
6859 |
*orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
6860 |
{ |
|
6861 |
if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
6862 |
{ |
|
6863 |
DoCompoundNodeEndKeyL( children, &aFocusedNode ); |
|
6864 |
} |
|
6865 |
if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
6866 |
{ |
|
6867 |
DoCompoundNodeBeginKeyL( children, &aFocusedNode ); |
|
6868 |
} |
|
6869 |
} |
|
6870 |
else if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
6871 |
*orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
6872 |
{ |
|
6873 |
if ( aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
6874 |
{ |
|
6875 |
DoCompoundNodeBeginKeyL( children, &aFocusedNode ); |
|
6876 |
} |
|
6877 |
else if ( aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
6878 |
{ |
|
6879 |
DoCompoundNodeEndKeyL( children, &aFocusedNode ); |
|
6880 |
} |
|
6881 |
} |
|
6882 |
else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
6883 |
*orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
6884 |
{ |
|
6885 |
if ( aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
6886 |
{ |
|
6887 |
DoCompoundNodeBeginKeyL( children, &aFocusedNode ); |
|
6888 |
} |
|
6889 |
else if ( aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
6890 |
{ |
|
6891 |
DoCompoundNodeEndKeyL( children, &aFocusedNode ); |
|
6892 |
} |
|
6893 |
} |
|
6894 |
} |
|
6895 |
} |
|
6896 |
} |
|
6897 |
||
6898 |
// ----------------------------------------------------------------------------- |
|
6899 |
// BuildTriggerNodeL |
|
6900 |
// Builds a trigger node |
|
6901 |
// ----------------------------------------------------------------------------- |
|
6902 |
// |
|
6903 |
static CXnNode* BuildTriggerNodeL( |
|
6904 |
CXnUiEngine& aUiEngine, |
|
6905 |
const TDesC8& aTriggerName ) |
|
6906 |
{ |
|
6907 |
CXnNode* node = CXnNode::NewL(); |
|
6908 |
CleanupStack::PushL( node ); |
|
6909 |
CXnType* type = CXnType::NewL( XnPropertyNames::action::KTrigger ); |
|
6910 |
CleanupStack::PushL( type ); |
|
6911 |
CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
6912 |
CleanupStack::Pop( type ); |
|
6913 |
node->SetImpl( impl ); |
|
6914 |
node->SetUiEngine( aUiEngine ); |
|
6915 |
CXnDomPropertyValue* nameValue = |
|
6916 |
CXnDomPropertyValue::NewL( aUiEngine.ODT()->DomDocument().StringPool() ); |
|
6917 |
CleanupStack::PushL( nameValue ); |
|
6918 |
nameValue->SetStringValueL( CXnDomPropertyValue::EString, aTriggerName ); |
|
6919 |
CXnProperty* name = CXnProperty::NewL( |
|
6920 |
XnPropertyNames::action::trigger::KName, |
|
6921 |
nameValue, |
|
6922 |
*aUiEngine.ODT()->DomDocument().StringPool() ); |
|
6923 |
CleanupStack::Pop( nameValue ); |
|
6924 |
CleanupStack::PushL( name ); |
|
6925 |
node->SetPropertyL( name ); |
|
6926 |
CleanupStack::Pop( name ); |
|
6927 |
CleanupStack::Pop( node ); |
|
6928 |
return node; |
|
6929 |
} |
|
6930 |
||
6931 |
// ============================ MEMBER FUNCTIONS =============================== |
|
6932 |
||
6933 |
// ----------------------------------------------------------------------------- |
|
6934 |
// CXnNodeImpl::NewL() |
|
6935 |
// Two-phased constructor. |
|
6936 |
// ----------------------------------------------------------------------------- |
|
6937 |
// |
|
6938 |
CXnNodeImpl* CXnNodeImpl::NewL( CXnType* aType ) |
|
6939 |
{ |
|
6940 |
CXnNodeImpl* self = new ( ELeave ) CXnNodeImpl; |
|
6941 |
||
6942 |
CleanupStack::PushL( self ); |
|
6943 |
self->ConstructL( aType ); |
|
6944 |
CleanupStack::Pop(); |
|
6945 |
||
6946 |
return self; |
|
6947 |
} |
|
6948 |
||
6949 |
// ----------------------------------------------------------------------------- |
|
6950 |
// CXnNodeImpl::ConstructL() |
|
6951 |
// Symbian 2nd phase constructor can leave. |
|
6952 |
// ----------------------------------------------------------------------------- |
|
6953 |
// |
|
6954 |
void CXnNodeImpl::ConstructL( CXnType* aType ) |
|
6955 |
{ |
|
6956 |
iType = aType; |
|
6957 |
iPropertyList = CXnPropertyList::NewL(); |
|
6958 |
iLayoutCapable = ETrue; |
|
6959 |
iHandleTooltip = ETrue; |
|
6960 |
} |
|
6961 |
||
6962 |
// ----------------------------------------------------------------------------- |
|
6963 |
// CXnNodeImpl::CXnNodeImpl() |
|
6964 |
// C++ default constructor can NOT contain any code, that |
|
6965 |
// might leave. |
|
6966 |
// ----------------------------------------------------------------------------- |
|
6967 |
// |
|
6968 |
CXnNodeImpl::CXnNodeImpl() |
|
6969 |
: iDropped( 0 ), iChildren( 1 ), iAdaptive( 0 ) |
|
6970 |
{ |
|
6971 |
} |
|
6972 |
||
6973 |
// ----------------------------------------------------------------------------- |
|
6974 |
// CXnNodeImpl::~CXnNodeImpl() |
|
6975 |
// C++ default destructor. |
|
6976 |
// ----------------------------------------------------------------------------- |
|
6977 |
// |
|
6978 |
CXnNodeImpl::~CXnNodeImpl() |
|
6979 |
{ |
|
6980 |
delete iPropertyList; |
|
6981 |
delete iType; |
|
6982 |
iPropertyPseudoClasses.Reset(); |
|
6983 |
iStates.Reset(); |
|
6984 |
iChildren.ResetAndDestroy(); |
|
6985 |
delete iLayoutPropertyCache; |
|
6986 |
} |
|
6987 |
||
6988 |
// ----------------------------------------------------------------------------- |
|
6989 |
// CXnNodeImpl::SetNode |
|
6990 |
// ----------------------------------------------------------------------------- |
|
6991 |
// |
|
6992 |
void CXnNodeImpl::SetNode( CXnNode& aNode ) |
|
6993 |
{ |
|
6994 |
iNode = &aNode; |
|
6995 |
} |
|
6996 |
||
6997 |
// ----------------------------------------------------------------------------- |
|
6998 |
// CXnNodeImpl::Node |
|
6999 |
// ----------------------------------------------------------------------------- |
|
7000 |
// |
|
7001 |
CXnNode* CXnNodeImpl::Node() |
|
7002 |
{ |
|
7003 |
return iNode; |
|
7004 |
} |
|
7005 |
||
7006 |
// ----------------------------------------------------------------------------- |
|
7007 |
// CXnNodeImpl::SetRect |
|
7008 |
// ----------------------------------------------------------------------------- |
|
7009 |
// |
|
7010 |
void CXnNodeImpl::SetRect( const TRect& aRect ) |
|
7011 |
{ |
|
7012 |
iRect = aRect; |
|
7013 |
} |
|
7014 |
||
7015 |
// ----------------------------------------------------------------------------- |
|
7016 |
// CXnNodeImpl::Rect |
|
7017 |
// ----------------------------------------------------------------------------- |
|
7018 |
// |
|
7019 |
TRect CXnNodeImpl::Rect() |
|
7020 |
{ |
|
7021 |
return AdjustRectIfNeeded(iRect); |
|
7022 |
} |
|
7023 |
||
7024 |
// ----------------------------------------------------------------------------- |
|
7025 |
// CXnNodeImpl::SetBorderRect |
|
7026 |
// ----------------------------------------------------------------------------- |
|
7027 |
// |
|
7028 |
void CXnNodeImpl::SetBorderRect( const TRect& aRect ) |
|
7029 |
{ |
|
7030 |
iBorderRect = aRect; |
|
7031 |
} |
|
7032 |
||
7033 |
// ----------------------------------------------------------------------------- |
|
7034 |
// CXnNodeImpl::BorderRect |
|
7035 |
// ----------------------------------------------------------------------------- |
|
7036 |
// |
|
7037 |
TRect CXnNodeImpl::BorderRect() |
|
7038 |
{ |
|
7039 |
return AdjustRectIfNeeded(iBorderRect); |
|
7040 |
} |
|
7041 |
||
7042 |
// ----------------------------------------------------------------------------- |
|
7043 |
// CXnNodeImpl::SetNormalFlowBorderRect |
|
7044 |
// ----------------------------------------------------------------------------- |
|
7045 |
// |
|
7046 |
void CXnNodeImpl::SetNormalFlowBorderRect( const TRect& aRect ) |
|
7047 |
{ |
|
7048 |
iNormalFlowBorderRect = aRect; |
|
7049 |
} |
|
7050 |
||
7051 |
// ----------------------------------------------------------------------------- |
|
7052 |
// CXnNodeImpl::NormalFlowBorderRect |
|
7053 |
// ----------------------------------------------------------------------------- |
|
7054 |
// |
|
7055 |
TRect CXnNodeImpl::NormalFlowBorderRect() |
|
7056 |
{ |
|
7057 |
return AdjustRectIfNeeded(iNormalFlowBorderRect); |
|
7058 |
} |
|
7059 |
||
7060 |
// ----------------------------------------------------------------------------- |
|
7061 |
// CXnNodeImpl::SetMarginRect |
|
7062 |
// ----------------------------------------------------------------------------- |
|
7063 |
// |
|
7064 |
void CXnNodeImpl::SetMarginRect( const TRect& aRect ) |
|
7065 |
{ |
|
7066 |
iMarginRect = aRect; |
|
7067 |
} |
|
7068 |
||
7069 |
// ----------------------------------------------------------------------------- |
|
7070 |
// CXnNodeImpl::MarginRect |
|
7071 |
// ----------------------------------------------------------------------------- |
|
7072 |
// |
|
7073 |
TRect CXnNodeImpl::MarginRect() |
|
7074 |
{ |
|
7075 |
return AdjustRectIfNeeded(iMarginRect); |
|
7076 |
} |
|
7077 |
||
7078 |
// ----------------------------------------------------------------------------- |
|
7079 |
// CXnNodeImpl::SetPaddingRect |
|
7080 |
// ----------------------------------------------------------------------------- |
|
7081 |
// |
|
7082 |
void CXnNodeImpl::SetPaddingRect( const TRect& aRect ) |
|
7083 |
{ |
|
7084 |
iPaddingRect = aRect; |
|
7085 |
} |
|
7086 |
||
7087 |
// ----------------------------------------------------------------------------- |
|
7088 |
// CXnNodeImpl::PaddingRect |
|
7089 |
// ----------------------------------------------------------------------------- |
|
7090 |
// |
|
7091 |
TRect CXnNodeImpl::PaddingRect() |
|
7092 |
{ |
|
7093 |
return AdjustRectIfNeeded(iPaddingRect); |
|
7094 |
} |
|
7095 |
||
7096 |
// ----------------------------------------------------------------------------- |
|
7097 |
// CXnNodeImpl::Type() |
|
7098 |
// Returns control type. |
|
7099 |
// ----------------------------------------------------------------------------- |
|
7100 |
// |
|
7101 |
CXnType* CXnNodeImpl::Type() |
|
7102 |
{ |
|
7103 |
return iType; |
|
7104 |
} |
|
7105 |
||
7106 |
// ----------------------------------------------------------------------------- |
|
7107 |
// CXnNodeImpl::Parent |
|
7108 |
// Get component parent |
|
7109 |
// ----------------------------------------------------------------------------- |
|
7110 |
// |
|
7111 |
CXnNode* CXnNodeImpl::Parent() const |
|
7112 |
{ |
|
7113 |
return iParent; |
|
7114 |
} |
|
7115 |
||
7116 |
// ----------------------------------------------------------------------------- |
|
7117 |
// CXnNodeImpl::SetParent |
|
7118 |
// Set component parent |
|
7119 |
// ----------------------------------------------------------------------------- |
|
7120 |
// |
|
7121 |
void CXnNodeImpl::SetParent( CXnNode& aParent ) |
|
7122 |
{ |
|
7123 |
iParent = &aParent; |
|
7124 |
} |
|
7125 |
||
7126 |
// ----------------------------------------------------------------------------- |
|
7127 |
// CXnNodeImpl::AddChildL |
|
7128 |
// Adds a child to this container. |
|
7129 |
// ----------------------------------------------------------------------------- |
|
7130 |
// |
|
7131 |
void CXnNodeImpl::AddChildL( CXnNode* aChild ) |
|
7132 |
{ |
|
7133 |
TInt err = iChildren.Append( aChild ); |
|
7134 |
if ( err != KErrNone ) |
|
7135 |
{ |
|
7136 |
User::Leave( KXnErrAddChildToAreaFailed ); |
|
7137 |
} |
|
7138 |
aChild->SetParent( *iNode ); |
|
7139 |
} |
|
7140 |
||
7141 |
// ----------------------------------------------------------------------------- |
|
7142 |
// CXnNodeImpl::Children |
|
7143 |
// ----------------------------------------------------------------------------- |
|
7144 |
// |
|
7145 |
RPointerArray< CXnNode >& CXnNodeImpl::Children() |
|
7146 |
{ |
|
7147 |
return iChildren; |
|
7148 |
} |
|
7149 |
||
7150 |
// ----------------------------------------------------------------------------- |
|
7151 |
// CXnNodeImpl::SetPCDataL |
|
7152 |
// Set a property. |
|
7153 |
// ----------------------------------------------------------------------------- |
|
7154 |
// |
|
7155 |
void CXnNodeImpl::SetPCDataL( const TDesC8& aData ) |
|
7156 |
{ |
|
7157 |
iDomNode->SetPCDataL( aData ); |
|
7158 |
||
7159 |
SetDirtyL( XnDirtyLevel::ERender ); |
|
7160 |
||
7161 |
CXnDomStringPool* sp( iDomNode->StringPool() ); |
|
7162 |
||
7163 |
CXnDomPropertyValue* newValue = CXnDomPropertyValue::NewL( sp ); |
|
7164 |
CleanupStack::PushL( newValue ); |
|
7165 |
newValue->SetStringValueL( CXnDomPropertyValue::EString, KNullDesC8 ); |
|
7166 |
// create property |
|
7167 |
CXnProperty* prop = CXnProperty::NewL( |
|
7168 |
XnPropertyNames::common::KPCData, newValue, *sp ); |
|
7169 |
CleanupStack::Pop( newValue ); |
|
7170 |
CleanupStack::PushL( prop ); |
|
7171 |
||
7172 |
InformPropertyChangeL( *iNode, prop ); |
|
7173 |
||
7174 |
CleanupStack::PopAndDestroy( prop ); |
|
7175 |
} |
|
7176 |
||
7177 |
// ----------------------------------------------------------------------------- |
|
7178 |
// CXnNodeImpl::GetPCData |
|
7179 |
// Set a property. |
|
7180 |
// ----------------------------------------------------------------------------- |
|
7181 |
// |
|
7182 |
const TDesC8& CXnNodeImpl::GetPCData() |
|
7183 |
{ |
|
7184 |
return iDomNode->PCData(); |
|
7185 |
} |
|
7186 |
||
7187 |
// ----------------------------------------------------------------------------- |
|
7188 |
// CXnNodeImpl::SetHandleTooltip() |
|
7189 |
// Sets wheter to handle tooltips |
|
7190 |
// ----------------------------------------------------------------------------- |
|
7191 |
// |
|
7192 |
void CXnNodeImpl::SetHandleTooltip( TBool aFlag ) |
|
7193 |
{ |
|
7194 |
iHandleTooltip = aFlag; |
|
7195 |
} |
|
7196 |
||
7197 |
// ----------------------------------------------------------------------------- |
|
7198 |
// CXnNodeImpl::ShowPopupsL() |
|
7199 |
// Searchs and shoes tooltips |
|
7200 |
// ----------------------------------------------------------------------------- |
|
7201 |
// |
|
7202 |
void CXnNodeImpl::ShowPopupsL( TRect aRect, TInt aSource ) |
|
7203 |
{ |
|
7204 |
if ( iHandleTooltip ) |
|
7205 |
{ |
|
7206 |
for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
7207 |
{ |
|
7208 |
CXnNode* node( iChildren[i] ); |
|
7209 |
||
7210 |
if ( node->Type()->Type() == KToolTip ) |
|
7211 |
{ |
|
7212 |
CXnNodeAppIf& tooltipNode( node->AppIfL() ); |
|
7213 |
CXnPopup* popup( NULL ); |
|
7214 |
||
7215 |
XnComponentInterface::MakeInterfaceL( popup, tooltipNode ); |
|
7216 |
||
7217 |
if ( popup && aSource != XnEventSource::EStylus ) |
|
7218 |
{ |
|
7219 |
popup->ShowPopupL( aRect ); |
|
7220 |
} |
|
7221 |
} |
|
7222 |
} |
|
7223 |
} |
|
7224 |
} |
|
7225 |
||
7226 |
// ----------------------------------------------------------------------------- |
|
7227 |
// CXnNodeImpl::HidePopupsL() |
|
7228 |
// Searchs and hides tooltips |
|
7229 |
// ----------------------------------------------------------------------------- |
|
7230 |
// |
|
7231 |
void CXnNodeImpl::HidePopupsL() |
|
7232 |
{ |
|
7233 |
if ( iHandleTooltip ) |
|
7234 |
{ |
|
7235 |
for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
7236 |
{ |
|
7237 |
CXnNode* node( iChildren[i] ); |
|
7238 |
||
7239 |
if ( node->Type()->Type() == KToolTip ) |
|
7240 |
{ |
|
7241 |
CXnNodeAppIf& tooltipNode( node->AppIfL() ); |
|
7242 |
CXnPopup* popup( NULL ); |
|
7243 |
||
7244 |
XnComponentInterface::MakeInterfaceL( popup, tooltipNode ); |
|
7245 |
||
7246 |
if ( popup ) |
|
7247 |
{ |
|
7248 |
popup->HidePopupL(); |
|
7249 |
} |
|
7250 |
} |
|
7251 |
} |
|
7252 |
} |
|
7253 |
} |
|
7254 |
||
7255 |
// ----------------------------------------------------------------------------- |
|
7256 |
// CXnNodeImpl::SetPropertyL |
|
7257 |
// Sets a property, informs property change and builds trigger. |
|
7258 |
// ----------------------------------------------------------------------------- |
|
7259 |
// |
|
7260 |
void CXnNodeImpl::SetPropertyL( CXnProperty* aProperty, TBool aNotify ) |
|
7261 |
{ |
|
7262 |
TInt level( DoSetPropertyL( aProperty ) ); |
|
7263 |
||
7264 |
if ( !aNotify || level == XnDirtyLevel::ENone ) |
|
7265 |
{ |
|
7266 |
// all done |
|
7267 |
return; |
|
7268 |
} |
|
7269 |
||
7270 |
InformPropertyChangeL( *iNode, aProperty ); |
|
7271 |
||
7272 |
if ( iLayoutCapable && iNode->Parent() ) |
|
7273 |
{ |
|
7274 |
const TDesC8* value( NULL ); |
|
7275 |
const TDesC8& name( aProperty->Property()->Name() ); |
|
7276 |
TBool informChildren( EFalse ); |
|
7277 |
||
7278 |
if ( name == XnPropertyNames::style::common::KDisplay ) |
|
7279 |
{ |
|
7280 |
value = &XnPropertyNames::style::common::display::KNone; |
|
7281 |
informChildren = ETrue; |
|
7282 |
} |
|
7283 |
else if ( name == XnPropertyNames::style::common::KVisibility ) |
|
7284 |
{ |
|
7285 |
value = &XnPropertyNames::style::common::visibility::KHidden; |
|
7286 |
informChildren = ETrue; |
|
7287 |
} |
|
7288 |
||
7289 |
if ( value ) |
|
7290 |
{ |
|
7291 |
if ( *value == aProperty->StringValue() ) |
|
7292 |
{ |
|
7293 |
CXnNode* loseVisualisation( |
|
7294 |
BuildTriggerNodeL( |
|
7295 |
*iUiEngine, |
|
7296 |
XnPropertyNames::action::trigger::name::KLoseVisualisation ) ); |
|
7297 |
||
7298 |
CleanupStack::PushL( loseVisualisation ); |
|
7299 |
||
7300 |
CXnNode* focused( iUiEngine->FocusedNode() ); |
|
7301 |
||
7302 |
for ( CXnNode* node = focused; node; node = node->Parent() ) |
|
7303 |
{ |
|
7304 |
if ( node == iNode ) |
|
7305 |
{ |
|
7306 |
// Focus is either in this node or |
|
7307 |
// somewhere in this node's childrens |
|
7308 |
focused->UnsetStateL( |
|
7309 |
XnPropertyNames::style::common::KFocus ); |
|
7310 |
||
7311 |
focused->UnsetStateL( |
|
7312 |
XnPropertyNames::style::common::KHold ); |
|
7313 |
||
7314 |
focused->UnsetStateL( |
|
7315 |
XnPropertyNames::style::common::KActive ); |
|
7316 |
||
7317 |
// Report losevisualisation to focused node if the node |
|
7318 |
// is 'visualisationaware' |
|
7319 |
CXnProperty* visaware = GetPropertyL( |
|
7320 |
XnPropertyNames::common::KVisualisationAware ); |
|
7321 |
||
7322 |
if ( visaware && visaware->StringValue() == |
|
7323 |
XnPropertyNames::KTrue ) |
|
7324 |
{ |
|
7325 |
focused->ReportXuikonEventL( *loseVisualisation ); |
|
7326 |
} |
|
7327 |
||
7328 |
break; |
|
7329 |
} |
|
7330 |
} |
|
7331 |
||
7332 |
if ( focused != iNode ) |
|
7333 |
{ |
|
7334 |
// Report losevisualisation to this node if the node |
|
7335 |
// is 'visualisationaware' |
|
7336 |
CXnProperty* visaware = GetPropertyL( |
|
7337 |
XnPropertyNames::common::KVisualisationAware ); |
|
7338 |
if ( visaware && visaware->StringValue() == |
|
7339 |
XnPropertyNames::KTrue ) |
|
7340 |
{ |
|
7341 |
iNode->ReportXuikonEventL( *loseVisualisation ); |
|
7342 |
} |
|
7343 |
} |
|
7344 |
||
7345 |
CleanupStack::PopAndDestroy( loseVisualisation ); |
|
7346 |
} |
|
7347 |
else |
|
7348 |
{ |
|
7349 |
if ( !iUiEngine->FocusedNode() ) |
|
7350 |
{ |
|
7351 |
CXnNode* node( IsNodeNavigableL( Node() ) ); |
|
7352 |
||
7353 |
if ( node ) |
|
7354 |
{ |
|
7355 |
// This node can be focused |
|
7356 |
iUiEngine->AddFocusCandidateL( node ); |
|
7357 |
} |
|
7358 |
} |
|
7359 |
} |
|
7360 |
} |
|
7361 |
||
7362 |
if ( informChildren && ( iNode->Children().Count() > 0 ) ) |
|
7363 |
{ |
|
7364 |
//we have already done inform for the parent, so EFalse |
|
7365 |
InformChildrenPropertyChangeL( *iNode, aProperty, EFalse ); |
|
7366 |
} |
|
7367 |
} |
|
7368 |
} |
|
7369 |
||
7370 |
// ----------------------------------------------------------------------------- |
|
7371 |
// CXnNodeImpl::SetPropertyWithoutNotificationL |
|
7372 |
// Sets a property. |
|
7373 |
// ----------------------------------------------------------------------------- |
|
7374 |
// |
|
7375 |
void CXnNodeImpl::SetPropertyWithoutNotificationL( CXnProperty* aProperty ) |
|
7376 |
{ |
|
7377 |
SetPropertyL( aProperty, EFalse ); |
|
7378 |
} |
|
7379 |
||
7380 |
// ----------------------------------------------------------------------------- |
|
7381 |
// CXnNodeImpl::SetPropertyArrayL |
|
7382 |
// Sets an array of properties and after all the properties are set informs |
|
7383 |
// property change. |
|
7384 |
// ----------------------------------------------------------------------------- |
|
7385 |
// |
|
7386 |
void CXnNodeImpl::SetPropertyArrayL( |
|
7387 |
RPointerArray< CXnProperty >& aPropertyArray ) |
|
7388 |
{ |
|
7389 |
TBool informPropertyChange( EFalse ); |
|
7390 |
||
7391 |
TInt count( aPropertyArray.Count() ); |
|
7392 |
||
7393 |
iUiEngine->DisableRenderUiLC(); |
|
7394 |
||
7395 |
for ( TInt i = 0; i < count; i++ ) |
|
7396 |
{ |
|
7397 |
CXnProperty* aProp( aPropertyArray[i] ); |
|
7398 |
||
7399 |
const TDesC8& name( aProp->Property()->Name() ); |
|
7400 |
||
7401 |
if ( name == XnPropertyNames::style::common::KDisplay || |
|
7402 |
name == XnPropertyNames::style::common::KVisibility ) |
|
7403 |
{ |
|
7404 |
SetPropertyL( aProp ); |
|
7405 |
} |
|
7406 |
else |
|
7407 |
{ |
|
7408 |
SetPropertyL( aProp, EFalse ); |
|
7409 |
informPropertyChange = ETrue; |
|
7410 |
} |
|
7411 |
} |
|
7412 |
||
7413 |
if ( informPropertyChange ) |
|
7414 |
{ |
|
7415 |
InformPropertyChangeL( *iNode, NULL ); |
|
7416 |
} |
|
7417 |
||
7418 |
CleanupStack::PopAndDestroy(); |
|
7419 |
} |
|
7420 |
||
7421 |
// ----------------------------------------------------------------------------- |
|
7422 |
// CXnNodeImpl::DoSetPropertyL |
|
7423 |
// Does the actual property update |
|
7424 |
// ----------------------------------------------------------------------------- |
|
7425 |
// |
|
7426 |
TInt CXnNodeImpl::DoSetPropertyL( CXnProperty* aProperty ) |
|
7427 |
{ |
|
7428 |
TInt level( XnDirtyLevel::ENone ); |
|
7429 |
||
7430 |
const TDesC8& name( aProperty->Property()->Name() ); |
|
7431 |
||
7432 |
CXnProperty* prop( GetPropertyL( name ) ); |
|
7433 |
||
7434 |
if ( prop && prop->EqualsL( *aProperty ) ) |
|
7435 |
{ |
|
7436 |
// No change in the property value |
|
7437 |
delete aProperty; |
|
7438 |
||
7439 |
return level; |
|
7440 |
} |
|
7441 |
||
7442 |
level = DirtyLevelFromPropertyL( *iNode, name ); |
|
7443 |
||
7444 |
// Save the displayed state, before setting the property |
|
7445 |
TBool isDisplayed( IsNodeDisplayedL( *iNode ) ); |
|
7446 |
||
7447 |
CXnDomProperty::TPseudoClass pseudoClass( aProperty->Property()->PseudoClass() ); |
|
7448 |
||
7449 |
if ( pseudoClass != CXnDomProperty::ENone ) |
|
7450 |
{ |
|
7451 |
InsertPropertyPseudoClassL( pseudoClass, iPropertyPseudoClasses ); |
|
7452 |
||
7453 |
if ( IsStateSet( PseudoClassName( pseudoClass ) ) ) |
|
7454 |
{ |
|
7455 |
SetCachedProperty( |
|
7456 |
aProperty, |
|
7457 |
iLayoutPropertyCache, |
|
7458 |
iName, |
|
7459 |
iValue, |
|
7460 |
iLabel, |
|
7461 |
iInitialFocus, |
|
7462 |
iClass, |
|
7463 |
iId, |
|
7464 |
iPath, |
|
7465 |
iMaskPath, |
|
7466 |
EFalse, |
|
7467 |
EFalse ); |
|
7468 |
} |
|
7469 |
} |
|
7470 |
else |
|
7471 |
{ |
|
7472 |
SetCachedProperty( |
|
7473 |
aProperty, |
|
7474 |
iLayoutPropertyCache, |
|
7475 |
iName, |
|
7476 |
iValue, |
|
7477 |
iLabel, |
|
7478 |
iInitialFocus, |
|
7479 |
iClass, |
|
7480 |
iId, |
|
7481 |
iPath, |
|
7482 |
iMaskPath, |
|
7483 |
EFalse, |
|
7484 |
EFalse ); |
|
7485 |
} |
|
7486 |
||
7487 |
iPropertyList->SetPropertyL( aProperty ); |
|
7488 |
||
7489 |
TBool isDisplayedNow( IsNodeDisplayedL( *iNode ) ); |
|
7490 |
||
7491 |
level = ( iAdaptive & XnAdaptive::EIgnoreDirty ) ? XnDirtyLevel::ENone : level; |
|
7492 |
||
7493 |
// This is from layout calculation point of view |
|
7494 |
TBool displayed( ETrue ); |
|
7495 |
||
7496 |
if ( isDisplayed && !isDisplayedNow ) |
|
7497 |
{ |
|
7498 |
// Node loses its visualisation (either display: none, or |
|
7499 |
// visibility: hidden) Make sure control is hidden |
|
7500 |
CCoeControl* ctrl( iNode->Control() ); |
|
7501 |
||
7502 |
if ( ctrl ) |
|
7503 |
{ |
|
7504 |
ctrl->MakeVisible( EFalse ); |
|
7505 |
} |
|
7506 |
} |
|
7507 |
else if ( !isDisplayed && isDisplayedNow ) |
|
7508 |
{ |
|
7509 |
// Node gains its visualisation (both display: block, and |
|
7510 |
// visibility: visible) |
|
7511 |
// Run gainvisualisation trigger, if node is 'visualisationaware' |
|
7512 |
CXnProperty* visaware( |
|
7513 |
GetPropertyL( XnPropertyNames::common::KVisualisationAware ) ); |
|
7514 |
||
7515 |
if ( visaware && visaware->StringValue() == XnPropertyNames::KTrue ) |
|
7516 |
{ |
|
7517 |
CXnNode* gainVisualisation( BuildTriggerNodeL( *iUiEngine, |
|
7518 |
XnPropertyNames::action::trigger::name::KGainVisualisation ) ); |
|
7519 |
CleanupStack::PushL( gainVisualisation ); |
|
7520 |
iNode->ReportXuikonEventL( *gainVisualisation ); |
|
7521 |
CleanupStack::PopAndDestroy( gainVisualisation ); |
|
7522 |
} |
|
7523 |
} |
|
7524 |
else if ( !isDisplayed && !isDisplayedNow ) |
|
7525 |
{ |
|
7526 |
// No change |
|
7527 |
displayed = EFalse; |
|
7528 |
} |
|
7529 |
||
7530 |
SetDirtyL( level, displayed ); |
|
7531 |
||
7532 |
return level; |
|
7533 |
} |
|
7534 |
||
7535 |
// ----------------------------------------------------------------------------- |
|
7536 |
// CXnNodeImpl::InitializePropertyL |
|
7537 |
// Set a property. |
|
7538 |
// ----------------------------------------------------------------------------- |
|
7539 |
// |
|
7540 |
void CXnNodeImpl::InitializePropertyL( CXnProperty* aProperty ) |
|
7541 |
{ |
|
7542 |
if ( aProperty->Property()->PseudoClass() != CXnDomProperty::ENone ) |
|
7543 |
{ |
|
7544 |
InsertPropertyPseudoClassL( |
|
7545 |
aProperty->Property()->PseudoClass(), iPropertyPseudoClasses ); |
|
7546 |
||
7547 |
SetCachedProperty( |
|
7548 |
aProperty, |
|
7549 |
iLayoutPropertyCache, |
|
7550 |
iName, |
|
7551 |
iValue, |
|
7552 |
iLabel, |
|
7553 |
iInitialFocus, |
|
7554 |
iClass, |
|
7555 |
iId, |
|
7556 |
iPath, |
|
7557 |
iMaskPath, |
|
7558 |
ETrue, |
|
7559 |
ETrue ); |
|
7560 |
} |
|
7561 |
else |
|
7562 |
{ |
|
7563 |
SetCachedProperty( |
|
7564 |
aProperty, |
|
7565 |
iLayoutPropertyCache, |
|
7566 |
iName, |
|
7567 |
iValue, |
|
7568 |
iLabel, |
|
7569 |
iInitialFocus, |
|
7570 |
iClass, |
|
7571 |
iId, |
|
7572 |
iPath, |
|
7573 |
iMaskPath, |
|
7574 |
ETrue, |
|
7575 |
EFalse ); |
|
7576 |
} |
|
7577 |
||
7578 |
iPropertyList->SetPropertyL( aProperty ); |
|
7579 |
} |
|
7580 |
||
7581 |
// ----------------------------------------------------------------------------- |
|
7582 |
// CXnNodeImpl::GetPropertyL |
|
7583 |
// Gets a property. |
|
7584 |
// ----------------------------------------------------------------------------- |
|
7585 |
// |
|
7586 |
CXnProperty* CXnNodeImpl::GetPropertyL( const TDesC8& aKey ) |
|
7587 |
{ |
|
7588 |
CXnDomProperty* attribute = NULL; |
|
7589 |
CXnProperty* property = iPropertyList->GetProperty( aKey ); |
|
7590 |
||
7591 |
if ( property ) |
|
7592 |
{ |
|
7593 |
attribute = property->Property(); |
|
7594 |
CXnDomList& list = attribute->PropertyValueList(); |
|
7595 |
||
7596 |
if ( list.Length() == 0 ) |
|
7597 |
{ |
|
7598 |
return NULL; |
|
7599 |
} |
|
7600 |
||
7601 |
CXnDomPropertyValue* attributeValue = |
|
7602 |
static_cast< CXnDomPropertyValue* >( list.Item( 0 ) ); |
|
7603 |
||
7604 |
if ( !attributeValue ) |
|
7605 |
{ |
|
7606 |
return NULL; |
|
7607 |
} |
|
7608 |
||
7609 |
if ( attributeValue->IsInheritIdent() && iParent ) |
|
7610 |
{ |
|
7611 |
// inherited values are queried from the parent |
|
7612 |
property = iParent->GetPropertyL( aKey ); |
|
7613 |
} |
|
7614 |
||
7615 |
// otherwise just return the value |
|
7616 |
return property; |
|
7617 |
} |
|
7618 |
||
7619 |
// if not found, return NULL |
|
7620 |
return NULL; |
|
7621 |
} |
|
7622 |
||
7623 |
// ----------------------------------------------------------------------------- |
|
7624 |
// CXnNodeImpl::SetStateL |
|
7625 |
// Set a pseudoclass |
|
7626 |
// ----------------------------------------------------------------------------- |
|
7627 |
// |
|
7628 |
void CXnNodeImpl::SetStateL( const TDesC8& aState, TInt aSource ) |
|
7629 |
{ |
|
7630 |
if ( IsStateSet( aState ) ) |
|
7631 |
{ |
|
7632 |
return; |
|
7633 |
} |
|
7634 |
||
7635 |
TBool focusReceived( EFalse ); |
|
7636 |
TBool activated( EFalse ); |
|
7637 |
TBool stateChanged( EFalse ); |
|
7638 |
||
7639 |
if ( aState == XnPropertyNames::action::trigger::name::KFocus ) |
|
7640 |
{ |
|
7641 |
if ( !iUiEngine->AppUiAdapter().FocusShown() ) |
|
7642 |
{ |
|
7643 |
return; |
|
7644 |
} |
|
7645 |
||
7646 |
focusReceived = DoReceiveFocusL( *iNode, *iUiEngine ); |
|
7647 |
||
7648 |
if ( focusReceived ) |
|
7649 |
{ |
|
7650 |
// focused |
|
7651 |
HidePopupsL(); |
|
7652 |
ShowPopupsL( iNode->Rect(), aSource ); |
|
7653 |
||
7654 |
if ( IsStateSet( XnPropertyNames::action::trigger::name::KPassiveFocus ) ) |
|
7655 |
{ |
|
7656 |
iUiEngine->RemovePassiveFocusedNodeL( iNode ); |
|
7657 |
} |
|
7658 |
||
7659 |
stateChanged = focusReceived = iPropertyList->SetStateL( aState ); |
|
7660 |
} |
|
7661 |
} |
|
7662 |
else if ( aState == XnPropertyNames::style::common::KPressedDown ) |
|
7663 |
{ |
|
7664 |
if ( IsStateSet( XnPropertyNames::action::trigger::name::KFocus ) ) |
|
7665 |
{ |
|
7666 |
iPropertyList->SetStateL( |
|
7667 |
XnPropertyNames::style::common::KPressedDown ); |
|
7668 |
iNode->SetDirtyL( XnDirtyLevel::ERender ); |
|
7669 |
} |
|
7670 |
} |
|
7671 |
else if ( aState == XnPropertyNames::style::common::KActive ) |
|
7672 |
{ |
|
7673 |
activated = ETrue; |
|
7674 |
} |
|
7675 |
else if ( aState == XnPropertyNames::action::trigger::name::KPassiveFocus ) |
|
7676 |
{ |
|
7677 |
// is focusable node |
|
7678 |
if ( DoReceiveFocusL( *iNode, *iUiEngine ) ) |
|
7679 |
{ |
|
7680 |
// focused |
|
7681 |
stateChanged = iPropertyList->SetStateL( aState ); |
|
7682 |
} |
|
7683 |
} |
|
7684 |
else |
|
7685 |
{ |
|
7686 |
stateChanged = iPropertyList->SetStateL( aState ); |
|
7687 |
} |
|
7688 |
||
7689 |
if ( stateChanged ) |
|
7690 |
{ |
|
7691 |
CXnDomProperty::TPseudoClass pseudoClass( PseudoClassFromName( aState ) ); |
|
7692 |
||
7693 |
if ( pseudoClass != CXnDomProperty::ENone ) |
|
7694 |
{ |
|
7695 |
iStates.Append( pseudoClass ); |
|
7696 |
||
7697 |
// Ensure that pseudo class is defined |
|
7698 |
InsertPropertyPseudoClassL( pseudoClass, iPropertyPseudoClasses ); |
|
7699 |
||
7700 |
if ( IsPropertyPseudoClass( pseudoClass, iPropertyPseudoClasses ) ) |
|
7701 |
{ |
|
7702 |
EnableStatePropertiesL( *iNode, pseudoClass, iLayoutPropertyCache ); |
|
7703 |
||
7704 |
InformPropertyChangeL( *iNode ); |
|
7705 |
} |
|
7706 |
} |
|
7707 |
||
7708 |
if ( aState == XnPropertyNames::style::common::KPressedDown ) |
|
7709 |
{ |
|
7710 |
iNode->SetDirtyL( XnDirtyLevel::ERender ); |
|
7711 |
} |
|
7712 |
} |
|
7713 |
||
7714 |
if ( focusReceived && aState == XnPropertyNames::action::trigger::name::KFocus ) |
|
7715 |
{ |
|
7716 |
iUiEngine->SetFocusedNodeL( iNode, aSource ); |
|
7717 |
} |
|
7718 |
||
7719 |
if ( activated ) |
|
7720 |
{ |
|
7721 |
iUiEngine->AppUiAdapter().ItemActivator().ActivateL( iNode ); |
|
7722 |
} |
|
7723 |
||
7724 |
if ( stateChanged ) |
|
7725 |
{ |
|
7726 |
iUiEngine->RenderUIL(); |
|
7727 |
} |
|
7728 |
} |
|
7729 |
||
7730 |
// ----------------------------------------------------------------------------- |
|
7731 |
// CXnNodeImpl::IsStateSet |
|
7732 |
// Check whether a state is set or not |
|
7733 |
// ----------------------------------------------------------------------------- |
|
7734 |
// |
|
7735 |
TBool CXnNodeImpl::IsStateSet( const TDesC8& aState ) |
|
7736 |
{ |
|
7737 |
return iPropertyList->IsStateSet( aState ); |
|
7738 |
} |
|
7739 |
||
7740 |
// ----------------------------------------------------------------------------- |
|
7741 |
// CXnNodeImpl::SetStateWithoutNotificationL |
|
7742 |
// Set a pseudoclass |
|
7743 |
// ----------------------------------------------------------------------------- |
|
7744 |
// |
|
7745 |
void CXnNodeImpl::SetStateWithoutNotificationL( const TDesC8& aState ) |
|
7746 |
{ |
|
7747 |
if ( IsStateSet( aState ) ) |
|
7748 |
{ |
|
7749 |
return; |
|
7750 |
} |
|
7751 |
||
7752 |
TBool setState( ETrue ); |
|
7753 |
||
7754 |
if ( aState == XnPropertyNames::action::trigger::name::KFocus ) |
|
7755 |
{ |
|
7756 |
if ( !iUiEngine->AppUiAdapter().FocusShown() ) |
|
7757 |
{ |
|
7758 |
return; |
|
7759 |
} |
|
7760 |
||
7761 |
setState = DoReceiveFocusL( *iNode, *iUiEngine ); |
|
7762 |
} |
|
7763 |
||
7764 |
if ( setState && iPropertyList->SetStateL( aState ) ) |
|
7765 |
{ |
|
7766 |
CXnDomProperty::TPseudoClass pseudoClass( PseudoClassFromName( aState ) ); |
|
7767 |
||
7768 |
if ( pseudoClass != CXnDomProperty::ENone ) |
|
7769 |
{ |
|
7770 |
iStates.Append( pseudoClass ); |
|
7771 |
||
7772 |
// Ensure that pseudo class is defined |
|
7773 |
InsertPropertyPseudoClassL( pseudoClass, iPropertyPseudoClasses ); |
|
7774 |
||
7775 |
if ( IsPropertyPseudoClass( pseudoClass, iPropertyPseudoClasses ) ) |
|
7776 |
{ |
|
7777 |
EnableStatePropertiesL( *iNode, pseudoClass, iLayoutPropertyCache ); |
|
7778 |
} |
|
7779 |
} |
|
7780 |
||
7781 |
if ( aState == XnPropertyNames::action::trigger::name::KFocus ) |
|
7782 |
{ |
|
7783 |
iUiEngine->SetFocusedNodeL( iNode ); |
|
7784 |
||
7785 |
HidePopupsL(); |
|
7786 |
} |
|
7787 |
||
7788 |
iUiEngine->RenderUIL(); |
|
7789 |
} |
|
7790 |
} |
|
7791 |
||
7792 |
// ----------------------------------------------------------------------------- |
|
7793 |
// CXnNodeImpl::UnsetStateL |
|
7794 |
// Unset a pseudoclass |
|
7795 |
// ----------------------------------------------------------------------------- |
|
7796 |
// |
|
7797 |
void CXnNodeImpl::UnsetStateL( const TDesC8& aState ) |
|
7798 |
{ |
|
7799 |
if ( !IsStateSet( aState ) ) |
|
7800 |
{ |
|
7801 |
return; |
|
7802 |
} |
|
7803 |
||
7804 |
if ( aState == XnPropertyNames::action::trigger::name::KFocus ) |
|
7805 |
{ |
|
7806 |
HidePopupsL(); |
|
7807 |
||
7808 |
iPropertyList->UnsetState( |
|
7809 |
XnPropertyNames::style::common::KPressedDown ); |
|
7810 |
||
7811 |
if ( iUiEngine->FocusedNode() == iNode ) |
|
7812 |
{ |
|
7813 |
iUiEngine->SetFocusedNodeL( NULL ); |
|
7814 |
} |
|
7815 |
} |
|
7816 |
||
7817 |
TBool stateChanged( iPropertyList->UnsetState( aState ) ); |
|
7818 |
||
7819 |
if ( stateChanged ) |
|
7820 |
{ |
|
7821 |
CXnDomProperty::TPseudoClass pseudoClass( PseudoClassFromName( aState ) ); |
|
7822 |
||
7823 |
if ( IsPropertyPseudoClass( pseudoClass, iPropertyPseudoClasses ) ) |
|
7824 |
{ |
|
7825 |
DisableStatePropertiesL( |
|
7826 |
*iNode, pseudoClass, iStates, iLayoutPropertyCache ); |
|
7827 |
||
7828 |
InformPropertyChangeL( *iNode ); |
|
7829 |
} |
|
7830 |
||
7831 |
for ( TInt i = iStates.Count() - 1; i >= 0; --i ) |
|
7832 |
{ |
|
7833 |
if ( iStates[i] == pseudoClass ) |
|
7834 |
{ |
|
7835 |
iStates.Remove( i ); |
|
7836 |
} |
|
7837 |
} |
|
7838 |
||
7839 |
if ( aState == XnPropertyNames::style::common::KPressedDown ) |
|
7840 |
{ |
|
7841 |
iNode->SetDirtyL( XnDirtyLevel::ERender ); |
|
7842 |
} |
|
7843 |
||
7844 |
iUiEngine->RenderUIL(); |
|
7845 |
} |
|
7846 |
} |
|
7847 |
||
7848 |
// ----------------------------------------------------------------------------- |
|
7849 |
// CXnNodeImpl::SetUiEngine |
|
7850 |
// ----------------------------------------------------------------------------- |
|
7851 |
// |
|
7852 |
void CXnNodeImpl::SetUiEngine( CXnUiEngine& aEngine ) |
|
7853 |
{ |
|
7854 |
iUiEngine = &aEngine; |
|
7855 |
} |
|
7856 |
||
7857 |
// ----------------------------------------------------------------------------- |
|
7858 |
// CXnNodeImpl::UiEngine |
|
7859 |
// ----------------------------------------------------------------------------- |
|
7860 |
// |
|
7861 |
CXnUiEngine* CXnNodeImpl::UiEngine() |
|
7862 |
{ |
|
7863 |
return iUiEngine; |
|
7864 |
} |
|
7865 |
||
7866 |
// ----------------------------------------------------------------------------- |
|
7867 |
// CXnNodeImpl::ReportXuikonEventL |
|
7868 |
// ----------------------------------------------------------------------------- |
|
7869 |
// |
|
7870 |
TBool CXnNodeImpl::ReportXuikonEventL( CXnNode& aEventData, TInt aSource ) |
|
7871 |
{ |
|
7872 |
CXnProperty* prop( GetPropertyL( KActionsHandler ) ); |
|
7873 |
||
7874 |
CXnNode* handler( NULL ); |
|
7875 |
||
7876 |
iUiEngine->DisableRenderUiLC(); |
|
7877 |
||
7878 |
if ( prop ) |
|
7879 |
{ |
|
7880 |
const TDesC8& value( prop->StringValue() ); |
|
7881 |
||
7882 |
handler = iUiEngine->FindNodeByIdL( value, Namespace() ); |
|
7883 |
} |
|
7884 |
||
7885 |
if ( handler && handler->Type()->Type() == KActionsHandler ) |
|
7886 |
{ |
|
7887 |
// Let <actionshandler> node to handle actions |
|
7888 |
DoTriggerEventL( this, *iUiEngine, *iNode, |
|
7889 |
*handler, aEventData, aSource ); |
|
7890 |
} |
|
7891 |
else |
|
7892 |
{ |
|
7893 |
// Let this node to handle actions |
|
7894 |
DoTriggerEventL( this, *iUiEngine, *iNode, |
|
7895 |
*iNode, aEventData, aSource ); |
|
7896 |
} |
|
7897 |
||
7898 |
CleanupStack::PopAndDestroy(); // DisableRenderUiLC |
|
7899 |
||
7900 |
return EFalse; |
|
7901 |
} |
|
7902 |
||
7903 |
// ----------------------------------------------------------------------------- |
|
7904 |
// CXnNodeImpl::OfferKeyEventL |
|
7905 |
// ----------------------------------------------------------------------------- |
|
7906 |
// |
|
7907 |
void CXnNodeImpl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
7908 |
{ |
|
7909 |
DoTriggerKeyEventL( this, *iUiEngine, *iNode, aKeyEvent, aType ); |
|
7910 |
} |
|
7911 |
||
7912 |
// ----------------------------------------------------------------------------- |
|
7913 |
// CXnNodeImpl::SetDropped |
|
7914 |
// ----------------------------------------------------------------------------- |
|
7915 |
// |
|
7916 |
void CXnNodeImpl::SetDropped( const TInt aDropped ) |
|
7917 |
{ |
|
7918 |
if ( Type()->Type() != KToolTip ) |
|
7919 |
{ |
|
7920 |
iDropped = aDropped; |
|
7921 |
||
7922 |
TInt count( iChildren.Count() ); |
|
7923 |
||
7924 |
for ( TInt i = 0; i < count; i++ ) |
|
7925 |
{ |
|
7926 |
iChildren[i]->SetDropped( aDropped ); |
|
7927 |
} |
|
7928 |
} |
|
7929 |
} |
|
7930 |
||
7931 |
// ----------------------------------------------------------------------------- |
|
7932 |
// CXnNodeImpl::IsDropped |
|
7933 |
// ----------------------------------------------------------------------------- |
|
7934 |
// |
|
7935 |
TInt CXnNodeImpl::IsDropped() const |
|
7936 |
{ |
|
7937 |
return iDropped; |
|
7938 |
} |
|
7939 |
||
7940 |
// ----------------------------------------------------------------------------- |
|
7941 |
// CXnNodeImpl::SetLayoutCapable |
|
7942 |
// ----------------------------------------------------------------------------- |
|
7943 |
// |
|
7944 |
void CXnNodeImpl::SetLayoutCapable( const TBool aLayoutCapable ) |
|
7945 |
{ |
|
7946 |
iLayoutCapable = aLayoutCapable; |
|
7947 |
} |
|
7948 |
||
7949 |
// ----------------------------------------------------------------------------- |
|
7950 |
// CXnNodeImpl::IsLayoutCapable |
|
7951 |
// ----------------------------------------------------------------------------- |
|
7952 |
// |
|
7953 |
TBool CXnNodeImpl::IsLayoutCapable() const |
|
7954 |
{ |
|
7955 |
return iLayoutCapable; |
|
7956 |
} |
|
7957 |
||
7958 |
// ----------------------------------------------------------------------------- |
|
7959 |
// CXnNodeImpl::SetRenderedL |
|
7960 |
// ----------------------------------------------------------------------------- |
|
7961 |
// |
|
7962 |
void CXnNodeImpl::SetRenderedL() |
|
7963 |
{ |
|
7964 |
if ( !iLayoutCapable ) |
|
7965 |
{ |
|
7966 |
return; |
|
7967 |
} |
|
7968 |
||
7969 |
CXnControlAdapter* control = |
|
7970 |
static_cast< CXnControlAdapter* >( iNode->Control() ); |
|
7971 |
||
7972 |
if ( control ) |
|
7973 |
{ |
|
7974 |
TBool displayed( IsNodeDisplayedL( *iNode, ETrue, EFalse ) ); |
|
7975 |
||
7976 |
control->SetBlank( EFalse ); |
|
7977 |
||
7978 |
if ( iDropped || !displayed ) |
|
7979 |
{ |
|
7980 |
// Need to check blank here |
|
7981 |
CXnProperty* prop( VisibilityL() ); |
|
7982 |
||
7983 |
if ( prop && prop->StringValue() == |
|
7984 |
XnPropertyNames::style::common::visibility::KBlank ) |
|
7985 |
{ |
|
7986 |
control->SetBlank( ETrue ); |
|
7987 |
control->MakeVisible( EFalse ); |
|
7988 |
control->SetComponentsToInheritVisibility( EFalse ); |
|
7989 |
control->MakeVisible( ETrue ); |
|
7990 |
control->SetComponentsToInheritVisibility( ETrue ); |
|
7991 |
} |
|
7992 |
else |
|
7993 |
{ |
|
7994 |
if ( control->IsVisible() ) |
|
7995 |
{ |
|
7996 |
control->MakeVisible( EFalse ); |
|
7997 |
} |
|
7998 |
} |
|
7999 |
} |
|
8000 |
else |
|
8001 |
{ |
|
8002 |
CCoeControl* parent( control->Parent() ); |
|
8003 |
||
8004 |
TBool parentVisible( ETrue ); |
|
8005 |
||
8006 |
if ( parent && !parent->IsVisible() ) |
|
8007 |
{ |
|
8008 |
parentVisible = EFalse; |
|
8009 |
} |
|
8010 |
||
8011 |
if ( !control->IsVisible() && parentVisible ) |
|
8012 |
{ |
|
8013 |
TBool found( EFalse ); |
|
8014 |
||
8015 |
for ( CXnNode* node = iNode; !found && node; node = node->Parent() ) |
|
8016 |
{ |
|
8017 |
if ( node->Type()->Type() == KToolTip ) |
|
8018 |
{ |
|
8019 |
// Tooltip control handles its visibility internally |
|
8020 |
found = ETrue; |
|
8021 |
} |
|
8022 |
} |
|
8023 |
||
8024 |
if ( !found ) |
|
8025 |
{ |
|
8026 |
control->MakeVisible( ETrue ); |
|
8027 |
} |
|
8028 |
} |
|
8029 |
} |
|
8030 |
} |
|
8031 |
||
8032 |
iRendered = ETrue; |
|
8033 |
||
8034 |
for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
8035 |
{ |
|
8036 |
iChildren[i]->SetRenderedL(); |
|
8037 |
} |
|
8038 |
} |
|
8039 |
||
8040 |
// ----------------------------------------------------------------------------- |
|
8041 |
// CXnNodeImpl::SetLaidOutL |
|
8042 |
// ----------------------------------------------------------------------------- |
|
8043 |
// |
|
8044 |
void CXnNodeImpl::SetLaidOutL() |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
8045 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
8046 |
if ( !iLayoutCapable || iDropped || !IsNodeDisplayedL( *iNode ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
8047 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
8048 |
iLaidOut = EFalse; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
8049 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
8050 |
else |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
8051 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
8052 |
iLaidOut = ETrue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
8053 |
} |
34 | 8054 |
|
8055 |
for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
8056 |
{ |
|
8057 |
iChildren[i]->SetLaidOutL(); |
|
8058 |
} |
|
8059 |
} |
|
8060 |
||
8061 |
// ----------------------------------------------------------------------------- |
|
8062 |
// CXnNodeImpl::IsLaidOut |
|
8063 |
// ----------------------------------------------------------------------------- |
|
8064 |
// |
|
8065 |
TBool CXnNodeImpl::IsLaidOut() const |
|
8066 |
{ |
|
8067 |
return iLaidOut; |
|
8068 |
} |
|
8069 |
||
8070 |
// ----------------------------------------------------------------------------- |
|
8071 |
// CXnNodeImpl::ClearRenderedAndLaidOut |
|
8072 |
// ----------------------------------------------------------------------------- |
|
8073 |
// |
|
8074 |
void CXnNodeImpl::ClearRenderedAndLaidOut() |
|
8075 |
{ |
|
8076 |
if ( !iRendered && !iLaidOut ) |
|
8077 |
{ |
|
8078 |
return; |
|
8079 |
} |
|
8080 |
||
8081 |
TRect empty; |
|
8082 |
||
8083 |
SetRect( empty ); |
|
8084 |
SetPaddingRect( empty ); |
|
8085 |
SetBorderRect( empty ); |
|
8086 |
SetNormalFlowBorderRect( empty ); |
|
8087 |
SetMarginRect( empty ); |
|
8088 |
||
8089 |
iRendered = EFalse; |
|
8090 |
iLaidOut = EFalse; |
|
8091 |
||
8092 |
if ( iLayoutCapable ) |
|
8093 |
{ |
|
8094 |
for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
8095 |
{ |
|
8096 |
iChildren[i]->ClearRenderedAndLaidOut(); |
|
8097 |
} |
|
8098 |
} |
|
8099 |
} |
|
8100 |
||
8101 |
// ----------------------------------------------------------------------------- |
|
8102 |
// CXnNodeImpl::MakeInterfaceL |
|
8103 |
// Create a component interface according to the given type. |
|
8104 |
// ----------------------------------------------------------------------------- |
|
8105 |
// |
|
8106 |
XnComponentInterface::MXnComponentInterface* CXnNodeImpl::MakeInterfaceL( |
|
8107 |
const TDesC8& /*aType*/ ) |
|
8108 |
{ |
|
8109 |
return NULL; |
|
8110 |
} |
|
8111 |
||
8112 |
// ----------------------------------------------------------------------------- |
|
8113 |
// PropertyL |
|
8114 |
// Returns a property. |
|
8115 |
// ----------------------------------------------------------------------------- |
|
8116 |
// |
|
8117 |
static CXnProperty* PropertyL( CXnProperty* aProperty, |
|
8118 |
CXnProperty* ( CXnNode::* aFunc )(), |
|
8119 |
TAny* aLayoutPropertyCache, CXnNode* aParent ) |
|
8120 |
{ |
|
8121 |
if ( aLayoutPropertyCache && aProperty ) |
|
8122 |
{ |
|
8123 |
CXnDomProperty* attribute = aProperty->Property(); |
|
8124 |
CXnDomList& list = attribute->PropertyValueList(); |
|
8125 |
||
8126 |
if ( list.Length() == 0 ) |
|
8127 |
{ |
|
8128 |
return NULL; |
|
8129 |
} |
|
8130 |
||
8131 |
CXnDomPropertyValue* attributeValue = |
|
8132 |
static_cast< CXnDomPropertyValue* >( list.Item( 0 ) ); |
|
8133 |
||
8134 |
if ( !attributeValue ) |
|
8135 |
{ |
|
8136 |
return NULL; |
|
8137 |
} |
|
8138 |
||
8139 |
if ( attributeValue->IsInheritIdent() && aParent ) |
|
8140 |
{ |
|
8141 |
// inherited values are queried from the parent |
|
8142 |
return ( aParent->*aFunc )(); |
|
8143 |
} |
|
8144 |
||
8145 |
// otherwise just return the value |
|
8146 |
return aProperty; |
|
8147 |
} |
|
8148 |
||
8149 |
return NULL; |
|
8150 |
} |
|
8151 |
||
8152 |
// ----------------------------------------------------------------------------- |
|
8153 |
// CXnNodeImpl::WidthL |
|
8154 |
// Returns width property. |
|
8155 |
// ----------------------------------------------------------------------------- |
|
8156 |
// |
|
8157 |
CXnProperty* CXnNodeImpl::WidthL() |
|
8158 |
{ |
|
8159 |
CXnProperty* property = |
|
8160 |
iLayoutPropertyCache ? iLayoutPropertyCache->iWidth : NULL; |
|
8161 |
return PropertyL( property, &CXnNode::WidthL, |
|
8162 |
iLayoutPropertyCache, iParent ); |
|
8163 |
} |
|
8164 |
||
8165 |
// ----------------------------------------------------------------------------- |
|
8166 |
// CXnNodeImpl::HeightL |
|
8167 |
// Returns height property. |
|
8168 |
// ----------------------------------------------------------------------------- |
|
8169 |
// |
|
8170 |
CXnProperty* CXnNodeImpl::HeightL() |
|
8171 |
{ |
|
8172 |
CXnProperty* property = |
|
8173 |
iLayoutPropertyCache ? iLayoutPropertyCache->iHeight : NULL; |
|
8174 |
return PropertyL( property, &CXnNode::HeightL, |
|
8175 |
iLayoutPropertyCache, iParent ); |
|
8176 |
} |
|
8177 |
||
8178 |
// ----------------------------------------------------------------------------- |
|
8179 |
// CXnNodeImpl::MarginLeftL |
|
8180 |
// Returns margin-left property. |
|
8181 |
// ----------------------------------------------------------------------------- |
|
8182 |
// |
|
8183 |
CXnProperty* CXnNodeImpl::MarginLeftL() |
|
8184 |
{ |
|
8185 |
CXnProperty* property = |
|
8186 |
iLayoutPropertyCache ? |
|
8187 |
iLayoutPropertyCache->iMarginLeft : |
|
8188 |
NULL; |
|
8189 |
return PropertyL( property, &CXnNode::MarginLeftL, |
|
8190 |
iLayoutPropertyCache, iParent ); |
|
8191 |
} |
|
8192 |
||
8193 |
// ----------------------------------------------------------------------------- |
|
8194 |
// CXnNodeImpl::MarginRightL |
|
8195 |
// Returns margin-right property. |
|
8196 |
// ----------------------------------------------------------------------------- |
|
8197 |
// |
|
8198 |
CXnProperty* CXnNodeImpl::MarginRightL() |
|
8199 |
{ |
|
8200 |
CXnProperty* property = |
|
8201 |
iLayoutPropertyCache ? |
|
8202 |
iLayoutPropertyCache->iMarginRight : |
|
8203 |
NULL; |
|
8204 |
return PropertyL( property, &CXnNode::MarginRightL, |
|
8205 |
iLayoutPropertyCache, iParent ); |
|
8206 |
} |
|
8207 |
||
8208 |
// ----------------------------------------------------------------------------- |
|
8209 |
// CXnNodeImpl::BorderLeftL |
|
8210 |
// Returns border-left property. |
|
8211 |
// ----------------------------------------------------------------------------- |
|
8212 |
// |
|
8213 |
CXnProperty* CXnNodeImpl::BorderLeftL() |
|
8214 |
{ |
|
8215 |
CXnProperty* property = iLayoutPropertyCache ? |
|
8216 |
iLayoutPropertyCache->iBorderLeft : |
|
8217 |
NULL; |
|
8218 |
return PropertyL( property, &CXnNode::BorderLeftL, |
|
8219 |
iLayoutPropertyCache, iParent ); |
|
8220 |
} |
|
8221 |
||
8222 |
// ----------------------------------------------------------------------------- |
|
8223 |
// CXnNodeImpl::BorderRightL |
|
8224 |
// Returns border-right property. |
|
8225 |
// ----------------------------------------------------------------------------- |
|
8226 |
// |
|
8227 |
CXnProperty* CXnNodeImpl::BorderRightL() |
|
8228 |
{ |
|
8229 |
CXnProperty* property = |
|
8230 |
iLayoutPropertyCache ? |
|
8231 |
iLayoutPropertyCache->iBorderRight : |
|
8232 |
NULL; |
|
8233 |
return PropertyL( property, &CXnNode::BorderRightL, |
|
8234 |
iLayoutPropertyCache, iParent ); |
|
8235 |
} |
|
8236 |
||
8237 |
// ----------------------------------------------------------------------------- |
|
8238 |
// CXnNodeImpl::PaddingLeftL |
|
8239 |
// Returns padding-left property. |
|
8240 |
// ----------------------------------------------------------------------------- |
|
8241 |
// |
|
8242 |
CXnProperty* CXnNodeImpl::PaddingLeftL() |
|
8243 |
{ |
|
8244 |
CXnProperty* property = |
|
8245 |
iLayoutPropertyCache ? |
|
8246 |
iLayoutPropertyCache->iPaddingLeft : |
|
8247 |
NULL; |
|
8248 |
return PropertyL( property, &CXnNode::PaddingLeftL, |
|
8249 |
iLayoutPropertyCache, iParent ); |
|
8250 |
} |
|
8251 |
||
8252 |
// ----------------------------------------------------------------------------- |
|
8253 |
// CXnNodeImpl::PaddingRightL |
|
8254 |
// Returns PaddingRightL property. |
|
8255 |
// ----------------------------------------------------------------------------- |
|
8256 |
// |
|
8257 |
CXnProperty* CXnNodeImpl::PaddingRightL() |
|
8258 |
{ |
|
8259 |
CXnProperty* property = |
|
8260 |
iLayoutPropertyCache ? iLayoutPropertyCache->iPaddingRight : NULL; |
|
8261 |
return PropertyL( property, &CXnNode::PaddingRightL, |
|
8262 |
iLayoutPropertyCache, iParent ); |
|
8263 |
} |
|
8264 |
||
8265 |
// ----------------------------------------------------------------------------- |
|
8266 |
// CXnNodeImpl::MarginTopL |
|
8267 |
// Returns margin-top property. |
|
8268 |
// ----------------------------------------------------------------------------- |
|
8269 |
// |
|
8270 |
CXnProperty* CXnNodeImpl::MarginTopL() |
|
8271 |
{ |
|
8272 |
CXnProperty* property = |
|
8273 |
iLayoutPropertyCache ? iLayoutPropertyCache->iMarginTop : NULL; |
|
8274 |
return PropertyL( property, &CXnNode::MarginTopL, |
|
8275 |
iLayoutPropertyCache, iParent ); |
|
8276 |
} |
|
8277 |
||
8278 |
// ----------------------------------------------------------------------------- |
|
8279 |
// CXnNodeImpl::MarginBottomL |
|
8280 |
// Returns margin-bottom property. |
|
8281 |
// ----------------------------------------------------------------------------- |
|
8282 |
// |
|
8283 |
CXnProperty* CXnNodeImpl::MarginBottomL() |
|
8284 |
{ |
|
8285 |
CXnProperty* property = |
|
8286 |
iLayoutPropertyCache ? iLayoutPropertyCache->iMarginBottom : NULL; |
|
8287 |
return PropertyL( property, &CXnNode::MarginBottomL, |
|
8288 |
iLayoutPropertyCache, iParent ); |
|
8289 |
} |
|
8290 |
||
8291 |
// ----------------------------------------------------------------------------- |
|
8292 |
// CXnNodeImpl::BorderTopL |
|
8293 |
// Returns border-top property. |
|
8294 |
// ----------------------------------------------------------------------------- |
|
8295 |
// |
|
8296 |
CXnProperty* CXnNodeImpl::BorderTopL() |
|
8297 |
{ |
|
8298 |
CXnProperty* property = |
|
8299 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBorderTop : NULL; |
|
8300 |
return PropertyL( property, &CXnNode::BorderTopL, |
|
8301 |
iLayoutPropertyCache, iParent ); |
|
8302 |
} |
|
8303 |
||
8304 |
// ----------------------------------------------------------------------------- |
|
8305 |
// CXnNodeImpl::BorderBottomL |
|
8306 |
// Returns border-bottom property. |
|
8307 |
// ----------------------------------------------------------------------------- |
|
8308 |
// |
|
8309 |
CXnProperty* CXnNodeImpl::BorderBottomL() |
|
8310 |
{ |
|
8311 |
CXnProperty* property = |
|
8312 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBorderBottom : NULL; |
|
8313 |
return PropertyL( property, &CXnNode::BorderBottomL, |
|
8314 |
iLayoutPropertyCache, iParent ); |
|
8315 |
} |
|
8316 |
||
8317 |
// ----------------------------------------------------------------------------- |
|
8318 |
// CXnNodeImpl::PaddingTopL |
|
8319 |
// Returns padding-top property. |
|
8320 |
// ----------------------------------------------------------------------------- |
|
8321 |
// |
|
8322 |
CXnProperty* CXnNodeImpl::PaddingTopL() |
|
8323 |
{ |
|
8324 |
CXnProperty* property = |
|
8325 |
iLayoutPropertyCache ? iLayoutPropertyCache->iPaddingTop : NULL; |
|
8326 |
return PropertyL( property, &CXnNode::PaddingTopL, |
|
8327 |
iLayoutPropertyCache, iParent ); |
|
8328 |
} |
|
8329 |
||
8330 |
// ----------------------------------------------------------------------------- |
|
8331 |
// CXnNodeImpl::PaddingBottomL |
|
8332 |
// Returns padding-bottom property. |
|
8333 |
// ----------------------------------------------------------------------------- |
|
8334 |
// |
|
8335 |
CXnProperty* CXnNodeImpl::PaddingBottomL() |
|
8336 |
{ |
|
8337 |
CXnProperty* property = |
|
8338 |
iLayoutPropertyCache ? iLayoutPropertyCache->iPaddingBottom : NULL; |
|
8339 |
return PropertyL( property, &CXnNode::PaddingBottomL, |
|
8340 |
iLayoutPropertyCache, iParent ); |
|
8341 |
} |
|
8342 |
||
8343 |
// ----------------------------------------------------------------------------- |
|
8344 |
// CXnNodeImpl::BorderWidthL |
|
8345 |
// Returns border-width property. |
|
8346 |
// ----------------------------------------------------------------------------- |
|
8347 |
// |
|
8348 |
CXnProperty* CXnNodeImpl::BorderWidthL() |
|
8349 |
{ |
|
8350 |
CXnProperty* property = |
|
8351 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBorderWidth : NULL; |
|
8352 |
return PropertyL( property, &CXnNode::BorderWidthL, |
|
8353 |
iLayoutPropertyCache, iParent ); |
|
8354 |
} |
|
8355 |
||
8356 |
// ----------------------------------------------------------------------------- |
|
8357 |
// CXnNodeImpl::BlockProgressionL |
|
8358 |
// Returns block-progression property. |
|
8359 |
// ----------------------------------------------------------------------------- |
|
8360 |
// |
|
8361 |
CXnProperty* CXnNodeImpl::BlockProgressionL() |
|
8362 |
{ |
|
8363 |
CXnProperty* property = |
|
8364 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBlockProgression : NULL; |
|
8365 |
return PropertyL( property, &CXnNode::BlockProgressionL, |
|
8366 |
iLayoutPropertyCache, iParent ); |
|
8367 |
} |
|
8368 |
||
8369 |
// ----------------------------------------------------------------------------- |
|
8370 |
// CXnNodeImpl::DirectionL |
|
8371 |
// Returns direction property. |
|
8372 |
// ----------------------------------------------------------------------------- |
|
8373 |
// |
|
8374 |
CXnProperty* CXnNodeImpl::DirectionL() |
|
8375 |
{ |
|
8376 |
CXnProperty* property = |
|
8377 |
iLayoutPropertyCache ? iLayoutPropertyCache->iDirection : NULL; |
|
8378 |
return PropertyL( property, &CXnNode::DirectionL, |
|
8379 |
iLayoutPropertyCache, iParent ); |
|
8380 |
} |
|
8381 |
||
8382 |
// ----------------------------------------------------------------------------- |
|
8383 |
// CXnNodeImpl::PositionL |
|
8384 |
// Returns position property. |
|
8385 |
// ----------------------------------------------------------------------------- |
|
8386 |
// |
|
8387 |
CXnProperty* CXnNodeImpl::PositionL() |
|
8388 |
{ |
|
8389 |
CXnProperty* property = |
|
8390 |
iLayoutPropertyCache ? iLayoutPropertyCache->iPosition : NULL; |
|
8391 |
return PropertyL( property, &CXnNode::PositionL, |
|
8392 |
iLayoutPropertyCache, iParent ); |
|
8393 |
} |
|
8394 |
||
8395 |
// ----------------------------------------------------------------------------- |
|
8396 |
// CXnNodeImpl::MaxHeightL |
|
8397 |
// Returns max-height property. |
|
8398 |
// ----------------------------------------------------------------------------- |
|
8399 |
// |
|
8400 |
CXnProperty* CXnNodeImpl::MaxHeightL() |
|
8401 |
{ |
|
8402 |
CXnProperty* property = |
|
8403 |
iLayoutPropertyCache ? iLayoutPropertyCache->iMaxHeight : NULL; |
|
8404 |
return PropertyL( property, &CXnNode::MaxHeightL, |
|
8405 |
iLayoutPropertyCache, iParent ); |
|
8406 |
} |
|
8407 |
||
8408 |
// ----------------------------------------------------------------------------- |
|
8409 |
// CXnNodeImpl::MinHeightL |
|
8410 |
// Returns min-height property. |
|
8411 |
// ----------------------------------------------------------------------------- |
|
8412 |
// |
|
8413 |
CXnProperty* CXnNodeImpl::MinHeightL() |
|
8414 |
{ |
|
8415 |
CXnProperty* property = |
|
8416 |
iLayoutPropertyCache ? iLayoutPropertyCache->iMinHeight : NULL; |
|
8417 |
return PropertyL( property, &CXnNode::MinHeightL, |
|
8418 |
iLayoutPropertyCache, iParent ); |
|
8419 |
} |
|
8420 |
||
8421 |
// ----------------------------------------------------------------------------- |
|
8422 |
// CXnNodeImpl::MaxWidthL |
|
8423 |
// Returns max-width property. |
|
8424 |
// ----------------------------------------------------------------------------- |
|
8425 |
// |
|
8426 |
CXnProperty* CXnNodeImpl::MaxWidthL() |
|
8427 |
{ |
|
8428 |
CXnProperty* property = |
|
8429 |
iLayoutPropertyCache ? iLayoutPropertyCache->iMaxWidth : NULL; |
|
8430 |
return PropertyL( property, &CXnNode::MaxWidthL, |
|
8431 |
iLayoutPropertyCache, iParent ); |
|
8432 |
} |
|
8433 |
||
8434 |
// ----------------------------------------------------------------------------- |
|
8435 |
// CXnNodeImpl::MinWidthL |
|
8436 |
// Returns min-width property. |
|
8437 |
// ----------------------------------------------------------------------------- |
|
8438 |
// |
|
8439 |
CXnProperty* CXnNodeImpl::MinWidthL() |
|
8440 |
{ |
|
8441 |
CXnProperty* property = |
|
8442 |
iLayoutPropertyCache ? iLayoutPropertyCache->iMinWidth : NULL; |
|
8443 |
return PropertyL( property, &CXnNode::MinWidthL, |
|
8444 |
iLayoutPropertyCache, iParent ); |
|
8445 |
} |
|
8446 |
||
8447 |
// ----------------------------------------------------------------------------- |
|
8448 |
// CXnNodeImpl::DisplayL |
|
8449 |
// Returns display property. |
|
8450 |
// ----------------------------------------------------------------------------- |
|
8451 |
// |
|
8452 |
CXnProperty* CXnNodeImpl::DisplayL() |
|
8453 |
{ |
|
8454 |
CXnProperty* property = |
|
8455 |
iLayoutPropertyCache ? iLayoutPropertyCache->iDisplay : NULL; |
|
8456 |
return PropertyL( property, &CXnNode::DisplayL, |
|
8457 |
iLayoutPropertyCache, iParent ); |
|
8458 |
} |
|
8459 |
||
8460 |
// ----------------------------------------------------------------------------- |
|
8461 |
// CXnNodeImpl::LeftL |
|
8462 |
// Returns left property. |
|
8463 |
// ----------------------------------------------------------------------------- |
|
8464 |
// |
|
8465 |
CXnProperty* CXnNodeImpl::LeftL() |
|
8466 |
{ |
|
8467 |
CXnProperty* property = |
|
8468 |
iLayoutPropertyCache ? iLayoutPropertyCache->iLeft : NULL; |
|
8469 |
return PropertyL( property, &CXnNode::LeftL, |
|
8470 |
iLayoutPropertyCache, iParent ); |
|
8471 |
} |
|
8472 |
||
8473 |
// ----------------------------------------------------------------------------- |
|
8474 |
// CXnNodeImpl::RightL |
|
8475 |
// Returns right property. |
|
8476 |
// ----------------------------------------------------------------------------- |
|
8477 |
// |
|
8478 |
CXnProperty* CXnNodeImpl::RightL() |
|
8479 |
{ |
|
8480 |
CXnProperty* property = |
|
8481 |
iLayoutPropertyCache ? iLayoutPropertyCache->iRight : NULL; |
|
8482 |
return PropertyL( property, &CXnNode::RightL, |
|
8483 |
iLayoutPropertyCache, iParent ); |
|
8484 |
} |
|
8485 |
||
8486 |
// ----------------------------------------------------------------------------- |
|
8487 |
// CXnNodeImpl::TopL |
|
8488 |
// Returns top property. |
|
8489 |
// ----------------------------------------------------------------------------- |
|
8490 |
// |
|
8491 |
CXnProperty* CXnNodeImpl::TopL() |
|
8492 |
{ |
|
8493 |
CXnProperty* property = |
|
8494 |
iLayoutPropertyCache ? iLayoutPropertyCache->iTop : NULL; |
|
8495 |
return PropertyL( property, &CXnNode::TopL, |
|
8496 |
iLayoutPropertyCache, iParent ); |
|
8497 |
} |
|
8498 |
||
8499 |
// ----------------------------------------------------------------------------- |
|
8500 |
// CXnNodeImpl::BottomL |
|
8501 |
// Returns bottom property. |
|
8502 |
// ----------------------------------------------------------------------------- |
|
8503 |
// |
|
8504 |
CXnProperty* CXnNodeImpl::BottomL() |
|
8505 |
{ |
|
8506 |
CXnProperty* property = |
|
8507 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBottom : NULL; |
|
8508 |
return PropertyL( property, &CXnNode::BottomL, |
|
8509 |
iLayoutPropertyCache, iParent ); |
|
8510 |
} |
|
8511 |
||
8512 |
// ----------------------------------------------------------------------------- |
|
8513 |
// CXnNodeImpl::BorderLeftStyleL |
|
8514 |
// Returns border-left-style property. |
|
8515 |
// ----------------------------------------------------------------------------- |
|
8516 |
// |
|
8517 |
CXnProperty* CXnNodeImpl::BorderLeftStyleL() |
|
8518 |
{ |
|
8519 |
CXnProperty* property = |
|
8520 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBorderLeftStyle : NULL; |
|
8521 |
return PropertyL( property, &CXnNode::BorderLeftStyleL, |
|
8522 |
iLayoutPropertyCache, iParent ); |
|
8523 |
} |
|
8524 |
||
8525 |
// ----------------------------------------------------------------------------- |
|
8526 |
// CXnNodeImpl::BorderRightStyleL |
|
8527 |
// Returns border-right-style property. |
|
8528 |
// ----------------------------------------------------------------------------- |
|
8529 |
// |
|
8530 |
CXnProperty* CXnNodeImpl::BorderRightStyleL() |
|
8531 |
{ |
|
8532 |
CXnProperty* property = |
|
8533 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBorderRightStyle : NULL; |
|
8534 |
return PropertyL( property, &CXnNode::BorderRightStyleL, |
|
8535 |
iLayoutPropertyCache, iParent ); |
|
8536 |
} |
|
8537 |
||
8538 |
// ----------------------------------------------------------------------------- |
|
8539 |
// CXnNodeImpl::BorderTopStyleL |
|
8540 |
// Returns border-top-style property. |
|
8541 |
// ----------------------------------------------------------------------------- |
|
8542 |
// |
|
8543 |
CXnProperty* CXnNodeImpl::BorderTopStyleL() |
|
8544 |
{ |
|
8545 |
CXnProperty* property = |
|
8546 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBorderTopStyle : NULL; |
|
8547 |
return PropertyL( property, &CXnNode::BorderTopStyleL, |
|
8548 |
iLayoutPropertyCache, iParent ); |
|
8549 |
} |
|
8550 |
||
8551 |
// ----------------------------------------------------------------------------- |
|
8552 |
// CXnNodeImpl::BorderBottomStyleL |
|
8553 |
// Returns border-bottom-style property. |
|
8554 |
// ----------------------------------------------------------------------------- |
|
8555 |
// |
|
8556 |
CXnProperty* CXnNodeImpl::BorderBottomStyleL() |
|
8557 |
{ |
|
8558 |
CXnProperty* property = |
|
8559 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBorderBottomStyle : NULL; |
|
8560 |
return PropertyL( property, &CXnNode::BorderBottomStyleL, |
|
8561 |
iLayoutPropertyCache, iParent ); |
|
8562 |
} |
|
8563 |
||
8564 |
// ----------------------------------------------------------------------------- |
|
8565 |
// CXnNodeImpl::BorderStyleL |
|
8566 |
// Returns border-style property. |
|
8567 |
// ----------------------------------------------------------------------------- |
|
8568 |
// |
|
8569 |
CXnProperty* CXnNodeImpl::BorderStyleL() |
|
8570 |
{ |
|
8571 |
CXnProperty* property = |
|
8572 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBorderStyle : NULL; |
|
8573 |
return PropertyL( property, &CXnNode::BorderStyleL, |
|
8574 |
iLayoutPropertyCache, iParent ); |
|
8575 |
} |
|
8576 |
||
8577 |
// ----------------------------------------------------------------------------- |
|
8578 |
// CXnNodeImpl::BorderImageL |
|
8579 |
// Returns border-image property. |
|
8580 |
// ----------------------------------------------------------------------------- |
|
8581 |
// |
|
8582 |
CXnProperty* CXnNodeImpl::BorderImageL() |
|
8583 |
{ |
|
8584 |
CXnProperty* property = |
|
8585 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBorderImage : NULL; |
|
8586 |
return PropertyL( property, &CXnNode::BorderImageL, |
|
8587 |
iLayoutPropertyCache, iParent ); |
|
8588 |
} |
|
8589 |
||
8590 |
// ----------------------------------------------------------------------------- |
|
8591 |
// CXnNodeImpl::DisplayPriorityL |
|
8592 |
// Returns display-priority property. |
|
8593 |
// ----------------------------------------------------------------------------- |
|
8594 |
// |
|
8595 |
CXnProperty* CXnNodeImpl::DisplayPriorityL() |
|
8596 |
{ |
|
8597 |
CXnProperty* property = |
|
8598 |
iLayoutPropertyCache ? iLayoutPropertyCache->iDisplayPriority : NULL; |
|
8599 |
return PropertyL( property, &CXnNode::DisplayPriorityL, |
|
8600 |
iLayoutPropertyCache, iParent ); |
|
8601 |
} |
|
8602 |
||
8603 |
// ----------------------------------------------------------------------------- |
|
8604 |
// CXnNodeImpl::NameL |
|
8605 |
// Returns name property. |
|
8606 |
// ----------------------------------------------------------------------------- |
|
8607 |
// |
|
8608 |
CXnProperty* CXnNodeImpl::NameL() |
|
8609 |
{ |
|
8610 |
return PropertyL( iName, &CXnNode::NameL, this, iParent ); |
|
8611 |
} |
|
8612 |
||
8613 |
// ----------------------------------------------------------------------------- |
|
8614 |
// CXnNodeImpl::ValueL |
|
8615 |
// Returns value property. |
|
8616 |
// ----------------------------------------------------------------------------- |
|
8617 |
// |
|
8618 |
CXnProperty* CXnNodeImpl::ValueL() |
|
8619 |
{ |
|
8620 |
return PropertyL( iValue, &CXnNode::ValueL, this, iParent ); |
|
8621 |
} |
|
8622 |
||
8623 |
// ----------------------------------------------------------------------------- |
|
8624 |
// CXnNodeImpl::VisibilityL |
|
8625 |
// Returns visibility property. |
|
8626 |
// ----------------------------------------------------------------------------- |
|
8627 |
// |
|
8628 |
CXnProperty* CXnNodeImpl::VisibilityL() |
|
8629 |
{ |
|
8630 |
CXnProperty* property = |
|
8631 |
iLayoutPropertyCache ? iLayoutPropertyCache->iVisibility : NULL; |
|
8632 |
return PropertyL( property, &CXnNode::VisibilityL, |
|
8633 |
iLayoutPropertyCache, iParent ); |
|
8634 |
} |
|
8635 |
||
8636 |
// ----------------------------------------------------------------------------- |
|
8637 |
// CXnNodeImpl::LabelL |
|
8638 |
// Returns label property. |
|
8639 |
// ----------------------------------------------------------------------------- |
|
8640 |
// |
|
8641 |
CXnProperty* CXnNodeImpl::LabelL() |
|
8642 |
{ |
|
8643 |
return PropertyL( iLabel, &CXnNode::LabelL, this, iParent ); |
|
8644 |
} |
|
8645 |
||
8646 |
// ----------------------------------------------------------------------------- |
|
8647 |
// CXnNodeImpl::InitialFocusL |
|
8648 |
// Returns initial-focus property. |
|
8649 |
// ----------------------------------------------------------------------------- |
|
8650 |
// |
|
8651 |
CXnProperty* CXnNodeImpl::InitialFocusL() |
|
8652 |
{ |
|
8653 |
return PropertyL( iInitialFocus, &CXnNode::InitialFocusL, this, iParent ); |
|
8654 |
} |
|
8655 |
||
8656 |
// ----------------------------------------------------------------------------- |
|
8657 |
// CXnNodeImpl::ClassL |
|
8658 |
// Returns class property. |
|
8659 |
// ----------------------------------------------------------------------------- |
|
8660 |
// |
|
8661 |
CXnProperty* CXnNodeImpl::ClassL() |
|
8662 |
{ |
|
8663 |
return PropertyL( iClass, &CXnNode::ClassL, this, iParent ); |
|
8664 |
} |
|
8665 |
||
8666 |
// ----------------------------------------------------------------------------- |
|
8667 |
// CXnNodeImpl::IdL |
|
8668 |
// Returns id property. |
|
8669 |
// ----------------------------------------------------------------------------- |
|
8670 |
// |
|
8671 |
CXnProperty* CXnNodeImpl::IdL() |
|
8672 |
{ |
|
8673 |
if ( iId ) |
|
8674 |
{ |
|
8675 |
CXnDomProperty* attribute = iId->Property(); |
|
8676 |
CXnDomList& list = attribute->PropertyValueList(); |
|
8677 |
if ( list.Length() == 0 ) |
|
8678 |
{ |
|
8679 |
return NULL; |
|
8680 |
} |
|
8681 |
CXnDomPropertyValue* attributeValue = |
|
8682 |
static_cast< CXnDomPropertyValue* >( list.Item( 0 ) ); |
|
8683 |
if ( !attributeValue ) |
|
8684 |
{ |
|
8685 |
return NULL; |
|
8686 |
} |
|
8687 |
if ( attributeValue->IsInheritIdent() |
|
8688 |
&& iParent ) |
|
8689 |
{ |
|
8690 |
// inherited values are queried from the parent |
|
8691 |
return iParent->IdL(); |
|
8692 |
} |
|
8693 |
// otherwise just return the value |
|
8694 |
return iId; |
|
8695 |
} |
|
8696 |
// if not found, return NULL |
|
8697 |
return NULL; |
|
8698 |
} |
|
8699 |
||
8700 |
// ----------------------------------------------------------------------------- |
|
8701 |
// CXnNodeImpl::PathL |
|
8702 |
// Returns path property. |
|
8703 |
// ----------------------------------------------------------------------------- |
|
8704 |
// |
|
8705 |
CXnProperty* CXnNodeImpl::PathL() |
|
8706 |
{ |
|
8707 |
return PropertyL( iPath, &CXnNode::PathL, this, iParent ); |
|
8708 |
} |
|
8709 |
||
8710 |
// ----------------------------------------------------------------------------- |
|
8711 |
// CXnNodeImpl::MaskPathL |
|
8712 |
// Returns maskpath property. |
|
8713 |
// ----------------------------------------------------------------------------- |
|
8714 |
// |
|
8715 |
CXnProperty* CXnNodeImpl::MaskPathL() |
|
8716 |
{ |
|
8717 |
return PropertyL( iMaskPath, &CXnNode::MaskPathL, this, iParent ); |
|
8718 |
} |
|
8719 |
||
8720 |
// ----------------------------------------------------------------------------- |
|
8721 |
// CXnNodeImpl::NavIndexL |
|
8722 |
// Returns nav-index property. |
|
8723 |
// ----------------------------------------------------------------------------- |
|
8724 |
// |
|
8725 |
CXnProperty* CXnNodeImpl::NavIndexL() |
|
8726 |
{ |
|
8727 |
CXnProperty* property = |
|
8728 |
iLayoutPropertyCache ? iLayoutPropertyCache->iNavIndex : NULL; |
|
8729 |
return PropertyL( property, &CXnNode::NavIndexL, |
|
8730 |
iLayoutPropertyCache, iParent ); |
|
8731 |
} |
|
8732 |
||
8733 |
// ----------------------------------------------------------------------------- |
|
8734 |
// CXnNodeImpl::ZIndexL |
|
8735 |
// Returns z-index property. |
|
8736 |
// ----------------------------------------------------------------------------- |
|
8737 |
// |
|
8738 |
CXnProperty* CXnNodeImpl::ZIndexL() |
|
8739 |
{ |
|
8740 |
CXnProperty* property = |
|
8741 |
iLayoutPropertyCache ? iLayoutPropertyCache->iZIndex : NULL; |
|
8742 |
return PropertyL( property, &CXnNode::ZIndexL, |
|
8743 |
iLayoutPropertyCache, iParent ); |
|
8744 |
} |
|
8745 |
||
8746 |
// ----------------------------------------------------------------------------- |
|
8747 |
// CXnNodeImpl::BackgroundColorL |
|
8748 |
// Returns background-color property. |
|
8749 |
// ----------------------------------------------------------------------------- |
|
8750 |
// |
|
8751 |
CXnProperty* CXnNodeImpl::BackgroundColorL() |
|
8752 |
{ |
|
8753 |
CXnProperty* property = |
|
8754 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBackgroundColor : NULL; |
|
8755 |
return PropertyL( property, &CXnNode::BackgroundColorL, |
|
8756 |
iLayoutPropertyCache, iParent ); |
|
8757 |
} |
|
8758 |
||
8759 |
// ----------------------------------------------------------------------------- |
|
8760 |
// CXnNodeImpl::BackgroundImageL |
|
8761 |
// Returns background-image property. |
|
8762 |
// ----------------------------------------------------------------------------- |
|
8763 |
// |
|
8764 |
CXnProperty* CXnNodeImpl::BackgroundImageL() |
|
8765 |
{ |
|
8766 |
CXnProperty* property = |
|
8767 |
iLayoutPropertyCache ? iLayoutPropertyCache->iBackgroundImage : NULL; |
|
8768 |
return PropertyL( property, &CXnNode::BackgroundImageL, |
|
8769 |
iLayoutPropertyCache, iParent ); |
|
8770 |
} |
|
8771 |
||
8772 |
// ----------------------------------------------------------------------------- |
|
8773 |
// CXnNodeImpl::FocusBackgroundL |
|
8774 |
// Returns focus-background property. |
|
8775 |
// ----------------------------------------------------------------------------- |
|
8776 |
// |
|
8777 |
CXnProperty* CXnNodeImpl::FocusBackgroundL() |
|
8778 |
{ |
|
8779 |
CXnProperty* property = |
|
8780 |
iLayoutPropertyCache ? iLayoutPropertyCache->iFocusBackground : NULL; |
|
8781 |
||
8782 |
return PropertyL( property, &CXnNode::FocusBackgroundL, |
|
8783 |
iLayoutPropertyCache, iParent ); |
|
8784 |
} |
|
8785 |
||
8786 |
// ---------------------------------------------------------------------------- |
|
8787 |
// CXnNodeImpl::SetDomNode |
|
8788 |
// Sets DOM node |
|
8789 |
// ---------------------------------------------------------------------------- |
|
8790 |
// |
|
8791 |
void CXnNodeImpl::SetDomNode( CXnDomNode* aDomNode ) |
|
8792 |
{ |
|
8793 |
iDomNode = aDomNode; |
|
8794 |
} |
|
8795 |
||
8796 |
// ---------------------------------------------------------------------------- |
|
8797 |
// CXnNodeImpl::DomNode |
|
8798 |
// Returns the DOM node pointer |
|
8799 |
// ---------------------------------------------------------------------------- |
|
8800 |
// |
|
8801 |
CXnDomNode* CXnNodeImpl::DomNode() |
|
8802 |
{ |
|
8803 |
return iDomNode; |
|
8804 |
} |
|
8805 |
||
8806 |
// ---------------------------------------------------------------------------- |
|
8807 |
// CXnNodeImpl::MeasureAdaptiveContentL |
|
8808 |
// Measures the adaptive content dimensions. |
|
8809 |
// ---------------------------------------------------------------------------- |
|
8810 |
// |
|
8811 |
TSize CXnNodeImpl::MeasureAdaptiveContentL( const TSize& aAvailableSize ) |
|
8812 |
{ |
|
8813 |
TSize empty; |
|
8814 |
||
8815 |
TInt adaptive( IsAdaptive() ); |
|
8816 |
||
8817 |
if ( aAvailableSize.iWidth <= 0 && ( adaptive & XnAdaptive::EWidth ) || |
|
8818 |
aAvailableSize.iHeight <= 0 && ( adaptive & XnAdaptive::EHeight ) ) |
|
8819 |
{ |
|
8820 |
// No available size, don't even try to measure |
|
8821 |
return empty; |
|
8822 |
} |
|
8823 |
||
8824 |
// node is displayed as default |
|
8825 |
TBool displayed( ETrue ); |
|
8826 |
||
8827 |
CXnProperty* displayProp( DisplayL() ); |
|
8828 |
||
8829 |
if ( displayProp ) |
|
8830 |
{ |
|
8831 |
const TDesC8& value( displayProp->StringValue() ); |
|
8832 |
||
8833 |
if ( value != XnPropertyNames::style::common::display::KBlock ) |
|
8834 |
{ |
|
8835 |
// Not displayed |
|
8836 |
displayed = EFalse; |
|
8837 |
} |
|
8838 |
} |
|
8839 |
||
8840 |
if ( adaptive && iLayoutCapable && !iDropped && displayed ) |
|
8841 |
{ |
|
8842 |
CXnControlAdapter* adapter( iNode->Control() ); |
|
8843 |
||
8844 |
// What is my size? |
|
8845 |
if ( adapter ) |
|
8846 |
{ |
|
8847 |
TInt width( 0 ); |
|
8848 |
TInt height( 0 ); |
|
8849 |
||
8850 |
TSize size = adapter->MeasureAdaptiveContentL( aAvailableSize ); |
|
8851 |
||
8852 |
if ( adaptive & XnAdaptive::EWidth ) |
|
8853 |
{ |
|
8854 |
width = size.iWidth; |
|
8855 |
} |
|
8856 |
||
8857 |
if ( adaptive & XnAdaptive::EHeight ) |
|
8858 |
{ |
|
8859 |
height = size.iHeight; |
|
8860 |
} |
|
8861 |
||
8862 |
return TSize( width, height ); |
|
8863 |
} |
|
8864 |
} |
|
8865 |
||
8866 |
return empty; |
|
8867 |
} |
|
8868 |
||
8869 |
// ---------------------------------------------------------------------------- |
|
8870 |
// CXnNodeImpl::IsAdaptive |
|
8871 |
// Checks if the node have adaptive content |
|
8872 |
// ---------------------------------------------------------------------------- |
|
8873 |
// |
|
8874 |
TInt CXnNodeImpl::IsAdaptive( TBool aIgnoreSizeFixed ) const |
|
8875 |
{ |
|
8876 |
if ( !iAdaptive ) |
|
8877 |
{ |
|
8878 |
return XnAdaptive::ENone; |
|
8879 |
} |
|
8880 |
||
8881 |
TInt adaptive( iAdaptive ); |
|
8882 |
||
8883 |
if ( ( adaptive & XnAdaptive::ESizeFixed ) && !aIgnoreSizeFixed ) |
|
8884 |
{ |
|
8885 |
// When size is fixed, pretend non-adaptive |
|
8886 |
return XnAdaptive::ENone; |
|
8887 |
} |
|
8888 |
||
8889 |
// Remove measure control flags |
|
8890 |
adaptive &= ~XnAdaptive::EMeasure; |
|
8891 |
adaptive &= ~XnAdaptive::ESizeFixed; |
|
8892 |
||
8893 |
return adaptive; |
|
8894 |
} |
|
8895 |
||
8896 |
// ---------------------------------------------------------------------------- |
|
8897 |
// CXnNodeImpl::SetAdaptiveL |
|
8898 |
// Marks the node to have adaptive content |
|
8899 |
// ---------------------------------------------------------------------------- |
|
8900 |
// |
|
8901 |
void CXnNodeImpl::SetAdaptiveL( const TInt aAdaptive ) |
|
8902 |
{ |
|
8903 |
TInt adaptive( aAdaptive ); |
|
8904 |
||
8905 |
// Force adaptive nodes to be auto |
|
8906 |
if ( adaptive & XnAdaptive::EMeasure ) |
|
8907 |
{ |
|
8908 |
if ( iAdaptive & XnAdaptive::EMeasure ) |
|
8909 |
{ |
|
8910 |
// Measure already pending |
|
8911 |
return; |
|
8912 |
} |
|
8913 |
||
8914 |
if ( iAdaptive & XnAdaptive::EWidth ) |
|
8915 |
{ |
|
8916 |
adaptive |= XnAdaptive::EWidth; |
|
8917 |
} |
|
8918 |
||
8919 |
if ( iAdaptive & XnAdaptive::EHeight ) |
|
8920 |
{ |
|
8921 |
adaptive |= XnAdaptive::EHeight; |
|
8922 |
} |
|
8923 |
||
8924 |
// Reset |
|
8925 |
iAdaptive = XnAdaptive::ENone; |
|
8926 |
} |
|
8927 |
||
8928 |
if ( ( adaptive & XnAdaptive::EWidth ) && |
|
8929 |
!( iAdaptive & XnAdaptive::EWidth ) ) |
|
8930 |
{ |
|
8931 |
iAdaptive |= XnAdaptive::EIgnoreDirty; |
|
8932 |
||
8933 |
SetStringPropertyToNodeL( |
|
8934 |
*DomNode()->StringPool(), *Node(), |
|
8935 |
XnPropertyNames::style::common::KWidth, |
|
8936 |
XnPropertyNames::style::common::KAuto ); |
|
8937 |
||
8938 |
// Width is adaptive |
|
8939 |
iAdaptive |= XnAdaptive::EWidth; |
|
8940 |
||
8941 |
iAdaptive &= ~XnAdaptive::EIgnoreDirty; |
|
8942 |
} |
|
8943 |
||
8944 |
if ( ( adaptive & XnAdaptive::EHeight ) && |
|
8945 |
!( iAdaptive & XnAdaptive::EHeight ) ) |
|
8946 |
{ |
|
8947 |
iAdaptive |= XnAdaptive::EIgnoreDirty; |
|
8948 |
||
8949 |
SetStringPropertyToNodeL( |
|
8950 |
*DomNode()->StringPool(), *Node(), |
|
8951 |
XnPropertyNames::style::common::KHeight, |
|
8952 |
XnPropertyNames::style::common::KAuto ); |
|
8953 |
||
8954 |
// Height is adaptive |
|
8955 |
iAdaptive |= XnAdaptive::EHeight; |
|
8956 |
||
8957 |
iAdaptive &= ~XnAdaptive::EIgnoreDirty; |
|
8958 |
} |
|
8959 |
||
8960 |
// Size is no more fixed |
|
8961 |
iAdaptive &= ~XnAdaptive::ESizeFixed; |
|
8962 |
||
8963 |
// and it needs to be measured |
|
8964 |
iAdaptive |= XnAdaptive::EMeasure; |
|
8965 |
} |
|
8966 |
||
8967 |
// ---------------------------------------------------------------------------- |
|
8968 |
// CXnNodeImpl::FixAdaptiveSize |
|
8969 |
// Fixes the adaptive node's size |
|
8970 |
// ---------------------------------------------------------------------------- |
|
8971 |
// |
|
8972 |
void CXnNodeImpl::FixAdaptiveSizeL( const TSize& aFixedSize ) |
|
8973 |
{ |
|
8974 |
// Is there measure pending |
|
8975 |
if ( iAdaptive & XnAdaptive::EMeasure ) |
|
8976 |
{ |
|
8977 |
if ( iAdaptive & XnAdaptive::EWidth ) |
|
8978 |
{ |
|
8979 |
iAdaptive |= XnAdaptive::EIgnoreDirty; |
|
8980 |
||
8981 |
SetFloatPropertyToNodeL( |
|
8982 |
*DomNode()->StringPool(), *Node(), |
|
8983 |
XnPropertyNames::style::common::KWidth, |
|
8984 |
aFixedSize.iWidth, CXnDomPropertyValue::EPx ); |
|
8985 |
||
8986 |
iAdaptive &= ~XnAdaptive::EIgnoreDirty; |
|
8987 |
} |
|
8988 |
||
8989 |
if ( iAdaptive & XnAdaptive::EHeight ) |
|
8990 |
{ |
|
8991 |
iAdaptive |= XnAdaptive::EIgnoreDirty; |
|
8992 |
||
8993 |
SetFloatPropertyToNodeL( |
|
8994 |
*DomNode()->StringPool(), *Node(), |
|
8995 |
XnPropertyNames::style::common::KHeight, |
|
8996 |
aFixedSize.iHeight, CXnDomPropertyValue::EPx ); |
|
8997 |
||
8998 |
iAdaptive &= ~XnAdaptive::EIgnoreDirty; |
|
8999 |
} |
|
9000 |
||
9001 |
// Measure done |
|
9002 |
iAdaptive &= ~XnAdaptive::EMeasure; |
|
9003 |
// Size is now fixed |
|
9004 |
iAdaptive |= XnAdaptive::ESizeFixed; |
|
9005 |
} |
|
9006 |
} |
|
9007 |
||
9008 |
// ----------------------------------------------------------------------------- |
|
9009 |
// CXnNodeImpl::SetDirtyL |
|
9010 |
// ----------------------------------------------------------------------------- |
|
9011 |
// |
|
9012 |
void CXnNodeImpl::SetDirtyL( TInt aLevel, TBool aDisplayedState ) |
|
9013 |
{ |
|
9014 |
if( !aDisplayedState ) |
|
9015 |
{ |
|
9016 |
// check if node isn't displayed indeed (def. param. = EFalse) |
|
9017 |
aDisplayedState = IsNodeDisplayedL( *iNode ); |
|
9018 |
} |
|
9019 |
if ( iLayoutCapable ) |
|
9020 |
{ |
|
9021 |
if ( aLevel == XnDirtyLevel::ENone ) |
|
9022 |
{ |
|
9023 |
// nothing to do |
|
9024 |
return; |
|
9025 |
} |
|
9026 |
||
9027 |
if ( aLevel == XnDirtyLevel::ELayoutAndRenderSiblings ) |
|
9028 |
{ |
|
9029 |
if ( iParent ) |
|
9030 |
{ |
|
9031 |
// Siblings needs to be laid out also |
|
9032 |
RPointerArray< CXnNode >& siblings( iParent->Children() ); |
|
9033 |
||
9034 |
for ( TInt i = 0; i < siblings.Count(); i++ ) |
|
9035 |
{ |
|
9036 |
CXnNode* sibling( siblings[i] ); |
|
9037 |
||
9038 |
if ( sibling == iNode ) |
|
9039 |
{ |
|
9040 |
sibling->SetDirtyL( XnDirtyLevel::ELayoutAndRender, |
|
9041 |
aDisplayedState ); |
|
9042 |
} |
|
9043 |
else |
|
9044 |
{ |
|
9045 |
sibling->SetDirtyL( XnDirtyLevel::ELayoutAndRender ); |
|
9046 |
} |
|
9047 |
} |
|
9048 |
} |
|
9049 |
} |
|
9050 |
else |
|
9051 |
{ |
|
9052 |
if ( ( iParent || iNode == iUiEngine->RootNode() ) && |
|
9053 |
iNode != iUiEngine->ActiveView() ) |
|
9054 |
{ |
|
9055 |
// Full redraw (without layout) can be done by setting rootnode |
|
9056 |
// level to ERender |
|
9057 |
if ( aLevel == XnDirtyLevel::ERender && !iLaidOut && |
|
9058 |
iNode != iUiEngine->RootNode() ) |
|
9059 |
{ |
|
9060 |
aLevel = XnDirtyLevel::ELayoutAndRender; |
|
9061 |
} |
|
9062 |
||
9063 |
if ( aDisplayedState ) |
|
9064 |
{ |
|
9065 |
iUiEngine->AddDirtyNodeL( iNode, aLevel ); |
|
9066 |
} |
|
9067 |
else |
|
9068 |
{ |
|
9069 |
ClearRenderedAndLaidOut(); |
|
9070 |
} |
|
9071 |
} |
|
9072 |
} |
|
9073 |
} |
|
9074 |
else if ( iParent && iParent->Type()->Type() == KMenuBar ) |
|
9075 |
{ |
|
9076 |
// Mark menu to be refreshed |
|
9077 |
iUiEngine->AddDirtyNodeL( iParent, XnDirtyLevel::ERender ); |
|
9078 |
} |
|
9079 |
} |
|
9080 |
||
9081 |
// ----------------------------------------------------------------------------- |
|
9082 |
// CXnNodeImpl::RunFocusChangeL |
|
9083 |
// ----------------------------------------------------------------------------- |
|
9084 |
// |
|
9085 |
TBool CXnNodeImpl::RunFocusChangeL( RPointerArray< CXnNode >& aFocusCandidates ) |
|
9086 |
{ |
|
9087 |
for ( TInt i = 0; i < aFocusCandidates.Count(); i++ ) |
|
9088 |
{ |
|
9089 |
CXnNode* node( aFocusCandidates[i] ); |
|
9090 |
||
9091 |
if ( IsNodeNavigableL( *node ) ) |
|
9092 |
{ |
|
9093 |
if( node->ScrollableControl() ) |
|
9094 |
{ |
|
9095 |
node->ScrollableControl()->ShowItem( *node ); |
|
9096 |
} |
|
9097 |
||
9098 |
node->SetStateWithoutNotificationL( |
|
9099 |
XnPropertyNames::style::common::KFocus ); |
|
9100 |
||
9101 |
// All done |
|
9102 |
return ETrue; |
|
9103 |
} |
|
9104 |
} |
|
9105 |
||
9106 |
// Focus change failed |
|
9107 |
CXnNode* focused( iUiEngine->FocusedNode() ); |
|
9108 |
||
9109 |
if ( focused ) |
|
9110 |
{ |
|
9111 |
// Is the currently focused node still navigable |
|
9112 |
if ( !IsNodeNavigableL( *focused ) ) |
|
9113 |
{ |
|
9114 |
// No, remove focus |
|
9115 |
focused->UnsetStateL( XnPropertyNames::style::common::KFocus ); |
|
9116 |
} |
|
9117 |
} |
|
9118 |
||
9119 |
return EFalse; |
|
9120 |
} |
|
9121 |
||
9122 |
// ----------------------------------------------------------------------------- |
|
9123 |
// CXnNodeImpl::ReorderNodesL |
|
9124 |
// ----------------------------------------------------------------------------- |
|
9125 |
// |
|
9126 |
void CXnNodeImpl::ReorderNodesL( CXnNode* aSource, CXnNode* aTarget ) |
|
9127 |
{ |
|
9128 |
TInt target = -1; |
|
9129 |
TInt source = -1; |
|
9130 |
TInt childCount = iChildren.Count(); |
|
9131 |
RPointerArray< CXnNode > lockedNodes; |
|
9132 |
CleanupClosePushL( lockedNodes ); |
|
9133 |
RArray< TInt > lockedNodeIndex; |
|
9134 |
CleanupClosePushL( lockedNodeIndex ); |
|
9135 |
||
9136 |
for ( TInt i = 0; i < childCount; i++ ) |
|
9137 |
{ |
|
9138 |
CXnNode* tmpNode = iChildren[i]; |
|
9139 |
CXnProperty* editable = tmpNode->GetPropertyL( |
|
9140 |
XnPropertyNames::style::common::edit::KEditable ); |
|
9141 |
if ( editable && editable->StringValue() == XnPropertyNames::KFalse ) |
|
9142 |
{ |
|
9143 |
lockedNodes.AppendL( tmpNode ); |
|
9144 |
lockedNodeIndex.AppendL( i ); |
|
9145 |
continue; |
|
9146 |
} |
|
9147 |
||
9148 |
if ( tmpNode == aSource ) |
|
9149 |
{ |
|
9150 |
source = i; |
|
9151 |
} |
|
9152 |
if ( tmpNode == aTarget ) |
|
9153 |
{ |
|
9154 |
target = i; |
|
9155 |
} |
|
9156 |
} |
|
9157 |
if ( source != -1 && target != -1 ) |
|
9158 |
{ |
|
9159 |
TBool swap = EFalse; |
|
9160 |
CXnPluginData* data( aTarget->UiEngine()->ViewManager()-> |
|
9161 |
ActiveViewData().Plugin( aTarget ) ); |
|
9162 |
if ( data && !data->Occupied() ) |
|
9163 |
{ |
|
9164 |
// target is empty widget, swap widget places |
|
9165 |
swap = ETrue; |
|
9166 |
} |
|
9167 |
||
9168 |
if ( target < source ) |
|
9169 |
{ |
|
9170 |
iChildren.InsertL( aSource, target ); |
|
9171 |
iChildren.Remove( source + 1 ); |
|
9172 |
if ( swap ) |
|
9173 |
{ |
|
9174 |
iChildren.Remove( target + 1 ); |
|
9175 |
iChildren.InsertL( aTarget, source ); |
|
9176 |
} |
|
9177 |
} |
|
9178 |
else if ( source < target ) |
|
9179 |
{ |
|
9180 |
iChildren.Remove( source ); |
|
9181 |
iChildren.InsertL( aSource, target ); |
|
9182 |
if ( swap ) |
|
9183 |
{ |
|
9184 |
iChildren.Insert( aTarget, source ); |
|
9185 |
iChildren.Remove( target ); |
|
9186 |
} |
|
9187 |
} |
|
9188 |
||
9189 |
// put the locked nodes to the original places |
|
9190 |
TInt lockedNodeCount = lockedNodes.Count(); |
|
9191 |
TInt lockedIndexCount = lockedNodeIndex.Count(); |
|
9192 |
if ( lockedNodeCount != lockedIndexCount ) |
|
9193 |
{ |
|
9194 |
return; |
|
9195 |
} |
|
9196 |
// First remove all the locked nodes |
|
9197 |
for ( TInt j = 0; j < lockedNodeCount; j++ ) |
|
9198 |
{ |
|
9199 |
CXnNode* tmpLockedNode = lockedNodes[j]; |
|
9200 |
TInt ind = iChildren.FindL( tmpLockedNode ); |
|
9201 |
if ( KErrNotFound != ind ) |
|
9202 |
{ |
|
9203 |
iChildren.Remove( ind ); |
|
9204 |
} |
|
9205 |
} |
|
9206 |
||
9207 |
//And then put them again to the original places |
|
9208 |
for ( TInt j = 0; j < lockedNodeCount; j++ ) |
|
9209 |
{ |
|
9210 |
CXnNode* tmpLockedNode = lockedNodes[j]; |
|
9211 |
iChildren.InsertL( tmpLockedNode, lockedNodeIndex[j] ); |
|
9212 |
} |
|
9213 |
} |
|
9214 |
||
9215 |
lockedNodes.Reset(); |
|
9216 |
lockedNodeIndex.Reset(); |
|
9217 |
CleanupStack::PopAndDestroy( 2 ); // lockedNodes, lockedNodeIndex |
|
9218 |
} |
|
9219 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
9220 |
/* |
34 | 9221 |
// ----------------------------------------------------------------------------- |
9222 |
// CXnNodeImpl::FindNextNodeL |
|
9223 |
// ----------------------------------------------------------------------------- |
|
9224 |
// |
|
9225 |
CXnNode* CXnNodeImpl::FindNextNodeL( |
|
9226 |
RPointerArray< CXnNode >& aArray, |
|
9227 |
CXnNode& aNode, |
|
9228 |
TInt aDirection ) |
|
9229 |
{ |
|
9230 |
CXnNode* node = NULL; |
|
9231 |
if ( aDirection == EStdKeyRightArrow ) |
|
9232 |
{ |
|
9233 |
node = FindNextNodeFromRightL( aArray, aNode ); |
|
9234 |
} |
|
9235 |
else if ( aDirection == EStdKeyLeftArrow ) |
|
9236 |
{ |
|
9237 |
node = FindNextNodeFromLeftL( aArray, aNode ); |
|
9238 |
} |
|
9239 |
else if ( aDirection == EStdKeyUpArrow ) |
|
9240 |
{ |
|
9241 |
node = FindNextNodeFromAboveL( aArray, aNode ); |
|
9242 |
} |
|
9243 |
else if ( aDirection == EStdKeyDownArrow ) |
|
9244 |
{ |
|
9245 |
node = FindNextNodeFromBelowL( aArray, aNode ); |
|
9246 |
} |
|
9247 |
return node; |
|
9248 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
9249 |
*/ |
34 | 9250 |
|
9251 |
// ----------------------------------------------------------------------------- |
|
9252 |
// CXnNodeImpl::Namespace |
|
9253 |
// ----------------------------------------------------------------------------- |
|
9254 |
// |
|
9255 |
const TDesC8& CXnNodeImpl::Namespace() |
|
9256 |
{ |
|
9257 |
return DomNode()->Namespace(); |
|
9258 |
} |
|
9259 |
||
9260 |
// ----------------------------------------------------------------------------- |
|
9261 |
// CXnNodeImpl::SetScrollableControl() |
|
9262 |
// ----------------------------------------------------------------------------- |
|
9263 |
// |
|
9264 |
void CXnNodeImpl::SetScrollableControl( CXnScrollableControlAdapter* aScrollableControl ) |
|
9265 |
{ |
|
9266 |
iScrollableControl = aScrollableControl; |
|
9267 |
} |
|
9268 |
||
9269 |
// ----------------------------------------------------------------------------- |
|
9270 |
// CXnNodeImpl::ScrollableControl() |
|
9271 |
// ----------------------------------------------------------------------------- |
|
9272 |
// |
|
9273 |
CXnScrollableControlAdapter* CXnNodeImpl::ScrollableControl() |
|
9274 |
{ |
|
9275 |
return iScrollableControl; |
|
9276 |
} |
|
9277 |
||
9278 |
// ----------------------------------------------------------------------------- |
|
9279 |
// CXnNodeImpl::AdjustRectIfNeeded |
|
9280 |
// ----------------------------------------------------------------------------- |
|
9281 |
// |
|
9282 |
TRect CXnNodeImpl::AdjustRectIfNeeded( TRect aRect ) |
|
9283 |
{ |
|
9284 |
if(iScrollableControl) |
|
9285 |
{ |
|
9286 |
aRect.Move( iScrollableControl->DeltaPosition() ); |
|
9287 |
} |
|
9288 |
return aRect; |
|
9289 |
} |