|
1 /* |
|
2 * Copyright (c) 2007 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 of an action menu component. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "emailtrace.h" |
|
20 #include "fsactionmenu.h" |
|
21 #include "fstreevisualizerbase.h" |
|
22 #include "fslayoutmanager.h" |
|
23 #include "fsactionmenucontrol.h" |
|
24 |
|
25 //SYSTEM INCLUDES |
|
26 #include <AknUtils.h> |
|
27 #include <eikbtgpc.h> |
|
28 #include <eikenv.h> |
|
29 #include <eikspane.h> |
|
30 //TOOLKIT INCLUDES |
|
31 // <cmail> |
|
32 #include <alf/alfenv.h> |
|
33 #include <alf/alfdecklayout.h> |
|
34 #include <alf/alfcontrol.h> |
|
35 #include <alf/alfcontrolgroup.h> |
|
36 #include <alf/alfdisplay.h> |
|
37 #include <alf/alfroster.h> |
|
38 #include <alf/alfborderbrush.h> |
|
39 #include <alf/alfgradientbrush.h> |
|
40 #include <alf/alfbrusharray.h> |
|
41 // </cmail> |
|
42 // --------------------------------------------------------------------------- |
|
43 // Two-phased constructor. |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 EXPORT_C CFsActionMenu* CFsActionMenu::NewL( CAlfDisplay& aDisplay, TInt aCbaResource ) |
|
47 { |
|
48 FUNC_LOG; |
|
49 CFsActionMenu* self = new( ELeave ) CFsActionMenu( aDisplay ); |
|
50 CleanupStack::PushL( self ); |
|
51 self->ConstructL( aCbaResource ); |
|
52 CleanupStack::Pop( self ); |
|
53 |
|
54 return self; |
|
55 } |
|
56 |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // C++ destructor. |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 EXPORT_C CFsActionMenu::~CFsActionMenu() |
|
63 { |
|
64 FUNC_LOG; |
|
65 delete iWait; |
|
66 delete iButtonGroupContainer; |
|
67 } |
|
68 |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // Exetutes action menu at predefined vertical position. |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 EXPORT_C TFsActionMenuResult CFsActionMenu::ExecuteL( TFsVActionMenuPosition aPos ) |
|
75 { |
|
76 FUNC_LOG; |
|
77 |
|
78 iResult = EFsMenuDismissed; |
|
79 |
|
80 TInt count = Count(); |
|
81 if ( count > 0 ) |
|
82 { |
|
83 iVPos = aPos; |
|
84 iIsCustVPos = EFalse; |
|
85 |
|
86 FadeBehindActionMenuL( ETrue ); // <cmail> |
|
87 DoExecuteL(); |
|
88 FadeBehindActionMenuL( EFalse ); // <cmail> |
|
89 HideCbaButtonsL(); |
|
90 } |
|
91 |
|
92 return iResult; |
|
93 } |
|
94 |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // Exetutes action menu at a custom vertical position. |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C TFsActionMenuResult CFsActionMenu::ExecuteL( const TInt aYPos ) |
|
101 { |
|
102 FUNC_LOG; |
|
103 iResult = EFsMenuDismissed; |
|
104 |
|
105 TInt count = Count(); |
|
106 if ( count > 0 ) |
|
107 { |
|
108 iCustVPos = aYPos; |
|
109 iIsCustVPos = ETrue; |
|
110 |
|
111 FadeBehindActionMenuL( ETrue ); // <cmail> |
|
112 DoExecuteL(); |
|
113 FadeBehindActionMenuL( EFalse ); // <cmail> |
|
114 HideCbaButtonsL(); |
|
115 } |
|
116 |
|
117 return iResult; |
|
118 } |
|
119 |
|
120 |
|
121 // --------------------------------------------------------------------------- |
|
122 // The function returns size of Action Menu with the curent number of item. |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 EXPORT_C TSize CFsActionMenu::ActionMenuSize ( ) |
|
126 { |
|
127 FUNC_LOG; |
|
128 // <cmail> |
|
129 TRAP_IGNORE( SetAMSizeFromLayoutMgrL( ) ); |
|
130 // </cmail> |
|
131 return iSize; |
|
132 } |
|
133 |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // Sets visiblity of the border |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 EXPORT_C void CFsActionMenu::SetBorderL( const TBool aVisible, CAlfTexture* aBorderTexture ) |
|
140 { |
|
141 FUNC_LOG; |
|
142 CFsTreeList::SetBorderL( aVisible, aBorderTexture ); |
|
143 |
|
144 const TInt KZero(0); |
|
145 |
|
146 if ( aVisible ) |
|
147 { |
|
148 iAmXPadd = KZero; |
|
149 iAmYPadd = KZero; |
|
150 } |
|
151 else |
|
152 { |
|
153 iAmXPadd = KListBorderPadding; |
|
154 iAmYPadd = KListBorderPadding; |
|
155 } |
|
156 } |
|
157 |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // The function returns a button group container. |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 EXPORT_C CEikButtonGroupContainer* CFsActionMenu::ButtonGroupContainer() |
|
164 { |
|
165 FUNC_LOG; |
|
166 return iButtonGroupContainer; |
|
167 } |
|
168 |
|
169 |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 void CFsActionMenu::RootLayoutUpdatedL() |
|
175 { |
|
176 FUNC_LOG; |
|
177 TInt count = Count(); |
|
178 if ( count > 0 ) |
|
179 { |
|
180 iRootLayout->ClearFlag(EAlfVisualFlagLayoutUpdateNotification); |
|
181 UpdateActionMenuWindowL( ); |
|
182 iRootLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); |
|
183 } |
|
184 } |
|
185 |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // Processes user commands. |
|
189 // --------------------------------------------------------------------------- |
|
190 // |
|
191 void CFsActionMenu::ProcessCommandL(TInt aCommandId) |
|
192 { |
|
193 FUNC_LOG; |
|
194 switch ( aCommandId ) |
|
195 { |
|
196 case EAknSoftkeyCancel: |
|
197 case EAknSoftkeyExit: |
|
198 case EAknSoftkeyClose: |
|
199 case EAknSoftkeyNo: |
|
200 case EAknSoftkeyBack: |
|
201 { |
|
202 iResult = EFsMenuDismissed; |
|
203 DoDismissL(); |
|
204 break; |
|
205 } |
|
206 case EAknSoftkeySelect: |
|
207 case EAknSoftkeyYes: |
|
208 case EAknSoftkeyOk: |
|
209 case EAknSoftkeyDone: |
|
210 { |
|
211 iResult = EFsMenuItemSelected; |
|
212 DoDismissL(); |
|
213 break; |
|
214 } |
|
215 default: |
|
216 { |
|
217 // Nothing to do |
|
218 break; |
|
219 } |
|
220 } |
|
221 } |
|
222 |
|
223 |
|
224 // --------------------------------------------------------------------------- |
|
225 // Shows action menu's cba. |
|
226 // --------------------------------------------------------------------------- |
|
227 // |
|
228 // <cmail> Touch |
|
229 void CFsActionMenu::TreeListEventL( const TFsTreeListEvent aEvent, const TFsTreeItemId /*aId*/ ) |
|
230 { |
|
231 FUNC_LOG; |
|
232 // </cmail> |
|
233 switch ( aEvent ) |
|
234 { |
|
235 case MFsTreeListObserver::EFsTreeItemSelected: |
|
236 { |
|
237 iResult = EFsMenuItemSelected; |
|
238 DoDismissL(); // <cmail> |
|
239 break; |
|
240 } |
|
241 case MFsTreeListObserver::EFsTreeItemWithMenuSelected: |
|
242 { |
|
243 iResult = EFsMenuItemSelected; |
|
244 DoDismissL(); // <cmail> |
|
245 break; |
|
246 } |
|
247 case MFsTreeListObserver::EFsTreeListKeyRightArrow: |
|
248 {//right arrow click acts like "Cancel" in AH (mirrored) layouts |
|
249 if ( CFsLayoutManager::IsMirrored() ) |
|
250 { |
|
251 iResult = EFsMenuDismissed; |
|
252 DoDismissL(); // <cmail> |
|
253 } |
|
254 break; |
|
255 } |
|
256 case MFsTreeListObserver::EFsTreeListKeyLeftArrow: |
|
257 {//left arrow click acts like "Cancel" in western layouts |
|
258 if ( !CFsLayoutManager::IsMirrored() ) |
|
259 { |
|
260 iResult = EFsMenuDismissed; |
|
261 DoDismissL(); // <cmail> |
|
262 } |
|
263 break; |
|
264 } |
|
265 case MFsTreeListObserver::EFsTreeListHidden: |
|
266 {//list fully hidden -> remove from the roster; |
|
267 iDisplay->Roster().Hide( *iCtrlGroup ); |
|
268 break; |
|
269 } |
|
270 case MFsTreeListObserver::EFsTreeListShown: |
|
271 {//list fully shown |
|
272 break; |
|
273 } |
|
274 } |
|
275 } |
|
276 |
|
277 |
|
278 // --------------------------------------------------------------------------- |
|
279 // Shows action menu's cba. |
|
280 // --------------------------------------------------------------------------- |
|
281 // |
|
282 void CFsActionMenu::ShowCbaButtonsL() |
|
283 { |
|
284 FUNC_LOG; |
|
285 iButtonGroupContainer->MakeVisible(ETrue); |
|
286 } |
|
287 |
|
288 |
|
289 // --------------------------------------------------------------------------- |
|
290 // Hides action menu's cba. |
|
291 // --------------------------------------------------------------------------- |
|
292 // |
|
293 void CFsActionMenu::HideCbaButtonsL() |
|
294 { |
|
295 FUNC_LOG; |
|
296 iButtonGroupContainer->MakeVisible(EFalse); |
|
297 } |
|
298 |
|
299 |
|
300 // --------------------------------------------------------------------------- |
|
301 // Executes action menu. |
|
302 // --------------------------------------------------------------------------- |
|
303 // |
|
304 void CFsActionMenu::DoExecuteL() |
|
305 { |
|
306 FUNC_LOG; |
|
307 iRootLayout->ClearFlag(EAlfVisualFlagLayoutUpdateNotification); |
|
308 TAlfTimedValue opacity; |
|
309 opacity.SetValueNow(0.0); |
|
310 iRootLayout->SetOpacity(opacity); |
|
311 |
|
312 UpdateActionMenuWindowL( ); |
|
313 SetFirstItemAsFocusedL( ); |
|
314 ShowCbaButtonsL( ); |
|
315 ////////////////////////////////////////// |
|
316 iDisplay->Roster().ShowL( *iCtrlGroup ); |
|
317 |
|
318 TBool fadeIn(EFalse), slideIn(EFalse); |
|
319 |
|
320 fadeIn = IsFadeIn(); |
|
321 slideIn = IsSlideIn(); |
|
322 |
|
323 this->ShowListL( fadeIn, slideIn ); |
|
324 |
|
325 //show root layout |
|
326 opacity.SetValueNow(1.0); |
|
327 iRootLayout->SetOpacity(opacity); |
|
328 |
|
329 iRootLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); |
|
330 |
|
331 StartWait(); |
|
332 |
|
333 } |
|
334 |
|
335 |
|
336 // --------------------------------------------------------------------------- |
|
337 // Dismiss action menu. |
|
338 // --------------------------------------------------------------------------- |
|
339 // |
|
340 void CFsActionMenu::DoDismissL() |
|
341 { |
|
342 FUNC_LOG; |
|
343 TBool fadeOut(EFalse), slideOut(EFalse); |
|
344 |
|
345 fadeOut = IsFadeOut(); |
|
346 slideOut = IsSlideOut(); |
|
347 this->HideListL( fadeOut, slideOut ); |
|
348 |
|
349 //after the list is fully hidden we get a notification in TreeListEvent and |
|
350 //action menu is removed from roster |
|
351 |
|
352 StopWait(); |
|
353 } |
|
354 |
|
355 |
|
356 // --------------------------------------------------------------------------- |
|
357 // |
|
358 // --------------------------------------------------------------------------- |
|
359 // |
|
360 void CFsActionMenu::StartWait() |
|
361 { |
|
362 FUNC_LOG; |
|
363 iWait->Start(); |
|
364 } |
|
365 |
|
366 |
|
367 // --------------------------------------------------------------------------- |
|
368 // |
|
369 // --------------------------------------------------------------------------- |
|
370 // |
|
371 void CFsActionMenu::StopWait() |
|
372 { |
|
373 FUNC_LOG; |
|
374 if ( iWait->IsStarted() ) |
|
375 { |
|
376 iWait->AsyncStop(); |
|
377 } |
|
378 } |
|
379 |
|
380 |
|
381 // --------------------------------------------------------------------------- |
|
382 // The function sets size and position of Action Menu. |
|
383 // --------------------------------------------------------------------------- |
|
384 // |
|
385 void CFsActionMenu::UpdateActionMenuWindowL( ) |
|
386 { |
|
387 FUNC_LOG; |
|
388 //AM's size |
|
389 SetAMSizeFromLayoutMgrL( ); |
|
390 //AM's position |
|
391 CalculatePosition( ); |
|
392 |
|
393 iVisualizer->SetPadding( TAlfBoxMetric(iAmXPadd, iAmXPadd, iAmYPadd, iAmYPadd) ); |
|
394 |
|
395 iRootLayout->SetSize( iSize, 0 ); |
|
396 iRootLayout->SetPos( iPos, 0 ); |
|
397 iRootLayout->UpdateChildrenLayout( 0 ); |
|
398 } |
|
399 |
|
400 // --------------------------------------------------------------------------- |
|
401 // The function retrieves Action Menu's size from Layout Manager. |
|
402 // --------------------------------------------------------------------------- |
|
403 // |
|
404 void CFsActionMenu::SetAMSizeFromLayoutMgrL( ) |
|
405 { |
|
406 FUNC_LOG; |
|
407 TInt count(0), variety(0); |
|
408 |
|
409 count = Count(); |
|
410 if ( count <= 0 ) |
|
411 { |
|
412 iSize.iWidth = 0; |
|
413 iSize.iHeight = 0; |
|
414 } |
|
415 else |
|
416 { |
|
417 variety = count + 1;//0-6 variety for 1-7 row AM |
|
418 if ( variety < 2 ) |
|
419 { |
|
420 variety = 2; //lowest variety to avoid crashes |
|
421 } |
|
422 |
|
423 if ( count > 7 ) |
|
424 { |
|
425 variety = 8; //highest variety |
|
426 SetScrollbarVisibilityL(EFsScrollbarShowAlways); |
|
427 } |
|
428 else |
|
429 { |
|
430 SetScrollbarVisibilityL(EFsScrollbarHideAlways); |
|
431 } |
|
432 |
|
433 TRect parentRect; |
|
434 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, parentRect ); |
|
435 |
|
436 TRect clientRect; |
|
437 CFsLayoutManager::LayoutMetricsRect( parentRect, CFsLayoutManager::EFsLmMainPane, clientRect ); |
|
438 |
|
439 CFsLayoutManager::TFsLayoutMetrics actionMenuMetrics(CFsLayoutManager::EFsLmPopupSpFsActionMenuPane); |
|
440 |
|
441 TRect actionMenuPopupRect; |
|
442 CFsLayoutManager::LayoutMetricsRect( |
|
443 clientRect, //parent |
|
444 actionMenuMetrics, //queried item |
|
445 actionMenuPopupRect, // result |
|
446 variety ); |
|
447 |
|
448 iSize.iWidth = actionMenuPopupRect.Width(); |
|
449 iSize.iHeight = actionMenuPopupRect.Height(); |
|
450 iSize.iHeight += 1; |
|
451 } |
|
452 |
|
453 } |
|
454 |
|
455 |
|
456 // --------------------------------------------------------------------------- |
|
457 // The function calculates AM's position based on it's size and predefined vertical |
|
458 // position (top,center,bottom) or custom vertical position set by the user. |
|
459 // --------------------------------------------------------------------------- |
|
460 // |
|
461 void CFsActionMenu::CalculatePosition( ) |
|
462 { |
|
463 FUNC_LOG; |
|
464 TRect clientRect; |
|
465 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, clientRect ); |
|
466 |
|
467 //horizontal position |
|
468 TRect amRect; |
|
469 if ( CFsLayoutManager::IsMirrored() ) |
|
470 { |
|
471 amRect.iTl.iX = 0; |
|
472 } |
|
473 else |
|
474 { |
|
475 amRect.iTl.iX = clientRect.iBr.iX - iSize.iWidth; |
|
476 } |
|
477 |
|
478 amRect.iBr.iX = amRect.iTl.iX + iSize.iWidth; |
|
479 |
|
480 //vertical position |
|
481 if ( iIsCustVPos ) |
|
482 { |
|
483 amRect.iTl.iY = iCustVPos; |
|
484 amRect.iBr.iY = amRect.iTl.iY + iSize.iHeight; |
|
485 } |
|
486 else |
|
487 { |
|
488 switch ( iVPos ) |
|
489 { |
|
490 case EFsVPosTop: |
|
491 amRect.iTl.iY = 0; |
|
492 amRect.iBr.iY = amRect.iTl.iY + iSize.iHeight; |
|
493 break; |
|
494 case EFsVPosCenter: |
|
495 amRect.iTl.iY = (clientRect.Height() - iSize.iHeight) / 2; |
|
496 amRect.iBr.iY = amRect.iTl.iY + iSize.iHeight; |
|
497 break; |
|
498 case EFsVPosBottom: |
|
499 default: |
|
500 amRect.iBr.iY = clientRect.Height(); |
|
501 amRect.iTl.iY = amRect.iBr.iY - iSize.iHeight; |
|
502 break; |
|
503 } |
|
504 } |
|
505 |
|
506 iPos = amRect.iTl; |
|
507 } |
|
508 |
|
509 |
|
510 // --------------------------------------------------------------------------- |
|
511 // The function returns whether the slide in effect is set. |
|
512 // --------------------------------------------------------------------------- |
|
513 // |
|
514 TBool CFsActionMenu::IsSlideIn() |
|
515 { |
|
516 FUNC_LOG; |
|
517 TBool slideIn(EFalse); |
|
518 if ( iVisualizer->SlideInDirection() != MFsTreeVisualizer::ESlideNone && |
|
519 iVisualizer->SlideInDuration() > 0 ) |
|
520 { |
|
521 slideIn = ETrue; |
|
522 } |
|
523 else |
|
524 { |
|
525 slideIn = EFalse; |
|
526 } |
|
527 return slideIn; |
|
528 } |
|
529 |
|
530 |
|
531 // --------------------------------------------------------------------------- |
|
532 // The function returns whether the fade in effect is set. |
|
533 // --------------------------------------------------------------------------- |
|
534 // |
|
535 TBool CFsActionMenu::IsFadeIn() |
|
536 { |
|
537 FUNC_LOG; |
|
538 TBool fadeIn(EFalse); |
|
539 if ( iVisualizer->FadeInEffectTime() > 0 ) |
|
540 { |
|
541 fadeIn = ETrue; |
|
542 } |
|
543 else |
|
544 { |
|
545 fadeIn = EFalse; |
|
546 } |
|
547 return fadeIn; |
|
548 } |
|
549 |
|
550 |
|
551 // --------------------------------------------------------------------------- |
|
552 // The function returns whether the slide out effect is set. |
|
553 // --------------------------------------------------------------------------- |
|
554 // |
|
555 TBool CFsActionMenu::IsSlideOut() |
|
556 { |
|
557 FUNC_LOG; |
|
558 TBool slideOut(EFalse); |
|
559 if ( iVisualizer->SlideOutDirection() != MFsTreeVisualizer::ESlideNone && |
|
560 iVisualizer->SlideOutDuration() > 0 ) |
|
561 { |
|
562 slideOut = ETrue; |
|
563 } |
|
564 else |
|
565 { |
|
566 slideOut = EFalse; |
|
567 } |
|
568 return slideOut; |
|
569 } |
|
570 |
|
571 |
|
572 // --------------------------------------------------------------------------- |
|
573 // The function returns whether the fade out effect is set. |
|
574 // --------------------------------------------------------------------------- |
|
575 // |
|
576 TBool CFsActionMenu::IsFadeOut() |
|
577 { |
|
578 FUNC_LOG; |
|
579 TBool fadeOut(EFalse); |
|
580 if ( iVisualizer->FadeOutEffectTime() > 0 ) |
|
581 { |
|
582 fadeOut = ETrue; |
|
583 } |
|
584 else |
|
585 { |
|
586 fadeOut = EFalse; |
|
587 } |
|
588 return fadeOut; |
|
589 } |
|
590 |
|
591 |
|
592 // --------------------------------------------------------------------------- |
|
593 // The function sets first list item as focused. |
|
594 // --------------------------------------------------------------------------- |
|
595 // |
|
596 void CFsActionMenu::SetFirstItemAsFocusedL() |
|
597 { |
|
598 FUNC_LOG; |
|
599 const TInt KZero( 0 ); |
|
600 |
|
601 if ( !IsEmpty( KFsTreeRootID ) ) |
|
602 { |
|
603 TFsTreeItemId firstItemId( KFsTreeNoneID ); |
|
604 |
|
605 firstItemId = Child( KFsTreeRootID, KZero ); |
|
606 if ( firstItemId != KFsTreeNoneID ) |
|
607 { |
|
608 iVisualizer->SetFocusedItemL( firstItemId ); |
|
609 } |
|
610 } |
|
611 } |
|
612 |
|
613 |
|
614 // --------------------------------------------------------------------------- |
|
615 // The function fades screen behind popup. |
|
616 // --------------------------------------------------------------------------- |
|
617 // |
|
618 void CFsActionMenu::FadeBehindActionMenuL( TBool aFaded ) // <cmail> |
|
619 { |
|
620 FUNC_LOG; |
|
621 TBool faded (aFaded); |
|
622 |
|
623 CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
624 |
|
625 if ( statusPane ) |
|
626 { |
|
627 CCoeControl* control(NULL); |
|
628 TUid uid; |
|
629 |
|
630 uid.iUid = EEikStatusPaneUidSignal; |
|
631 CEikStatusPaneBase::TPaneCapabilities subPane = statusPane->PaneCapabilities(uid); |
|
632 subPane = statusPane->PaneCapabilities( uid ); |
|
633 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
634 { |
|
635 control = statusPane->ControlL( uid ); |
|
636 control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren ); |
|
637 } |
|
638 |
|
639 |
|
640 uid.iUid = EEikStatusPaneUidBattery; |
|
641 subPane = statusPane->PaneCapabilities( uid ); |
|
642 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
643 { |
|
644 control = statusPane->ControlL( uid ); |
|
645 control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren ); |
|
646 } |
|
647 |
|
648 |
|
649 uid.iUid = EEikStatusPaneUidContext; |
|
650 subPane = statusPane->PaneCapabilities( uid ); |
|
651 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
652 { |
|
653 control = statusPane->ControlL( uid ); |
|
654 control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren ); |
|
655 } |
|
656 |
|
657 |
|
658 uid.iUid = EEikStatusPaneUidTitle; |
|
659 subPane = statusPane->PaneCapabilities( uid ); |
|
660 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
661 { |
|
662 control = statusPane->ControlL( uid ); |
|
663 control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren ); |
|
664 } |
|
665 |
|
666 |
|
667 uid.iUid = EEikStatusPaneUidNavi; |
|
668 subPane = statusPane->PaneCapabilities( uid ); |
|
669 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
670 { |
|
671 control = statusPane->ControlL( uid ); |
|
672 control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren ); |
|
673 } |
|
674 |
|
675 |
|
676 uid.iUid = EEikStatusPaneUidIndic; |
|
677 subPane = statusPane->PaneCapabilities( uid ); |
|
678 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
679 { |
|
680 control = statusPane->ControlL( uid ); |
|
681 control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren ); |
|
682 } |
|
683 |
|
684 |
|
685 uid.iUid = EEikStatusPaneUidMessage; |
|
686 subPane = statusPane->PaneCapabilities( uid ); |
|
687 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
688 { |
|
689 control = statusPane->ControlL( uid ); |
|
690 control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren ); |
|
691 } |
|
692 |
|
693 |
|
694 uid.iUid = EEikStatusPaneUidClock; |
|
695 subPane = statusPane->PaneCapabilities( uid ); |
|
696 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
697 { |
|
698 control = statusPane->ControlL( uid ); |
|
699 control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren ); |
|
700 } |
|
701 |
|
702 |
|
703 uid.iUid = EEikStatusPaneUidDigitalClock; |
|
704 subPane = statusPane->PaneCapabilities( uid ); |
|
705 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
706 { |
|
707 control = statusPane->ControlL( uid ); |
|
708 control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren ); |
|
709 } |
|
710 |
|
711 |
|
712 uid.iUid = EEikStatusPaneUidEmpty; |
|
713 subPane = statusPane->PaneCapabilities( uid ); |
|
714 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
715 { |
|
716 control = statusPane->ControlL( uid ); |
|
717 control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren ); |
|
718 } |
|
719 } |
|
720 |
|
721 |
|
722 |
|
723 TAlfTimedValue opacity; |
|
724 CAlfGradientBrush* brush(NULL); |
|
725 if ( faded ) |
|
726 { |
|
727 if (iFadeLayout->Brushes()) |
|
728 { |
|
729 if ( iFadeLayout->Brushes()->Count() <= 0 ) |
|
730 { |
|
731 TRgb color(240,240,240); |
|
732 brush = CAlfGradientBrush::NewL( iControl->Env() ); |
|
733 brush->SetColor( color ); |
|
734 brush->SetLayer(EAlfBrushLayerBackground); |
|
735 opacity.SetTarget( 0.55 , 0); |
|
736 brush->SetOpacity( opacity ); |
|
737 iFadeLayout->Brushes()->AppendL(brush,EAlfHasOwnership); |
|
738 } |
|
739 else |
|
740 { |
|
741 opacity.SetTarget( 0.55 , 0); |
|
742 brush = reinterpret_cast<CAlfGradientBrush*>(&iFadeLayout->Brushes()->At(0)); |
|
743 brush->SetOpacity( opacity ); |
|
744 } |
|
745 } |
|
746 } |
|
747 else |
|
748 { |
|
749 if (iFadeLayout->Brushes()) |
|
750 { |
|
751 opacity.SetTarget( 0.0 , 0); |
|
752 brush = reinterpret_cast<CAlfGradientBrush*>(&iFadeLayout->Brushes()->At(0)); |
|
753 brush->SetOpacity( opacity ); |
|
754 } |
|
755 } |
|
756 } |
|
757 |
|
758 |
|
759 // --------------------------------------------------------------------------- |
|
760 // C++ constructor. |
|
761 // --------------------------------------------------------------------------- |
|
762 // |
|
763 EXPORT_C CFsActionMenu::CFsActionMenu( CAlfDisplay& aDisplay ) |
|
764 : CFsTreeList( aDisplay.Env(), *iVisualizer ), //setting NULL visualizer, visualizer created in ConstructL |
|
765 iDisplay( &aDisplay ), |
|
766 iVPos( EFsVPosTop ), |
|
767 iCustVPos(0), |
|
768 iIsCustVPos( EFalse ), |
|
769 KListBorderPadding(5), |
|
770 iAmXPadd(5), |
|
771 iAmYPadd(5) |
|
772 { |
|
773 FUNC_LOG; |
|
774 |
|
775 } |
|
776 |
|
777 |
|
778 // --------------------------------------------------------------------------- |
|
779 // Second phase constructor. |
|
780 // --------------------------------------------------------------------------- |
|
781 // |
|
782 EXPORT_C void CFsActionMenu::ConstructL( TInt aCbaResource ) |
|
783 { |
|
784 FUNC_LOG; |
|
785 iWait = new ( ELeave ) CActiveSchedulerWait(); |
|
786 //create action list's control group |
|
787 //check if the group exists - take first free slot |
|
788 iCtrlGroup = &iDisplay->Env().NewControlGroupL( KFsGroupActionMenu ); |
|
789 |
|
790 iControl = new (ELeave) CFsActionMenuControl(this); |
|
791 // <cmail> Removed cleanup stack usage of mthe meber variables. </cmail> |
|
792 iControl->ConstructL( iDisplay->Env()); |
|
793 |
|
794 iFadeLayout = CAlfDeckLayout::AddNewL (*iControl); |
|
795 iFadeLayout->EnableBrushesL(); |
|
796 |
|
797 iRootLayout = CAlfDeckLayout::AddNewL (*iControl); |
|
798 // <cmail> Removed cleanup stack usage of mthe meber variables. </cmail> |
|
799 |
|
800 iRootLayout->SetFlag(EAlfVisualFlagManualLayout); |
|
801 iRootLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); |
|
802 |
|
803 |
|
804 //set initial pos/size - proper values set by ExecuteL |
|
805 iRootLayout->ClearFlag(EAlfVisualFlagLayoutUpdateNotification); |
|
806 iRootLayout->SetPos(TAlfRealPoint(30,15)); |
|
807 iRootLayout->SetSize(TSize ( 150, 100 ) ); |
|
808 iRootLayout->UpdateChildrenLayout(); |
|
809 iRootLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); |
|
810 iControl->SetRootVisual( iRootLayout ); |
|
811 |
|
812 /////////////////////////////////////// |
|
813 //DEBUG BORDER |
|
814 /* |
|
815 iRootLayout->EnableBrushesL( ETrue ); |
|
816 CAlfBorderBrush* border = CAlfBorderBrush::NewLC(aEnv,1, 1, 0, 0); |
|
817 border->SetColor(KRgbRed); |
|
818 iRootLayout->Brushes()->AppendL(border, EAlfHasOwnership); |
|
819 CleanupStack::Pop(border); |
|
820 */ |
|
821 /////////////////////////////////////// |
|
822 |
|
823 |
|
824 //create list's visualizer |
|
825 iVisualizer = CFsTreeVisualizerBase::NewL( iControl, *iRootLayout ); |
|
826 // <cmail> Removed cleanup stack usage of mthe meber variables. </cmail> |
|
827 //construct the list's base class |
|
828 CFsTreeList::SetTreeVisualizer( *iVisualizer ); |
|
829 CFsTreeList::ConstructL( iDisplay->Env() ); |
|
830 //use custom padding - turn off list's padding |
|
831 iVisualizer->EnableListPanePadding( EFalse ); |
|
832 //set some list's properties |
|
833 CFsTreeList::SetMarkTypeL( CFsTreeList::EFsTreeListNonMarkable ); |
|
834 CFsTreeList::SetLoopingType( EFsTreeListLoopingDisabled ); |
|
835 CFsTreeList::SetScrollTime( KFsActionMenuScrollTime, KFsActionMenuAccelerationRate ); |
|
836 //Observe the list. |
|
837 CFsTreeList::AddObserverL(*this); |
|
838 |
|
839 iCtrlGroup->AppendL( iControl ); |
|
840 iCtrlGroup->AppendL( this->TreeControl() ); |
|
841 |
|
842 iRootLayout->UpdateChildrenLayout(); |
|
843 |
|
844 //hide the list |
|
845 this->HideListL( EFalse, EFalse ); |
|
846 iDisplay->Roster().Hide( *iCtrlGroup ); |
|
847 |
|
848 //construct Cba buttons |
|
849 iButtonGroupContainer = CEikButtonGroupContainer::NewL( |
|
850 CEikButtonGroupContainer::ECba, |
|
851 CEikButtonGroupContainer::EHorizontal, |
|
852 this, aCbaResource ); |
|
853 //hide cba buttons |
|
854 iButtonGroupContainer->MakeVisible(EFalse); |
|
855 // <cmail> Removed cleanup stack usage of mthe meber variables. </cmail> |
|
856 } |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 //End Of File |
|
862 |