|
1 /* |
|
2 * Copyright (c) 2002-2004 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: |
|
15 * Xuikon UI engine. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef XNUIENGINE_H |
|
20 #define XNUIENGINE_H |
|
21 |
|
22 // System includes |
|
23 #include <e32base.h> |
|
24 #include <w32std.h> |
|
25 |
|
26 // Forward declarations |
|
27 class CXnAppUiAdapter; |
|
28 class CXnViewManager; |
|
29 class CXnUiEngineImpl; |
|
30 class TXnUiEngineAppIf; |
|
31 class TXnUiEnginePluginIf; |
|
32 class CCoeControl; |
|
33 class CXnProperty; |
|
34 class CXnNode; |
|
35 class CXnResource; |
|
36 class CXnODT; |
|
37 class CXnPointerArray; |
|
38 class CXnEditor; |
|
39 class CXnEditMode; |
|
40 class CXnKeyEventDispatcher; |
|
41 |
|
42 // Class declaration |
|
43 /** |
|
44 * Xuikon UI engine. |
|
45 * |
|
46 * @ingroup group_xnlayoutengine |
|
47 * @lib xnlayoutengine.lib |
|
48 * @since Series 60 3.1 |
|
49 */ |
|
50 NONSHARABLE_CLASS( CXnUiEngine ) : public CBase |
|
51 { |
|
52 public: |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 */ |
|
57 static CXnUiEngine* NewL( CXnAppUiAdapter& aAdapter ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CXnUiEngine(); |
|
63 |
|
64 public: |
|
65 // New functions |
|
66 |
|
67 /** |
|
68 * Gets AppUi |
|
69 * |
|
70 * @since S60 5.0 |
|
71 * @return AppUi |
|
72 */ |
|
73 CXnAppUiAdapter& AppUiAdapter() const; |
|
74 |
|
75 /** |
|
76 * Calculates the layout of the UI and renders it. |
|
77 * |
|
78 * @since Series 60 3.1 |
|
79 * @param aNode Starting point for the layout |
|
80 * @exception KXnErrLoadLayoutFileFailed Loading the layout file failed. |
|
81 */ |
|
82 void RenderUIL( CXnNode* aNode = NULL ); |
|
83 |
|
84 /** |
|
85 * Calculates the layout of the UI. |
|
86 * |
|
87 * @since Series 60 3.1 |
|
88 * @param aNode Starting point for the layout |
|
89 */ |
|
90 void LayoutUIL( CXnNode* aNode = NULL ); |
|
91 |
|
92 /** |
|
93 * Gets the root node of the UI. Ownership is not transferred. |
|
94 * |
|
95 * @since Series 60 3.1 |
|
96 * @return Node |
|
97 */ |
|
98 CXnNode* RootNode(); |
|
99 |
|
100 /** |
|
101 * Find a node by its id. Ownership is not transferred. |
|
102 * |
|
103 * @since Series 60 3.1 |
|
104 * @param aAreaId Area id |
|
105 * @param aNamespace Namespace |
|
106 * @return Node with the given id |
|
107 */ |
|
108 CXnNode* FindNodeByIdL( |
|
109 const TDesC& aAreaId, |
|
110 const TDesC& aNamespace = KNullDesC ); |
|
111 |
|
112 /** |
|
113 * 8-bit version of Find a node by its id. Ownership is not transferred. |
|
114 * |
|
115 * @since Series 60 3.1 |
|
116 * @param aAreaId Area id |
|
117 * @param aNamespace Namespace |
|
118 * @return Node with the given id |
|
119 */ |
|
120 CXnNode* FindNodeByIdL( |
|
121 const TDesC8& aAreaId, |
|
122 const TDesC8& aNamespace = KNullDesC8 ); |
|
123 |
|
124 /** |
|
125 * Find nodes by class. Ownership is not transferred. |
|
126 * |
|
127 * @since Series 60 3.1 |
|
128 * @param aClassId Class id |
|
129 * @return Nodes belonging to the class |
|
130 */ |
|
131 CXnPointerArray* FindNodeByClassL( |
|
132 const TDesC& aClassId, |
|
133 const TDesC& aNamespace = KNullDesC ); |
|
134 |
|
135 /** |
|
136 * Find nodes by class. Ownership is not transferred. |
|
137 * |
|
138 * @since Series 60 3.1 |
|
139 * @param aClassId Class id |
|
140 * @return Nodes belonging to the class |
|
141 */ |
|
142 CXnPointerArray* FindNodeByClassL( |
|
143 const TDesC8& aClassId, |
|
144 const TDesC8& aNamespace = KNullDesC8 ); |
|
145 |
|
146 /** |
|
147 * Find content source nodes from namespace. Ownership is not transferred. |
|
148 * |
|
149 * @since S60 5.2 |
|
150 * @param aNamespace Namespace |
|
151 * @return Content source nodes from namespace |
|
152 */ |
|
153 CXnPointerArray* FindContentSourceNodesL( |
|
154 const TDesC8& aNamespace ); |
|
155 |
|
156 /** |
|
157 * Find resources (images etc.) of the UI. Ownership is not transferred. |
|
158 * |
|
159 * @since Series 60 3.1 |
|
160 * @return Resources of the UI |
|
161 */ |
|
162 CArrayPtrSeg< CXnResource >& Resources(); |
|
163 |
|
164 /** |
|
165 * Set currently focused node |
|
166 * |
|
167 * @since Series 60 3.1 |
|
168 * @param aFocusedNode Focused node |
|
169 * @param aSource A source of event that triggered focus change. |
|
170 */ |
|
171 void SetFocusedNodeL( CXnNode* aFocusedNode, TInt aSource = 0 ); |
|
172 |
|
173 /** |
|
174 * Get currently focused node |
|
175 * |
|
176 * @since Series 60 3.2 |
|
177 * @return Focused node. |
|
178 */ |
|
179 CXnNode* FocusedNode(); |
|
180 |
|
181 /** |
|
182 * Checks if the UI is in Edit mode. |
|
183 * |
|
184 * @since Series 60 5.0 |
|
185 * @return ETrue if the current mode is edit, otherwise EFalse. |
|
186 */ |
|
187 TBool IsEditMode(); |
|
188 |
|
189 /** |
|
190 * Get the raw ODT |
|
191 * |
|
192 * @since Series 60 3.1 |
|
193 * @return ODT |
|
194 */ |
|
195 CXnODT* ODT(); |
|
196 |
|
197 /** |
|
198 * Get a numeric value of a property in vertical pixels |
|
199 * |
|
200 * @since Series 60 3.1 |
|
201 * @param aValue Property |
|
202 * @param aReferenceValue Value used for percentage calculation |
|
203 * @return Value in vertical pixels |
|
204 */ |
|
205 TInt VerticalPixelValueL( CXnProperty* aValue, TInt aReferenceValue ); |
|
206 |
|
207 /** |
|
208 * Get a numeric value of a property in horizontal pixels |
|
209 * |
|
210 * @since Series 60 3.1 |
|
211 * @param aValue Property |
|
212 * @param aReferenceValue Value used for percentage calculation |
|
213 * @return Value in horizontal pixels |
|
214 */ |
|
215 TInt HorizontalPixelValueL( CXnProperty* aValue, TInt aReferenceValue ); |
|
216 |
|
217 /** |
|
218 * Get a numeric value of a property in vertical twips |
|
219 * |
|
220 * @since Series 60 3.1 |
|
221 * @param aValue Property |
|
222 * @param aReferenceValue Value used for percentage calculation |
|
223 * @return Value in vertical twips |
|
224 */ |
|
225 TInt VerticalTwipValueL( CXnProperty* aValue, TInt aReferenceValue ); |
|
226 |
|
227 /** |
|
228 * Get a numeric value of a property in horizontal twips |
|
229 * |
|
230 * @since Series 60 3.1 |
|
231 * @param aValue Property |
|
232 * @param aReferenceValue Value used for percentage calculation |
|
233 * @return Value in horizontal pixels |
|
234 */ |
|
235 TInt HorizontalTwipValueL( CXnProperty* aValue, TInt aReferenceValue ); |
|
236 |
|
237 /** |
|
238 * Refresh current menu |
|
239 * |
|
240 * @since Series 60 3.1 |
|
241 */ |
|
242 void RefreshMenuL(); |
|
243 |
|
244 /** |
|
245 * Returns view manager |
|
246 * |
|
247 * @since S60 5.0 |
|
248 * @return view manager |
|
249 */ |
|
250 CXnViewManager* ViewManager(); |
|
251 |
|
252 /** |
|
253 * Return the active view |
|
254 * |
|
255 * @since Series 60 3.1 |
|
256 * @return The active view node |
|
257 */ |
|
258 CXnNode* ActiveView(); |
|
259 |
|
260 /** |
|
261 * Add a dirty node. |
|
262 * |
|
263 * LayoutUiL and RenderUiL will only perform operations on the set of dirty |
|
264 * nodes. |
|
265 * |
|
266 * @since Series 60 3.1 |
|
267 * @param aNode Dirty node. |
|
268 */ |
|
269 void AddDirtyNodeL( CXnNode* aNode, TInt aLevel ); |
|
270 |
|
271 /** |
|
272 * Get application interface. |
|
273 * |
|
274 * @since Series 60 3.1 |
|
275 * @return application interface |
|
276 */ |
|
277 TXnUiEngineAppIf& AppIfL(); |
|
278 |
|
279 /** |
|
280 * Get plugin interface. |
|
281 * |
|
282 * @since Series 60 3.1 |
|
283 * @return plugin interface |
|
284 */ |
|
285 TXnUiEnginePluginIf& PluginIfL(); |
|
286 |
|
287 /** |
|
288 * Get the size of the current screen device |
|
289 * |
|
290 * @since Series 60 3.1 |
|
291 * @return Size of the current screen device |
|
292 */ |
|
293 TSize ScreenDeviceSize() const; |
|
294 |
|
295 /** |
|
296 * Checks whether the dialog is displaying. |
|
297 * |
|
298 * @since Series 60 3.1 |
|
299 * @return ETrue if dialog is displaying. |
|
300 */ |
|
301 TBool IsDialogDisplaying(); |
|
302 |
|
303 /** |
|
304 * Checks whether the menu is displaying. |
|
305 * |
|
306 * @since Series 60 3.1 |
|
307 * @return ETrue if menu is displaying. |
|
308 */ |
|
309 TBool IsMenuDisplaying(); |
|
310 |
|
311 /** |
|
312 * Returns menubar node. |
|
313 * |
|
314 * @since Series 60 3.2 |
|
315 */ |
|
316 CXnNode* MenuBarNode() const; |
|
317 |
|
318 /** |
|
319 * Returns stylus popup node. |
|
320 * |
|
321 * @since S60 5.0 |
|
322 */ |
|
323 CXnNode* StylusPopupNode() const; |
|
324 |
|
325 /** |
|
326 * Set node as passive, and add it to the passive focused node array. |
|
327 * |
|
328 * @since Series 60 3.2 |
|
329 * @param aNode Node to use. |
|
330 */ |
|
331 void AddPassiveFocusedNodeL( CXnNode* aNode ); |
|
332 |
|
333 /** |
|
334 * Unset the passive focus from the node, and remove it from the passive |
|
335 * focused node array. |
|
336 * @since Series 60 3.2 |
|
337 * @param aNode Node to use. |
|
338 */ |
|
339 void RemovePassiveFocusedNodeL( CXnNode* aNode ); |
|
340 |
|
341 /** |
|
342 * Clear the passive focused node array, and unset the passive focus states. |
|
343 * |
|
344 * @since Series 60 3.2 |
|
345 */ |
|
346 void ClearPassiveFocusedNodesL(); |
|
347 |
|
348 /** |
|
349 * Sets the main pane rect |
|
350 * |
|
351 * @since Series 60 5.0 |
|
352 */ |
|
353 void SetClientRectL( TRect aRect, TBool aDrawNow = ETrue ); |
|
354 |
|
355 /** |
|
356 * Gets the main pane rect |
|
357 * |
|
358 * @since Series 60 5.0 |
|
359 */ |
|
360 TRect ClientRect() const; |
|
361 |
|
362 /** |
|
363 * Sets nodes dropped state |
|
364 * |
|
365 * @since S60 3.2 |
|
366 */ |
|
367 void SetNodeDroppedL( CXnNode& aNode, TInt aDropped ) const; |
|
368 |
|
369 /** |
|
370 * Checks if node is adaptive, but doesn't have any content |
|
371 * |
|
372 * @since Series 60 3.2 |
|
373 */ |
|
374 void CheckAdaptiveContentL( |
|
375 CXnNode& aNode, |
|
376 TSize aAvailableSize = TSize::EUninitialized ) const; |
|
377 |
|
378 /** |
|
379 * Adds a node which can be focused. |
|
380 * |
|
381 * @since Series 60 3.2 |
|
382 */ |
|
383 void AddFocusCandidateL( CXnNode *aNode ); |
|
384 |
|
385 /** |
|
386 * Fetch editor to operate on AI3 widgets. |
|
387 * |
|
388 * @since Series 60 5.0 |
|
389 * @return Pointer to Editor |
|
390 */ |
|
391 CXnEditor* Editor()const; |
|
392 |
|
393 /** |
|
394 * Gets pointer to edit mode storage. |
|
395 * |
|
396 * @since Series 60 5.0 |
|
397 */ |
|
398 CXnEditMode* EditMode(); |
|
399 |
|
400 /** |
|
401 * Gets the array that contains plugin nodes for current view. |
|
402 * |
|
403 * @since Series 60 5.0 |
|
404 */ |
|
405 RPointerArray< CXnNode >* Plugins(); |
|
406 |
|
407 /** |
|
408 * Gets theme resource file |
|
409 * |
|
410 * @since S60 5.1 |
|
411 * @param aPath path from which file is found |
|
412 * @param aFile file to which resource is set |
|
413 * @return errorcode |
|
414 */ |
|
415 TInt GetThemeResource( const TDesC& aPath, RFile& aFile ); |
|
416 |
|
417 /** |
|
418 * Analyse added widget |
|
419 * |
|
420 * @since S60 5.1 |
|
421 */ |
|
422 TBool AnalyseAddedWidgetL( CXnNode& aNode ); |
|
423 |
|
424 /** |
|
425 * Disables layoyt and redraw, places cleanup item to cleanup stack |
|
426 * for enabling layot and redraw |
|
427 * |
|
428 * @since Series 60 5.0 |
|
429 */ |
|
430 void DisableRenderUiLC(); |
|
431 |
|
432 /** |
|
433 * Set event dispatcher |
|
434 * |
|
435 * @since Series 60 5.0 |
|
436 * @param aDispather Event dispatcher |
|
437 */ |
|
438 void SetEventDispatcher( CXnKeyEventDispatcher* aDispatcher ); |
|
439 |
|
440 /** |
|
441 * Enables partial touch input |
|
442 * |
|
443 * @since Series 60 5.2 |
|
444 * @param aNode Editor Node |
|
445 * @param TBool True if partial input is open |
|
446 */ |
|
447 void EnablePartialTouchInput( CXnNode& aNode, TBool aEnable ); |
|
448 |
|
449 /** |
|
450 * Is partial input active |
|
451 * |
|
452 * @since Series 60 5.2 |
|
453 * @return TBool is partial input active |
|
454 */ |
|
455 TBool IsPartialInputActive(); |
|
456 |
|
457 /** |
|
458 * Checks if text editor is focused or partioal touch input open. |
|
459 * |
|
460 * @since Series 60 5.2 |
|
461 * @return TBool True if partial input is open or editor focused |
|
462 */ |
|
463 TBool IsTextEditorActive(); |
|
464 |
|
465 private: |
|
466 /** |
|
467 * C++ default constructor. |
|
468 */ |
|
469 CXnUiEngine(); |
|
470 |
|
471 /** |
|
472 * 2nd phase constructor. |
|
473 */ |
|
474 void ConstructL( CXnAppUiAdapter& aAdapter ); |
|
475 |
|
476 private: |
|
477 // Data |
|
478 |
|
479 /** |
|
480 * The layout calculation and ui rendering implementation. |
|
481 * Own. |
|
482 */ |
|
483 CXnUiEngineImpl* iUiEngineImpl; |
|
484 |
|
485 /** |
|
486 * Application proxy. |
|
487 * Own. |
|
488 */ |
|
489 TXnUiEngineAppIf* iAppIf; |
|
490 |
|
491 /** |
|
492 * Plugin proxy. |
|
493 * Own. |
|
494 */ |
|
495 TXnUiEnginePluginIf* iPluginIf; |
|
496 }; |
|
497 |
|
498 #endif |