emailuis/uicomponents/src/fsactionmenu.cpp
branchRCL_3
changeset 64 3533d4323edc
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
       
     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, 
       
   230                                     const TFsTreeItemId /*aId*/,
       
   231                                     const TPoint& /*aPoint*/ )
       
   232     {
       
   233     FUNC_LOG;
       
   234 // </cmail>
       
   235     switch ( aEvent )
       
   236         {
       
   237         case MFsTreeListObserver::EFsTreeItemSelected:
       
   238             {
       
   239             iResult = EFsMenuItemSelected;
       
   240             DoDismissL(); // <cmail>
       
   241             break;
       
   242             }
       
   243         case MFsTreeListObserver::EFsTreeItemWithMenuSelected:
       
   244             {
       
   245             iResult = EFsMenuItemSelected;
       
   246             DoDismissL(); // <cmail>
       
   247             break;
       
   248             }
       
   249         case MFsTreeListObserver::EFsTreeListKeyRightArrow:
       
   250             {//right arrow click acts like "Cancel" in AH (mirrored) layouts
       
   251             if ( CFsLayoutManager::IsMirrored() )
       
   252                 {
       
   253                 iResult = EFsMenuDismissed;
       
   254                 DoDismissL(); // <cmail>
       
   255                 }
       
   256             break;
       
   257             }
       
   258         case MFsTreeListObserver::EFsTreeListKeyLeftArrow:
       
   259             {//left arrow click acts like "Cancel" in western layouts
       
   260             if ( !CFsLayoutManager::IsMirrored() )
       
   261                 {
       
   262             	iResult = EFsMenuDismissed;
       
   263 				DoDismissL(); // <cmail>
       
   264                 }
       
   265             break;
       
   266             }
       
   267         case MFsTreeListObserver::EFsTreeListHidden:
       
   268             {//list fully hidden -> remove from the roster;
       
   269             iDisplay->Roster().Hide( *iCtrlGroup );
       
   270             break;
       
   271             }
       
   272         case MFsTreeListObserver::EFsTreeListShown:
       
   273             {//list fully shown
       
   274             break;
       
   275             }
       
   276         }
       
   277     }
       
   278 
       
   279 
       
   280 // ---------------------------------------------------------------------------
       
   281 // Shows action menu's cba.
       
   282 // ---------------------------------------------------------------------------
       
   283 //
       
   284 void CFsActionMenu::ShowCbaButtonsL()
       
   285     {
       
   286     FUNC_LOG;
       
   287     iButtonGroupContainer->MakeVisible(ETrue);
       
   288     }
       
   289 
       
   290 
       
   291 // ---------------------------------------------------------------------------
       
   292 // Hides action menu's cba.
       
   293 // ---------------------------------------------------------------------------
       
   294 //
       
   295 void CFsActionMenu::HideCbaButtonsL()
       
   296     {
       
   297     FUNC_LOG;
       
   298     iButtonGroupContainer->MakeVisible(EFalse);
       
   299     }
       
   300     
       
   301 
       
   302 // ---------------------------------------------------------------------------
       
   303 // Executes action menu. 
       
   304 // ---------------------------------------------------------------------------
       
   305 //
       
   306 void CFsActionMenu::DoExecuteL()
       
   307     {
       
   308     FUNC_LOG;
       
   309     iRootLayout->ClearFlag(EAlfVisualFlagLayoutUpdateNotification);
       
   310     TAlfTimedValue opacity;
       
   311     opacity.SetValueNow(0.0);
       
   312     iRootLayout->SetOpacity(opacity);
       
   313        
       
   314     UpdateActionMenuWindowL( );
       
   315     SetFirstItemAsFocusedL( );
       
   316     ShowCbaButtonsL( );
       
   317     //////////////////////////////////////////
       
   318     iDisplay->Roster().ShowL( *iCtrlGroup );
       
   319     
       
   320     TBool fadeIn(EFalse), slideIn(EFalse);
       
   321         
       
   322     fadeIn = IsFadeIn();
       
   323     slideIn = IsSlideIn();
       
   324     
       
   325     this->ShowListL( fadeIn, slideIn );
       
   326 
       
   327     //show root layout
       
   328     opacity.SetValueNow(1.0);
       
   329     iRootLayout->SetOpacity(opacity);
       
   330     
       
   331     iRootLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification);
       
   332     
       
   333     StartWait();
       
   334     
       
   335     }
       
   336 
       
   337 
       
   338 // ---------------------------------------------------------------------------
       
   339 // Dismiss action menu. 
       
   340 // ---------------------------------------------------------------------------
       
   341 //
       
   342 void CFsActionMenu::DoDismissL()
       
   343     {
       
   344     FUNC_LOG;
       
   345     TBool fadeOut(EFalse), slideOut(EFalse);
       
   346     
       
   347     fadeOut = IsFadeOut();
       
   348     slideOut = IsSlideOut();
       
   349     this->HideListL( fadeOut, slideOut );
       
   350         
       
   351     //after the list is fully hidden we get a notification in TreeListEvent and
       
   352     //action menu is removed from roster
       
   353     
       
   354     StopWait();
       
   355     }
       
   356 
       
   357 
       
   358 // ---------------------------------------------------------------------------
       
   359 // 
       
   360 // ---------------------------------------------------------------------------
       
   361 //
       
   362 void CFsActionMenu::StartWait()
       
   363     {
       
   364     FUNC_LOG;
       
   365     iWait->Start();
       
   366     }
       
   367     
       
   368 
       
   369 // ---------------------------------------------------------------------------
       
   370 // 
       
   371 // ---------------------------------------------------------------------------
       
   372 //
       
   373 void CFsActionMenu::StopWait()
       
   374     {
       
   375     FUNC_LOG;
       
   376     if ( iWait->IsStarted() )
       
   377         {
       
   378         iWait->AsyncStop();
       
   379         }
       
   380     }
       
   381 
       
   382 
       
   383 // ---------------------------------------------------------------------------
       
   384 // The function sets size and position of Action Menu.
       
   385 // ---------------------------------------------------------------------------
       
   386 //
       
   387 void CFsActionMenu::UpdateActionMenuWindowL( )
       
   388     {
       
   389     FUNC_LOG;
       
   390     //AM's size
       
   391     SetAMSizeFromLayoutMgrL( );
       
   392     //AM's position
       
   393     CalculatePosition( );
       
   394     
       
   395     iVisualizer->SetPadding( TAlfBoxMetric(iAmXPadd, iAmXPadd, iAmYPadd, iAmYPadd) );        
       
   396     
       
   397     iRootLayout->SetSize( iSize, 0 );
       
   398     iRootLayout->SetPos( iPos, 0 );
       
   399     iRootLayout->UpdateChildrenLayout( 0 );
       
   400     }
       
   401 
       
   402 // ---------------------------------------------------------------------------
       
   403 // The function retrieves Action Menu's size from Layout Manager.
       
   404 // ---------------------------------------------------------------------------
       
   405 //
       
   406 void CFsActionMenu::SetAMSizeFromLayoutMgrL( )
       
   407     {
       
   408     FUNC_LOG;
       
   409     TInt count(0), variety(0);
       
   410     
       
   411     count = Count();
       
   412     if ( count <= 0 )
       
   413         {
       
   414         iSize.iWidth = 0;
       
   415         iSize.iHeight = 0;
       
   416         }
       
   417     else
       
   418         {
       
   419         variety = count + 1;//0-6 variety for 1-7 row AM
       
   420         if ( variety < 2 )
       
   421             {
       
   422             variety = 2; //lowest variety to avoid crashes
       
   423             }
       
   424         
       
   425         if ( count > 7 )
       
   426             {
       
   427             variety = 8; //highest variety
       
   428             SetScrollbarVisibilityL(EFsScrollbarShowAlways);
       
   429             }
       
   430         else
       
   431             {
       
   432             SetScrollbarVisibilityL(EFsScrollbarHideAlways);
       
   433             }
       
   434         
       
   435         TRect parentRect;
       
   436         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, parentRect );
       
   437 
       
   438         TRect clientRect;
       
   439         CFsLayoutManager::LayoutMetricsRect( parentRect, CFsLayoutManager::EFsLmMainPane, clientRect );
       
   440         
       
   441         CFsLayoutManager::TFsLayoutMetrics actionMenuMetrics(CFsLayoutManager::EFsLmPopupSpFsActionMenuPane);
       
   442         
       
   443         TRect actionMenuPopupRect;
       
   444         CFsLayoutManager::LayoutMetricsRect(
       
   445                         clientRect, //parent
       
   446                         actionMenuMetrics, //queried item
       
   447                         actionMenuPopupRect, // result
       
   448                         variety ); 
       
   449         
       
   450         iSize.iWidth = actionMenuPopupRect.Width();
       
   451         iSize.iHeight = actionMenuPopupRect.Height();
       
   452         iSize.iHeight += 1;
       
   453         }
       
   454 
       
   455     }
       
   456 
       
   457 
       
   458 // ---------------------------------------------------------------------------
       
   459 // The function calculates AM's position based on it's size and predefined vertical
       
   460 // position (top,center,bottom) or custom vertical position set by the user.
       
   461 // ---------------------------------------------------------------------------
       
   462 //
       
   463 void CFsActionMenu::CalculatePosition( )
       
   464     {
       
   465     FUNC_LOG;
       
   466     TRect clientRect;
       
   467     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, clientRect );    
       
   468      
       
   469     //horizontal position
       
   470     TRect amRect;
       
   471     if ( CFsLayoutManager::IsMirrored() )
       
   472         {
       
   473         amRect.iTl.iX = 0;
       
   474         }
       
   475     else
       
   476         {
       
   477         amRect.iTl.iX = clientRect.iBr.iX - iSize.iWidth;        
       
   478         }
       
   479     
       
   480     amRect.iBr.iX = amRect.iTl.iX + iSize.iWidth;
       
   481     
       
   482     //vertical position
       
   483     if ( iIsCustVPos )
       
   484         {
       
   485         amRect.iTl.iY = iCustVPos;
       
   486         amRect.iBr.iY = amRect.iTl.iY + iSize.iHeight;
       
   487         }
       
   488     else
       
   489         {
       
   490         switch ( iVPos )
       
   491             {
       
   492             case EFsVPosTop:
       
   493                 amRect.iTl.iY = 0;
       
   494                 amRect.iBr.iY = amRect.iTl.iY + iSize.iHeight;
       
   495                 break;
       
   496             case EFsVPosCenter:           
       
   497                 amRect.iTl.iY = (clientRect.Height() - iSize.iHeight) / 2;
       
   498                 amRect.iBr.iY = amRect.iTl.iY + iSize.iHeight;
       
   499                 break;
       
   500             case EFsVPosBottom:
       
   501             default:
       
   502                 amRect.iBr.iY = clientRect.Height();
       
   503                 amRect.iTl.iY = amRect.iBr.iY - iSize.iHeight;
       
   504                 break;
       
   505             }
       
   506         }
       
   507     
       
   508     iPos = amRect.iTl;
       
   509     }
       
   510 
       
   511 
       
   512 // ---------------------------------------------------------------------------
       
   513 // The function returns whether the slide in effect is set.
       
   514 // ---------------------------------------------------------------------------
       
   515 //
       
   516 TBool CFsActionMenu::IsSlideIn()
       
   517     {
       
   518     FUNC_LOG;
       
   519     TBool slideIn(EFalse);
       
   520     if ( iVisualizer->SlideInDirection() != MFsTreeVisualizer::ESlideNone && 
       
   521          iVisualizer->SlideInDuration() > 0 )
       
   522         {
       
   523         slideIn = ETrue;
       
   524         }
       
   525     else
       
   526         {
       
   527         slideIn = EFalse;
       
   528         }
       
   529     return slideIn;
       
   530     }
       
   531 
       
   532 
       
   533 // ---------------------------------------------------------------------------
       
   534 // The function returns whether the fade in effect is set.
       
   535 // ---------------------------------------------------------------------------
       
   536 //
       
   537 TBool CFsActionMenu::IsFadeIn()
       
   538     {
       
   539     FUNC_LOG;
       
   540     TBool fadeIn(EFalse);
       
   541     if ( iVisualizer->FadeInEffectTime() > 0 )
       
   542         {
       
   543         fadeIn = ETrue;
       
   544         }
       
   545     else
       
   546         {
       
   547         fadeIn = EFalse;
       
   548         }
       
   549     return fadeIn;
       
   550     }
       
   551 
       
   552 
       
   553 // ---------------------------------------------------------------------------
       
   554 // The function returns whether the slide out effect is set.
       
   555 // ---------------------------------------------------------------------------
       
   556 //
       
   557 TBool CFsActionMenu::IsSlideOut()
       
   558     {
       
   559     FUNC_LOG;
       
   560     TBool slideOut(EFalse);
       
   561     if ( iVisualizer->SlideOutDirection() != MFsTreeVisualizer::ESlideNone && 
       
   562          iVisualizer->SlideOutDuration() > 0 )
       
   563         {
       
   564         slideOut = ETrue;
       
   565         }
       
   566     else
       
   567         {
       
   568         slideOut = EFalse;
       
   569         }
       
   570     return slideOut;
       
   571     }
       
   572 
       
   573 
       
   574 // ---------------------------------------------------------------------------
       
   575 // The function returns whether the fade out effect is set.
       
   576 // ---------------------------------------------------------------------------
       
   577 //
       
   578 TBool CFsActionMenu::IsFadeOut()
       
   579     {
       
   580     FUNC_LOG;
       
   581     TBool fadeOut(EFalse);
       
   582     if ( iVisualizer->FadeOutEffectTime() > 0 )
       
   583         {
       
   584         fadeOut = ETrue;
       
   585         }
       
   586     else
       
   587         {
       
   588         fadeOut = EFalse;
       
   589         }
       
   590     return fadeOut;
       
   591     }
       
   592 
       
   593 
       
   594 // ---------------------------------------------------------------------------
       
   595 // The function sets first list item as focused.
       
   596 // ---------------------------------------------------------------------------
       
   597 //
       
   598 void CFsActionMenu::SetFirstItemAsFocusedL()
       
   599     {
       
   600     FUNC_LOG;
       
   601     const TInt KZero( 0 );
       
   602     
       
   603     if ( !IsEmpty( KFsTreeRootID ) )
       
   604         {
       
   605         TFsTreeItemId firstItemId( KFsTreeNoneID );
       
   606         
       
   607         firstItemId = Child( KFsTreeRootID, KZero );
       
   608         if ( firstItemId != KFsTreeNoneID )
       
   609             {
       
   610             iVisualizer->SetFocusedItemL( firstItemId );
       
   611             }
       
   612         }
       
   613     }
       
   614 
       
   615 
       
   616 // ---------------------------------------------------------------------------
       
   617 //  The function fades screen behind popup.
       
   618 // ---------------------------------------------------------------------------
       
   619 //
       
   620 void CFsActionMenu::FadeBehindActionMenuL( TBool aFaded ) // <cmail>
       
   621     {
       
   622     FUNC_LOG;
       
   623     TBool faded (aFaded);
       
   624     
       
   625     CEikStatusPane* statusPane =  CEikonEnv::Static()->AppUiFactory()->StatusPane();
       
   626    
       
   627     if ( statusPane )
       
   628         {
       
   629         CCoeControl* control(NULL);
       
   630         TUid uid;
       
   631         
       
   632         uid.iUid = EEikStatusPaneUidSignal;     
       
   633         CEikStatusPaneBase::TPaneCapabilities subPane = statusPane->PaneCapabilities(uid);
       
   634         subPane = statusPane->PaneCapabilities( uid );
       
   635         if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   636             {
       
   637             control = statusPane->ControlL( uid );
       
   638             control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren );
       
   639             }
       
   640         
       
   641         
       
   642         uid.iUid = EEikStatusPaneUidBattery;
       
   643         subPane = statusPane->PaneCapabilities( uid );
       
   644         if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   645             {
       
   646             control = statusPane->ControlL( uid );
       
   647             control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren );
       
   648             }
       
   649         
       
   650 
       
   651         uid.iUid = EEikStatusPaneUidContext;
       
   652         subPane = statusPane->PaneCapabilities( uid );
       
   653         if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   654             {
       
   655             control = statusPane->ControlL( uid );
       
   656             control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren );
       
   657             }
       
   658         
       
   659         
       
   660         uid.iUid = EEikStatusPaneUidTitle;
       
   661         subPane = statusPane->PaneCapabilities( uid );
       
   662         if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   663             {
       
   664             control = statusPane->ControlL( uid );
       
   665             control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren );
       
   666             }
       
   667         
       
   668 
       
   669         uid.iUid = EEikStatusPaneUidNavi;
       
   670         subPane = statusPane->PaneCapabilities( uid );
       
   671         if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   672             {
       
   673             control = statusPane->ControlL( uid );
       
   674             control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren );
       
   675             }
       
   676         
       
   677 
       
   678         uid.iUid = EEikStatusPaneUidIndic;
       
   679         subPane = statusPane->PaneCapabilities( uid );
       
   680         if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   681             {
       
   682             control = statusPane->ControlL( uid );
       
   683             control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren );
       
   684             }
       
   685         
       
   686 
       
   687         uid.iUid = EEikStatusPaneUidMessage;
       
   688         subPane = statusPane->PaneCapabilities( uid );
       
   689         if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   690             {
       
   691             control = statusPane->ControlL( uid );
       
   692             control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren );
       
   693             }
       
   694             
       
   695 
       
   696         uid.iUid = EEikStatusPaneUidClock;
       
   697         subPane = statusPane->PaneCapabilities( uid );
       
   698         if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   699             {
       
   700             control = statusPane->ControlL( uid );
       
   701             control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren );
       
   702             }
       
   703         
       
   704         
       
   705         uid.iUid = EEikStatusPaneUidDigitalClock;
       
   706         subPane = statusPane->PaneCapabilities( uid );
       
   707         if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   708             {
       
   709             control = statusPane->ControlL( uid );
       
   710             control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren );
       
   711             }
       
   712         
       
   713         
       
   714         uid.iUid = EEikStatusPaneUidEmpty;
       
   715         subPane = statusPane->PaneCapabilities( uid );    
       
   716         if ( subPane.IsPresent() && subPane.IsAppOwned() )
       
   717             {
       
   718             control = statusPane->ControlL( uid );
       
   719             control->DrawableWindow()->SetFaded( faded, RWindowTreeNode::EFadeIncludeChildren );
       
   720             }
       
   721         }
       
   722     
       
   723     
       
   724 
       
   725     TAlfTimedValue opacity;
       
   726     CAlfGradientBrush* brush(NULL);    
       
   727     if ( faded )
       
   728         {
       
   729         if (iFadeLayout->Brushes())
       
   730             {
       
   731             if ( iFadeLayout->Brushes()->Count() <= 0 )
       
   732                 {
       
   733                 TRgb color(240,240,240);
       
   734                 brush = CAlfGradientBrush::NewL( iControl->Env() );
       
   735                 brush->SetColor( color );
       
   736                 brush->SetLayer(EAlfBrushLayerBackground);
       
   737                 opacity.SetTarget( 0.55 , 0);
       
   738                 brush->SetOpacity( opacity );            
       
   739                 iFadeLayout->Brushes()->AppendL(brush,EAlfHasOwnership);
       
   740                 }
       
   741             else
       
   742                 {
       
   743                 opacity.SetTarget( 0.55 , 0);
       
   744                 brush = reinterpret_cast<CAlfGradientBrush*>(&iFadeLayout->Brushes()->At(0));
       
   745                 brush->SetOpacity( opacity );
       
   746                 }
       
   747             }        
       
   748         }
       
   749     else
       
   750         {
       
   751         if (iFadeLayout->Brushes())
       
   752             {
       
   753             opacity.SetTarget( 0.0 , 0);
       
   754             brush = reinterpret_cast<CAlfGradientBrush*>(&iFadeLayout->Brushes()->At(0));
       
   755             brush->SetOpacity( opacity );
       
   756             }
       
   757         }    
       
   758     }
       
   759 
       
   760 
       
   761 // ---------------------------------------------------------------------------
       
   762 //  C++ constructor.
       
   763 // ---------------------------------------------------------------------------
       
   764 //
       
   765 EXPORT_C CFsActionMenu::CFsActionMenu( CAlfDisplay& aDisplay )
       
   766 : CFsTreeList( aDisplay.Env(), *iVisualizer ), //setting NULL visualizer, visualizer created in ConstructL
       
   767   iDisplay( &aDisplay ),
       
   768   iVPos( EFsVPosTop ),
       
   769   iCustVPos(0),
       
   770   iIsCustVPos( EFalse ), 
       
   771   KListBorderPadding(5),
       
   772   iAmXPadd(5),
       
   773   iAmYPadd(5)
       
   774     {
       
   775     FUNC_LOG;
       
   776     
       
   777     }    
       
   778 
       
   779 
       
   780 // ---------------------------------------------------------------------------
       
   781 //  Second phase constructor.
       
   782 // ---------------------------------------------------------------------------
       
   783 //
       
   784 EXPORT_C void CFsActionMenu::ConstructL( TInt aCbaResource )
       
   785     {
       
   786     FUNC_LOG;
       
   787     iWait = new ( ELeave ) CActiveSchedulerWait();
       
   788     //create action list's control group
       
   789     //check if the group exists - take first free slot
       
   790     iCtrlGroup = &iDisplay->Env().NewControlGroupL( KFsGroupActionMenu );
       
   791     
       
   792     iControl = new (ELeave) CFsActionMenuControl(this);
       
   793     // <cmail> Removed cleanup stack usage of mthe meber variables. </cmail>
       
   794     iControl->ConstructL( iDisplay->Env());
       
   795     
       
   796     iFadeLayout = CAlfDeckLayout::AddNewL (*iControl);
       
   797     iFadeLayout->EnableBrushesL();
       
   798     
       
   799     iRootLayout = CAlfDeckLayout::AddNewL (*iControl);
       
   800     // <cmail> Removed cleanup stack usage of mthe meber variables. </cmail>
       
   801 
       
   802     iRootLayout->SetFlag(EAlfVisualFlagManualLayout);
       
   803     iRootLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification);
       
   804     
       
   805     
       
   806     //set initial pos/size - proper values set by ExecuteL
       
   807     iRootLayout->ClearFlag(EAlfVisualFlagLayoutUpdateNotification);
       
   808     iRootLayout->SetPos(TAlfRealPoint(30,15));
       
   809     iRootLayout->SetSize(TSize ( 150, 100 ) );
       
   810     iRootLayout->UpdateChildrenLayout();
       
   811     iRootLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification);
       
   812     iControl->SetRootVisual( iRootLayout );
       
   813 
       
   814     ///////////////////////////////////////
       
   815     //DEBUG BORDER
       
   816     /*
       
   817     iRootLayout->EnableBrushesL( ETrue );
       
   818     CAlfBorderBrush* border = CAlfBorderBrush::NewLC(aEnv,1, 1, 0, 0);
       
   819     border->SetColor(KRgbRed);
       
   820     iRootLayout->Brushes()->AppendL(border, EAlfHasOwnership);
       
   821     CleanupStack::Pop(border);
       
   822     */
       
   823     ///////////////////////////////////////
       
   824 
       
   825     
       
   826     //create list's visualizer
       
   827     iVisualizer = CFsTreeVisualizerBase::NewL( iControl, *iRootLayout );
       
   828     // <cmail> Removed cleanup stack usage of mthe meber variables. </cmail>
       
   829     //construct the list's base class
       
   830     CFsTreeList::SetTreeVisualizer( *iVisualizer );
       
   831     CFsTreeList::ConstructL( iDisplay->Env() );
       
   832     //use custom padding - turn off list's padding
       
   833     iVisualizer->EnableListPanePadding( EFalse );
       
   834     //set some list's properties
       
   835     CFsTreeList::SetMarkTypeL( CFsTreeList::EFsTreeListNonMarkable );
       
   836     CFsTreeList::SetLoopingType( EFsTreeListLoopingDisabled );
       
   837     CFsTreeList::SetScrollTime( KFsActionMenuScrollTime, KFsActionMenuAccelerationRate );
       
   838     //Observe the list.
       
   839     CFsTreeList::AddObserverL(*this);
       
   840     
       
   841     iCtrlGroup->AppendL( iControl );
       
   842     iCtrlGroup->AppendL( this->TreeControl() );    
       
   843     
       
   844     iRootLayout->UpdateChildrenLayout();
       
   845     
       
   846     //hide the list
       
   847     this->HideListL( EFalse, EFalse );       
       
   848     iDisplay->Roster().Hide( *iCtrlGroup );
       
   849     
       
   850     //construct Cba buttons
       
   851     iButtonGroupContainer = CEikButtonGroupContainer::NewL( 
       
   852             CEikButtonGroupContainer::ECba,
       
   853             CEikButtonGroupContainer::EHorizontal,
       
   854             this, aCbaResource );
       
   855     //hide cba buttons
       
   856     iButtonGroupContainer->MakeVisible(EFalse);
       
   857     // <cmail> Removed cleanup stack usage of mthe meber variables. </cmail>
       
   858     }
       
   859 
       
   860 
       
   861 
       
   862 
       
   863 //End Of File
       
   864