|
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: Implementation for wrapper for a menu |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <utf.h> |
|
20 #include <aknappui.h> |
|
21 #include <e32base.h> |
|
22 #include <coecntrl.h> |
|
23 #include <eikbtgpc.h> |
|
24 #include <eikcba.h> |
|
25 #include <barsread.h> |
|
26 #include <eiksoftkeyimage.h> |
|
27 #include <aknlayoutscalable_avkon.cdl.h> |
|
28 #include <layoutmetadata.cdl.h> |
|
29 |
|
30 #include <AknStatuspaneUtils.h> |
|
31 #include <AknUtils.h> |
|
32 #include <AknIconUtils.h> |
|
33 #include <eikspane.h> |
|
34 #include <AknSgcc.h> |
|
35 #include <aknview.h> |
|
36 |
|
37 // User includes |
|
38 #include "xnnodepluginif.h" |
|
39 #include "xntype.h" |
|
40 #include "xnproperty.h" |
|
41 |
|
42 #include "xndompropertyvalue.h" |
|
43 #include "xndomproperty.h" |
|
44 #include "xndomlist.h" |
|
45 |
|
46 #include "xnuienginepluginif.h" |
|
47 #include "xncomponent.h" |
|
48 |
|
49 #include "xnappuiadapter.h" |
|
50 #include "xnbitmap.h" |
|
51 #include "xnmenuadapter.h" |
|
52 #include "xncomponentnodeimpl.h" |
|
53 #include "c_xnutils.h" |
|
54 |
|
55 #undef _AVKON_CBA_LSC |
|
56 |
|
57 _LIT8( KWidgetSpecific, "Menu/WidgetSpecific" ); |
|
58 _LIT8( KViewSpecific, "Menu/ViewSpecific" ); |
|
59 _LIT8( KWidgetsHidden, "Menu/WidgetsHidden" ); |
|
60 _LIT8( KWidgetsShown, "Menu/WidgetsShown" ); |
|
61 _LIT8( KEditMode, "Menu/EditMode" ); |
|
62 _LIT8( KAlwaysShown, "Menu/AlwaysShown" ); |
|
63 _LIT8( KHsShowHelp, "hs_show_help" ); |
|
64 |
|
65 const TInt KMenuCommandFirst = 6000; |
|
66 const TInt KMenuCommandLast = 6199; |
|
67 const TInt KCBACommandFirst = 6200; |
|
68 const TInt KCBACommandSecond = 6201; |
|
69 const TInt KCBACommandMiddle = 6202; |
|
70 |
|
71 const TInt KXnMenuArrayGranularity = 6; |
|
72 const TInt KWideScreenWidth = 640; |
|
73 |
|
74 _LIT( KMskIconDialer, "#dialer"); |
|
75 |
|
76 using namespace XnPropertyNames; |
|
77 |
|
78 static CXnNodePluginIf* FindChildL(CXnNodePluginIf& aNode, |
|
79 const TDesC8& aType, const TDesC8& aTarget = KNullDesC8); |
|
80 |
|
81 class CXnSoftkeyItem: public CBase |
|
82 { |
|
83 public: |
|
84 CXnSoftkeyItem() |
|
85 : iNode( NULL ), |
|
86 iPosition( 0 ), |
|
87 iCommandId( 0 ), |
|
88 iLabel( NULL ), |
|
89 iBitmap( NULL ), |
|
90 iMask( NULL ), |
|
91 iImageOn( EFalse ), |
|
92 iInvertMask( EFalse ), |
|
93 iPreserveAspectRatio( EFalse ), |
|
94 iUpdateAppearance( ETrue ), |
|
95 iOwnBitmaps( ETrue ), |
|
96 iDefault( EFalse ) |
|
97 #if 0 // MSK icon change |
|
98 , |
|
99 iId( KAknsIIDQsnIconColors ), |
|
100 iBmpFile( NULL ), |
|
101 iBmp( 0 ), |
|
102 iBmpM( 0 ) |
|
103 #endif // MSK icon change |
|
104 { |
|
105 } |
|
106 |
|
107 ~CXnSoftkeyItem() |
|
108 { |
|
109 Reset(); |
|
110 } |
|
111 |
|
112 void Reset() |
|
113 { |
|
114 delete iLabel; |
|
115 iLabel = NULL; |
|
116 if ( iOwnBitmaps ) |
|
117 { |
|
118 delete iBitmap; |
|
119 iBitmap = NULL; |
|
120 delete iMask; |
|
121 iMask = NULL; |
|
122 } |
|
123 else |
|
124 { |
|
125 iBitmap = NULL; |
|
126 iMask = NULL; |
|
127 } |
|
128 |
|
129 iImageOn = EFalse; |
|
130 iInvertMask = EFalse; |
|
131 iPreserveAspectRatio = EFalse; |
|
132 #if 0 // MSK icon change |
|
133 delete iBmpFile; |
|
134 iBmpFile = NULL; |
|
135 #endif // MSK icon change |
|
136 } |
|
137 |
|
138 CXnNodePluginIf* iNode; |
|
139 TInt iPosition; |
|
140 TInt iCommandId; |
|
141 HBufC* iLabel; |
|
142 CFbsBitmap* iBitmap; |
|
143 CFbsBitmap* iMask; |
|
144 TBool iImageOn; |
|
145 TBool iInvertMask; |
|
146 TBool iPreserveAspectRatio; |
|
147 TBool iUpdateAppearance; |
|
148 TBool iOwnBitmaps; |
|
149 TBool iDefault; |
|
150 #if 0 // MSK icon change |
|
151 TAknsItemID iId; |
|
152 HBufC* iBmpFile; |
|
153 TInt32 iBmp; |
|
154 TInt32 iBmpM; |
|
155 #endif // MSK icon change |
|
156 }; |
|
157 |
|
158 |
|
159 inline TAknWindowComponentLayout DoCompose( TAknWindowComponentLayout aLine1, |
|
160 TAknWindowComponentLayout aLine2 ) |
|
161 { |
|
162 return TAknWindowComponentLayout::Compose( aLine1, aLine2 ); |
|
163 } |
|
164 |
|
165 inline TAknTextComponentLayout DoComposeText( TAknWindowComponentLayout aLine1, |
|
166 TAknTextComponentLayout aLine2 ) |
|
167 { |
|
168 return TAknWindowComponentLayout::ComposeText( aLine1, aLine2 ); |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // IsNodeVisibleL |
|
173 // |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 static TBool IsNodeVisibleL(CXnNodePluginIf& aNode) |
|
177 { |
|
178 CXnProperty* propVisibility = aNode.VisibilityL(); |
|
179 |
|
180 if( propVisibility ) |
|
181 { |
|
182 const TDesC8& visibility = propVisibility->StringValue(); |
|
183 |
|
184 if( visibility == XnPropertyNames::style::common::visibility::KHidden ) |
|
185 { |
|
186 return EFalse; |
|
187 } |
|
188 } |
|
189 |
|
190 CXnProperty* propDisplay = aNode.DisplayL(); |
|
191 |
|
192 if( propDisplay ) |
|
193 { |
|
194 const TDesC8& display = propDisplay->StringValue(); |
|
195 |
|
196 if( display == XnPropertyNames::style::common::display::KNone ) |
|
197 { |
|
198 return EFalse; |
|
199 } |
|
200 } |
|
201 |
|
202 CXnProperty* propDisabled = aNode.GetPropertyL( XnPropertyNames::common::KDisabled ); |
|
203 |
|
204 if( propDisabled ) |
|
205 { |
|
206 const TDesC8& disabled = propDisabled->StringValue(); |
|
207 |
|
208 if( disabled == XnPropertyNames::KTrue ) |
|
209 { |
|
210 return EFalse; |
|
211 } |
|
212 } |
|
213 |
|
214 return ETrue; |
|
215 } |
|
216 |
|
217 #ifdef _AVKON_CBA_LSC |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 // Calculate touch sensitive softkey area for Top button (landscape) |
|
221 // ----------------------------------------------------------------------------- |
|
222 static TRect SoftkeyRectTopTouch() |
|
223 { |
|
224 TRect screen; |
|
225 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
|
226 |
|
227 TAknLayoutRect layoutRect; |
|
228 |
|
229 TAknWindowComponentLayout rightAreaLayout( |
|
230 AknLayoutScalable_Avkon::area_side_right_pane( 0 ) ); |
|
231 |
|
232 |
|
233 layoutRect.LayoutRect( screen, DoCompose( rightAreaLayout, |
|
234 AknLayoutScalable_Avkon::sctrl_sk_top_pane() ).LayoutLine() ); |
|
235 TRect topSKRect( layoutRect.Rect() ); |
|
236 |
|
237 layoutRect.LayoutRect( topSKRect, |
|
238 AknLayoutScalable_Avkon::aid_touch_sctrl_top().LayoutLine() ); |
|
239 return layoutRect.Rect(); |
|
240 } |
|
241 |
|
242 // ----------------------------------------------------------------------------- |
|
243 // |
|
244 // Calculate touch sensitive softkey area for right button (portrait) |
|
245 // ----------------------------------------------------------------------------- |
|
246 static TRect SoftkeyRectRightTouch() |
|
247 { |
|
248 TRect screen; |
|
249 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
|
250 |
|
251 TAknLayoutRect layoutRect; |
|
252 |
|
253 TAknWindowComponentLayout bottomAreaLayout( |
|
254 AknLayoutScalable_Avkon::area_bottom_pane( 0 ) ); |
|
255 |
|
256 |
|
257 layoutRect.LayoutRect( screen, DoCompose( bottomAreaLayout, |
|
258 AknLayoutScalable_Avkon::control_bg_pane() ).LayoutLine() ); |
|
259 TRect rightSKRect( layoutRect.Rect() ); |
|
260 layoutRect.LayoutRect( |
|
261 rightSKRect, |
|
262 AknLayoutScalable_Avkon::aid_touch_ctrl_right().LayoutLine() ); |
|
263 return layoutRect.Rect(); |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 // Calculate touch sensitive softkey area for left button (portrait) |
|
269 // ----------------------------------------------------------------------------- |
|
270 static TRect SoftkeyRectLeftTouch() |
|
271 { |
|
272 TRect screen; |
|
273 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
|
274 |
|
275 TAknLayoutRect layoutRect; |
|
276 |
|
277 TAknWindowComponentLayout bottomAreaLayout( |
|
278 AknLayoutScalable_Avkon::area_bottom_pane( 0 ) ); |
|
279 |
|
280 |
|
281 layoutRect.LayoutRect( screen, DoCompose( bottomAreaLayout, |
|
282 AknLayoutScalable_Avkon::control_bg_pane() ).LayoutLine() ); |
|
283 TRect leftSKRect( layoutRect.Rect() ); |
|
284 layoutRect.LayoutRect( |
|
285 leftSKRect, |
|
286 AknLayoutScalable_Avkon::aid_touch_ctrl_left().LayoutLine() ); |
|
287 |
|
288 return layoutRect.Rect(); |
|
289 |
|
290 } |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // |
|
294 // Calculate touch sensitive softkey area for Bottom button (landscape) |
|
295 // ----------------------------------------------------------------------------- |
|
296 static TRect SoftkeyRectBottomTouch() |
|
297 { |
|
298 TRect screen; |
|
299 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
|
300 |
|
301 TAknLayoutRect layoutRect; |
|
302 |
|
303 TAknWindowComponentLayout rightAreaLayout( AknLayoutScalable_Avkon::area_side_right_pane( 0 ) ); |
|
304 |
|
305 layoutRect.LayoutRect( screen, DoCompose( rightAreaLayout, |
|
306 AknLayoutScalable_Avkon::sctrl_sk_bottom_pane() ).LayoutLine() ); |
|
307 TRect bottomSKRect( layoutRect.Rect() ); |
|
308 |
|
309 layoutRect.LayoutRect( bottomSKRect, |
|
310 AknLayoutScalable_Avkon::aid_touch_sctrl_bottom().LayoutLine() ); |
|
311 return layoutRect.Rect(); |
|
312 } |
|
313 #endif |
|
314 // ----------------------------------------------------------------------------- |
|
315 // |
|
316 // Calculate (whole) softkey area for Bottom button (landscape) |
|
317 // ----------------------------------------------------------------------------- |
|
318 static TBool HDLayoutActive() |
|
319 { |
|
320 TInt resourceId = 0; |
|
321 CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current(); |
|
322 |
|
323 if ( statusPane ) // Return the resource ID of app statuspane if it exists. |
|
324 { |
|
325 resourceId = statusPane->CurrentLayoutResId(); |
|
326 } |
|
327 else // If this app does not have statuspane, then we ask the layout from AknCapServer. |
|
328 { |
|
329 resourceId = CAknSgcClient::CurrentStatuspaneResource(); |
|
330 } |
|
331 |
|
332 TBool retVal = EFalse; |
|
333 |
|
334 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
335 { |
|
336 // Can be widescreen only in landscape orientation. |
|
337 retVal = ( resourceId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL || |
|
338 resourceId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE || |
|
339 resourceId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT || |
|
340 resourceId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT ); |
|
341 } |
|
342 |
|
343 return retVal; |
|
344 } |
|
345 |
|
346 // ----------------------------------------------------------------------------- |
|
347 // |
|
348 // Calculate softkey image graphics area for Bottom button (landscape) |
|
349 // ----------------------------------------------------------------------------- |
|
350 static TRect SoftkeyRectBottomGraphics() |
|
351 { |
|
352 TRect screen; |
|
353 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
|
354 |
|
355 TAknWindowComponentLayout rightAreaLayout( |
|
356 AknLayoutScalable_Avkon::area_side_right_pane( 0 ) ); |
|
357 |
|
358 TAknWindowComponentLayout bottomSKLayout( |
|
359 DoCompose( rightAreaLayout, |
|
360 AknLayoutScalable_Avkon::sctrl_sk_bottom_pane() ) ); |
|
361 |
|
362 // Calculate softkey rects. |
|
363 // Left (bottom in landscape) softkey layout. |
|
364 TAknLayoutRect leftSoftkeyLayoutRect; |
|
365 leftSoftkeyLayoutRect.LayoutRect( screen, |
|
366 bottomSKLayout.LayoutLine() ); |
|
367 TRect leftSoftKeyButtonRect( leftSoftkeyLayoutRect.Rect() ); |
|
368 |
|
369 // Calculate softkey image layout. |
|
370 // Left (bottom in landscape) softkey layout. |
|
371 TAknWindowLineLayout leftSoftkeyImageLayout( |
|
372 DoCompose( |
|
373 bottomSKLayout, |
|
374 AknLayoutScalable_Avkon::sctrl_sk_bottom_pane_g1() ).LayoutLine() ); |
|
375 |
|
376 |
|
377 TAknLayoutRect qgn_graf_sk_left; |
|
378 qgn_graf_sk_left.LayoutRect( screen, leftSoftkeyImageLayout ); |
|
379 |
|
380 return qgn_graf_sk_left.Rect(); |
|
381 } |
|
382 |
|
383 // ----------------------------------------------------------------------------- |
|
384 // |
|
385 // Calculate softkey image graphics area for Top button (landscape) |
|
386 // ----------------------------------------------------------------------------- |
|
387 static TRect SoftkeyRectTopGraphics() |
|
388 { |
|
389 TRect screen; |
|
390 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
|
391 |
|
392 TAknWindowComponentLayout rightAreaLayout( |
|
393 AknLayoutScalable_Avkon::area_side_right_pane( 0 ) ); |
|
394 |
|
395 TAknWindowComponentLayout topSKLayout( |
|
396 DoCompose( rightAreaLayout, |
|
397 AknLayoutScalable_Avkon::sctrl_sk_top_pane() ) ); |
|
398 |
|
399 // Calculate softkey rects. |
|
400 // Right (top in landscape) softkey layout. |
|
401 TAknLayoutRect rightSoftkeyLayoutRect; |
|
402 rightSoftkeyLayoutRect.LayoutRect( screen, |
|
403 topSKLayout.LayoutLine() ); |
|
404 TRect rightSoftKeyButtonRect( rightSoftkeyLayoutRect.Rect() ); |
|
405 |
|
406 // Left (bottom in landscape) softkey layout. |
|
407 // Right (top in landscape) softkey layout. |
|
408 TAknWindowLineLayout rightSoftkeyImageLayout( |
|
409 DoCompose( |
|
410 topSKLayout, |
|
411 AknLayoutScalable_Avkon::sctrl_sk_top_pane_g1() ).LayoutLine() ); |
|
412 |
|
413 TAknLayoutRect qgn_graf_sk_right; |
|
414 qgn_graf_sk_right.LayoutRect( screen, rightSoftkeyImageLayout ); |
|
415 return qgn_graf_sk_right.Rect(); |
|
416 } |
|
417 |
|
418 |
|
419 // ----------------------------------------------------------------------------- |
|
420 // SoftkeyRectL |
|
421 // Calculate soft key rect |
|
422 // ----------------------------------------------------------------------------- |
|
423 static TRect SoftkeyRectL( CEikButtonGroupContainer& aContainer, TInt aPos, TBool aImageOn ) |
|
424 { |
|
425 TRect rect; |
|
426 |
|
427 if( AknStatuspaneUtils::StaconPaneActive() ) |
|
428 { |
|
429 TInt variety( 0 ); |
|
430 |
|
431 if( AknStatuspaneUtils::StaconSoftKeysLeft() ) |
|
432 { |
|
433 variety = 1; |
|
434 } |
|
435 |
|
436 TRect parentRect( iAvkonAppUi->ApplicationRect() ); |
|
437 |
|
438 switch( aPos ) |
|
439 { |
|
440 case CEikButtonGroupContainer::ELeftSoftkeyPosition: |
|
441 { |
|
442 TAknWindowComponentLayout layout0( AknLayoutScalable_Avkon::area_bottom_pane( 2 ) ); |
|
443 TAknWindowComponentLayout layout1( AknLayoutScalable_Avkon::stacon_bottom_pane() ); |
|
444 |
|
445 // If clock is shown in stacon, cba area is smaller. |
|
446 TInt bottomCbaVariety( variety ); |
|
447 |
|
448 if( AknStatuspaneUtils::ExtendedStaconPaneActive() ) |
|
449 { |
|
450 bottomCbaVariety += 2; |
|
451 } |
|
452 |
|
453 TAknWindowComponentLayout layout2( AknLayoutScalable_Avkon::control_bottom_pane_stacon( bottomCbaVariety ) ); |
|
454 |
|
455 if( aImageOn ) |
|
456 { |
|
457 // Icon layout |
|
458 TAknWindowComponentLayout iconLayout( AknLayoutScalable_Avkon::control_bottom_pane_stacon_g1() ); |
|
459 |
|
460 TAknWindowComponentLayout lskIconLayout( DoCompose( layout0, |
|
461 DoCompose( layout1, DoCompose( layout2, iconLayout ) ) ) ); |
|
462 |
|
463 TAknWindowLineLayout lskIcon( lskIconLayout.LayoutLine() ); |
|
464 |
|
465 TAknLayoutRect qgn_icon_lsk; |
|
466 |
|
467 qgn_icon_lsk.LayoutRect( parentRect, lskIcon ); |
|
468 |
|
469 rect = qgn_icon_lsk.Rect(); |
|
470 } |
|
471 else |
|
472 { |
|
473 // Text layout |
|
474 TAknTextComponentLayout textLayout( AknLayoutScalable_Avkon::control_bottom_pane_stacon_t1( variety ) ); |
|
475 |
|
476 TAknTextComponentLayout lskTextLayout( DoComposeText( layout0, |
|
477 DoComposeText( layout1, DoComposeText( layout2, textLayout ) ) ) ); |
|
478 |
|
479 TAknTextLineLayout lskText( lskTextLayout.LayoutLine() ); |
|
480 |
|
481 TAknLayoutText qgn_text_lsk; |
|
482 |
|
483 qgn_text_lsk.LayoutText( parentRect, lskText ); |
|
484 |
|
485 rect = qgn_text_lsk.TextRect(); |
|
486 } |
|
487 } |
|
488 break; |
|
489 case CEikButtonGroupContainer::ERightSoftkeyPosition: |
|
490 { |
|
491 TAknWindowComponentLayout layout0( AknLayoutScalable_Avkon::area_top_pane( 2 ) ); |
|
492 TAknWindowComponentLayout layout1( AknLayoutScalable_Avkon::stacon_top_pane() ); |
|
493 |
|
494 TInt topCbaVariety( variety ); |
|
495 |
|
496 if( AknStatuspaneUtils::ExtendedStaconPaneActive() ) |
|
497 { |
|
498 topCbaVariety += 4; |
|
499 } |
|
500 |
|
501 TAknWindowComponentLayout layout2( AknLayoutScalable_Avkon::control_top_pane_stacon( topCbaVariety ) ); |
|
502 |
|
503 if( aImageOn ) |
|
504 { |
|
505 // Icon layout |
|
506 TAknWindowComponentLayout iconLayout( AknLayoutScalable_Avkon::control_top_pane_stacon_g1() ); |
|
507 |
|
508 TAknWindowComponentLayout rskIconLayout( DoCompose( layout0, |
|
509 DoCompose( layout1, DoCompose( layout2, iconLayout ) ) ) ); |
|
510 |
|
511 TAknWindowLineLayout rskIcon( rskIconLayout.LayoutLine() ); |
|
512 |
|
513 TAknLayoutRect qgn_icon_rsk; |
|
514 |
|
515 qgn_icon_rsk.LayoutRect( parentRect, rskIcon ); |
|
516 |
|
517 rect = qgn_icon_rsk.Rect(); |
|
518 } |
|
519 else |
|
520 { |
|
521 // Text layout |
|
522 TAknTextComponentLayout textLayout( AknLayoutScalable_Avkon::control_top_pane_stacon_t1( variety ) ); |
|
523 |
|
524 TAknTextComponentLayout rskTextLayout( DoComposeText( layout0, |
|
525 DoComposeText( layout1, DoComposeText( layout2, textLayout ) ) ) ); |
|
526 |
|
527 TAknTextLineLayout rskText( rskTextLayout.LayoutLine() ); |
|
528 |
|
529 TAknLayoutText qgn_text_rsk; |
|
530 |
|
531 qgn_text_rsk.LayoutText( parentRect, rskText ); |
|
532 |
|
533 rect = qgn_text_rsk.TextRect(); |
|
534 } |
|
535 } |
|
536 break; |
|
537 default: |
|
538 User::Leave( KErrNotSupported ); |
|
539 break; |
|
540 |
|
541 } |
|
542 } |
|
543 else |
|
544 { |
|
545 TInt textVariety( 0 ); |
|
546 TInt graphVariety( 0 ); |
|
547 |
|
548 TBool mskEnabled( AknLayoutUtils::MSKEnabled() && Layout_Meta_Data::IsMSKEnabled() ); |
|
549 |
|
550 if ( mskEnabled ) |
|
551 { |
|
552 textVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 3; |
|
553 graphVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 4; |
|
554 } |
|
555 else |
|
556 { |
|
557 textVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 0; |
|
558 graphVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 4; |
|
559 } |
|
560 |
|
561 CEikCba* cba( static_cast< CEikCba* >( aContainer.ButtonGroup() ) ); |
|
562 |
|
563 TRect parentRect( cba->Rect() ); |
|
564 |
|
565 switch( aPos ) |
|
566 { |
|
567 case CEikButtonGroupContainer::ELeftSoftkeyPosition: |
|
568 { |
|
569 if( aImageOn ) |
|
570 { |
|
571 if ( HDLayoutActive() && |
|
572 AKN_LAYOUT_WINDOW_screen.iW == KWideScreenWidth ) |
|
573 { |
|
574 rect = SoftkeyRectBottomGraphics(); |
|
575 } |
|
576 else |
|
577 { |
|
578 |
|
579 TAknLayoutRect qgn_icon_lsk; |
|
580 |
|
581 qgn_icon_lsk.LayoutRect( parentRect, |
|
582 AknLayoutScalable_Avkon::control_pane_g1( graphVariety ).LayoutLine() ); |
|
583 |
|
584 rect = qgn_icon_lsk.Rect(); |
|
585 } |
|
586 } |
|
587 else |
|
588 { |
|
589 TAknLayoutText qgn_text_lsk; |
|
590 |
|
591 qgn_text_lsk.LayoutText( parentRect, |
|
592 AknLayoutScalable_Avkon::control_pane_t1( textVariety ).LayoutLine() ); |
|
593 |
|
594 rect = qgn_text_lsk.TextRect(); |
|
595 } |
|
596 } |
|
597 break; |
|
598 case CEikButtonGroupContainer::ERightSoftkeyPosition: |
|
599 { |
|
600 if( aImageOn ) |
|
601 { |
|
602 if ( HDLayoutActive() && |
|
603 AKN_LAYOUT_WINDOW_screen.iW == KWideScreenWidth ) |
|
604 { |
|
605 rect = SoftkeyRectTopGraphics(); |
|
606 } |
|
607 else |
|
608 { |
|
609 TAknLayoutRect qgn_icon_rsk; |
|
610 |
|
611 qgn_icon_rsk.LayoutRect( parentRect, |
|
612 AknLayoutScalable_Avkon::control_pane_g2( graphVariety ).LayoutLine() ); |
|
613 |
|
614 rect = qgn_icon_rsk.Rect(); |
|
615 } |
|
616 } |
|
617 else |
|
618 { |
|
619 TAknLayoutText qgn_text_rsk; |
|
620 |
|
621 qgn_text_rsk.LayoutText( parentRect, |
|
622 AknLayoutScalable_Avkon::control_pane_t2( textVariety ).LayoutLine() ); |
|
623 |
|
624 rect = qgn_text_rsk.TextRect(); |
|
625 } |
|
626 } |
|
627 break; |
|
628 case CEikButtonGroupContainer::EMiddleSoftkeyPosition: |
|
629 { |
|
630 if( !mskEnabled || aImageOn ) |
|
631 { |
|
632 // No msk, or asking image size for msk |
|
633 User::Leave( KErrNotSupported ); |
|
634 } |
|
635 else |
|
636 { |
|
637 TAknLayoutText qgn_text_msk; |
|
638 |
|
639 qgn_text_msk.LayoutText( parentRect, |
|
640 AknLayoutScalable_Avkon::control_pane_t3( textVariety ).LayoutLine() ); |
|
641 |
|
642 rect = qgn_text_msk.TextRect(); |
|
643 } |
|
644 } |
|
645 break; |
|
646 default: |
|
647 User::Leave( KErrNotFound ); |
|
648 break; |
|
649 } |
|
650 } |
|
651 |
|
652 return rect; |
|
653 } |
|
654 // ----------------------------------------------------------------------------- |
|
655 // Get softkey image rect |
|
656 // ----------------------------------------------------------------------------- |
|
657 static TRect SoftkeyImageRect(CEikButtonGroupContainer& aContainer, TInt aPosition) |
|
658 { |
|
659 TRect ret; |
|
660 #ifndef _AVKON_CBA_LSC |
|
661 TAknLayoutRect softkeyImg; |
|
662 CEikCba* cba( static_cast< CEikCba* >( aContainer.ButtonGroup() ) ); |
|
663 TRect parentRect( cba->Rect() ); |
|
664 |
|
665 if(Layout_Meta_Data::IsLandscapeOrientation()) |
|
666 { |
|
667 if(aPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition) |
|
668 { |
|
669 TAknWindowComponentLayout wcl = AknLayoutScalable_Avkon::control_pane_g1(2); |
|
670 softkeyImg.LayoutRect(parentRect,wcl.LayoutLine() ); |
|
671 } |
|
672 else if(aPosition == CEikButtonGroupContainer::ERightSoftkeyPosition) |
|
673 { |
|
674 TAknWindowComponentLayout wcl = AknLayoutScalable_Avkon::control_pane_g2(2); |
|
675 softkeyImg.LayoutRect(parentRect,wcl.LayoutLine() ); |
|
676 } |
|
677 } |
|
678 else |
|
679 { |
|
680 if(aPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition) |
|
681 { |
|
682 TAknWindowComponentLayout wcl = AknLayoutScalable_Avkon::control_pane_g1(4); |
|
683 softkeyImg.LayoutRect(parentRect,wcl.LayoutLine() ); |
|
684 } |
|
685 else if(aPosition == CEikButtonGroupContainer::ERightSoftkeyPosition) |
|
686 { |
|
687 TAknWindowComponentLayout wcl = AknLayoutScalable_Avkon::control_pane_g2(4); |
|
688 softkeyImg.LayoutRect(parentRect,wcl.LayoutLine() ); |
|
689 |
|
690 } |
|
691 } |
|
692 ret = softkeyImg.Rect(); |
|
693 #else |
|
694 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
695 { |
|
696 if(aPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition) |
|
697 { |
|
698 ret = SoftkeyRectTopTouch(); |
|
699 } |
|
700 else if(aPosition == CEikButtonGroupContainer::ERightSoftkeyPosition) |
|
701 { |
|
702 ret = SoftkeyRectBottomTouch(); |
|
703 } |
|
704 } |
|
705 else // portrait |
|
706 { |
|
707 if(aPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition) |
|
708 { |
|
709 ret = SoftkeyRectLeftTouch(); |
|
710 } |
|
711 else if(aPosition == CEikButtonGroupContainer::ERightSoftkeyPosition) |
|
712 { |
|
713 ret = SoftkeyRectRightTouch(); |
|
714 } |
|
715 } |
|
716 #endif |
|
717 return ret; |
|
718 } |
|
719 |
|
720 // ----------------------------------------------------------------------------- |
|
721 // CopyBitmapLC |
|
722 // Copy bitmap |
|
723 // ----------------------------------------------------------------------------- |
|
724 static CFbsBitmap* CopyBitmapL( const CFbsBitmap* aBitmap ) |
|
725 { |
|
726 CFbsBitmap* copy = new ( ELeave ) CFbsBitmap; |
|
727 CleanupStack::PushL( copy ); |
|
728 |
|
729 copy->Create( aBitmap->SizeInPixels(), aBitmap->DisplayMode() ); |
|
730 |
|
731 CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL( copy ); |
|
732 CleanupStack::PushL( dev ); |
|
733 |
|
734 CFbsBitGc* gc = CFbsBitGc::NewL(); |
|
735 CleanupStack::PushL( gc ); |
|
736 |
|
737 gc->Activate( dev ); |
|
738 gc->BitBlt( TPoint( 0, 0 ), aBitmap ); |
|
739 |
|
740 CleanupStack::PopAndDestroy( 2 ); // gc, dev |
|
741 |
|
742 CleanupStack::Pop( copy ); |
|
743 |
|
744 return copy; |
|
745 } |
|
746 |
|
747 // ----------------------------------------------------------------------------- |
|
748 // MenuTypeL |
|
749 // This is used to deactivate "active applications" menu item using the theme |
|
750 // Get the "menutype" property from menubar and check if it has value |
|
751 // "menuoptions" (default) or "menuoptionsnotaskswapper" and return |
|
752 // correct menu type. |
|
753 // ----------------------------------------------------------------------------- |
|
754 static CEikMenuBar::TMenuType MenuTypeL( CXnNodePluginIf& aMenubarNode ) |
|
755 { |
|
756 CEikMenuBar::TMenuType menuType( CEikMenuBar::EMenuOptions ); |
|
757 |
|
758 CXnProperty* property( aMenubarNode.GetPropertyL( XnPropertyNames::menu::KMenuType ) ); |
|
759 |
|
760 if( property ) |
|
761 { |
|
762 if( property->StringValue() == XnPropertyNames::menu::menutype::KMenuOptionsNoTaskSwapper ) |
|
763 { |
|
764 menuType = CEikMenuBar::EMenuOptionsNoTaskSwapper; |
|
765 } |
|
766 } |
|
767 |
|
768 return menuType; |
|
769 } |
|
770 |
|
771 // ----------------------------------------------------------------------------- |
|
772 // FindChildL |
|
773 // |
|
774 // ----------------------------------------------------------------------------- |
|
775 static CXnNodePluginIf* FindChildL( CXnNodePluginIf& aNode, |
|
776 const TDesC8& aType, const TDesC8& aTarget ) |
|
777 { |
|
778 RPointerArray<CXnNodePluginIf> children( aNode.ChildrenL() ); |
|
779 CleanupClosePushL( children ); |
|
780 |
|
781 CXnNodePluginIf* retval( NULL ); |
|
782 |
|
783 for( TInt i = 0; i < children.Count(); i++ ) |
|
784 { |
|
785 CXnNodePluginIf* child( children[i] ); |
|
786 |
|
787 if( child->Type()->Type() == aType ) |
|
788 { |
|
789 if( aTarget == KNullDesC8 ) |
|
790 { |
|
791 retval = child; |
|
792 break; |
|
793 } |
|
794 else |
|
795 { |
|
796 CXnProperty* target( child->GetPropertyL( KXnTarget ) ); |
|
797 |
|
798 if( target && target->StringValue() == aTarget ) |
|
799 { |
|
800 retval = child; |
|
801 break; |
|
802 } |
|
803 |
|
804 CXnProperty* source( child->GetPropertyL( KXnSource ) ); |
|
805 |
|
806 if( source && source->StringValue() == aTarget ) |
|
807 { |
|
808 retval = child; |
|
809 break; |
|
810 } |
|
811 } |
|
812 } |
|
813 } |
|
814 |
|
815 CleanupStack::PopAndDestroy( &children ); |
|
816 |
|
817 return retval; |
|
818 } |
|
819 |
|
820 // ============================ MEMBER FUNCTIONS =============================== |
|
821 |
|
822 // ----------------------------------------------------------------------------- |
|
823 // CXnMenuAdapter::NewL |
|
824 // Symbian static 1st phase constructor |
|
825 // ----------------------------------------------------------------------------- |
|
826 // |
|
827 CXnMenuAdapter* CXnMenuAdapter::NewL( CXnControlAdapter* aParent, CXnNodePluginIf& aNode ) |
|
828 { |
|
829 CXnMenuAdapter* self = new( ELeave ) CXnMenuAdapter; |
|
830 |
|
831 CleanupStack::PushL( self ); |
|
832 self->ConstructL( aParent, aNode ); |
|
833 CleanupStack::Pop( self ); |
|
834 |
|
835 return self; |
|
836 } |
|
837 |
|
838 // ----------------------------------------------------------------------------- |
|
839 // CXnMenuAdapter::ConstructL |
|
840 // Symbian 2nd phase constructor can leave. |
|
841 // ----------------------------------------------------------------------------- |
|
842 // |
|
843 void CXnMenuAdapter::ConstructL( CXnControlAdapter* /*aParent*/, CXnNodePluginIf& aNode ) |
|
844 { |
|
845 iRootNode = &aNode; |
|
846 |
|
847 CXnControlAdapter::ConstructL( aNode ); |
|
848 |
|
849 iUiEngine = iRootNode->UiEngineL(); |
|
850 |
|
851 CAknAppUi* appui( iAvkonAppUi ); |
|
852 |
|
853 iPreviousMenuPaneId = appui->StatusPane()->CurrentLayoutResId(); |
|
854 |
|
855 CEikMenuBar* current( iEikonEnv->AppUiFactory()->SwapMenuBar( NULL ) ); |
|
856 appui->RemoveFromStack( current ); |
|
857 |
|
858 delete current; |
|
859 current = NULL; |
|
860 |
|
861 InitSoftkeyItemsL(); |
|
862 } |
|
863 |
|
864 // ----------------------------------------------------------------------------- |
|
865 // CXnMenuAdapter::CXnMenuAdapter |
|
866 // C++ default constructor |
|
867 // ----------------------------------------------------------------------------- |
|
868 // |
|
869 CXnMenuAdapter::CXnMenuAdapter(): |
|
870 iMenuItems( KXnMenuArrayGranularity ), |
|
871 iIdCounter( KMenuCommandFirst ) |
|
872 { |
|
873 } |
|
874 |
|
875 // ----------------------------------------------------------------------------- |
|
876 // CXnMenuAdapter::~CXnMenuAdapter |
|
877 // C++ destructor |
|
878 // ----------------------------------------------------------------------------- |
|
879 // |
|
880 CXnMenuAdapter::~CXnMenuAdapter() |
|
881 { |
|
882 StopDisplayingMenu(); |
|
883 |
|
884 if ( iAvkonAppUi ) |
|
885 { |
|
886 iAvkonAppUi->RemoveFromStack( iMenuBar ); |
|
887 } |
|
888 |
|
889 if ( iMenuBar ) |
|
890 { |
|
891 delete iMenuBar; |
|
892 } |
|
893 |
|
894 iSoftkeyItems.ResetAndDestroy(); |
|
895 iMenuItems.Reset(); |
|
896 } |
|
897 |
|
898 // ----------------------------------------------------------------------------- |
|
899 // Create scaled bitmap from source bitmap. |
|
900 // ----------------------------------------------------------------------------- |
|
901 // |
|
902 void CreateScaledBitmapL( |
|
903 const TRect& aRect, |
|
904 CFbsBitmap*& aTrgBitmap, |
|
905 CFbsBitmap* aSrcBitmap, |
|
906 TBool aPreserveAspectRatio ) |
|
907 { |
|
908 TRect destRect = aRect; |
|
909 |
|
910 if( aPreserveAspectRatio ) |
|
911 { |
|
912 // Calculate the bitmap image dimensions so that it uses maximum space |
|
913 // of the given rectangle and maintains aspect ratio. |
|
914 TInt srcHeight = aSrcBitmap->SizeInPixels().iHeight; |
|
915 TInt srcWidth = aSrcBitmap->SizeInPixels().iWidth; |
|
916 TReal scaleRatio( 1 ); //no scale as defaul |
|
917 |
|
918 // If any dimension is 0, then we do not bother to scale |
|
919 if( aRect.Width() > 0 && aRect.Height() > 0 ) |
|
920 { |
|
921 TReal xRatio = ( (TReal )srcWidth / ( TReal )aRect.Width() ); |
|
922 TReal yRatio = ( ( TReal )srcHeight / ( TReal )aRect.Height() ); |
|
923 |
|
924 //Find out appropriate scaling factor |
|
925 xRatio > yRatio ? ( scaleRatio = xRatio ) : ( scaleRatio = yRatio ); |
|
926 } |
|
927 |
|
928 // Scale the size for target bitmap |
|
929 destRect.SetHeight( srcHeight / scaleRatio ); |
|
930 destRect.SetWidth( srcWidth / scaleRatio ); |
|
931 } |
|
932 |
|
933 aTrgBitmap = new ( ELeave ) CFbsBitmap; |
|
934 CleanupStack::PushL( aTrgBitmap ); |
|
935 |
|
936 // It is allowed to create zero height or width bitmap. |
|
937 TInt err( aTrgBitmap->Create( destRect.Size(), aSrcBitmap->DisplayMode() ) ); |
|
938 |
|
939 if( err == KErrNone ) |
|
940 { |
|
941 CXnUtils::ScaleBitmapL( destRect, aTrgBitmap, aSrcBitmap ); |
|
942 } |
|
943 |
|
944 // we do not own the bitmap so just Pop. |
|
945 CleanupStack::Pop( aTrgBitmap ); |
|
946 } |
|
947 |
|
948 // ----------------------------------------------------------------------------- |
|
949 // CXnMenuAdapter::PrepareSoftkeyImageL |
|
950 // Make a copy of originals and scale them to right size. |
|
951 // Finally place the scaled icon to right position of drawing area. |
|
952 // ----------------------------------------------------------------------------- |
|
953 CEikImage* CXnMenuAdapter::PrepareSoftkeyImageL( const CXnSoftkeyItem& aItem, const TSize& aSize ) |
|
954 { |
|
955 CFbsBitmap* bitmap( NULL ); |
|
956 CFbsBitmap* mask( NULL ); |
|
957 |
|
958 // Start from bitmap |
|
959 CFbsBitmap* source( aItem.iBitmap ); |
|
960 |
|
961 TInt count( 0 ); |
|
962 |
|
963 // Go through bitmap and mask |
|
964 for( TInt i = 0; i < 2; i++ ) |
|
965 { |
|
966 if( !source ) |
|
967 { |
|
968 source = aItem.iMask; |
|
969 continue; |
|
970 } |
|
971 |
|
972 CFbsBitmap* scaled( NULL ); |
|
973 |
|
974 TScaleMode mode( aItem.iPreserveAspectRatio ? EAspectRatioPreserved : EAspectRatioNotPreserved ); |
|
975 |
|
976 if( AknIconUtils::IsMifIcon( source ) ) |
|
977 { |
|
978 AknIconUtils::SetSize( source, aSize, mode ); |
|
979 |
|
980 scaled = CopyBitmapL( source ); |
|
981 } |
|
982 else |
|
983 { |
|
984 CreateScaledBitmapL( TRect( aSize ), scaled, source, mode == EAspectRatioPreserved ); |
|
985 } |
|
986 |
|
987 CleanupStack::PushL( scaled ); |
|
988 |
|
989 if( !aItem.iPreserveAspectRatio ) |
|
990 { |
|
991 count++; |
|
992 |
|
993 if( i == 0 ) |
|
994 { |
|
995 bitmap = scaled; |
|
996 } |
|
997 else |
|
998 { |
|
999 mask = scaled; |
|
1000 } |
|
1001 } |
|
1002 else |
|
1003 { |
|
1004 CFbsBitmap* target = new ( ELeave ) CFbsBitmap; |
|
1005 CleanupStack::PushL( target ); |
|
1006 |
|
1007 // Target is size of whole draw area |
|
1008 User::LeaveIfError( target->Create( aSize, source->DisplayMode() ) ); |
|
1009 |
|
1010 CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL( target ); |
|
1011 CleanupStack::PushL( dev ); |
|
1012 |
|
1013 CFbsBitGc* gc = CFbsBitGc::NewL(); |
|
1014 CleanupStack::PushL( gc ); |
|
1015 |
|
1016 gc->Activate( dev ); |
|
1017 |
|
1018 gc->SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
1019 gc->SetPenStyle( CGraphicsContext::ENullPen ); |
|
1020 |
|
1021 if( aItem.iInvertMask ) |
|
1022 { |
|
1023 // White, with full transparent alpha channel |
|
1024 gc->SetBrushColor( TRgb( 0x00FFFFFF, 0 ) ); |
|
1025 } |
|
1026 else |
|
1027 { |
|
1028 // Black, with full transparent alpha channel |
|
1029 gc->SetBrushColor( TRgb( 0x00000000, 0 ) ); |
|
1030 } |
|
1031 |
|
1032 // Make whole target area transparent |
|
1033 gc->DrawRect( TRect( aSize ) ); |
|
1034 |
|
1035 TPoint iconPos; |
|
1036 |
|
1037 switch( AknLayoutUtils::CbaLocation() ) |
|
1038 { |
|
1039 case AknLayoutUtils::EAknCbaLocationBottom: |
|
1040 // Rsk must be moved to right, lsk is in correct place by default |
|
1041 if ( aItem.iPosition != CEikButtonGroupContainer::ELeftSoftkeyPosition ) |
|
1042 { |
|
1043 iconPos.iX = aSize.iWidth - scaled->SizeInPixels().iWidth; |
|
1044 } |
|
1045 break; |
|
1046 case AknLayoutUtils::EAknCbaLocationRight: |
|
1047 // Rsk and lsk must be moved to right |
|
1048 iconPos.iX = aSize.iWidth - scaled->SizeInPixels().iWidth; |
|
1049 break; |
|
1050 case AknLayoutUtils::EAknCbaLocationLeft: |
|
1051 // Already in correct position |
|
1052 default: |
|
1053 break; |
|
1054 } |
|
1055 |
|
1056 // Align horizontally to center |
|
1057 iconPos.iY = iconPos.iX ? 0 : ( ( aSize.iHeight - scaled->SizeInPixels().iHeight ) / 2 ); |
|
1058 |
|
1059 gc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
1060 |
|
1061 // Blit image to correct position |
|
1062 gc->BitBlt( iconPos, scaled ); |
|
1063 |
|
1064 CleanupStack::PopAndDestroy( 2, dev ); |
|
1065 |
|
1066 CleanupStack::Pop( target ); |
|
1067 |
|
1068 CleanupStack::PopAndDestroy( scaled ); |
|
1069 |
|
1070 CleanupStack::PushL( target ); |
|
1071 count++; |
|
1072 |
|
1073 if( i == 0 ) |
|
1074 { |
|
1075 bitmap = target; |
|
1076 } |
|
1077 else |
|
1078 { |
|
1079 mask = target; |
|
1080 } |
|
1081 |
|
1082 |
|
1083 } |
|
1084 |
|
1085 // Go with mask next |
|
1086 source = aItem.iMask; |
|
1087 } |
|
1088 |
|
1089 // Takes ownership of scaled bitmap and mask |
|
1090 CEikImage* image = new ( ELeave ) CEikImage; |
|
1091 |
|
1092 image->SetPictureOwnedExternally( EFalse ); |
|
1093 image->SetPicture( bitmap, mask ); |
|
1094 |
|
1095 CleanupStack::Pop( count ); |
|
1096 |
|
1097 return image; |
|
1098 } |
|
1099 |
|
1100 // ----------------------------------------------------------------------------- |
|
1101 // CXnMenuAdapter::SetSoftkeyAppearanceL |
|
1102 // |
|
1103 // ----------------------------------------------------------------------------- |
|
1104 // |
|
1105 void CXnMenuAdapter::SetSoftkeyAppearanceL( CXnSoftkeyItem& aItem ) |
|
1106 { |
|
1107 #if 0 // MSK icon change |
|
1108 if( IsNodeVisibleL( *aItem.iNode) ) |
|
1109 { |
|
1110 if( aItem.iImageOn ) |
|
1111 { |
|
1112 ChangeSoftkeyImageL( aItem ); |
|
1113 } |
|
1114 else if( aItem.iLabel )// change label |
|
1115 { |
|
1116 TBool left( EFalse ); |
|
1117 if ( aItem.iPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition ) |
|
1118 { |
|
1119 left = ETrue; |
|
1120 EikSoftkeyImage::SetLabel( iContainer,left ); |
|
1121 } |
|
1122 else if ( aItem.iPosition == CEikButtonGroupContainer::ERightSoftkeyPosition ) |
|
1123 { |
|
1124 left = EFalse; |
|
1125 EikSoftkeyImage::SetLabel( iContainer,left ); |
|
1126 } |
|
1127 |
|
1128 iContainer->SetCommandL( aItem.iPosition, aItem.iCommandId, *aItem.iLabel ); |
|
1129 } |
|
1130 } |
|
1131 } |
|
1132 #else // MSK icon change |
|
1133 if( IsNodeVisibleL( *aItem.iNode) ) |
|
1134 { |
|
1135 if( aItem.iPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition |
|
1136 || aItem.iPosition == CEikButtonGroupContainer::ERightSoftkeyPosition) |
|
1137 { |
|
1138 if(aItem.iImageOn) |
|
1139 { |
|
1140 ChangeSoftkeyImageL(aItem); |
|
1141 } |
|
1142 else if(aItem.iLabel)// change label |
|
1143 { |
|
1144 TBool left(EFalse); |
|
1145 if(aItem.iPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition) |
|
1146 { |
|
1147 left = ETrue; |
|
1148 } |
|
1149 EikSoftkeyImage::SetLabel( iContainer,left ); |
|
1150 iContainer->SetCommandL( aItem.iPosition, aItem.iCommandId, *aItem.iLabel ); |
|
1151 |
|
1152 } |
|
1153 |
|
1154 } |
|
1155 else if(aItem.iPosition == CEikButtonGroupContainer::EMiddleSoftkeyPosition) |
|
1156 { |
|
1157 if( aItem.iLabel ) |
|
1158 { |
|
1159 // Msk will have predefined image based on command id |
|
1160 if( *aItem.iLabel == menu::KMSKDotImage16 ) |
|
1161 { |
|
1162 aItem.iCommandId = KCBACommandFirst; |
|
1163 } |
|
1164 else if(*aItem.iLabel == KMskIconDialer) |
|
1165 { |
|
1166 #ifndef _AVKON_CBA_LSC |
|
1167 aItem.iCommandId = EAknSoftkeyDialler; |
|
1168 #endif |
|
1169 } |
|
1170 else |
|
1171 { |
|
1172 aItem.iCommandId = KCBACommandMiddle; |
|
1173 } |
|
1174 iContainer->SetCommandL( aItem.iPosition, aItem.iCommandId, *aItem.iLabel ); |
|
1175 } |
|
1176 } |
|
1177 } |
|
1178 } |
|
1179 #endif // MSK icon change |
|
1180 |
|
1181 // ----------------------------------------------------------------------------- |
|
1182 // CXnMenuAdapter::InitSoftkeyItemsL |
|
1183 // |
|
1184 // ----------------------------------------------------------------------------- |
|
1185 // |
|
1186 void CXnMenuAdapter::InitSoftkeyItemsL() |
|
1187 { |
|
1188 // No layout calulations needed |
|
1189 iRootNode->SetLayoutCapable( EFalse ); |
|
1190 |
|
1191 // create softkeyitems to hold data |
|
1192 |
|
1193 RPointerArray< CXnNodePluginIf > children( iRootNode->ChildrenL() ); |
|
1194 CleanupClosePushL( children ); |
|
1195 CXnSoftkeyItem* item(0); |
|
1196 for(TInt i=0;i<children.Count();++i) |
|
1197 { |
|
1198 if(children[i]->Type()->Type() == XnPropertyNames::softkey::KNodeName) |
|
1199 { |
|
1200 item = AppendSoftkeyItemL(children[i]); |
|
1201 if(item) |
|
1202 { |
|
1203 item->iDefault = ETrue; |
|
1204 } |
|
1205 } |
|
1206 } |
|
1207 CleanupStack::PopAndDestroy( &children ); |
|
1208 |
|
1209 } |
|
1210 |
|
1211 // ----------------------------------------------------------------------------- |
|
1212 // CXnMenuAdapter::InitSoftkeyItemL |
|
1213 // |
|
1214 // ----------------------------------------------------------------------------- |
|
1215 // |
|
1216 void CXnMenuAdapter::InitSoftkeyItemImageL( CXnSoftkeyItem& aItem) |
|
1217 { |
|
1218 CXnNodePluginIf* node( aItem.iNode ); |
|
1219 |
|
1220 // No layout calulations needed |
|
1221 node->SetLayoutCapable( EFalse ); |
|
1222 |
|
1223 #if 0 // MSK icon change |
|
1224 if ( aItem.iPosition == CEikButtonGroupContainer::EMiddleSoftkeyPosition ) |
|
1225 { |
|
1226 aItem.iImageOn = ETrue; |
|
1227 return; |
|
1228 } |
|
1229 #endif // MSK icon change |
|
1230 |
|
1231 CXnProperty* pathProp( node->PathL() ); |
|
1232 if( pathProp ) |
|
1233 { |
|
1234 HBufC* bitmapPath( NULL ); |
|
1235 HBufC* maskPath( NULL ); |
|
1236 |
|
1237 bitmapPath = pathProp->StringValueL(); |
|
1238 CleanupStack::PushL( bitmapPath ); |
|
1239 TInt count( 1 ); |
|
1240 |
|
1241 CXnProperty* maskProp( node->MaskPathL() ); |
|
1242 |
|
1243 if( maskProp ) |
|
1244 { |
|
1245 maskPath = maskProp->StringValueL(); |
|
1246 CleanupStack::PushL( maskPath ); |
|
1247 count++; |
|
1248 } |
|
1249 |
|
1250 CFbsBitmap* bitmap( NULL ); |
|
1251 CFbsBitmap* mask( NULL ); |
|
1252 |
|
1253 // Call base class to get bitmap and mask |
|
1254 GetBitmapAndMask( bitmapPath ? *bitmapPath : KNullDesC(), |
|
1255 maskPath ? *maskPath : KNullDesC(), |
|
1256 bitmap, mask ); |
|
1257 |
|
1258 aItem.iImageOn = ETrue; |
|
1259 aItem.iBitmap = bitmap; |
|
1260 aItem.iMask = mask; |
|
1261 |
|
1262 CXnProperty* maskInvertedProp( node->GetPropertyL( XnPropertyNames::image::KMaskInverted ) ); |
|
1263 |
|
1264 if( maskInvertedProp ) |
|
1265 { |
|
1266 if( maskInvertedProp->StringValue() == XnPropertyNames::KTrue ) |
|
1267 { |
|
1268 aItem.iInvertMask = ETrue; |
|
1269 } |
|
1270 } |
|
1271 |
|
1272 CXnProperty* aspectRatioProp( node->GetPropertyL( XnPropertyNames::image::KS60AspectRatio ) ); |
|
1273 |
|
1274 if( aspectRatioProp ) |
|
1275 { |
|
1276 if( aspectRatioProp->StringValue() == XnPropertyNames::image::KPreserve ) |
|
1277 { |
|
1278 aItem.iPreserveAspectRatio = ETrue; |
|
1279 } |
|
1280 } |
|
1281 |
|
1282 CleanupStack::PopAndDestroy( count ); // path and/or mask |
|
1283 } |
|
1284 } |
|
1285 |
|
1286 // ----------------------------------------------------------------------------- |
|
1287 // CXnMenuAdapter::IsMskAvailable |
|
1288 // |
|
1289 // ----------------------------------------------------------------------------- |
|
1290 // |
|
1291 TBool CXnMenuAdapter::IsMskAvailable() |
|
1292 { |
|
1293 if( AknLayoutUtils::MSKEnabled() && Layout_Meta_Data::IsMSKEnabled() ) |
|
1294 { |
|
1295 return ETrue; |
|
1296 } |
|
1297 |
|
1298 return EFalse; |
|
1299 } |
|
1300 |
|
1301 // ----------------------------------------------------------------------------- |
|
1302 // CXnMenuAdapter::AddMenuItemL |
|
1303 // |
|
1304 // ----------------------------------------------------------------------------- |
|
1305 // |
|
1306 TInt CXnMenuAdapter::AddMenuItemL( TInt aParentIndex, |
|
1307 CXnNodePluginIf* aNode, RPointerArray< const TDesC8 >& aGroups ) |
|
1308 { |
|
1309 if ( !aNode ) |
|
1310 { |
|
1311 return 0; |
|
1312 } |
|
1313 |
|
1314 const TDesC8& name( aNode->Type()->Type() ); |
|
1315 |
|
1316 TInt retval( 0 ); |
|
1317 |
|
1318 TBool showByGroup( EFalse ); |
|
1319 |
|
1320 const TDesC8* id( NULL ); |
|
1321 |
|
1322 CXnProperty* prop( aNode->IdL() ); |
|
1323 |
|
1324 if( prop ) |
|
1325 { |
|
1326 id = &prop->StringValue(); |
|
1327 } |
|
1328 else |
|
1329 { |
|
1330 // If menuitem doesn't have id, group doesn't affect to it |
|
1331 showByGroup = ETrue; |
|
1332 } |
|
1333 |
|
1334 if( name == KXnMenuItem || |
|
1335 name == KXnDynMenuItem || |
|
1336 name == KXnWidgetMenuItem ) |
|
1337 { |
|
1338 const TDesC8& ns( aNode->Namespace() ); |
|
1339 |
|
1340 for( TInt i = 0; !showByGroup && i < aGroups.Count(); i++ ) |
|
1341 { |
|
1342 const TDesC8& groupId( *(aGroups)[i] ); |
|
1343 |
|
1344 CXnNodePluginIf* group( iUiEngine->FindNodeByIdL( groupId, ns ) ); |
|
1345 |
|
1346 if( group ) |
|
1347 { |
|
1348 RPointerArray< CXnNodePluginIf > |
|
1349 children( group->ChildrenL() ); |
|
1350 |
|
1351 CleanupClosePushL( children ); |
|
1352 |
|
1353 for( TInt j = 0; j < children.Count(); j++ ) |
|
1354 { |
|
1355 CXnProperty* prop( children[j]->GetPropertyL( |
|
1356 XnPropertyNames::action::KName ) ); |
|
1357 |
|
1358 if( prop ) |
|
1359 { |
|
1360 const TDesC8& name( prop->StringValue() ); |
|
1361 |
|
1362 if( name == *id ) |
|
1363 { |
|
1364 // The menuitem belongs to defined group |
|
1365 showByGroup = ETrue; |
|
1366 break; |
|
1367 } |
|
1368 } |
|
1369 } |
|
1370 |
|
1371 CleanupStack::PopAndDestroy( &children ); |
|
1372 } |
|
1373 } |
|
1374 |
|
1375 if( !showByGroup || !IsNodeVisibleL( *aNode ) ) |
|
1376 { |
|
1377 // Menuitem is invisible |
|
1378 return retval; |
|
1379 } |
|
1380 } |
|
1381 |
|
1382 TXnMenuItem item; |
|
1383 |
|
1384 item.iAutomaticSP = ETrue; |
|
1385 |
|
1386 item.iParentIndex = aParentIndex; |
|
1387 item.iData.iFlags = 0; |
|
1388 |
|
1389 CXnNodePluginIf* menuItem( NULL ); |
|
1390 |
|
1391 if( name == KXnMenuItem || name == KXnDynMenuItem ) |
|
1392 { |
|
1393 menuItem = aNode; |
|
1394 } |
|
1395 else if( name == KXnWidgetMenuItem ) |
|
1396 { |
|
1397 TRAP_IGNORE( menuItem = FindWidgetMenuItemL( aNode ) ); |
|
1398 } |
|
1399 |
|
1400 if( menuItem ) |
|
1401 { |
|
1402 const TDesC8& type( menuItem->Type()->Type() ); |
|
1403 |
|
1404 // check first if label comes from view |
|
1405 CXnProperty* label( aNode->LabelL() ); |
|
1406 |
|
1407 if ( !label ) |
|
1408 { |
|
1409 // get label from widget |
|
1410 label = menuItem->LabelL(); |
|
1411 } |
|
1412 |
|
1413 if( label ) |
|
1414 { |
|
1415 HBufC* itemLabel = label->StringValueL(); |
|
1416 item.iData.iText.Copy( *itemLabel ); |
|
1417 delete itemLabel; |
|
1418 } |
|
1419 else |
|
1420 { |
|
1421 item.iData.iText.Copy( KNullDesC ); |
|
1422 } |
|
1423 |
|
1424 TBool okToAdd( ETrue ); |
|
1425 |
|
1426 if( type == KXnDynMenuItem ) |
|
1427 { |
|
1428 okToAdd = EFalse; |
|
1429 |
|
1430 if( iObserver ) |
|
1431 { |
|
1432 okToAdd = iObserver->DynInitMenuItemL( menuItem->AppIfL() ); |
|
1433 } |
|
1434 } |
|
1435 |
|
1436 if( okToAdd ) |
|
1437 { |
|
1438 if ( id && *id == KHsShowHelp ) |
|
1439 { |
|
1440 // Help command id must be EAknCmdHelp to get editing input options |
|
1441 // shown correctly |
|
1442 item.iData.iCommandId = EAknCmdHelp; |
|
1443 } |
|
1444 else |
|
1445 { |
|
1446 item.iData.iCommandId = iIdCounter++; |
|
1447 } |
|
1448 |
|
1449 item.iData.iCascadeId = 0; |
|
1450 item.iNode = menuItem; |
|
1451 item.iIsCascade = EFalse; |
|
1452 iMenuItems.AppendL( item ); |
|
1453 |
|
1454 retval = 1; |
|
1455 } |
|
1456 } |
|
1457 |
|
1458 if( name == KXnMenu ) |
|
1459 { |
|
1460 // main level menu or submenu (cascade) |
|
1461 item.iData.iCommandId = iIdCounter++; |
|
1462 |
|
1463 if( aParentIndex == -1 ) |
|
1464 { |
|
1465 item.iData.iCascadeId = R_AVKON_MENUPANE_EMPTY; |
|
1466 } |
|
1467 else |
|
1468 { |
|
1469 item.iData.iCascadeId = iIdCounter++; |
|
1470 } |
|
1471 |
|
1472 item.iNode = aNode; |
|
1473 item.iIsCascade = ETrue; |
|
1474 iMenuItems.AppendL( item ); |
|
1475 |
|
1476 TInt currentIndex( iMenuItems.Count() - 1 ); |
|
1477 |
|
1478 RPointerArray< CXnNodePluginIf > children( aNode->ChildrenL() ); |
|
1479 CleanupClosePushL( children ); |
|
1480 |
|
1481 TInt count( 0 ); |
|
1482 |
|
1483 for( TInt i = 0; i < children.Count(); i++ ) |
|
1484 { |
|
1485 count += AddMenuItemL( currentIndex, children[i], aGroups ); |
|
1486 } |
|
1487 |
|
1488 if( aParentIndex != -1 && count == 0 ) |
|
1489 { |
|
1490 // Empty submenu, don't show it |
|
1491 iMenuItems.Delete( currentIndex ); |
|
1492 // Reverse counter as well |
|
1493 iIdCounter -= 2; |
|
1494 } |
|
1495 |
|
1496 CleanupStack::PopAndDestroy( &children ); |
|
1497 |
|
1498 retval = count; |
|
1499 } |
|
1500 |
|
1501 return retval; |
|
1502 } |
|
1503 |
|
1504 // ----------------------------------------------------------------------------- |
|
1505 // CXnMenuAdapter::PopulateMenuL |
|
1506 // |
|
1507 // ----------------------------------------------------------------------------- |
|
1508 // |
|
1509 void CXnMenuAdapter::PopulateMenuL() |
|
1510 { |
|
1511 iMenuItems.Reset(); |
|
1512 |
|
1513 iIdCounter = KMenuCommandFirst; |
|
1514 |
|
1515 CXnNodePluginIf* focused( iUiEngine->FocusedNodeL() ); |
|
1516 |
|
1517 const TDesC8& ns( iRootNode->Namespace() ); |
|
1518 |
|
1519 TBool widgetSpecific( EFalse ); |
|
1520 |
|
1521 for( ; focused ; focused = focused->ParentL() ) |
|
1522 { |
|
1523 if( focused->AppIfL().InternalDomNodeType() == XnPropertyNames::KPlugin ) |
|
1524 { |
|
1525 widgetSpecific = ETrue; |
|
1526 break; |
|
1527 } |
|
1528 } |
|
1529 |
|
1530 TBool widgetsShown( iUiEngine->WidgetsVisible() ); |
|
1531 |
|
1532 RPointerArray< const TDesC8 > groups; |
|
1533 CleanupClosePushL( groups ); |
|
1534 |
|
1535 if( iUiEngine->EditMode() ) |
|
1536 { |
|
1537 groups.AppendL( &KEditMode ); |
|
1538 } |
|
1539 else |
|
1540 { |
|
1541 groups.AppendL( widgetSpecific ? &KWidgetSpecific : &KViewSpecific ); |
|
1542 groups.AppendL( widgetsShown ? &KWidgetsShown : &KWidgetsHidden ); |
|
1543 } |
|
1544 |
|
1545 groups.AppendL( &KAlwaysShown ); |
|
1546 |
|
1547 // Recursively add menuitems |
|
1548 AddMenuItemL( -1, iMenuBarNode, groups ); |
|
1549 |
|
1550 CleanupStack::PopAndDestroy( &groups ); |
|
1551 } |
|
1552 |
|
1553 // ----------------------------------------------------------------------------- |
|
1554 // CXnMenuAdapter::OfferKeyEventL |
|
1555 // ----------------------------------------------------------------------------- |
|
1556 // |
|
1557 TKeyResponse CXnMenuAdapter::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
1558 { |
|
1559 TKeyResponse resp( EKeyWasNotConsumed ); |
|
1560 |
|
1561 if( IsMenuFocused() && aKeyEvent.iScanCode == EStdKeyNo ) |
|
1562 { |
|
1563 StopDisplayingMenu(); |
|
1564 |
|
1565 iKeyEventNode = NULL; |
|
1566 |
|
1567 return resp; |
|
1568 } |
|
1569 |
|
1570 const TDesC8* pos( &KNullDesC8 ); |
|
1571 |
|
1572 if( aKeyEvent.iScanCode == EStdKeyDevice0 ) |
|
1573 { |
|
1574 pos = &XnPropertyNames::softkey::type::KLeft; |
|
1575 } |
|
1576 else if( aKeyEvent.iScanCode == EStdKeyDevice1 ) |
|
1577 { |
|
1578 pos = &XnPropertyNames::softkey::type::KRight; |
|
1579 } |
|
1580 else if( aKeyEvent.iScanCode == EStdKeyDevice3 ) |
|
1581 { |
|
1582 pos = &XnPropertyNames::softkey::type::KMiddle; |
|
1583 } |
|
1584 |
|
1585 if( aType == EEventKeyDown ) |
|
1586 { |
|
1587 iKeyEventNode = FindSoftkeyNodeL( *pos ); |
|
1588 } |
|
1589 |
|
1590 if( aKeyEvent.iScanCode == EStdKeyDevice0 || |
|
1591 aKeyEvent.iScanCode == EStdKeyDevice1 || |
|
1592 aKeyEvent.iScanCode == EStdKeyDevice3 ) |
|
1593 { |
|
1594 CXnNodePluginIf* node( FindSoftkeyNodeL( *pos ) ); |
|
1595 |
|
1596 if( node && node == iKeyEventNode ) |
|
1597 { |
|
1598 // Let base class handle the event |
|
1599 resp = CXnControlAdapter::OfferKeyEventL( aKeyEvent, aType ); |
|
1600 } |
|
1601 } |
|
1602 |
|
1603 if( aType == EEventKeyUp ) |
|
1604 { |
|
1605 iKeyEventNode = NULL; |
|
1606 } |
|
1607 |
|
1608 return resp; |
|
1609 } |
|
1610 |
|
1611 // ----------------------------------------------------------------------------- |
|
1612 // CXnMenuAdapter::HandlePointerEventL |
|
1613 // ----------------------------------------------------------------------------- |
|
1614 // |
|
1615 void CXnMenuAdapter::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
1616 { |
|
1617 CXnNodePluginIf* node( FindSoftkeyItemByPosition( aPointerEvent.iParentPosition ) ); |
|
1618 |
|
1619 if( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
1620 { |
|
1621 // The sofkey node which received the button down event |
|
1622 iPointerEventNode = node; |
|
1623 } |
|
1624 |
|
1625 if( node && node == iPointerEventNode ) |
|
1626 { |
|
1627 iUiEngine->DisableRenderUiLC(); |
|
1628 |
|
1629 // Handle event if location is in the grabbing node's area |
|
1630 CXnControlAdapter::HandlePointerEventL( aPointerEvent ); |
|
1631 |
|
1632 CleanupStack::PopAndDestroy(); |
|
1633 } |
|
1634 |
|
1635 if( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
1636 { |
|
1637 // Reset grabbing node after the up event |
|
1638 iPointerEventNode = NULL; |
|
1639 } |
|
1640 } |
|
1641 |
|
1642 // ----------------------------------------------------------------------------- |
|
1643 // CXnMenuAdapter::DoEnterPowerSaveModeL |
|
1644 // Enter power save mode |
|
1645 // ----------------------------------------------------------------------------- |
|
1646 void CXnMenuAdapter::DoEnterPowerSaveModeL(TModeEvent /*aEvent*/) |
|
1647 { |
|
1648 } |
|
1649 |
|
1650 // ----------------------------------------------------------------------------- |
|
1651 // CXnMenuAdapter::DoExitPowerSaveModeL |
|
1652 // Enter power save mode |
|
1653 // ----------------------------------------------------------------------------- |
|
1654 void CXnMenuAdapter::DoExitPowerSaveModeL(TModeEvent /*aEvent*/) |
|
1655 { |
|
1656 } |
|
1657 |
|
1658 // ----------------------------------------------------------------------------- |
|
1659 // CXnMenuAdapter::RestoreMenuL |
|
1660 // ----------------------------------------------------------------------------- |
|
1661 // |
|
1662 void CXnMenuAdapter::RestoreMenuL( CCoeControl* aMenuControl, TInt aResourceId, |
|
1663 TMenuType aType ) |
|
1664 { |
|
1665 // let all menu pane resources propogate to default implementation, |
|
1666 // otherwise panic when trying to display menu |
|
1667 if ( aType == MEikMenuObserver::EMenuPane ) |
|
1668 { |
|
1669 if ( !( KMenuCommandFirst <= aResourceId && |
|
1670 aResourceId <= KMenuCommandLast ) |
|
1671 && aResourceId != R_AVKON_MENUPANE_EMPTY ) |
|
1672 { |
|
1673 MEikMenuObserver::RestoreMenuL( aMenuControl,aResourceId, aType ); |
|
1674 } |
|
1675 else |
|
1676 { |
|
1677 AddItemsToMenuPaneL( ( CEikMenuPane* )aMenuControl, aResourceId ); |
|
1678 } |
|
1679 } |
|
1680 } |
|
1681 |
|
1682 // ----------------------------------------------------------------------------- |
|
1683 // CXnMenuAdapter::DynInitMenuPaneL |
|
1684 // ----------------------------------------------------------------------------- |
|
1685 // |
|
1686 void CXnMenuAdapter::DynInitMenuPaneL( TInt aResourceId, |
|
1687 CEikMenuPane* aMenuPane ) |
|
1688 { |
|
1689 if ( aResourceId == R_AVKON_MENUPANE_EMPTY ) |
|
1690 { |
|
1691 RestoreMenuL( aMenuPane, aResourceId, MEikMenuObserver::EMenuPane ); |
|
1692 } |
|
1693 } |
|
1694 |
|
1695 // ----------------------------------------------------------------------------- |
|
1696 // CXnMenuAdapter::SetEmphasis |
|
1697 // ----------------------------------------------------------------------------- |
|
1698 // |
|
1699 void CXnMenuAdapter::SetEmphasis( CCoeControl* aMenuControl, |
|
1700 TBool aEmphasis ) |
|
1701 { |
|
1702 if ( iMenuBar && aMenuControl == iMenuBar ) |
|
1703 { |
|
1704 CXnAppUiAdapter* appui( |
|
1705 static_cast< CXnAppUiAdapter* >( iAvkonAppUi ) ); |
|
1706 |
|
1707 if ( aEmphasis && !iMenuShown ) |
|
1708 { |
|
1709 iMenuShown = ETrue; |
|
1710 |
|
1711 TRAP_IGNORE( appui->AddToStackL( appui->View(), |
|
1712 iMenuBar, |
|
1713 ECoeStackPriorityMenu ) ); |
|
1714 |
|
1715 iMenuBar->MakeVisible( ETrue ); |
|
1716 } |
|
1717 else if ( !aEmphasis && iMenuShown ) |
|
1718 { |
|
1719 iMenuShown = EFalse; |
|
1720 |
|
1721 appui->RemoveFromStack( iMenuBar ); |
|
1722 |
|
1723 iMenuBar->MakeVisible( EFalse ); |
|
1724 } |
|
1725 } |
|
1726 } |
|
1727 |
|
1728 // ----------------------------------------------------------------------------- |
|
1729 // CXnMenuAdapter::ProcessCommandL |
|
1730 // ----------------------------------------------------------------------------- |
|
1731 // |
|
1732 void CXnMenuAdapter::ProcessCommandL( TInt aCommand ) |
|
1733 { |
|
1734 if ( ( KMenuCommandFirst <= aCommand && aCommand <= KMenuCommandLast ) || |
|
1735 aCommand == EAknCmdHelp ) |
|
1736 { |
|
1737 // find item for this command |
|
1738 for ( TInt i = 0; i< iMenuItems.Count(); i++ ) |
|
1739 { |
|
1740 if ( iMenuItems[i].iData.iCommandId == aCommand ) |
|
1741 { |
|
1742 CXnNodePluginIf* node( iMenuItems[i].iNode ); |
|
1743 |
|
1744 if ( node ) |
|
1745 { |
|
1746 StopDisplayingMenu(); |
|
1747 |
|
1748 iUiEngine->DisableRenderUiLC(); |
|
1749 |
|
1750 node->SetStateL( XnPropertyNames::style::common::KActive ); |
|
1751 |
|
1752 CleanupStack::PopAndDestroy(); |
|
1753 |
|
1754 break; |
|
1755 } |
|
1756 } |
|
1757 } |
|
1758 } |
|
1759 else |
|
1760 { |
|
1761 StopDisplayingMenu(); |
|
1762 |
|
1763 if( aCommand == EEikCmdEditPaste ) |
|
1764 { |
|
1765 // Paste event for AknCcpuSupport |
|
1766 TKeyEvent pasteEvent = |
|
1767 { EKeyF18, EEikCmdEditPaste, EModifierCtrl, 1 }; |
|
1768 |
|
1769 iCoeEnv->SimulateKeyEventL( pasteEvent, EEventKey ); |
|
1770 } |
|
1771 } |
|
1772 } |
|
1773 |
|
1774 // ----------------------------------------------------------------------------- |
|
1775 // CXnMenuAdapter::SetContainerL |
|
1776 // |
|
1777 // ----------------------------------------------------------------------------- |
|
1778 // |
|
1779 void CXnMenuAdapter::SetContainerL( CEikButtonGroupContainer& aContainer ) |
|
1780 { |
|
1781 TBool updateNeeded( EFalse ); |
|
1782 |
|
1783 TInt statusPaneId( iAvkonAppUi->StatusPane()->CurrentLayoutResId() ); |
|
1784 |
|
1785 if(iPreviousMenuPaneId != statusPaneId) |
|
1786 { |
|
1787 updateNeeded = ETrue; |
|
1788 iPreviousMenuPaneId = statusPaneId; |
|
1789 } |
|
1790 |
|
1791 if((&aContainer) && (iContainer != &aContainer || updateNeeded)) |
|
1792 { |
|
1793 iUpdateLskAppearance = ETrue; |
|
1794 iUpdateMskAppearance = ETrue; |
|
1795 iUpdateRskAppearance = ETrue; |
|
1796 } |
|
1797 |
|
1798 iContainer = &aContainer; |
|
1799 |
|
1800 UpdateSoftkeyAppearancesL(); |
|
1801 |
|
1802 if (iContainer) |
|
1803 { |
|
1804 iContainer->DrawNow(); |
|
1805 } |
|
1806 } |
|
1807 |
|
1808 //-------------------------------------------------------------- |
|
1809 // CXnMenuAdapter::IsMenuFocused |
|
1810 // ------------------------------------------------------------ |
|
1811 TBool CXnMenuAdapter::IsMenuFocused() |
|
1812 { |
|
1813 return iMenuShown; |
|
1814 } |
|
1815 |
|
1816 // ----------------------------------------------------------------------------- |
|
1817 // CXnMenuAdapter::TryDisplayingMenuL |
|
1818 // Displays options menu if it is defined for the softkey item |
|
1819 // ----------------------------------------------------------------------------- |
|
1820 // |
|
1821 void CXnMenuAdapter::TryDisplayingMenuL( const TDesC& aMenuNodeId ) |
|
1822 { |
|
1823 HBufC8* id = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aMenuNodeId ); |
|
1824 CleanupStack::PushL( id ); |
|
1825 CXnNodePluginIf* node( iUiEngine->FindNodeByIdL( *id, iRootNode->Namespace() ) ); |
|
1826 CleanupStack::PopAndDestroy( id ); |
|
1827 |
|
1828 if( node && node->Type()->Type() == KXnMenu ) |
|
1829 { |
|
1830 TryDisplayingMenuL(); |
|
1831 } |
|
1832 } |
|
1833 |
|
1834 // ----------------------------------------------------------------------------- |
|
1835 // CXnMenuAdapter::TryDisplayingMenuL |
|
1836 // Displays options menu if it is defined for the softkey item |
|
1837 // ----------------------------------------------------------------------------- |
|
1838 // |
|
1839 void CXnMenuAdapter::TryDisplayingMenuL() |
|
1840 { |
|
1841 StopDisplayingMenu(); |
|
1842 |
|
1843 CreateMenuBarL(); |
|
1844 |
|
1845 if ( iMenuBar ) |
|
1846 { |
|
1847 CEikMenuBarTitle* title = new( ELeave ) CEikMenuBarTitle; |
|
1848 CleanupStack::PushL( title ); |
|
1849 |
|
1850 title->iData.iMenuPaneResourceId = R_AVKON_MENUPANE_EMPTY; |
|
1851 title->iTitleFlags = 0; |
|
1852 |
|
1853 // this cannot be done earlyer, than this callback |
|
1854 iMenuBar->TitleArray()->AddTitleL( title ); |
|
1855 CleanupStack::Pop( title ); |
|
1856 |
|
1857 iMenuBar->TryDisplayMenuBarL(); |
|
1858 } |
|
1859 } |
|
1860 |
|
1861 // ----------------------------------------------------------------------------- |
|
1862 // CXnMenuAdapter::StopDisplayingMenu |
|
1863 // ----------------------------------------------------------------------------- |
|
1864 // |
|
1865 void CXnMenuAdapter::StopDisplayingMenu() |
|
1866 { |
|
1867 if( iMenuShown && iMenuBar ) |
|
1868 { |
|
1869 iMenuBar->StopDisplayingMenuBar(); |
|
1870 } |
|
1871 } |
|
1872 |
|
1873 // --------------------------------------------------------------------------- |
|
1874 // CXnMenuAdapter::CreateMenuBarL |
|
1875 // --------------------------------------------------------------------------- |
|
1876 // |
|
1877 void CXnMenuAdapter::CreateMenuBarL() |
|
1878 { |
|
1879 if ( iMenuBar ) |
|
1880 { |
|
1881 // All ready created |
|
1882 return; |
|
1883 } |
|
1884 |
|
1885 // Create |
|
1886 RPointerArray< CXnNodePluginIf > children( iRootNode->ChildrenL() ); |
|
1887 CleanupClosePushL( children ); |
|
1888 |
|
1889 for( TInt i = 0; i < children.Count(); i++ ) |
|
1890 { |
|
1891 CXnNodePluginIf* node( children[i] ); |
|
1892 |
|
1893 TPtrC8 type( node->Type()->Type() ); |
|
1894 |
|
1895 // Currently only one menubar is allowed, |
|
1896 // but it can be assigned to any of the CBAs |
|
1897 // To change this, we have to create and maintain a list of menubars |
|
1898 if( type == KXnMenu ) |
|
1899 { |
|
1900 iMenuBarNode = node; |
|
1901 |
|
1902 iMenuBar = new ( ELeave ) CEikMenuBar; |
|
1903 iMenuBar->ConstructL( this ); |
|
1904 iMenuBar->SetMenuType( MenuTypeL( *iRootNode ) ); |
|
1905 |
|
1906 // All done |
|
1907 break; |
|
1908 } |
|
1909 } |
|
1910 CleanupStack::PopAndDestroy( &children ); |
|
1911 } |
|
1912 |
|
1913 //-------------------------------------------------------------- |
|
1914 // CXnMenuAdapter::HandleResourceChange |
|
1915 // Handles a change to the control's resources of type aType |
|
1916 // ------------------------------------------------------------ |
|
1917 void CXnMenuAdapter::HandleResourceChange( TInt aType ) |
|
1918 { |
|
1919 if( iMenuBar ) |
|
1920 { |
|
1921 iMenuBar->HandleResourceChange( aType ); |
|
1922 } |
|
1923 } |
|
1924 |
|
1925 // ----------------------------------------------------------------------------- |
|
1926 // CXnMenuAdapter::SetSoftKeyImageL |
|
1927 // |
|
1928 // ----------------------------------------------------------------------------- |
|
1929 // |
|
1930 void CXnMenuAdapter::SetSoftKeyImageL( |
|
1931 CFbsBitmap* aBitmap, |
|
1932 CFbsBitmap* aMask, |
|
1933 XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos, |
|
1934 CXnNodeAppIf* aNode, |
|
1935 TBool aPreserveAspectRatio, TBool aInvertMask, |
|
1936 TBool aTransferOwnership) |
|
1937 { |
|
1938 if( ( !aBitmap && !aMask ) || aPos == XnMenuInterface::MXnMenuInterface::ECenter ) |
|
1939 { |
|
1940 // No images present and image can be set only to lsk or rsk |
|
1941 User::Leave( KErrArgument ); |
|
1942 } |
|
1943 |
|
1944 CXnSoftkeyItem* softkey(NULL); |
|
1945 |
|
1946 if( aPos == XnMenuInterface::MXnMenuInterface::ELeft) |
|
1947 { |
|
1948 if( aNode ) |
|
1949 { |
|
1950 softkey = SoftkeyItemL( aNode ); |
|
1951 } |
|
1952 else |
|
1953 { |
|
1954 softkey = SoftkeyItemL(CEikButtonGroupContainer::ELeftSoftkeyPosition); |
|
1955 } |
|
1956 iUpdateLskAppearance = ETrue; |
|
1957 } |
|
1958 else if(aPos == XnMenuInterface::MXnMenuInterface::ERight) |
|
1959 { |
|
1960 if( aNode ) |
|
1961 { |
|
1962 softkey = SoftkeyItemL( aNode ); |
|
1963 } |
|
1964 else |
|
1965 { |
|
1966 softkey = SoftkeyItemL(CEikButtonGroupContainer::ERightSoftkeyPosition); |
|
1967 } |
|
1968 iUpdateRskAppearance = ETrue; |
|
1969 } |
|
1970 |
|
1971 if(softkey) |
|
1972 { |
|
1973 softkey->Reset(); |
|
1974 softkey->iImageOn = ETrue; |
|
1975 |
|
1976 // Save new icon data |
|
1977 softkey->iBitmap = aBitmap; |
|
1978 softkey->iMask = aMask; |
|
1979 softkey->iPreserveAspectRatio = aPreserveAspectRatio; |
|
1980 softkey->iInvertMask = aInvertMask; |
|
1981 softkey->iOwnBitmaps = aTransferOwnership; |
|
1982 // Image set, mark node as dirty |
|
1983 softkey->iNode->SetDirtyL(); |
|
1984 |
|
1985 } |
|
1986 } |
|
1987 |
|
1988 #if 0 // MSK icon change |
|
1989 // ----------------------------------------------------------------------------- |
|
1990 // CXnMenuAdapter::SetSoftKeyImageL |
|
1991 // |
|
1992 // ----------------------------------------------------------------------------- |
|
1993 // |
|
1994 void CXnMenuAdapter::SetSoftKeyImageL( const TAknsItemID& aId, |
|
1995 const TDesC& aBmpFile, |
|
1996 const TInt32 aBmp, |
|
1997 const TInt32 aBmpM, |
|
1998 XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos, |
|
1999 TBool /*aEnable*/ ) |
|
2000 { |
|
2001 CXnSoftkeyItem* softkey( NULL ); |
|
2002 |
|
2003 switch( aPos ) |
|
2004 { |
|
2005 case XnMenuInterface::MXnMenuInterface::ECenter: |
|
2006 { |
|
2007 softkey = SoftkeyItemL( CEikButtonGroupContainer::EMiddleSoftkeyPosition ); |
|
2008 iUpdateMskAppearance = ETrue; |
|
2009 break; |
|
2010 } |
|
2011 // Currently only MSK icon updating supported here |
|
2012 case XnMenuInterface::MXnMenuInterface::ELeft: |
|
2013 case XnMenuInterface::MXnMenuInterface::ERight: |
|
2014 default: |
|
2015 { |
|
2016 break; |
|
2017 } |
|
2018 } |
|
2019 |
|
2020 if( softkey ) |
|
2021 { |
|
2022 softkey->Reset(); |
|
2023 softkey->iImageOn = ETrue; |
|
2024 |
|
2025 // Save new icon data |
|
2026 softkey->iBitmap = NULL; |
|
2027 softkey->iMask = NULL; |
|
2028 softkey->iPreserveAspectRatio = EFalse; |
|
2029 softkey->iInvertMask = EFalse; |
|
2030 softkey->iOwnBitmaps = ETrue; |
|
2031 delete softkey->iBmpFile; |
|
2032 softkey->iBmpFile = NULL; |
|
2033 softkey->iBmpFile = aBmpFile.AllocL(); |
|
2034 softkey->iId.Set( aId ); |
|
2035 softkey->iBmp = aBmp; |
|
2036 softkey->iBmpM = aBmpM; |
|
2037 |
|
2038 // Image set, mark node as dirty |
|
2039 softkey->iNode->SetDirtyL(); |
|
2040 } |
|
2041 } |
|
2042 #endif // MSK icon change |
|
2043 |
|
2044 // ----------------------------------------------------------------------------- |
|
2045 // CXnMenuAdapter::SetSoftKeyTextL |
|
2046 // |
|
2047 // ----------------------------------------------------------------------------- |
|
2048 // |
|
2049 void CXnMenuAdapter::SetSoftKeyTextL( const TDesC& aText, |
|
2050 XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos ) |
|
2051 { |
|
2052 CXnSoftkeyItem* softkey(NULL); |
|
2053 |
|
2054 switch( aPos ) |
|
2055 { |
|
2056 case XnMenuInterface::MXnMenuInterface::ELeft: |
|
2057 softkey = SoftkeyItemL(CEikButtonGroupContainer::ELeftSoftkeyPosition); |
|
2058 iUpdateLskAppearance = ETrue; |
|
2059 break; |
|
2060 case XnMenuInterface::MXnMenuInterface::ERight: |
|
2061 softkey = SoftkeyItemL(CEikButtonGroupContainer::ERightSoftkeyPosition); |
|
2062 iUpdateRskAppearance = ETrue; |
|
2063 break; |
|
2064 case XnMenuInterface::MXnMenuInterface::ECenter: |
|
2065 softkey = SoftkeyItemL(CEikButtonGroupContainer::EMiddleSoftkeyPosition); |
|
2066 iUpdateMskAppearance = ETrue; |
|
2067 break; |
|
2068 default: |
|
2069 break; |
|
2070 } |
|
2071 if(softkey) |
|
2072 { |
|
2073 softkey->Reset(); |
|
2074 |
|
2075 softkey->iImageOn = EFalse; |
|
2076 |
|
2077 softkey->iLabel = aText.AllocL(); |
|
2078 // Text set, mark parent as dirty |
|
2079 softkey->iNode->SetDirtyL(); |
|
2080 } |
|
2081 } |
|
2082 |
|
2083 // ----------------------------------------------------------------------------- |
|
2084 // CXnMenuAdapter::SetSoftKeyL |
|
2085 // |
|
2086 // ----------------------------------------------------------------------------- |
|
2087 // |
|
2088 void CXnMenuAdapter::SetSoftKeyL( CXnNodePluginIf* aSoftkeyNode, |
|
2089 XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos ) |
|
2090 { |
|
2091 |
|
2092 CXnSoftkeyItem* item = AppendSoftkeyItemL(aSoftkeyNode); |
|
2093 switch(aPos) |
|
2094 { |
|
2095 case XnMenuInterface::MXnMenuInterface::ELeft: |
|
2096 if(item) |
|
2097 { |
|
2098 iVisibleLSK = item; |
|
2099 } |
|
2100 else |
|
2101 { |
|
2102 iVisibleLSK = NULL; |
|
2103 } |
|
2104 iUpdateLskAppearance = ETrue; |
|
2105 break; |
|
2106 case XnMenuInterface::MXnMenuInterface::ECenter: |
|
2107 if(item) |
|
2108 { |
|
2109 iVisibleMSK = item; |
|
2110 } |
|
2111 else |
|
2112 { |
|
2113 iVisibleMSK = NULL; |
|
2114 } |
|
2115 iUpdateMskAppearance = ETrue; |
|
2116 break; |
|
2117 case XnMenuInterface::MXnMenuInterface::ERight: |
|
2118 if(item) |
|
2119 { |
|
2120 iVisibleRSK = item; |
|
2121 } |
|
2122 else |
|
2123 { |
|
2124 iVisibleRSK = NULL; |
|
2125 } |
|
2126 iUpdateRskAppearance = ETrue; |
|
2127 break; |
|
2128 } |
|
2129 } |
|
2130 |
|
2131 // ----------------------------------------------------------------------------- |
|
2132 // CXnMenuAdapter::SoftKeyL |
|
2133 // |
|
2134 // ----------------------------------------------------------------------------- |
|
2135 // |
|
2136 CXnNodePluginIf* CXnMenuAdapter::SoftKeyL( XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos ) |
|
2137 { |
|
2138 CXnNodePluginIf* node(NULL); |
|
2139 CXnSoftkeyItem* item = SoftkeyItemL(aPos); |
|
2140 if(item) |
|
2141 { |
|
2142 node = item->iNode; |
|
2143 } |
|
2144 return node; |
|
2145 } |
|
2146 |
|
2147 // ----------------------------------------------------------------------------- |
|
2148 // CXnMenuAdapter::HandleScreenDeviceChangedL |
|
2149 // |
|
2150 // ----------------------------------------------------------------------------- |
|
2151 // |
|
2152 void CXnMenuAdapter::HandleScreenDeviceChangedL() |
|
2153 { |
|
2154 CXnSoftkeyItem* left = |
|
2155 SoftkeyItemL(CEikButtonGroupContainer::ELeftSoftkeyPosition); |
|
2156 |
|
2157 CXnSoftkeyItem* middle = |
|
2158 SoftkeyItemL(CEikButtonGroupContainer::EMiddleSoftkeyPosition); |
|
2159 CXnSoftkeyItem* right = |
|
2160 SoftkeyItemL(CEikButtonGroupContainer::ERightSoftkeyPosition); |
|
2161 |
|
2162 if(left && left->iImageOn) |
|
2163 { |
|
2164 iUpdateLskAppearance = ETrue; |
|
2165 left->iNode->SetDirtyL(); |
|
2166 } |
|
2167 if(right && right->iImageOn) |
|
2168 { |
|
2169 iUpdateRskAppearance = ETrue; |
|
2170 right->iNode->SetDirtyL(); |
|
2171 } |
|
2172 if(middle && middle->iImageOn) |
|
2173 { |
|
2174 iUpdateMskAppearance = ETrue; |
|
2175 middle->iNode->SetDirtyL(); |
|
2176 } |
|
2177 CXnControlAdapter::HandleScreenDeviceChangedL(); |
|
2178 } |
|
2179 |
|
2180 // ----------------------------------------------------------------------------- |
|
2181 // CXnMenuAdapter::HandleMenuPropertyChangeL |
|
2182 // Change softkey appearance |
|
2183 // ----------------------------------------------------------------------------- |
|
2184 // |
|
2185 void CXnMenuAdapter::HandleMenuPropertyChangeL(CXnNodePluginIf* aNode, CXnProperty* aProperty) |
|
2186 { |
|
2187 if ( !aNode ) |
|
2188 { |
|
2189 return; |
|
2190 } |
|
2191 |
|
2192 const TDesC8& type( aNode->Type()->Type() ); |
|
2193 |
|
2194 if ( type != softkey::KNodeName) |
|
2195 { |
|
2196 return; |
|
2197 } |
|
2198 |
|
2199 // Find target softkey |
|
2200 CXnSoftkeyItem* softkey( SoftkeyItemL( aNode ) ); |
|
2201 |
|
2202 if ( !softkey ) |
|
2203 { |
|
2204 return; |
|
2205 } |
|
2206 |
|
2207 SetUpdateAppearanceL( softkey ); |
|
2208 |
|
2209 const TDesC8* name( &KNullDesC8() ); |
|
2210 |
|
2211 if ( aProperty ) |
|
2212 { |
|
2213 name = &aProperty->Property()->Name(); |
|
2214 } |
|
2215 |
|
2216 if ( *name == menu::KLabel ) |
|
2217 { |
|
2218 softkey->Reset(); |
|
2219 softkey->iImageOn = EFalse; |
|
2220 softkey->iLabel = aProperty->StringValueL(); |
|
2221 } |
|
2222 else if ( *name == style::common::KDisplay ) |
|
2223 { |
|
2224 if ( aProperty->StringValue() == XnPropertyNames::style::common::display::KNone ) |
|
2225 { |
|
2226 if ( softkey->iPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition ) |
|
2227 { |
|
2228 EikSoftkeyImage::SetLabel( iContainer,ETrue ); |
|
2229 iContainer->SetCommandL( CEikButtonGroupContainer::ELeftSoftkeyPosition,KCBACommandFirst, KNullDesC ); |
|
2230 } |
|
2231 else if ( softkey->iPosition == CEikButtonGroupContainer::ERightSoftkeyPosition ) |
|
2232 { |
|
2233 EikSoftkeyImage::SetLabel( iContainer,EFalse ); |
|
2234 iContainer->SetCommandL( CEikButtonGroupContainer::ERightSoftkeyPosition,KCBACommandSecond, KNullDesC ); |
|
2235 } |
|
2236 else if ( softkey->iPosition == CEikButtonGroupContainer::EMiddleSoftkeyPosition ) |
|
2237 { |
|
2238 iContainer->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition,KCBACommandMiddle, KNullDesC ); |
|
2239 } |
|
2240 } |
|
2241 } |
|
2242 } |
|
2243 |
|
2244 // ----------------------------------------------------------------------------- |
|
2245 // CXnMenuAdapter::SetObserver |
|
2246 // |
|
2247 // ----------------------------------------------------------------------------- |
|
2248 // |
|
2249 void CXnMenuAdapter::SetObserver( XnMenuInterface::MXnMenuObserver& aObserver ) |
|
2250 { |
|
2251 iObserver = &aObserver; |
|
2252 } |
|
2253 |
|
2254 // ----------------------------------------------------------------------------- |
|
2255 // CXnMenuAdapter::RemoveObserver |
|
2256 // |
|
2257 // ----------------------------------------------------------------------------- |
|
2258 // |
|
2259 void CXnMenuAdapter::RemoveObserver() |
|
2260 { |
|
2261 iObserver = NULL; |
|
2262 } |
|
2263 |
|
2264 // --------------------------------------------------------------------------- |
|
2265 // CXnMenuAdapter::FindSoftKeyNodeByPosition |
|
2266 // --------------------------------------------------------------------------- |
|
2267 // |
|
2268 TBool CXnMenuAdapter::FindSoftKeyNodeByPosition( |
|
2269 const TPoint& aPosition, |
|
2270 CXnNodePluginIf*& aNode ) |
|
2271 { |
|
2272 CXnNodePluginIf* ret = FindSoftkeyItemByPosition(aPosition); |
|
2273 aNode = ret; |
|
2274 return (ret?ETrue:EFalse); |
|
2275 } |
|
2276 // --------------------------------------------------------------------------- |
|
2277 // CXnMenuAdapter::ButtonTouchableRectByPosition |
|
2278 // Gets a CBA button rectangle. Touchable are is larger than controls rect |
|
2279 // --------------------------------------------------------------------------- |
|
2280 // |
|
2281 TRect CXnMenuAdapter::ButtonTouchableRectByPosition( TInt aPosition) |
|
2282 { |
|
2283 TRect rect( 0, 0, 0, 0 ); |
|
2284 |
|
2285 TRect button1Rect( 0, 0, 0, 0 ); |
|
2286 TRect button2Rect( 0, 0, 0, 0 ); |
|
2287 TRect buttonMSKRect( 0, 0, 0, 0 ); |
|
2288 |
|
2289 // In touch layouts the button areas are read from the |
|
2290 // layout data because they are larger than the actual |
|
2291 // control size. |
|
2292 #ifndef _AVKON_CBA_LSC |
|
2293 CCoeControl* container = iContainer->ButtonGroup()->AsControl(); |
|
2294 TRect containerRect(container->PositionRelativeToScreen(),container->Size()); |
|
2295 TAknLayoutRect layoutRect; |
|
2296 layoutRect.LayoutRect( |
|
2297 containerRect, |
|
2298 AknLayoutScalable_Avkon::control_pane_g6( 0 ).LayoutLine() ); |
|
2299 button1Rect = layoutRect.Rect(); |
|
2300 |
|
2301 layoutRect.LayoutRect( |
|
2302 containerRect, |
|
2303 AknLayoutScalable_Avkon::control_pane_g8( 0 ).LayoutLine() ); |
|
2304 button2Rect = layoutRect.Rect(); |
|
2305 |
|
2306 layoutRect.LayoutRect( |
|
2307 containerRect, |
|
2308 AknLayoutScalable_Avkon::control_pane_g7( 0 ).LayoutLine() ); |
|
2309 buttonMSKRect = layoutRect.Rect(); |
|
2310 #else |
|
2311 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
2312 { |
|
2313 button1Rect = SoftkeyRectTopTouch(); |
|
2314 button2Rect= SoftkeyRectBottomTouch(); |
|
2315 |
|
2316 } |
|
2317 else // portrait |
|
2318 { |
|
2319 button1Rect = SoftkeyRectLeftTouch(); |
|
2320 button2Rect = SoftkeyRectRightTouch(); |
|
2321 } |
|
2322 #endif |
|
2323 |
|
2324 switch ( aPosition ) |
|
2325 { |
|
2326 case CEikButtonGroupContainer::ELeftSoftkeyPosition: |
|
2327 { |
|
2328 rect = button1Rect; |
|
2329 break; |
|
2330 } |
|
2331 |
|
2332 case CEikButtonGroupContainer::ERightSoftkeyPosition: |
|
2333 { |
|
2334 rect = button2Rect; |
|
2335 break; |
|
2336 } |
|
2337 |
|
2338 case CEikButtonGroupContainer::EMiddleSoftkeyPosition: |
|
2339 { |
|
2340 rect = buttonMSKRect; |
|
2341 break; |
|
2342 } |
|
2343 |
|
2344 default: |
|
2345 { |
|
2346 break; |
|
2347 } |
|
2348 } |
|
2349 |
|
2350 |
|
2351 return rect; |
|
2352 } |
|
2353 |
|
2354 // --------------------------------------------------------------------------- |
|
2355 // CXnMenuAdapter::FindSoftkeyNodeL |
|
2356 // --------------------------------------------------------------------------- |
|
2357 // |
|
2358 CXnNodePluginIf* CXnMenuAdapter::FindSoftkeyNodeL(const TDesC8& aNodeType) |
|
2359 { |
|
2360 CXnNodePluginIf* ret(0); |
|
2361 |
|
2362 RPointerArray< CXnNodePluginIf > children( iRootNode->ChildrenL() ); |
|
2363 CleanupClosePushL( children ); |
|
2364 for(TInt i=0;i<children.Count();++i) |
|
2365 { |
|
2366 if(children[i]->Type()->Type() == XnPropertyNames::softkey::KNodeName) |
|
2367 { |
|
2368 if( SoftkeyPlaceL(*children[i]) == aNodeType |
|
2369 && IsNodeVisibleL( *children[i]) ) |
|
2370 { |
|
2371 ret = children[i]; |
|
2372 break; |
|
2373 } |
|
2374 |
|
2375 } |
|
2376 } |
|
2377 CleanupStack::PopAndDestroy( &children ); |
|
2378 return ret; |
|
2379 } |
|
2380 |
|
2381 // --------------------------------------------------------------------------- |
|
2382 // CXnMenuAdapter::UpdateSoftkeyAppearancesL |
|
2383 // --------------------------------------------------------------------------- |
|
2384 // |
|
2385 void CXnMenuAdapter::UpdateSoftkeyAppearancesL() |
|
2386 { |
|
2387 |
|
2388 if(iUpdateLskAppearance) |
|
2389 { |
|
2390 CXnSoftkeyItem* left = |
|
2391 SoftkeyItemL(CEikButtonGroupContainer::ELeftSoftkeyPosition); |
|
2392 if( left ) |
|
2393 { |
|
2394 SetSoftkeyAppearanceL(*left); |
|
2395 } |
|
2396 iUpdateLskAppearance = EFalse; |
|
2397 } |
|
2398 if(iUpdateRskAppearance) |
|
2399 { |
|
2400 CXnSoftkeyItem* right = |
|
2401 SoftkeyItemL(CEikButtonGroupContainer::ERightSoftkeyPosition); |
|
2402 if(right) |
|
2403 { |
|
2404 SetSoftkeyAppearanceL(*right); |
|
2405 } |
|
2406 iUpdateRskAppearance = EFalse; |
|
2407 } |
|
2408 if(iUpdateMskAppearance) |
|
2409 { |
|
2410 CXnSoftkeyItem* middle = |
|
2411 SoftkeyItemL(CEikButtonGroupContainer::EMiddleSoftkeyPosition); |
|
2412 if(middle) |
|
2413 { |
|
2414 SetSoftkeyAppearanceL(*middle); |
|
2415 } |
|
2416 iUpdateMskAppearance = EFalse; |
|
2417 } |
|
2418 } |
|
2419 // --------------------------------------------------------------------------- |
|
2420 // CXnMenuAdapter::ChangeSoftkeyImageL |
|
2421 // --------------------------------------------------------------------------- |
|
2422 // |
|
2423 void CXnMenuAdapter::ChangeSoftkeyImageL(const CXnSoftkeyItem& aSoftkey) |
|
2424 { |
|
2425 #if 0 // MSK icon change |
|
2426 if ( aSoftkey.iPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition || |
|
2427 aSoftkey.iPosition == CEikButtonGroupContainer::ERightSoftkeyPosition ) |
|
2428 { |
|
2429 #endif // MSK icon change |
|
2430 TSize size; |
|
2431 if(AknLayoutUtils::PenEnabled()) |
|
2432 { |
|
2433 size = SoftkeyImageRect(*iContainer,aSoftkey.iPosition).Size(); |
|
2434 } |
|
2435 else |
|
2436 { |
|
2437 size = SoftkeyRectL( *iContainer,aSoftkey.iPosition, aSoftkey.iImageOn ).Size(); |
|
2438 } |
|
2439 |
|
2440 CEikImage* image( PrepareSoftkeyImageL( aSoftkey, size ) ); |
|
2441 TBool left(ETrue); |
|
2442 |
|
2443 if(aSoftkey.iPosition != CEikButtonGroupContainer::ELeftSoftkeyPosition) |
|
2444 { |
|
2445 left = EFalse; |
|
2446 } |
|
2447 EikSoftkeyImage::SetImage( iContainer, *image, left ); |
|
2448 #if 0 // MSK icon change |
|
2449 } |
|
2450 else if ( aSoftkey.iBmpFile ) |
|
2451 { |
|
2452 CEikCba* cba = static_cast< CEikCba* >( iContainer->ButtonGroup() ); |
|
2453 // use iAvkonAppUi |
|
2454 CAknAppUi* appUi = static_cast<CAknAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
2455 cba->UpdateMSKIconL( |
|
2456 aSoftkey.iId, |
|
2457 aSoftkey.iBmpFile->Des(), |
|
2458 aSoftkey.iBmp, |
|
2459 aSoftkey.iBmpM, |
|
2460 ETrue ); |
|
2461 cba->DrawNow(); |
|
2462 } |
|
2463 #endif // MSK icon change |
|
2464 } |
|
2465 |
|
2466 // --------------------------------------------------------------------------- |
|
2467 // CXnMenuAdapter::AddItemsToMenuPaneL |
|
2468 // --------------------------------------------------------------------------- |
|
2469 // |
|
2470 void CXnMenuAdapter::AddItemsToMenuPaneL(CEikMenuPane* aMenuPane, TInt aResourceId) |
|
2471 { |
|
2472 TInt parentIndexForNotification( 0 ); |
|
2473 |
|
2474 for ( TInt i = 0; i< iMenuItems.Count(); i++ ) |
|
2475 { |
|
2476 // find items belong to this pane |
|
2477 TInt parent( iMenuItems[i].iParentIndex ); |
|
2478 |
|
2479 if ( parent >= 0 ) |
|
2480 { |
|
2481 TInt cid( iMenuItems[parent].iData.iCascadeId ); |
|
2482 |
|
2483 if ( cid == aResourceId ) |
|
2484 { |
|
2485 if ( parent > 0 ) |
|
2486 { |
|
2487 parentIndexForNotification = parent; |
|
2488 break; |
|
2489 } |
|
2490 } |
|
2491 } |
|
2492 } |
|
2493 |
|
2494 TBool selectionEnabled( EFalse ); |
|
2495 TBool isRadio( EFalse ); |
|
2496 |
|
2497 if ( parentIndexForNotification != 0 ) |
|
2498 { |
|
2499 CXnNodePluginIf* node( iMenuItems[parentIndexForNotification].iNode ); |
|
2500 |
|
2501 CXnProperty* property( node->GetPropertyL( _L8( "selectiontype" ) ) ); |
|
2502 |
|
2503 if ( property && property->StringValue() == _L8( "multi" ) ) |
|
2504 { |
|
2505 selectionEnabled = ETrue; |
|
2506 } |
|
2507 else if ( property && property->StringValue() == _L8( "single" ) ) |
|
2508 { |
|
2509 selectionEnabled = ETrue; |
|
2510 isRadio = ETrue; |
|
2511 } |
|
2512 |
|
2513 node->SetStateL( XnPropertyNames::style::common::KActive ); |
|
2514 node->UnsetStateL( XnPropertyNames::style::common::KActive ); |
|
2515 } |
|
2516 |
|
2517 PopulateMenuL(); |
|
2518 |
|
2519 for ( TInt i = 0; i< iMenuItems.Count(); i++ ) |
|
2520 { |
|
2521 // find items belong to this pane |
|
2522 TInt parent( iMenuItems[i].iParentIndex ); |
|
2523 |
|
2524 if ( parent >= 0 ) |
|
2525 { |
|
2526 TInt cid( iMenuItems[parent].iData.iCascadeId ); |
|
2527 |
|
2528 if ( cid == aResourceId ) |
|
2529 { |
|
2530 if ( selectionEnabled ) |
|
2531 { |
|
2532 if ( !isRadio ) |
|
2533 { |
|
2534 iMenuItems[i].iData.iFlags |= |
|
2535 EEikMenuItemCheckBox; |
|
2536 } |
|
2537 else |
|
2538 { |
|
2539 iMenuItems[i].iData.iFlags |= |
|
2540 EEikMenuItemRadioStart| |
|
2541 EEikMenuItemRadioMiddle| |
|
2542 EEikMenuItemRadioEnd; |
|
2543 } |
|
2544 } |
|
2545 |
|
2546 aMenuPane->AddMenuItemL( iMenuItems[i].iData ); |
|
2547 |
|
2548 if ( selectionEnabled ) |
|
2549 { |
|
2550 CXnProperty* property( |
|
2551 iMenuItems[i].iNode->GetPropertyL( XnPropertyNames::menu::KChecked ) ); |
|
2552 |
|
2553 if ( property && property->StringValue() == XnPropertyNames::KTrue ) |
|
2554 { |
|
2555 aMenuPane->SetItemButtonState( |
|
2556 iMenuItems[i].iData.iCommandId, EEikMenuItemSymbolOn ); |
|
2557 } |
|
2558 } |
|
2559 } |
|
2560 } |
|
2561 } // for end |
|
2562 } |
|
2563 |
|
2564 // --------------------------------------------------------------------------- |
|
2565 // CXnMenuAdapter::AppendSoftkeyItemL |
|
2566 // --------------------------------------------------------------------------- |
|
2567 // |
|
2568 CXnSoftkeyItem* CXnMenuAdapter::AppendSoftkeyItemL(CXnNodePluginIf* aNode) |
|
2569 { |
|
2570 if(!aNode) |
|
2571 { |
|
2572 return NULL; |
|
2573 } |
|
2574 CXnProperty* property = |
|
2575 aNode->GetPropertyL( XnPropertyNames::softkey::KTypeAttribute ); |
|
2576 if(!property) |
|
2577 { |
|
2578 return NULL; |
|
2579 } |
|
2580 const TDesC8& skType = property->StringValue(); |
|
2581 if( skType != XnPropertyNames::softkey::type::KRight && |
|
2582 skType != XnPropertyNames::softkey::type::KLeft && |
|
2583 skType != XnPropertyNames::softkey::type::KMiddle ) |
|
2584 { |
|
2585 return NULL; |
|
2586 } |
|
2587 for( TInt i=0; i<iSoftkeyItems.Count(); i++ ) |
|
2588 { |
|
2589 if( iSoftkeyItems[i]->iNode == aNode ) |
|
2590 { |
|
2591 return iSoftkeyItems[i]; |
|
2592 } |
|
2593 } |
|
2594 CXnSoftkeyItem* softkey(0); |
|
2595 softkey = new (ELeave) CXnSoftkeyItem; |
|
2596 CleanupStack::PushL(softkey); |
|
2597 |
|
2598 if ( skType == XnPropertyNames::softkey::type::KRight ) |
|
2599 { |
|
2600 softkey->iPosition = CEikButtonGroupContainer::ERightSoftkeyPosition; |
|
2601 softkey->iCommandId = KCBACommandSecond; |
|
2602 } |
|
2603 else if ( skType == XnPropertyNames::softkey::type::KLeft ) |
|
2604 { |
|
2605 softkey->iPosition = CEikButtonGroupContainer::ELeftSoftkeyPosition; |
|
2606 softkey->iCommandId = KCBACommandFirst; |
|
2607 } |
|
2608 else |
|
2609 { |
|
2610 softkey->iPosition = CEikButtonGroupContainer::EMiddleSoftkeyPosition; |
|
2611 softkey->iCommandId = KCBACommandMiddle; |
|
2612 } |
|
2613 |
|
2614 softkey->iNode = aNode; |
|
2615 |
|
2616 CXnProperty* labelProp( aNode->LabelL() ); |
|
2617 CXnProperty* targetProp( aNode->GetPropertyL(KXnTarget) ); |
|
2618 |
|
2619 if(labelProp) |
|
2620 { |
|
2621 softkey->iImageOn = EFalse; |
|
2622 softkey->iLabel = labelProp->StringValueL(); |
|
2623 } |
|
2624 else if(targetProp) |
|
2625 { |
|
2626 softkey->iImageOn = EFalse; |
|
2627 softkey->iLabel = FindSoftkeyLabelL(aNode); |
|
2628 } |
|
2629 #if 0 // MSK icon change |
|
2630 else |
|
2631 { |
|
2632 InitSoftkeyItemImageL( *softkey ); |
|
2633 } |
|
2634 #else // MSK icon change |
|
2635 else if(softkey->iPosition != CEikButtonGroupContainer::EMiddleSoftkeyPosition) |
|
2636 { // we can't set own image to middle softkey |
|
2637 InitSoftkeyItemImageL( *softkey ); |
|
2638 } |
|
2639 #endif // MSK icon change |
|
2640 softkey->iUpdateAppearance = ETrue; |
|
2641 iSoftkeyItems.AppendL(softkey); |
|
2642 CleanupStack::Pop(softkey); |
|
2643 return softkey; |
|
2644 } |
|
2645 // --------------------------------------------------------------------------- |
|
2646 // CXnMenuAdapter::SoftkeyPlaceL |
|
2647 // --------------------------------------------------------------------------- |
|
2648 // |
|
2649 const TDesC8& CXnMenuAdapter::SoftkeyPlaceL(CXnNodePluginIf& aNode) |
|
2650 { |
|
2651 CXnProperty* property = |
|
2652 aNode.GetPropertyL( XnPropertyNames::softkey::KTypeAttribute ); |
|
2653 |
|
2654 if( property) |
|
2655 { |
|
2656 return property->StringValue(); |
|
2657 } |
|
2658 return KNullDesC8; |
|
2659 |
|
2660 } |
|
2661 |
|
2662 // ----------------------------------------------------------------------------- |
|
2663 // CXnMenuAdapter::FindSoftkeyItemByPosition |
|
2664 // |
|
2665 // ----------------------------------------------------------------------------- |
|
2666 CXnNodePluginIf* CXnMenuAdapter::FindSoftkeyItemByPosition( const TPoint& aPosition ) |
|
2667 { |
|
2668 CXnNodePluginIf* softkey(0); |
|
2669 TRAP_IGNORE( softkey = DoFindSoftkeyItemByPositionL( aPosition ) ); |
|
2670 return softkey; |
|
2671 } |
|
2672 |
|
2673 // ----------------------------------------------------------------------------- |
|
2674 // CXnMenuAdapter::DoFindSoftkeyItemByPositionL |
|
2675 // |
|
2676 // ----------------------------------------------------------------------------- |
|
2677 CXnNodePluginIf* CXnMenuAdapter::DoFindSoftkeyItemByPositionL( const TPoint& aPosition ) |
|
2678 { |
|
2679 TRect lsk( ButtonTouchableRectByPosition(CEikButtonGroupContainer::ELeftSoftkeyPosition) ); |
|
2680 TRect rsk( ButtonTouchableRectByPosition(CEikButtonGroupContainer::ERightSoftkeyPosition) ); |
|
2681 TRect msk( ButtonTouchableRectByPosition(CEikButtonGroupContainer::EMiddleSoftkeyPosition) ); |
|
2682 |
|
2683 CXnNodePluginIf* softkey(NULL); |
|
2684 CXnSoftkeyItem* item(NULL); |
|
2685 if ( lsk.Contains(aPosition) ) |
|
2686 { |
|
2687 item = SoftkeyItemL(CEikButtonGroupContainer::ELeftSoftkeyPosition); |
|
2688 } |
|
2689 else if(msk.Contains(aPosition)) |
|
2690 { |
|
2691 item = SoftkeyItemL(CEikButtonGroupContainer::EMiddleSoftkeyPosition); |
|
2692 } |
|
2693 else if( rsk.Contains(aPosition) ) |
|
2694 { |
|
2695 item = SoftkeyItemL(CEikButtonGroupContainer::ERightSoftkeyPosition); |
|
2696 } |
|
2697 if(item) |
|
2698 { |
|
2699 softkey = item->iNode; |
|
2700 } |
|
2701 return softkey; |
|
2702 } |
|
2703 |
|
2704 // ----------------------------------------------------------------------------- |
|
2705 // ----------------------------------------------------------------------------- |
|
2706 CXnSoftkeyItem* CXnMenuAdapter::SoftkeyItemL(TInt aPosition) |
|
2707 { |
|
2708 CXnSoftkeyItem* softkeyItem(0); |
|
2709 if(iVisibleLSK && aPosition == CEikButtonGroupContainer::ELeftSoftkeyPosition) |
|
2710 { |
|
2711 return iVisibleLSK; |
|
2712 } |
|
2713 else if(iVisibleRSK && aPosition == CEikButtonGroupContainer::ERightSoftkeyPosition) |
|
2714 { |
|
2715 return iVisibleRSK; |
|
2716 } |
|
2717 else if(iVisibleMSK && aPosition == CEikButtonGroupContainer::EMiddleSoftkeyPosition) |
|
2718 { |
|
2719 return iVisibleMSK; |
|
2720 } |
|
2721 |
|
2722 // return default |
|
2723 for(TInt i=0;i<iSoftkeyItems.Count();++i) |
|
2724 { |
|
2725 softkeyItem = iSoftkeyItems[i]; |
|
2726 if(softkeyItem->iPosition == aPosition && |
|
2727 softkeyItem->iDefault && |
|
2728 IsNodeVisibleL(*softkeyItem->iNode)) |
|
2729 { |
|
2730 return softkeyItem; |
|
2731 } |
|
2732 } |
|
2733 return NULL; |
|
2734 } |
|
2735 |
|
2736 // ----------------------------------------------------------------------------- |
|
2737 // ----------------------------------------------------------------------------- |
|
2738 CXnSoftkeyItem* CXnMenuAdapter::SoftkeyItemL(CXnNodePluginIf* aNode) |
|
2739 { |
|
2740 CXnSoftkeyItem* softkeyItem(0); |
|
2741 for(TInt i=0;i<iSoftkeyItems.Count();++i) |
|
2742 { |
|
2743 softkeyItem = iSoftkeyItems[i]; |
|
2744 if(softkeyItem->iNode == aNode) |
|
2745 { |
|
2746 return softkeyItem; |
|
2747 } |
|
2748 } |
|
2749 return NULL; |
|
2750 } |
|
2751 |
|
2752 CXnSoftkeyItem* CXnMenuAdapter::SoftkeyItemL(CXnNodeAppIf* aNode) |
|
2753 { |
|
2754 CXnSoftkeyItem* softkeyItem(0); |
|
2755 for(TInt i=0;i<iSoftkeyItems.Count();++i) |
|
2756 { |
|
2757 softkeyItem = iSoftkeyItems[i]; |
|
2758 if(&(softkeyItem->iNode->AppIfL()) == aNode) |
|
2759 { |
|
2760 return softkeyItem; |
|
2761 } |
|
2762 } |
|
2763 return NULL; |
|
2764 } |
|
2765 // ----------------------------------------------------------------------------- |
|
2766 // ----------------------------------------------------------------------------- |
|
2767 |
|
2768 void CXnMenuAdapter::SetUpdateAppearanceL(CXnSoftkeyItem* aItem) |
|
2769 { |
|
2770 if ( aItem && IsNodeVisibleL( *aItem->iNode ) ) |
|
2771 { |
|
2772 aItem->iNode->SetDirtyL(); |
|
2773 |
|
2774 switch ( aItem->iPosition ) |
|
2775 { |
|
2776 case CEikButtonGroupContainer::ELeftSoftkeyPosition: |
|
2777 iUpdateLskAppearance = ETrue; |
|
2778 iVisibleLSK = NULL; |
|
2779 break; |
|
2780 case CEikButtonGroupContainer::EMiddleSoftkeyPosition: |
|
2781 iUpdateMskAppearance = ETrue; |
|
2782 iVisibleMSK = NULL; |
|
2783 break; |
|
2784 case CEikButtonGroupContainer::ERightSoftkeyPosition: |
|
2785 iUpdateRskAppearance = ETrue; |
|
2786 iVisibleRSK = NULL; |
|
2787 break; |
|
2788 } |
|
2789 } |
|
2790 } |
|
2791 |
|
2792 // ----------------------------------------------------------------------------- |
|
2793 // CXnMenuAdapter::FindWidgetMenuItemL |
|
2794 // |
|
2795 // ----------------------------------------------------------------------------- |
|
2796 CXnNodePluginIf* CXnMenuAdapter::FindWidgetMenuItemL( CXnNodePluginIf* aNode ) |
|
2797 { |
|
2798 CXnNodePluginIf* focusedNode( iUiEngine->FocusedNodeL() ); |
|
2799 |
|
2800 CXnNodePluginIf* menuItem( NULL ); |
|
2801 |
|
2802 if ( focusedNode && aNode ) |
|
2803 { |
|
2804 // Get <plugin> element |
|
2805 CXnNodePluginIf& pluginNode( iUiEngine->PluginNodeL( focusedNode ) ); |
|
2806 |
|
2807 RPointerArray< CXnNodePluginIf > children( pluginNode.ChildrenL() ); |
|
2808 CleanupClosePushL( children ); |
|
2809 |
|
2810 CXnNodePluginIf* widgetExtNode( NULL ); |
|
2811 |
|
2812 if( children.Count() > 0 ) |
|
2813 { |
|
2814 // children[0] must be <widget> element |
|
2815 widgetExtNode = FindChildL( *children[0], KXnMenuExtension ); |
|
2816 } |
|
2817 |
|
2818 if( !widgetExtNode ) |
|
2819 { |
|
2820 widgetExtNode = focusedNode; |
|
2821 } |
|
2822 |
|
2823 if ( widgetExtNode ) |
|
2824 { |
|
2825 CXnProperty* prop( aNode->GetPropertyL( KXnSource ) ); |
|
2826 |
|
2827 if ( prop ) |
|
2828 { |
|
2829 const TDesC8& source( prop->StringValue() ); |
|
2830 |
|
2831 // Try to find <menuitem> |
|
2832 menuItem = FindChildL( *widgetExtNode, |
|
2833 KXnMenuItem, |
|
2834 source ); |
|
2835 |
|
2836 if ( !menuItem ) |
|
2837 { |
|
2838 // Try to find <dynmenuitem> |
|
2839 menuItem = FindChildL( *widgetExtNode, |
|
2840 KXnDynMenuItem, |
|
2841 source ); |
|
2842 } |
|
2843 } |
|
2844 } |
|
2845 |
|
2846 CleanupStack::PopAndDestroy( &children ); |
|
2847 } |
|
2848 |
|
2849 if( menuItem && IsNodeVisibleL( *menuItem ) ) |
|
2850 { |
|
2851 return menuItem; |
|
2852 } |
|
2853 |
|
2854 return NULL; |
|
2855 } |
|
2856 |
|
2857 // ----------------------------------------------------------------------------- |
|
2858 // CXnMenuAdapter::FindSoftkeyLabelL |
|
2859 // |
|
2860 // ----------------------------------------------------------------------------- |
|
2861 HBufC* CXnMenuAdapter::FindSoftkeyLabelL( CXnNodePluginIf* aNode ) |
|
2862 { |
|
2863 if( !aNode ) |
|
2864 { |
|
2865 return NULL; |
|
2866 } |
|
2867 |
|
2868 CXnProperty* targerProp( aNode->GetPropertyL( KXnTarget ) ); |
|
2869 |
|
2870 if ( targerProp && iRootNode ) |
|
2871 { |
|
2872 CXnNodePluginIf* widgetSoftkeyNode( |
|
2873 FindChildL( *iRootNode, |
|
2874 KXnWidgetSoftkey, |
|
2875 targerProp->StringValue() ) ); |
|
2876 |
|
2877 if ( widgetSoftkeyNode ) |
|
2878 { |
|
2879 CXnProperty* label( widgetSoftkeyNode->LabelL() ); |
|
2880 |
|
2881 if( label ) |
|
2882 { |
|
2883 return label->StringValueL(); |
|
2884 } |
|
2885 } |
|
2886 } |
|
2887 |
|
2888 return NULL;; |
|
2889 } |
|
2890 |
|
2891 //end of file |