|
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" |
|
30 #include "xncontroladapter.h" |
|
31 #include "xnpopupcontroladapter.h" |
|
32 #include "xnmenuadapter.h" |
|
33 #include "xndomlist.h" |
|
34 #include "xndomdocument.h" |
|
35 #include "xnpointerarray.h" |
|
36 #include "xnodt.h" |
|
37 #include "xntype.h" |
|
38 #include "xndomnode.h" |
|
39 #include "xndomattribute.h" |
|
40 #include "xndompropertyvalue.h" |
|
41 #include "xnpopup.h" |
|
42 #include "c_xnutils.h" |
|
43 #include "xneditmode.h" |
|
44 #include "xneditor.h" |
|
45 #include "xntext.h" |
|
46 #include "xnscrollablecontroladapter.h" |
|
47 #include "xnviewdata.h" |
|
48 #include "xnrootdata.h" |
|
49 #include "xnpanic.h" |
|
50 #include "xnlistquerydialogadapter.h" |
|
51 #include "xneffectmanager.h" |
|
52 #include "xnviewadapter.h" |
|
53 #include "xnbackgroundmanager.h" |
|
54 #include "xntexteditor.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( |
|
340 RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse ); |
|
341 static CXnNode* FindNextNodeFromAboveL( |
|
342 RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse ); |
|
343 static CXnNode* FindPluginNode( CXnNode& aNode ); |
|
344 static TBool DoInternalFocusChangeL( |
|
345 CXnUiEngine& aEngine, CXnNode& aNode, const TKeyEvent& aKeyEvent, |
|
346 TEventCode aType ); |
|
347 static TBool DoTriggerKeyEventL( |
|
348 CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode, |
|
349 const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
350 static void DoTriggerEventL( |
|
351 CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode, |
|
352 CXnNode& aActionsParent, CXnNode& aEventData, TInt aSource ); |
|
353 static TBool DoReceiveFocusL( CXnNode& aNode, CXnUiEngine& aEngine ); |
|
354 static void InformPropertyChangeL( CXnNode& aNode, CXnProperty* aProperty = NULL ); |
|
355 static CXnNode* BuildEventTypeNodeL( TEventCode aType, CXnUiEngine& aUiEngine ); |
|
356 static CXnNode* BuildModifiersNodeL( |
|
357 const TKeyEvent& aKeyEvent, CXnUiEngine& aUiEngine ); |
|
358 static CXnNode* BuildKeyCodeNodeL( |
|
359 const TKeyEvent& aKeyEvent, CXnUiEngine& aUiEngine ); |
|
360 static CXnNode* BuildScanCodeNodeL( |
|
361 const TKeyEvent& aKeyEvent, CXnUiEngine& aUiEngine ); |
|
362 static CXnNode* BuildRepeatsNodeL( |
|
363 const TKeyEvent& aKeyEvent, CXnUiEngine& aUiEngine ); |
|
364 static void BuildPropertyNodesL( CXnNode& aNode, const TKeyEvent& aKeyEvent, |
|
365 TEventCode aType, CXnUiEngine& aUiEngine ); |
|
366 static CXnNode* BuildKeyTriggerNodeL( const TKeyEvent& aKeyEvent, TEventCode aType, |
|
367 CXnUiEngine& aUiEngine ); |
|
368 static CXnDomPropertyValue* GetNavIndexL( CXnNode& aNode ); |
|
369 static CXnNode* BackwardL( CXnNode& aNode ); |
|
370 static CXnNode* ForwardL( CXnNode& aNode ); |
|
371 static CXnNode* BackwardLoopL( CXnNode& aNode ); |
|
372 static CXnNode* ForwardLoopL( CXnNode& aNode ); |
|
373 static TInt CompareNavIndexesL( |
|
374 CXnDomPropertyValue* aCurrentPropertyValue, |
|
375 CXnDomPropertyValue* aNextPropertyValue ); |
|
376 static void ReplaceOrAppend( |
|
377 CXnProperty* aProperty, RPointerArray< CXnProperty >& aArray, |
|
378 TBool aAppendOnly ); |
|
379 static TBool DisplayValueMatchL( CXnNode& aNode, const TDesC8& aDisplayValue ); |
|
380 static void SetStringPropertyToNodeL( |
|
381 CXnDomStringPool& aStringPool, CXnNode& aNode, |
|
382 const TDesC8& aPropertyName, const TDesC8& aPropertyValue ); |
|
383 static void SetFloatPropertyToNodeL( |
|
384 CXnDomStringPool& aStringPool, CXnNode& aNode, |
|
385 const TDesC8& aPropertyName, TReal aPropertyValue, |
|
386 CXnDomPropertyValue::TPrimitiveValueType aValueType ); |
|
387 static CXnNode* FindYoungestSiblingWithDisplayL( |
|
388 RPointerArray< CXnNode >& aSiblingArray, |
|
389 const TDesC8& aDisplayValue, |
|
390 TInt& aIndex ); |
|
391 static CXnNode* FindOldestSiblingWithDisplayL( |
|
392 RPointerArray< CXnNode >& aSiblingArray, |
|
393 const TDesC8& aDisplayValue, |
|
394 TInt& aIndex ); |
|
395 static TBool IsCompoundNodeL( CXnNode* aNode ); |
|
396 static void NotifyScrollNodeL( CXnNode* aNode, TBool aBegin, TBool aGainEnd ); |
|
397 static void DoCompoundNodeBeginKeyL( |
|
398 RPointerArray< CXnNode >& aChildren, CXnNode* aFocusedNode ); |
|
399 static void DoCompoundNodeEndKeyL( |
|
400 RPointerArray< CXnNode >& aChildren, CXnNode* aFocusedNode ); |
|
401 static void DoCompoundNodeScrollingL( |
|
402 CXnNode& aFocusedNode, |
|
403 const TKeyEvent& aKeyEvent, |
|
404 TEventCode aType ); |
|
405 static CXnNode* BuildTriggerNodeL( |
|
406 CXnUiEngine& aUiEngine, const TDesC8& aTriggerName ); |
|
407 static CXnNode* IsNodeNavigableL( CXnNode* aParent ); |
|
408 static TBool IsNodeNavigableL( CXnNode& aNode, TBool aIgnoreDropped = EFalse ); |
|
409 static TInt DirtyLevelFromPropertyL( CXnNode& aNode, const TDesC8& aPropName ); |
|
410 static TBool IsNodeDisplayedL( |
|
411 CXnNode& aNode, TBool aCheckVisiblity = EFalse, TBool aCheckParent = ETrue ); |
|
412 static void EnableStatePropertyL( |
|
413 CXnNode& aNode, |
|
414 CXnDomProperty::TPseudoClass aPseudoClass, |
|
415 CXnProperty* ( CXnNode::* aGetCachedPropertyL )(), |
|
416 CXnProperty*& aProperty, |
|
417 RPointerArray< CXnProperty >& aArray, TInt& aLevel, |
|
418 TBool aInformChange = EFalse ); |
|
419 static void DisableStatePropertyL( |
|
420 CXnNode& aNode, |
|
421 CXnDomProperty::TPseudoClass aPseudoClass, |
|
422 CXnProperty* ( CXnNode::* aGetCachedPropertyL )(), |
|
423 CXnProperty*& aProperty, |
|
424 RPointerArray< CXnProperty >& aArray, |
|
425 RArray< CXnDomProperty::TPseudoClass >& aStates, TInt& aLevel, |
|
426 TBool aInformChange = EFalse ); |
|
427 static TBool MatchTitleScrollTriggerL( |
|
428 CXnNode& aEventData, CXnDomNode& aTriggerNode ); |
|
429 static CXnDomNode* GetTemplateEventL( |
|
430 const TDesC8& aTemplate, |
|
431 CXnNode& aNode, |
|
432 CXnDomNode& aEventNode ); |
|
433 |
|
434 // ============================= LOCAL FUNCTIONS =============================== |
|
435 // ----------------------------------------------------------------------------- |
|
436 // GetTemplateEventL |
|
437 // ----------------------------------------------------------------------------- |
|
438 // |
|
439 static CXnDomNode* GetTemplateEventL( const TDesC8& aTemplate, CXnNode& aNode, |
|
440 CXnDomNode& aEventNode ) |
|
441 { |
|
442 CXnDomNode* retval( NULL ); |
|
443 |
|
444 if ( aTemplate == KIndex() ) |
|
445 { |
|
446 _LIT8( KTemplateIndex, "(#)" ); |
|
447 |
|
448 const TDesC8& eventString( aEventNode.AttributeValue( KName ) ); |
|
449 |
|
450 TInt index( eventString.Find( KTemplateIndex ) ); |
|
451 |
|
452 CXnNode* parent( aNode.Parent() ); |
|
453 |
|
454 if ( index != KErrNotFound && parent ) |
|
455 { |
|
456 RPointerArray< CXnNode >& siblings( parent->Children() ); |
|
457 |
|
458 TInt itemindex( siblings.Find( &aNode ) ); |
|
459 |
|
460 if ( itemindex != KErrNotFound ) |
|
461 { |
|
462 TBuf8< 4 > buf; |
|
463 buf.AppendNum( itemindex ); |
|
464 |
|
465 CXnDomNode* clone( |
|
466 aEventNode.CloneL( *aEventNode.StringPool() ) ); |
|
467 CleanupStack::PushL( clone ); |
|
468 |
|
469 HBufC8* templateString = |
|
470 HBufC8::NewLC( eventString.Length() + 4 ); |
|
471 |
|
472 TPtr8 ptr( templateString->Des() ); |
|
473 |
|
474 ptr.Copy( eventString ); |
|
475 ptr.Delete( index + 1, 1 ); |
|
476 ptr.Insert( index + 1, buf ); |
|
477 |
|
478 CXnDomAttribute* attribute = static_cast< CXnDomAttribute* > |
|
479 ( clone->AttributeList().FindByName( |
|
480 XnPropertyNames::action::event::KName ) ); |
|
481 |
|
482 if ( attribute ) |
|
483 { |
|
484 attribute->SetValueL( ptr ); |
|
485 } |
|
486 |
|
487 CleanupStack::PopAndDestroy( templateString ); |
|
488 |
|
489 CleanupStack::Pop( clone ); |
|
490 retval = clone; |
|
491 } |
|
492 } |
|
493 } |
|
494 |
|
495 return retval; |
|
496 } |
|
497 |
|
498 // ----------------------------------------------------------------------------- |
|
499 // ResolveEffectId |
|
500 // ----------------------------------------------------------------------------- |
|
501 // |
|
502 static TInt ResolveEffectId( CXnDomNode& aEventNode ) |
|
503 { |
|
504 TInt effect( 0 ); |
|
505 const TDesC8& value( aEventNode.AttributeValue( |
|
506 XnPropertyNames::common::KEffectId ) ); |
|
507 if( value != KNullDesC8 ) |
|
508 { |
|
509 TLex8 lex( value ); |
|
510 lex.Val( effect ); |
|
511 } |
|
512 return effect; |
|
513 } |
|
514 |
|
515 // ----------------------------------------------------------------------------- |
|
516 // Checks whether trigger is runnable |
|
517 // ----------------------------------------------------------------------------- |
|
518 // |
|
519 TBool IsTriggerRunnableL( CXnDomNode& aTriggerNode ) |
|
520 { |
|
521 TBool ret( ETrue ); |
|
522 CXnNode* layoutNode = aTriggerNode.LayoutNode(); |
|
523 if ( layoutNode ) |
|
524 { |
|
525 CXnProperty* display = |
|
526 layoutNode->GetPropertyL( XnPropertyNames::style::common::KDisplay ); |
|
527 |
|
528 if ( display && display->StringValue() == |
|
529 XnPropertyNames::style::common::display::KNone ) |
|
530 { |
|
531 ret = EFalse; |
|
532 } |
|
533 } |
|
534 return ret; |
|
535 } |
|
536 |
|
537 // ----------------------------------------------------------------------------- |
|
538 // DirtyLevelFromPropertyL |
|
539 // ----------------------------------------------------------------------------- |
|
540 // |
|
541 static TInt DirtyLevelFromPropertyL( CXnNode& aNode, const TDesC8& aPropName ) |
|
542 { |
|
543 if ( aPropName == XnPropertyNames::style::common::KDisplay || |
|
544 aPropName == XnPropertyNames::style::common::KBlockProgression || |
|
545 aPropName == XnPropertyNames::style::common::KDirection || |
|
546 aPropName == XnPropertyNames::style::common::KPosition || |
|
547 aPropName == XnPropertyNames::style::common::KTop || |
|
548 aPropName == XnPropertyNames::style::common::KLeft || |
|
549 aPropName == XnPropertyNames::style::common::KBottom || |
|
550 aPropName == XnPropertyNames::style::common::KRight || |
|
551 aPropName == XnPropertyNames::style::common::KWidth || |
|
552 aPropName == XnPropertyNames::style::common::KHeight || |
|
553 aPropName == XnPropertyNames::style::common::KMinWidth || |
|
554 aPropName == XnPropertyNames::style::common::KMaxWidth || |
|
555 aPropName == XnPropertyNames::style::common::KMinHeight || |
|
556 aPropName == XnPropertyNames::style::common::KMaxHeight || |
|
557 aPropName == XnPropertyNames::style::common::KS60DisplayPriority || |
|
558 aPropName == XnPropertyNames::style::common::KMarginTop || |
|
559 aPropName == XnPropertyNames::style::common::KMarginRight || |
|
560 aPropName == XnPropertyNames::style::common::KMarginBottom || |
|
561 aPropName == XnPropertyNames::style::common::KMarginLeft || |
|
562 aPropName == XnPropertyNames::style::common::KBorderWidth || |
|
563 aPropName == XnPropertyNames::style::common::KBorderTopWidth || |
|
564 aPropName == XnPropertyNames::style::common::KBorderRightWidth || |
|
565 aPropName == XnPropertyNames::style::common::KBorderBottomWidth || |
|
566 aPropName == XnPropertyNames::style::common::KBorderLeftWidth || |
|
567 aPropName == XnPropertyNames::style::common::KBorderLeftWidth || |
|
568 aPropName == XnPropertyNames::style::common::KPaddingRight || |
|
569 aPropName == XnPropertyNames::style::common::KPaddingBottom || |
|
570 aPropName == XnPropertyNames::style::common::KPaddingLeft ) |
|
571 { |
|
572 TInt retval( XnDirtyLevel::ELayoutAndRenderSiblings ); |
|
573 |
|
574 CXnProperty* prop( aNode.PositionL() ); |
|
575 |
|
576 if ( prop ) |
|
577 { |
|
578 const TDesC8& value( prop->StringValue() ); |
|
579 |
|
580 if ( value == XnPropertyNames::style::common::position::KAbsolute || |
|
581 value == XnPropertyNames::style::common::position::KFloating ) |
|
582 { |
|
583 retval = XnDirtyLevel::ELayoutAndRender; |
|
584 } |
|
585 } |
|
586 |
|
587 if ( aNode.Type()->Type() == KToolTip ) |
|
588 { |
|
589 retval = XnDirtyLevel::ELayoutAndRender; |
|
590 } |
|
591 |
|
592 return retval; |
|
593 } |
|
594 else |
|
595 { |
|
596 return XnDirtyLevel::ERender; |
|
597 } |
|
598 } |
|
599 |
|
600 // ----------------------------------------------------------------------------- |
|
601 // IsNodeDisplayedL |
|
602 // Check whether a node is displayed or not |
|
603 // ----------------------------------------------------------------------------- |
|
604 // |
|
605 static TBool IsNodeDisplayedL( |
|
606 CXnNode& aNode, |
|
607 TBool aCheckVisiblity, |
|
608 TBool aCheckParent ) |
|
609 { |
|
610 if ( !aNode.IsLayoutCapable() ) |
|
611 { |
|
612 return EFalse; |
|
613 } |
|
614 |
|
615 if ( aCheckVisiblity ) |
|
616 { |
|
617 CXnProperty* visibilityProp( aNode.VisibilityL() ); |
|
618 |
|
619 // Am I visible? |
|
620 if ( visibilityProp ) |
|
621 { |
|
622 const TDesC8& visibility( visibilityProp->StringValue() ); |
|
623 |
|
624 if ( visibility != XnPropertyNames::style::common::visibility::KVisible ) |
|
625 { |
|
626 return EFalse; |
|
627 } |
|
628 } |
|
629 } |
|
630 |
|
631 // Am I displayed? |
|
632 CXnProperty* displayProp( aNode.DisplayL() ); |
|
633 |
|
634 if ( displayProp ) |
|
635 { |
|
636 const TDesC8& display( displayProp->StringValue() ); |
|
637 |
|
638 if ( display != XnPropertyNames::style::common::display::KBlock ) |
|
639 { |
|
640 return EFalse; |
|
641 } |
|
642 } |
|
643 |
|
644 if ( aCheckParent ) |
|
645 { |
|
646 CXnNode* parent( aNode.Parent() ); |
|
647 |
|
648 // Is my parent displayed? |
|
649 for ( ; parent; parent = parent->Parent() ) |
|
650 { |
|
651 CXnProperty* displayProp( parent->DisplayL() ); |
|
652 |
|
653 if ( displayProp ) |
|
654 { |
|
655 const TDesC8& display( displayProp->StringValue() ); |
|
656 |
|
657 if ( display != XnPropertyNames::style::common::display::KBlock ) |
|
658 { |
|
659 return EFalse; |
|
660 } |
|
661 } |
|
662 } |
|
663 } |
|
664 |
|
665 return ETrue; |
|
666 } |
|
667 |
|
668 // ----------------------------------------------------------------------------- |
|
669 // IsNodeNavigableL |
|
670 // Check whether a node or its child is navigable, ignores dropped state |
|
671 // ----------------------------------------------------------------------------- |
|
672 // |
|
673 static CXnNode* IsNodeNavigableL( CXnNode* aParent ) |
|
674 { |
|
675 if ( IsNodeNavigableL( *aParent, ETrue ) ) |
|
676 { |
|
677 return aParent; |
|
678 } |
|
679 |
|
680 RPointerArray< CXnNode >& children( aParent->Children() ); |
|
681 |
|
682 TInt count( children.Count() ); |
|
683 |
|
684 CXnNode* retval = NULL; |
|
685 for ( TInt i = 0; i < count; i++ ) |
|
686 { |
|
687 retval = IsNodeNavigableL( children[i] ); |
|
688 if ( retval ) |
|
689 { |
|
690 return retval; |
|
691 } |
|
692 } |
|
693 |
|
694 return NULL; |
|
695 } |
|
696 |
|
697 // ----------------------------------------------------------------------------- |
|
698 // IsNodeNavigableL() |
|
699 // Check if node can be navigated |
|
700 // ----------------------------------------------------------------------------- |
|
701 // |
|
702 static TBool IsNodeNavigableL( CXnNode& aNode, TBool aIgnoreDropped ) |
|
703 { |
|
704 if ( !aNode.IsLayoutCapable() || ( !aIgnoreDropped && aNode.IsDropped() ) ) |
|
705 { |
|
706 return EFalse; |
|
707 } |
|
708 |
|
709 CXnProperty* displayProp( aNode.DisplayL() ); |
|
710 |
|
711 if ( displayProp ) |
|
712 { |
|
713 const TDesC8& display( displayProp->StringValue() ); |
|
714 |
|
715 if ( display != XnPropertyNames::style::common::display::KBlock ) |
|
716 { |
|
717 return EFalse; |
|
718 } |
|
719 } |
|
720 |
|
721 CXnProperty* visibilityProp( aNode.VisibilityL() ); |
|
722 |
|
723 if ( visibilityProp ) |
|
724 { |
|
725 const TDesC8& visibility( visibilityProp->StringValue() ); |
|
726 |
|
727 if ( visibility != XnPropertyNames::style::common::visibility::KVisible ) |
|
728 { |
|
729 return EFalse; |
|
730 } |
|
731 } |
|
732 |
|
733 CXnProperty* focusableProp( |
|
734 aNode.GetPropertyL( XnPropertyNames::common::KFocusable ) ); |
|
735 |
|
736 if ( focusableProp ) |
|
737 { |
|
738 const TDesC8& focus( focusableProp->StringValue() ); |
|
739 |
|
740 if ( focus != XnPropertyNames::KTrue ) |
|
741 { |
|
742 return EFalse; |
|
743 } |
|
744 } |
|
745 else |
|
746 { |
|
747 return EFalse; |
|
748 } |
|
749 CXnProperty* disabledProp( |
|
750 aNode.GetPropertyL( XnPropertyNames::common::KDisabled ) ); |
|
751 |
|
752 if ( disabledProp ) |
|
753 { |
|
754 const TDesC8& disabled( disabledProp->StringValue() ); |
|
755 |
|
756 if ( disabled == XnPropertyNames::KTrue ) |
|
757 { |
|
758 return EFalse; |
|
759 } |
|
760 } |
|
761 |
|
762 // The node can be navigated. Then check parents display and visibilty properties |
|
763 CXnNode* parent( aNode.Parent() ); |
|
764 |
|
765 for ( ; parent; parent = parent->Parent() ) |
|
766 { |
|
767 CXnProperty* displayProp( parent->DisplayL() ); |
|
768 |
|
769 if ( displayProp ) |
|
770 { |
|
771 const TDesC8& display( displayProp->StringValue() ); |
|
772 |
|
773 if ( display != XnPropertyNames::style::common::display::KBlock ) |
|
774 { |
|
775 return EFalse; |
|
776 } |
|
777 } |
|
778 |
|
779 CXnProperty* visibilityProp( parent->VisibilityL() ); |
|
780 |
|
781 if ( visibilityProp ) |
|
782 { |
|
783 const TDesC8& visibility( visibilityProp->StringValue() ); |
|
784 |
|
785 if ( visibility != XnPropertyNames::style::common::visibility::KVisible ) |
|
786 { |
|
787 return EFalse; |
|
788 } |
|
789 } |
|
790 } |
|
791 |
|
792 return ETrue; |
|
793 } |
|
794 |
|
795 // ----------------------------------------------------------------------------- |
|
796 // EnableStatePropertyL() |
|
797 // ----------------------------------------------------------------------------- |
|
798 // |
|
799 static void EnableStatePropertyL( |
|
800 CXnNode& aNode, |
|
801 CXnDomProperty::TPseudoClass aPseudoClass, |
|
802 CXnProperty* ( CXnNode::* aGetCachedPropertyL )(), |
|
803 CXnProperty*& aProperty, |
|
804 RPointerArray< CXnProperty >& aArray, TInt& aLevel, |
|
805 TBool aInformChange ) |
|
806 { |
|
807 TBool doInform( EFalse ); |
|
808 |
|
809 for ( TInt i = aArray.Count() - 1; i >= 0; --i ) |
|
810 { |
|
811 if ( aArray[i]->Property()->PseudoClass() == aPseudoClass ) |
|
812 { |
|
813 CXnProperty* temp( aArray[i] ); |
|
814 |
|
815 if ( aLevel < XnDirtyLevel::ELayoutAndRenderSiblings || |
|
816 aInformChange ) |
|
817 { |
|
818 TInt level( XnDirtyLevel::ENone ); |
|
819 |
|
820 // Get current cached prop |
|
821 CXnProperty* prop( ( aNode.*aGetCachedPropertyL )() ); |
|
822 |
|
823 if ( !temp && prop ) |
|
824 { |
|
825 level = DirtyLevelFromPropertyL( |
|
826 aNode, prop->Property()->Name() ); |
|
827 } |
|
828 else if ( ( temp && !prop ) || |
|
829 ( temp && prop && !prop->EqualsL( *temp ) ) ) |
|
830 { |
|
831 level = DirtyLevelFromPropertyL( |
|
832 aNode, temp->Property()->Name() ); |
|
833 } |
|
834 |
|
835 if ( aInformChange && ( level != XnDirtyLevel::ENone ) ) |
|
836 { |
|
837 doInform = ETrue; |
|
838 } |
|
839 |
|
840 if ( level > aLevel && aNode.IsLayoutCapable()) |
|
841 { |
|
842 aLevel = level; |
|
843 } |
|
844 } |
|
845 |
|
846 aProperty = temp; |
|
847 |
|
848 if ( doInform ) |
|
849 { |
|
850 // Property is changed |
|
851 InformPropertyChangeL( aNode, temp ); |
|
852 } |
|
853 |
|
854 break; |
|
855 } |
|
856 } |
|
857 } |
|
858 |
|
859 // ----------------------------------------------------------------------------- |
|
860 // DisableStatePropertyL() |
|
861 // ----------------------------------------------------------------------------- |
|
862 // |
|
863 static void DisableStatePropertyL( |
|
864 CXnNode& aNode, |
|
865 CXnDomProperty::TPseudoClass aPseudoClass, |
|
866 CXnProperty* ( CXnNode::* aGetCachedPropertyL )(), |
|
867 CXnProperty*& aProperty, |
|
868 RPointerArray< CXnProperty >& aArray, |
|
869 RArray< CXnDomProperty::TPseudoClass >& aStates, TInt& aLevel, |
|
870 TBool aInformChange ) |
|
871 { |
|
872 CXnProperty* currentStateProperty( NULL ); |
|
873 |
|
874 TBool doInform( EFalse ); |
|
875 |
|
876 if ( aProperty && aProperty->Property()->PseudoClass() == aPseudoClass ) |
|
877 { |
|
878 // Is there an other pseudo state where to return? |
|
879 for ( TInt i = aArray.Count() - 1; !currentStateProperty && i >= 0; --i ) |
|
880 { |
|
881 for ( TInt j = aStates.Count() - 1; j >= 0; --j ) |
|
882 { |
|
883 if ( aArray[i]->Property()->PseudoClass() == aStates[j] && |
|
884 aArray[i]->Property()->PseudoClass() != aPseudoClass ) |
|
885 { |
|
886 currentStateProperty = aArray[i]; |
|
887 break; |
|
888 } |
|
889 } |
|
890 } |
|
891 |
|
892 // No, use the property from state "none" |
|
893 for ( TInt i = aArray.Count() - 1; !currentStateProperty && i >= 0; --i ) |
|
894 { |
|
895 for ( TInt j = aStates.Count() - 1; j >= 0; --j ) |
|
896 { |
|
897 if ( aArray[i]->Property()->PseudoClass() == CXnDomProperty::ENone && |
|
898 aArray[i]->Property()->PseudoClass() != aPseudoClass ) |
|
899 { |
|
900 currentStateProperty = aArray[i]; |
|
901 break; |
|
902 } |
|
903 } |
|
904 } |
|
905 |
|
906 CXnProperty* temp( currentStateProperty ); |
|
907 |
|
908 if ( aLevel < XnDirtyLevel::ELayoutAndRenderSiblings || aInformChange ) |
|
909 { |
|
910 TInt level( XnDirtyLevel::ENone ); |
|
911 |
|
912 // Get current cached prop |
|
913 CXnProperty* prop( ( aNode.*aGetCachedPropertyL )() ); |
|
914 |
|
915 if ( !temp && prop ) |
|
916 { |
|
917 level = DirtyLevelFromPropertyL( aNode, prop->Property()->Name() ); |
|
918 } |
|
919 else if ( ( temp && !prop ) || ( temp && prop && !prop->EqualsL( *temp ) ) ) |
|
920 { |
|
921 level = DirtyLevelFromPropertyL( aNode, temp->Property()->Name() ); |
|
922 } |
|
923 |
|
924 if ( aInformChange && ( level != XnDirtyLevel::ENone ) ) |
|
925 { |
|
926 doInform = ETrue; |
|
927 } |
|
928 |
|
929 if ( level > aLevel && aNode.IsLayoutCapable()) |
|
930 { |
|
931 aLevel = level; |
|
932 } |
|
933 } |
|
934 |
|
935 aProperty = temp; |
|
936 |
|
937 if ( doInform ) |
|
938 { |
|
939 // Property is changed |
|
940 InformPropertyChangeL( aNode, temp ); |
|
941 } |
|
942 } |
|
943 } |
|
944 |
|
945 // ----------------------------------------------------------------------------- |
|
946 // EnableStatePropertiesL() |
|
947 // ----------------------------------------------------------------------------- |
|
948 // |
|
949 static void EnableStatePropertiesL( |
|
950 CXnNode& aNode, |
|
951 CXnDomProperty::TPseudoClass aPseudoClass, |
|
952 CLayoutPropertyCache*& aLayoutPropertyCache ) |
|
953 { |
|
954 if ( !aLayoutPropertyCache ) |
|
955 { |
|
956 aLayoutPropertyCache = new ( ELeave ) CLayoutPropertyCache; |
|
957 } |
|
958 |
|
959 TInt level( XnDirtyLevel::ENone ); |
|
960 |
|
961 EnableStatePropertyL( |
|
962 aNode, aPseudoClass, &CXnNode::WidthL, |
|
963 aLayoutPropertyCache->iWidth, |
|
964 aLayoutPropertyCache->iWidths, level ); |
|
965 |
|
966 EnableStatePropertyL( |
|
967 aNode, aPseudoClass, &CXnNode::HeightL, |
|
968 aLayoutPropertyCache->iHeight, |
|
969 aLayoutPropertyCache->iHeights, level ); |
|
970 |
|
971 EnableStatePropertyL( |
|
972 aNode, aPseudoClass, &CXnNode::MarginLeftL, |
|
973 aLayoutPropertyCache->iMarginLeft, |
|
974 aLayoutPropertyCache->iMarginLefts, level ); |
|
975 |
|
976 EnableStatePropertyL( |
|
977 aNode, aPseudoClass, &CXnNode::MarginRightL, |
|
978 aLayoutPropertyCache->iMarginRight, |
|
979 aLayoutPropertyCache->iMarginRights, level ); |
|
980 |
|
981 EnableStatePropertyL( |
|
982 aNode, aPseudoClass, &CXnNode::BorderLeftL, |
|
983 aLayoutPropertyCache->iBorderLeft, |
|
984 aLayoutPropertyCache->iBorderLefts, level ); |
|
985 |
|
986 EnableStatePropertyL( |
|
987 aNode, aPseudoClass, &CXnNode::BorderRightL, |
|
988 aLayoutPropertyCache->iBorderRight, |
|
989 aLayoutPropertyCache->iBorderRights, level ); |
|
990 |
|
991 EnableStatePropertyL( |
|
992 aNode, aPseudoClass, &CXnNode::PaddingLeftL, |
|
993 aLayoutPropertyCache->iPaddingLeft, |
|
994 aLayoutPropertyCache->iPaddingLefts, level ); |
|
995 |
|
996 EnableStatePropertyL( |
|
997 aNode, aPseudoClass, &CXnNode::PaddingRightL, |
|
998 aLayoutPropertyCache->iPaddingRight, |
|
999 aLayoutPropertyCache->iPaddingRights, level ); |
|
1000 |
|
1001 EnableStatePropertyL( |
|
1002 aNode, aPseudoClass, &CXnNode::MarginTopL, |
|
1003 aLayoutPropertyCache->iMarginTop, |
|
1004 aLayoutPropertyCache->iMarginTops, level ); |
|
1005 |
|
1006 EnableStatePropertyL( |
|
1007 aNode, aPseudoClass, &CXnNode::MarginBottomL, |
|
1008 aLayoutPropertyCache->iMarginBottom, |
|
1009 aLayoutPropertyCache->iMarginBottoms, level ); |
|
1010 |
|
1011 EnableStatePropertyL( |
|
1012 aNode, aPseudoClass, &CXnNode::BorderTopL, |
|
1013 aLayoutPropertyCache->iBorderTop, |
|
1014 aLayoutPropertyCache->iBorderTops, level ); |
|
1015 |
|
1016 EnableStatePropertyL( |
|
1017 aNode, aPseudoClass, &CXnNode::BorderBottomL, |
|
1018 aLayoutPropertyCache->iBorderBottom, |
|
1019 aLayoutPropertyCache->iBorderBottoms, level ); |
|
1020 |
|
1021 EnableStatePropertyL( |
|
1022 aNode, aPseudoClass, &CXnNode::PaddingTopL, |
|
1023 aLayoutPropertyCache->iPaddingTop, |
|
1024 aLayoutPropertyCache->iPaddingTops, level ); |
|
1025 |
|
1026 EnableStatePropertyL( |
|
1027 aNode, aPseudoClass, &CXnNode::PaddingBottomL, |
|
1028 aLayoutPropertyCache->iPaddingBottom, |
|
1029 aLayoutPropertyCache->iPaddingBottoms, level ); |
|
1030 |
|
1031 EnableStatePropertyL( |
|
1032 aNode, aPseudoClass, &CXnNode::BorderWidthL, |
|
1033 aLayoutPropertyCache->iBorderWidth, |
|
1034 aLayoutPropertyCache->iBorderWidths, level ); |
|
1035 |
|
1036 EnableStatePropertyL( |
|
1037 aNode, aPseudoClass, &CXnNode::BlockProgressionL, |
|
1038 aLayoutPropertyCache->iBlockProgression, |
|
1039 aLayoutPropertyCache->iBlockProgressions, level ); |
|
1040 |
|
1041 EnableStatePropertyL( |
|
1042 aNode, aPseudoClass, &CXnNode::DirectionL, |
|
1043 aLayoutPropertyCache->iDirection, |
|
1044 aLayoutPropertyCache->iDirections, level ); |
|
1045 |
|
1046 EnableStatePropertyL( |
|
1047 aNode, aPseudoClass, &CXnNode::PositionL, |
|
1048 aLayoutPropertyCache->iPosition, |
|
1049 aLayoutPropertyCache->iPositions, level ); |
|
1050 |
|
1051 EnableStatePropertyL( |
|
1052 aNode, aPseudoClass, &CXnNode::MaxHeightL, |
|
1053 aLayoutPropertyCache->iMaxHeight, |
|
1054 aLayoutPropertyCache->iMaxHeights, level ); |
|
1055 |
|
1056 EnableStatePropertyL( |
|
1057 aNode, aPseudoClass, &CXnNode::MinHeightL, |
|
1058 aLayoutPropertyCache->iMinHeight, |
|
1059 aLayoutPropertyCache->iMinHeights, level ); |
|
1060 |
|
1061 EnableStatePropertyL( |
|
1062 aNode, aPseudoClass, &CXnNode::MaxWidthL, |
|
1063 aLayoutPropertyCache->iMaxWidth, |
|
1064 aLayoutPropertyCache->iMaxWidths, level ); |
|
1065 |
|
1066 EnableStatePropertyL( |
|
1067 aNode, aPseudoClass, &CXnNode::MinWidthL, |
|
1068 aLayoutPropertyCache->iMinWidth, |
|
1069 aLayoutPropertyCache->iMinWidths, level ); |
|
1070 |
|
1071 EnableStatePropertyL( |
|
1072 aNode, aPseudoClass, &CXnNode::DisplayL, |
|
1073 aLayoutPropertyCache->iDisplay, |
|
1074 aLayoutPropertyCache->iDisplays, level, ETrue ); |
|
1075 |
|
1076 EnableStatePropertyL( |
|
1077 aNode, aPseudoClass, &CXnNode::VisibilityL, |
|
1078 aLayoutPropertyCache->iVisibility, |
|
1079 aLayoutPropertyCache->iVisibilities, level ); |
|
1080 |
|
1081 EnableStatePropertyL( |
|
1082 aNode, aPseudoClass, &CXnNode::LeftL, |
|
1083 aLayoutPropertyCache->iLeft, |
|
1084 aLayoutPropertyCache->iLefts, level ); |
|
1085 |
|
1086 EnableStatePropertyL( |
|
1087 aNode, aPseudoClass, &CXnNode::RightL, |
|
1088 aLayoutPropertyCache->iRight, |
|
1089 aLayoutPropertyCache->iRights, level ); |
|
1090 |
|
1091 EnableStatePropertyL( |
|
1092 aNode, aPseudoClass, &CXnNode::TopL, |
|
1093 aLayoutPropertyCache->iTop, |
|
1094 aLayoutPropertyCache->iTops, level ); |
|
1095 |
|
1096 EnableStatePropertyL( |
|
1097 aNode, aPseudoClass, &CXnNode::BottomL, |
|
1098 aLayoutPropertyCache->iBottom, |
|
1099 aLayoutPropertyCache->iBottoms, level ); |
|
1100 |
|
1101 EnableStatePropertyL( |
|
1102 aNode, aPseudoClass, &CXnNode::BorderLeftStyleL, |
|
1103 aLayoutPropertyCache->iBorderLeftStyle, |
|
1104 aLayoutPropertyCache->iBorderLeftStyles, level ); |
|
1105 |
|
1106 EnableStatePropertyL( |
|
1107 aNode, aPseudoClass, &CXnNode::BorderRightStyleL, |
|
1108 aLayoutPropertyCache->iBorderRightStyle, |
|
1109 aLayoutPropertyCache->iBorderRightStyles, level ); |
|
1110 |
|
1111 EnableStatePropertyL( |
|
1112 aNode, aPseudoClass, &CXnNode::BorderTopStyleL, |
|
1113 aLayoutPropertyCache->iBorderTopStyle, |
|
1114 aLayoutPropertyCache->iBorderTopStyles, level ); |
|
1115 |
|
1116 EnableStatePropertyL( |
|
1117 aNode, aPseudoClass, &CXnNode::BorderBottomStyleL, |
|
1118 aLayoutPropertyCache->iBorderBottomStyle, |
|
1119 aLayoutPropertyCache->iBorderBottomStyles, level ); |
|
1120 |
|
1121 EnableStatePropertyL( |
|
1122 aNode, aPseudoClass, &CXnNode::BorderStyleL, |
|
1123 aLayoutPropertyCache->iBorderStyle, |
|
1124 aLayoutPropertyCache->iBorderStyles, level ); |
|
1125 |
|
1126 EnableStatePropertyL( |
|
1127 aNode, aPseudoClass, &CXnNode::DisplayPriorityL, |
|
1128 aLayoutPropertyCache->iDisplayPriority, |
|
1129 aLayoutPropertyCache->iDisplayPriorities, level ); |
|
1130 |
|
1131 EnableStatePropertyL( |
|
1132 aNode, aPseudoClass, &CXnNode::NavIndexL, |
|
1133 aLayoutPropertyCache->iNavIndex, |
|
1134 aLayoutPropertyCache->iNavIndexes, level ); |
|
1135 |
|
1136 EnableStatePropertyL( |
|
1137 aNode, aPseudoClass, &CXnNode::ZIndexL, |
|
1138 aLayoutPropertyCache->iZIndex, |
|
1139 aLayoutPropertyCache->iZIndexes, level ); |
|
1140 |
|
1141 EnableStatePropertyL( |
|
1142 aNode, aPseudoClass, &CXnNode::BackgroundColorL, |
|
1143 aLayoutPropertyCache->iBackgroundColor, |
|
1144 aLayoutPropertyCache->iBackgroundColors, level ); |
|
1145 |
|
1146 EnableStatePropertyL( |
|
1147 aNode, aPseudoClass, &CXnNode::BackgroundImageL, |
|
1148 aLayoutPropertyCache->iBackgroundImage, |
|
1149 aLayoutPropertyCache->iBackgroundImages, level, ETrue ); |
|
1150 |
|
1151 EnableStatePropertyL( |
|
1152 aNode, aPseudoClass, &CXnNode::FocusBackgroundL, |
|
1153 aLayoutPropertyCache->iFocusBackground, |
|
1154 aLayoutPropertyCache->iFocusBackgrounds, level ); |
|
1155 |
|
1156 aNode.SetDirtyL( level ); |
|
1157 } |
|
1158 |
|
1159 // ----------------------------------------------------------------------------- |
|
1160 // DisableStatePropertiesL() |
|
1161 // ----------------------------------------------------------------------------- |
|
1162 // |
|
1163 static void DisableStatePropertiesL( |
|
1164 CXnNode& aNode, |
|
1165 CXnDomProperty::TPseudoClass aPseudoClass, |
|
1166 RArray< CXnDomProperty::TPseudoClass >& aStates, |
|
1167 CLayoutPropertyCache*& aLayoutPropertyCache ) |
|
1168 { |
|
1169 if ( !aLayoutPropertyCache ) |
|
1170 { |
|
1171 aLayoutPropertyCache = new ( ELeave ) CLayoutPropertyCache; |
|
1172 } |
|
1173 |
|
1174 TInt level( XnDirtyLevel::ENone ); |
|
1175 |
|
1176 DisableStatePropertyL( |
|
1177 aNode, aPseudoClass, &CXnNode::WidthL, |
|
1178 aLayoutPropertyCache->iWidth, |
|
1179 aLayoutPropertyCache->iWidths, aStates, level ); |
|
1180 |
|
1181 DisableStatePropertyL( |
|
1182 aNode, aPseudoClass, &CXnNode::HeightL, |
|
1183 aLayoutPropertyCache->iHeight, |
|
1184 aLayoutPropertyCache->iHeights, aStates, level ); |
|
1185 |
|
1186 DisableStatePropertyL( |
|
1187 aNode, aPseudoClass, &CXnNode::MarginLeftL, |
|
1188 aLayoutPropertyCache->iMarginLeft, |
|
1189 aLayoutPropertyCache->iMarginLefts, aStates, level ); |
|
1190 |
|
1191 DisableStatePropertyL( |
|
1192 aNode, aPseudoClass, &CXnNode::MarginRightL, |
|
1193 aLayoutPropertyCache->iMarginRight, |
|
1194 aLayoutPropertyCache->iMarginRights, aStates, level ); |
|
1195 |
|
1196 DisableStatePropertyL( |
|
1197 aNode, aPseudoClass, &CXnNode::BorderLeftL, |
|
1198 aLayoutPropertyCache->iBorderLeft, |
|
1199 aLayoutPropertyCache->iBorderLefts, aStates, level ); |
|
1200 |
|
1201 DisableStatePropertyL( |
|
1202 aNode, aPseudoClass, &CXnNode::BorderRightL, |
|
1203 aLayoutPropertyCache->iBorderRight, |
|
1204 aLayoutPropertyCache->iBorderRights, aStates, level ); |
|
1205 |
|
1206 DisableStatePropertyL( |
|
1207 aNode, aPseudoClass, &CXnNode::PaddingLeftL, |
|
1208 aLayoutPropertyCache->iPaddingLeft, |
|
1209 aLayoutPropertyCache->iPaddingLefts, aStates, level ); |
|
1210 |
|
1211 DisableStatePropertyL( |
|
1212 aNode, aPseudoClass, &CXnNode::PaddingRightL, |
|
1213 aLayoutPropertyCache->iPaddingRight, |
|
1214 aLayoutPropertyCache->iPaddingRights, aStates, level ); |
|
1215 |
|
1216 DisableStatePropertyL( |
|
1217 aNode, aPseudoClass, &CXnNode::MarginTopL, |
|
1218 aLayoutPropertyCache->iMarginTop, |
|
1219 aLayoutPropertyCache->iMarginTops, aStates, level ); |
|
1220 |
|
1221 DisableStatePropertyL( |
|
1222 aNode, aPseudoClass, &CXnNode::MarginBottomL, |
|
1223 aLayoutPropertyCache->iMarginBottom, |
|
1224 aLayoutPropertyCache->iMarginBottoms, aStates, level ); |
|
1225 |
|
1226 DisableStatePropertyL( |
|
1227 aNode, aPseudoClass, &CXnNode::BorderTopL, |
|
1228 aLayoutPropertyCache->iBorderTop, |
|
1229 aLayoutPropertyCache->iBorderTops, aStates, level ); |
|
1230 |
|
1231 DisableStatePropertyL( |
|
1232 aNode, aPseudoClass, &CXnNode::BorderBottomL, |
|
1233 aLayoutPropertyCache->iBorderBottom, |
|
1234 aLayoutPropertyCache->iBorderBottoms, aStates, level ); |
|
1235 |
|
1236 DisableStatePropertyL( |
|
1237 aNode, aPseudoClass, &CXnNode::PaddingTopL, |
|
1238 aLayoutPropertyCache->iPaddingTop, |
|
1239 aLayoutPropertyCache->iPaddingTops, aStates, level ); |
|
1240 |
|
1241 DisableStatePropertyL( |
|
1242 aNode, aPseudoClass, &CXnNode::PaddingBottomL, |
|
1243 aLayoutPropertyCache->iPaddingBottom, |
|
1244 aLayoutPropertyCache->iPaddingBottoms, aStates, level ); |
|
1245 |
|
1246 DisableStatePropertyL( |
|
1247 aNode, aPseudoClass, &CXnNode::BorderWidthL, |
|
1248 aLayoutPropertyCache->iBorderWidth, |
|
1249 aLayoutPropertyCache->iBorderWidths, aStates, level ); |
|
1250 |
|
1251 DisableStatePropertyL( |
|
1252 aNode, aPseudoClass, &CXnNode::BlockProgressionL, |
|
1253 aLayoutPropertyCache->iBlockProgression, |
|
1254 aLayoutPropertyCache->iBlockProgressions, aStates, level ); |
|
1255 |
|
1256 DisableStatePropertyL( |
|
1257 aNode, aPseudoClass, &CXnNode::DirectionL, |
|
1258 aLayoutPropertyCache->iDirection, |
|
1259 aLayoutPropertyCache->iDirections, aStates, level ); |
|
1260 |
|
1261 DisableStatePropertyL( |
|
1262 aNode, aPseudoClass, &CXnNode::PositionL, |
|
1263 aLayoutPropertyCache->iPosition, |
|
1264 aLayoutPropertyCache->iPositions, aStates, level ); |
|
1265 |
|
1266 DisableStatePropertyL( |
|
1267 aNode, aPseudoClass, &CXnNode::MaxHeightL, |
|
1268 aLayoutPropertyCache->iMaxHeight, |
|
1269 aLayoutPropertyCache->iMaxHeights, aStates, level ); |
|
1270 |
|
1271 DisableStatePropertyL( |
|
1272 aNode, aPseudoClass, &CXnNode::MinHeightL, |
|
1273 aLayoutPropertyCache->iMinHeight, |
|
1274 aLayoutPropertyCache->iMinHeights, aStates, level ); |
|
1275 |
|
1276 DisableStatePropertyL( |
|
1277 aNode, aPseudoClass, &CXnNode::MaxWidthL, |
|
1278 aLayoutPropertyCache->iMaxWidth, |
|
1279 aLayoutPropertyCache->iMaxWidths, aStates, level ); |
|
1280 |
|
1281 DisableStatePropertyL( |
|
1282 aNode, aPseudoClass, &CXnNode::MinWidthL, |
|
1283 aLayoutPropertyCache->iMinWidth, |
|
1284 aLayoutPropertyCache->iMinWidths, aStates, level ); |
|
1285 |
|
1286 DisableStatePropertyL( |
|
1287 aNode, aPseudoClass, &CXnNode::DisplayL, |
|
1288 aLayoutPropertyCache->iDisplay, |
|
1289 aLayoutPropertyCache->iDisplays, aStates, level, ETrue ); |
|
1290 |
|
1291 DisableStatePropertyL( |
|
1292 aNode, aPseudoClass, &CXnNode::VisibilityL, |
|
1293 aLayoutPropertyCache->iVisibility, |
|
1294 aLayoutPropertyCache->iVisibilities, aStates, level ); |
|
1295 |
|
1296 DisableStatePropertyL( |
|
1297 aNode, aPseudoClass, &CXnNode::LeftL, |
|
1298 aLayoutPropertyCache->iLeft, |
|
1299 aLayoutPropertyCache->iLefts, aStates, level ); |
|
1300 |
|
1301 DisableStatePropertyL( |
|
1302 aNode, aPseudoClass, &CXnNode::RightL, |
|
1303 aLayoutPropertyCache->iRight, |
|
1304 aLayoutPropertyCache->iRights, aStates, level ); |
|
1305 |
|
1306 DisableStatePropertyL( |
|
1307 aNode, aPseudoClass, &CXnNode::TopL, |
|
1308 aLayoutPropertyCache->iTop, |
|
1309 aLayoutPropertyCache->iTops, aStates, level ); |
|
1310 |
|
1311 DisableStatePropertyL( |
|
1312 aNode, aPseudoClass, &CXnNode::BottomL, |
|
1313 aLayoutPropertyCache->iBottom, |
|
1314 aLayoutPropertyCache->iBottoms, aStates, level ); |
|
1315 |
|
1316 DisableStatePropertyL( |
|
1317 aNode, aPseudoClass, &CXnNode::BorderLeftStyleL, |
|
1318 aLayoutPropertyCache->iBorderLeftStyle, |
|
1319 aLayoutPropertyCache->iBorderLeftStyles, aStates, level ); |
|
1320 |
|
1321 DisableStatePropertyL( |
|
1322 aNode, aPseudoClass, &CXnNode::BorderRightStyleL, |
|
1323 aLayoutPropertyCache->iBorderRightStyle, |
|
1324 aLayoutPropertyCache->iBorderRightStyles, aStates, level ); |
|
1325 |
|
1326 DisableStatePropertyL( |
|
1327 aNode, aPseudoClass, &CXnNode::BorderTopStyleL, |
|
1328 aLayoutPropertyCache->iBorderTopStyle, |
|
1329 aLayoutPropertyCache->iBorderTopStyles, aStates, level ); |
|
1330 |
|
1331 DisableStatePropertyL( |
|
1332 aNode, aPseudoClass, &CXnNode::BorderBottomStyleL, |
|
1333 aLayoutPropertyCache->iBorderBottomStyle, |
|
1334 aLayoutPropertyCache->iBorderBottomStyles, aStates, level ); |
|
1335 |
|
1336 DisableStatePropertyL( |
|
1337 aNode, aPseudoClass, &CXnNode::BorderStyleL, |
|
1338 aLayoutPropertyCache->iBorderStyle, |
|
1339 aLayoutPropertyCache->iBorderStyles, aStates, level ); |
|
1340 |
|
1341 DisableStatePropertyL( |
|
1342 aNode, aPseudoClass, &CXnNode::DisplayPriorityL, |
|
1343 aLayoutPropertyCache->iDisplayPriority, |
|
1344 aLayoutPropertyCache->iDisplayPriorities, aStates, level ); |
|
1345 |
|
1346 DisableStatePropertyL( |
|
1347 aNode, aPseudoClass, &CXnNode::NavIndexL, |
|
1348 aLayoutPropertyCache->iNavIndex, |
|
1349 aLayoutPropertyCache->iNavIndexes, aStates, level ); |
|
1350 |
|
1351 DisableStatePropertyL( |
|
1352 aNode, aPseudoClass, &CXnNode::ZIndexL, |
|
1353 aLayoutPropertyCache->iZIndex, |
|
1354 aLayoutPropertyCache->iZIndexes, aStates, level ); |
|
1355 |
|
1356 DisableStatePropertyL( |
|
1357 aNode, aPseudoClass, &CXnNode::BackgroundColorL, |
|
1358 aLayoutPropertyCache->iBackgroundColor, |
|
1359 aLayoutPropertyCache->iBackgroundColors, aStates, level ); |
|
1360 |
|
1361 DisableStatePropertyL( |
|
1362 aNode, aPseudoClass, &CXnNode::BackgroundImageL, |
|
1363 aLayoutPropertyCache->iBackgroundImage, |
|
1364 aLayoutPropertyCache->iBackgroundImages, aStates, level, ETrue ); |
|
1365 |
|
1366 DisableStatePropertyL( |
|
1367 aNode, aPseudoClass, &CXnNode::FocusBackgroundL, |
|
1368 aLayoutPropertyCache->iFocusBackground, |
|
1369 aLayoutPropertyCache->iFocusBackgrounds, aStates, level ); |
|
1370 |
|
1371 aNode.SetDirtyL( level ); |
|
1372 } |
|
1373 |
|
1374 // ----------------------------------------------------------------------------- |
|
1375 // AllocateLayoutCache() |
|
1376 // ----------------------------------------------------------------------------- |
|
1377 // |
|
1378 static TBool AllocateLayoutCache( CLayoutPropertyCache*& aLayoutPropertyCache ) |
|
1379 { |
|
1380 if ( !aLayoutPropertyCache ) |
|
1381 { |
|
1382 aLayoutPropertyCache = new CLayoutPropertyCache; |
|
1383 } |
|
1384 |
|
1385 return aLayoutPropertyCache ? ETrue : EFalse; |
|
1386 } |
|
1387 |
|
1388 // ----------------------------------------------------------------------------- |
|
1389 // DoSetCachedProperty() |
|
1390 // ----------------------------------------------------------------------------- |
|
1391 // |
|
1392 static void DoSetCachedProperty( |
|
1393 CXnProperty* aProperty,\ |
|
1394 CXnProperty*& aCachedPropertyToSet, |
|
1395 RPointerArray< CXnProperty >& aArray, |
|
1396 TBool aInitializing, |
|
1397 TBool aArrayOnly ) |
|
1398 { |
|
1399 ReplaceOrAppend( aProperty, aArray, aInitializing ); |
|
1400 |
|
1401 if ( !aArrayOnly ) |
|
1402 { |
|
1403 aCachedPropertyToSet = aProperty; |
|
1404 } |
|
1405 } |
|
1406 |
|
1407 // ----------------------------------------------------------------------------- |
|
1408 // SetCachedProperty() |
|
1409 // ----------------------------------------------------------------------------- |
|
1410 // |
|
1411 static void SetCachedProperty( |
|
1412 CXnProperty* aProperty, |
|
1413 CLayoutPropertyCache*& aLayoutPropertyCache, |
|
1414 CXnProperty*& aName, |
|
1415 CXnProperty*& aValue, |
|
1416 CXnProperty*& aLabel, |
|
1417 CXnProperty*& aInitialFocus, |
|
1418 CXnProperty*& aClass, |
|
1419 CXnProperty*& aId, |
|
1420 CXnProperty*& aPath, |
|
1421 CXnProperty*& aMaskPath, |
|
1422 TBool aInitializing, |
|
1423 TBool aArrayOnly) |
|
1424 { |
|
1425 const TDesC8& name = aProperty->Property()->Name(); |
|
1426 if ( !AllocateLayoutCache( aLayoutPropertyCache ) ) |
|
1427 { |
|
1428 return; |
|
1429 } |
|
1430 if ( name == XnPropertyNames::common::KId ) |
|
1431 { |
|
1432 aId = aProperty; |
|
1433 } |
|
1434 else if ( name == XnPropertyNames::common::KClass ) |
|
1435 { |
|
1436 aClass = aProperty; |
|
1437 } |
|
1438 else if ( name == XnPropertyNames::style::common::KWidth ) |
|
1439 { |
|
1440 DoSetCachedProperty( |
|
1441 aProperty, |
|
1442 aLayoutPropertyCache->iWidth, |
|
1443 aLayoutPropertyCache->iWidths, |
|
1444 aInitializing, aArrayOnly ); |
|
1445 } |
|
1446 else if ( name == XnPropertyNames::style::common::KHeight ) |
|
1447 { |
|
1448 DoSetCachedProperty( |
|
1449 aProperty, |
|
1450 aLayoutPropertyCache->iHeight, |
|
1451 aLayoutPropertyCache->iHeights, |
|
1452 aInitializing, aArrayOnly ); |
|
1453 } |
|
1454 else if ( name == XnPropertyNames::style::common::KBlockProgression ) |
|
1455 { |
|
1456 DoSetCachedProperty( |
|
1457 aProperty, |
|
1458 aLayoutPropertyCache->iBlockProgression, |
|
1459 aLayoutPropertyCache->iBlockProgressions, |
|
1460 aInitializing, aArrayOnly ); |
|
1461 } |
|
1462 else if ( name == XnPropertyNames::style::common::KDirection ) |
|
1463 { |
|
1464 DoSetCachedProperty( |
|
1465 aProperty, |
|
1466 aLayoutPropertyCache->iDirection, |
|
1467 aLayoutPropertyCache->iDirections, |
|
1468 aInitializing, aArrayOnly ); |
|
1469 } |
|
1470 else if ( name == XnPropertyNames::style::common::KPosition ) |
|
1471 { |
|
1472 DoSetCachedProperty( |
|
1473 aProperty, |
|
1474 aLayoutPropertyCache->iPosition, |
|
1475 aLayoutPropertyCache->iPositions, |
|
1476 aInitializing, aArrayOnly ); |
|
1477 } |
|
1478 else if ( name == XnPropertyNames::style::common::KDisplay ) |
|
1479 { |
|
1480 DoSetCachedProperty( |
|
1481 aProperty, |
|
1482 aLayoutPropertyCache->iDisplay, |
|
1483 aLayoutPropertyCache->iDisplays, |
|
1484 aInitializing, aArrayOnly ); |
|
1485 } |
|
1486 else if ( name == XnPropertyNames::style::common::KVisibility ) |
|
1487 { |
|
1488 DoSetCachedProperty( |
|
1489 aProperty, |
|
1490 aLayoutPropertyCache->iVisibility, |
|
1491 aLayoutPropertyCache->iVisibilities, |
|
1492 aInitializing, aArrayOnly ); |
|
1493 } |
|
1494 else if ( name == XnPropertyNames::action::KName ) |
|
1495 { |
|
1496 aName = aProperty; |
|
1497 } |
|
1498 else if ( name == XnPropertyNames::action::KValue ) |
|
1499 { |
|
1500 aValue = aProperty; |
|
1501 } |
|
1502 else if ( name == XnPropertyNames::menu::KLabel ) |
|
1503 { |
|
1504 aLabel = aProperty; |
|
1505 } |
|
1506 else if ( name == XnPropertyNames::image::KPath ) |
|
1507 { |
|
1508 aPath = aProperty; |
|
1509 } |
|
1510 else if ( name == XnPropertyNames::image::KMaskPath ) |
|
1511 { |
|
1512 aMaskPath = aProperty; |
|
1513 } |
|
1514 else if ( name == XnPropertyNames::style::common::KMarginLeft ) |
|
1515 { |
|
1516 DoSetCachedProperty( |
|
1517 aProperty, |
|
1518 aLayoutPropertyCache->iMarginLeft, |
|
1519 aLayoutPropertyCache->iMarginLefts, |
|
1520 aInitializing, aArrayOnly ); |
|
1521 } |
|
1522 else if ( name == XnPropertyNames::style::common::KMarginRight ) |
|
1523 { |
|
1524 DoSetCachedProperty( |
|
1525 aProperty, |
|
1526 aLayoutPropertyCache->iMarginRight, |
|
1527 aLayoutPropertyCache->iMarginRights, |
|
1528 aInitializing, aArrayOnly ); |
|
1529 } |
|
1530 else if ( name == XnPropertyNames::style::common::KBorderLeftWidth ) |
|
1531 { |
|
1532 DoSetCachedProperty( |
|
1533 aProperty, |
|
1534 aLayoutPropertyCache->iBorderLeft, |
|
1535 aLayoutPropertyCache->iBorderLefts, |
|
1536 aInitializing, aArrayOnly ); |
|
1537 } |
|
1538 else if ( name == XnPropertyNames::style::common::KBorderRightWidth ) |
|
1539 { |
|
1540 DoSetCachedProperty( |
|
1541 aProperty, |
|
1542 aLayoutPropertyCache->iBorderRight, |
|
1543 aLayoutPropertyCache->iBorderRights, |
|
1544 aInitializing, aArrayOnly ); |
|
1545 } |
|
1546 else if ( name == XnPropertyNames::style::common::KPaddingLeft ) |
|
1547 { |
|
1548 DoSetCachedProperty( |
|
1549 aProperty, |
|
1550 aLayoutPropertyCache->iPaddingLeft, |
|
1551 aLayoutPropertyCache->iPaddingLefts, |
|
1552 aInitializing, aArrayOnly ); |
|
1553 } |
|
1554 else if ( name == XnPropertyNames::style::common::KPaddingRight ) |
|
1555 { |
|
1556 DoSetCachedProperty( |
|
1557 aProperty, |
|
1558 aLayoutPropertyCache->iPaddingRight, |
|
1559 aLayoutPropertyCache->iPaddingRights, |
|
1560 aInitializing, aArrayOnly ); |
|
1561 } |
|
1562 else if ( name == XnPropertyNames::style::common::KMarginTop ) |
|
1563 { |
|
1564 DoSetCachedProperty( |
|
1565 aProperty, |
|
1566 aLayoutPropertyCache->iMarginTop, |
|
1567 aLayoutPropertyCache->iMarginTops, |
|
1568 aInitializing, aArrayOnly ); |
|
1569 } |
|
1570 else if ( name == XnPropertyNames::style::common::KMarginBottom ) |
|
1571 { |
|
1572 DoSetCachedProperty( |
|
1573 aProperty, |
|
1574 aLayoutPropertyCache->iMarginBottom, |
|
1575 aLayoutPropertyCache->iMarginBottoms, |
|
1576 aInitializing, aArrayOnly ); |
|
1577 } |
|
1578 else if ( name == XnPropertyNames::style::common::KBorderTopWidth ) |
|
1579 { |
|
1580 DoSetCachedProperty( |
|
1581 aProperty, |
|
1582 aLayoutPropertyCache->iBorderTop, |
|
1583 aLayoutPropertyCache->iBorderTops, |
|
1584 aInitializing, aArrayOnly ); |
|
1585 } |
|
1586 else if ( name == XnPropertyNames::style::common::KBorderBottomWidth ) |
|
1587 { |
|
1588 DoSetCachedProperty( |
|
1589 aProperty, |
|
1590 aLayoutPropertyCache->iBorderBottom, |
|
1591 aLayoutPropertyCache->iBorderBottoms, |
|
1592 aInitializing, aArrayOnly ); |
|
1593 } |
|
1594 else if ( name == XnPropertyNames::style::common::KPaddingTop ) |
|
1595 { |
|
1596 DoSetCachedProperty( |
|
1597 aProperty, |
|
1598 aLayoutPropertyCache->iPaddingTop, |
|
1599 aLayoutPropertyCache->iPaddingTops, |
|
1600 aInitializing, aArrayOnly ); |
|
1601 } |
|
1602 else if ( name == XnPropertyNames::style::common::KPaddingBottom ) |
|
1603 { |
|
1604 DoSetCachedProperty( |
|
1605 aProperty, |
|
1606 aLayoutPropertyCache->iPaddingBottom, |
|
1607 aLayoutPropertyCache->iPaddingBottoms, |
|
1608 aInitializing, aArrayOnly ); |
|
1609 } |
|
1610 else if ( name == XnPropertyNames::style::common::KBorderWidth ) |
|
1611 { |
|
1612 DoSetCachedProperty( |
|
1613 aProperty, |
|
1614 aLayoutPropertyCache->iBorderWidth, |
|
1615 aLayoutPropertyCache->iBorderWidths, |
|
1616 aInitializing, aArrayOnly ); |
|
1617 } |
|
1618 else if ( name == XnPropertyNames::style::common::KMaxHeight ) |
|
1619 { |
|
1620 DoSetCachedProperty( |
|
1621 aProperty, |
|
1622 aLayoutPropertyCache->iMaxHeight, |
|
1623 aLayoutPropertyCache->iMaxHeights, |
|
1624 aInitializing, aArrayOnly ); |
|
1625 } |
|
1626 else if ( name == XnPropertyNames::style::common::KMinHeight ) |
|
1627 { |
|
1628 DoSetCachedProperty( |
|
1629 aProperty, |
|
1630 aLayoutPropertyCache->iMinHeight, |
|
1631 aLayoutPropertyCache->iMinHeights, |
|
1632 aInitializing, aArrayOnly ); |
|
1633 } |
|
1634 else if ( name == XnPropertyNames::style::common::KMaxWidth ) |
|
1635 { |
|
1636 DoSetCachedProperty( |
|
1637 aProperty, |
|
1638 aLayoutPropertyCache->iMaxWidth, |
|
1639 aLayoutPropertyCache->iMaxWidths, |
|
1640 aInitializing, aArrayOnly ); |
|
1641 } |
|
1642 else if ( name == XnPropertyNames::style::common::KMinWidth ) |
|
1643 { |
|
1644 DoSetCachedProperty( |
|
1645 aProperty, |
|
1646 aLayoutPropertyCache->iMinWidth, |
|
1647 aLayoutPropertyCache->iMinWidths, |
|
1648 aInitializing, aArrayOnly ); |
|
1649 } |
|
1650 else if ( name == XnPropertyNames::style::common::KLeft ) |
|
1651 { |
|
1652 DoSetCachedProperty( |
|
1653 aProperty, |
|
1654 aLayoutPropertyCache->iLeft, |
|
1655 aLayoutPropertyCache->iLefts, |
|
1656 aInitializing, aArrayOnly ); |
|
1657 } |
|
1658 else if ( name == XnPropertyNames::style::common::KRight ) |
|
1659 { |
|
1660 DoSetCachedProperty( |
|
1661 aProperty, |
|
1662 aLayoutPropertyCache->iRight, |
|
1663 aLayoutPropertyCache->iRights, |
|
1664 aInitializing, aArrayOnly ); |
|
1665 } |
|
1666 else if ( name == XnPropertyNames::style::common::KTop ) |
|
1667 { |
|
1668 DoSetCachedProperty( |
|
1669 aProperty, |
|
1670 aLayoutPropertyCache->iTop, |
|
1671 aLayoutPropertyCache->iTops, |
|
1672 aInitializing, aArrayOnly ); |
|
1673 } |
|
1674 else if ( name == XnPropertyNames::style::common::KBottom ) |
|
1675 { |
|
1676 DoSetCachedProperty( |
|
1677 aProperty, |
|
1678 aLayoutPropertyCache->iBottom, |
|
1679 aLayoutPropertyCache->iBottoms, |
|
1680 aInitializing, aArrayOnly ); |
|
1681 } |
|
1682 else if ( name == XnPropertyNames::appearance::common::KBorderLeftStyle ) |
|
1683 { |
|
1684 DoSetCachedProperty( |
|
1685 aProperty, |
|
1686 aLayoutPropertyCache->iBorderLeftStyle, |
|
1687 aLayoutPropertyCache->iBorderLeftStyles, |
|
1688 aInitializing, aArrayOnly ); |
|
1689 } |
|
1690 else if ( name == XnPropertyNames::appearance::common::KBorderRightStyle ) |
|
1691 { |
|
1692 DoSetCachedProperty( |
|
1693 aProperty, |
|
1694 aLayoutPropertyCache->iBorderRightStyle, |
|
1695 aLayoutPropertyCache->iBorderRightStyles, |
|
1696 aInitializing, aArrayOnly ); |
|
1697 } |
|
1698 else if ( name == XnPropertyNames::appearance::common::KBorderTopStyle ) |
|
1699 { |
|
1700 DoSetCachedProperty( |
|
1701 aProperty, |
|
1702 aLayoutPropertyCache->iBorderTopStyle, |
|
1703 aLayoutPropertyCache->iBorderTopStyles, |
|
1704 aInitializing, aArrayOnly ); |
|
1705 } |
|
1706 else if ( name == XnPropertyNames::appearance::common::KBorderBottomStyle ) |
|
1707 { |
|
1708 DoSetCachedProperty( |
|
1709 aProperty, |
|
1710 aLayoutPropertyCache->iBorderBottomStyle, |
|
1711 aLayoutPropertyCache->iBorderBottomStyles, |
|
1712 aInitializing, aArrayOnly ); |
|
1713 } |
|
1714 else if ( name == XnPropertyNames::appearance::common::KBorderStyle ) |
|
1715 { |
|
1716 DoSetCachedProperty( |
|
1717 aProperty, |
|
1718 aLayoutPropertyCache->iBorderStyle, |
|
1719 aLayoutPropertyCache->iBorderStyles, |
|
1720 aInitializing, aArrayOnly ); |
|
1721 } |
|
1722 else if ( name == XnPropertyNames::appearance::common::KBorderImage ) |
|
1723 { |
|
1724 aLayoutPropertyCache->iBorderImage = aProperty; |
|
1725 } |
|
1726 else if ( name == XnPropertyNames::style::common::KZIndex ) |
|
1727 { |
|
1728 DoSetCachedProperty( |
|
1729 aProperty, |
|
1730 aLayoutPropertyCache->iZIndex, |
|
1731 aLayoutPropertyCache->iZIndexes, |
|
1732 aInitializing, aArrayOnly ); |
|
1733 } |
|
1734 else if ( name == XnPropertyNames::appearance::common::KBackGroundColor ) |
|
1735 { |
|
1736 DoSetCachedProperty( |
|
1737 aProperty, |
|
1738 aLayoutPropertyCache->iBackgroundColor, |
|
1739 aLayoutPropertyCache->iBackgroundColors, |
|
1740 aInitializing, aArrayOnly ); |
|
1741 } |
|
1742 else if ( name == XnPropertyNames::appearance::common::KBackGroundImage ) |
|
1743 { |
|
1744 DoSetCachedProperty( |
|
1745 aProperty, |
|
1746 aLayoutPropertyCache->iBackgroundImage, |
|
1747 aLayoutPropertyCache->iBackgroundImages, |
|
1748 aInitializing, aArrayOnly ); |
|
1749 } |
|
1750 else if ( name == XnPropertyNames::appearance::common::KFocusBackground ) |
|
1751 { |
|
1752 DoSetCachedProperty( |
|
1753 aProperty, |
|
1754 aLayoutPropertyCache->iFocusBackground, |
|
1755 aLayoutPropertyCache->iFocusBackgrounds, |
|
1756 aInitializing, aArrayOnly ); |
|
1757 } |
|
1758 else if ( name == XnPropertyNames::style::common::KS60DisplayPriority ) |
|
1759 { |
|
1760 DoSetCachedProperty( |
|
1761 aProperty, |
|
1762 aLayoutPropertyCache->iDisplayPriority, |
|
1763 aLayoutPropertyCache->iDisplayPriorities, |
|
1764 aInitializing, aArrayOnly ); |
|
1765 } |
|
1766 else if ( name == XnPropertyNames::common::KInitialFocus ) |
|
1767 { |
|
1768 aInitialFocus = aProperty; |
|
1769 } |
|
1770 else if ( name == XnPropertyNames::style::common::KNavIndex ) |
|
1771 { |
|
1772 DoSetCachedProperty( |
|
1773 aProperty, |
|
1774 aLayoutPropertyCache->iNavIndex, |
|
1775 aLayoutPropertyCache->iNavIndexes, |
|
1776 aInitializing, aArrayOnly ); |
|
1777 } |
|
1778 } |
|
1779 |
|
1780 // ----------------------------------------------------------------------------- |
|
1781 // ReplaceOrAppend() |
|
1782 // ----------------------------------------------------------------------------- |
|
1783 // |
|
1784 static void ReplaceOrAppend( |
|
1785 CXnProperty* aProperty, |
|
1786 RPointerArray< CXnProperty >& aArray, |
|
1787 TBool aAppendOnly ) |
|
1788 { |
|
1789 if ( !aAppendOnly ) |
|
1790 { |
|
1791 for ( TInt i = aArray.Count() - 1; i >= 0; --i ) |
|
1792 { |
|
1793 if ( aArray[i] == aProperty ) |
|
1794 { |
|
1795 aArray.Remove( i ); |
|
1796 } |
|
1797 else if ( aArray[i]->Property()->PseudoClass() == |
|
1798 aProperty->Property()->PseudoClass() && |
|
1799 aArray[i]->Property()->Name() == |
|
1800 aProperty->Property()->Name() ) |
|
1801 { |
|
1802 aArray.Remove( i ); |
|
1803 } |
|
1804 } |
|
1805 } |
|
1806 aArray.Append( aProperty ); |
|
1807 } |
|
1808 |
|
1809 // ----------------------------------------------------------------------------- |
|
1810 // IsPropertyPseudoClass() |
|
1811 // ----------------------------------------------------------------------------- |
|
1812 // |
|
1813 static TBool IsPropertyPseudoClass( |
|
1814 CXnDomProperty::TPseudoClass aPseudoClass, |
|
1815 RArray< CXnDomProperty::TPseudoClass >& aArray ) |
|
1816 { |
|
1817 for ( TInt i = aArray.Count() - 1; i >= 0; --i ) |
|
1818 { |
|
1819 if ( aArray[i] == aPseudoClass ) |
|
1820 { |
|
1821 return ETrue; |
|
1822 } |
|
1823 } |
|
1824 return EFalse; |
|
1825 } |
|
1826 |
|
1827 // ----------------------------------------------------------------------------- |
|
1828 // InsertPropertyPseudoClassL() |
|
1829 // ----------------------------------------------------------------------------- |
|
1830 // |
|
1831 static void InsertPropertyPseudoClassL( |
|
1832 CXnDomProperty::TPseudoClass aPseudoClass, |
|
1833 RArray< CXnDomProperty::TPseudoClass >& aArray ) |
|
1834 { |
|
1835 if ( !IsPropertyPseudoClass( aPseudoClass, aArray ) ) |
|
1836 { |
|
1837 User::LeaveIfError( aArray.Append( aPseudoClass ) ); |
|
1838 } |
|
1839 } |
|
1840 |
|
1841 // ----------------------------------------------------------------------------- |
|
1842 // BuildEventTypeNodeL |
|
1843 // ----------------------------------------------------------------------------- |
|
1844 // |
|
1845 static CXnNode* BuildEventTypeNodeL( TEventCode aType, CXnUiEngine& aUiEngine ) |
|
1846 { |
|
1847 CXnNode* node = CXnNode::NewL(); |
|
1848 CleanupStack::PushL( node ); |
|
1849 CXnType* type = CXnType::NewL( XnPropertyNames::action::KProperty ); |
|
1850 CleanupStack::PushL( type ); |
|
1851 CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
1852 CleanupStack::Pop( type ); |
|
1853 node->SetImpl( impl ); |
|
1854 node->SetUiEngine( aUiEngine ); |
|
1855 CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
1856 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1857 CleanupStack::PushL( nameValue ); |
|
1858 nameValue->SetStringValueL( |
|
1859 CXnDomPropertyValue::EString, |
|
1860 XnPropertyNames::action::trigger::name::keyevent::KEventType ); |
|
1861 CXnProperty* name = CXnProperty::NewL( |
|
1862 XnPropertyNames::action::KName, |
|
1863 nameValue, *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1864 CleanupStack::Pop( nameValue ); |
|
1865 CleanupStack::PushL( name ); |
|
1866 node->SetPropertyL( name ); |
|
1867 CleanupStack::Pop( name ); |
|
1868 CXnDomPropertyValue* valueValue = CXnDomPropertyValue::NewL( |
|
1869 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1870 CleanupStack::PushL( valueValue ); |
|
1871 valueValue->SetFloatValueL( CXnDomPropertyValue::ENumber, aType ); |
|
1872 CXnProperty* value = CXnProperty::NewL( |
|
1873 XnPropertyNames::action::KValue, valueValue, |
|
1874 *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1875 CleanupStack::Pop( valueValue ); |
|
1876 CleanupStack::PushL( value ); |
|
1877 node->SetPropertyL( value ); |
|
1878 CleanupStack::Pop( value ); |
|
1879 CleanupStack::Pop( node ); |
|
1880 return node; |
|
1881 } |
|
1882 |
|
1883 // ----------------------------------------------------------------------------- |
|
1884 // BuildModifiersNodeL |
|
1885 // ----------------------------------------------------------------------------- |
|
1886 // |
|
1887 static CXnNode* BuildModifiersNodeL( |
|
1888 const TKeyEvent& aKeyEvent, |
|
1889 CXnUiEngine& aUiEngine ) |
|
1890 { |
|
1891 CXnNode* node = CXnNode::NewL(); |
|
1892 CleanupStack::PushL( node ); |
|
1893 CXnType* type = CXnType::NewL( XnPropertyNames::action::KProperty ); |
|
1894 CleanupStack::PushL( type ); |
|
1895 CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
1896 CleanupStack::Pop( type ); |
|
1897 node->SetImpl( impl ); |
|
1898 node->SetUiEngine( aUiEngine ); |
|
1899 CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
1900 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1901 CleanupStack::PushL( nameValue ); |
|
1902 nameValue->SetStringValueL( |
|
1903 CXnDomPropertyValue::EString, |
|
1904 XnPropertyNames::action::trigger::name::keyevent::KModifiers ); |
|
1905 CXnProperty* name = CXnProperty::NewL( |
|
1906 XnPropertyNames::action::KName, |
|
1907 nameValue, |
|
1908 *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1909 CleanupStack::Pop( nameValue ); |
|
1910 CleanupStack::PushL( name ); |
|
1911 node->SetPropertyL( name ); |
|
1912 CleanupStack::Pop( name ); |
|
1913 CXnDomPropertyValue* valueValue = CXnDomPropertyValue::NewL( |
|
1914 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1915 CleanupStack::PushL( valueValue ); |
|
1916 valueValue->SetFloatValueL( |
|
1917 CXnDomPropertyValue::ENumber, aKeyEvent.iModifiers ); |
|
1918 CXnProperty* value = CXnProperty::NewL( |
|
1919 XnPropertyNames::action::KValue, |
|
1920 valueValue, |
|
1921 *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1922 CleanupStack::Pop( valueValue ); |
|
1923 CleanupStack::PushL( value ); |
|
1924 node->SetPropertyL( value ); |
|
1925 CleanupStack::Pop( value ); |
|
1926 CleanupStack::Pop( node ); |
|
1927 return node; |
|
1928 } |
|
1929 |
|
1930 // ----------------------------------------------------------------------------- |
|
1931 // BuildKeyCodeNodeL |
|
1932 // ----------------------------------------------------------------------------- |
|
1933 // |
|
1934 static CXnNode* BuildKeyCodeNodeL( |
|
1935 const TKeyEvent& aKeyEvent, |
|
1936 CXnUiEngine& aUiEngine ) |
|
1937 { |
|
1938 CXnNode* node = CXnNode::NewL(); |
|
1939 CleanupStack::PushL( node ); |
|
1940 CXnType* type = CXnType::NewL( XnPropertyNames::action::KProperty ); |
|
1941 CleanupStack::PushL( type ); |
|
1942 CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
1943 CleanupStack::Pop( type ); |
|
1944 node->SetImpl( impl ); |
|
1945 node->SetUiEngine( aUiEngine ); |
|
1946 CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
1947 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1948 CleanupStack::PushL( nameValue ); |
|
1949 nameValue->SetStringValueL( |
|
1950 CXnDomPropertyValue::EString, |
|
1951 XnPropertyNames::action::trigger::name::keyevent::KKeyCode ); |
|
1952 CXnProperty* name = CXnProperty::NewL( |
|
1953 XnPropertyNames::action::KName, |
|
1954 nameValue, |
|
1955 *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1956 CleanupStack::Pop( nameValue ); |
|
1957 CleanupStack::PushL( name ); |
|
1958 node->SetPropertyL( name ); |
|
1959 CleanupStack::Pop( name ); |
|
1960 CXnDomPropertyValue* valueValue = CXnDomPropertyValue::NewL( |
|
1961 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1962 CleanupStack::PushL( valueValue ); |
|
1963 valueValue->SetFloatValueL( CXnDomPropertyValue::ENumber, aKeyEvent.iCode ); |
|
1964 CXnProperty* value = CXnProperty::NewL( |
|
1965 XnPropertyNames::action::KValue, |
|
1966 valueValue, |
|
1967 *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1968 CleanupStack::Pop( valueValue ); |
|
1969 CleanupStack::PushL( value ); |
|
1970 node->SetPropertyL( value ); |
|
1971 CleanupStack::Pop( value ); |
|
1972 CleanupStack::Pop( node ); |
|
1973 return node; |
|
1974 } |
|
1975 |
|
1976 // ----------------------------------------------------------------------------- |
|
1977 // BuildScanCodeNodeL |
|
1978 // ----------------------------------------------------------------------------- |
|
1979 // |
|
1980 static CXnNode* BuildScanCodeNodeL( |
|
1981 const TKeyEvent& aKeyEvent, |
|
1982 CXnUiEngine& aUiEngine ) |
|
1983 { |
|
1984 CXnNode* node = CXnNode::NewL(); |
|
1985 CleanupStack::PushL( node ); |
|
1986 CXnType* type = CXnType::NewL( XnPropertyNames::action::KProperty ); |
|
1987 CleanupStack::PushL( type ); |
|
1988 CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
1989 CleanupStack::Pop( type ); |
|
1990 node->SetImpl( impl ); |
|
1991 node->SetUiEngine( aUiEngine ); |
|
1992 CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
1993 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
1994 CleanupStack::PushL( nameValue ); |
|
1995 nameValue->SetStringValueL( |
|
1996 CXnDomPropertyValue::EString, |
|
1997 XnPropertyNames::action::trigger::name::keyevent::KScanCode ); |
|
1998 CXnProperty* name = CXnProperty::NewL( |
|
1999 XnPropertyNames::action::KName, |
|
2000 nameValue, |
|
2001 *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2002 CleanupStack::Pop( nameValue ); |
|
2003 CleanupStack::PushL( name ); |
|
2004 node->SetPropertyL( name ); |
|
2005 CleanupStack::Pop( name ); |
|
2006 CXnDomPropertyValue* valueValue = CXnDomPropertyValue::NewL( |
|
2007 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2008 CleanupStack::PushL( valueValue ); |
|
2009 valueValue->SetFloatValueL( |
|
2010 CXnDomPropertyValue::ENumber, aKeyEvent.iScanCode ); |
|
2011 CXnProperty* value = CXnProperty::NewL( |
|
2012 XnPropertyNames::action::KValue, |
|
2013 valueValue, |
|
2014 *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2015 CleanupStack::Pop( valueValue ); |
|
2016 CleanupStack::PushL( value ); |
|
2017 node->SetPropertyL( value ); |
|
2018 CleanupStack::Pop( value ); |
|
2019 CleanupStack::Pop( node ); |
|
2020 return node; |
|
2021 } |
|
2022 |
|
2023 // ----------------------------------------------------------------------------- |
|
2024 // BuildRepeatsNodeL |
|
2025 // ----------------------------------------------------------------------------- |
|
2026 // |
|
2027 static CXnNode* BuildRepeatsNodeL( |
|
2028 const TKeyEvent& aKeyEvent, |
|
2029 CXnUiEngine& aUiEngine ) |
|
2030 { |
|
2031 CXnNode* node = CXnNode::NewL(); |
|
2032 CleanupStack::PushL( node ); |
|
2033 CXnType* type = CXnType::NewL( XnPropertyNames::action::KProperty ); |
|
2034 CleanupStack::PushL( type ); |
|
2035 CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
2036 CleanupStack::Pop( type ); |
|
2037 node->SetImpl( impl ); |
|
2038 node->SetUiEngine( aUiEngine ); |
|
2039 CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
2040 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2041 CleanupStack::PushL( nameValue ); |
|
2042 nameValue->SetStringValueL( |
|
2043 CXnDomPropertyValue::EString, |
|
2044 XnPropertyNames::action::trigger::name::keyevent::KRepeats ); |
|
2045 CXnProperty* name = CXnProperty::NewL( |
|
2046 XnPropertyNames::action::KName, |
|
2047 nameValue, |
|
2048 *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2049 CleanupStack::Pop( nameValue ); |
|
2050 CleanupStack::PushL( name ); |
|
2051 node->SetPropertyL( name ); |
|
2052 CleanupStack::Pop( name ); |
|
2053 CXnDomPropertyValue* valueValue = CXnDomPropertyValue::NewL( |
|
2054 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2055 CleanupStack::PushL( valueValue ); |
|
2056 valueValue->SetFloatValueL( |
|
2057 CXnDomPropertyValue::ENumber, aKeyEvent.iRepeats ); |
|
2058 CXnProperty* value = CXnProperty::NewL( |
|
2059 XnPropertyNames::action::KValue, |
|
2060 valueValue, |
|
2061 *aUiEngine.ODT()->DomDocument().StringPool()) ; |
|
2062 CleanupStack::Pop( valueValue ); |
|
2063 CleanupStack::PushL( value ); |
|
2064 node->SetPropertyL( value ); |
|
2065 CleanupStack::Pop( value ); |
|
2066 CleanupStack::Pop( node ); |
|
2067 return node; |
|
2068 } |
|
2069 |
|
2070 // ----------------------------------------------------------------------------- |
|
2071 // BuildPropertyNodesL |
|
2072 // ----------------------------------------------------------------------------- |
|
2073 // |
|
2074 static void BuildPropertyNodesL( |
|
2075 CXnNode& aNode, |
|
2076 const TKeyEvent& aKeyEvent, |
|
2077 TEventCode aType, |
|
2078 CXnUiEngine& aUiEngine ) |
|
2079 { |
|
2080 CXnNode* eventType = BuildEventTypeNodeL( aType, aUiEngine ); |
|
2081 CleanupStack::PushL( eventType ); |
|
2082 aNode.AddChildL( eventType ); |
|
2083 CleanupStack::Pop( eventType ); |
|
2084 CXnNode* modifiers = BuildModifiersNodeL( aKeyEvent, aUiEngine ); |
|
2085 CleanupStack::PushL( modifiers ); |
|
2086 aNode.AddChildL( modifiers ); |
|
2087 CleanupStack::Pop( modifiers ); |
|
2088 CXnNode* keyCode = BuildKeyCodeNodeL( aKeyEvent, aUiEngine ); |
|
2089 CleanupStack::PushL( keyCode ); |
|
2090 aNode.AddChildL( keyCode ); |
|
2091 CleanupStack::Pop( keyCode ); |
|
2092 CXnNode* scanCode = BuildScanCodeNodeL( aKeyEvent, aUiEngine ); |
|
2093 CleanupStack::PushL( scanCode ); |
|
2094 aNode.AddChildL( scanCode ); |
|
2095 CleanupStack::Pop( scanCode ); |
|
2096 CXnNode* repeats = BuildRepeatsNodeL( aKeyEvent, aUiEngine ); |
|
2097 CleanupStack::PushL( repeats ); |
|
2098 aNode.AddChildL( repeats ); |
|
2099 CleanupStack::Pop( repeats ); |
|
2100 } |
|
2101 |
|
2102 // ----------------------------------------------------------------------------- |
|
2103 // BuildKeyTriggerNodeL |
|
2104 // ----------------------------------------------------------------------------- |
|
2105 // |
|
2106 static CXnNode* BuildKeyTriggerNodeL( |
|
2107 const TKeyEvent& aKeyEvent, |
|
2108 TEventCode aType, |
|
2109 CXnUiEngine& aUiEngine ) |
|
2110 { |
|
2111 CXnNode* node = CXnNode::NewL(); |
|
2112 CleanupStack::PushL( node ); |
|
2113 CXnType* type = CXnType::NewL( XnPropertyNames::action::KTrigger ); |
|
2114 CleanupStack::PushL( type ); |
|
2115 CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
2116 CleanupStack::Pop( type ); |
|
2117 node->SetImpl( impl ); |
|
2118 node->SetUiEngine( aUiEngine ); |
|
2119 CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL( |
|
2120 aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2121 CleanupStack::PushL( nameValue ); |
|
2122 nameValue->SetStringValueL( |
|
2123 CXnDomPropertyValue::EString, |
|
2124 XnPropertyNames::action::trigger::name::KKeyEvent ); |
|
2125 CXnProperty* name = CXnProperty::NewL( |
|
2126 XnPropertyNames::action::trigger::KName, |
|
2127 nameValue, |
|
2128 *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
2129 CleanupStack::Pop( nameValue ); |
|
2130 CleanupStack::PushL( name ); |
|
2131 node->SetPropertyL( name ); |
|
2132 CleanupStack::Pop( name ); |
|
2133 BuildPropertyNodesL( *node, aKeyEvent, aType, aUiEngine ); |
|
2134 CleanupStack::Pop( node ); |
|
2135 return node; |
|
2136 } |
|
2137 |
|
2138 // ----------------------------------------------------------------------------- |
|
2139 // PseudoClassFromName |
|
2140 // ----------------------------------------------------------------------------- |
|
2141 // |
|
2142 static CXnDomProperty::TPseudoClass PseudoClassFromName( const TDesC8& aName ) |
|
2143 { |
|
2144 if ( aName == KPseudoClassFocus ) |
|
2145 { |
|
2146 return CXnDomProperty::EFocus; |
|
2147 } |
|
2148 else if ( aName == KPseudoClassPassiveFocus ) |
|
2149 { |
|
2150 return CXnDomProperty::EPassiveFocus; |
|
2151 } |
|
2152 else if ( aName == KPseudoClassHold ) |
|
2153 { |
|
2154 return CXnDomProperty::EHold; |
|
2155 } |
|
2156 else if ( aName == KPseudoClassHover ) |
|
2157 { |
|
2158 return CXnDomProperty::EHover; |
|
2159 } |
|
2160 else if ( aName == KPseudoClassLink ) |
|
2161 { |
|
2162 return CXnDomProperty::ELink; |
|
2163 } |
|
2164 else if ( aName == KPseudoClassVisited ) |
|
2165 { |
|
2166 return CXnDomProperty::EVisited; |
|
2167 } |
|
2168 else if ( aName == KPseudoClassActive ) |
|
2169 { |
|
2170 return CXnDomProperty::EActive; |
|
2171 } |
|
2172 else if ( aName == KPseudoClassEdit ) |
|
2173 { |
|
2174 return CXnDomProperty::EEdit; |
|
2175 } |
|
2176 else if ( aName == KPseudoClassPressedDown ) |
|
2177 { |
|
2178 return CXnDomProperty::EPressedDown; |
|
2179 } |
|
2180 return CXnDomProperty::ENone; |
|
2181 } |
|
2182 |
|
2183 // ----------------------------------------------------------------------------- |
|
2184 // PseudoClassName |
|
2185 // ----------------------------------------------------------------------------- |
|
2186 // |
|
2187 static const TDesC8& PseudoClassName( CXnDomProperty::TPseudoClass aPseudoClass ) |
|
2188 { |
|
2189 switch ( aPseudoClass ) |
|
2190 { |
|
2191 case CXnDomProperty::EFocus: |
|
2192 return KPseudoClassFocus; |
|
2193 case CXnDomProperty::EPassiveFocus: |
|
2194 return KPseudoClassPassiveFocus; |
|
2195 case CXnDomProperty::EHold: |
|
2196 return KPseudoClassHold; |
|
2197 case CXnDomProperty::EHover: |
|
2198 return KPseudoClassHover; |
|
2199 case CXnDomProperty::ELink: |
|
2200 return KPseudoClassLink; |
|
2201 case CXnDomProperty::EVisited: |
|
2202 return KPseudoClassVisited; |
|
2203 case CXnDomProperty::EActive: |
|
2204 return KPseudoClassActive; |
|
2205 case CXnDomProperty::EEdit: |
|
2206 return KPseudoClassEdit; |
|
2207 default: |
|
2208 return KNullDesC8; |
|
2209 } |
|
2210 } |
|
2211 |
|
2212 // ----------------------------------------------------------------------------- |
|
2213 // DoMatchTriggerForKeyEventL |
|
2214 // ----------------------------------------------------------------------------- |
|
2215 // |
|
2216 static TBool DoMatchTriggerForKeyEventL( |
|
2217 const TKeyEvent& aKeyEvent, TEventCode aType, |
|
2218 CXnDomNode& aTriggerNode ) |
|
2219 { |
|
2220 TInt triggerEventType = EEventKeyDown; |
|
2221 TInt triggerKeyCode = 0; |
|
2222 TInt triggerScanCode = 0; |
|
2223 TInt triggerModifiers = 0; |
|
2224 CXnDomList& triggerChildren = aTriggerNode.ChildNodes(); |
|
2225 TInt triggerCount = triggerChildren.Length(); |
|
2226 TBool triggerScanCodeSet = EFalse; |
|
2227 TBool triggerKeyCodeSet = EFalse; |
|
2228 for ( TInt i = 0; i < triggerCount; ++i ) |
|
2229 { |
|
2230 CXnDomNode* node = static_cast< CXnDomNode* >( |
|
2231 triggerChildren.Item( i ) ); |
|
2232 CXnDomList& attrs = node->AttributeList(); |
|
2233 CXnDomAttribute* nameAttribute = static_cast< CXnDomAttribute* >( |
|
2234 attrs.FindByName( XnPropertyNames::action::KName ) ); |
|
2235 CXnDomAttribute* valueAttribute = static_cast< CXnDomAttribute* >( |
|
2236 attrs.FindByName( XnPropertyNames::action::KValue ) ); |
|
2237 if ( !nameAttribute || !valueAttribute ) |
|
2238 { |
|
2239 continue; |
|
2240 } |
|
2241 if ( nameAttribute->Value() == |
|
2242 XnPropertyNames::action::trigger::name::keyevent::KEventType ) |
|
2243 { |
|
2244 TLex8 lex( valueAttribute->Value() ); |
|
2245 lex.Val( triggerEventType ); |
|
2246 } |
|
2247 else if ( nameAttribute->Value() == |
|
2248 XnPropertyNames::action::trigger::name::keyevent::KModifiers ) |
|
2249 { |
|
2250 TLex8 lex( valueAttribute->Value() ); |
|
2251 lex.Val( triggerModifiers ); |
|
2252 } |
|
2253 else if ( nameAttribute->Value() == |
|
2254 XnPropertyNames::action::trigger::name::keyevent::KKeyCode ) |
|
2255 { |
|
2256 TLex8 lex( valueAttribute->Value() ); |
|
2257 lex.Val( triggerKeyCode ); |
|
2258 triggerKeyCodeSet = ETrue; |
|
2259 } |
|
2260 else if ( nameAttribute->Value() == |
|
2261 XnPropertyNames::action::trigger::name::keyevent::KScanCode ) |
|
2262 { |
|
2263 TLex8 lex( valueAttribute->Value() ); |
|
2264 lex.Val( triggerScanCode ); |
|
2265 triggerScanCodeSet = ETrue; |
|
2266 } |
|
2267 } |
|
2268 return |
|
2269 aType == triggerEventType && |
|
2270 ( triggerKeyCodeSet ? ( aKeyEvent.iCode == triggerKeyCode ) : ETrue ) && |
|
2271 ( triggerScanCodeSet ? ( aKeyEvent.iScanCode == triggerScanCode ) : ETrue ) && |
|
2272 ( ( aKeyEvent.iModifiers & 0xFFFFFFFE ) == ( triggerModifiers & 0xFFFFFFFE ) ); |
|
2273 } |
|
2274 |
|
2275 // ----------------------------------------------------------------------------- |
|
2276 // MatchTriggerForKeyEventL |
|
2277 // ----------------------------------------------------------------------------- |
|
2278 // |
|
2279 static TBool MatchTriggerForKeyEventL( |
|
2280 CXnNodeImpl* aThis, |
|
2281 CXnUiEngine& aEngine, |
|
2282 CXnNode& aNode, |
|
2283 const TKeyEvent& aKeyEvent, |
|
2284 TEventCode aType, |
|
2285 CXnDomNode& aActionNode, |
|
2286 CXnDomNode& aTriggerNode ) |
|
2287 { |
|
2288 CXnDomList& attrs = aTriggerNode.AttributeList(); |
|
2289 CXnDomAttribute* attribute = static_cast< CXnDomAttribute* >( |
|
2290 attrs.FindByName(XnPropertyNames::action::trigger::KName ) ); |
|
2291 if ( !attribute ) |
|
2292 { |
|
2293 return EFalse; |
|
2294 } |
|
2295 |
|
2296 const TDesC8& nameString = attribute->Value(); |
|
2297 if ( nameString == KNullDesC8 ) |
|
2298 { |
|
2299 return EFalse; |
|
2300 } |
|
2301 if ( nameString == XnPropertyNames::action::trigger::name::KKeyEvent ) |
|
2302 { |
|
2303 TBool match = DoMatchTriggerForKeyEventL( aKeyEvent, aType, aTriggerNode ); |
|
2304 if ( match ) |
|
2305 { |
|
2306 CXnNode* eventNode = BuildKeyTriggerNodeL( aKeyEvent, aType, aEngine ); |
|
2307 CleanupStack::PushL( eventNode ); |
|
2308 RunEventsL( aThis, aEngine, aNode, aActionNode, aTriggerNode, *eventNode ); |
|
2309 CleanupStack::PopAndDestroy( eventNode ); |
|
2310 } |
|
2311 return match; |
|
2312 } |
|
2313 else if ( aType == EEventKey && |
|
2314 ( nameString == XnPropertyNames::action::trigger::name::KUp || |
|
2315 nameString == XnPropertyNames::action::trigger::name::KDown || |
|
2316 nameString == XnPropertyNames::action::trigger::name::KLeft || |
|
2317 nameString == XnPropertyNames::action::trigger::name::KRight ) ) |
|
2318 { |
|
2319 TBool match = DoMatchTriggerForHighLevelKeyEventL( |
|
2320 aNode, aKeyEvent, aType, nameString ); |
|
2321 if ( match ) |
|
2322 { |
|
2323 CXnNode* eventNode = BuildKeyTriggerNodeL( aKeyEvent, aType, aEngine ); |
|
2324 CleanupStack::PushL( eventNode ); |
|
2325 RunEventsL( aThis, aEngine, aNode, aActionNode, aTriggerNode, *eventNode ); |
|
2326 CleanupStack::PopAndDestroy( eventNode ); |
|
2327 } |
|
2328 return match; |
|
2329 } |
|
2330 else if ( aKeyEvent.iScanCode == EStdKeyDevice3 && |
|
2331 aKeyEvent.iRepeats > 0 && |
|
2332 nameString == XnPropertyNames::action::trigger::name::KHold ) |
|
2333 { |
|
2334 CXnNode* eventNode = BuildKeyTriggerNodeL( aKeyEvent, aType, aEngine ); |
|
2335 CleanupStack::PushL( eventNode ); |
|
2336 RunEventsL( aThis, aEngine, aNode, aActionNode, aTriggerNode, *eventNode ); |
|
2337 CleanupStack::PopAndDestroy( eventNode ); |
|
2338 return ETrue; |
|
2339 } |
|
2340 else if ( ( ( aKeyEvent.iScanCode == EStdKeyDevice0 ) || |
|
2341 ( aKeyEvent.iScanCode == EStdKeyDevice1 ) ) && |
|
2342 aKeyEvent.iRepeats > 0 && |
|
2343 nameString == XnPropertyNames::action::trigger::name::KHold ) |
|
2344 { |
|
2345 CXnNode* eventNode = BuildKeyTriggerNodeL( aKeyEvent, aType, aEngine ); |
|
2346 CleanupStack::PushL( eventNode ); |
|
2347 RunEventsL( aThis, aEngine, aNode, aActionNode, aTriggerNode, *eventNode ); |
|
2348 CleanupStack::PopAndDestroy( eventNode ); |
|
2349 return ETrue; |
|
2350 } |
|
2351 return EFalse; |
|
2352 } |
|
2353 |
|
2354 // ----------------------------------------------------------------------------- |
|
2355 // MatchActivateTriggerPropertiesL |
|
2356 // Checks if triggered node properties match |
|
2357 // ones defined in theme |
|
2358 // ----------------------------------------------------------------------------- |
|
2359 // |
|
2360 static TBool MatchActivateTriggerPropertiesL( |
|
2361 CXnNode& aEventData, |
|
2362 CXnDomNode& aTriggerNode ) |
|
2363 { |
|
2364 RPointerArray< CXnNode >& eventChildren = aEventData.Children(); |
|
2365 TInt eventCount = eventChildren.Count(); |
|
2366 |
|
2367 if ( eventCount ) |
|
2368 { |
|
2369 CXnNode* node = eventChildren[0]; |
|
2370 CXnProperty* nameProperty = node->NameL(); |
|
2371 CXnProperty* valueProperty = node->ValueL(); |
|
2372 |
|
2373 if ( !nameProperty || !valueProperty ) |
|
2374 { |
|
2375 return EFalse; |
|
2376 } |
|
2377 |
|
2378 const TDesC8& name = nameProperty->StringValue(); |
|
2379 |
|
2380 if ( name == XnPropertyNames::action::trigger::name::keyevent::KEventType ) |
|
2381 { |
|
2382 const TDesC8& valueName = valueProperty->StringValue(); |
|
2383 |
|
2384 CXnDomList& children = aTriggerNode.ChildNodes(); |
|
2385 TInt count = children.Length(); |
|
2386 |
|
2387 if ( ( valueName == _L8( "3" ) ) ) //keydown |
|
2388 { |
|
2389 // check that no eventype has been defined |
|
2390 if ( !count ) |
|
2391 { |
|
2392 return EFalse; |
|
2393 } |
|
2394 } |
|
2395 else if ( ( valueName == _L8( "2" ) ) ) //keyup |
|
2396 { |
|
2397 ///check that some eventtype has been defined |
|
2398 if ( !count ) |
|
2399 { |
|
2400 return EFalse; |
|
2401 } |
|
2402 |
|
2403 CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( 0 ) ); |
|
2404 CXnDomList& attrs = node->AttributeList(); |
|
2405 CXnDomAttribute* nameAttribute = static_cast< CXnDomAttribute* >( |
|
2406 attrs.FindByName( XnPropertyNames::action::KName ) ); |
|
2407 CXnDomAttribute* valueAttribute = static_cast< CXnDomAttribute* >( |
|
2408 attrs.FindByName( XnPropertyNames::action::KValue ) ); |
|
2409 |
|
2410 if ( !nameAttribute || !valueAttribute ) |
|
2411 { |
|
2412 return EFalse; |
|
2413 } |
|
2414 |
|
2415 const TDesC8& name = nameAttribute->Value(); |
|
2416 |
|
2417 // check that eventype name matches |
|
2418 if ( name != |
|
2419 XnPropertyNames::action::trigger::name::keyevent::KEventType ) |
|
2420 { |
|
2421 return EFalse; |
|
2422 } |
|
2423 else |
|
2424 { |
|
2425 //check that eventype value matches |
|
2426 const TDesC8& valueName = valueAttribute->Value(); |
|
2427 if ( valueName != _L8( "2" ) ) |
|
2428 { |
|
2429 return EFalse; |
|
2430 } |
|
2431 } |
|
2432 } |
|
2433 } |
|
2434 } |
|
2435 |
|
2436 return ETrue; |
|
2437 } |
|
2438 |
|
2439 // ----------------------------------------------------------------------------- |
|
2440 // MatchScreenDeviceChangePropertiesL |
|
2441 // Checks if triggered node properties match |
|
2442 // ones defined in theme |
|
2443 // ----------------------------------------------------------------------------- |
|
2444 // |
|
2445 static TBool MatchScreenDeviceChangePropertiesL( |
|
2446 CXnNode& aEventData, |
|
2447 CXnDomNode& aTriggerNode ) |
|
2448 { |
|
2449 CXnDomList& attributeList( aTriggerNode.AttributeList() ); |
|
2450 |
|
2451 const TDesC8& reason( |
|
2452 XnPropertyNames::action::trigger::name::orientation::KReason ); |
|
2453 |
|
2454 CXnDomAttribute* attribute( static_cast< CXnDomAttribute* > |
|
2455 ( attributeList.FindByName( reason ) ) ); |
|
2456 |
|
2457 if ( !attribute ) |
|
2458 { |
|
2459 // Reason not defined, run events for plain screendevicechange trigger |
|
2460 return ETrue; |
|
2461 } |
|
2462 |
|
2463 const TDesC8& value( attribute->Value() ); |
|
2464 |
|
2465 if ( value == |
|
2466 XnPropertyNames::action::trigger::name::orientation::reason::KLandscape || |
|
2467 value == |
|
2468 XnPropertyNames::action::trigger::name::orientation::reason::KPortrait ) |
|
2469 { |
|
2470 CXnProperty* reasonProp( aEventData.GetPropertyL( reason ) ); |
|
2471 |
|
2472 if ( reasonProp ) |
|
2473 { |
|
2474 const TDesC8& reasonValue( reasonProp->StringValue() ); |
|
2475 |
|
2476 if ( reasonValue == value ) |
|
2477 { |
|
2478 return ETrue; |
|
2479 } |
|
2480 } |
|
2481 } |
|
2482 |
|
2483 return EFalse; |
|
2484 } |
|
2485 |
|
2486 // ----------------------------------------------------------------------------- |
|
2487 // MatchSwipeTriggerL |
|
2488 // Check if trigger matches the one defined in theme |
|
2489 // ----------------------------------------------------------------------------- |
|
2490 // |
|
2491 static TBool MatchSwipeTriggerL( |
|
2492 CXnNode& aEventData, |
|
2493 CXnDomNode& aTriggerNode ) |
|
2494 { |
|
2495 CXnDomList& attributeList( aTriggerNode.AttributeList() ); |
|
2496 |
|
2497 const TDesC8& reason( XnPropertyNames::action::trigger::name::swipe::KDirection); |
|
2498 |
|
2499 CXnDomAttribute* attribute( static_cast< CXnDomAttribute* > |
|
2500 ( attributeList.FindByName( reason ) ) ); |
|
2501 |
|
2502 if ( !attribute ) |
|
2503 { |
|
2504 // Reason not defined |
|
2505 return EFalse; |
|
2506 } |
|
2507 |
|
2508 const TDesC8& value( attribute->Value() ); |
|
2509 |
|
2510 if ( value == XnPropertyNames::action::trigger::name::swipe::direction::KLeft || |
|
2511 value == XnPropertyNames::action::trigger::name::swipe::direction::KRight ) |
|
2512 { |
|
2513 CXnProperty* reasonProp( aEventData.GetPropertyL( reason ) ); |
|
2514 |
|
2515 if ( reasonProp ) |
|
2516 { |
|
2517 const TDesC8& reasonValue( reasonProp->StringValue() ); |
|
2518 |
|
2519 if ( reasonValue == value ) |
|
2520 { |
|
2521 return ETrue; |
|
2522 } |
|
2523 } |
|
2524 } |
|
2525 |
|
2526 return EFalse; |
|
2527 } |
|
2528 |
|
2529 // ----------------------------------------------------------------------------- |
|
2530 // MatchValueAttributeTriggerL |
|
2531 // Check if trigger matches the one defined in theme |
|
2532 // ----------------------------------------------------------------------------- |
|
2533 // |
|
2534 static TBool MatchValueAttributeTriggerL( CXnNode& aEventData, |
|
2535 CXnDomNode& aTriggerNode ) |
|
2536 { |
|
2537 CXnDomList& attributeList( aTriggerNode.AttributeList() ); |
|
2538 |
|
2539 const TDesC8& reason( XnPropertyNames::action::KValue ); |
|
2540 |
|
2541 CXnDomAttribute* attribute( static_cast< CXnDomAttribute* > |
|
2542 ( attributeList.FindByName( reason ) ) ); |
|
2543 |
|
2544 if ( !attribute ) |
|
2545 { |
|
2546 // Reason not defined |
|
2547 return EFalse; |
|
2548 } |
|
2549 |
|
2550 const TDesC8& value( attribute->Value() ); |
|
2551 |
|
2552 CXnProperty* reasonProp( aEventData.GetPropertyL( reason ) ); |
|
2553 |
|
2554 if ( reasonProp ) |
|
2555 { |
|
2556 const TDesC8& reasonValue( reasonProp->StringValue() ); |
|
2557 |
|
2558 if ( reasonValue == value ) |
|
2559 { |
|
2560 return ETrue; |
|
2561 } |
|
2562 } |
|
2563 |
|
2564 return EFalse; |
|
2565 } |
|
2566 |
|
2567 // ----------------------------------------------------------------------------- |
|
2568 // MatchTitleScrollTriggerL |
|
2569 // ----------------------------------------------------------------------------- |
|
2570 // |
|
2571 static TBool MatchTitleScrollTriggerL(CXnNode& aEventData, |
|
2572 CXnDomNode& aTriggerNode ) |
|
2573 { |
|
2574 CXnDomList& attributeList( aTriggerNode.AttributeList() ); |
|
2575 |
|
2576 const TDesC8& reason( XnPropertyNames::action::trigger::name::KTitleIndex ); |
|
2577 |
|
2578 CXnDomAttribute* attribute( static_cast< CXnDomAttribute* > |
|
2579 ( attributeList.FindByName( reason ) ) ); |
|
2580 |
|
2581 if ( !attribute ) |
|
2582 { |
|
2583 // Reason not defined |
|
2584 return ETrue; |
|
2585 } |
|
2586 else |
|
2587 { |
|
2588 const TDesC8& value( attribute->Value() ); |
|
2589 |
|
2590 CXnProperty* reasonProp( aEventData.GetPropertyL( reason ) ); |
|
2591 |
|
2592 if ( reasonProp ) |
|
2593 { |
|
2594 const TDesC8& reasonValue( reasonProp->StringValue() ); |
|
2595 |
|
2596 if ( reasonValue == value ) |
|
2597 { |
|
2598 return ETrue; |
|
2599 } |
|
2600 } |
|
2601 } |
|
2602 |
|
2603 return EFalse; |
|
2604 } |
|
2605 |
|
2606 // ----------------------------------------------------------------------------- |
|
2607 // MatchTriggerForEventL |
|
2608 // ----------------------------------------------------------------------------- |
|
2609 // |
|
2610 static TBool MatchTriggerForEventL( |
|
2611 CXnNodeImpl* aThis, |
|
2612 CXnUiEngine& aEngine, |
|
2613 CXnNode& aNode, |
|
2614 CXnNode& aEventData, |
|
2615 CXnDomNode& aActionNode, |
|
2616 CXnDomNode& aTriggerNode, |
|
2617 TInt /*aSource*/ ) |
|
2618 { |
|
2619 const TDesC8& nameString( aTriggerNode.AttributeValue( KName ) ); |
|
2620 |
|
2621 if ( nameString == KNullDesC8 ) |
|
2622 { |
|
2623 return EFalse; |
|
2624 } |
|
2625 |
|
2626 CXnProperty* eventName( aEventData.NameL() ); |
|
2627 const TDesC8& eventNameString( eventName->StringValue() ); |
|
2628 |
|
2629 if ( nameString == eventNameString ) |
|
2630 { |
|
2631 // Check if triggernode properties match the ones defined in theme |
|
2632 // This is for identifying keyup in activate-trigger |
|
2633 if ( nameString == XnPropertyNames::action::trigger::name::KActivate ) |
|
2634 { |
|
2635 if ( !MatchActivateTriggerPropertiesL( aEventData, aTriggerNode ) ) |
|
2636 { |
|
2637 return EFalse; |
|
2638 } |
|
2639 } |
|
2640 else if ( nameString == XnPropertyNames::action::trigger::name::KTitleToScroll || |
|
2641 nameString == XnPropertyNames::action::trigger::name::KTitleScrolled ) |
|
2642 { |
|
2643 if ( !MatchTitleScrollTriggerL( aEventData, aTriggerNode ) ) |
|
2644 { |
|
2645 return EFalse; |
|
2646 } |
|
2647 } |
|
2648 else if ( nameString == |
|
2649 XnPropertyNames::action::trigger::name::KScreenDeviceChange ) |
|
2650 { |
|
2651 if ( !MatchScreenDeviceChangePropertiesL( aEventData, aTriggerNode ) ) |
|
2652 { |
|
2653 return EFalse; |
|
2654 } |
|
2655 } |
|
2656 else if ( nameString == XnPropertyNames::action::trigger::name::KSwipe ) |
|
2657 { |
|
2658 if ( !MatchSwipeTriggerL( aEventData, aTriggerNode ) ) |
|
2659 { |
|
2660 return EFalse; |
|
2661 } |
|
2662 } |
|
2663 else if ( nameString == XnPropertyNames::action::trigger::name::KWidgetAmount || |
|
2664 nameString == XnPropertyNames::action::trigger::name::KCallState || |
|
2665 nameString == XnPropertyNames::action::trigger::name::KEditMode ) |
|
2666 { |
|
2667 if ( !MatchValueAttributeTriggerL( aEventData, aTriggerNode ) ) |
|
2668 { |
|
2669 return EFalse; |
|
2670 } |
|
2671 } |
|
2672 |
|
2673 RunEventsL( aThis, aEngine, aNode, aActionNode, aTriggerNode, aEventData ); |
|
2674 |
|
2675 return ETrue; |
|
2676 } |
|
2677 |
|
2678 return EFalse; |
|
2679 } |
|
2680 |
|
2681 // ----------------------------------------------------------------------------- |
|
2682 // GetFocusCandidatesL |
|
2683 // ----------------------------------------------------------------------------- |
|
2684 // |
|
2685 static void GetFocusCandidatesL( |
|
2686 CXnNodeImpl* aThis, |
|
2687 CXnUiEngine& aEngine, |
|
2688 CXnDomNode& aEventNode, |
|
2689 RPointerArray< CXnNode >& aFocusCandidates ) |
|
2690 { |
|
2691 CXnDomList& children( aEventNode.ChildNodes() ); |
|
2692 |
|
2693 TInt count( children.Length() ); |
|
2694 |
|
2695 for ( TInt i = 0; i < count; ++i ) |
|
2696 { |
|
2697 CXnDomNode* dnode( static_cast< CXnDomNode* >( children.Item( i ) ) ); |
|
2698 |
|
2699 const TDesC8& type( dnode->Name() ); |
|
2700 |
|
2701 // Is the event's node child a property? |
|
2702 if ( type == XnPropertyNames::action::KProperty ) |
|
2703 { |
|
2704 CXnDomList& attributeList( dnode->AttributeList() ); |
|
2705 |
|
2706 CXnDomAttribute* attribute( static_cast< CXnDomAttribute* > |
|
2707 ( attributeList.FindByName( XnPropertyNames::action::KValue ) ) ); |
|
2708 |
|
2709 if ( attribute ) |
|
2710 { |
|
2711 CXnNode* node( aEngine.FindNodeByIdL( |
|
2712 attribute->Value(), aThis->Namespace() ) ); |
|
2713 |
|
2714 if ( node ) |
|
2715 { |
|
2716 aFocusCandidates.AppendL( node ); |
|
2717 } |
|
2718 } |
|
2719 } |
|
2720 } |
|
2721 } |
|
2722 |
|
2723 // ----------------------------------------------------------------------------- |
|
2724 // RunPassiveFocusChangeL |
|
2725 // ----------------------------------------------------------------------------- |
|
2726 // |
|
2727 static void RunPassiveFocusChangeL( |
|
2728 CXnNodeImpl* aThis, |
|
2729 CXnUiEngine& aEngine, |
|
2730 CXnDomNode& aEventNode, |
|
2731 const TDesC8& aString ) |
|
2732 { |
|
2733 CXnDomList& children = aEventNode.ChildNodes(); |
|
2734 TInt count = children.Length(); |
|
2735 for ( TInt i = 0; i < count; ++i ) |
|
2736 { |
|
2737 CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
2738 const TDesC8& type = dnode->Name(); |
|
2739 if ( type == XnPropertyNames::action::KProperty ) |
|
2740 { |
|
2741 CXnDomList& attrs = dnode->AttributeList(); |
|
2742 CXnDomAttribute* attribute = static_cast< CXnDomAttribute* >( |
|
2743 attrs.FindByName(XnPropertyNames::action::KValue ) ); |
|
2744 if ( attribute ) |
|
2745 { |
|
2746 CXnNode* node = aEngine.FindNodeByIdL( |
|
2747 attribute->Value(), aThis->Namespace() ); |
|
2748 if ( node ) |
|
2749 { |
|
2750 if ( aString == XnPropertyNames::action::event::KSetPassiveFocus ) |
|
2751 { |
|
2752 aEngine.AddPassiveFocusedNodeL( node ); |
|
2753 } |
|
2754 else if ( aString == XnPropertyNames::action::event::KResetPassiveFocus ) |
|
2755 { |
|
2756 aEngine.RemovePassiveFocusedNodeL( node ); |
|
2757 } |
|
2758 else if ( aString == XnPropertyNames::action::event::KSetActiveFocus ) |
|
2759 { |
|
2760 CXnNode* previousNode = aEngine.FocusedNode(); |
|
2761 if ( previousNode && previousNode != node ) |
|
2762 { |
|
2763 if ( IsNodeNavigableL( *node ) ) |
|
2764 { |
|
2765 node->SetStateL( XnPropertyNames::style::common::KFocus ); |
|
2766 aEngine.AddPassiveFocusedNodeL( previousNode ); |
|
2767 break; |
|
2768 } |
|
2769 } |
|
2770 } |
|
2771 } |
|
2772 } |
|
2773 } |
|
2774 } |
|
2775 } |
|
2776 |
|
2777 // ----------------------------------------------------------------------------- |
|
2778 // RunAppUiNotificationL |
|
2779 // ----------------------------------------------------------------------------- |
|
2780 // |
|
2781 static void RunAppUiNotificationL( |
|
2782 CXnUiEngine& aEngine, |
|
2783 CXnNode& aNode, |
|
2784 CXnDomNode& aEventNode, |
|
2785 CXnDomNode& aTriggerNode, |
|
2786 CXnNode& aEventData ) |
|
2787 { |
|
2788 CXnAppUiAdapter& adapter( aEngine.AppUiAdapter() ); |
|
2789 |
|
2790 // Check if event is template |
|
2791 const TDesC8& templateEvent( aEventNode.AttributeValue( KTemplate ) ); |
|
2792 |
|
2793 if ( templateEvent != KNullDesC8() ) |
|
2794 { |
|
2795 CXnDomNode* event( |
|
2796 GetTemplateEventL( templateEvent, aNode, aEventNode ) ); |
|
2797 CleanupStack::PushL( event ); |
|
2798 |
|
2799 if ( event ) |
|
2800 { |
|
2801 adapter.HandleXuikonEventL( |
|
2802 aNode.AppIfL(), aEventData.AppIfL(), aTriggerNode, *event ); |
|
2803 } |
|
2804 |
|
2805 CleanupStack::PopAndDestroy( event ); |
|
2806 } |
|
2807 else |
|
2808 { |
|
2809 adapter.HandleXuikonEventL( |
|
2810 aNode.AppIfL(), aEventData.AppIfL(), aTriggerNode, aEventNode ); |
|
2811 } |
|
2812 } |
|
2813 |
|
2814 // ----------------------------------------------------------------------------- |
|
2815 // RunFullScreenEffectL |
|
2816 // ----------------------------------------------------------------------------- |
|
2817 // |
|
2818 static void RunFullScreenEffectL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
2819 { |
|
2820 TInt effectId = ResolveEffectId( aEventNode ); |
|
2821 if( effectId ) |
|
2822 { |
|
2823 aEngine.AppUiAdapter().EffectManager()->BeginFullscreenEffectL( |
|
2824 effectId, aEngine.ViewManager()->ActiveViewData() ); |
|
2825 } |
|
2826 } |
|
2827 |
|
2828 // ----------------------------------------------------------------------------- |
|
2829 // RunActivateNextViewL |
|
2830 // ----------------------------------------------------------------------------- |
|
2831 // |
|
2832 static void RunActivateNextViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
2833 { |
|
2834 TInt effectid = ResolveEffectId( aEventNode ); |
|
2835 aEngine.ViewManager()->ActivateNextViewL( /*effectid*/ ); |
|
2836 } |
|
2837 |
|
2838 // ----------------------------------------------------------------------------- |
|
2839 // RunActivatePreviousViewL |
|
2840 // ----------------------------------------------------------------------------- |
|
2841 // |
|
2842 static void RunActivatePreviousViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
2843 { |
|
2844 TInt effectid = ResolveEffectId( aEventNode ); |
|
2845 aEngine.ViewManager()->ActivatePreviousViewL( /*effectid*/ ); |
|
2846 } |
|
2847 |
|
2848 // ----------------------------------------------------------------------------- |
|
2849 // RunAddViewL |
|
2850 // ----------------------------------------------------------------------------- |
|
2851 // |
|
2852 static void RunAddViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
2853 { |
|
2854 TInt effectid = ResolveEffectId( aEventNode ); |
|
2855 aEngine.ViewManager()->AddViewL( effectid ); |
|
2856 } |
|
2857 |
|
2858 // ----------------------------------------------------------------------------- |
|
2859 // RunRemoveViewL |
|
2860 // ----------------------------------------------------------------------------- |
|
2861 // |
|
2862 static void RunRemoveViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
2863 { |
|
2864 TInt effectid = ResolveEffectId( aEventNode ); |
|
2865 aEngine.ViewManager()->RemoveViewL( effectid ); |
|
2866 } |
|
2867 |
|
2868 // ----------------------------------------------------------------------------- |
|
2869 // RunActivateL |
|
2870 // ----------------------------------------------------------------------------- |
|
2871 // |
|
2872 static void RunActivateL( |
|
2873 CXnNodeImpl* aThis, |
|
2874 CXnUiEngine& aEngine, |
|
2875 CXnDomNode& aEventNode ) |
|
2876 { |
|
2877 CXnDomList& children = aEventNode.ChildNodes(); |
|
2878 TInt count = children.Length(); |
|
2879 for ( TInt i = 0; i < count; ++i ) |
|
2880 { |
|
2881 CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
2882 const TDesC8& type = dnode->Name(); |
|
2883 if ( type == XnPropertyNames::action::KProperty ) |
|
2884 { |
|
2885 const TDesC8& id = dnode->AttributeValue( KId ); |
|
2886 CXnNode* node = aEngine.FindNodeByIdL( id, aThis->Namespace() ); |
|
2887 if ( node ) |
|
2888 { |
|
2889 node->SetStateL( XnPropertyNames::style::common::KActive ); |
|
2890 return; |
|
2891 } |
|
2892 } |
|
2893 } |
|
2894 |
|
2895 CXnNode* focused( aEngine.FocusedNode() ); |
|
2896 |
|
2897 if ( focused ) |
|
2898 { |
|
2899 focused->SetStateL( XnPropertyNames::style::common::KActive ); |
|
2900 } |
|
2901 } |
|
2902 |
|
2903 // ----------------------------------------------------------------------------- |
|
2904 // RunActivateEditorL |
|
2905 // ----------------------------------------------------------------------------- |
|
2906 // |
|
2907 static void RunActivateEditorL( |
|
2908 CXnNodeImpl* aThis, |
|
2909 CXnNode& aLayoutNode, |
|
2910 CXnUiEngine& aEngine, |
|
2911 CXnDomNode& aEventNode, |
|
2912 TBool aActivate ) |
|
2913 { |
|
2914 CXnNode* editorNode( NULL ); |
|
2915 CXnDomList& children = aEventNode.ChildNodes(); |
|
2916 TInt count = children.Length(); |
|
2917 for ( TInt i = 0; i < count; ++i ) |
|
2918 { |
|
2919 CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
2920 const TDesC8& type = dnode->Name(); |
|
2921 if ( type == XnPropertyNames::action::KProperty ) |
|
2922 { |
|
2923 const TDesC8& id = dnode->AttributeValue( KId ); |
|
2924 CXnNode* node = aEngine.FindNodeByIdL( id, aThis->Namespace() ); |
|
2925 if( node && node->Type()->Type() == KTextEditor ) |
|
2926 { |
|
2927 editorNode = node; |
|
2928 break; |
|
2929 } |
|
2930 } |
|
2931 } |
|
2932 |
|
2933 if( !editorNode && aLayoutNode.Type()->Type() == KTextEditor ) |
|
2934 { |
|
2935 editorNode = &aLayoutNode; |
|
2936 } |
|
2937 |
|
2938 if( editorNode ) |
|
2939 { |
|
2940 XnTextEditorInterface::MXnTextEditorInterface* editorControl = NULL; |
|
2941 |
|
2942 XnComponentInterface::MakeInterfaceL( editorControl, editorNode->AppIfL() ); |
|
2943 if( editorControl ) |
|
2944 { |
|
2945 if( aActivate ) |
|
2946 { |
|
2947 editorControl->HandleEditorEvent(CXnTextEditor::KActivateTextEditor); |
|
2948 } |
|
2949 else |
|
2950 { |
|
2951 editorControl->HandleEditorEvent(CXnTextEditor::KDeactivateTextEditor); |
|
2952 } |
|
2953 } |
|
2954 } |
|
2955 } |
|
2956 |
|
2957 // ----------------------------------------------------------------------------- |
|
2958 // RunEditL |
|
2959 // ----------------------------------------------------------------------------- |
|
2960 // |
|
2961 static void RunEditL( |
|
2962 CXnNodeImpl* aThis, |
|
2963 CXnUiEngine& aEngine, |
|
2964 CXnDomNode& aEventNode ) |
|
2965 { |
|
2966 aEngine.DisableRenderUiLC(); |
|
2967 |
|
2968 // Set plugins to edit state |
|
2969 RPointerArray< CXnPluginData >& views( |
|
2970 aEngine.ViewManager()->ActiveAppData().PluginData() ); |
|
2971 |
|
2972 CXnViewData* view( NULL ); |
|
2973 |
|
2974 for ( TInt i = 0; i < views.Count(); i++ ) |
|
2975 { |
|
2976 view = static_cast< CXnViewData* >( views[i] ); |
|
2977 |
|
2978 CXnPluginData* plugin( view->Plugin( aThis->Node() ) ); |
|
2979 |
|
2980 if ( plugin && plugin == view ) |
|
2981 { |
|
2982 break; |
|
2983 } |
|
2984 } |
|
2985 |
|
2986 if ( !view ) |
|
2987 { |
|
2988 return; |
|
2989 } |
|
2990 |
|
2991 RPointerArray< CXnPluginData >& plugins( view->PluginData() ); |
|
2992 |
|
2993 CXnDomStringPool* sp( aEventNode.StringPool() ); |
|
2994 |
|
2995 CXnDomList& children( aEventNode.ChildNodes() ); |
|
2996 |
|
2997 TInt count( children.Length() ); |
|
2998 |
|
2999 for ( TInt i = 0; i < count; ++i ) |
|
3000 { |
|
3001 CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
3002 const TDesC8& type = dnode->Name(); |
|
3003 |
|
3004 if ( type == XnPropertyNames::action::KProperty ) |
|
3005 { |
|
3006 const TDesC8& name = dnode->AttributeValue( |
|
3007 XnPropertyNames::action::event::systemset::KName ); |
|
3008 const TDesC8& value = dnode->AttributeValue( |
|
3009 XnPropertyNames::action::event::systemset::KValue ); |
|
3010 |
|
3011 if ( name != KNullDesC8 && value != KNullDesC8 ) |
|
3012 { |
|
3013 // Find node by id |
|
3014 if ( name == XnPropertyNames::common::KId ) |
|
3015 { |
|
3016 CXnNode* node( aEngine.FindNodeByIdL( value, aThis->Namespace() ) ); |
|
3017 |
|
3018 if ( node ) |
|
3019 { |
|
3020 node->SetStateL( XnPropertyNames::style::common::KEdit ); |
|
3021 } |
|
3022 } |
|
3023 // Find nodes by class |
|
3024 else if ( name == XnPropertyNames::common::KClass ) |
|
3025 { |
|
3026 CXnPointerArray* array = aEngine.FindNodeByClassL( value, aThis->Namespace() ); |
|
3027 CleanupStack::PushL( array ); |
|
3028 |
|
3029 if ( array ) |
|
3030 { |
|
3031 const TInt count( array->Container().Count() ); |
|
3032 |
|
3033 for ( TInt i = 0; i < count; ++i ) |
|
3034 { |
|
3035 CXnNode* node( static_cast< CXnNode* >( |
|
3036 array->Container()[i] ) ); |
|
3037 |
|
3038 CXnProperty* editable( node->GetPropertyL( |
|
3039 XnPropertyNames::style::common::edit::KEditable ) ); |
|
3040 |
|
3041 if ( !editable || |
|
3042 editable->StringValue() != XnPropertyNames::KFalse ) |
|
3043 { |
|
3044 node->SetStateL( XnPropertyNames::style::common::KEdit ); |
|
3045 } |
|
3046 } |
|
3047 } |
|
3048 |
|
3049 CleanupStack::PopAndDestroy( array ); |
|
3050 } |
|
3051 } |
|
3052 } |
|
3053 } |
|
3054 |
|
3055 TBool useEmpty( view->UseEmptyWidget() ); |
|
3056 |
|
3057 for ( TInt i = 0; i < plugins.Count(); i++ ) |
|
3058 { |
|
3059 CXnNode* node( plugins[i]->Owner()->LayoutNode() ); |
|
3060 |
|
3061 node->SetStateL( XnPropertyNames::style::common::KEdit ); |
|
3062 |
|
3063 if ( !plugins[i]->Occupied() && useEmpty ) |
|
3064 { |
|
3065 // Make empty space visible |
|
3066 SetStringPropertyToNodeL( *sp, *node, |
|
3067 XnPropertyNames::style::common::KVisibility, |
|
3068 XnPropertyNames::style::common::visibility::KVisible ); |
|
3069 } |
|
3070 } |
|
3071 |
|
3072 aEngine.EditMode()->SetEditModeL( CXnEditMode::EDragAndDrop ); |
|
3073 aEngine.AppUiAdapter().ViewAdapter().CloseAllPopupsL(); |
|
3074 |
|
3075 CleanupStack::PopAndDestroy(); |
|
3076 |
|
3077 aEngine.AppUiAdapter().ViewAdapter().UpdateRskByUiStateL( *view ); |
|
3078 } |
|
3079 |
|
3080 // ----------------------------------------------------------------------------- |
|
3081 // RunResetEditL |
|
3082 // ----------------------------------------------------------------------------- |
|
3083 // |
|
3084 static void RunResetEditL( |
|
3085 CXnNodeImpl* aThis, |
|
3086 CXnUiEngine& aEngine, |
|
3087 CXnDomNode& aEventNode ) |
|
3088 { |
|
3089 // Set plugins to edit state |
|
3090 RPointerArray< CXnPluginData >& views( |
|
3091 aEngine.ViewManager()->ActiveAppData().PluginData() ); |
|
3092 |
|
3093 CXnViewData* view( NULL ); |
|
3094 |
|
3095 for ( TInt i = 0; i < views.Count(); i++ ) |
|
3096 { |
|
3097 view = static_cast< CXnViewData* >( views[i] ); |
|
3098 |
|
3099 CXnPluginData* plugin( view->Plugin( aThis->Node() ) ); |
|
3100 |
|
3101 if ( plugin && plugin == view ) |
|
3102 { |
|
3103 break; |
|
3104 } |
|
3105 } |
|
3106 |
|
3107 if ( !view ) |
|
3108 { |
|
3109 return; |
|
3110 } |
|
3111 |
|
3112 CXnDomList& children( aEventNode.ChildNodes() ); |
|
3113 |
|
3114 TInt count( children.Length() ); |
|
3115 |
|
3116 for ( TInt i = 0; i < count; ++i ) |
|
3117 { |
|
3118 CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
3119 const TDesC8& type = dnode->Name(); |
|
3120 |
|
3121 if ( type == XnPropertyNames::action::KProperty ) |
|
3122 { |
|
3123 const TDesC8& name = dnode->AttributeValue( |
|
3124 XnPropertyNames::action::event::systemset::KName ); |
|
3125 const TDesC8& value = dnode->AttributeValue( |
|
3126 XnPropertyNames::action::event::systemset::KValue ); |
|
3127 |
|
3128 if ( name != KNullDesC8 && value != KNullDesC8 ) |
|
3129 { |
|
3130 if ( name == XnPropertyNames::common::KId ) |
|
3131 { |
|
3132 CXnNode* node( aEngine.FindNodeByIdL( value, aThis->Namespace() ) ); |
|
3133 |
|
3134 if ( node ) |
|
3135 { |
|
3136 node->UnsetStateL( |
|
3137 XnPropertyNames::style::common::KEdit ); |
|
3138 } |
|
3139 } |
|
3140 else if ( name == XnPropertyNames::common::KClass ) |
|
3141 { |
|
3142 CXnPointerArray* array( aEngine.FindNodeByClassL( value, aThis->Namespace() ) ); |
|
3143 CleanupStack::PushL( array ); |
|
3144 |
|
3145 const TInt count = array->Container().Count(); |
|
3146 |
|
3147 for ( TInt i = 0; i < count; ++i ) |
|
3148 { |
|
3149 CXnNode* node = static_cast< CXnNode* >( |
|
3150 array->Container()[i] ); |
|
3151 |
|
3152 if ( node && |
|
3153 node->IsStateSet( XnPropertyNames::style::common::KEdit ) ) |
|
3154 { |
|
3155 node->UnsetStateL( XnPropertyNames::style::common::KEdit ); |
|
3156 } |
|
3157 } |
|
3158 |
|
3159 CleanupStack::PopAndDestroy( array ); |
|
3160 } |
|
3161 } |
|
3162 } |
|
3163 } |
|
3164 |
|
3165 RPointerArray< CXnPluginData>& plugins( view->PluginData() ); |
|
3166 |
|
3167 CXnDomStringPool* sp( aEventNode.StringPool() ); |
|
3168 |
|
3169 TBool useEmpty( view->UseEmptyWidget() ); |
|
3170 |
|
3171 for ( TInt i = 0; i < plugins.Count(); i++ ) |
|
3172 { |
|
3173 CXnNode* node( plugins[i]->Owner()->LayoutNode() ); |
|
3174 |
|
3175 node->UnsetStateL( XnPropertyNames::style::common::KEdit ); |
|
3176 |
|
3177 if ( !plugins[i]->Occupied() && useEmpty ) |
|
3178 { |
|
3179 // Make empty space blank |
|
3180 SetStringPropertyToNodeL( *sp, *node, |
|
3181 XnPropertyNames::style::common::KVisibility, |
|
3182 XnPropertyNames::style::common::visibility::KBlank ); |
|
3183 } |
|
3184 } |
|
3185 |
|
3186 aEngine.EditMode()->SetEditModeL( CXnEditMode::ENone ); |
|
3187 |
|
3188 aEngine.AppUiAdapter().ViewAdapter().UpdateRskByUiStateL( *view ); |
|
3189 } |
|
3190 |
|
3191 // ----------------------------------------------------------------------------- |
|
3192 // RunDeactivateL |
|
3193 // ----------------------------------------------------------------------------- |
|
3194 // |
|
3195 static void RunDeactivateL( |
|
3196 CXnNodeImpl* aThis, |
|
3197 CXnUiEngine& aEngine, |
|
3198 CXnDomNode& aEventNode ) |
|
3199 { |
|
3200 CXnDomList& children = aEventNode.ChildNodes(); |
|
3201 TInt count = children.Length(); |
|
3202 for ( TInt i = 0; i < count; ++i ) |
|
3203 { |
|
3204 CXnDomNode* dnode = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
3205 const TDesC8& type = dnode->Name(); |
|
3206 if ( type == XnPropertyNames::action::KProperty ) |
|
3207 { |
|
3208 const TDesC8& id = dnode->AttributeValue( KId ); |
|
3209 CXnNode* node = aEngine.FindNodeByIdL( id, aThis->Namespace() ); |
|
3210 if ( node ) |
|
3211 { |
|
3212 node->UnsetStateL( XnPropertyNames::style::common::KActive ); |
|
3213 } |
|
3214 } |
|
3215 } |
|
3216 } |
|
3217 |
|
3218 // ----------------------------------------------------------------------------- |
|
3219 // RunSystemSetPCDataL |
|
3220 // ----------------------------------------------------------------------------- |
|
3221 // |
|
3222 static void RunSystemSetPCDataL( |
|
3223 CXnNodeImpl* aThis, |
|
3224 CXnUiEngine& aEngine, |
|
3225 const TDesC8& aId, |
|
3226 const TDesC8& aData ) |
|
3227 { |
|
3228 CXnNode* node = aEngine.FindNodeByIdL( aId, aThis->Namespace() ); |
|
3229 |
|
3230 if ( node ) |
|
3231 { |
|
3232 node->SetPCDataL( aData ); |
|
3233 } |
|
3234 } |
|
3235 |
|
3236 // ----------------------------------------------------------------------------- |
|
3237 // GetNumberValues |
|
3238 // ----------------------------------------------------------------------------- |
|
3239 // |
|
3240 static void GetNumberValues( |
|
3241 const TDesC8& aData, |
|
3242 TReal& aNumber, |
|
3243 CXnDomPropertyValue::TPrimitiveValueType& aValueType ) |
|
3244 { |
|
3245 TLex8 lex( aData ); |
|
3246 lex.Val( aNumber ); |
|
3247 TPtrC8 rest = lex.Remainder(); |
|
3248 if ( rest.FindF( _L8( "%" ) ) != KErrNotFound ) |
|
3249 { |
|
3250 aValueType = CXnDomPropertyValue::EPercentage; |
|
3251 } |
|
3252 else if (rest.FindF( _L8( "em" ) ) != KErrNotFound ) |
|
3253 { |
|
3254 aValueType = CXnDomPropertyValue::EEms; |
|
3255 } |
|
3256 else if ( rest.FindF( _L8( "ex" ) ) != KErrNotFound ) |
|
3257 { |
|
3258 aValueType = CXnDomPropertyValue::EExs; |
|
3259 } |
|
3260 else if ( rest.FindF( _L8( "px" ) ) != KErrNotFound ) |
|
3261 { |
|
3262 aValueType = CXnDomPropertyValue::EPx; |
|
3263 } |
|
3264 else if ( rest.FindF( _L8( "u" ) ) != KErrNotFound ) |
|
3265 { |
|
3266 aValueType = CXnDomPropertyValue::EUnitValue; |
|
3267 } |
|
3268 else if ( rest.FindF( _L8( "cm" ) ) != KErrNotFound ) |
|
3269 { |
|
3270 aValueType = CXnDomPropertyValue::ECm; |
|
3271 } |
|
3272 else if ( rest.FindF( _L8( "mm" ) ) != KErrNotFound ) |
|
3273 { |
|
3274 aValueType = CXnDomPropertyValue::EMm; |
|
3275 } |
|
3276 else if ( rest.FindF( _L8( "in" ) ) != KErrNotFound ) |
|
3277 { |
|
3278 aValueType = CXnDomPropertyValue::EIn; |
|
3279 } |
|
3280 else if ( rest.FindF( _L8( "pt" ) ) != KErrNotFound ) |
|
3281 { |
|
3282 aValueType = CXnDomPropertyValue::EPt; |
|
3283 } |
|
3284 else if ( rest.FindF( _L8( "pc" ) ) != KErrNotFound ) |
|
3285 { |
|
3286 aValueType = CXnDomPropertyValue::EPc; |
|
3287 } |
|
3288 else |
|
3289 { |
|
3290 aValueType = CXnDomPropertyValue::ENumber; |
|
3291 } |
|
3292 } |
|
3293 |
|
3294 // ----------------------------------------------------------------------------- |
|
3295 // RunSystemSetNumberL |
|
3296 // ----------------------------------------------------------------------------- |
|
3297 // |
|
3298 static void RunSystemSetNumberL( |
|
3299 CXnUiEngine& aEngine, |
|
3300 CXnNode* aNode, |
|
3301 const TDesC8& aName, |
|
3302 const RPointerArray< HBufC8 >& aValues ) |
|
3303 { |
|
3304 if ( aNode ) |
|
3305 { |
|
3306 CXnDomStringPool* sp = aEngine.ODT()->DomDocument().StringPool(); |
|
3307 CXnDomProperty* prop = CXnDomProperty::NewL( aName, sp ); |
|
3308 CleanupStack::PushL( prop ); |
|
3309 |
|
3310 for ( TInt i = 0; i < aValues.Count(); i++ ) |
|
3311 { |
|
3312 const TDesC8& value = ( *aValues[i] ); |
|
3313 |
|
3314 CXnDomPropertyValue* propVal = CXnDomPropertyValue::NewL( sp ); |
|
3315 CleanupStack::PushL( propVal ); |
|
3316 |
|
3317 CXnDomPropertyValue::TPrimitiveValueType type; |
|
3318 TReal realValue; |
|
3319 |
|
3320 GetNumberValues( value, realValue, type ); |
|
3321 propVal->SetFloatValueL( type, realValue ); |
|
3322 |
|
3323 prop->PropertyValueList().AddItemL( propVal ); |
|
3324 CleanupStack::Pop( propVal ); |
|
3325 } |
|
3326 |
|
3327 CXnProperty* propertyValue = CXnProperty::NewL( prop ); |
|
3328 |
|
3329 CleanupStack::Pop( prop ); |
|
3330 CleanupStack::PushL( propertyValue ); |
|
3331 |
|
3332 aNode->SetPropertyL( propertyValue ); |
|
3333 |
|
3334 CleanupStack::Pop( propertyValue ); |
|
3335 } |
|
3336 } |
|
3337 |
|
3338 // ----------------------------------------------------------------------------- |
|
3339 // RunSystemSetRGBL |
|
3340 // ----------------------------------------------------------------------------- |
|
3341 // |
|
3342 static void RunSystemSetRGBL( |
|
3343 CXnUiEngine& aEngine, |
|
3344 CXnNode* aNode, |
|
3345 const TDesC8& aName, |
|
3346 const RPointerArray< HBufC8 >& aValues ) |
|
3347 { |
|
3348 if ( aNode ) |
|
3349 { |
|
3350 CXnDomStringPool* sp = aEngine.ODT()->DomDocument().StringPool(); |
|
3351 CXnDomProperty* prop = CXnDomProperty::NewL( aName, sp ); |
|
3352 CleanupStack::PushL( prop ); |
|
3353 |
|
3354 for ( TInt i = 0; i < aValues.Count(); i++ ) |
|
3355 { |
|
3356 const TDesC8& value = ( *aValues[i] ); |
|
3357 |
|
3358 CXnDomPropertyValue* propVal = CXnDomPropertyValue::NewL( sp ); |
|
3359 CleanupStack::PushL( propVal ); |
|
3360 |
|
3361 TRgb rgb; |
|
3362 |
|
3363 if ( CXnUtils::GetRgbValue( rgb, value ) ) |
|
3364 { |
|
3365 propVal->SetRgbColorL( rgb ); |
|
3366 prop->PropertyValueList().AddItemL( propVal ); |
|
3367 CleanupStack::Pop( propVal ); |
|
3368 } |
|
3369 else |
|
3370 { |
|
3371 CleanupStack::PopAndDestroy( propVal ); |
|
3372 } |
|
3373 } |
|
3374 |
|
3375 CXnProperty* propertyValue = CXnProperty::NewL( prop ); |
|
3376 |
|
3377 CleanupStack::Pop( prop ); |
|
3378 CleanupStack::PushL( propertyValue ); |
|
3379 |
|
3380 aNode->SetPropertyL( propertyValue ); |
|
3381 |
|
3382 CleanupStack::Pop( propertyValue ); |
|
3383 } |
|
3384 } |
|
3385 |
|
3386 // ----------------------------------------------------------------------------- |
|
3387 // RunSystemSetStringL |
|
3388 // ----------------------------------------------------------------------------- |
|
3389 // |
|
3390 static void RunSystemSetStringL( |
|
3391 CXnUiEngine& aEngine, |
|
3392 CXnNode* aNode, |
|
3393 const TDesC8& aName, |
|
3394 const RPointerArray< HBufC8 >& aValues, |
|
3395 const CXnDomPropertyValue::TPrimitiveValueType aValueType ) |
|
3396 { |
|
3397 if ( aNode ) |
|
3398 { |
|
3399 CXnDomStringPool* sp = aEngine.ODT()->DomDocument().StringPool(); |
|
3400 CXnDomProperty* prop = CXnDomProperty::NewL( aName, sp ); |
|
3401 CleanupStack::PushL( prop ); |
|
3402 |
|
3403 for ( TInt i = 0; i < aValues.Count(); i++ ) |
|
3404 { |
|
3405 const TDesC8& value = ( *aValues[i] ); |
|
3406 |
|
3407 CXnDomPropertyValue* propVal = CXnDomPropertyValue::NewL( sp ); |
|
3408 CleanupStack::PushL( propVal ); |
|
3409 |
|
3410 propVal->SetStringValueL( aValueType, value ); |
|
3411 prop->PropertyValueList().AddItemL( propVal ); |
|
3412 CleanupStack::Pop( propVal ); |
|
3413 } |
|
3414 |
|
3415 CXnProperty* propertyValue = CXnProperty::NewL( prop ); |
|
3416 |
|
3417 CleanupStack::Pop( prop ); |
|
3418 CleanupStack::PushL( propertyValue ); |
|
3419 |
|
3420 aNode->SetPropertyL( propertyValue ); |
|
3421 |
|
3422 CleanupStack::Pop( propertyValue ); |
|
3423 } |
|
3424 } |
|
3425 |
|
3426 // ----------------------------------------------------------------------------- |
|
3427 // GetSystemSetDataL |
|
3428 // ----------------------------------------------------------------------------- |
|
3429 // |
|
3430 static void GetSystemSetDataL( |
|
3431 CXnDomNode& aDomNode, |
|
3432 HBufC8*& aId, |
|
3433 const TDesC8** aPseudoClass, |
|
3434 const TDesC8** aName, |
|
3435 RPointerArray< HBufC8 >* aValues, |
|
3436 const TDesC8** aType, |
|
3437 TBool aSettings, |
|
3438 const TDesC8& aProvidedId, |
|
3439 const TDesC8** aClassId ) |
|
3440 { |
|
3441 CXnDomList& children = aDomNode.ChildNodes(); |
|
3442 |
|
3443 if ( aSettings ) |
|
3444 { |
|
3445 aId = aProvidedId.AllocL(); |
|
3446 } |
|
3447 |
|
3448 TInt count = children.Length(); |
|
3449 |
|
3450 for ( TInt i = 0; i < count; ++i ) |
|
3451 { |
|
3452 CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
3453 const TDesC8& nodeType = node->Name(); |
|
3454 |
|
3455 if ( nodeType == XnPropertyNames::action::KProperty ) |
|
3456 { |
|
3457 const TDesC8& name = node->AttributeValue( |
|
3458 XnPropertyNames::action::event::systemset::KName ); |
|
3459 const TDesC8& value = node->AttributeValue( |
|
3460 XnPropertyNames::action::event::systemset::KValue ); |
|
3461 |
|
3462 if ( !aSettings && |
|
3463 ( name == XnPropertyNames::action::event::systemset::KId ) ) |
|
3464 { |
|
3465 HBufC8* utfName = HBufC8::NewL( value.Length() ); |
|
3466 TPtr8 ptr = utfName->Des(); |
|
3467 ptr = value; |
|
3468 aId = utfName; |
|
3469 } |
|
3470 else if ( name == XnPropertyNames::action::event::systemset::KPseudoClass ) |
|
3471 { |
|
3472 *aPseudoClass = &value; |
|
3473 } |
|
3474 else if ( name == XnPropertyNames::action::event::systemset::KName ) |
|
3475 { |
|
3476 *aName = &value; |
|
3477 } |
|
3478 else if ( name == XnPropertyNames::action::event::systemset::KValue ) |
|
3479 { |
|
3480 if ( aValues ) |
|
3481 { |
|
3482 HBufC8* valueH = HBufC8::NewLC( value.Length() + KUnitMaxLen ); |
|
3483 TPtr8 ptr( valueH->Des() ); |
|
3484 ptr.Append( value ); |
|
3485 aValues->AppendL( valueH ); //take ownership |
|
3486 CleanupStack::Pop( valueH ); |
|
3487 } |
|
3488 } |
|
3489 else if ( name == XnPropertyNames::action::event::systemset::KType ) |
|
3490 { |
|
3491 *aType = &value; |
|
3492 } |
|
3493 else if ( name == XnPropertyNames::action::event::systemset::KUnit ) |
|
3494 { |
|
3495 if ( value.Length() > KUnitMaxLen ) |
|
3496 { |
|
3497 #ifdef _XN_DEBUG_ |
|
3498 RDebug::Print( _L( "xnnodeimpl GetSystemSetDataL - unexpected length of type string" ) ); |
|
3499 #endif |
|
3500 User::Leave( KErrNotSupported ); |
|
3501 } |
|
3502 if ( aValues ) |
|
3503 { |
|
3504 TInt index = aValues->Count() - 1; |
|
3505 HBufC8* valueH = ( *aValues )[index]; |
|
3506 TPtr8 ptr( valueH->Des() ); |
|
3507 ptr.Append( value ); |
|
3508 } |
|
3509 } |
|
3510 else if ( name == XnPropertyNames::action::event::systemset::KClass ) |
|
3511 { |
|
3512 *aClassId = &value; |
|
3513 } |
|
3514 else |
|
3515 { |
|
3516 // Everyting is within the same property tag |
|
3517 // e.g. <property name="display" value="block" type="string" id="my_id"/> |
|
3518 |
|
3519 // Save name... |
|
3520 *aName = &name; |
|
3521 |
|
3522 // ...and value |
|
3523 if ( aValues ) |
|
3524 { |
|
3525 HBufC8* valueH = HBufC8::NewLC( value.Length() + KUnitMaxLen ); |
|
3526 TPtr8 ptr( valueH->Des() ); |
|
3527 ptr.Append( value ); |
|
3528 aValues->AppendL( valueH ); //take ownership |
|
3529 CleanupStack::Pop( valueH ); |
|
3530 } |
|
3531 |
|
3532 // ...and type |
|
3533 const TDesC8& type = node->AttributeValue( |
|
3534 XnPropertyNames::action::event::systemset::KType ); |
|
3535 *aType = &type; |
|
3536 |
|
3537 // ...and id |
|
3538 const TDesC8& id = node->AttributeValue( |
|
3539 XnPropertyNames::action::event::systemset::KId ); |
|
3540 HBufC8* utfName = HBufC8::NewL( id.Length() ); |
|
3541 TPtr8 ptr = utfName->Des(); |
|
3542 ptr = id; |
|
3543 aId = utfName; |
|
3544 } |
|
3545 } |
|
3546 } |
|
3547 } |
|
3548 |
|
3549 // ----------------------------------------------------------------------------- |
|
3550 // RunTryDisplayingMenuL |
|
3551 // ----------------------------------------------------------------------------- |
|
3552 // |
|
3553 static void RunTryDisplayingMenuL( CXnUiEngine& aEngine, CXnDomNode& aEventNode ) |
|
3554 { |
|
3555 CXnNode* menubar( aEngine.MenuBarNode() ); |
|
3556 |
|
3557 if ( menubar ) |
|
3558 { |
|
3559 CXnDomList& children( aEventNode.ChildNodes() ); |
|
3560 |
|
3561 TInt count( children.Length() ); |
|
3562 |
|
3563 for ( TInt i = 0; i < count; ++i ) |
|
3564 { |
|
3565 CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
3566 |
|
3567 const TDesC8& type( node->Name() ); |
|
3568 |
|
3569 if ( type == XnPropertyNames::action::KProperty ) |
|
3570 { |
|
3571 const TDesC8& id( node->AttributeValue( XnPropertyNames::action::KValue ) ); |
|
3572 |
|
3573 if ( id != KNullDesC8 ) |
|
3574 { |
|
3575 HBufC* menuId( CnvUtfConverter::ConvertToUnicodeFromUtf8L( id ) ); |
|
3576 CleanupStack::PushL( menuId ); |
|
3577 |
|
3578 XnMenuInterface::MXnMenuInterface* menuIf( NULL ); |
|
3579 XnComponentInterface::MakeInterfaceL( menuIf, menubar->AppIfL() ); |
|
3580 |
|
3581 if ( menuIf ) |
|
3582 { |
|
3583 aEngine.Editor()->SetTargetPlugin( aEngine.FocusedNode() ); |
|
3584 menuIf->TryDisplayingMenuBarL( *menuId, EFalse ); |
|
3585 } |
|
3586 |
|
3587 CleanupStack::PopAndDestroy( menuId ); |
|
3588 } |
|
3589 } |
|
3590 } |
|
3591 } |
|
3592 } |
|
3593 |
|
3594 // ----------------------------------------------------------------------------- |
|
3595 // RunTryDisplayingListQueryDialogL |
|
3596 // ----------------------------------------------------------------------------- |
|
3597 // |
|
3598 static void RunTryDisplayingListQueryDialogL( |
|
3599 CXnNodeImpl* aThis, |
|
3600 CXnUiEngine& aEngine, |
|
3601 CXnDomNode& aEventNode ) |
|
3602 { |
|
3603 CXnDomList& children( aEventNode.ChildNodes() ); |
|
3604 |
|
3605 TInt count( children.Length() ); |
|
3606 |
|
3607 if ( count > 0 ) |
|
3608 { |
|
3609 CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( 0 ) ); |
|
3610 |
|
3611 const TDesC8& type( node->Name() ); |
|
3612 |
|
3613 if ( type == XnPropertyNames::action::KProperty ) |
|
3614 { |
|
3615 const TDesC8& id( |
|
3616 node->AttributeValue( XnPropertyNames::action::KValue ) ); |
|
3617 |
|
3618 if ( id != KNullDesC8 ) |
|
3619 { |
|
3620 CXnNode* dialog( aEngine.FindNodeByIdL( id, aThis->Namespace() ) ); |
|
3621 |
|
3622 if ( dialog && dialog->Type()->Type() == XnPropertyNames::listquerydialog::KListQueryDialog ) |
|
3623 { |
|
3624 CXnListQueryDialogAdapter* adapter = |
|
3625 static_cast< CXnListQueryDialogAdapter* > ( dialog->Control() ); |
|
3626 |
|
3627 adapter->TryDisplayingDialogL(); |
|
3628 } |
|
3629 |
|
3630 } |
|
3631 } |
|
3632 } |
|
3633 } |
|
3634 |
|
3635 // ----------------------------------------------------------------------------- |
|
3636 // RunTryDisplayingStylusPopupL |
|
3637 // ----------------------------------------------------------------------------- |
|
3638 // |
|
3639 static void RunTryDisplayingStylusPopupL( |
|
3640 CXnNodeImpl* aThis, |
|
3641 CXnNode& aNode, |
|
3642 CXnUiEngine& aEngine, |
|
3643 CXnDomNode& aEventNode ) |
|
3644 { |
|
3645 CXnDomList& children( aEventNode.ChildNodes() ); |
|
3646 |
|
3647 TInt count( children.Length() ); |
|
3648 |
|
3649 if ( count > 0 ) |
|
3650 { |
|
3651 CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( 0 ) ); |
|
3652 |
|
3653 const TDesC8& type( node->Name() ); |
|
3654 |
|
3655 if ( type == XnPropertyNames::action::KProperty ) |
|
3656 { |
|
3657 const TDesC8& id( node->AttributeValue( |
|
3658 XnPropertyNames::action::KValue ) ); |
|
3659 |
|
3660 if ( id != KNullDesC8 ) |
|
3661 { |
|
3662 CXnNode* popup( aEngine.FindNodeByIdL( id, aThis->Namespace() ) ); |
|
3663 |
|
3664 if ( popup && popup->Type()->Type() == _L8("styluspopup") ) |
|
3665 { |
|
3666 CXnPopupControlAdapter* adapter = |
|
3667 static_cast< CXnPopupControlAdapter* > ( popup->Control() ); |
|
3668 |
|
3669 adapter->TryDisplayingStylusPopupL( aNode ); |
|
3670 } |
|
3671 } |
|
3672 } |
|
3673 } |
|
3674 } |
|
3675 |
|
3676 // ----------------------------------------------------------------------------- |
|
3677 // RunSetInitialFocusL |
|
3678 // ----------------------------------------------------------------------------- |
|
3679 // |
|
3680 static void RunSetInitialFocusL( CXnUiEngine& aEngine ) |
|
3681 { |
|
3682 TBool editState( aEngine.EditMode()->EditState() ); |
|
3683 |
|
3684 CXnViewManager* manager( aEngine.ViewManager() ); |
|
3685 |
|
3686 RPointerArray< CXnNode >& pluginNodes( manager->PluginNodes() ); |
|
3687 |
|
3688 if ( editState ) |
|
3689 { |
|
3690 TBool pluginFocused( EFalse ); |
|
3691 |
|
3692 for ( TInt i = 0; i < pluginNodes.Count(); i++ ) |
|
3693 { |
|
3694 CXnNode* node( pluginNodes[i] ); |
|
3695 |
|
3696 if ( node->IsStateSet( XnPropertyNames::style::common::KFocus ) ) |
|
3697 { |
|
3698 pluginFocused = ETrue; |
|
3699 break; |
|
3700 } |
|
3701 } |
|
3702 |
|
3703 if ( !pluginFocused ) |
|
3704 { |
|
3705 for ( TInt i = 0; i < pluginNodes.Count(); i++ ) |
|
3706 { |
|
3707 CXnNode* node( pluginNodes[i] ); |
|
3708 |
|
3709 node->SetStateWithoutNotificationL( |
|
3710 XnPropertyNames::style::common::KFocus ); |
|
3711 |
|
3712 if ( node->IsStateSet( |
|
3713 XnPropertyNames::style::common::KFocus ) ) |
|
3714 { |
|
3715 break; |
|
3716 } |
|
3717 } |
|
3718 } |
|
3719 } |
|
3720 else |
|
3721 { |
|
3722 CXnViewData& viewData( manager->ActiveViewData() ); |
|
3723 |
|
3724 RPointerArray< CXnPluginData > plugins; |
|
3725 CleanupClosePushL( plugins ); |
|
3726 |
|
3727 for( TInt i = 0; i < pluginNodes.Count(); i++ ) |
|
3728 { |
|
3729 CXnPluginData* data( viewData.Plugin( pluginNodes[i] ) ); |
|
3730 |
|
3731 if( data && data->Occupied() ) |
|
3732 { |
|
3733 plugins.AppendL( data ); |
|
3734 } |
|
3735 } |
|
3736 |
|
3737 plugins.Append( &viewData ); |
|
3738 |
|
3739 RPointerArray< CXnNode > list; |
|
3740 CleanupClosePushL( list ); |
|
3741 |
|
3742 for( TInt i = 0; i < plugins.Count(); i++ ) |
|
3743 { |
|
3744 plugins[i]->InitialFocusNodesL( list ); |
|
3745 } |
|
3746 |
|
3747 for ( TInt i = 0; i < list.Count(); i++ ) |
|
3748 { |
|
3749 CXnNode* node( list[i] ); |
|
3750 |
|
3751 node->SetStateWithoutNotificationL( |
|
3752 XnPropertyNames::style::common::KFocus ); |
|
3753 |
|
3754 if ( node->IsStateSet( XnPropertyNames::style::common::KFocus ) ) |
|
3755 { |
|
3756 break; |
|
3757 } |
|
3758 } |
|
3759 |
|
3760 CleanupStack::PopAndDestroy( 2, &plugins ); // list |
|
3761 } |
|
3762 } |
|
3763 |
|
3764 // ----------------------------------------------------------------------------- |
|
3765 // RunSystemSetL |
|
3766 // ----------------------------------------------------------------------------- |
|
3767 // |
|
3768 static void RunSystemSetL( |
|
3769 CXnNodeImpl* aThis, |
|
3770 CXnUiEngine& aEngine, |
|
3771 CXnDomNode& aEventNode, |
|
3772 TBool aSettings, |
|
3773 const TDesC8& aId ) |
|
3774 { |
|
3775 HBufC8* id = NULL; |
|
3776 const TDesC8* pseudoClass = NULL; |
|
3777 const TDesC8* name = NULL; |
|
3778 const TDesC8* type = NULL; |
|
3779 const TDesC8* classId = NULL; |
|
3780 |
|
3781 RPointerArray< HBufC8 > values; |
|
3782 CleanupResetAndDestroyPushL( values ); |
|
3783 |
|
3784 GetSystemSetDataL( |
|
3785 aEventNode, id, &pseudoClass, &name, |
|
3786 &values, &type, aSettings, aId, &classId ); |
|
3787 |
|
3788 CleanupStack::PushL( id ); |
|
3789 |
|
3790 if ( !name && id ) |
|
3791 { |
|
3792 for ( TInt i = 0; i < values.Count(); i++ ) |
|
3793 { |
|
3794 const TDesC8* value = values[i]; |
|
3795 |
|
3796 RunSystemSetPCDataL( aThis, aEngine, *id, *value ); |
|
3797 } |
|
3798 } |
|
3799 else if ( name && id && type ) |
|
3800 { |
|
3801 CXnNode* node = aEngine.FindNodeByIdL( *id, aThis->Namespace() ); |
|
3802 |
|
3803 if ( *type == XnPropertyNames::action::event::systemset::type::KString ) |
|
3804 { |
|
3805 RunSystemSetStringL( |
|
3806 aEngine, node, *name, values, CXnDomPropertyValue::EString ); |
|
3807 } |
|
3808 else if ( *type == |
|
3809 XnPropertyNames::action::event::systemset::type::KNumeric ) |
|
3810 { |
|
3811 RunSystemSetNumberL( |
|
3812 aEngine, node, *name, values ); |
|
3813 } |
|
3814 else if ( *type == XnPropertyNames::action::event::systemset::type::KRGB ) |
|
3815 { |
|
3816 RunSystemSetRGBL( |
|
3817 aEngine, node, *name, values ); |
|
3818 } |
|
3819 else if ( *type == XnPropertyNames::action::event::systemset::type::KUrl ) |
|
3820 { |
|
3821 RunSystemSetStringL( |
|
3822 aEngine, node, *name, values, CXnDomPropertyValue::EUri ); |
|
3823 } |
|
3824 else if ( *type == |
|
3825 XnPropertyNames::action::event::systemset::type::KAttribute ) |
|
3826 { |
|
3827 RunSystemSetStringL( |
|
3828 aEngine, node, *name, values, CXnDomPropertyValue::EAttr ); |
|
3829 } |
|
3830 } |
|
3831 else if ( name && classId && type ) |
|
3832 { |
|
3833 CXnPointerArray* array = aEngine.FindNodeByClassL( *classId, aThis->Namespace() ); |
|
3834 CleanupStack::PushL( array ); |
|
3835 |
|
3836 const TInt count = array->Container().Count(); |
|
3837 |
|
3838 for ( TInt i = 0; i < count; ++i ) |
|
3839 { |
|
3840 CXnNode* node = static_cast< CXnNode* >(array->Container()[i]); |
|
3841 if ( *type == XnPropertyNames::action::event::systemset::type::KString ) |
|
3842 { |
|
3843 RunSystemSetStringL( |
|
3844 aEngine, node, *name, values, CXnDomPropertyValue::EString ); |
|
3845 } |
|
3846 else if ( *type == |
|
3847 XnPropertyNames::action::event::systemset::type::KNumeric ) |
|
3848 { |
|
3849 RunSystemSetNumberL( |
|
3850 aEngine, node, *name, values ); |
|
3851 } |
|
3852 else if ( *type == XnPropertyNames::action::event::systemset::type::KRGB ) |
|
3853 { |
|
3854 RunSystemSetRGBL( |
|
3855 aEngine, node, *name, values ); |
|
3856 } |
|
3857 else if ( *type == XnPropertyNames::action::event::systemset::type::KUrl ) |
|
3858 { |
|
3859 RunSystemSetStringL( |
|
3860 aEngine, node, *name, values, CXnDomPropertyValue::EUri ); |
|
3861 } |
|
3862 else if ( *type == |
|
3863 XnPropertyNames::action::event::systemset::type::KAttribute ) |
|
3864 { |
|
3865 RunSystemSetStringL( |
|
3866 aEngine, node, *name, values, CXnDomPropertyValue::EAttr ); |
|
3867 } |
|
3868 } |
|
3869 CleanupStack::PopAndDestroy( array ); |
|
3870 } |
|
3871 |
|
3872 CleanupStack::PopAndDestroy( 2, &values ); |
|
3873 } |
|
3874 |
|
3875 // ----------------------------------------------------------------------------- |
|
3876 // RunEventL |
|
3877 // ----------------------------------------------------------------------------- |
|
3878 // |
|
3879 static TBool RunEventL( |
|
3880 CXnNodeImpl* aThis, |
|
3881 CXnUiEngine& aEngine, |
|
3882 CXnNode& aNode, |
|
3883 CXnDomNode& aEventNode, |
|
3884 CXnDomNode& aTriggerNode, |
|
3885 CXnNode& aEventData ) |
|
3886 { |
|
3887 const TDesC8& nameString( aEventNode.AttributeValue( KName ) ); |
|
3888 |
|
3889 if ( nameString == KNullDesC8 ) |
|
3890 { |
|
3891 return EFalse; |
|
3892 } |
|
3893 |
|
3894 const TDesC8& system( XnPropertyNames::action::event::KSystemPrefix() ); |
|
3895 |
|
3896 if ( nameString.Find( system ) != 0 ) |
|
3897 { |
|
3898 // event doesn't contain "system/" prefix |
|
3899 RunAppUiNotificationL( aEngine, aNode, |
|
3900 aEventNode, aTriggerNode, aEventData ); |
|
3901 } |
|
3902 else if ( nameString == XnPropertyNames::action::event::KSetFocus ) |
|
3903 { |
|
3904 RPointerArray< CXnNode > focusCandidates; |
|
3905 CleanupClosePushL( focusCandidates ); |
|
3906 |
|
3907 GetFocusCandidatesL( aThis, aEngine, aEventNode, focusCandidates ); |
|
3908 |
|
3909 TBool retval( aNode.RunFocusChangeL( focusCandidates ) ); |
|
3910 |
|
3911 CleanupStack::PopAndDestroy( &focusCandidates ); |
|
3912 |
|
3913 return retval; |
|
3914 } |
|
3915 else if ( nameString == XnPropertyNames::action::event::KSetInitialFocus ) |
|
3916 { |
|
3917 RunSetInitialFocusL( aEngine ); |
|
3918 return ETrue; |
|
3919 } |
|
3920 else if ( nameString == XnPropertyNames::action::event::KSet ) |
|
3921 { |
|
3922 RunSystemSetL( aThis, aEngine, aEventNode ); |
|
3923 return ETrue; |
|
3924 } |
|
3925 else if ( nameString == XnPropertyNames::action::event::KSetPassiveFocus || |
|
3926 nameString == XnPropertyNames::action::event::KResetPassiveFocus || |
|
3927 nameString == XnPropertyNames::action::event::KSetActiveFocus ) |
|
3928 { |
|
3929 RunPassiveFocusChangeL( aThis, aEngine, aEventNode, nameString ); |
|
3930 return ETrue; |
|
3931 } |
|
3932 else if ( nameString == XnPropertyNames::action::event::KClearPassiveFocuses ) |
|
3933 { |
|
3934 aEngine.ClearPassiveFocusedNodesL(); |
|
3935 return ETrue; |
|
3936 } |
|
3937 else if ( nameString == XnPropertyNames::action::event::KSetEditMode ) |
|
3938 { |
|
3939 RunEditL( aThis, aEngine, aEventNode ); |
|
3940 return ETrue; |
|
3941 } |
|
3942 else if ( nameString == XnPropertyNames::action::event::KResetEditMode ) |
|
3943 { |
|
3944 RunResetEditL( aThis, aEngine, aEventNode ); |
|
3945 return ETrue; |
|
3946 } |
|
3947 else if ( nameString == XnPropertyNames::action::event::KRunAddWidgetQuery ) |
|
3948 { |
|
3949 aEngine.Editor()->AddWidgetL(); |
|
3950 } |
|
3951 else if ( nameString == XnPropertyNames::action::event::KRemoveFocusedWidget ) |
|
3952 { |
|
3953 aEngine.Editor()->RemoveWidgetL( aEngine.FocusedNode() ); |
|
3954 } |
|
3955 else if ( nameString == XnPropertyNames::action::event::KActivateNextView ) |
|
3956 { |
|
3957 RunActivateNextViewL( aEngine, aEventNode ); |
|
3958 } |
|
3959 else if ( nameString == XnPropertyNames::action::event::KActivatePreviousView ) |
|
3960 { |
|
3961 RunActivatePreviousViewL( aEngine, aEventNode ); |
|
3962 } |
|
3963 else if ( nameString == XnPropertyNames::action::event::KAddView ) |
|
3964 { |
|
3965 RunAddViewL( aEngine, aEventNode ); |
|
3966 } |
|
3967 else if ( nameString == XnPropertyNames::action::event::KRemoveView ) |
|
3968 { |
|
3969 RunRemoveViewL( aEngine, aEventNode ); |
|
3970 } |
|
3971 else if ( nameString == XnPropertyNames::action::event::KActivate ) |
|
3972 { |
|
3973 RunActivateL( aThis, aEngine, aEventNode ); |
|
3974 return ETrue; |
|
3975 } |
|
3976 else if ( nameString == XnPropertyNames::action::event::KActivateSelectedItem ) |
|
3977 { |
|
3978 CXnNode* focusedNode( aEngine.FocusedNode() ); |
|
3979 |
|
3980 if ( focusedNode ) |
|
3981 { |
|
3982 aEngine.AppUiAdapter().ItemActivator().ActivateL( focusedNode ); |
|
3983 } |
|
3984 |
|
3985 return ETrue; |
|
3986 } |
|
3987 else if ( nameString == XnPropertyNames::action::event::KDeactivate ) |
|
3988 { |
|
3989 RunDeactivateL( aThis, aEngine, aEventNode ); |
|
3990 return ETrue; |
|
3991 } |
|
3992 else if ( nameString == XnPropertyNames::action::event::KTryDisplayingMenu ) |
|
3993 { |
|
3994 RunTryDisplayingMenuL( aEngine, aEventNode ); |
|
3995 } |
|
3996 else if ( nameString == |
|
3997 XnPropertyNames::action::event::KTryDisplayingListQueryDialog ) |
|
3998 { |
|
3999 RunTryDisplayingListQueryDialogL( aThis, aEngine, aEventNode ); |
|
4000 } |
|
4001 else if ( nameString == XnPropertyNames::action::event::KTryDisplayingStylusPopup ) |
|
4002 { |
|
4003 RunTryDisplayingStylusPopupL( aThis, aNode, aEngine, aEventNode ); |
|
4004 return ETrue; |
|
4005 } |
|
4006 else if ( nameString == XnPropertyNames::action::event::KToggleWidgetsVisibilty ) |
|
4007 { |
|
4008 aEngine.Editor()->ToggleWidgetsVisibiltyL(); |
|
4009 |
|
4010 // check if focused widget need to be changed |
|
4011 CXnNode* focused( aEngine.FocusedNode() ); |
|
4012 |
|
4013 if ( !focused || !IsNodeNavigableL( focused ) ) |
|
4014 { |
|
4015 RunSetInitialFocusL( aEngine ); |
|
4016 } |
|
4017 |
|
4018 return ETrue; |
|
4019 } |
|
4020 else if ( nameString == XnPropertyNames::action::event::KReportEnterEditMode ) |
|
4021 |
|
4022 { |
|
4023 RunFullScreenEffectL( aEngine, aEventNode ); |
|
4024 |
|
4025 CXnNode* trigger( BuildTriggerNodeL( aEngine, |
|
4026 XnPropertyNames::action::trigger::name::KEditMode ) ); |
|
4027 CleanupStack::PushL( trigger ); |
|
4028 |
|
4029 CXnDomStringPool* sp( aEngine.ODT()->DomDocument().StringPool() ); |
|
4030 |
|
4031 CXnProperty* value( CXnProperty::NewL( |
|
4032 XnPropertyNames::action::KValue, |
|
4033 XnPropertyNames::action::trigger::name::editmode::KEnter, |
|
4034 CXnDomPropertyValue::EString, *sp ) ); |
|
4035 CleanupStack::PushL( value ); |
|
4036 |
|
4037 trigger->SetPropertyL( value ); |
|
4038 CleanupStack::Pop( value ); |
|
4039 |
|
4040 aEngine.ActiveView()->ReportXuikonEventL( *trigger ); |
|
4041 |
|
4042 CleanupStack::PopAndDestroy( trigger ); |
|
4043 |
|
4044 return ETrue; |
|
4045 } |
|
4046 else if( nameString == XnPropertyNames::action::event::KReportExitEditMode ) |
|
4047 { |
|
4048 RunFullScreenEffectL( aEngine, aEventNode ); |
|
4049 |
|
4050 CXnNode* trigger( BuildTriggerNodeL( aEngine, |
|
4051 XnPropertyNames::action::trigger::name::KEditMode ) ); |
|
4052 CleanupStack::PushL( trigger ); |
|
4053 |
|
4054 CXnDomStringPool* sp( aEngine.ODT()->DomDocument().StringPool() ); |
|
4055 |
|
4056 CXnProperty* value( CXnProperty::NewL( |
|
4057 XnPropertyNames::action::KValue, |
|
4058 XnPropertyNames::action::trigger::name::editmode::KExit, |
|
4059 CXnDomPropertyValue::EString, *sp ) ); |
|
4060 CleanupStack::PushL( value ); |
|
4061 |
|
4062 trigger->SetPropertyL( value ); |
|
4063 CleanupStack::Pop( value ); |
|
4064 |
|
4065 aEngine.ActiveView()->ReportXuikonEventL( *trigger ); |
|
4066 |
|
4067 CleanupStack::PopAndDestroy( trigger ); |
|
4068 |
|
4069 return ETrue; |
|
4070 } |
|
4071 else if ( nameString == XnPropertyNames::action::event::KSetWallpaper ) |
|
4072 { |
|
4073 aEngine.AppUiAdapter().ViewAdapter().BgManager().SetWallpaperL(); |
|
4074 return ETrue; |
|
4075 } |
|
4076 else if ( nameString == XnPropertyNames::action::event::KActivateTextEditor) |
|
4077 { |
|
4078 RunActivateEditorL( aThis, aNode, aEngine, aEventNode, ETrue ); |
|
4079 return ETrue; |
|
4080 } |
|
4081 else if ( nameString == XnPropertyNames::action::event::KDeactivateTextEditor) |
|
4082 { |
|
4083 RunActivateEditorL( aThis, aNode, aEngine, aEventNode, EFalse ); |
|
4084 return ETrue; |
|
4085 } |
|
4086 return EFalse; |
|
4087 } |
|
4088 |
|
4089 // ----------------------------------------------------------------------------- |
|
4090 // RunEventsL |
|
4091 // ----------------------------------------------------------------------------- |
|
4092 // |
|
4093 static void RunEventsL( |
|
4094 CXnNodeImpl* aThis, |
|
4095 CXnUiEngine& aEngine, |
|
4096 CXnNode& aNode, |
|
4097 CXnDomNode& aActionNode, |
|
4098 CXnDomNode& aTriggerNode, |
|
4099 CXnNode& aEventData ) |
|
4100 { |
|
4101 CXnDomList& children = aActionNode.ChildNodes(); |
|
4102 TInt count = children.Length(); |
|
4103 TBool render = EFalse; |
|
4104 for ( TInt i = 0; i < count; ++i ) |
|
4105 { |
|
4106 CXnDomNode* node = static_cast< CXnDomNode* >(children.Item( i ) ); |
|
4107 const TDesC8& type = node->Name(); |
|
4108 if ( type == XnPropertyNames::action::KEvent ) |
|
4109 { |
|
4110 TBool tmp = RunEventL( |
|
4111 aThis, aEngine, aNode, *node, aTriggerNode, aEventData ); |
|
4112 if ( !render ) |
|
4113 { |
|
4114 render = tmp; |
|
4115 } |
|
4116 } |
|
4117 } |
|
4118 if ( render ) |
|
4119 { |
|
4120 aEngine.RenderUIL( NULL ); |
|
4121 } |
|
4122 } |
|
4123 |
|
4124 // ----------------------------------------------------------------------------- |
|
4125 // DoMatchTriggerForHighLevelKeyEventL |
|
4126 // ----------------------------------------------------------------------------- |
|
4127 // |
|
4128 static TBool DoMatchTriggerForHighLevelKeyEventL( |
|
4129 CXnNode& aNode, |
|
4130 const TKeyEvent& aKeyEvent, |
|
4131 TEventCode aType, |
|
4132 const TDesC8& aHighLevelKey ) |
|
4133 { |
|
4134 const TDesC8* key; |
|
4135 |
|
4136 switch ( aKeyEvent.iCode ) |
|
4137 { |
|
4138 case EKeyLeftArrow: |
|
4139 key = &XnPropertyNames::action::trigger::name::KLeft; |
|
4140 break; |
|
4141 case EKeyRightArrow: |
|
4142 key = &XnPropertyNames::action::trigger::name::KRight; |
|
4143 break; |
|
4144 case EKeyUpArrow: |
|
4145 key = &XnPropertyNames::action::trigger::name::KUp; |
|
4146 break; |
|
4147 case EKeyDownArrow: |
|
4148 key = &XnPropertyNames::action::trigger::name::KDown; |
|
4149 break; |
|
4150 default: |
|
4151 key = NULL; |
|
4152 break; |
|
4153 } |
|
4154 |
|
4155 if ( !key || aType != EEventKey ) |
|
4156 { |
|
4157 return EFalse; |
|
4158 } |
|
4159 |
|
4160 CXnNode* parent( aNode.Parent() ); |
|
4161 |
|
4162 if ( !parent || aNode.ViewNodeImpl() ) |
|
4163 { |
|
4164 if ( *key == aHighLevelKey ) |
|
4165 { |
|
4166 return ETrue; |
|
4167 } |
|
4168 } |
|
4169 else |
|
4170 { |
|
4171 const TDesC8* direction( |
|
4172 &XnPropertyNames::style::common::direction::KLTR ); |
|
4173 const TDesC8* orientation( |
|
4174 &XnPropertyNames::style::common::block_progression::KTB ); |
|
4175 |
|
4176 CXnProperty* directionProperty( parent->DirectionL() ); |
|
4177 |
|
4178 if ( directionProperty ) |
|
4179 { |
|
4180 direction = &directionProperty->StringValue(); |
|
4181 } |
|
4182 |
|
4183 CXnProperty* orientationProperty( parent->BlockProgressionL() ); |
|
4184 |
|
4185 if ( orientationProperty ) |
|
4186 { |
|
4187 orientation = &orientationProperty->StringValue(); |
|
4188 } |
|
4189 |
|
4190 if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
4191 ( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
4192 *orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
4193 { |
|
4194 if ( *key == aHighLevelKey ) |
|
4195 { |
|
4196 return ETrue; |
|
4197 } |
|
4198 } |
|
4199 else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
4200 ( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
4201 *orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
4202 { |
|
4203 if ( *key == XnPropertyNames::action::trigger::name::KRight && |
|
4204 aHighLevelKey == XnPropertyNames::action::trigger::name::KLeft ) |
|
4205 { |
|
4206 return ETrue; |
|
4207 } |
|
4208 |
|
4209 if ( *key == XnPropertyNames::action::trigger::name::KLeft && |
|
4210 aHighLevelKey == XnPropertyNames::action::trigger::name::KRight ) |
|
4211 { |
|
4212 return ETrue; |
|
4213 } |
|
4214 |
|
4215 if ( *key == XnPropertyNames::action::trigger::name::KDown && |
|
4216 aHighLevelKey == XnPropertyNames::action::trigger::name::KDown ) |
|
4217 { |
|
4218 return ETrue; |
|
4219 } |
|
4220 |
|
4221 if ( *key == XnPropertyNames::action::trigger::name::KUp && |
|
4222 aHighLevelKey == XnPropertyNames::action::trigger::name::KUp ) |
|
4223 { |
|
4224 return ETrue; |
|
4225 } |
|
4226 } |
|
4227 else if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
4228 *orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
4229 { |
|
4230 if ( *key == XnPropertyNames::action::trigger::name::KUp && |
|
4231 aHighLevelKey == XnPropertyNames::action::trigger::name::KLeft ) |
|
4232 { |
|
4233 return ETrue; |
|
4234 } |
|
4235 |
|
4236 if ( *key == XnPropertyNames::action::trigger::name::KDown && |
|
4237 aHighLevelKey == XnPropertyNames::action::trigger::name::KRight ) |
|
4238 { |
|
4239 return ETrue; |
|
4240 } |
|
4241 |
|
4242 if ( *key == XnPropertyNames::action::trigger::name::KLeft && |
|
4243 aHighLevelKey == XnPropertyNames::action::trigger::name::KDown ) |
|
4244 { |
|
4245 return ETrue; |
|
4246 } |
|
4247 |
|
4248 if ( *key == XnPropertyNames::action::trigger::name::KRight && |
|
4249 aHighLevelKey == XnPropertyNames::action::trigger::name::KUp ) |
|
4250 { |
|
4251 return ETrue; |
|
4252 } |
|
4253 } |
|
4254 else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
4255 *orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
4256 { |
|
4257 if ( *key == XnPropertyNames::action::trigger::name::KDown && |
|
4258 aHighLevelKey == XnPropertyNames::action::trigger::name::KLeft ) |
|
4259 { |
|
4260 return ETrue; |
|
4261 } |
|
4262 |
|
4263 if ( *key == XnPropertyNames::action::trigger::name::KUp && |
|
4264 aHighLevelKey == XnPropertyNames::action::trigger::name::KRight ) |
|
4265 { |
|
4266 return ETrue; |
|
4267 } |
|
4268 |
|
4269 if ( *key == XnPropertyNames::action::trigger::name::KLeft && |
|
4270 aHighLevelKey == XnPropertyNames::action::trigger::name::KDown ) |
|
4271 { |
|
4272 return ETrue; |
|
4273 } |
|
4274 |
|
4275 if ( *key == XnPropertyNames::action::trigger::name::KRight && |
|
4276 aHighLevelKey == XnPropertyNames::action::trigger::name::KUp ) |
|
4277 { |
|
4278 return ETrue; |
|
4279 } |
|
4280 } |
|
4281 } |
|
4282 |
|
4283 return EFalse; |
|
4284 } |
|
4285 |
|
4286 // ----------------------------------------------------------------------------- |
|
4287 // MatchActionForKeyEventL |
|
4288 // ----------------------------------------------------------------------------- |
|
4289 // |
|
4290 static TBool MatchActionForKeyEventL( |
|
4291 CXnNodeImpl* aThis, |
|
4292 CXnUiEngine& aEngine, |
|
4293 CXnNode& aNode, |
|
4294 const TKeyEvent& aKeyEvent, TEventCode aType, |
|
4295 CXnDomNode& aActionNode ) |
|
4296 { |
|
4297 CXnDomList& children = aActionNode.ChildNodes(); |
|
4298 TInt count = children.Length(); |
|
4299 for ( TInt i = 0; i < count; ++i ) |
|
4300 { |
|
4301 CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
4302 const TDesC8& type = node->Name(); |
|
4303 if ( type == XnPropertyNames::action::KTrigger ) |
|
4304 { |
|
4305 if ( node && ( IsTriggerRunnableL( *node ) || IsTriggerActiveL( *node ) ) ) |
|
4306 { |
|
4307 TBool match = MatchTriggerForKeyEventL( |
|
4308 aThis, aEngine, aNode, aKeyEvent, aType, aActionNode, *node ); |
|
4309 if ( match ) |
|
4310 { |
|
4311 return match; |
|
4312 } |
|
4313 } |
|
4314 } |
|
4315 } |
|
4316 return EFalse; |
|
4317 } |
|
4318 |
|
4319 // ----------------------------------------------------------------------------- |
|
4320 // IsTriggerActiveL |
|
4321 // ----------------------------------------------------------------------------- |
|
4322 // |
|
4323 static TBool IsTriggerActiveL( CXnDomNode& aNode ) |
|
4324 { |
|
4325 CXnDomList& propList = aNode.PropertyList(); |
|
4326 TInt count = propList.Length(); |
|
4327 for ( TInt j = 0; j < count; j++ ) |
|
4328 { |
|
4329 CXnDomProperty* prop = static_cast< CXnDomProperty* >( propList.Item( j ) ); |
|
4330 const TDesC8& propName = prop->Name(); |
|
4331 if ( propName == XnPropertyNames::style::common::KDisplay ) |
|
4332 { |
|
4333 CXnDomList& propValList = prop->PropertyValueList(); |
|
4334 TInt propValCount(propValList.Length()); |
|
4335 for ( TInt k = 0; k < propValCount; k++ ) |
|
4336 { |
|
4337 CXnDomPropertyValue* propVal = |
|
4338 static_cast< CXnDomPropertyValue* >( propValList.Item( k ) ); |
|
4339 CXnDomPropertyValue::TPrimitiveValueType type = |
|
4340 propVal->PrimitiveValueType(); |
|
4341 switch ( type ) |
|
4342 { |
|
4343 case CXnDomPropertyValue::EString: |
|
4344 case CXnDomPropertyValue::EIdent: |
|
4345 case CXnDomPropertyValue::EUri: |
|
4346 case CXnDomPropertyValue::EAttr: |
|
4347 case CXnDomPropertyValue::EUnknown: |
|
4348 { |
|
4349 const TDesC8& value = propVal->StringValueL(); |
|
4350 if ( value == XnPropertyNames::style::common::display::KNone ) |
|
4351 { |
|
4352 return EFalse; |
|
4353 } |
|
4354 else |
|
4355 { |
|
4356 return ETrue; |
|
4357 } |
|
4358 } |
|
4359 } |
|
4360 } |
|
4361 } |
|
4362 } |
|
4363 return ETrue; |
|
4364 } |
|
4365 |
|
4366 // ----------------------------------------------------------------------------- |
|
4367 // MatchActionForEventL |
|
4368 // ----------------------------------------------------------------------------- |
|
4369 // |
|
4370 static TBool MatchActionForEventL( |
|
4371 CXnNodeImpl* aThis, |
|
4372 CXnUiEngine& aEngine, |
|
4373 CXnNode& aNode, |
|
4374 CXnNode& aEventData, |
|
4375 CXnDomNode& aActionNode, |
|
4376 TInt aSource ) |
|
4377 { |
|
4378 CXnDomList& children = aActionNode.ChildNodes(); |
|
4379 TInt count = children.Length(); |
|
4380 for ( TInt i = 0; i < count; ++i ) |
|
4381 { |
|
4382 CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
4383 const TDesC8& type = node->Name(); |
|
4384 if ( type == XnPropertyNames::action::KTrigger && |
|
4385 node && IsTriggerRunnableL( *node ) ) |
|
4386 { |
|
4387 TBool match = MatchTriggerForEventL( |
|
4388 aThis, aEngine, aNode, aEventData, aActionNode, *node, aSource ); |
|
4389 if ( match ) |
|
4390 { |
|
4391 return match; |
|
4392 } |
|
4393 } |
|
4394 } |
|
4395 return EFalse; |
|
4396 } |
|
4397 |
|
4398 // ----------------------------------------------------------------------------- |
|
4399 // FindLoopedFocusableNodeL |
|
4400 // ----------------------------------------------------------------------------- |
|
4401 // |
|
4402 static CXnNode* FindLoopedFocusableNodeL( CXnNode& aNode, TBool aForward ) |
|
4403 { |
|
4404 if ( aNode.ViewNodeImpl() ) |
|
4405 { |
|
4406 return NULL; |
|
4407 } |
|
4408 CXnNode* nextNode = NULL; |
|
4409 CXnProperty* navLoopProperty = aNode.GetPropertyL( |
|
4410 XnPropertyNames::style::common::KS60NavLooping ); |
|
4411 if ( navLoopProperty ) |
|
4412 { |
|
4413 const TDesC8& loopValue = navLoopProperty->StringValue(); |
|
4414 if ( loopValue != KNullDesC8 && |
|
4415 loopValue == XnPropertyNames::style::common::s60_focus_looping::KStop ) |
|
4416 { |
|
4417 return NULL; |
|
4418 } |
|
4419 } |
|
4420 if ( aForward ) |
|
4421 { |
|
4422 nextNode = ForwardLoopL( aNode ); |
|
4423 } |
|
4424 else |
|
4425 { |
|
4426 nextNode = BackwardLoopL( aNode ); |
|
4427 } |
|
4428 return nextNode; |
|
4429 } |
|
4430 |
|
4431 // ----------------------------------------------------------------------------- |
|
4432 // GetNavIndexL |
|
4433 // ----------------------------------------------------------------------------- |
|
4434 // |
|
4435 static CXnDomPropertyValue* GetNavIndexL( CXnNode& aNode ) |
|
4436 { |
|
4437 CXnProperty* navIndexProperty = aNode.NavIndexL(); |
|
4438 CXnDomPropertyValue* value = NULL; |
|
4439 if ( navIndexProperty ) |
|
4440 { |
|
4441 value = static_cast< CXnDomPropertyValue* >( |
|
4442 navIndexProperty->Property()->PropertyValueList().Item( 0 ) ); |
|
4443 } |
|
4444 return value; |
|
4445 } |
|
4446 |
|
4447 // ----------------------------------------------------------------------------- |
|
4448 // ForwardL |
|
4449 // ----------------------------------------------------------------------------- |
|
4450 // |
|
4451 static CXnNode* ForwardL( CXnNode& aNode ) |
|
4452 { |
|
4453 RPointerArray< CXnNode >& siblings = aNode.Parent()->Children(); |
|
4454 CXnNode* nextNode = NULL; |
|
4455 CXnDomPropertyValue* navIndexValue = GetNavIndexL( aNode ); |
|
4456 CXnDomPropertyValue* prevIndexValue = NULL; |
|
4457 CXnDomPropertyValue* tmpIndexValue = NULL; |
|
4458 TInt count = siblings.Count(); |
|
4459 TInt nodePosition = count; |
|
4460 TBool first = ETrue; |
|
4461 for ( TInt i = 0; i < count; ++i ) |
|
4462 { |
|
4463 CXnNode* tmpNode = siblings[i]; |
|
4464 if ( tmpNode == &aNode ) |
|
4465 { |
|
4466 nodePosition = i; |
|
4467 continue; |
|
4468 } |
|
4469 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4470 { |
|
4471 continue; |
|
4472 } |
|
4473 tmpIndexValue = GetNavIndexL( *tmpNode ); |
|
4474 if ( tmpIndexValue ) |
|
4475 { |
|
4476 if ( tmpIndexValue->IsNoneIdent() ) |
|
4477 { |
|
4478 // nav index set as none, skipping |
|
4479 continue; |
|
4480 } |
|
4481 } |
|
4482 if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) == 0 ) && |
|
4483 ( first || |
|
4484 ( CompareNavIndexesL( tmpIndexValue, prevIndexValue ) < 0 ) ) && |
|
4485 ( i > nodePosition ) ) |
|
4486 { |
|
4487 first = EFalse; |
|
4488 prevIndexValue = tmpIndexValue; |
|
4489 nextNode = tmpNode; |
|
4490 } |
|
4491 else if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) > 0 ) && |
|
4492 ( first || |
|
4493 ( CompareNavIndexesL( tmpIndexValue, prevIndexValue ) < 0 ) ) ) |
|
4494 { |
|
4495 first = EFalse; |
|
4496 prevIndexValue = tmpIndexValue; |
|
4497 nextNode = tmpNode; |
|
4498 } |
|
4499 } |
|
4500 return nextNode; |
|
4501 } |
|
4502 |
|
4503 // ----------------------------------------------------------------------------- |
|
4504 // ForwardLoopL |
|
4505 // ----------------------------------------------------------------------------- |
|
4506 // |
|
4507 static CXnNode* ForwardLoopL( CXnNode& aNode ) |
|
4508 { |
|
4509 RPointerArray< CXnNode >& siblings = aNode.Parent()->Children(); |
|
4510 CXnNode* nextNode = NULL; |
|
4511 CXnDomPropertyValue* navIndexValue = GetNavIndexL( aNode ); |
|
4512 CXnDomPropertyValue* tmpIndexValue = NULL; |
|
4513 CXnDomPropertyValue* prevIndexValue = NULL; |
|
4514 TInt count = siblings.Count(); |
|
4515 TInt nodePosition = count; |
|
4516 TBool first = ETrue; |
|
4517 for ( TInt i = 0; i < count; ++i ) |
|
4518 { |
|
4519 CXnNode* tmpNode = siblings[i]; |
|
4520 if ( tmpNode == &aNode ) |
|
4521 { |
|
4522 nodePosition = i; |
|
4523 continue; |
|
4524 } |
|
4525 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4526 { |
|
4527 continue; |
|
4528 } |
|
4529 tmpIndexValue = GetNavIndexL( *tmpNode ); |
|
4530 if ( tmpIndexValue ) |
|
4531 { |
|
4532 if ( tmpIndexValue->IsNoneIdent() ) |
|
4533 { |
|
4534 // nav index set as none, skipping |
|
4535 continue; |
|
4536 } |
|
4537 } |
|
4538 if ( ( CompareNavIndexesL( navIndexValue, tmpIndexValue ) == 0 ) && |
|
4539 ( first || |
|
4540 ( CompareNavIndexesL( tmpIndexValue, prevIndexValue ) < 0 ) ) && |
|
4541 ( i < nodePosition ) ) |
|
4542 { |
|
4543 first = EFalse; |
|
4544 prevIndexValue = tmpIndexValue; |
|
4545 nextNode = tmpNode; |
|
4546 } |
|
4547 else if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) < 0 ) && |
|
4548 ( first || |
|
4549 ( CompareNavIndexesL( tmpIndexValue, prevIndexValue ) < 0 ) ) ) |
|
4550 { |
|
4551 first = EFalse; |
|
4552 prevIndexValue = tmpIndexValue; |
|
4553 nextNode = tmpNode; |
|
4554 } |
|
4555 } |
|
4556 return nextNode; |
|
4557 } |
|
4558 |
|
4559 // ----------------------------------------------------------------------------- |
|
4560 // BackwardL |
|
4561 // ----------------------------------------------------------------------------- |
|
4562 // |
|
4563 static CXnNode* BackwardL( CXnNode& aNode ) |
|
4564 { |
|
4565 RPointerArray< CXnNode >& siblings = aNode.Parent()->Children(); |
|
4566 CXnNode* nextNode = NULL; |
|
4567 CXnDomPropertyValue* navIndexValue = GetNavIndexL( aNode ); |
|
4568 CXnDomPropertyValue* tmpIndexValue = NULL; |
|
4569 TInt count = siblings.Count(); |
|
4570 CXnDomPropertyValue* nextIndexValue = GetNavIndexL( *siblings[count - 1] ); |
|
4571 TInt nodePosition = 0; |
|
4572 TBool first = ETrue; |
|
4573 for ( TInt i = count - 1; i > -1; --i ) |
|
4574 { |
|
4575 CXnNode* tmpNode = siblings[i]; |
|
4576 if ( tmpNode == &aNode ) |
|
4577 { |
|
4578 nodePosition = i; |
|
4579 continue; |
|
4580 } |
|
4581 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4582 { |
|
4583 continue; |
|
4584 } |
|
4585 tmpIndexValue = GetNavIndexL( *tmpNode ); |
|
4586 if ( tmpIndexValue ) |
|
4587 { |
|
4588 if ( tmpIndexValue->IsNoneIdent() ) |
|
4589 { |
|
4590 // nav index set as none, skipping |
|
4591 continue; |
|
4592 } |
|
4593 } |
|
4594 if ( ( CompareNavIndexesL( navIndexValue, tmpIndexValue ) == 0 ) && |
|
4595 ( first || |
|
4596 ( CompareNavIndexesL( tmpIndexValue, nextIndexValue ) > 0 ) ) && |
|
4597 ( i < nodePosition ) ) |
|
4598 { |
|
4599 first = EFalse; |
|
4600 nextIndexValue = tmpIndexValue; |
|
4601 nextNode = tmpNode; |
|
4602 } |
|
4603 else if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) < 0 ) && |
|
4604 ( first || |
|
4605 ( CompareNavIndexesL( tmpIndexValue, nextIndexValue ) > 0 ) ) ) |
|
4606 { |
|
4607 first = EFalse; |
|
4608 nextIndexValue = tmpIndexValue; |
|
4609 nextNode = tmpNode; |
|
4610 } |
|
4611 } |
|
4612 return nextNode; |
|
4613 } |
|
4614 |
|
4615 // ----------------------------------------------------------------------------- |
|
4616 // BackwardLoopL |
|
4617 // ----------------------------------------------------------------------------- |
|
4618 // |
|
4619 static CXnNode* BackwardLoopL( CXnNode& aNode ) |
|
4620 { |
|
4621 RPointerArray<CXnNode>& siblings = aNode.Parent()->Children(); |
|
4622 CXnNode* nextNode = NULL; |
|
4623 CXnDomPropertyValue* navIndexValue = GetNavIndexL( aNode ); |
|
4624 CXnDomPropertyValue* tmpIndexValue = NULL; |
|
4625 TInt count = siblings.Count(); |
|
4626 CXnDomPropertyValue* nextIndexValue = GetNavIndexL( *siblings[count - 1] ); |
|
4627 TInt nodePosition = 0; |
|
4628 TBool first = ETrue; |
|
4629 for ( TInt i = count - 1; i > -1; --i ) |
|
4630 { |
|
4631 CXnNode* tmpNode = siblings[i]; |
|
4632 if ( tmpNode == &aNode ) |
|
4633 { |
|
4634 nodePosition = i; |
|
4635 continue; |
|
4636 } |
|
4637 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4638 { |
|
4639 continue; |
|
4640 } |
|
4641 tmpIndexValue = GetNavIndexL( *tmpNode ); |
|
4642 if ( tmpIndexValue ) |
|
4643 { |
|
4644 if ( tmpIndexValue->IsNoneIdent() ) |
|
4645 { |
|
4646 // nav index set as none, skipping |
|
4647 continue; |
|
4648 } |
|
4649 } |
|
4650 if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) == 0 ) && |
|
4651 ( first || |
|
4652 ( CompareNavIndexesL( tmpIndexValue, nextIndexValue ) > 0 ) ) && |
|
4653 ( i > nodePosition ) ) |
|
4654 { |
|
4655 first = EFalse; |
|
4656 nextIndexValue = tmpIndexValue; |
|
4657 nextNode = tmpNode; |
|
4658 } |
|
4659 else if ( ( CompareNavIndexesL( tmpIndexValue, navIndexValue ) > 0 ) && |
|
4660 ( first || |
|
4661 ( CompareNavIndexesL( tmpIndexValue, nextIndexValue ) > 0 ) ) ) |
|
4662 { |
|
4663 first = EFalse; |
|
4664 nextIndexValue = tmpIndexValue; |
|
4665 nextNode = tmpNode; |
|
4666 } |
|
4667 } |
|
4668 return nextNode; |
|
4669 } |
|
4670 |
|
4671 // ----------------------------------------------------------------------------- |
|
4672 // CompareNavIndexesL |
|
4673 // ----------------------------------------------------------------------------- |
|
4674 // |
|
4675 static TInt CompareNavIndexesL( |
|
4676 CXnDomPropertyValue* aCurrentPropertyValue, |
|
4677 CXnDomPropertyValue* aNextPropertyValue ) |
|
4678 { |
|
4679 if ( !aCurrentPropertyValue && !aNextPropertyValue ) |
|
4680 { |
|
4681 return 0; |
|
4682 } |
|
4683 else if ( aCurrentPropertyValue && !aNextPropertyValue ) |
|
4684 { |
|
4685 if ( aCurrentPropertyValue->IsAutoIdent() ) |
|
4686 { |
|
4687 return 0; |
|
4688 } |
|
4689 return 1; |
|
4690 } |
|
4691 else if ( !aCurrentPropertyValue && aNextPropertyValue ) |
|
4692 { |
|
4693 if ( aNextPropertyValue->IsAutoIdent() ) |
|
4694 { |
|
4695 return 0; |
|
4696 } |
|
4697 return -1; |
|
4698 } |
|
4699 else if ( aCurrentPropertyValue->IsAutoIdent() && |
|
4700 aNextPropertyValue->IsAutoIdent() ) |
|
4701 { |
|
4702 return 0; |
|
4703 } |
|
4704 else if ( !aCurrentPropertyValue->IsAutoIdent() && |
|
4705 aNextPropertyValue->IsAutoIdent() ) |
|
4706 { |
|
4707 return 1; |
|
4708 } |
|
4709 else if ( aCurrentPropertyValue->IsAutoIdent() && |
|
4710 !aNextPropertyValue->IsAutoIdent() ) |
|
4711 { |
|
4712 return -1; |
|
4713 } |
|
4714 else |
|
4715 { |
|
4716 return |
|
4717 aCurrentPropertyValue->FloatValueL() < aNextPropertyValue->FloatValueL() ? |
|
4718 -1 : |
|
4719 aCurrentPropertyValue->FloatValueL() == aNextPropertyValue->FloatValueL() ? |
|
4720 0 : |
|
4721 1; |
|
4722 } |
|
4723 } |
|
4724 |
|
4725 // ----------------------------------------------------------------------------- |
|
4726 // FindNextFocusableNodeByNavIndexL |
|
4727 // ----------------------------------------------------------------------------- |
|
4728 // |
|
4729 static CXnNode* FindNextFocusableNodeByNavIndexL( CXnNode& aNode, TBool aForward ) |
|
4730 { |
|
4731 if ( aNode.ViewNodeImpl() ) |
|
4732 { |
|
4733 return NULL; |
|
4734 } |
|
4735 CXnNode* nextNode = NULL; |
|
4736 if ( aForward ) |
|
4737 { |
|
4738 nextNode = ForwardL( aNode ); |
|
4739 } |
|
4740 else |
|
4741 { |
|
4742 nextNode = BackwardL( aNode ); |
|
4743 } |
|
4744 return nextNode; |
|
4745 } |
|
4746 |
|
4747 // ----------------------------------------------------------------------------- |
|
4748 // FindNextFocusableNodeL |
|
4749 // ----------------------------------------------------------------------------- |
|
4750 // |
|
4751 TBool FindNextFocusableNodeL( CXnNode& aNode, TBool aForward ) |
|
4752 { |
|
4753 CXnNode* node( FindNextFocusableNodeByNavIndexL( aNode, aForward ) ); |
|
4754 |
|
4755 if ( !node ) |
|
4756 { |
|
4757 node = FindLoopedFocusableNodeL( aNode, aForward ); |
|
4758 } |
|
4759 |
|
4760 if ( node ) |
|
4761 { |
|
4762 node->SetStateL( XnPropertyNames::style::common::KFocus ); |
|
4763 if( node && node->ScrollableControl() ) |
|
4764 { |
|
4765 node->ScrollableControl()->ShowItem( *node ); |
|
4766 } |
|
4767 return ETrue; |
|
4768 } |
|
4769 |
|
4770 return EFalse; |
|
4771 } |
|
4772 |
|
4773 // ----------------------------------------------------------------------------- |
|
4774 // FindNextNodeFromRightL |
|
4775 // ----------------------------------------------------------------------------- |
|
4776 // |
|
4777 static CXnNode* FindNextNodeFromRightL( |
|
4778 RPointerArray< CXnNode >& aArray, |
|
4779 CXnNode& aNode, |
|
4780 TBool stayInNamespace, |
|
4781 CXnUiEngine* aEngine ) |
|
4782 { |
|
4783 |
|
4784 CXnNode* nextNode = NULL; |
|
4785 TRect rect = aNode.PaddingRect(); |
|
4786 |
|
4787 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
4788 { |
|
4789 CXnNode* tmpNode = aArray[i]; |
|
4790 if ( tmpNode == &aNode ) |
|
4791 { |
|
4792 continue; |
|
4793 } |
|
4794 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4795 { |
|
4796 continue; |
|
4797 } |
|
4798 if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
4799 { |
|
4800 // do not shift focus to another view |
|
4801 continue; |
|
4802 } |
|
4803 |
|
4804 const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
4805 const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
4806 |
|
4807 if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
4808 { |
|
4809 // if staying in the same namespace is required, |
|
4810 // do not shift focus to a different namespace |
|
4811 continue; |
|
4812 } |
|
4813 |
|
4814 // TODO: only plugin widgets are available in edit mode |
|
4815 |
|
4816 TRect tmpRect = tmpNode->PaddingRect(); |
|
4817 |
|
4818 // temp node qualification: |
|
4819 // 1. left edge of temp node is to the right from focused's right edge |
|
4820 // 2. top edge of temp node is NOT below the bottom edge of focused node |
|
4821 // 3. bottom edge of temp node is NOT above the top edge of focused node |
|
4822 if ( rect.iBr.iX - 1 < tmpRect.iTl.iX && |
|
4823 rect.iBr.iY - 1 >= tmpRect.iTl.iY && |
|
4824 rect.iTl.iY <= tmpRect.iBr.iY - 1 ) |
|
4825 { |
|
4826 if ( !nextNode ) |
|
4827 { |
|
4828 nextNode = tmpNode; |
|
4829 } |
|
4830 else |
|
4831 { |
|
4832 // left edge of temp node is closer to focused than next node's |
|
4833 // left edge |
|
4834 if ( tmpRect.iTl.iX < nextNode->PaddingRect().iTl.iX ) |
|
4835 { |
|
4836 nextNode = tmpNode; |
|
4837 continue; |
|
4838 } |
|
4839 // left edge of temp and next are at the same level |
|
4840 else if ( tmpRect.iTl.iX == nextNode->PaddingRect().iTl.iX ) |
|
4841 { |
|
4842 // top edges are at the same level, choose this one |
|
4843 if ( tmpRect.iTl.iY == rect.iTl.iY ) |
|
4844 { |
|
4845 nextNode = tmpNode; |
|
4846 continue; |
|
4847 } |
|
4848 // top edges are not at the same level |
|
4849 else |
|
4850 { |
|
4851 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
4852 { |
|
4853 // candidate's top edge is below focused's top edge |
|
4854 // and previous candidate's top edge is above |
|
4855 // focused's top edge |
|
4856 if ( nextNode->PaddingRect().iTl.iY < rect.iTl.iY && |
|
4857 tmpRect.iTl.iY > rect.iTl.iY ) |
|
4858 { |
|
4859 nextNode = tmpNode; |
|
4860 continue; |
|
4861 } |
|
4862 // previous candidate's top edge is below focused's |
|
4863 // top edge. Also, candidate's top edge is below |
|
4864 // focused's top edge. Select the highest one. |
|
4865 else if ( nextNode->PaddingRect().iTl.iY > rect.iTl.iY && |
|
4866 tmpRect.iTl.iY > rect.iTl.iY && |
|
4867 tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
4868 { |
|
4869 nextNode = tmpNode; |
|
4870 continue; |
|
4871 } |
|
4872 } |
|
4873 else // arabic/hebrew layout |
|
4874 { |
|
4875 // candidate's top edge is above focused's top edge |
|
4876 // and previous candidate's top edge is below |
|
4877 // focused's top edge |
|
4878 if ( nextNode->PaddingRect().iTl.iY > rect.iTl.iY && |
|
4879 tmpRect.iTl.iY < rect.iTl.iY ) |
|
4880 { |
|
4881 nextNode = tmpNode; |
|
4882 continue; |
|
4883 } |
|
4884 // candidate's and previous' top edge is below focused's |
|
4885 // top edge. Select the highest one. |
|
4886 else if ( nextNode->PaddingRect().iTl.iY > rect.iTl.iY && |
|
4887 tmpRect.iTl.iY > rect.iTl.iY && |
|
4888 tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
4889 { |
|
4890 nextNode = tmpNode; |
|
4891 continue; |
|
4892 } |
|
4893 } |
|
4894 } |
|
4895 } |
|
4896 else |
|
4897 { |
|
4898 continue; |
|
4899 } |
|
4900 } |
|
4901 } |
|
4902 } |
|
4903 |
|
4904 // find node below or above to the right |
|
4905 if ( !nextNode ) |
|
4906 { |
|
4907 CXnNode* candidateAbove = NULL; |
|
4908 CXnNode* candidateBelow = NULL; |
|
4909 |
|
4910 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
4911 { |
|
4912 CXnNode* tmpNode = aArray[i]; |
|
4913 if ( tmpNode == &aNode ) |
|
4914 { |
|
4915 continue; |
|
4916 } |
|
4917 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
4918 { |
|
4919 continue; |
|
4920 } |
|
4921 if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
4922 { |
|
4923 // do not shift focus to another view |
|
4924 continue; |
|
4925 } |
|
4926 |
|
4927 const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
4928 const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
4929 |
|
4930 if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
4931 { |
|
4932 // if staying in the same namespace is required, |
|
4933 // do not shift focus to a different namespace |
|
4934 continue; |
|
4935 } |
|
4936 // TODO: only plugin widgets are available in edit mode |
|
4937 |
|
4938 TRect tmpRect = tmpNode->PaddingRect(); |
|
4939 |
|
4940 // temp node qualification: |
|
4941 // left edge of temp node is to the right from focused's right edge |
|
4942 if ( rect.iBr.iX - 1 < tmpRect.iTl.iX ) |
|
4943 { |
|
4944 // tmp is above the focused node |
|
4945 if ( tmpRect.iBr.iY - 1 < rect.iTl.iY ) |
|
4946 { |
|
4947 if ( candidateAbove == NULL ) |
|
4948 { |
|
4949 candidateAbove = tmpNode; |
|
4950 } |
|
4951 else |
|
4952 { |
|
4953 // use pythagorean theorem to determine the closest node |
|
4954 TInt xDistTmp = tmpRect.iTl.iX - rect.iBr.iX; |
|
4955 TInt yDistTmp = tmpRect.iBr.iY - rect.iTl.iY; |
|
4956 TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
4957 |
|
4958 TInt xCand = candidateAbove->PaddingRect().iTl.iX - rect.iBr.iX; |
|
4959 TInt yCand = candidateAbove->PaddingRect().iBr.iY - rect.iTl.iY; |
|
4960 TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
4961 |
|
4962 if ( tmpDist < cDist ) |
|
4963 { |
|
4964 candidateAbove = tmpNode; |
|
4965 } |
|
4966 } |
|
4967 } |
|
4968 else |
|
4969 { |
|
4970 if ( candidateBelow == NULL ) |
|
4971 { |
|
4972 candidateBelow = tmpNode; |
|
4973 } |
|
4974 else |
|
4975 { |
|
4976 // use pythagorean theorem to determine the closest node |
|
4977 TInt xDistTmp = tmpRect.iTl.iX - rect.iBr.iX; |
|
4978 TInt yDistTmp = tmpRect.iTl.iY - rect.iBr.iY; |
|
4979 TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
4980 |
|
4981 TInt xCand = candidateBelow->PaddingRect().iTl.iX - rect.iBr.iX; |
|
4982 TInt yCand = candidateBelow->PaddingRect().iTl.iY - rect.iBr.iY; |
|
4983 TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
4984 |
|
4985 if ( tmpDist < cDist ) |
|
4986 { |
|
4987 candidateBelow = tmpNode; |
|
4988 } |
|
4989 } |
|
4990 } |
|
4991 } |
|
4992 } |
|
4993 |
|
4994 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
4995 { |
|
4996 if ( candidateBelow ) |
|
4997 { |
|
4998 nextNode = candidateBelow; |
|
4999 } |
|
5000 else |
|
5001 { |
|
5002 if ( candidateAbove ) |
|
5003 { |
|
5004 nextNode = candidateAbove; |
|
5005 } |
|
5006 } |
|
5007 } |
|
5008 else |
|
5009 { |
|
5010 if ( candidateAbove ) |
|
5011 { |
|
5012 nextNode = candidateAbove; |
|
5013 } |
|
5014 else |
|
5015 { |
|
5016 if ( candidateBelow ) |
|
5017 { |
|
5018 nextNode = candidateBelow; |
|
5019 } |
|
5020 } |
|
5021 } |
|
5022 } |
|
5023 |
|
5024 // loop to the right |
|
5025 if ( !nextNode ) |
|
5026 { |
|
5027 if ( !stayInNamespace && aEngine && |
|
5028 aEngine->ViewManager()->ViewAmount() != KOneView ) |
|
5029 { |
|
5030 aEngine->ViewManager()->ActivateNextViewL(); |
|
5031 return nextNode; |
|
5032 } |
|
5033 |
|
5034 CXnNode* candidateAbove = NULL; |
|
5035 CXnNode* candidateBelow = NULL; |
|
5036 |
|
5037 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5038 { |
|
5039 CXnNode* tmpNode = aArray[i]; |
|
5040 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5041 { |
|
5042 continue; |
|
5043 } |
|
5044 if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5045 { |
|
5046 // do not shift focus to another view |
|
5047 continue; |
|
5048 } |
|
5049 |
|
5050 const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5051 const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5052 |
|
5053 if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5054 { |
|
5055 // if staying in the same namespace is required, |
|
5056 // do not shift focus to a different namespace |
|
5057 continue; |
|
5058 } |
|
5059 |
|
5060 // TODO: only plugin widgets are available in edit mode |
|
5061 TRect tmpRect = tmpNode->PaddingRect(); |
|
5062 |
|
5063 // tmp is above the focused node |
|
5064 if ( tmpRect.iBr.iY <= rect.iTl.iY ) |
|
5065 { |
|
5066 if ( candidateAbove == NULL ) |
|
5067 { |
|
5068 candidateAbove = tmpNode; |
|
5069 } |
|
5070 else |
|
5071 { |
|
5072 // use pythagorean theorem to determine the closest node |
|
5073 TInt xDistTmp = tmpRect.iTl.iX; |
|
5074 TInt yDistTmp = tmpRect.iTl.iY - rect.iTl.iY; |
|
5075 TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5076 |
|
5077 TInt xCand = candidateAbove->PaddingRect().iTl.iX; |
|
5078 TInt yCand = candidateAbove->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5079 TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5080 |
|
5081 if ( tmpDist < cDist ) |
|
5082 { |
|
5083 candidateAbove = tmpNode; |
|
5084 } |
|
5085 } |
|
5086 } |
|
5087 else |
|
5088 { |
|
5089 if ( candidateBelow == NULL ) |
|
5090 { |
|
5091 candidateBelow = tmpNode; |
|
5092 } |
|
5093 else |
|
5094 { |
|
5095 // use pythagorean theorem to determine the closest node |
|
5096 TInt xDistTmp = tmpRect.iTl.iX; |
|
5097 TInt yDistTmp = rect.iTl.iY - tmpRect.iTl.iY; |
|
5098 TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5099 |
|
5100 TInt xCand = candidateBelow->PaddingRect().iTl.iX; |
|
5101 TInt yCand = rect.iTl.iY - candidateBelow->PaddingRect().iTl.iY; |
|
5102 TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5103 |
|
5104 if ( tmpDist < cDist ) |
|
5105 { |
|
5106 candidateBelow = tmpNode; |
|
5107 } |
|
5108 } |
|
5109 } |
|
5110 } |
|
5111 |
|
5112 if ( candidateAbove && candidateBelow ) |
|
5113 { |
|
5114 CXnNode* pluginAbove = FindPluginNode( *candidateAbove ); |
|
5115 CXnNode* pluginBelow = FindPluginNode( *candidateBelow ); |
|
5116 |
|
5117 TReal aboveDist = 0; |
|
5118 TReal belowDist = 0; |
|
5119 |
|
5120 if ( pluginAbove ) |
|
5121 { |
|
5122 TInt xAbove = pluginAbove->PaddingRect().iTl.iX; |
|
5123 TInt yAbove = 0; |
|
5124 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5125 { |
|
5126 yAbove = rect.iTl.iY - pluginAbove->PaddingRect().iTl.iY; |
|
5127 } |
|
5128 else |
|
5129 { |
|
5130 yAbove = rect.iTl.iY - pluginAbove->PaddingRect().iBr.iY; |
|
5131 } |
|
5132 aboveDist = Abs( ( xAbove * xAbove ) + ( yAbove * yAbove ) ); |
|
5133 } |
|
5134 else |
|
5135 { |
|
5136 TInt xAbove = candidateAbove->PaddingRect().iTl.iX; |
|
5137 TInt yAbove = 0; |
|
5138 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5139 { |
|
5140 yAbove = rect.iTl.iY - candidateAbove->PaddingRect().iTl.iY; |
|
5141 } |
|
5142 else |
|
5143 { |
|
5144 yAbove = rect.iTl.iY - candidateAbove->PaddingRect().iBr.iY; |
|
5145 } |
|
5146 |
|
5147 aboveDist = Abs( ( xAbove * xAbove ) + ( yAbove * yAbove ) ); |
|
5148 } |
|
5149 |
|
5150 if ( pluginBelow ) |
|
5151 { |
|
5152 TInt xBelow = pluginBelow->PaddingRect().iTl.iX; |
|
5153 TInt yBelow = pluginBelow->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5154 belowDist = Abs( ( xBelow * xBelow ) + ( yBelow * yBelow ) ); |
|
5155 } |
|
5156 else |
|
5157 { |
|
5158 TInt xBelow = candidateBelow->PaddingRect().iTl.iX; |
|
5159 TInt yBelow = candidateBelow->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5160 belowDist = Abs( ( xBelow * xBelow ) + ( yBelow * yBelow ) ); |
|
5161 } |
|
5162 |
|
5163 if ( aboveDist < belowDist ) |
|
5164 { |
|
5165 nextNode = candidateAbove; |
|
5166 } |
|
5167 else if ( belowDist < aboveDist ) |
|
5168 { |
|
5169 nextNode = candidateBelow; |
|
5170 } |
|
5171 else |
|
5172 { |
|
5173 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5174 { |
|
5175 nextNode = candidateBelow; |
|
5176 } |
|
5177 else |
|
5178 { |
|
5179 nextNode = candidateAbove; |
|
5180 } |
|
5181 } |
|
5182 } |
|
5183 else if ( candidateAbove ) |
|
5184 { |
|
5185 nextNode = candidateAbove; |
|
5186 } |
|
5187 else if ( candidateBelow ) |
|
5188 { |
|
5189 nextNode = candidateBelow; |
|
5190 } |
|
5191 else |
|
5192 { |
|
5193 // do nothing |
|
5194 } |
|
5195 } |
|
5196 |
|
5197 if ( stayInNamespace && !nextNode ) |
|
5198 { |
|
5199 return &aNode; |
|
5200 } |
|
5201 |
|
5202 return nextNode; |
|
5203 } |
|
5204 |
|
5205 // ----------------------------------------------------------------------------- |
|
5206 // FindNextNodeFromLeftL |
|
5207 // ----------------------------------------------------------------------------- |
|
5208 // |
|
5209 static CXnNode* FindNextNodeFromLeftL( |
|
5210 RPointerArray< CXnNode >& aArray, |
|
5211 CXnNode& aNode, |
|
5212 TBool stayInNamespace, |
|
5213 CXnUiEngine* aEngine ) |
|
5214 { |
|
5215 CXnNode* nextNode = NULL; |
|
5216 TRect rect = aNode.PaddingRect(); |
|
5217 |
|
5218 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5219 { |
|
5220 CXnNode* tmpNode = aArray[i]; |
|
5221 if ( tmpNode == &aNode ) |
|
5222 { |
|
5223 continue; |
|
5224 } |
|
5225 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5226 { |
|
5227 continue; |
|
5228 } |
|
5229 if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5230 { |
|
5231 // do not shift focus to another view |
|
5232 continue; |
|
5233 } |
|
5234 |
|
5235 const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5236 const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5237 |
|
5238 if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5239 { |
|
5240 // if staying in the same namespace is required, |
|
5241 // do not shift focus to a different namespace |
|
5242 continue; |
|
5243 } |
|
5244 |
|
5245 // TODO: only plugin widgets are available in edit mode |
|
5246 |
|
5247 TRect tmpRect = tmpNode->PaddingRect(); |
|
5248 |
|
5249 // temp node qualification: |
|
5250 // 1. right edge of temp node is to the left from focused's left edge |
|
5251 // 2. top edge of temp node is NOT below the bottom edge of focused node |
|
5252 // 3. bottom edge of temp node is NOT above the top edge of focused node |
|
5253 if ( rect.iTl.iX > tmpRect.iBr.iX - 1 && |
|
5254 rect.iBr.iY - 1 >= tmpRect.iTl.iY && |
|
5255 rect.iTl.iY <= tmpRect.iBr.iY - 1 ) |
|
5256 { |
|
5257 if ( !nextNode ) |
|
5258 { |
|
5259 nextNode = tmpNode; |
|
5260 } |
|
5261 else |
|
5262 { |
|
5263 // right edge of temp node is closer to focused than next node's |
|
5264 // right edge |
|
5265 if ( tmpRect.iBr.iX - 1 > nextNode->PaddingRect().iBr.iX - 1 ) |
|
5266 { |
|
5267 nextNode = tmpNode; |
|
5268 continue; |
|
5269 } |
|
5270 // left edge of temp and next are at the same level |
|
5271 else if ( tmpRect.iBr.iX - 1 == nextNode->PaddingRect().iBr.iX - 1 ) |
|
5272 { |
|
5273 // top edges are at the same level, choose this one |
|
5274 if ( tmpRect.iTl.iY == rect.iTl.iY ) |
|
5275 { |
|
5276 nextNode = tmpNode; |
|
5277 continue; |
|
5278 } |
|
5279 // top edges are not at the same level |
|
5280 else |
|
5281 { |
|
5282 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5283 { |
|
5284 // candidate's top edge is below focused's top edge |
|
5285 // and previous candidate's top edge is above focused's |
|
5286 // top edge |
|
5287 if ( nextNode->PaddingRect().iTl.iY > rect.iTl.iY && |
|
5288 tmpRect.iTl.iY < rect.iTl.iY ) |
|
5289 { |
|
5290 nextNode = tmpNode; |
|
5291 continue; |
|
5292 } |
|
5293 // candidate's and previous candidate's top edge is |
|
5294 // above focused's top edge. Select highest one. |
|
5295 else if ( nextNode->PaddingRect().iTl.iY < rect.iTl.iY && |
|
5296 tmpRect.iTl.iY < rect.iTl.iY && |
|
5297 tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
5298 { |
|
5299 nextNode = tmpNode; |
|
5300 continue; |
|
5301 } |
|
5302 } |
|
5303 else // arabic/hebrew layout |
|
5304 { |
|
5305 // candidate's top edge is below focused's top edge |
|
5306 // and previous candidate's top edge is above |
|
5307 // focused's top edge |
|
5308 if ( nextNode->PaddingRect().iTl.iY < rect.iTl.iY && |
|
5309 tmpRect.iTl.iY > rect.iTl.iY ) |
|
5310 { |
|
5311 nextNode = tmpNode; |
|
5312 continue; |
|
5313 } |
|
5314 // previous candidate's top edge is below focused's |
|
5315 // top edge. Also, candidate's top edge is below |
|
5316 // focused's top edge. Select the highest one. |
|
5317 else if ( nextNode->PaddingRect().iTl.iY > rect.iTl.iY && |
|
5318 tmpRect.iTl.iY > rect.iTl.iY && |
|
5319 tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
5320 { |
|
5321 nextNode = tmpNode; |
|
5322 continue; |
|
5323 } |
|
5324 } |
|
5325 } |
|
5326 } |
|
5327 else |
|
5328 { |
|
5329 continue; |
|
5330 } |
|
5331 } |
|
5332 } |
|
5333 } |
|
5334 |
|
5335 if ( !nextNode ) |
|
5336 { |
|
5337 CXnNode* candidateAbove = NULL; |
|
5338 CXnNode* candidateBelow = NULL; |
|
5339 |
|
5340 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5341 { |
|
5342 CXnNode* tmpNode = aArray[i]; |
|
5343 if ( tmpNode == &aNode ) |
|
5344 { |
|
5345 continue; |
|
5346 } |
|
5347 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5348 { |
|
5349 continue; |
|
5350 } |
|
5351 if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5352 { |
|
5353 // do not shift focus to another view |
|
5354 continue; |
|
5355 } |
|
5356 |
|
5357 const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5358 const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5359 |
|
5360 if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5361 { |
|
5362 // if staying in the same namespace is required, |
|
5363 // do not shift focus to a different namespace |
|
5364 continue; |
|
5365 } |
|
5366 |
|
5367 // TODO: only plugin widgets are available in edit mode |
|
5368 TRect tmpRect = tmpNode->PaddingRect(); |
|
5369 |
|
5370 // temp node qualification: |
|
5371 // right edge of temp node is to the left from focused's left edge |
|
5372 if ( tmpRect.iBr.iX < rect.iTl.iX - 1 ) |
|
5373 { |
|
5374 // tmp is above the focused node |
|
5375 if ( tmpRect.iBr.iY < rect.iTl.iY ) |
|
5376 { |
|
5377 if ( candidateAbove == NULL ) |
|
5378 { |
|
5379 candidateAbove = tmpNode; |
|
5380 } |
|
5381 else |
|
5382 { |
|
5383 // use pythagorean theorem to determine the closest node |
|
5384 TInt xDistTmp = rect.iTl.iX - tmpRect.iBr.iX; |
|
5385 TInt yDistTmp = rect.iTl.iY - tmpRect.iBr.iY; |
|
5386 TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5387 |
|
5388 TInt xCand = rect.iTl.iX - candidateAbove->PaddingRect().iTl.iX; |
|
5389 TInt yCand = rect.iTl.iY - candidateAbove->PaddingRect().iBr.iY; |
|
5390 TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5391 |
|
5392 if ( tmpDist < cDist ) |
|
5393 { |
|
5394 candidateAbove = tmpNode; |
|
5395 } |
|
5396 } |
|
5397 } |
|
5398 else |
|
5399 { |
|
5400 if ( candidateBelow == NULL ) |
|
5401 { |
|
5402 candidateBelow = tmpNode; |
|
5403 } |
|
5404 else |
|
5405 { |
|
5406 // use pythagorean theorem to determine the closest node |
|
5407 TInt xDistTmp = rect.iTl.iX - tmpRect.iBr.iX; |
|
5408 TInt yDistTmp = rect.iBr.iY - tmpRect.iTl.iY; |
|
5409 TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5410 |
|
5411 TInt xCand = rect.iTl.iX - candidateBelow->PaddingRect().iBr.iX; |
|
5412 TInt yCand = rect.iBr.iY - candidateBelow->PaddingRect().iTl.iY; |
|
5413 TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5414 |
|
5415 if ( tmpDist < cDist ) |
|
5416 { |
|
5417 candidateBelow = tmpNode; |
|
5418 } |
|
5419 } |
|
5420 } |
|
5421 } |
|
5422 } |
|
5423 |
|
5424 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5425 { |
|
5426 if ( candidateAbove ) |
|
5427 { |
|
5428 nextNode = candidateAbove; |
|
5429 } |
|
5430 else |
|
5431 { |
|
5432 if ( candidateBelow ) |
|
5433 { |
|
5434 nextNode = candidateBelow; |
|
5435 } |
|
5436 } |
|
5437 } |
|
5438 else |
|
5439 { |
|
5440 if ( candidateBelow ) |
|
5441 { |
|
5442 nextNode = candidateBelow; |
|
5443 } |
|
5444 else |
|
5445 { |
|
5446 if ( candidateAbove ) |
|
5447 { |
|
5448 nextNode = candidateAbove; |
|
5449 } |
|
5450 } |
|
5451 } |
|
5452 } |
|
5453 |
|
5454 // get view width to get looping x point |
|
5455 TInt viewWidth = aNode.FindViewNode()->PaddingRect().Width(); |
|
5456 |
|
5457 // loop to the left |
|
5458 if ( !nextNode ) |
|
5459 { |
|
5460 if ( !stayInNamespace && aEngine && |
|
5461 aEngine->ViewManager()->ViewAmount() != KOneView ) |
|
5462 { |
|
5463 aEngine->ViewManager()->ActivatePreviousViewL(); |
|
5464 return nextNode; |
|
5465 } |
|
5466 |
|
5467 CXnNode* candidateAbove = NULL; |
|
5468 CXnNode* candidateBelow = NULL; |
|
5469 |
|
5470 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5471 { |
|
5472 CXnNode* tmpNode = aArray[i]; |
|
5473 /* |
|
5474 if ( tmpNode == &aNode ) |
|
5475 { |
|
5476 continue; |
|
5477 } |
|
5478 */ |
|
5479 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5480 { |
|
5481 continue; |
|
5482 } |
|
5483 if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5484 { |
|
5485 // do not shift focus to another view |
|
5486 continue; |
|
5487 } |
|
5488 |
|
5489 const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5490 const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5491 |
|
5492 if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5493 { |
|
5494 // if staying in the same namespace is required, |
|
5495 // do not shift focus to a different namespace |
|
5496 continue; |
|
5497 } |
|
5498 |
|
5499 |
|
5500 // TODO: only plugin widgets are available in edit mode |
|
5501 TRect tmpRect = tmpNode->PaddingRect(); |
|
5502 |
|
5503 // tmp is above the focused node |
|
5504 if ( tmpRect.iBr.iY <= rect.iTl.iY ) |
|
5505 { |
|
5506 if ( candidateAbove == NULL ) |
|
5507 { |
|
5508 candidateAbove = tmpNode; |
|
5509 } |
|
5510 else |
|
5511 { |
|
5512 // use pythagorean theorem to determine the closest node |
|
5513 TInt xDistTmp = viewWidth - tmpRect.iBr.iX; |
|
5514 TInt yDistTmp = rect.iTl.iY - tmpRect.iBr.iY; |
|
5515 TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5516 |
|
5517 TInt xCand = viewWidth - candidateAbove->PaddingRect().iBr.iX; |
|
5518 TInt yCand = rect.iTl.iY - candidateAbove->PaddingRect().iTl.iY; |
|
5519 TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5520 |
|
5521 if ( tmpDist < cDist ) |
|
5522 { |
|
5523 candidateAbove = tmpNode; |
|
5524 } |
|
5525 } |
|
5526 } |
|
5527 else |
|
5528 { |
|
5529 if ( candidateBelow == NULL ) |
|
5530 { |
|
5531 candidateBelow = tmpNode; |
|
5532 } |
|
5533 else |
|
5534 { |
|
5535 // use pythagorean theorem to determine the closest node |
|
5536 TInt xDistTmp = viewWidth - tmpRect.iBr.iX; |
|
5537 TInt yDistTmp = tmpRect.iTl.iY - rect.iTl.iY; |
|
5538 TReal tmpDist = Abs( ( xDistTmp * xDistTmp ) + ( yDistTmp * yDistTmp ) ); |
|
5539 |
|
5540 TInt xCand = viewWidth - candidateBelow->PaddingRect().iBr.iX; |
|
5541 TInt yCand = candidateBelow->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5542 TReal cDist = Abs( ( xCand * xCand ) + ( yCand * yCand ) ); |
|
5543 |
|
5544 if ( tmpDist < cDist ) |
|
5545 { |
|
5546 candidateBelow = tmpNode; |
|
5547 } |
|
5548 } |
|
5549 } |
|
5550 } |
|
5551 |
|
5552 if ( candidateAbove && candidateBelow ) |
|
5553 { |
|
5554 CXnNode* pluginAbove = FindPluginNode( *candidateAbove ); |
|
5555 CXnNode* pluginBelow = FindPluginNode( *candidateBelow ); |
|
5556 |
|
5557 TReal aboveDist = 0; |
|
5558 TReal belowDist = 0; |
|
5559 |
|
5560 if ( pluginAbove ) |
|
5561 { |
|
5562 // compare to bottom right when looping to left |
|
5563 TInt xAbove = viewWidth - pluginAbove->PaddingRect().iBr.iX; |
|
5564 TInt yAbove = 0; |
|
5565 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5566 { |
|
5567 yAbove = rect.iTl.iY - pluginAbove->PaddingRect().iBr.iY; |
|
5568 } |
|
5569 else |
|
5570 { |
|
5571 yAbove = rect.iTl.iY - pluginAbove->PaddingRect().iTl.iY; |
|
5572 } |
|
5573 |
|
5574 aboveDist = Abs( (xAbove * xAbove) + (yAbove * yAbove) ); |
|
5575 } |
|
5576 else |
|
5577 { |
|
5578 TInt xAbove = viewWidth - candidateAbove->PaddingRect().iBr.iX; |
|
5579 TInt yAbove = 0; |
|
5580 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5581 { |
|
5582 yAbove = rect.iTl.iY - candidateAbove->PaddingRect().iBr.iY; |
|
5583 } |
|
5584 else |
|
5585 { |
|
5586 yAbove = rect.iTl.iY - candidateAbove->PaddingRect().iTl.iY; |
|
5587 } |
|
5588 aboveDist = Abs( ( xAbove * xAbove ) + ( yAbove * yAbove ) ); |
|
5589 } |
|
5590 |
|
5591 if ( pluginBelow ) |
|
5592 { |
|
5593 TInt xBelow = viewWidth - pluginBelow->PaddingRect().iBr.iX; |
|
5594 TInt yBelow = pluginBelow->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5595 belowDist = Abs( ( xBelow * xBelow ) + ( yBelow * yBelow ) ); |
|
5596 } |
|
5597 else |
|
5598 { |
|
5599 TInt xBelow = viewWidth - candidateBelow->PaddingRect().iBr.iX; |
|
5600 TInt yBelow = candidateBelow->PaddingRect().iTl.iY - rect.iTl.iY; |
|
5601 belowDist = Abs( ( xBelow * xBelow ) + ( yBelow * yBelow ) ); |
|
5602 } |
|
5603 |
|
5604 if ( aboveDist < belowDist ) |
|
5605 { |
|
5606 nextNode = candidateAbove; |
|
5607 } |
|
5608 else if ( belowDist < aboveDist ) |
|
5609 { |
|
5610 nextNode = candidateBelow; |
|
5611 } |
|
5612 else |
|
5613 { |
|
5614 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
5615 { |
|
5616 nextNode = candidateBelow; |
|
5617 } |
|
5618 else |
|
5619 { |
|
5620 nextNode = candidateAbove; |
|
5621 } |
|
5622 } |
|
5623 } |
|
5624 else if ( candidateAbove ) |
|
5625 { |
|
5626 nextNode = candidateAbove; |
|
5627 } |
|
5628 else if ( candidateBelow ) |
|
5629 { |
|
5630 nextNode = candidateBelow; |
|
5631 } |
|
5632 else |
|
5633 { |
|
5634 // do nothing |
|
5635 } |
|
5636 } |
|
5637 |
|
5638 if ( stayInNamespace && !nextNode ) |
|
5639 { |
|
5640 return &aNode; |
|
5641 } |
|
5642 |
|
5643 return nextNode; |
|
5644 } |
|
5645 |
|
5646 // ----------------------------------------------------------------------------- |
|
5647 // FindNextNodeFromBelowL |
|
5648 // ----------------------------------------------------------------------------- |
|
5649 // |
|
5650 static CXnNode* FindNextNodeFromBelowL( |
|
5651 RPointerArray< CXnNode >& aArray, |
|
5652 CXnNode& aNode, TBool stayInNamespace ) |
|
5653 { |
|
5654 CXnNode* nextNode = NULL; |
|
5655 TRect rect = aNode.PaddingRect(); |
|
5656 |
|
5657 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5658 { |
|
5659 CXnNode* tmpNode = aArray[i]; |
|
5660 if ( tmpNode == &aNode ) |
|
5661 { |
|
5662 continue; |
|
5663 } |
|
5664 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5665 { |
|
5666 continue; |
|
5667 } |
|
5668 if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5669 { |
|
5670 // do not shift focus to another view |
|
5671 continue; |
|
5672 } |
|
5673 |
|
5674 const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5675 const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5676 |
|
5677 if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5678 { |
|
5679 // if staying in the same namespace is required, |
|
5680 // do not shift focus to a different namespace |
|
5681 continue; |
|
5682 } |
|
5683 |
|
5684 // TODO: only plugin widgets are available in edit mode |
|
5685 |
|
5686 TRect tmpRect = tmpNode->PaddingRect(); |
|
5687 |
|
5688 // temp node qualification: |
|
5689 // 1. top edge of the temp node is below bottom edge of focused node |
|
5690 // 2. temp node's right or left edge is between focused's left or right edge |
|
5691 if ( tmpRect.iTl.iY > rect.iBr.iY - 1 && |
|
5692 tmpRect.iBr.iX - 1 >= rect.iTl.iX && |
|
5693 tmpRect.iTl.iX <= rect.iBr.iX - 1 ) |
|
5694 { |
|
5695 if ( !nextNode ) |
|
5696 { |
|
5697 nextNode = tmpNode; |
|
5698 } |
|
5699 else |
|
5700 { |
|
5701 // temp node is closer than next node |
|
5702 if ( tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
5703 { |
|
5704 nextNode = tmpNode; |
|
5705 continue; |
|
5706 } |
|
5707 // top edge of temp node and next are at the same level |
|
5708 else if ( tmpRect.iTl.iY == nextNode->PaddingRect().iTl.iY ) |
|
5709 { |
|
5710 // western layout: take the leftmost one |
|
5711 if ( !AknLayoutUtils::LayoutMirrored() && |
|
5712 tmpRect.iBr.iX - 1 < nextNode->PaddingRect().iBr.iX - 1 ) |
|
5713 { |
|
5714 nextNode = tmpNode; |
|
5715 continue; |
|
5716 } |
|
5717 // arabic/hebrew layout: take the rightmost one |
|
5718 if ( AknLayoutUtils::LayoutMirrored() && |
|
5719 tmpRect.iBr.iX - 1 > nextNode->PaddingRect().iBr.iX - 1 ) |
|
5720 { |
|
5721 nextNode = tmpNode; |
|
5722 continue; |
|
5723 } |
|
5724 } |
|
5725 else |
|
5726 { |
|
5727 continue; |
|
5728 } |
|
5729 } |
|
5730 } |
|
5731 } |
|
5732 |
|
5733 // no nodes found on the right, try looping |
|
5734 if ( !nextNode ) |
|
5735 { |
|
5736 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5737 { |
|
5738 CXnNode* tmpNode = aArray[i]; |
|
5739 TRect tmpRect = tmpNode->PaddingRect(); |
|
5740 if ( tmpNode == &aNode ) |
|
5741 { |
|
5742 continue; |
|
5743 } |
|
5744 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5745 { |
|
5746 continue; |
|
5747 } |
|
5748 if ( tmpRect.Intersects( rect ) ) |
|
5749 { |
|
5750 continue; |
|
5751 } |
|
5752 if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5753 { |
|
5754 // do not shift focus to another view |
|
5755 continue; |
|
5756 } |
|
5757 |
|
5758 const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5759 const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5760 |
|
5761 if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5762 { |
|
5763 // if staying in the same namespace is required, |
|
5764 // do not shift focus to a different namespace |
|
5765 continue; |
|
5766 } |
|
5767 |
|
5768 // TODO: only plugin widgets are available in edit mode |
|
5769 |
|
5770 // temp node's right or left edge must be between focused's left or |
|
5771 // right edge |
|
5772 if ( tmpRect.iBr.iX - 1 >= rect.iTl.iX && |
|
5773 tmpRect.iTl.iX <= rect.iBr.iX - 1 ) |
|
5774 { |
|
5775 if ( !nextNode ) |
|
5776 { |
|
5777 nextNode = tmpNode; |
|
5778 } |
|
5779 else |
|
5780 { |
|
5781 // temp node is closer than next node |
|
5782 if ( tmpRect.iTl.iY < nextNode->PaddingRect().iTl.iY ) |
|
5783 { |
|
5784 nextNode = tmpNode; |
|
5785 continue; |
|
5786 } |
|
5787 // top edge of temp node and next are at the same level |
|
5788 else if ( tmpRect.iTl.iY == nextNode->PaddingRect().iTl.iY ) |
|
5789 { |
|
5790 // western layout: take the leftmost one |
|
5791 if ( !AknLayoutUtils::LayoutMirrored() && |
|
5792 tmpRect.iBr.iX - 1 < nextNode->PaddingRect().iBr.iX - 1 ) |
|
5793 { |
|
5794 nextNode = tmpNode; |
|
5795 continue; |
|
5796 } |
|
5797 // arabic/hebrew layout: take the rightmost one |
|
5798 if ( AknLayoutUtils::LayoutMirrored() && |
|
5799 tmpRect.iBr.iX - 1 > nextNode->PaddingRect().iBr.iX - 1 ) |
|
5800 { |
|
5801 nextNode = tmpNode; |
|
5802 continue; |
|
5803 } |
|
5804 } |
|
5805 else |
|
5806 { |
|
5807 continue; |
|
5808 } |
|
5809 } |
|
5810 } |
|
5811 } |
|
5812 } |
|
5813 |
|
5814 if ( stayInNamespace && !nextNode ) |
|
5815 { |
|
5816 return &aNode; |
|
5817 } |
|
5818 |
|
5819 return nextNode; |
|
5820 } |
|
5821 |
|
5822 // ----------------------------------------------------------------------------- |
|
5823 // FindNextNodeFromAboveL |
|
5824 // ----------------------------------------------------------------------------- |
|
5825 // |
|
5826 static CXnNode* FindNextNodeFromAboveL( |
|
5827 RPointerArray< CXnNode >& aArray, |
|
5828 CXnNode& aNode, TBool stayInNamespace ) |
|
5829 { |
|
5830 CXnNode* nextNode = NULL; |
|
5831 TRect rect = aNode.PaddingRect(); |
|
5832 |
|
5833 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5834 { |
|
5835 CXnNode* tmpNode = aArray[i]; |
|
5836 if ( tmpNode == &aNode ) |
|
5837 { |
|
5838 continue; |
|
5839 } |
|
5840 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5841 { |
|
5842 continue; |
|
5843 } |
|
5844 if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5845 { |
|
5846 // do not shift focus to another view |
|
5847 continue; |
|
5848 } |
|
5849 |
|
5850 const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5851 const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5852 |
|
5853 if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5854 { |
|
5855 // if staying in the same namespace is required, |
|
5856 // do not shift focus to a different namespace |
|
5857 continue; |
|
5858 } |
|
5859 |
|
5860 // TODO: only plugin widgets are available in edit mode |
|
5861 TRect tmpRect = tmpNode->PaddingRect(); |
|
5862 |
|
5863 // temp node qualification: |
|
5864 // 1. bottom edge of the temp node is above the top edge of focused node |
|
5865 // 2. temp node's right or left edge is between focused's left or right edge |
|
5866 if ( tmpRect.iBr.iY - 1 < rect.iTl.iY && |
|
5867 tmpRect.iBr.iX - 1 >= rect.iTl.iX && |
|
5868 tmpRect.iTl.iX <= rect.iBr.iX - 1 ) |
|
5869 { |
|
5870 if ( !nextNode ) |
|
5871 { |
|
5872 nextNode = tmpNode; |
|
5873 } |
|
5874 else |
|
5875 { |
|
5876 // temp node is closer than next node |
|
5877 if ( tmpRect.iBr.iY - 1 > nextNode->PaddingRect().iBr.iY - 1 ) |
|
5878 { |
|
5879 nextNode = tmpNode; |
|
5880 continue; |
|
5881 } |
|
5882 // bottom edge of temp and next node are at the same level |
|
5883 else if ( tmpRect.iBr.iY - 1 == nextNode->PaddingRect().iBr.iY - 1 ) |
|
5884 { |
|
5885 // western layout: take the leftmost one |
|
5886 if ( !AknLayoutUtils::LayoutMirrored() && |
|
5887 tmpRect.iBr.iX - 1 < nextNode->PaddingRect().iBr.iX - 1 ) |
|
5888 { |
|
5889 nextNode = tmpNode; |
|
5890 continue; |
|
5891 } |
|
5892 // arabic/hebrew layout: take the rightmost one |
|
5893 if ( AknLayoutUtils::LayoutMirrored() && |
|
5894 tmpRect.iBr.iX - 1 > nextNode->PaddingRect().iBr.iX - 1 ) |
|
5895 { |
|
5896 nextNode = tmpNode; |
|
5897 continue; |
|
5898 } |
|
5899 } |
|
5900 else |
|
5901 { |
|
5902 continue; |
|
5903 } |
|
5904 } |
|
5905 } |
|
5906 } |
|
5907 |
|
5908 // no nodes found on the right, try looping |
|
5909 if ( !nextNode ) |
|
5910 { |
|
5911 for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
5912 { |
|
5913 CXnNode* tmpNode = aArray[i]; |
|
5914 TRect tmpRect = tmpNode->PaddingRect(); |
|
5915 if ( tmpNode == &aNode ) |
|
5916 { |
|
5917 continue; |
|
5918 } |
|
5919 if ( !IsNodeNavigableL( *tmpNode ) ) |
|
5920 { |
|
5921 continue; |
|
5922 } |
|
5923 if ( tmpRect.Intersects( rect ) ) |
|
5924 { |
|
5925 continue; |
|
5926 } |
|
5927 if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() ) |
|
5928 { |
|
5929 // do not shift focus to another view |
|
5930 continue; |
|
5931 } |
|
5932 |
|
5933 const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace(); |
|
5934 const TDesC8& nodeNamespace = aNode.Impl()->Namespace(); |
|
5935 |
|
5936 if ( stayInNamespace && tmpNamespace != nodeNamespace ) |
|
5937 { |
|
5938 // if staying in the same namespace is required, |
|
5939 // do not shift focus to a different namespace |
|
5940 continue; |
|
5941 } |
|
5942 |
|
5943 // TODO: only plugin widgets are available in edit mode |
|
5944 |
|
5945 // temp node's right or left edge must be between focused's left or |
|
5946 // right edge |
|
5947 if ( tmpRect.iBr.iX - 1 >= rect.iTl.iX && |
|
5948 tmpRect.iTl.iX <= rect.iBr.iX - 1 ) |
|
5949 { |
|
5950 if ( !nextNode ) |
|
5951 { |
|
5952 nextNode = tmpNode; |
|
5953 } |
|
5954 else |
|
5955 { |
|
5956 // temp node is closer than next node |
|
5957 if ( tmpRect.iBr.iY - 1 > nextNode->PaddingRect().iBr.iY - 1 ) |
|
5958 { |
|
5959 nextNode = tmpNode; |
|
5960 continue; |
|
5961 } |
|
5962 // bottom edge of temp and next node are at the same level |
|
5963 else if ( tmpRect.iBr.iY - 1 == nextNode->PaddingRect().iBr.iY - 1 ) |
|
5964 { |
|
5965 // western layout: take the leftmost one |
|
5966 if ( !AknLayoutUtils::LayoutMirrored() && |
|
5967 tmpRect.iBr.iX - 1 < nextNode->PaddingRect().iBr.iX - 1 ) |
|
5968 { |
|
5969 nextNode = tmpNode; |
|
5970 continue; |
|
5971 } |
|
5972 // arabic/hebrew layout: take the rightmost one |
|
5973 if ( AknLayoutUtils::LayoutMirrored() && |
|
5974 tmpRect.iBr.iX - 1 > nextNode->PaddingRect().iBr.iX - 1 ) |
|
5975 { |
|
5976 nextNode = tmpNode; |
|
5977 continue; |
|
5978 } |
|
5979 } |
|
5980 else |
|
5981 { |
|
5982 continue; |
|
5983 } |
|
5984 } |
|
5985 } |
|
5986 } |
|
5987 } |
|
5988 |
|
5989 if ( stayInNamespace && !nextNode ) |
|
5990 { |
|
5991 return &aNode; |
|
5992 } |
|
5993 |
|
5994 return nextNode; |
|
5995 } |
|
5996 |
|
5997 // ----------------------------------------------------------------------------- |
|
5998 // FindPluginNode |
|
5999 // ----------------------------------------------------------------------------- |
|
6000 // |
|
6001 static CXnNode* FindPluginNode( CXnNode& aNode ) |
|
6002 { |
|
6003 CXnNode* pluginNode = NULL; |
|
6004 CXnNode* tmp = &aNode; |
|
6005 |
|
6006 while( tmp->Parent() ) |
|
6007 { |
|
6008 tmp = tmp->Parent(); |
|
6009 const TDesC8& nodeType = tmp->DomNode()->Name(); |
|
6010 |
|
6011 if ( nodeType == KPlugin ) |
|
6012 { |
|
6013 pluginNode = tmp; |
|
6014 break; |
|
6015 } |
|
6016 } |
|
6017 |
|
6018 return pluginNode; |
|
6019 } |
|
6020 |
|
6021 // ----------------------------------------------------------------------------- |
|
6022 // DoInternalFocusChangeL |
|
6023 // ----------------------------------------------------------------------------- |
|
6024 // |
|
6025 static TBool DoInternalFocusChangeL( CXnUiEngine& aEngine, |
|
6026 CXnNode& aNode, const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
6027 { |
|
6028 if ( aNode.ViewNodeImpl() ) |
|
6029 { |
|
6030 return EFalse; |
|
6031 } |
|
6032 if ( aType != 1 ) |
|
6033 { |
|
6034 return EFalse; |
|
6035 } |
|
6036 if ( aKeyEvent.iScanCode != EStdKeyLeftArrow && |
|
6037 aKeyEvent.iScanCode != EStdKeyRightArrow && |
|
6038 aKeyEvent.iScanCode != EStdKeyDownArrow && |
|
6039 aKeyEvent.iScanCode != EStdKeyUpArrow ) |
|
6040 { |
|
6041 return EFalse; |
|
6042 } |
|
6043 CXnNode* parent = aNode.Parent(); |
|
6044 if ( !parent ) |
|
6045 { |
|
6046 return EFalse; |
|
6047 } |
|
6048 |
|
6049 // Handle 'appearance' navigation first, if the current node has |
|
6050 // "nav-index: appearance"... |
|
6051 CXnProperty* navind = aNode.NavIndexL(); |
|
6052 if ( navind && navind->StringValue() == XnPropertyNames::style::common::KAppearance ) |
|
6053 { |
|
6054 |
|
6055 CXnAppUiAdapter& appui = static_cast< CXnAppUiAdapter& >( *iAvkonAppUi ); |
|
6056 CXnPluginData* plugin( |
|
6057 appui.ViewManager().ActiveViewData().Plugin( &aNode ) ); |
|
6058 |
|
6059 // find if node is in a widget that contatins some opened popup window |
|
6060 TBool containsPopUp = ( plugin ? plugin->IsDisplayingPopup() : EFalse ); |
|
6061 |
|
6062 CXnNode* nextNode( NULL ); |
|
6063 RPointerArray< CXnNode >& array = aEngine.ViewManager()->AppearanceNodes(); |
|
6064 if ( aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
6065 { |
|
6066 nextNode = FindNextNodeFromBelowL( array, aNode, containsPopUp ); |
|
6067 } |
|
6068 else if ( aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
6069 { |
|
6070 nextNode = FindNextNodeFromAboveL( array, aNode, containsPopUp ); |
|
6071 } |
|
6072 else if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
6073 { |
|
6074 nextNode = FindNextNodeFromRightL( array, aNode, containsPopUp, &aEngine ); |
|
6075 } |
|
6076 else if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
6077 { |
|
6078 nextNode = FindNextNodeFromLeftL( array, aNode, containsPopUp, &aEngine ); |
|
6079 } |
|
6080 if ( nextNode ) |
|
6081 { |
|
6082 // focus plugin node if in edit mode |
|
6083 if( aEngine.IsEditMode() ) |
|
6084 { |
|
6085 if( nextNode->Type()->Type() != KPlugin ) |
|
6086 { |
|
6087 CXnNode* pluginNode = FindPluginNode( *nextNode ); |
|
6088 if( pluginNode ) |
|
6089 { |
|
6090 nextNode = pluginNode; |
|
6091 } |
|
6092 } |
|
6093 } |
|
6094 |
|
6095 if( nextNode && nextNode->ScrollableControl() ) |
|
6096 { |
|
6097 nextNode->ScrollableControl()->ShowItem( *nextNode ); |
|
6098 } |
|
6099 nextNode->SetStateL( XnPropertyNames::style::common::KFocus ); |
|
6100 return ETrue; |
|
6101 } |
|
6102 } |
|
6103 else |
|
6104 { |
|
6105 const TDesC8* direction( &XnPropertyNames::style::common::direction::KLTR ); |
|
6106 const TDesC8* orientation( &XnPropertyNames::style::common::block_progression::KTB ); |
|
6107 |
|
6108 CXnProperty* directionProperty( parent->DirectionL() ); |
|
6109 |
|
6110 if ( directionProperty ) |
|
6111 { |
|
6112 direction = &directionProperty->StringValue(); |
|
6113 } |
|
6114 |
|
6115 CXnProperty* orientationProperty( parent->BlockProgressionL() ); |
|
6116 |
|
6117 if ( orientationProperty ) |
|
6118 { |
|
6119 orientation = &orientationProperty->StringValue(); |
|
6120 } |
|
6121 |
|
6122 TBool match = EFalse; |
|
6123 |
|
6124 if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
6125 ( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
6126 *orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
6127 { |
|
6128 if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
6129 { |
|
6130 match = FindNextFocusableNodeL( aNode, EFalse ); |
|
6131 } |
|
6132 if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
6133 { |
|
6134 match = FindNextFocusableNodeL( aNode, ETrue ); |
|
6135 } |
|
6136 } |
|
6137 else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
6138 ( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
6139 *orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
6140 { |
|
6141 if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
6142 { |
|
6143 match = FindNextFocusableNodeL( aNode, EFalse ); |
|
6144 } |
|
6145 if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
6146 { |
|
6147 match = FindNextFocusableNodeL( aNode, ETrue ); |
|
6148 } |
|
6149 } |
|
6150 else if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
6151 *orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
6152 { |
|
6153 if ( aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
6154 { |
|
6155 match = FindNextFocusableNodeL( aNode, EFalse ); |
|
6156 } |
|
6157 if ( aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
6158 { |
|
6159 match = FindNextFocusableNodeL( aNode, ETrue ); |
|
6160 } |
|
6161 } |
|
6162 else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
6163 *orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
6164 { |
|
6165 if ( aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
6166 { |
|
6167 match = FindNextFocusableNodeL( aNode, EFalse ); |
|
6168 } |
|
6169 if ( aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
6170 { |
|
6171 match = FindNextFocusableNodeL( aNode, ETrue ); |
|
6172 } |
|
6173 } |
|
6174 return match; |
|
6175 } |
|
6176 return EFalse; |
|
6177 } |
|
6178 |
|
6179 // ----------------------------------------------------------------------------- |
|
6180 // DoTriggerKeyEventL |
|
6181 // ----------------------------------------------------------------------------- |
|
6182 // |
|
6183 static TBool DoTriggerKeyEventL( |
|
6184 CXnNodeImpl* aThis, |
|
6185 CXnUiEngine& aEngine, |
|
6186 CXnNode& aNode, |
|
6187 const TKeyEvent& aKeyEvent, |
|
6188 TEventCode aType ) |
|
6189 { |
|
6190 CXnDomNode* domNode = aNode.DomNode(); |
|
6191 CXnDomList& children = domNode->ChildNodes(); |
|
6192 TInt count = children.Length(); |
|
6193 TBool returnValue = EFalse; |
|
6194 for ( TInt i = 0; i < count; ++i ) |
|
6195 { |
|
6196 CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
6197 const TDesC8& type = node->Name(); |
|
6198 if ( type == XnPropertyNames::action::KActions ) |
|
6199 { |
|
6200 CXnDomList& actionChildren = node->ChildNodes(); |
|
6201 TInt actionCount = actionChildren.Length(); |
|
6202 for ( TInt j = 0; j < actionCount; ++j ) |
|
6203 { |
|
6204 CXnDomNode* actionNode = |
|
6205 static_cast< CXnDomNode* >( actionChildren.Item( j ) ); |
|
6206 const TDesC8& actionType = actionNode->Name(); |
|
6207 if ( actionType == XnPropertyNames::action::KAction ) |
|
6208 { |
|
6209 TBool match = MatchActionForKeyEventL( |
|
6210 aThis, aEngine, aNode, aKeyEvent, aType, *actionNode ); |
|
6211 if ( match ) |
|
6212 { |
|
6213 returnValue = ETrue; |
|
6214 } |
|
6215 } |
|
6216 } |
|
6217 } |
|
6218 } |
|
6219 |
|
6220 if ( returnValue ) |
|
6221 { |
|
6222 // Return is removed from here to enable auto navigation altough the |
|
6223 // action is alreadytriggered. This enables simpler theme definitions |
|
6224 // especially in AI2 case. If regression is observed then return should |
|
6225 // be restored here. Task ou1s60ui#3386. |
|
6226 //return returnValue; |
|
6227 } |
|
6228 |
|
6229 DoCompoundNodeScrollingL( aNode, aKeyEvent, aType ); |
|
6230 |
|
6231 returnValue = DoInternalFocusChangeL( aEngine, aNode, aKeyEvent, aType ); |
|
6232 |
|
6233 if ( returnValue ) |
|
6234 { |
|
6235 aEngine.RenderUIL(); |
|
6236 } |
|
6237 |
|
6238 return returnValue; |
|
6239 } |
|
6240 |
|
6241 // ----------------------------------------------------------------------------- |
|
6242 // DoTriggerEventL |
|
6243 // ----------------------------------------------------------------------------- |
|
6244 // |
|
6245 static void DoTriggerEventL( |
|
6246 CXnNodeImpl* aThis, |
|
6247 CXnUiEngine& aEngine, |
|
6248 CXnNode& aNode, |
|
6249 CXnNode& aActionsParent, |
|
6250 CXnNode& aEventData, |
|
6251 TInt aSource ) |
|
6252 { |
|
6253 CXnDomList& children( aActionsParent.DomNode()->ChildNodes() ); |
|
6254 |
|
6255 TInt count( children.Length() ); |
|
6256 |
|
6257 for ( TInt i = 0; i < count; ++i ) |
|
6258 { |
|
6259 CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) ); |
|
6260 const TDesC8& type = node->Name(); |
|
6261 if ( type == XnPropertyNames::action::KActions ) |
|
6262 { |
|
6263 CXnDomList& actionChildren = node->ChildNodes(); |
|
6264 TInt actionCount = actionChildren.Length(); |
|
6265 for ( TInt j = 0; j < actionCount; ++j ) |
|
6266 { |
|
6267 CXnDomNode* actionNode = |
|
6268 static_cast< CXnDomNode* >( actionChildren.Item( j ) ); |
|
6269 const TDesC8& actionType = actionNode->Name(); |
|
6270 if ( actionType == XnPropertyNames::action::KAction ) |
|
6271 { |
|
6272 TBool match = MatchActionForEventL( |
|
6273 aThis, aEngine, aNode, aEventData, *actionNode, aSource ); |
|
6274 } |
|
6275 } |
|
6276 } |
|
6277 } |
|
6278 } |
|
6279 |
|
6280 // ----------------------------------------------------------------------------- |
|
6281 // DoReceiveFocusL |
|
6282 // ----------------------------------------------------------------------------- |
|
6283 // |
|
6284 static TBool DoReceiveFocusL( CXnNode& aNode, CXnUiEngine& /*aEngine*/ ) |
|
6285 { |
|
6286 CXnProperty* focusable = aNode.GetPropertyL( |
|
6287 XnPropertyNames::common::KFocusable ); |
|
6288 CXnProperty* disabled = aNode.GetPropertyL( |
|
6289 XnPropertyNames::common::KDisabled ); |
|
6290 if ( focusable ) |
|
6291 { |
|
6292 const TDesC8& focusValue = focusable->StringValue(); |
|
6293 if ( focusValue != KNullDesC8 ) |
|
6294 { |
|
6295 if ( focusValue != XnPropertyNames::KTrue ) |
|
6296 { |
|
6297 return EFalse; |
|
6298 } |
|
6299 } |
|
6300 } |
|
6301 else |
|
6302 { |
|
6303 return EFalse; |
|
6304 } |
|
6305 if ( disabled ) |
|
6306 { |
|
6307 const TDesC8& disabledValue = disabled->StringValue(); |
|
6308 if ( disabledValue != KNullDesC8 ) |
|
6309 { |
|
6310 if ( disabledValue == XnPropertyNames::KTrue ) |
|
6311 { |
|
6312 return EFalse; |
|
6313 } |
|
6314 } |
|
6315 } |
|
6316 if ( !IsNodeNavigableL( aNode ) ) |
|
6317 { |
|
6318 return EFalse; |
|
6319 } |
|
6320 |
|
6321 return ETrue; |
|
6322 } |
|
6323 |
|
6324 // ----------------------------------------------------------------------------- |
|
6325 // Informs the component about the property change. |
|
6326 // ----------------------------------------------------------------------------- |
|
6327 // |
|
6328 static void InformPropertyChangeL( CXnNode& aNode, CXnProperty* aProperty ) |
|
6329 { |
|
6330 //Inform the component about the property change. |
|
6331 CXnNode* parent( aNode.Parent() ); |
|
6332 |
|
6333 if ( parent ) |
|
6334 { |
|
6335 if ( parent->Type()->Type() == KMenuBar ) |
|
6336 { |
|
6337 CXnMenuAdapter* adapter = |
|
6338 static_cast< CXnMenuAdapter* >( parent->Control() ); |
|
6339 |
|
6340 if ( adapter ) |
|
6341 { |
|
6342 adapter->HandleMenuPropertyChangeL( &aNode.PluginIfL(), aProperty ); |
|
6343 } |
|
6344 } |
|
6345 else if ( aNode.IsLayoutCapable() ) |
|
6346 { |
|
6347 CXnControlAdapter* adapter( aNode.Control() ); |
|
6348 |
|
6349 if ( adapter ) |
|
6350 { |
|
6351 adapter->HandlePropertyChangeL( aProperty ); |
|
6352 } |
|
6353 } |
|
6354 } |
|
6355 } |
|
6356 |
|
6357 // ----------------------------------------------------------------------------- |
|
6358 // Informs parent and its children about the property change. |
|
6359 // ----------------------------------------------------------------------------- |
|
6360 // |
|
6361 static void InformChildrenPropertyChangeL( |
|
6362 CXnNode& aParent, |
|
6363 CXnProperty* aProperty, |
|
6364 TBool aInformParent = ETrue ) |
|
6365 { |
|
6366 RPointerArray< CXnNode >& children( aParent.Children() ); |
|
6367 if ( aInformParent ) |
|
6368 { |
|
6369 InformPropertyChangeL( aParent, aProperty ); |
|
6370 } |
|
6371 TInt count( children.Count() ); |
|
6372 for ( TInt i = 0 ; i < count; i++ ) |
|
6373 { |
|
6374 InformChildrenPropertyChangeL( *children[i], aProperty, ETrue ); |
|
6375 } |
|
6376 } |
|
6377 |
|
6378 // ----------------------------------------------------------------------------- |
|
6379 // DisplayValueMatchL |
|
6380 // ----------------------------------------------------------------------------- |
|
6381 // |
|
6382 static TBool DisplayValueMatchL( |
|
6383 CXnNode& aNode, |
|
6384 const TDesC8& aDisplayValue ) |
|
6385 { |
|
6386 CXnProperty* display = aNode.GetPropertyL( KDisplay ); |
|
6387 if ( display ) |
|
6388 { |
|
6389 const TDesC8& value = display->StringValue(); |
|
6390 if ( value.Compare( aDisplayValue ) == KErrNone ) |
|
6391 { |
|
6392 return ETrue; |
|
6393 } |
|
6394 } |
|
6395 return EFalse; |
|
6396 } |
|
6397 |
|
6398 // ----------------------------------------------------------------------------- |
|
6399 // SetFloatPropertyToNodeL |
|
6400 // Set float property to a node |
|
6401 // ----------------------------------------------------------------------------- |
|
6402 // |
|
6403 static void SetFloatPropertyToNodeL( |
|
6404 CXnDomStringPool& aStringPool, CXnNode& aNode, |
|
6405 const TDesC8& aPropertyName, TReal aPropertyValue, |
|
6406 CXnDomPropertyValue::TPrimitiveValueType aValueType ) |
|
6407 { |
|
6408 // create property |
|
6409 CXnProperty* prop = CXnProperty::NewL( |
|
6410 aPropertyName, aPropertyValue, aValueType, aStringPool ); |
|
6411 |
|
6412 CleanupStack::PushL( prop ); |
|
6413 aNode.SetPropertyL( prop ); |
|
6414 CleanupStack::Pop( prop ); |
|
6415 } |
|
6416 |
|
6417 // ----------------------------------------------------------------------------- |
|
6418 // SetStringPropertyToNodeL |
|
6419 // Set string property to a node |
|
6420 // ----------------------------------------------------------------------------- |
|
6421 // |
|
6422 static void SetStringPropertyToNodeL( |
|
6423 CXnDomStringPool& aStringPool, |
|
6424 CXnNode& aNode, |
|
6425 const TDesC8& aPropertyName, |
|
6426 const TDesC8& aPropertyValue ) |
|
6427 { |
|
6428 // create property |
|
6429 CXnProperty* prop = CXnProperty::NewL( |
|
6430 aPropertyName, aPropertyValue, CXnDomPropertyValue::EString, aStringPool ); |
|
6431 |
|
6432 CleanupStack::PushL( prop ); |
|
6433 aNode.SetPropertyL( prop ); |
|
6434 CleanupStack::Pop( prop ); |
|
6435 } |
|
6436 |
|
6437 // ----------------------------------------------------------------------------- |
|
6438 // FindYoungestSiblingWithDisplayL |
|
6439 // Seek youngest sibling node with given display value |
|
6440 // ----------------------------------------------------------------------------- |
|
6441 // |
|
6442 static CXnNode* FindYoungestSiblingWithDisplayL( |
|
6443 RPointerArray< CXnNode >& aSiblingArray, |
|
6444 const TDesC8& aDisplayValue, |
|
6445 TInt& aIndex ) |
|
6446 { |
|
6447 aIndex = KErrNotFound; |
|
6448 CXnNode* node = NULL; |
|
6449 TInt siblingCount( aSiblingArray.Count() ); |
|
6450 //Find youngest sibling with display block |
|
6451 for ( TInt i = siblingCount; i > 0; ) |
|
6452 { |
|
6453 node = aSiblingArray[--i]; |
|
6454 if ( DisplayValueMatchL( *node, aDisplayValue ) ) |
|
6455 { |
|
6456 aIndex = i; |
|
6457 return node; |
|
6458 } |
|
6459 } |
|
6460 return NULL; |
|
6461 } |
|
6462 |
|
6463 // ----------------------------------------------------------------------------- |
|
6464 // FindOldestSiblingWithDisplayL |
|
6465 // Seek oldest sibling node with given display value |
|
6466 // ----------------------------------------------------------------------------- |
|
6467 // |
|
6468 static CXnNode* FindOldestSiblingWithDisplayL( |
|
6469 RPointerArray< CXnNode >& aSiblingArray, |
|
6470 const TDesC8& aDisplayValue, |
|
6471 TInt& aIndex ) |
|
6472 { |
|
6473 aIndex = KErrNotFound; |
|
6474 CXnNode* node = NULL; |
|
6475 TInt siblingCount( aSiblingArray.Count() ); |
|
6476 //Find oldest sibling with display block |
|
6477 for ( TInt i = 0; i < siblingCount; i++ ) |
|
6478 { |
|
6479 node = aSiblingArray[i]; |
|
6480 if ( DisplayValueMatchL( *node, aDisplayValue ) ) |
|
6481 { |
|
6482 aIndex = i; |
|
6483 return node; |
|
6484 } |
|
6485 } |
|
6486 return NULL; |
|
6487 } |
|
6488 |
|
6489 // ----------------------------------------------------------------------------- |
|
6490 // ScrollBoxToBeginningL |
|
6491 // Show the oldest siblings that fit into the compound box. |
|
6492 // ----------------------------------------------------------------------------- |
|
6493 // |
|
6494 static void ScrollBoxToBeginningL( RPointerArray< CXnNode >& aSiblingArray ) |
|
6495 { |
|
6496 CXnNode* node = NULL; |
|
6497 TInt toBeDisplayed(0); |
|
6498 TInt siblingCount( aSiblingArray.Count() ); |
|
6499 for ( TInt i = 0; i < siblingCount; i++ ) |
|
6500 { |
|
6501 node = aSiblingArray[i]; |
|
6502 if ( DisplayValueMatchL( *node, KBlock ) ) |
|
6503 { |
|
6504 CXnDomStringPool* sp = node->DomNode()->StringPool(); |
|
6505 //Switch the display to 'none' to visible siblings. |
|
6506 SetStringPropertyToNodeL( *sp, *node, KDisplay, KNone ); |
|
6507 node = aSiblingArray[toBeDisplayed]; |
|
6508 toBeDisplayed++; |
|
6509 //Switch the display to 'block' to hidden siblings. |
|
6510 SetStringPropertyToNodeL( *sp, *node, KDisplay, KBlock ); |
|
6511 } |
|
6512 } |
|
6513 } |
|
6514 |
|
6515 // ----------------------------------------------------------------------------- |
|
6516 // ScrollBoxToEndL |
|
6517 // Show the youngest siblings that fit into the compound box. |
|
6518 // ----------------------------------------------------------------------------- |
|
6519 // |
|
6520 static void ScrollBoxToEndL( RPointerArray< CXnNode >& aSiblingArray ) |
|
6521 { |
|
6522 CXnNode* node = NULL; |
|
6523 TInt siblingCount( aSiblingArray.Count() ); |
|
6524 TInt toBeDisplayed( siblingCount - 1 ); |
|
6525 for ( TInt i = siblingCount; i > 0; ) |
|
6526 { |
|
6527 node = aSiblingArray[--i]; |
|
6528 if ( DisplayValueMatchL( *node, KBlock ) ) |
|
6529 { |
|
6530 CXnDomStringPool* sp = node->DomNode()->StringPool(); |
|
6531 //Switch the display to 'none' to visible siblings. |
|
6532 SetStringPropertyToNodeL( *sp, *node, KDisplay, KNone ); |
|
6533 node = aSiblingArray[toBeDisplayed]; |
|
6534 toBeDisplayed--; |
|
6535 //Switch the display to 'block' to hidden siblings. |
|
6536 SetStringPropertyToNodeL( *sp, *node, KDisplay, KBlock ); |
|
6537 } |
|
6538 } |
|
6539 } |
|
6540 |
|
6541 // ----------------------------------------------------------------------------- |
|
6542 // IsCompoundNodeL |
|
6543 // Checks whether the node is coumound node. |
|
6544 // ----------------------------------------------------------------------------- |
|
6545 // |
|
6546 static TBool IsCompoundNodeL( CXnNode* aNode ) |
|
6547 { |
|
6548 if ( !aNode ) |
|
6549 { |
|
6550 return EFalse; |
|
6551 } |
|
6552 CXnProperty* compoundProperty = aNode->GetPropertyL( KCompound ); |
|
6553 if ( compoundProperty ) |
|
6554 { |
|
6555 const TDesC8& value = compoundProperty->StringValue(); |
|
6556 if ( !value.Compare( KTrue ) ) |
|
6557 { |
|
6558 return ETrue; |
|
6559 } |
|
6560 } |
|
6561 return EFalse; |
|
6562 } |
|
6563 |
|
6564 // ----------------------------------------------------------------------------- |
|
6565 // IsLoopingSetL |
|
6566 // Checks whether the node is set to loop. |
|
6567 // ----------------------------------------------------------------------------- |
|
6568 // |
|
6569 static TBool IsLoopingNodeL( CXnNode* aNode ) |
|
6570 { |
|
6571 if ( !aNode ) |
|
6572 { |
|
6573 return EFalse; |
|
6574 } |
|
6575 CXnProperty* navLoopProperty = aNode->GetPropertyL( |
|
6576 XnPropertyNames::style::common::KS60NavLooping ); |
|
6577 if ( navLoopProperty ) |
|
6578 { |
|
6579 const TDesC8& loopValue = navLoopProperty->StringValue(); |
|
6580 if ( loopValue == XnPropertyNames::style::common::s60_focus_looping::KStop ) |
|
6581 { |
|
6582 return EFalse; |
|
6583 } |
|
6584 } |
|
6585 return ETrue; |
|
6586 } |
|
6587 |
|
6588 // ----------------------------------------------------------------------------- |
|
6589 // NotifyScrollNodeL |
|
6590 // Notify scroll node i.e compound box first and last siblings that there is |
|
6591 // nothing more to scroll |
|
6592 // ----------------------------------------------------------------------------- |
|
6593 // |
|
6594 static void NotifyScrollNodeL( CXnNode* aNode, TBool aBegin, TBool aGainEnd ) |
|
6595 { |
|
6596 RPointerArray< CXnNode >& siblings = aNode->Parent()->Children(); |
|
6597 // Last sibling is assumend to be an end scrolling node |
|
6598 CXnNode* scrollNode = siblings[0]; |
|
6599 if ( !aBegin ) |
|
6600 { |
|
6601 scrollNode = siblings[siblings.Count() - 1]; |
|
6602 } |
|
6603 CXnNode* triggerNode = |
|
6604 BuildTriggerNodeL( *scrollNode->UiEngine(), aGainEnd?KGainEnd:KLoseEnd ); |
|
6605 triggerNode->SetUiEngine( *scrollNode->UiEngine() ); |
|
6606 CleanupStack::PushL( triggerNode ); |
|
6607 scrollNode->ReportXuikonEventL( *triggerNode ); |
|
6608 CleanupStack::PopAndDestroy( triggerNode ); |
|
6609 } |
|
6610 |
|
6611 // ----------------------------------------------------------------------------- |
|
6612 // DoCompoundNodeBeginKeyL |
|
6613 // If key towards begin of list was pressed scroll to that direction |
|
6614 // ----------------------------------------------------------------------------- |
|
6615 // |
|
6616 static void DoCompoundNodeBeginKeyL( |
|
6617 RPointerArray< CXnNode >& aChildren, |
|
6618 CXnNode* aFocusedNode ) |
|
6619 { |
|
6620 TInt oldestIndex( 0 ); |
|
6621 // Notify scrollNode if aFocusedNode is node end of the list |
|
6622 CXnNode* lastItem = aChildren[aChildren.Count() - 1]; |
|
6623 if ( aFocusedNode == lastItem && !IsLoopingNodeL( lastItem ) ) |
|
6624 { |
|
6625 NotifyScrollNodeL( aChildren[0]->Parent(), EFalse, EFalse ); |
|
6626 } |
|
6627 CXnNode* node = FindOldestSiblingWithDisplayL( aChildren, KBlock, oldestIndex ); |
|
6628 // Set next node's display to block |
|
6629 if ( node && node == aFocusedNode ) |
|
6630 { |
|
6631 if ( oldestIndex - 1 >= 0 ) |
|
6632 { |
|
6633 node = aChildren[oldestIndex - 1]; |
|
6634 CXnDomStringPool* sp = node->DomNode()->StringPool(); |
|
6635 SetStringPropertyToNodeL( *sp, *node, KDisplay, KBlock ); |
|
6636 // find youngest sibling with display block |
|
6637 TInt index( 0 ); |
|
6638 node = FindYoungestSiblingWithDisplayL( aChildren, KBlock, index ); |
|
6639 if ( node ) |
|
6640 { |
|
6641 SetStringPropertyToNodeL( *sp, *node, KDisplay, KNone ); |
|
6642 } |
|
6643 } |
|
6644 else |
|
6645 { |
|
6646 if ( IsLoopingNodeL( node ) ) |
|
6647 { |
|
6648 ScrollBoxToEndL( aChildren ); |
|
6649 } |
|
6650 else |
|
6651 { |
|
6652 NotifyScrollNodeL( aChildren[0]->Parent(), ETrue, ETrue ); |
|
6653 } |
|
6654 } |
|
6655 } |
|
6656 } |
|
6657 |
|
6658 // ----------------------------------------------------------------------------- |
|
6659 // DoCompoundNodeEndKeyL |
|
6660 // If key towards end of list was pressed scroll to that direction |
|
6661 // ----------------------------------------------------------------------------- |
|
6662 // |
|
6663 static void DoCompoundNodeEndKeyL( |
|
6664 RPointerArray< CXnNode >& aChildren, |
|
6665 CXnNode* aFocusedNode ) |
|
6666 { |
|
6667 TInt index( 0 ); |
|
6668 TInt siblingCount( aChildren.Count() ); |
|
6669 // Notify scrollNode if aFocusedNode is first node of the list |
|
6670 CXnNode* firstItem = aChildren[0]; |
|
6671 if ( aFocusedNode == firstItem && !IsLoopingNodeL( firstItem ) ) |
|
6672 { |
|
6673 NotifyScrollNodeL( aChildren[0]->Parent(), ETrue, EFalse ); |
|
6674 } |
|
6675 CXnNode* node = FindYoungestSiblingWithDisplayL( aChildren, KBlock, index ); |
|
6676 // Set next node's display to block |
|
6677 if ( node && node == aFocusedNode ) |
|
6678 { |
|
6679 if ( index < siblingCount - 1 ) |
|
6680 { |
|
6681 node = aChildren[index + 1]; |
|
6682 CXnDomStringPool* sp = node->DomNode()->StringPool(); |
|
6683 SetStringPropertyToNodeL( *sp , *node, KDisplay, KBlock ); |
|
6684 // find oldest sibling with display block |
|
6685 TInt oldestIndex( 0 ); |
|
6686 node = FindOldestSiblingWithDisplayL( aChildren, KBlock, oldestIndex ); |
|
6687 if ( node ) |
|
6688 { |
|
6689 SetStringPropertyToNodeL( *sp, *node, KDisplay, KNone ); |
|
6690 } |
|
6691 } |
|
6692 else // we are end of list |
|
6693 { |
|
6694 if ( IsLoopingNodeL( node ) ) |
|
6695 { |
|
6696 ScrollBoxToBeginningL( aChildren ); |
|
6697 } |
|
6698 else |
|
6699 { |
|
6700 NotifyScrollNodeL( aChildren[0]->Parent(), EFalse, ETrue ); |
|
6701 } |
|
6702 } |
|
6703 } |
|
6704 } |
|
6705 |
|
6706 // ----------------------------------------------------------------------------- |
|
6707 // DoCompoundNodeScrollingL |
|
6708 // Process compound node key events |
|
6709 // ----------------------------------------------------------------------------- |
|
6710 // |
|
6711 static void DoCompoundNodeScrollingL( |
|
6712 CXnNode& aFocusedNode, |
|
6713 const TKeyEvent& aKeyEvent, |
|
6714 TEventCode aType ) |
|
6715 { |
|
6716 if ( aType != EEventKey ) |
|
6717 { |
|
6718 return; |
|
6719 } |
|
6720 CXnNode* compoundNode = aFocusedNode.Parent(); |
|
6721 if ( IsCompoundNodeL( compoundNode ) ) |
|
6722 { |
|
6723 RPointerArray< CXnNode >& children = compoundNode->Children(); |
|
6724 |
|
6725 if ( aKeyEvent.iScanCode != EStdKeyLeftArrow && |
|
6726 aKeyEvent.iScanCode != EStdKeyRightArrow && |
|
6727 aKeyEvent.iScanCode != EStdKeyDownArrow && |
|
6728 aKeyEvent.iScanCode != EStdKeyUpArrow ) |
|
6729 { |
|
6730 return; |
|
6731 } |
|
6732 CXnNode* parent = aFocusedNode.Parent(); |
|
6733 if ( !parent ) |
|
6734 { |
|
6735 return; |
|
6736 } |
|
6737 else |
|
6738 { |
|
6739 const TDesC8* direction( |
|
6740 &XnPropertyNames::style::common::direction::KLTR ); |
|
6741 const TDesC8* orientation( |
|
6742 &XnPropertyNames::style::common::block_progression::KTB ); |
|
6743 |
|
6744 CXnProperty* directionProperty( parent->DirectionL() ); |
|
6745 |
|
6746 if ( directionProperty ) |
|
6747 { |
|
6748 direction = &directionProperty->StringValue(); |
|
6749 } |
|
6750 |
|
6751 CXnProperty* orientationProperty( parent->BlockProgressionL() ); |
|
6752 |
|
6753 if ( orientationProperty ) |
|
6754 { |
|
6755 orientation = &orientationProperty->StringValue(); |
|
6756 } |
|
6757 |
|
6758 if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
6759 ( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
6760 *orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
6761 { |
|
6762 if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
6763 { |
|
6764 DoCompoundNodeBeginKeyL( children, &aFocusedNode ); |
|
6765 } |
|
6766 if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
6767 { |
|
6768 DoCompoundNodeEndKeyL( children, &aFocusedNode ); |
|
6769 } |
|
6770 } |
|
6771 else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
6772 ( *orientation == XnPropertyNames::style::common::block_progression::KLR || |
|
6773 *orientation == XnPropertyNames::style::common::block_progression::KRL ) ) |
|
6774 { |
|
6775 if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
6776 { |
|
6777 DoCompoundNodeEndKeyL( children, &aFocusedNode ); |
|
6778 } |
|
6779 if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
6780 { |
|
6781 DoCompoundNodeBeginKeyL( children, &aFocusedNode ); |
|
6782 } |
|
6783 } |
|
6784 else if ( *direction == XnPropertyNames::style::common::direction::KLTR && |
|
6785 *orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
6786 { |
|
6787 if ( aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
6788 { |
|
6789 DoCompoundNodeBeginKeyL( children, &aFocusedNode ); |
|
6790 } |
|
6791 else if ( aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
6792 { |
|
6793 DoCompoundNodeEndKeyL( children, &aFocusedNode ); |
|
6794 } |
|
6795 } |
|
6796 else if ( *direction == XnPropertyNames::style::common::direction::KRTL && |
|
6797 *orientation == XnPropertyNames::style::common::block_progression::KTB ) |
|
6798 { |
|
6799 if ( aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
6800 { |
|
6801 DoCompoundNodeBeginKeyL( children, &aFocusedNode ); |
|
6802 } |
|
6803 else if ( aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
6804 { |
|
6805 DoCompoundNodeEndKeyL( children, &aFocusedNode ); |
|
6806 } |
|
6807 } |
|
6808 } |
|
6809 } |
|
6810 } |
|
6811 |
|
6812 // ----------------------------------------------------------------------------- |
|
6813 // BuildTriggerNodeL |
|
6814 // Builds a trigger node |
|
6815 // ----------------------------------------------------------------------------- |
|
6816 // |
|
6817 static CXnNode* BuildTriggerNodeL( |
|
6818 CXnUiEngine& aUiEngine, |
|
6819 const TDesC8& aTriggerName ) |
|
6820 { |
|
6821 CXnNode* node = CXnNode::NewL(); |
|
6822 CleanupStack::PushL( node ); |
|
6823 CXnType* type = CXnType::NewL( XnPropertyNames::action::KTrigger ); |
|
6824 CleanupStack::PushL( type ); |
|
6825 CXnNodeImpl* impl = CXnNodeImpl::NewL( type ); |
|
6826 CleanupStack::Pop( type ); |
|
6827 node->SetImpl( impl ); |
|
6828 node->SetUiEngine( aUiEngine ); |
|
6829 CXnDomPropertyValue* nameValue = |
|
6830 CXnDomPropertyValue::NewL( aUiEngine.ODT()->DomDocument().StringPool() ); |
|
6831 CleanupStack::PushL( nameValue ); |
|
6832 nameValue->SetStringValueL( CXnDomPropertyValue::EString, aTriggerName ); |
|
6833 CXnProperty* name = CXnProperty::NewL( |
|
6834 XnPropertyNames::action::trigger::KName, |
|
6835 nameValue, |
|
6836 *aUiEngine.ODT()->DomDocument().StringPool() ); |
|
6837 CleanupStack::Pop( nameValue ); |
|
6838 CleanupStack::PushL( name ); |
|
6839 node->SetPropertyL( name ); |
|
6840 CleanupStack::Pop( name ); |
|
6841 CleanupStack::Pop( node ); |
|
6842 return node; |
|
6843 } |
|
6844 |
|
6845 // ============================ MEMBER FUNCTIONS =============================== |
|
6846 |
|
6847 // ----------------------------------------------------------------------------- |
|
6848 // CXnNodeImpl::NewL() |
|
6849 // Two-phased constructor. |
|
6850 // ----------------------------------------------------------------------------- |
|
6851 // |
|
6852 CXnNodeImpl* CXnNodeImpl::NewL( CXnType* aType ) |
|
6853 { |
|
6854 CXnNodeImpl* self = new ( ELeave ) CXnNodeImpl; |
|
6855 |
|
6856 CleanupStack::PushL( self ); |
|
6857 self->ConstructL( aType ); |
|
6858 CleanupStack::Pop(); |
|
6859 |
|
6860 return self; |
|
6861 } |
|
6862 |
|
6863 // ----------------------------------------------------------------------------- |
|
6864 // CXnNodeImpl::ConstructL() |
|
6865 // Symbian 2nd phase constructor can leave. |
|
6866 // ----------------------------------------------------------------------------- |
|
6867 // |
|
6868 void CXnNodeImpl::ConstructL( CXnType* aType ) |
|
6869 { |
|
6870 iType = aType; |
|
6871 iPropertyList = CXnPropertyList::NewL(); |
|
6872 iLayoutCapable = ETrue; |
|
6873 iHandleTooltip = ETrue; |
|
6874 } |
|
6875 |
|
6876 // ----------------------------------------------------------------------------- |
|
6877 // CXnNodeImpl::CXnNodeImpl() |
|
6878 // C++ default constructor can NOT contain any code, that |
|
6879 // might leave. |
|
6880 // ----------------------------------------------------------------------------- |
|
6881 // |
|
6882 CXnNodeImpl::CXnNodeImpl() |
|
6883 : iDropped( 0 ), iChildren( 1 ), iAdaptive( 0 ) |
|
6884 { |
|
6885 } |
|
6886 |
|
6887 // ----------------------------------------------------------------------------- |
|
6888 // CXnNodeImpl::~CXnNodeImpl() |
|
6889 // C++ default destructor. |
|
6890 // ----------------------------------------------------------------------------- |
|
6891 // |
|
6892 CXnNodeImpl::~CXnNodeImpl() |
|
6893 { |
|
6894 delete iPropertyList; |
|
6895 delete iType; |
|
6896 iPropertyPseudoClasses.Reset(); |
|
6897 iStates.Reset(); |
|
6898 iChildren.ResetAndDestroy(); |
|
6899 delete iLayoutPropertyCache; |
|
6900 } |
|
6901 |
|
6902 // ----------------------------------------------------------------------------- |
|
6903 // CXnNodeImpl::SetNode |
|
6904 // ----------------------------------------------------------------------------- |
|
6905 // |
|
6906 void CXnNodeImpl::SetNode( CXnNode& aNode ) |
|
6907 { |
|
6908 iNode = &aNode; |
|
6909 } |
|
6910 |
|
6911 // ----------------------------------------------------------------------------- |
|
6912 // CXnNodeImpl::Node |
|
6913 // ----------------------------------------------------------------------------- |
|
6914 // |
|
6915 CXnNode* CXnNodeImpl::Node() |
|
6916 { |
|
6917 return iNode; |
|
6918 } |
|
6919 |
|
6920 // ----------------------------------------------------------------------------- |
|
6921 // CXnNodeImpl::SetRect |
|
6922 // ----------------------------------------------------------------------------- |
|
6923 // |
|
6924 void CXnNodeImpl::SetRect( const TRect& aRect ) |
|
6925 { |
|
6926 iRect = aRect; |
|
6927 } |
|
6928 |
|
6929 // ----------------------------------------------------------------------------- |
|
6930 // CXnNodeImpl::Rect |
|
6931 // ----------------------------------------------------------------------------- |
|
6932 // |
|
6933 TRect CXnNodeImpl::Rect() |
|
6934 { |
|
6935 return AdjustRectIfNeeded(iRect); |
|
6936 } |
|
6937 |
|
6938 // ----------------------------------------------------------------------------- |
|
6939 // CXnNodeImpl::SetBorderRect |
|
6940 // ----------------------------------------------------------------------------- |
|
6941 // |
|
6942 void CXnNodeImpl::SetBorderRect( const TRect& aRect ) |
|
6943 { |
|
6944 iBorderRect = aRect; |
|
6945 } |
|
6946 |
|
6947 // ----------------------------------------------------------------------------- |
|
6948 // CXnNodeImpl::BorderRect |
|
6949 // ----------------------------------------------------------------------------- |
|
6950 // |
|
6951 TRect CXnNodeImpl::BorderRect() |
|
6952 { |
|
6953 return AdjustRectIfNeeded(iBorderRect); |
|
6954 } |
|
6955 |
|
6956 // ----------------------------------------------------------------------------- |
|
6957 // CXnNodeImpl::SetNormalFlowBorderRect |
|
6958 // ----------------------------------------------------------------------------- |
|
6959 // |
|
6960 void CXnNodeImpl::SetNormalFlowBorderRect( const TRect& aRect ) |
|
6961 { |
|
6962 iNormalFlowBorderRect = aRect; |
|
6963 } |
|
6964 |
|
6965 // ----------------------------------------------------------------------------- |
|
6966 // CXnNodeImpl::NormalFlowBorderRect |
|
6967 // ----------------------------------------------------------------------------- |
|
6968 // |
|
6969 TRect CXnNodeImpl::NormalFlowBorderRect() |
|
6970 { |
|
6971 return AdjustRectIfNeeded(iNormalFlowBorderRect); |
|
6972 } |
|
6973 |
|
6974 // ----------------------------------------------------------------------------- |
|
6975 // CXnNodeImpl::SetMarginRect |
|
6976 // ----------------------------------------------------------------------------- |
|
6977 // |
|
6978 void CXnNodeImpl::SetMarginRect( const TRect& aRect ) |
|
6979 { |
|
6980 iMarginRect = aRect; |
|
6981 } |
|
6982 |
|
6983 // ----------------------------------------------------------------------------- |
|
6984 // CXnNodeImpl::MarginRect |
|
6985 // ----------------------------------------------------------------------------- |
|
6986 // |
|
6987 TRect CXnNodeImpl::MarginRect() |
|
6988 { |
|
6989 return AdjustRectIfNeeded(iMarginRect); |
|
6990 } |
|
6991 |
|
6992 // ----------------------------------------------------------------------------- |
|
6993 // CXnNodeImpl::SetPaddingRect |
|
6994 // ----------------------------------------------------------------------------- |
|
6995 // |
|
6996 void CXnNodeImpl::SetPaddingRect( const TRect& aRect ) |
|
6997 { |
|
6998 iPaddingRect = aRect; |
|
6999 } |
|
7000 |
|
7001 // ----------------------------------------------------------------------------- |
|
7002 // CXnNodeImpl::PaddingRect |
|
7003 // ----------------------------------------------------------------------------- |
|
7004 // |
|
7005 TRect CXnNodeImpl::PaddingRect() |
|
7006 { |
|
7007 return AdjustRectIfNeeded(iPaddingRect); |
|
7008 } |
|
7009 |
|
7010 // ----------------------------------------------------------------------------- |
|
7011 // CXnNodeImpl::Type() |
|
7012 // Returns control type. |
|
7013 // ----------------------------------------------------------------------------- |
|
7014 // |
|
7015 CXnType* CXnNodeImpl::Type() |
|
7016 { |
|
7017 return iType; |
|
7018 } |
|
7019 |
|
7020 // ----------------------------------------------------------------------------- |
|
7021 // CXnNodeImpl::Parent |
|
7022 // Get component parent |
|
7023 // ----------------------------------------------------------------------------- |
|
7024 // |
|
7025 CXnNode* CXnNodeImpl::Parent() const |
|
7026 { |
|
7027 return iParent; |
|
7028 } |
|
7029 |
|
7030 // ----------------------------------------------------------------------------- |
|
7031 // CXnNodeImpl::SetParent |
|
7032 // Set component parent |
|
7033 // ----------------------------------------------------------------------------- |
|
7034 // |
|
7035 void CXnNodeImpl::SetParent( CXnNode& aParent ) |
|
7036 { |
|
7037 iParent = &aParent; |
|
7038 } |
|
7039 |
|
7040 // ----------------------------------------------------------------------------- |
|
7041 // CXnNodeImpl::AddChildL |
|
7042 // Adds a child to this container. |
|
7043 // ----------------------------------------------------------------------------- |
|
7044 // |
|
7045 void CXnNodeImpl::AddChildL( CXnNode* aChild ) |
|
7046 { |
|
7047 TInt err = iChildren.Append( aChild ); |
|
7048 if ( err != KErrNone ) |
|
7049 { |
|
7050 User::Leave( KXnErrAddChildToAreaFailed ); |
|
7051 } |
|
7052 aChild->SetParent( *iNode ); |
|
7053 } |
|
7054 |
|
7055 // ----------------------------------------------------------------------------- |
|
7056 // CXnNodeImpl::Children |
|
7057 // ----------------------------------------------------------------------------- |
|
7058 // |
|
7059 RPointerArray< CXnNode >& CXnNodeImpl::Children() |
|
7060 { |
|
7061 return iChildren; |
|
7062 } |
|
7063 |
|
7064 // ----------------------------------------------------------------------------- |
|
7065 // CXnNodeImpl::SetPCDataL |
|
7066 // Set a property. |
|
7067 // ----------------------------------------------------------------------------- |
|
7068 // |
|
7069 void CXnNodeImpl::SetPCDataL( const TDesC8& aData ) |
|
7070 { |
|
7071 iDomNode->SetPCDataL( aData ); |
|
7072 |
|
7073 SetDirtyL( XnDirtyLevel::ERender ); |
|
7074 |
|
7075 CXnDomStringPool* sp( iDomNode->StringPool() ); |
|
7076 |
|
7077 CXnDomPropertyValue* newValue = CXnDomPropertyValue::NewL( sp ); |
|
7078 CleanupStack::PushL( newValue ); |
|
7079 newValue->SetStringValueL( CXnDomPropertyValue::EString, KNullDesC8 ); |
|
7080 // create property |
|
7081 CXnProperty* prop = CXnProperty::NewL( |
|
7082 XnPropertyNames::common::KPCData, newValue, *sp ); |
|
7083 CleanupStack::Pop( newValue ); |
|
7084 CleanupStack::PushL( prop ); |
|
7085 |
|
7086 InformPropertyChangeL( *iNode, prop ); |
|
7087 |
|
7088 CleanupStack::PopAndDestroy( prop ); |
|
7089 } |
|
7090 |
|
7091 // ----------------------------------------------------------------------------- |
|
7092 // CXnNodeImpl::GetPCData |
|
7093 // Set a property. |
|
7094 // ----------------------------------------------------------------------------- |
|
7095 // |
|
7096 const TDesC8& CXnNodeImpl::GetPCData() |
|
7097 { |
|
7098 return iDomNode->PCData(); |
|
7099 } |
|
7100 |
|
7101 // ----------------------------------------------------------------------------- |
|
7102 // CXnNodeImpl::SetHandleTooltip() |
|
7103 // Sets wheter to handle tooltips |
|
7104 // ----------------------------------------------------------------------------- |
|
7105 // |
|
7106 void CXnNodeImpl::SetHandleTooltip( TBool aFlag ) |
|
7107 { |
|
7108 iHandleTooltip = aFlag; |
|
7109 } |
|
7110 |
|
7111 // ----------------------------------------------------------------------------- |
|
7112 // CXnNodeImpl::ShowPopupsL() |
|
7113 // Searchs and shoes tooltips |
|
7114 // ----------------------------------------------------------------------------- |
|
7115 // |
|
7116 void CXnNodeImpl::ShowPopupsL( TRect aRect, TInt aSource ) |
|
7117 { |
|
7118 if ( iHandleTooltip ) |
|
7119 { |
|
7120 for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
7121 { |
|
7122 CXnNode* node( iChildren[i] ); |
|
7123 |
|
7124 if ( node->Type()->Type() == KToolTip ) |
|
7125 { |
|
7126 CXnNodeAppIf& tooltipNode( node->AppIfL() ); |
|
7127 CXnPopup* popup( NULL ); |
|
7128 |
|
7129 XnComponentInterface::MakeInterfaceL( popup, tooltipNode ); |
|
7130 |
|
7131 if ( popup && aSource != XnEventSource::EStylus ) |
|
7132 { |
|
7133 popup->ShowPopupL( aRect ); |
|
7134 } |
|
7135 } |
|
7136 } |
|
7137 } |
|
7138 } |
|
7139 |
|
7140 // ----------------------------------------------------------------------------- |
|
7141 // CXnNodeImpl::HidePopupsL() |
|
7142 // Searchs and hides tooltips |
|
7143 // ----------------------------------------------------------------------------- |
|
7144 // |
|
7145 void CXnNodeImpl::HidePopupsL() |
|
7146 { |
|
7147 if ( iHandleTooltip ) |
|
7148 { |
|
7149 for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
7150 { |
|
7151 CXnNode* node( iChildren[i] ); |
|
7152 |
|
7153 if ( node->Type()->Type() == KToolTip ) |
|
7154 { |
|
7155 CXnNodeAppIf& tooltipNode( node->AppIfL() ); |
|
7156 CXnPopup* popup( NULL ); |
|
7157 |
|
7158 XnComponentInterface::MakeInterfaceL( popup, tooltipNode ); |
|
7159 |
|
7160 if ( popup ) |
|
7161 { |
|
7162 popup->HidePopupL(); |
|
7163 } |
|
7164 } |
|
7165 } |
|
7166 } |
|
7167 } |
|
7168 |
|
7169 // ----------------------------------------------------------------------------- |
|
7170 // CXnNodeImpl::SetPropertyL |
|
7171 // Sets a property, informs property change and builds trigger. |
|
7172 // ----------------------------------------------------------------------------- |
|
7173 // |
|
7174 void CXnNodeImpl::SetPropertyL( CXnProperty* aProperty, TBool aNotify ) |
|
7175 { |
|
7176 TInt level( DoSetPropertyL( aProperty ) ); |
|
7177 |
|
7178 if ( !aNotify || level == XnDirtyLevel::ENone ) |
|
7179 { |
|
7180 // all done |
|
7181 return; |
|
7182 } |
|
7183 |
|
7184 InformPropertyChangeL( *iNode, aProperty ); |
|
7185 |
|
7186 if ( iLayoutCapable && iNode->Parent() ) |
|
7187 { |
|
7188 const TDesC8* value( NULL ); |
|
7189 const TDesC8& name( aProperty->Property()->Name() ); |
|
7190 TBool informChildren( EFalse ); |
|
7191 |
|
7192 if ( name == XnPropertyNames::style::common::KDisplay ) |
|
7193 { |
|
7194 value = &XnPropertyNames::style::common::display::KNone; |
|
7195 informChildren = ETrue; |
|
7196 } |
|
7197 else if ( name == XnPropertyNames::style::common::KVisibility ) |
|
7198 { |
|
7199 value = &XnPropertyNames::style::common::visibility::KHidden; |
|
7200 informChildren = ETrue; |
|
7201 } |
|
7202 |
|
7203 if ( value ) |
|
7204 { |
|
7205 if ( *value == aProperty->StringValue() ) |
|
7206 { |
|
7207 CXnNode* loseVisualisation( |
|
7208 BuildTriggerNodeL( |
|
7209 *iUiEngine, |
|
7210 XnPropertyNames::action::trigger::name::KLoseVisualisation ) ); |
|
7211 |
|
7212 CleanupStack::PushL( loseVisualisation ); |
|
7213 |
|
7214 CXnNode* focused( iUiEngine->FocusedNode() ); |
|
7215 |
|
7216 for ( CXnNode* node = focused; node; node = node->Parent() ) |
|
7217 { |
|
7218 if ( node == iNode ) |
|
7219 { |
|
7220 // Focus is either in this node or |
|
7221 // somewhere in this node's childrens |
|
7222 focused->UnsetStateL( |
|
7223 XnPropertyNames::style::common::KFocus ); |
|
7224 |
|
7225 focused->UnsetStateL( |
|
7226 XnPropertyNames::style::common::KHold ); |
|
7227 |
|
7228 focused->UnsetStateL( |
|
7229 XnPropertyNames::style::common::KActive ); |
|
7230 |
|
7231 // Report losevisualisation to focused node if the node |
|
7232 // is 'visualisationaware' |
|
7233 CXnProperty* visaware = GetPropertyL( |
|
7234 XnPropertyNames::common::KVisualisationAware ); |
|
7235 |
|
7236 if ( visaware && visaware->StringValue() == |
|
7237 XnPropertyNames::KTrue ) |
|
7238 { |
|
7239 focused->ReportXuikonEventL( *loseVisualisation ); |
|
7240 } |
|
7241 |
|
7242 break; |
|
7243 } |
|
7244 } |
|
7245 |
|
7246 if ( focused != iNode ) |
|
7247 { |
|
7248 // Report losevisualisation to this node if the node |
|
7249 // is 'visualisationaware' |
|
7250 CXnProperty* visaware = GetPropertyL( |
|
7251 XnPropertyNames::common::KVisualisationAware ); |
|
7252 if ( visaware && visaware->StringValue() == |
|
7253 XnPropertyNames::KTrue ) |
|
7254 { |
|
7255 iNode->ReportXuikonEventL( *loseVisualisation ); |
|
7256 } |
|
7257 } |
|
7258 |
|
7259 CleanupStack::PopAndDestroy( loseVisualisation ); |
|
7260 } |
|
7261 else |
|
7262 { |
|
7263 if ( !iUiEngine->FocusedNode() ) |
|
7264 { |
|
7265 CXnNode* node( IsNodeNavigableL( Node() ) ); |
|
7266 |
|
7267 if ( node ) |
|
7268 { |
|
7269 // This node can be focused |
|
7270 iUiEngine->AddFocusCandidateL( node ); |
|
7271 } |
|
7272 } |
|
7273 } |
|
7274 } |
|
7275 |
|
7276 if ( informChildren && ( iNode->Children().Count() > 0 ) ) |
|
7277 { |
|
7278 //we have already done inform for the parent, so EFalse |
|
7279 InformChildrenPropertyChangeL( *iNode, aProperty, EFalse ); |
|
7280 } |
|
7281 } |
|
7282 } |
|
7283 |
|
7284 // ----------------------------------------------------------------------------- |
|
7285 // CXnNodeImpl::SetPropertyWithoutNotificationL |
|
7286 // Sets a property. |
|
7287 // ----------------------------------------------------------------------------- |
|
7288 // |
|
7289 void CXnNodeImpl::SetPropertyWithoutNotificationL( CXnProperty* aProperty ) |
|
7290 { |
|
7291 SetPropertyL( aProperty, EFalse ); |
|
7292 } |
|
7293 |
|
7294 // ----------------------------------------------------------------------------- |
|
7295 // CXnNodeImpl::SetPropertyArrayL |
|
7296 // Sets an array of properties and after all the properties are set informs |
|
7297 // property change. |
|
7298 // ----------------------------------------------------------------------------- |
|
7299 // |
|
7300 void CXnNodeImpl::SetPropertyArrayL( |
|
7301 RPointerArray< CXnProperty >& aPropertyArray ) |
|
7302 { |
|
7303 TBool informPropertyChange( EFalse ); |
|
7304 |
|
7305 TInt count( aPropertyArray.Count() ); |
|
7306 |
|
7307 iUiEngine->DisableRenderUiLC(); |
|
7308 |
|
7309 for ( TInt i = 0; i < count; i++ ) |
|
7310 { |
|
7311 CXnProperty* aProp( aPropertyArray[i] ); |
|
7312 |
|
7313 const TDesC8& name( aProp->Property()->Name() ); |
|
7314 |
|
7315 if ( name == XnPropertyNames::style::common::KDisplay || |
|
7316 name == XnPropertyNames::style::common::KVisibility ) |
|
7317 { |
|
7318 SetPropertyL( aProp ); |
|
7319 } |
|
7320 else |
|
7321 { |
|
7322 SetPropertyL( aProp, EFalse ); |
|
7323 informPropertyChange = ETrue; |
|
7324 } |
|
7325 } |
|
7326 |
|
7327 if ( informPropertyChange ) |
|
7328 { |
|
7329 InformPropertyChangeL( *iNode, NULL ); |
|
7330 } |
|
7331 |
|
7332 CleanupStack::PopAndDestroy(); |
|
7333 } |
|
7334 |
|
7335 // ----------------------------------------------------------------------------- |
|
7336 // CXnNodeImpl::DoSetPropertyL |
|
7337 // Does the actual property update |
|
7338 // ----------------------------------------------------------------------------- |
|
7339 // |
|
7340 TInt CXnNodeImpl::DoSetPropertyL( CXnProperty* aProperty ) |
|
7341 { |
|
7342 TInt level( XnDirtyLevel::ENone ); |
|
7343 |
|
7344 const TDesC8& name( aProperty->Property()->Name() ); |
|
7345 |
|
7346 CXnProperty* prop( GetPropertyL( name ) ); |
|
7347 |
|
7348 if ( prop && prop->EqualsL( *aProperty ) ) |
|
7349 { |
|
7350 // No change in the property value |
|
7351 delete aProperty; |
|
7352 |
|
7353 return level; |
|
7354 } |
|
7355 |
|
7356 level = DirtyLevelFromPropertyL( *iNode, name ); |
|
7357 |
|
7358 // Save the displayed state, before setting the property |
|
7359 TBool isDisplayed( IsNodeDisplayedL( *iNode ) ); |
|
7360 |
|
7361 CXnDomProperty::TPseudoClass pseudoClass( aProperty->Property()->PseudoClass() ); |
|
7362 |
|
7363 if ( pseudoClass != CXnDomProperty::ENone ) |
|
7364 { |
|
7365 InsertPropertyPseudoClassL( pseudoClass, iPropertyPseudoClasses ); |
|
7366 |
|
7367 if ( IsStateSet( PseudoClassName( pseudoClass ) ) ) |
|
7368 { |
|
7369 SetCachedProperty( |
|
7370 aProperty, |
|
7371 iLayoutPropertyCache, |
|
7372 iName, |
|
7373 iValue, |
|
7374 iLabel, |
|
7375 iInitialFocus, |
|
7376 iClass, |
|
7377 iId, |
|
7378 iPath, |
|
7379 iMaskPath, |
|
7380 EFalse, |
|
7381 EFalse ); |
|
7382 } |
|
7383 } |
|
7384 else |
|
7385 { |
|
7386 SetCachedProperty( |
|
7387 aProperty, |
|
7388 iLayoutPropertyCache, |
|
7389 iName, |
|
7390 iValue, |
|
7391 iLabel, |
|
7392 iInitialFocus, |
|
7393 iClass, |
|
7394 iId, |
|
7395 iPath, |
|
7396 iMaskPath, |
|
7397 EFalse, |
|
7398 EFalse ); |
|
7399 } |
|
7400 |
|
7401 iPropertyList->SetPropertyL( aProperty ); |
|
7402 |
|
7403 TBool isDisplayedNow( IsNodeDisplayedL( *iNode ) ); |
|
7404 |
|
7405 level = ( iAdaptive & XnAdaptive::EIgnoreDirty ) ? XnDirtyLevel::ENone : level; |
|
7406 |
|
7407 // This is from layout calculation point of view |
|
7408 TBool displayed( ETrue ); |
|
7409 |
|
7410 if ( isDisplayed && !isDisplayedNow ) |
|
7411 { |
|
7412 // Node loses its visualisation (either display: none, or |
|
7413 // visibility: hidden) Make sure control is hidden |
|
7414 CCoeControl* ctrl( iNode->Control() ); |
|
7415 |
|
7416 if ( ctrl ) |
|
7417 { |
|
7418 ctrl->MakeVisible( EFalse ); |
|
7419 } |
|
7420 } |
|
7421 else if ( !isDisplayed && isDisplayedNow ) |
|
7422 { |
|
7423 // Node gains its visualisation (both display: block, and |
|
7424 // visibility: visible) |
|
7425 // Run gainvisualisation trigger, if node is 'visualisationaware' |
|
7426 CXnProperty* visaware( |
|
7427 GetPropertyL( XnPropertyNames::common::KVisualisationAware ) ); |
|
7428 |
|
7429 if ( visaware && visaware->StringValue() == XnPropertyNames::KTrue ) |
|
7430 { |
|
7431 CXnNode* gainVisualisation( BuildTriggerNodeL( *iUiEngine, |
|
7432 XnPropertyNames::action::trigger::name::KGainVisualisation ) ); |
|
7433 CleanupStack::PushL( gainVisualisation ); |
|
7434 iNode->ReportXuikonEventL( *gainVisualisation ); |
|
7435 CleanupStack::PopAndDestroy( gainVisualisation ); |
|
7436 } |
|
7437 } |
|
7438 else if ( !isDisplayed && !isDisplayedNow ) |
|
7439 { |
|
7440 // No change |
|
7441 displayed = EFalse; |
|
7442 } |
|
7443 |
|
7444 SetDirtyL( level, displayed ); |
|
7445 |
|
7446 return level; |
|
7447 } |
|
7448 |
|
7449 // ----------------------------------------------------------------------------- |
|
7450 // CXnNodeImpl::InitializePropertyL |
|
7451 // Set a property. |
|
7452 // ----------------------------------------------------------------------------- |
|
7453 // |
|
7454 void CXnNodeImpl::InitializePropertyL( CXnProperty* aProperty ) |
|
7455 { |
|
7456 if ( aProperty->Property()->PseudoClass() != CXnDomProperty::ENone ) |
|
7457 { |
|
7458 InsertPropertyPseudoClassL( |
|
7459 aProperty->Property()->PseudoClass(), iPropertyPseudoClasses ); |
|
7460 |
|
7461 SetCachedProperty( |
|
7462 aProperty, |
|
7463 iLayoutPropertyCache, |
|
7464 iName, |
|
7465 iValue, |
|
7466 iLabel, |
|
7467 iInitialFocus, |
|
7468 iClass, |
|
7469 iId, |
|
7470 iPath, |
|
7471 iMaskPath, |
|
7472 ETrue, |
|
7473 ETrue ); |
|
7474 } |
|
7475 else |
|
7476 { |
|
7477 SetCachedProperty( |
|
7478 aProperty, |
|
7479 iLayoutPropertyCache, |
|
7480 iName, |
|
7481 iValue, |
|
7482 iLabel, |
|
7483 iInitialFocus, |
|
7484 iClass, |
|
7485 iId, |
|
7486 iPath, |
|
7487 iMaskPath, |
|
7488 ETrue, |
|
7489 EFalse ); |
|
7490 } |
|
7491 |
|
7492 iPropertyList->SetPropertyL( aProperty ); |
|
7493 } |
|
7494 |
|
7495 // ----------------------------------------------------------------------------- |
|
7496 // CXnNodeImpl::GetPropertyL |
|
7497 // Gets a property. |
|
7498 // ----------------------------------------------------------------------------- |
|
7499 // |
|
7500 CXnProperty* CXnNodeImpl::GetPropertyL( const TDesC8& aKey ) |
|
7501 { |
|
7502 CXnDomProperty* attribute = NULL; |
|
7503 CXnProperty* property = iPropertyList->GetProperty( aKey ); |
|
7504 |
|
7505 if ( property ) |
|
7506 { |
|
7507 attribute = property->Property(); |
|
7508 CXnDomList& list = attribute->PropertyValueList(); |
|
7509 |
|
7510 if ( list.Length() == 0 ) |
|
7511 { |
|
7512 return NULL; |
|
7513 } |
|
7514 |
|
7515 CXnDomPropertyValue* attributeValue = |
|
7516 static_cast< CXnDomPropertyValue* >( list.Item( 0 ) ); |
|
7517 |
|
7518 if ( !attributeValue ) |
|
7519 { |
|
7520 return NULL; |
|
7521 } |
|
7522 |
|
7523 if ( attributeValue->IsInheritIdent() && iParent ) |
|
7524 { |
|
7525 // inherited values are queried from the parent |
|
7526 property = iParent->GetPropertyL( aKey ); |
|
7527 } |
|
7528 |
|
7529 // otherwise just return the value |
|
7530 return property; |
|
7531 } |
|
7532 |
|
7533 // if not found, return NULL |
|
7534 return NULL; |
|
7535 } |
|
7536 |
|
7537 // ----------------------------------------------------------------------------- |
|
7538 // CXnNodeImpl::SetStateL |
|
7539 // Set a pseudoclass |
|
7540 // ----------------------------------------------------------------------------- |
|
7541 // |
|
7542 void CXnNodeImpl::SetStateL( const TDesC8& aState, TInt aSource ) |
|
7543 { |
|
7544 if ( IsStateSet( aState ) ) |
|
7545 { |
|
7546 return; |
|
7547 } |
|
7548 |
|
7549 TBool focusReceived( EFalse ); |
|
7550 TBool activated( EFalse ); |
|
7551 TBool stateChanged( EFalse ); |
|
7552 |
|
7553 if ( aState == XnPropertyNames::action::trigger::name::KFocus ) |
|
7554 { |
|
7555 if ( !iUiEngine->AppUiAdapter().FocusShown() ) |
|
7556 { |
|
7557 return; |
|
7558 } |
|
7559 |
|
7560 focusReceived = DoReceiveFocusL( *iNode, *iUiEngine ); |
|
7561 |
|
7562 if ( focusReceived ) |
|
7563 { |
|
7564 // focused |
|
7565 HidePopupsL(); |
|
7566 ShowPopupsL( iNode->Rect(), aSource ); |
|
7567 |
|
7568 if ( IsStateSet( XnPropertyNames::action::trigger::name::KPassiveFocus ) ) |
|
7569 { |
|
7570 iUiEngine->RemovePassiveFocusedNodeL( iNode ); |
|
7571 } |
|
7572 |
|
7573 stateChanged = focusReceived = iPropertyList->SetStateL( aState ); |
|
7574 } |
|
7575 } |
|
7576 else if ( aState == XnPropertyNames::style::common::KPressedDown ) |
|
7577 { |
|
7578 if ( IsStateSet( XnPropertyNames::action::trigger::name::KFocus ) ) |
|
7579 { |
|
7580 iPropertyList->SetStateL( |
|
7581 XnPropertyNames::style::common::KPressedDown ); |
|
7582 iNode->SetDirtyL( XnDirtyLevel::ERender ); |
|
7583 } |
|
7584 } |
|
7585 else if ( aState == XnPropertyNames::style::common::KActive ) |
|
7586 { |
|
7587 activated = ETrue; |
|
7588 } |
|
7589 else if ( aState == XnPropertyNames::action::trigger::name::KPassiveFocus ) |
|
7590 { |
|
7591 // is focusable node |
|
7592 if ( DoReceiveFocusL( *iNode, *iUiEngine ) ) |
|
7593 { |
|
7594 // focused |
|
7595 stateChanged = iPropertyList->SetStateL( aState ); |
|
7596 } |
|
7597 } |
|
7598 else |
|
7599 { |
|
7600 stateChanged = iPropertyList->SetStateL( aState ); |
|
7601 } |
|
7602 |
|
7603 if ( stateChanged ) |
|
7604 { |
|
7605 CXnDomProperty::TPseudoClass pseudoClass( PseudoClassFromName( aState ) ); |
|
7606 |
|
7607 if ( pseudoClass != CXnDomProperty::ENone ) |
|
7608 { |
|
7609 iStates.Append( pseudoClass ); |
|
7610 |
|
7611 // Ensure that pseudo class is defined |
|
7612 InsertPropertyPseudoClassL( pseudoClass, iPropertyPseudoClasses ); |
|
7613 |
|
7614 if ( IsPropertyPseudoClass( pseudoClass, iPropertyPseudoClasses ) ) |
|
7615 { |
|
7616 EnableStatePropertiesL( *iNode, pseudoClass, iLayoutPropertyCache ); |
|
7617 |
|
7618 InformPropertyChangeL( *iNode ); |
|
7619 } |
|
7620 } |
|
7621 |
|
7622 if ( aState == XnPropertyNames::style::common::KPressedDown ) |
|
7623 { |
|
7624 iNode->SetDirtyL( XnDirtyLevel::ERender ); |
|
7625 } |
|
7626 } |
|
7627 |
|
7628 if ( focusReceived && aState == XnPropertyNames::action::trigger::name::KFocus ) |
|
7629 { |
|
7630 iUiEngine->SetFocusedNodeL( iNode, aSource ); |
|
7631 } |
|
7632 |
|
7633 if ( activated ) |
|
7634 { |
|
7635 iUiEngine->AppUiAdapter().ItemActivator().ActivateL( iNode ); |
|
7636 } |
|
7637 |
|
7638 if ( stateChanged ) |
|
7639 { |
|
7640 iUiEngine->RenderUIL(); |
|
7641 } |
|
7642 } |
|
7643 |
|
7644 // ----------------------------------------------------------------------------- |
|
7645 // CXnNodeImpl::IsStateSet |
|
7646 // Check whether a state is set or not |
|
7647 // ----------------------------------------------------------------------------- |
|
7648 // |
|
7649 TBool CXnNodeImpl::IsStateSet( const TDesC8& aState ) |
|
7650 { |
|
7651 return iPropertyList->IsStateSet( aState ); |
|
7652 } |
|
7653 |
|
7654 // ----------------------------------------------------------------------------- |
|
7655 // CXnNodeImpl::SetStateWithoutNotificationL |
|
7656 // Set a pseudoclass |
|
7657 // ----------------------------------------------------------------------------- |
|
7658 // |
|
7659 void CXnNodeImpl::SetStateWithoutNotificationL( const TDesC8& aState ) |
|
7660 { |
|
7661 if ( IsStateSet( aState ) ) |
|
7662 { |
|
7663 return; |
|
7664 } |
|
7665 |
|
7666 TBool setState( ETrue ); |
|
7667 |
|
7668 if ( aState == XnPropertyNames::action::trigger::name::KFocus ) |
|
7669 { |
|
7670 if ( !iUiEngine->AppUiAdapter().FocusShown() ) |
|
7671 { |
|
7672 return; |
|
7673 } |
|
7674 |
|
7675 setState = DoReceiveFocusL( *iNode, *iUiEngine ); |
|
7676 } |
|
7677 |
|
7678 if ( setState && iPropertyList->SetStateL( aState ) ) |
|
7679 { |
|
7680 CXnDomProperty::TPseudoClass pseudoClass( PseudoClassFromName( aState ) ); |
|
7681 |
|
7682 if ( pseudoClass != CXnDomProperty::ENone ) |
|
7683 { |
|
7684 iStates.Append( pseudoClass ); |
|
7685 |
|
7686 // Ensure that pseudo class is defined |
|
7687 InsertPropertyPseudoClassL( pseudoClass, iPropertyPseudoClasses ); |
|
7688 |
|
7689 if ( IsPropertyPseudoClass( pseudoClass, iPropertyPseudoClasses ) ) |
|
7690 { |
|
7691 EnableStatePropertiesL( *iNode, pseudoClass, iLayoutPropertyCache ); |
|
7692 } |
|
7693 } |
|
7694 |
|
7695 if ( aState == XnPropertyNames::action::trigger::name::KFocus ) |
|
7696 { |
|
7697 iUiEngine->SetFocusedNodeL( iNode ); |
|
7698 |
|
7699 HidePopupsL(); |
|
7700 } |
|
7701 |
|
7702 iUiEngine->RenderUIL(); |
|
7703 } |
|
7704 } |
|
7705 |
|
7706 // ----------------------------------------------------------------------------- |
|
7707 // CXnNodeImpl::UnsetStateL |
|
7708 // Unset a pseudoclass |
|
7709 // ----------------------------------------------------------------------------- |
|
7710 // |
|
7711 void CXnNodeImpl::UnsetStateL( const TDesC8& aState ) |
|
7712 { |
|
7713 if ( !IsStateSet( aState ) ) |
|
7714 { |
|
7715 return; |
|
7716 } |
|
7717 |
|
7718 if ( aState == XnPropertyNames::action::trigger::name::KFocus ) |
|
7719 { |
|
7720 HidePopupsL(); |
|
7721 |
|
7722 iPropertyList->UnsetState( |
|
7723 XnPropertyNames::style::common::KPressedDown ); |
|
7724 |
|
7725 if ( iUiEngine->FocusedNode() == iNode ) |
|
7726 { |
|
7727 iUiEngine->SetFocusedNodeL( NULL ); |
|
7728 } |
|
7729 } |
|
7730 |
|
7731 TBool stateChanged( iPropertyList->UnsetState( aState ) ); |
|
7732 |
|
7733 if ( stateChanged ) |
|
7734 { |
|
7735 CXnDomProperty::TPseudoClass pseudoClass( PseudoClassFromName( aState ) ); |
|
7736 |
|
7737 if ( IsPropertyPseudoClass( pseudoClass, iPropertyPseudoClasses ) ) |
|
7738 { |
|
7739 DisableStatePropertiesL( |
|
7740 *iNode, pseudoClass, iStates, iLayoutPropertyCache ); |
|
7741 |
|
7742 InformPropertyChangeL( *iNode ); |
|
7743 } |
|
7744 |
|
7745 for ( TInt i = iStates.Count() - 1; i >= 0; --i ) |
|
7746 { |
|
7747 if ( iStates[i] == pseudoClass ) |
|
7748 { |
|
7749 iStates.Remove( i ); |
|
7750 } |
|
7751 } |
|
7752 |
|
7753 if ( aState == XnPropertyNames::style::common::KPressedDown ) |
|
7754 { |
|
7755 iNode->SetDirtyL( XnDirtyLevel::ERender ); |
|
7756 } |
|
7757 |
|
7758 iUiEngine->RenderUIL(); |
|
7759 } |
|
7760 } |
|
7761 |
|
7762 // ----------------------------------------------------------------------------- |
|
7763 // CXnNodeImpl::SetUiEngine |
|
7764 // ----------------------------------------------------------------------------- |
|
7765 // |
|
7766 void CXnNodeImpl::SetUiEngine( CXnUiEngine& aEngine ) |
|
7767 { |
|
7768 iUiEngine = &aEngine; |
|
7769 } |
|
7770 |
|
7771 // ----------------------------------------------------------------------------- |
|
7772 // CXnNodeImpl::UiEngine |
|
7773 // ----------------------------------------------------------------------------- |
|
7774 // |
|
7775 CXnUiEngine* CXnNodeImpl::UiEngine() |
|
7776 { |
|
7777 return iUiEngine; |
|
7778 } |
|
7779 |
|
7780 // ----------------------------------------------------------------------------- |
|
7781 // CXnNodeImpl::ReportXuikonEventL |
|
7782 // ----------------------------------------------------------------------------- |
|
7783 // |
|
7784 TBool CXnNodeImpl::ReportXuikonEventL( CXnNode& aEventData, TInt aSource ) |
|
7785 { |
|
7786 CXnProperty* prop( GetPropertyL( KActionsHandler ) ); |
|
7787 |
|
7788 CXnNode* handler( NULL ); |
|
7789 |
|
7790 iUiEngine->DisableRenderUiLC(); |
|
7791 |
|
7792 if ( prop ) |
|
7793 { |
|
7794 const TDesC8& value( prop->StringValue() ); |
|
7795 |
|
7796 handler = iUiEngine->FindNodeByIdL( value, Namespace() ); |
|
7797 } |
|
7798 |
|
7799 if ( handler && handler->Type()->Type() == KActionsHandler ) |
|
7800 { |
|
7801 // Let <actionshandler> node to handle actions |
|
7802 DoTriggerEventL( this, *iUiEngine, *iNode, |
|
7803 *handler, aEventData, aSource ); |
|
7804 } |
|
7805 else |
|
7806 { |
|
7807 // Let this node to handle actions |
|
7808 DoTriggerEventL( this, *iUiEngine, *iNode, |
|
7809 *iNode, aEventData, aSource ); |
|
7810 } |
|
7811 |
|
7812 CleanupStack::PopAndDestroy(); // DisableRenderUiLC |
|
7813 |
|
7814 return EFalse; |
|
7815 } |
|
7816 |
|
7817 // ----------------------------------------------------------------------------- |
|
7818 // CXnNodeImpl::OfferKeyEventL |
|
7819 // ----------------------------------------------------------------------------- |
|
7820 // |
|
7821 void CXnNodeImpl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
7822 { |
|
7823 DoTriggerKeyEventL( this, *iUiEngine, *iNode, aKeyEvent, aType ); |
|
7824 } |
|
7825 |
|
7826 // ----------------------------------------------------------------------------- |
|
7827 // CXnNodeImpl::SetDropped |
|
7828 // ----------------------------------------------------------------------------- |
|
7829 // |
|
7830 void CXnNodeImpl::SetDropped( const TInt aDropped ) |
|
7831 { |
|
7832 if ( Type()->Type() != KToolTip ) |
|
7833 { |
|
7834 iDropped = aDropped; |
|
7835 |
|
7836 TInt count( iChildren.Count() ); |
|
7837 |
|
7838 for ( TInt i = 0; i < count; i++ ) |
|
7839 { |
|
7840 iChildren[i]->SetDropped( aDropped ); |
|
7841 } |
|
7842 } |
|
7843 } |
|
7844 |
|
7845 // ----------------------------------------------------------------------------- |
|
7846 // CXnNodeImpl::IsDropped |
|
7847 // ----------------------------------------------------------------------------- |
|
7848 // |
|
7849 TInt CXnNodeImpl::IsDropped() const |
|
7850 { |
|
7851 return iDropped; |
|
7852 } |
|
7853 |
|
7854 // ----------------------------------------------------------------------------- |
|
7855 // CXnNodeImpl::SetLayoutCapable |
|
7856 // ----------------------------------------------------------------------------- |
|
7857 // |
|
7858 void CXnNodeImpl::SetLayoutCapable( const TBool aLayoutCapable ) |
|
7859 { |
|
7860 iLayoutCapable = aLayoutCapable; |
|
7861 } |
|
7862 |
|
7863 // ----------------------------------------------------------------------------- |
|
7864 // CXnNodeImpl::IsLayoutCapable |
|
7865 // ----------------------------------------------------------------------------- |
|
7866 // |
|
7867 TBool CXnNodeImpl::IsLayoutCapable() const |
|
7868 { |
|
7869 return iLayoutCapable; |
|
7870 } |
|
7871 |
|
7872 // ----------------------------------------------------------------------------- |
|
7873 // CXnNodeImpl::SetRenderedL |
|
7874 // ----------------------------------------------------------------------------- |
|
7875 // |
|
7876 void CXnNodeImpl::SetRenderedL() |
|
7877 { |
|
7878 if ( !iLayoutCapable ) |
|
7879 { |
|
7880 return; |
|
7881 } |
|
7882 |
|
7883 CXnControlAdapter* control = |
|
7884 static_cast< CXnControlAdapter* >( iNode->Control() ); |
|
7885 |
|
7886 if ( control ) |
|
7887 { |
|
7888 TBool displayed( IsNodeDisplayedL( *iNode, ETrue, EFalse ) ); |
|
7889 |
|
7890 control->SetBlank( EFalse ); |
|
7891 |
|
7892 if ( iDropped || !displayed ) |
|
7893 { |
|
7894 // Need to check blank here |
|
7895 CXnProperty* prop( VisibilityL() ); |
|
7896 |
|
7897 if ( prop && prop->StringValue() == |
|
7898 XnPropertyNames::style::common::visibility::KBlank ) |
|
7899 { |
|
7900 control->SetBlank( ETrue ); |
|
7901 control->MakeVisible( EFalse ); |
|
7902 control->SetComponentsToInheritVisibility( EFalse ); |
|
7903 control->MakeVisible( ETrue ); |
|
7904 control->SetComponentsToInheritVisibility( ETrue ); |
|
7905 } |
|
7906 else |
|
7907 { |
|
7908 if ( control->IsVisible() ) |
|
7909 { |
|
7910 control->MakeVisible( EFalse ); |
|
7911 } |
|
7912 } |
|
7913 } |
|
7914 else |
|
7915 { |
|
7916 CCoeControl* parent( control->Parent() ); |
|
7917 |
|
7918 TBool parentVisible( ETrue ); |
|
7919 |
|
7920 if ( parent && !parent->IsVisible() ) |
|
7921 { |
|
7922 parentVisible = EFalse; |
|
7923 } |
|
7924 |
|
7925 if ( !control->IsVisible() && parentVisible ) |
|
7926 { |
|
7927 TBool found( EFalse ); |
|
7928 |
|
7929 for ( CXnNode* node = iNode; !found && node; node = node->Parent() ) |
|
7930 { |
|
7931 if ( node->Type()->Type() == KToolTip ) |
|
7932 { |
|
7933 // Tooltip control handles its visibility internally |
|
7934 found = ETrue; |
|
7935 } |
|
7936 } |
|
7937 |
|
7938 if ( !found ) |
|
7939 { |
|
7940 control->MakeVisible( ETrue ); |
|
7941 } |
|
7942 } |
|
7943 } |
|
7944 } |
|
7945 |
|
7946 iRendered = ETrue; |
|
7947 |
|
7948 for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
7949 { |
|
7950 iChildren[i]->SetRenderedL(); |
|
7951 } |
|
7952 } |
|
7953 |
|
7954 // ----------------------------------------------------------------------------- |
|
7955 // CXnNodeImpl::SetLaidOutL |
|
7956 // ----------------------------------------------------------------------------- |
|
7957 // |
|
7958 void CXnNodeImpl::SetLaidOutL() |
|
7959 { |
|
7960 if ( !iLayoutCapable ) |
|
7961 { |
|
7962 return; |
|
7963 } |
|
7964 |
|
7965 if ( iDropped || !IsNodeDisplayedL( *iNode ) ) |
|
7966 { |
|
7967 return; |
|
7968 } |
|
7969 |
|
7970 iLaidOut = ETrue; |
|
7971 |
|
7972 for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
7973 { |
|
7974 iChildren[i]->SetLaidOutL(); |
|
7975 } |
|
7976 } |
|
7977 |
|
7978 // ----------------------------------------------------------------------------- |
|
7979 // CXnNodeImpl::IsLaidOut |
|
7980 // ----------------------------------------------------------------------------- |
|
7981 // |
|
7982 TBool CXnNodeImpl::IsLaidOut() const |
|
7983 { |
|
7984 return iLaidOut; |
|
7985 } |
|
7986 |
|
7987 // ----------------------------------------------------------------------------- |
|
7988 // CXnNodeImpl::ClearRenderedAndLaidOut |
|
7989 // ----------------------------------------------------------------------------- |
|
7990 // |
|
7991 void CXnNodeImpl::ClearRenderedAndLaidOut() |
|
7992 { |
|
7993 if ( !iRendered && !iLaidOut ) |
|
7994 { |
|
7995 return; |
|
7996 } |
|
7997 |
|
7998 TRect empty; |
|
7999 |
|
8000 SetRect( empty ); |
|
8001 SetPaddingRect( empty ); |
|
8002 SetBorderRect( empty ); |
|
8003 SetNormalFlowBorderRect( empty ); |
|
8004 SetMarginRect( empty ); |
|
8005 |
|
8006 iRendered = EFalse; |
|
8007 iLaidOut = EFalse; |
|
8008 |
|
8009 if ( iLayoutCapable ) |
|
8010 { |
|
8011 for ( TInt i = 0; i < iChildren.Count(); i++ ) |
|
8012 { |
|
8013 iChildren[i]->ClearRenderedAndLaidOut(); |
|
8014 } |
|
8015 } |
|
8016 } |
|
8017 |
|
8018 // ----------------------------------------------------------------------------- |
|
8019 // CXnNodeImpl::MakeInterfaceL |
|
8020 // Create a component interface according to the given type. |
|
8021 // ----------------------------------------------------------------------------- |
|
8022 // |
|
8023 XnComponentInterface::MXnComponentInterface* CXnNodeImpl::MakeInterfaceL( |
|
8024 const TDesC8& /*aType*/ ) |
|
8025 { |
|
8026 return NULL; |
|
8027 } |
|
8028 |
|
8029 // ----------------------------------------------------------------------------- |
|
8030 // PropertyL |
|
8031 // Returns a property. |
|
8032 // ----------------------------------------------------------------------------- |
|
8033 // |
|
8034 static CXnProperty* PropertyL( CXnProperty* aProperty, |
|
8035 CXnProperty* ( CXnNode::* aFunc )(), |
|
8036 TAny* aLayoutPropertyCache, CXnNode* aParent ) |
|
8037 { |
|
8038 if ( aLayoutPropertyCache && aProperty ) |
|
8039 { |
|
8040 CXnDomProperty* attribute = aProperty->Property(); |
|
8041 CXnDomList& list = attribute->PropertyValueList(); |
|
8042 |
|
8043 if ( list.Length() == 0 ) |
|
8044 { |
|
8045 return NULL; |
|
8046 } |
|
8047 |
|
8048 CXnDomPropertyValue* attributeValue = |
|
8049 static_cast< CXnDomPropertyValue* >( list.Item( 0 ) ); |
|
8050 |
|
8051 if ( !attributeValue ) |
|
8052 { |
|
8053 return NULL; |
|
8054 } |
|
8055 |
|
8056 if ( attributeValue->IsInheritIdent() && aParent ) |
|
8057 { |
|
8058 // inherited values are queried from the parent |
|
8059 return ( aParent->*aFunc )(); |
|
8060 } |
|
8061 |
|
8062 // otherwise just return the value |
|
8063 return aProperty; |
|
8064 } |
|
8065 |
|
8066 return NULL; |
|
8067 } |
|
8068 |
|
8069 // ----------------------------------------------------------------------------- |
|
8070 // CXnNodeImpl::WidthL |
|
8071 // Returns width property. |
|
8072 // ----------------------------------------------------------------------------- |
|
8073 // |
|
8074 CXnProperty* CXnNodeImpl::WidthL() |
|
8075 { |
|
8076 CXnProperty* property = |
|
8077 iLayoutPropertyCache ? iLayoutPropertyCache->iWidth : NULL; |
|
8078 return PropertyL( property, &CXnNode::WidthL, |
|
8079 iLayoutPropertyCache, iParent ); |
|
8080 } |
|
8081 |
|
8082 // ----------------------------------------------------------------------------- |
|
8083 // CXnNodeImpl::HeightL |
|
8084 // Returns height property. |
|
8085 // ----------------------------------------------------------------------------- |
|
8086 // |
|
8087 CXnProperty* CXnNodeImpl::HeightL() |
|
8088 { |
|
8089 CXnProperty* property = |
|
8090 iLayoutPropertyCache ? iLayoutPropertyCache->iHeight : NULL; |
|
8091 return PropertyL( property, &CXnNode::HeightL, |
|
8092 iLayoutPropertyCache, iParent ); |
|
8093 } |
|
8094 |
|
8095 // ----------------------------------------------------------------------------- |
|
8096 // CXnNodeImpl::MarginLeftL |
|
8097 // Returns margin-left property. |
|
8098 // ----------------------------------------------------------------------------- |
|
8099 // |
|
8100 CXnProperty* CXnNodeImpl::MarginLeftL() |
|
8101 { |
|
8102 CXnProperty* property = |
|
8103 iLayoutPropertyCache ? |
|
8104 iLayoutPropertyCache->iMarginLeft : |
|
8105 NULL; |
|
8106 return PropertyL( property, &CXnNode::MarginLeftL, |
|
8107 iLayoutPropertyCache, iParent ); |
|
8108 } |
|
8109 |
|
8110 // ----------------------------------------------------------------------------- |
|
8111 // CXnNodeImpl::MarginRightL |
|
8112 // Returns margin-right property. |
|
8113 // ----------------------------------------------------------------------------- |
|
8114 // |
|
8115 CXnProperty* CXnNodeImpl::MarginRightL() |
|
8116 { |
|
8117 CXnProperty* property = |
|
8118 iLayoutPropertyCache ? |
|
8119 iLayoutPropertyCache->iMarginRight : |
|
8120 NULL; |
|
8121 return PropertyL( property, &CXnNode::MarginRightL, |
|
8122 iLayoutPropertyCache, iParent ); |
|
8123 } |
|
8124 |
|
8125 // ----------------------------------------------------------------------------- |
|
8126 // CXnNodeImpl::BorderLeftL |
|
8127 // Returns border-left property. |
|
8128 // ----------------------------------------------------------------------------- |
|
8129 // |
|
8130 CXnProperty* CXnNodeImpl::BorderLeftL() |
|
8131 { |
|
8132 CXnProperty* property = iLayoutPropertyCache ? |
|
8133 iLayoutPropertyCache->iBorderLeft : |
|
8134 NULL; |
|
8135 return PropertyL( property, &CXnNode::BorderLeftL, |
|
8136 iLayoutPropertyCache, iParent ); |
|
8137 } |
|
8138 |
|
8139 // ----------------------------------------------------------------------------- |
|
8140 // CXnNodeImpl::BorderRightL |
|
8141 // Returns border-right property. |
|
8142 // ----------------------------------------------------------------------------- |
|
8143 // |
|
8144 CXnProperty* CXnNodeImpl::BorderRightL() |
|
8145 { |
|
8146 CXnProperty* property = |
|
8147 iLayoutPropertyCache ? |
|
8148 iLayoutPropertyCache->iBorderRight : |
|
8149 NULL; |
|
8150 return PropertyL( property, &CXnNode::BorderRightL, |
|
8151 iLayoutPropertyCache, iParent ); |
|
8152 } |
|
8153 |
|
8154 // ----------------------------------------------------------------------------- |
|
8155 // CXnNodeImpl::PaddingLeftL |
|
8156 // Returns padding-left property. |
|
8157 // ----------------------------------------------------------------------------- |
|
8158 // |
|
8159 CXnProperty* CXnNodeImpl::PaddingLeftL() |
|
8160 { |
|
8161 CXnProperty* property = |
|
8162 iLayoutPropertyCache ? |
|
8163 iLayoutPropertyCache->iPaddingLeft : |
|
8164 NULL; |
|
8165 return PropertyL( property, &CXnNode::PaddingLeftL, |
|
8166 iLayoutPropertyCache, iParent ); |
|
8167 } |
|
8168 |
|
8169 // ----------------------------------------------------------------------------- |
|
8170 // CXnNodeImpl::PaddingRightL |
|
8171 // Returns PaddingRightL property. |
|
8172 // ----------------------------------------------------------------------------- |
|
8173 // |
|
8174 CXnProperty* CXnNodeImpl::PaddingRightL() |
|
8175 { |
|
8176 CXnProperty* property = |
|
8177 iLayoutPropertyCache ? iLayoutPropertyCache->iPaddingRight : NULL; |
|
8178 return PropertyL( property, &CXnNode::PaddingRightL, |
|
8179 iLayoutPropertyCache, iParent ); |
|
8180 } |
|
8181 |
|
8182 // ----------------------------------------------------------------------------- |
|
8183 // CXnNodeImpl::MarginTopL |
|
8184 // Returns margin-top property. |
|
8185 // ----------------------------------------------------------------------------- |
|
8186 // |
|
8187 CXnProperty* CXnNodeImpl::MarginTopL() |
|
8188 { |
|
8189 CXnProperty* property = |
|
8190 iLayoutPropertyCache ? iLayoutPropertyCache->iMarginTop : NULL; |
|
8191 return PropertyL( property, &CXnNode::MarginTopL, |
|
8192 iLayoutPropertyCache, iParent ); |
|
8193 } |
|
8194 |
|
8195 // ----------------------------------------------------------------------------- |
|
8196 // CXnNodeImpl::MarginBottomL |
|
8197 // Returns margin-bottom property. |
|
8198 // ----------------------------------------------------------------------------- |
|
8199 // |
|
8200 CXnProperty* CXnNodeImpl::MarginBottomL() |
|
8201 { |
|
8202 CXnProperty* property = |
|
8203 iLayoutPropertyCache ? iLayoutPropertyCache->iMarginBottom : NULL; |
|
8204 return PropertyL( property, &CXnNode::MarginBottomL, |
|
8205 iLayoutPropertyCache, iParent ); |
|
8206 } |
|
8207 |
|
8208 // ----------------------------------------------------------------------------- |
|
8209 // CXnNodeImpl::BorderTopL |
|
8210 // Returns border-top property. |
|
8211 // ----------------------------------------------------------------------------- |
|
8212 // |
|
8213 CXnProperty* CXnNodeImpl::BorderTopL() |
|
8214 { |
|
8215 CXnProperty* property = |
|
8216 iLayoutPropertyCache ? iLayoutPropertyCache->iBorderTop : NULL; |
|
8217 return PropertyL( property, &CXnNode::BorderTopL, |
|
8218 iLayoutPropertyCache, iParent ); |
|
8219 } |
|
8220 |
|
8221 // ----------------------------------------------------------------------------- |
|
8222 // CXnNodeImpl::BorderBottomL |
|
8223 // Returns border-bottom property. |
|
8224 // ----------------------------------------------------------------------------- |
|
8225 // |
|
8226 CXnProperty* CXnNodeImpl::BorderBottomL() |
|
8227 { |
|
8228 CXnProperty* property = |
|
8229 iLayoutPropertyCache ? iLayoutPropertyCache->iBorderBottom : NULL; |
|
8230 return PropertyL( property, &CXnNode::BorderBottomL, |
|
8231 iLayoutPropertyCache, iParent ); |
|
8232 } |
|
8233 |
|
8234 // ----------------------------------------------------------------------------- |
|
8235 // CXnNodeImpl::PaddingTopL |
|
8236 // Returns padding-top property. |
|
8237 // ----------------------------------------------------------------------------- |
|
8238 // |
|
8239 CXnProperty* CXnNodeImpl::PaddingTopL() |
|
8240 { |
|
8241 CXnProperty* property = |
|
8242 iLayoutPropertyCache ? iLayoutPropertyCache->iPaddingTop : NULL; |
|
8243 return PropertyL( property, &CXnNode::PaddingTopL, |
|
8244 iLayoutPropertyCache, iParent ); |
|
8245 } |
|
8246 |
|
8247 // ----------------------------------------------------------------------------- |
|
8248 // CXnNodeImpl::PaddingBottomL |
|
8249 // Returns padding-bottom property. |
|
8250 // ----------------------------------------------------------------------------- |
|
8251 // |
|
8252 CXnProperty* CXnNodeImpl::PaddingBottomL() |
|
8253 { |
|
8254 CXnProperty* property = |
|
8255 iLayoutPropertyCache ? iLayoutPropertyCache->iPaddingBottom : NULL; |
|
8256 return PropertyL( property, &CXnNode::PaddingBottomL, |
|
8257 iLayoutPropertyCache, iParent ); |
|
8258 } |
|
8259 |
|
8260 // ----------------------------------------------------------------------------- |
|
8261 // CXnNodeImpl::BorderWidthL |
|
8262 // Returns border-width property. |
|
8263 // ----------------------------------------------------------------------------- |
|
8264 // |
|
8265 CXnProperty* CXnNodeImpl::BorderWidthL() |
|
8266 { |
|
8267 CXnProperty* property = |
|
8268 iLayoutPropertyCache ? iLayoutPropertyCache->iBorderWidth : NULL; |
|
8269 return PropertyL( property, &CXnNode::BorderWidthL, |
|
8270 iLayoutPropertyCache, iParent ); |
|
8271 } |
|
8272 |
|
8273 // ----------------------------------------------------------------------------- |
|
8274 // CXnNodeImpl::BlockProgressionL |
|
8275 // Returns block-progression property. |
|
8276 // ----------------------------------------------------------------------------- |
|
8277 // |
|
8278 CXnProperty* CXnNodeImpl::BlockProgressionL() |
|
8279 { |
|
8280 CXnProperty* property = |
|
8281 iLayoutPropertyCache ? iLayoutPropertyCache->iBlockProgression : NULL; |
|
8282 return PropertyL( property, &CXnNode::BlockProgressionL, |
|
8283 iLayoutPropertyCache, iParent ); |
|
8284 } |
|
8285 |
|
8286 // ----------------------------------------------------------------------------- |
|
8287 // CXnNodeImpl::DirectionL |
|
8288 // Returns direction property. |
|
8289 // ----------------------------------------------------------------------------- |
|
8290 // |
|
8291 CXnProperty* CXnNodeImpl::DirectionL() |
|
8292 { |
|
8293 CXnProperty* property = |
|
8294 iLayoutPropertyCache ? iLayoutPropertyCache->iDirection : NULL; |
|
8295 return PropertyL( property, &CXnNode::DirectionL, |
|
8296 iLayoutPropertyCache, iParent ); |
|
8297 } |
|
8298 |
|
8299 // ----------------------------------------------------------------------------- |
|
8300 // CXnNodeImpl::PositionL |
|
8301 // Returns position property. |
|
8302 // ----------------------------------------------------------------------------- |
|
8303 // |
|
8304 CXnProperty* CXnNodeImpl::PositionL() |
|
8305 { |
|
8306 CXnProperty* property = |
|
8307 iLayoutPropertyCache ? iLayoutPropertyCache->iPosition : NULL; |
|
8308 return PropertyL( property, &CXnNode::PositionL, |
|
8309 iLayoutPropertyCache, iParent ); |
|
8310 } |
|
8311 |
|
8312 // ----------------------------------------------------------------------------- |
|
8313 // CXnNodeImpl::MaxHeightL |
|
8314 // Returns max-height property. |
|
8315 // ----------------------------------------------------------------------------- |
|
8316 // |
|
8317 CXnProperty* CXnNodeImpl::MaxHeightL() |
|
8318 { |
|
8319 CXnProperty* property = |
|
8320 iLayoutPropertyCache ? iLayoutPropertyCache->iMaxHeight : NULL; |
|
8321 return PropertyL( property, &CXnNode::MaxHeightL, |
|
8322 iLayoutPropertyCache, iParent ); |
|
8323 } |
|
8324 |
|
8325 // ----------------------------------------------------------------------------- |
|
8326 // CXnNodeImpl::MinHeightL |
|
8327 // Returns min-height property. |
|
8328 // ----------------------------------------------------------------------------- |
|
8329 // |
|
8330 CXnProperty* CXnNodeImpl::MinHeightL() |
|
8331 { |
|
8332 CXnProperty* property = |
|
8333 iLayoutPropertyCache ? iLayoutPropertyCache->iMinHeight : NULL; |
|
8334 return PropertyL( property, &CXnNode::MinHeightL, |
|
8335 iLayoutPropertyCache, iParent ); |
|
8336 } |
|
8337 |
|
8338 // ----------------------------------------------------------------------------- |
|
8339 // CXnNodeImpl::MaxWidthL |
|
8340 // Returns max-width property. |
|
8341 // ----------------------------------------------------------------------------- |
|
8342 // |
|
8343 CXnProperty* CXnNodeImpl::MaxWidthL() |
|
8344 { |
|
8345 CXnProperty* property = |
|
8346 iLayoutPropertyCache ? iLayoutPropertyCache->iMaxWidth : NULL; |
|
8347 return PropertyL( property, &CXnNode::MaxWidthL, |
|
8348 iLayoutPropertyCache, iParent ); |
|
8349 } |
|
8350 |
|
8351 // ----------------------------------------------------------------------------- |
|
8352 // CXnNodeImpl::MinWidthL |
|
8353 // Returns min-width property. |
|
8354 // ----------------------------------------------------------------------------- |
|
8355 // |
|
8356 CXnProperty* CXnNodeImpl::MinWidthL() |
|
8357 { |
|
8358 CXnProperty* property = |
|
8359 iLayoutPropertyCache ? iLayoutPropertyCache->iMinWidth : NULL; |
|
8360 return PropertyL( property, &CXnNode::MinWidthL, |
|
8361 iLayoutPropertyCache, iParent ); |
|
8362 } |
|
8363 |
|
8364 // ----------------------------------------------------------------------------- |
|
8365 // CXnNodeImpl::DisplayL |
|
8366 // Returns display property. |
|
8367 // ----------------------------------------------------------------------------- |
|
8368 // |
|
8369 CXnProperty* CXnNodeImpl::DisplayL() |
|
8370 { |
|
8371 CXnProperty* property = |
|
8372 iLayoutPropertyCache ? iLayoutPropertyCache->iDisplay : NULL; |
|
8373 return PropertyL( property, &CXnNode::DisplayL, |
|
8374 iLayoutPropertyCache, iParent ); |
|
8375 } |
|
8376 |
|
8377 // ----------------------------------------------------------------------------- |
|
8378 // CXnNodeImpl::LeftL |
|
8379 // Returns left property. |
|
8380 // ----------------------------------------------------------------------------- |
|
8381 // |
|
8382 CXnProperty* CXnNodeImpl::LeftL() |
|
8383 { |
|
8384 CXnProperty* property = |
|
8385 iLayoutPropertyCache ? iLayoutPropertyCache->iLeft : NULL; |
|
8386 return PropertyL( property, &CXnNode::LeftL, |
|
8387 iLayoutPropertyCache, iParent ); |
|
8388 } |
|
8389 |
|
8390 // ----------------------------------------------------------------------------- |
|
8391 // CXnNodeImpl::RightL |
|
8392 // Returns right property. |
|
8393 // ----------------------------------------------------------------------------- |
|
8394 // |
|
8395 CXnProperty* CXnNodeImpl::RightL() |
|
8396 { |
|
8397 CXnProperty* property = |
|
8398 iLayoutPropertyCache ? iLayoutPropertyCache->iRight : NULL; |
|
8399 return PropertyL( property, &CXnNode::RightL, |
|
8400 iLayoutPropertyCache, iParent ); |
|
8401 } |
|
8402 |
|
8403 // ----------------------------------------------------------------------------- |
|
8404 // CXnNodeImpl::TopL |
|
8405 // Returns top property. |
|
8406 // ----------------------------------------------------------------------------- |
|
8407 // |
|
8408 CXnProperty* CXnNodeImpl::TopL() |
|
8409 { |
|
8410 CXnProperty* property = |
|
8411 iLayoutPropertyCache ? iLayoutPropertyCache->iTop : NULL; |
|
8412 return PropertyL( property, &CXnNode::TopL, |
|
8413 iLayoutPropertyCache, iParent ); |
|
8414 } |
|
8415 |
|
8416 // ----------------------------------------------------------------------------- |
|
8417 // CXnNodeImpl::BottomL |
|
8418 // Returns bottom property. |
|
8419 // ----------------------------------------------------------------------------- |
|
8420 // |
|
8421 CXnProperty* CXnNodeImpl::BottomL() |
|
8422 { |
|
8423 CXnProperty* property = |
|
8424 iLayoutPropertyCache ? iLayoutPropertyCache->iBottom : NULL; |
|
8425 return PropertyL( property, &CXnNode::BottomL, |
|
8426 iLayoutPropertyCache, iParent ); |
|
8427 } |
|
8428 |
|
8429 // ----------------------------------------------------------------------------- |
|
8430 // CXnNodeImpl::BorderLeftStyleL |
|
8431 // Returns border-left-style property. |
|
8432 // ----------------------------------------------------------------------------- |
|
8433 // |
|
8434 CXnProperty* CXnNodeImpl::BorderLeftStyleL() |
|
8435 { |
|
8436 CXnProperty* property = |
|
8437 iLayoutPropertyCache ? iLayoutPropertyCache->iBorderLeftStyle : NULL; |
|
8438 return PropertyL( property, &CXnNode::BorderLeftStyleL, |
|
8439 iLayoutPropertyCache, iParent ); |
|
8440 } |
|
8441 |
|
8442 // ----------------------------------------------------------------------------- |
|
8443 // CXnNodeImpl::BorderRightStyleL |
|
8444 // Returns border-right-style property. |
|
8445 // ----------------------------------------------------------------------------- |
|
8446 // |
|
8447 CXnProperty* CXnNodeImpl::BorderRightStyleL() |
|
8448 { |
|
8449 CXnProperty* property = |
|
8450 iLayoutPropertyCache ? iLayoutPropertyCache->iBorderRightStyle : NULL; |
|
8451 return PropertyL( property, &CXnNode::BorderRightStyleL, |
|
8452 iLayoutPropertyCache, iParent ); |
|
8453 } |
|
8454 |
|
8455 // ----------------------------------------------------------------------------- |
|
8456 // CXnNodeImpl::BorderTopStyleL |
|
8457 // Returns border-top-style property. |
|
8458 // ----------------------------------------------------------------------------- |
|
8459 // |
|
8460 CXnProperty* CXnNodeImpl::BorderTopStyleL() |
|
8461 { |
|
8462 CXnProperty* property = |
|
8463 iLayoutPropertyCache ? iLayoutPropertyCache->iBorderTopStyle : NULL; |
|
8464 return PropertyL( property, &CXnNode::BorderTopStyleL, |
|
8465 iLayoutPropertyCache, iParent ); |
|
8466 } |
|
8467 |
|
8468 // ----------------------------------------------------------------------------- |
|
8469 // CXnNodeImpl::BorderBottomStyleL |
|
8470 // Returns border-bottom-style property. |
|
8471 // ----------------------------------------------------------------------------- |
|
8472 // |
|
8473 CXnProperty* CXnNodeImpl::BorderBottomStyleL() |
|
8474 { |
|
8475 CXnProperty* property = |
|
8476 iLayoutPropertyCache ? iLayoutPropertyCache->iBorderBottomStyle : NULL; |
|
8477 return PropertyL( property, &CXnNode::BorderBottomStyleL, |
|
8478 iLayoutPropertyCache, iParent ); |
|
8479 } |
|
8480 |
|
8481 // ----------------------------------------------------------------------------- |
|
8482 // CXnNodeImpl::BorderStyleL |
|
8483 // Returns border-style property. |
|
8484 // ----------------------------------------------------------------------------- |
|
8485 // |
|
8486 CXnProperty* CXnNodeImpl::BorderStyleL() |
|
8487 { |
|
8488 CXnProperty* property = |
|
8489 iLayoutPropertyCache ? iLayoutPropertyCache->iBorderStyle : NULL; |
|
8490 return PropertyL( property, &CXnNode::BorderStyleL, |
|
8491 iLayoutPropertyCache, iParent ); |
|
8492 } |
|
8493 |
|
8494 // ----------------------------------------------------------------------------- |
|
8495 // CXnNodeImpl::BorderImageL |
|
8496 // Returns border-image property. |
|
8497 // ----------------------------------------------------------------------------- |
|
8498 // |
|
8499 CXnProperty* CXnNodeImpl::BorderImageL() |
|
8500 { |
|
8501 CXnProperty* property = |
|
8502 iLayoutPropertyCache ? iLayoutPropertyCache->iBorderImage : NULL; |
|
8503 return PropertyL( property, &CXnNode::BorderImageL, |
|
8504 iLayoutPropertyCache, iParent ); |
|
8505 } |
|
8506 |
|
8507 // ----------------------------------------------------------------------------- |
|
8508 // CXnNodeImpl::DisplayPriorityL |
|
8509 // Returns display-priority property. |
|
8510 // ----------------------------------------------------------------------------- |
|
8511 // |
|
8512 CXnProperty* CXnNodeImpl::DisplayPriorityL() |
|
8513 { |
|
8514 CXnProperty* property = |
|
8515 iLayoutPropertyCache ? iLayoutPropertyCache->iDisplayPriority : NULL; |
|
8516 return PropertyL( property, &CXnNode::DisplayPriorityL, |
|
8517 iLayoutPropertyCache, iParent ); |
|
8518 } |
|
8519 |
|
8520 // ----------------------------------------------------------------------------- |
|
8521 // CXnNodeImpl::NameL |
|
8522 // Returns name property. |
|
8523 // ----------------------------------------------------------------------------- |
|
8524 // |
|
8525 CXnProperty* CXnNodeImpl::NameL() |
|
8526 { |
|
8527 return PropertyL( iName, &CXnNode::NameL, this, iParent ); |
|
8528 } |
|
8529 |
|
8530 // ----------------------------------------------------------------------------- |
|
8531 // CXnNodeImpl::ValueL |
|
8532 // Returns value property. |
|
8533 // ----------------------------------------------------------------------------- |
|
8534 // |
|
8535 CXnProperty* CXnNodeImpl::ValueL() |
|
8536 { |
|
8537 return PropertyL( iValue, &CXnNode::ValueL, this, iParent ); |
|
8538 } |
|
8539 |
|
8540 // ----------------------------------------------------------------------------- |
|
8541 // CXnNodeImpl::VisibilityL |
|
8542 // Returns visibility property. |
|
8543 // ----------------------------------------------------------------------------- |
|
8544 // |
|
8545 CXnProperty* CXnNodeImpl::VisibilityL() |
|
8546 { |
|
8547 CXnProperty* property = |
|
8548 iLayoutPropertyCache ? iLayoutPropertyCache->iVisibility : NULL; |
|
8549 return PropertyL( property, &CXnNode::VisibilityL, |
|
8550 iLayoutPropertyCache, iParent ); |
|
8551 } |
|
8552 |
|
8553 // ----------------------------------------------------------------------------- |
|
8554 // CXnNodeImpl::LabelL |
|
8555 // Returns label property. |
|
8556 // ----------------------------------------------------------------------------- |
|
8557 // |
|
8558 CXnProperty* CXnNodeImpl::LabelL() |
|
8559 { |
|
8560 return PropertyL( iLabel, &CXnNode::LabelL, this, iParent ); |
|
8561 } |
|
8562 |
|
8563 // ----------------------------------------------------------------------------- |
|
8564 // CXnNodeImpl::InitialFocusL |
|
8565 // Returns initial-focus property. |
|
8566 // ----------------------------------------------------------------------------- |
|
8567 // |
|
8568 CXnProperty* CXnNodeImpl::InitialFocusL() |
|
8569 { |
|
8570 return PropertyL( iInitialFocus, &CXnNode::InitialFocusL, this, iParent ); |
|
8571 } |
|
8572 |
|
8573 // ----------------------------------------------------------------------------- |
|
8574 // CXnNodeImpl::ClassL |
|
8575 // Returns class property. |
|
8576 // ----------------------------------------------------------------------------- |
|
8577 // |
|
8578 CXnProperty* CXnNodeImpl::ClassL() |
|
8579 { |
|
8580 return PropertyL( iClass, &CXnNode::ClassL, this, iParent ); |
|
8581 } |
|
8582 |
|
8583 // ----------------------------------------------------------------------------- |
|
8584 // CXnNodeImpl::IdL |
|
8585 // Returns id property. |
|
8586 // ----------------------------------------------------------------------------- |
|
8587 // |
|
8588 CXnProperty* CXnNodeImpl::IdL() |
|
8589 { |
|
8590 if ( iId ) |
|
8591 { |
|
8592 CXnDomProperty* attribute = iId->Property(); |
|
8593 CXnDomList& list = attribute->PropertyValueList(); |
|
8594 if ( list.Length() == 0 ) |
|
8595 { |
|
8596 return NULL; |
|
8597 } |
|
8598 CXnDomPropertyValue* attributeValue = |
|
8599 static_cast< CXnDomPropertyValue* >( list.Item( 0 ) ); |
|
8600 if ( !attributeValue ) |
|
8601 { |
|
8602 return NULL; |
|
8603 } |
|
8604 if ( attributeValue->IsInheritIdent() |
|
8605 && iParent ) |
|
8606 { |
|
8607 // inherited values are queried from the parent |
|
8608 return iParent->IdL(); |
|
8609 } |
|
8610 // otherwise just return the value |
|
8611 return iId; |
|
8612 } |
|
8613 // if not found, return NULL |
|
8614 return NULL; |
|
8615 } |
|
8616 |
|
8617 // ----------------------------------------------------------------------------- |
|
8618 // CXnNodeImpl::PathL |
|
8619 // Returns path property. |
|
8620 // ----------------------------------------------------------------------------- |
|
8621 // |
|
8622 CXnProperty* CXnNodeImpl::PathL() |
|
8623 { |
|
8624 return PropertyL( iPath, &CXnNode::PathL, this, iParent ); |
|
8625 } |
|
8626 |
|
8627 // ----------------------------------------------------------------------------- |
|
8628 // CXnNodeImpl::MaskPathL |
|
8629 // Returns maskpath property. |
|
8630 // ----------------------------------------------------------------------------- |
|
8631 // |
|
8632 CXnProperty* CXnNodeImpl::MaskPathL() |
|
8633 { |
|
8634 return PropertyL( iMaskPath, &CXnNode::MaskPathL, this, iParent ); |
|
8635 } |
|
8636 |
|
8637 // ----------------------------------------------------------------------------- |
|
8638 // CXnNodeImpl::NavIndexL |
|
8639 // Returns nav-index property. |
|
8640 // ----------------------------------------------------------------------------- |
|
8641 // |
|
8642 CXnProperty* CXnNodeImpl::NavIndexL() |
|
8643 { |
|
8644 CXnProperty* property = |
|
8645 iLayoutPropertyCache ? iLayoutPropertyCache->iNavIndex : NULL; |
|
8646 return PropertyL( property, &CXnNode::NavIndexL, |
|
8647 iLayoutPropertyCache, iParent ); |
|
8648 } |
|
8649 |
|
8650 // ----------------------------------------------------------------------------- |
|
8651 // CXnNodeImpl::ZIndexL |
|
8652 // Returns z-index property. |
|
8653 // ----------------------------------------------------------------------------- |
|
8654 // |
|
8655 CXnProperty* CXnNodeImpl::ZIndexL() |
|
8656 { |
|
8657 CXnProperty* property = |
|
8658 iLayoutPropertyCache ? iLayoutPropertyCache->iZIndex : NULL; |
|
8659 return PropertyL( property, &CXnNode::ZIndexL, |
|
8660 iLayoutPropertyCache, iParent ); |
|
8661 } |
|
8662 |
|
8663 // ----------------------------------------------------------------------------- |
|
8664 // CXnNodeImpl::BackgroundColorL |
|
8665 // Returns background-color property. |
|
8666 // ----------------------------------------------------------------------------- |
|
8667 // |
|
8668 CXnProperty* CXnNodeImpl::BackgroundColorL() |
|
8669 { |
|
8670 CXnProperty* property = |
|
8671 iLayoutPropertyCache ? iLayoutPropertyCache->iBackgroundColor : NULL; |
|
8672 return PropertyL( property, &CXnNode::BackgroundColorL, |
|
8673 iLayoutPropertyCache, iParent ); |
|
8674 } |
|
8675 |
|
8676 // ----------------------------------------------------------------------------- |
|
8677 // CXnNodeImpl::BackgroundImageL |
|
8678 // Returns background-image property. |
|
8679 // ----------------------------------------------------------------------------- |
|
8680 // |
|
8681 CXnProperty* CXnNodeImpl::BackgroundImageL() |
|
8682 { |
|
8683 CXnProperty* property = |
|
8684 iLayoutPropertyCache ? iLayoutPropertyCache->iBackgroundImage : NULL; |
|
8685 return PropertyL( property, &CXnNode::BackgroundImageL, |
|
8686 iLayoutPropertyCache, iParent ); |
|
8687 } |
|
8688 |
|
8689 // ----------------------------------------------------------------------------- |
|
8690 // CXnNodeImpl::FocusBackgroundL |
|
8691 // Returns focus-background property. |
|
8692 // ----------------------------------------------------------------------------- |
|
8693 // |
|
8694 CXnProperty* CXnNodeImpl::FocusBackgroundL() |
|
8695 { |
|
8696 CXnProperty* property = |
|
8697 iLayoutPropertyCache ? iLayoutPropertyCache->iFocusBackground : NULL; |
|
8698 |
|
8699 return PropertyL( property, &CXnNode::FocusBackgroundL, |
|
8700 iLayoutPropertyCache, iParent ); |
|
8701 } |
|
8702 |
|
8703 // ---------------------------------------------------------------------------- |
|
8704 // CXnNodeImpl::SetDomNode |
|
8705 // Sets DOM node |
|
8706 // ---------------------------------------------------------------------------- |
|
8707 // |
|
8708 void CXnNodeImpl::SetDomNode( CXnDomNode* aDomNode ) |
|
8709 { |
|
8710 iDomNode = aDomNode; |
|
8711 } |
|
8712 |
|
8713 // ---------------------------------------------------------------------------- |
|
8714 // CXnNodeImpl::DomNode |
|
8715 // Returns the DOM node pointer |
|
8716 // ---------------------------------------------------------------------------- |
|
8717 // |
|
8718 CXnDomNode* CXnNodeImpl::DomNode() |
|
8719 { |
|
8720 return iDomNode; |
|
8721 } |
|
8722 |
|
8723 // ---------------------------------------------------------------------------- |
|
8724 // CXnNodeImpl::MeasureAdaptiveContentL |
|
8725 // Measures the adaptive content dimensions. |
|
8726 // ---------------------------------------------------------------------------- |
|
8727 // |
|
8728 TSize CXnNodeImpl::MeasureAdaptiveContentL( const TSize& aAvailableSize ) |
|
8729 { |
|
8730 TSize empty; |
|
8731 |
|
8732 TInt adaptive( IsAdaptive() ); |
|
8733 |
|
8734 if ( aAvailableSize.iWidth <= 0 && ( adaptive & XnAdaptive::EWidth ) || |
|
8735 aAvailableSize.iHeight <= 0 && ( adaptive & XnAdaptive::EHeight ) ) |
|
8736 { |
|
8737 // No available size, don't even try to measure |
|
8738 return empty; |
|
8739 } |
|
8740 |
|
8741 // node is displayed as default |
|
8742 TBool displayed( ETrue ); |
|
8743 |
|
8744 CXnProperty* displayProp( DisplayL() ); |
|
8745 |
|
8746 if ( displayProp ) |
|
8747 { |
|
8748 const TDesC8& value( displayProp->StringValue() ); |
|
8749 |
|
8750 if ( value != XnPropertyNames::style::common::display::KBlock ) |
|
8751 { |
|
8752 // Not displayed |
|
8753 displayed = EFalse; |
|
8754 } |
|
8755 } |
|
8756 |
|
8757 if ( adaptive && iLayoutCapable && !iDropped && displayed ) |
|
8758 { |
|
8759 CXnControlAdapter* adapter( iNode->Control() ); |
|
8760 |
|
8761 // What is my size? |
|
8762 if ( adapter ) |
|
8763 { |
|
8764 TInt width( 0 ); |
|
8765 TInt height( 0 ); |
|
8766 |
|
8767 TSize size = adapter->MeasureAdaptiveContentL( aAvailableSize ); |
|
8768 |
|
8769 if ( adaptive & XnAdaptive::EWidth ) |
|
8770 { |
|
8771 width = size.iWidth; |
|
8772 } |
|
8773 |
|
8774 if ( adaptive & XnAdaptive::EHeight ) |
|
8775 { |
|
8776 height = size.iHeight; |
|
8777 } |
|
8778 |
|
8779 return TSize( width, height ); |
|
8780 } |
|
8781 } |
|
8782 |
|
8783 return empty; |
|
8784 } |
|
8785 |
|
8786 // ---------------------------------------------------------------------------- |
|
8787 // CXnNodeImpl::IsAdaptive |
|
8788 // Checks if the node have adaptive content |
|
8789 // ---------------------------------------------------------------------------- |
|
8790 // |
|
8791 TInt CXnNodeImpl::IsAdaptive( TBool aIgnoreSizeFixed ) const |
|
8792 { |
|
8793 if ( !iAdaptive ) |
|
8794 { |
|
8795 return XnAdaptive::ENone; |
|
8796 } |
|
8797 |
|
8798 TInt adaptive( iAdaptive ); |
|
8799 |
|
8800 if ( ( adaptive & XnAdaptive::ESizeFixed ) && !aIgnoreSizeFixed ) |
|
8801 { |
|
8802 // When size is fixed, pretend non-adaptive |
|
8803 return XnAdaptive::ENone; |
|
8804 } |
|
8805 |
|
8806 // Remove measure control flags |
|
8807 adaptive &= ~XnAdaptive::EMeasure; |
|
8808 adaptive &= ~XnAdaptive::ESizeFixed; |
|
8809 |
|
8810 return adaptive; |
|
8811 } |
|
8812 |
|
8813 // ---------------------------------------------------------------------------- |
|
8814 // CXnNodeImpl::SetAdaptiveL |
|
8815 // Marks the node to have adaptive content |
|
8816 // ---------------------------------------------------------------------------- |
|
8817 // |
|
8818 void CXnNodeImpl::SetAdaptiveL( const TInt aAdaptive ) |
|
8819 { |
|
8820 TInt adaptive( aAdaptive ); |
|
8821 |
|
8822 // Force adaptive nodes to be auto |
|
8823 if ( adaptive & XnAdaptive::EMeasure ) |
|
8824 { |
|
8825 if ( iAdaptive & XnAdaptive::EMeasure ) |
|
8826 { |
|
8827 // Measure already pending |
|
8828 return; |
|
8829 } |
|
8830 |
|
8831 if ( iAdaptive & XnAdaptive::EWidth ) |
|
8832 { |
|
8833 adaptive |= XnAdaptive::EWidth; |
|
8834 } |
|
8835 |
|
8836 if ( iAdaptive & XnAdaptive::EHeight ) |
|
8837 { |
|
8838 adaptive |= XnAdaptive::EHeight; |
|
8839 } |
|
8840 |
|
8841 // Reset |
|
8842 iAdaptive = XnAdaptive::ENone; |
|
8843 } |
|
8844 |
|
8845 if ( ( adaptive & XnAdaptive::EWidth ) && |
|
8846 !( iAdaptive & XnAdaptive::EWidth ) ) |
|
8847 { |
|
8848 iAdaptive |= XnAdaptive::EIgnoreDirty; |
|
8849 |
|
8850 SetStringPropertyToNodeL( |
|
8851 *DomNode()->StringPool(), *Node(), |
|
8852 XnPropertyNames::style::common::KWidth, |
|
8853 XnPropertyNames::style::common::KAuto ); |
|
8854 |
|
8855 // Width is adaptive |
|
8856 iAdaptive |= XnAdaptive::EWidth; |
|
8857 |
|
8858 iAdaptive &= ~XnAdaptive::EIgnoreDirty; |
|
8859 } |
|
8860 |
|
8861 if ( ( adaptive & XnAdaptive::EHeight ) && |
|
8862 !( iAdaptive & XnAdaptive::EHeight ) ) |
|
8863 { |
|
8864 iAdaptive |= XnAdaptive::EIgnoreDirty; |
|
8865 |
|
8866 SetStringPropertyToNodeL( |
|
8867 *DomNode()->StringPool(), *Node(), |
|
8868 XnPropertyNames::style::common::KHeight, |
|
8869 XnPropertyNames::style::common::KAuto ); |
|
8870 |
|
8871 // Height is adaptive |
|
8872 iAdaptive |= XnAdaptive::EHeight; |
|
8873 |
|
8874 iAdaptive &= ~XnAdaptive::EIgnoreDirty; |
|
8875 } |
|
8876 |
|
8877 // Size is no more fixed |
|
8878 iAdaptive &= ~XnAdaptive::ESizeFixed; |
|
8879 |
|
8880 // and it needs to be measured |
|
8881 iAdaptive |= XnAdaptive::EMeasure; |
|
8882 } |
|
8883 |
|
8884 // ---------------------------------------------------------------------------- |
|
8885 // CXnNodeImpl::FixAdaptiveSize |
|
8886 // Fixes the adaptive node's size |
|
8887 // ---------------------------------------------------------------------------- |
|
8888 // |
|
8889 void CXnNodeImpl::FixAdaptiveSizeL( const TSize& aFixedSize ) |
|
8890 { |
|
8891 // Is there measure pending |
|
8892 if ( iAdaptive & XnAdaptive::EMeasure ) |
|
8893 { |
|
8894 if ( iAdaptive & XnAdaptive::EWidth ) |
|
8895 { |
|
8896 iAdaptive |= XnAdaptive::EIgnoreDirty; |
|
8897 |
|
8898 SetFloatPropertyToNodeL( |
|
8899 *DomNode()->StringPool(), *Node(), |
|
8900 XnPropertyNames::style::common::KWidth, |
|
8901 aFixedSize.iWidth, CXnDomPropertyValue::EPx ); |
|
8902 |
|
8903 iAdaptive &= ~XnAdaptive::EIgnoreDirty; |
|
8904 } |
|
8905 |
|
8906 if ( iAdaptive & XnAdaptive::EHeight ) |
|
8907 { |
|
8908 iAdaptive |= XnAdaptive::EIgnoreDirty; |
|
8909 |
|
8910 SetFloatPropertyToNodeL( |
|
8911 *DomNode()->StringPool(), *Node(), |
|
8912 XnPropertyNames::style::common::KHeight, |
|
8913 aFixedSize.iHeight, CXnDomPropertyValue::EPx ); |
|
8914 |
|
8915 iAdaptive &= ~XnAdaptive::EIgnoreDirty; |
|
8916 } |
|
8917 |
|
8918 // Measure done |
|
8919 iAdaptive &= ~XnAdaptive::EMeasure; |
|
8920 // Size is now fixed |
|
8921 iAdaptive |= XnAdaptive::ESizeFixed; |
|
8922 } |
|
8923 } |
|
8924 |
|
8925 // ----------------------------------------------------------------------------- |
|
8926 // CXnNodeImpl::SetDirtyL |
|
8927 // ----------------------------------------------------------------------------- |
|
8928 // |
|
8929 void CXnNodeImpl::SetDirtyL( TInt aLevel, TBool aDisplayedState ) |
|
8930 { |
|
8931 if( !aDisplayedState ) |
|
8932 { |
|
8933 // check if node isn't displayed indeed (def. param. = EFalse) |
|
8934 aDisplayedState = IsNodeDisplayedL( *iNode ); |
|
8935 } |
|
8936 if ( iLayoutCapable ) |
|
8937 { |
|
8938 if ( aLevel == XnDirtyLevel::ENone ) |
|
8939 { |
|
8940 // nothing to do |
|
8941 return; |
|
8942 } |
|
8943 |
|
8944 if ( aLevel == XnDirtyLevel::ELayoutAndRenderSiblings ) |
|
8945 { |
|
8946 if ( iParent ) |
|
8947 { |
|
8948 // Siblings needs to be laid out also |
|
8949 RPointerArray< CXnNode >& siblings( iParent->Children() ); |
|
8950 |
|
8951 for ( TInt i = 0; i < siblings.Count(); i++ ) |
|
8952 { |
|
8953 CXnNode* sibling( siblings[i] ); |
|
8954 |
|
8955 if ( sibling == iNode ) |
|
8956 { |
|
8957 sibling->SetDirtyL( XnDirtyLevel::ELayoutAndRender, |
|
8958 aDisplayedState ); |
|
8959 } |
|
8960 else |
|
8961 { |
|
8962 sibling->SetDirtyL( XnDirtyLevel::ELayoutAndRender ); |
|
8963 } |
|
8964 } |
|
8965 } |
|
8966 } |
|
8967 else |
|
8968 { |
|
8969 if ( ( iParent || iNode == iUiEngine->RootNode() ) && |
|
8970 iNode != iUiEngine->ActiveView() ) |
|
8971 { |
|
8972 // Full redraw (without layout) can be done by setting rootnode |
|
8973 // level to ERender |
|
8974 if ( aLevel == XnDirtyLevel::ERender && !iLaidOut && |
|
8975 iNode != iUiEngine->RootNode() ) |
|
8976 { |
|
8977 aLevel = XnDirtyLevel::ELayoutAndRender; |
|
8978 } |
|
8979 |
|
8980 if ( aDisplayedState ) |
|
8981 { |
|
8982 iUiEngine->AddDirtyNodeL( iNode, aLevel ); |
|
8983 } |
|
8984 else |
|
8985 { |
|
8986 ClearRenderedAndLaidOut(); |
|
8987 } |
|
8988 } |
|
8989 } |
|
8990 } |
|
8991 else if ( iParent && iParent->Type()->Type() == KMenuBar ) |
|
8992 { |
|
8993 // Mark menu to be refreshed |
|
8994 iUiEngine->AddDirtyNodeL( iParent, XnDirtyLevel::ERender ); |
|
8995 } |
|
8996 } |
|
8997 |
|
8998 // ----------------------------------------------------------------------------- |
|
8999 // CXnNodeImpl::RunFocusChangeL |
|
9000 // ----------------------------------------------------------------------------- |
|
9001 // |
|
9002 TBool CXnNodeImpl::RunFocusChangeL( RPointerArray< CXnNode >& aFocusCandidates ) |
|
9003 { |
|
9004 for ( TInt i = 0; i < aFocusCandidates.Count(); i++ ) |
|
9005 { |
|
9006 CXnNode* node( aFocusCandidates[i] ); |
|
9007 |
|
9008 if ( IsNodeNavigableL( *node ) ) |
|
9009 { |
|
9010 if( node->ScrollableControl() ) |
|
9011 { |
|
9012 node->ScrollableControl()->ShowItem( *node ); |
|
9013 } |
|
9014 |
|
9015 node->SetStateWithoutNotificationL( |
|
9016 XnPropertyNames::style::common::KFocus ); |
|
9017 |
|
9018 // All done |
|
9019 return ETrue; |
|
9020 } |
|
9021 } |
|
9022 |
|
9023 // Focus change failed |
|
9024 CXnNode* focused( iUiEngine->FocusedNode() ); |
|
9025 |
|
9026 if ( focused ) |
|
9027 { |
|
9028 // Is the currently focused node still navigable |
|
9029 if ( !IsNodeNavigableL( *focused ) ) |
|
9030 { |
|
9031 // No, remove focus |
|
9032 focused->UnsetStateL( XnPropertyNames::style::common::KFocus ); |
|
9033 } |
|
9034 } |
|
9035 |
|
9036 return EFalse; |
|
9037 } |
|
9038 |
|
9039 // ----------------------------------------------------------------------------- |
|
9040 // CXnNodeImpl::ReorderNodesL |
|
9041 // ----------------------------------------------------------------------------- |
|
9042 // |
|
9043 void CXnNodeImpl::ReorderNodesL( CXnNode* aSource, CXnNode* aTarget ) |
|
9044 { |
|
9045 TInt target = -1; |
|
9046 TInt source = -1; |
|
9047 TInt childCount = iChildren.Count(); |
|
9048 RPointerArray< CXnNode > lockedNodes; |
|
9049 CleanupClosePushL( lockedNodes ); |
|
9050 RArray< TInt > lockedNodeIndex; |
|
9051 CleanupClosePushL( lockedNodeIndex ); |
|
9052 |
|
9053 for ( TInt i = 0; i < childCount; i++ ) |
|
9054 { |
|
9055 CXnNode* tmpNode = iChildren[i]; |
|
9056 CXnProperty* editable = tmpNode->GetPropertyL( |
|
9057 XnPropertyNames::style::common::edit::KEditable ); |
|
9058 if ( editable && editable->StringValue() == XnPropertyNames::KFalse ) |
|
9059 { |
|
9060 lockedNodes.AppendL( tmpNode ); |
|
9061 lockedNodeIndex.AppendL( i ); |
|
9062 continue; |
|
9063 } |
|
9064 |
|
9065 if ( tmpNode == aSource ) |
|
9066 { |
|
9067 source = i; |
|
9068 } |
|
9069 if ( tmpNode == aTarget ) |
|
9070 { |
|
9071 target = i; |
|
9072 } |
|
9073 } |
|
9074 if ( source != -1 && target != -1 ) |
|
9075 { |
|
9076 TBool swap = EFalse; |
|
9077 CXnPluginData* data( aTarget->UiEngine()->ViewManager()-> |
|
9078 ActiveViewData().Plugin( aTarget ) ); |
|
9079 if ( data && !data->Occupied() ) |
|
9080 { |
|
9081 // target is empty widget, swap widget places |
|
9082 swap = ETrue; |
|
9083 } |
|
9084 |
|
9085 if ( target < source ) |
|
9086 { |
|
9087 iChildren.InsertL( aSource, target ); |
|
9088 iChildren.Remove( source + 1 ); |
|
9089 if ( swap ) |
|
9090 { |
|
9091 iChildren.Remove( target + 1 ); |
|
9092 iChildren.InsertL( aTarget, source ); |
|
9093 } |
|
9094 } |
|
9095 else if ( source < target ) |
|
9096 { |
|
9097 iChildren.Remove( source ); |
|
9098 iChildren.InsertL( aSource, target ); |
|
9099 if ( swap ) |
|
9100 { |
|
9101 iChildren.Insert( aTarget, source ); |
|
9102 iChildren.Remove( target ); |
|
9103 } |
|
9104 } |
|
9105 |
|
9106 // put the locked nodes to the original places |
|
9107 TInt lockedNodeCount = lockedNodes.Count(); |
|
9108 TInt lockedIndexCount = lockedNodeIndex.Count(); |
|
9109 if ( lockedNodeCount != lockedIndexCount ) |
|
9110 { |
|
9111 return; |
|
9112 } |
|
9113 // First remove all the locked nodes |
|
9114 for ( TInt j = 0; j < lockedNodeCount; j++ ) |
|
9115 { |
|
9116 CXnNode* tmpLockedNode = lockedNodes[j]; |
|
9117 TInt ind = iChildren.FindL( tmpLockedNode ); |
|
9118 if ( KErrNotFound != ind ) |
|
9119 { |
|
9120 iChildren.Remove( ind ); |
|
9121 } |
|
9122 } |
|
9123 |
|
9124 //And then put them again to the original places |
|
9125 for ( TInt j = 0; j < lockedNodeCount; j++ ) |
|
9126 { |
|
9127 CXnNode* tmpLockedNode = lockedNodes[j]; |
|
9128 iChildren.InsertL( tmpLockedNode, lockedNodeIndex[j] ); |
|
9129 } |
|
9130 } |
|
9131 |
|
9132 lockedNodes.Reset(); |
|
9133 lockedNodeIndex.Reset(); |
|
9134 CleanupStack::PopAndDestroy( 2 ); // lockedNodes, lockedNodeIndex |
|
9135 } |
|
9136 |
|
9137 // ----------------------------------------------------------------------------- |
|
9138 // CXnNodeImpl::FindNextNodeL |
|
9139 // ----------------------------------------------------------------------------- |
|
9140 // |
|
9141 CXnNode* CXnNodeImpl::FindNextNodeL( |
|
9142 RPointerArray< CXnNode >& aArray, |
|
9143 CXnNode& aNode, |
|
9144 TInt aDirection ) |
|
9145 { |
|
9146 CXnNode* node = NULL; |
|
9147 if ( aDirection == EStdKeyRightArrow ) |
|
9148 { |
|
9149 node = FindNextNodeFromRightL( aArray, aNode ); |
|
9150 } |
|
9151 else if ( aDirection == EStdKeyLeftArrow ) |
|
9152 { |
|
9153 node = FindNextNodeFromLeftL( aArray, aNode ); |
|
9154 } |
|
9155 else if ( aDirection == EStdKeyUpArrow ) |
|
9156 { |
|
9157 node = FindNextNodeFromAboveL( aArray, aNode ); |
|
9158 } |
|
9159 else if ( aDirection == EStdKeyDownArrow ) |
|
9160 { |
|
9161 node = FindNextNodeFromBelowL( aArray, aNode ); |
|
9162 } |
|
9163 return node; |
|
9164 } |
|
9165 |
|
9166 // ----------------------------------------------------------------------------- |
|
9167 // CXnNodeImpl::Namespace |
|
9168 // ----------------------------------------------------------------------------- |
|
9169 // |
|
9170 const TDesC8& CXnNodeImpl::Namespace() |
|
9171 { |
|
9172 return DomNode()->Namespace(); |
|
9173 } |
|
9174 |
|
9175 // ----------------------------------------------------------------------------- |
|
9176 // CXnNodeImpl::SetScrollableControl() |
|
9177 // ----------------------------------------------------------------------------- |
|
9178 // |
|
9179 void CXnNodeImpl::SetScrollableControl( CXnScrollableControlAdapter* aScrollableControl ) |
|
9180 { |
|
9181 iScrollableControl = aScrollableControl; |
|
9182 } |
|
9183 |
|
9184 // ----------------------------------------------------------------------------- |
|
9185 // CXnNodeImpl::ScrollableControl() |
|
9186 // ----------------------------------------------------------------------------- |
|
9187 // |
|
9188 CXnScrollableControlAdapter* CXnNodeImpl::ScrollableControl() |
|
9189 { |
|
9190 return iScrollableControl; |
|
9191 } |
|
9192 |
|
9193 // ----------------------------------------------------------------------------- |
|
9194 // CXnNodeImpl::AdjustRectIfNeeded |
|
9195 // ----------------------------------------------------------------------------- |
|
9196 // |
|
9197 TRect CXnNodeImpl::AdjustRectIfNeeded( TRect aRect ) |
|
9198 { |
|
9199 if(iScrollableControl) |
|
9200 { |
|
9201 aRect.Move( iScrollableControl->DeltaPosition() ); |
|
9202 } |
|
9203 return aRect; |
|
9204 } |