uifw/AvKon/src/aknnavi.cpp
changeset 0 2f259fa3e83a
child 3 8ca85d2f0db7
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of the navi pane container control.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // SYSTEM INCLUDE FILES
       
    20 #include <eikfutil.h>
       
    21 #include <eiklabel.h>
       
    22 #include <eikimage.h>
       
    23 #include <layoutmetadata.cdl.h>
       
    24 #include <aknlayoutscalable_avkon.cdl.h>
       
    25 #include <fbs.h>
       
    26 #include <avkon.rsg>
       
    27 #include <centralrepository.h>
       
    28 #include <AknSkinsInternalCRKeys.h>
       
    29 #include <AknsDrawUtils.h>
       
    30 #include <AknsLayeredBackgroundControlContext.h>
       
    31 #include <mifconvdefs.h>
       
    32 #include <akniconconfig.h>
       
    33 
       
    34 #include <AknTasHook.h>
       
    35 // USER INCLUDE FILES
       
    36 #include "aknenv.h"
       
    37 #include "AknDef.h"
       
    38 #include "aknappui.h"
       
    39 #include "aknconsts.h"
       
    40 #include "akntabgrp.h"
       
    41 #include "aknnavide.h"
       
    42 #include "AknIndicatorContainer.h"
       
    43 #include "AknVolumePopup.h"
       
    44 #include "AknUtils.h"
       
    45 #include "AknBitmapMirrorUtils.h"
       
    46 #include "avkon.hrh"
       
    47 #include "aknnavi.h"
       
    48 #include "aknnavilabel.h"
       
    49 #include "akncontext.h"
       
    50 #include "AknSignalNotify.h"
       
    51 #include "AknNaviForegroundObserver.h"
       
    52 #include "AknNaviConstants.h"
       
    53 #include "aknEditStateIndicator.h"
       
    54 #include "AknStatuspaneUtils.h"
       
    55 #include "akntitle.h"
       
    56 #include "AknTitlePaneLabel.h"
       
    57 #include "AknDebug.h"
       
    58 
       
    59 const TInt KAknNaviPaneStackGranularity = 2;
       
    60 /**
       
    61 * Extension class for CAknNavigationControlContainer.
       
    62 */
       
    63 class CAknNavigationControlContainerExtension : public CBase
       
    64     {
       
    65 public:
       
    66     CAknNavigationControlContainerExtension(){};
       
    67     ~CAknNavigationControlContainerExtension(){};
       
    68 
       
    69 public:
       
    70     TInt                        iCurrentColorScheme;
       
    71     CAknNaviForegroundObserver* iForegroundObserver;
       
    72     TBool                       iDestructionOngoing;
       
    73     CFbsBitmap*                 iNaviColorBitmap;
       
    74     TInt                        iPreferredNaviDecoratorLayoutStyle;
       
    75     TBool                       iIsActiveIdle;
       
    76     };
       
    77 
       
    78 
       
    79 
       
    80 // ----------------------------------------------------------------------------
       
    81 // CAknNavigationControlContainer::CAknNavigationControlContainer
       
    82 // Default constructor.
       
    83 // ----------------------------------------------------------------------------
       
    84 //
       
    85 EXPORT_C CAknNavigationControlContainer::CAknNavigationControlContainer() :
       
    86     iStatusPane( CEikStatusPaneBase::Current() )
       
    87     {
       
    88     AKNTASHOOK_ADD( this, "CAknNavigationControlContainer" );
       
    89     }
       
    90 
       
    91 
       
    92 // ----------------------------------------------------------------------------
       
    93 // CAknNavigationControlContainer::~CAknNavigationControlContainer
       
    94 // Destructor.
       
    95 // ----------------------------------------------------------------------------
       
    96 //
       
    97 EXPORT_C CAknNavigationControlContainer::~CAknNavigationControlContainer()
       
    98     {
       
    99     AKNTASHOOK_REMOVE();
       
   100     if ( iExtension )
       
   101         {
       
   102         iExtension->iDestructionOngoing = ETrue;
       
   103         }
       
   104 
       
   105     AknsUtils::DeregisterControlPosition( this );
       
   106 
       
   107     delete iNaviDecoratorFromResource;
       
   108 
       
   109     if ( iNaviPaneControls )
       
   110         {
       
   111         const TInt last = iNaviPaneControls->Count() - 1;
       
   112         TInt ii = 0;
       
   113         for ( ii = last; ii >= 0; ii-- )
       
   114             {
       
   115             Pop( iNaviPaneControls->At( ii ) );
       
   116             }
       
   117         delete iNaviPaneControls;
       
   118         }
       
   119 
       
   120     for ( TInt jj = 0; jj < 4; jj++ )
       
   121         {
       
   122         delete iNaviArrowBitmap[ jj ];
       
   123         }
       
   124 
       
   125     if ( iExtension )
       
   126         {
       
   127         delete iExtension->iForegroundObserver;
       
   128         delete iExtension->iNaviColorBitmap;
       
   129         delete iExtension;
       
   130         }
       
   131     }
       
   132 
       
   133 
       
   134 // ----------------------------------------------------------------------------
       
   135 // CAknNavigationControlContainer::ConstructL
       
   136 // Second-phase constructor.
       
   137 // ----------------------------------------------------------------------------
       
   138 //
       
   139 EXPORT_C void CAknNavigationControlContainer::ConstructL()
       
   140     {
       
   141     if ( !iExtension )
       
   142         {
       
   143         iExtension =
       
   144             new (ELeave) CAknNavigationControlContainerExtension();
       
   145         iExtension->iCurrentColorScheme = ColorScheme();
       
   146         iExtension->iForegroundObserver =
       
   147             CAknNaviForegroundObserver::NewL( this );
       
   148         iExtension->iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle();
       
   149         }
       
   150 
       
   151     if ( !iNaviPaneControls )
       
   152         {
       
   153         iNaviPaneControls =
       
   154             new (ELeave) CAknNaviPaneStack( KAknNaviPaneStackGranularity );
       
   155         }
       
   156 
       
   157     // creating color bitmap
       
   158     LoadNaviColorBitmapL();
       
   159 
       
   160     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   161 
       
   162     AknsUtils::CreateIconL( skin,
       
   163                             KAknsIIDQgnIndiNaviArrowLeft,
       
   164                             iNaviArrowBitmap[ 0 ],
       
   165                             iNaviArrowBitmap[ 1 ],
       
   166                             KAvkonBitmapFile,
       
   167                             EMbmAvkonQgn_indi_navi_arrow_left,
       
   168                             EMbmAvkonQgn_indi_navi_arrow_left_mask );
       
   169 
       
   170     AknsUtils::CreateIconL( skin,
       
   171                             KAknsIIDQgnIndiNaviArrowRight,
       
   172                             iNaviArrowBitmap[ 2 ],
       
   173                             iNaviArrowBitmap[ 3 ],
       
   174                             KAvkonBitmapFile,
       
   175                             EMbmAvkonQgn_indi_navi_arrow_right,
       
   176                             EMbmAvkonQgn_indi_navi_arrow_right_mask );
       
   177 
       
   178     }
       
   179 
       
   180 
       
   181 // ----------------------------------------------------------------------------
       
   182 // CAknNavigationControlContainer::ConstructFromResourceL
       
   183 // Resource constructor.
       
   184 // ----------------------------------------------------------------------------
       
   185 //
       
   186 EXPORT_C void CAknNavigationControlContainer::ConstructFromResourceL(
       
   187     TResourceReader& aReader )
       
   188     {
       
   189     ConstructL();
       
   190     iNaviDecoratorFromResource =
       
   191         ConstructNavigationDecoratorFromResourceL( aReader );
       
   192     if ( iNaviDecoratorFromResource )
       
   193         {
       
   194         PushL( *iNaviDecoratorFromResource );
       
   195         }
       
   196     }
       
   197 
       
   198 
       
   199 // ----------------------------------------------------------------------------
       
   200 // CAknNavigationControlContainer::ConstructNavigationDecoratorFromResourceL
       
   201 // Creates a decorated navi pane control from resource.
       
   202 // ----------------------------------------------------------------------------
       
   203 //
       
   204 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::ConstructNavigationDecoratorFromResourceL(
       
   205     TResourceReader& aReader )
       
   206     {
       
   207     TInt controlType = aReader.ReadInt16(); // type
       
   208     CAknNavigationDecorator* decoratedNaviObject = NULL;
       
   209 
       
   210     switch ( controlType )
       
   211         {
       
   212         case ENaviDecoratorControlNone:
       
   213             {
       
   214             PushDefaultL();
       
   215             break;
       
   216             }
       
   217 
       
   218         case ENaviDecoratorControlTabGroup:
       
   219             {
       
   220             decoratedNaviObject  = CreateTabGroupL( aReader );
       
   221             break;
       
   222             }
       
   223 
       
   224         case ENaviDecoratorLabel:
       
   225             {
       
   226             decoratedNaviObject  = CreateNavigationLabelL( aReader );
       
   227             break;
       
   228             }
       
   229 
       
   230         case ENaviDecoratorImage:
       
   231             {
       
   232             decoratedNaviObject  = CreateNavigationImageL( aReader );
       
   233             break;
       
   234             }
       
   235 
       
   236         case ENaviDecoratorToolTip:
       
   237             {
       
   238             decoratedNaviObject  = CreateMessageLabelL( aReader );
       
   239             break;
       
   240             }
       
   241 
       
   242         default:
       
   243             {
       
   244             break;
       
   245             }
       
   246         }
       
   247 
       
   248     return decoratedNaviObject;
       
   249     }
       
   250 
       
   251 
       
   252 // ----------------------------------------------------------------------------
       
   253 // CAknNavigationControlContainer::CreateTabGroupL
       
   254 // Creates a decorated tab group control to use in navi pane.
       
   255 // ----------------------------------------------------------------------------
       
   256 //
       
   257 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateTabGroupL()
       
   258     {
       
   259     TBool penEnabled( AknLayoutUtils::PenEnabled() );
       
   260 
       
   261     CAknTabGroup* tabGroup = CAknTabGroup::NewL( *this );
       
   262 
       
   263     // Tab group to the clean up stack in first line of NewL function.
       
   264     CAknNavigationDecorator* decoratedTabGroup =
       
   265         CAknNavigationDecorator::NewL( this,
       
   266                                        tabGroup,
       
   267                                        CAknNavigationDecorator::ETabGroup );
       
   268 
       
   269     if ( penEnabled )
       
   270         {
       
   271         // Set tab group as an observer of the decorator for right/left
       
   272         // arrows tapping.
       
   273         decoratedTabGroup->SetNaviDecoratorObserver( tabGroup );
       
   274         }
       
   275 
       
   276     CleanupStack::PushL( decoratedTabGroup );
       
   277 
       
   278     decoratedTabGroup->SetContainerWindowL( *this );
       
   279 
       
   280     // Navi arrows are not used for tab group in touch layouts.
       
   281     decoratedTabGroup->MakeScrollButtonVisible( !penEnabled );
       
   282 
       
   283     tabGroup->SetRect(
       
   284         CAknNavigationDecorator::DecoratedTabControlRect(
       
   285             !AknStatuspaneUtils::UsualLayoutActive(),
       
   286             !penEnabled ) );
       
   287 
       
   288     CleanupStack::Pop( decoratedTabGroup );
       
   289 
       
   290     decoratedTabGroup->SetObserver( this );
       
   291 
       
   292     return decoratedTabGroup;
       
   293     }
       
   294 
       
   295 
       
   296 // ----------------------------------------------------------------------------
       
   297 // CAknNavigationControlContainer::CreateTabGroupL
       
   298 // Creates a decorated tab group control to use in navi pane.
       
   299 // ----------------------------------------------------------------------------
       
   300 //
       
   301 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateTabGroupL(
       
   302     MAknTabObserver *aObserver )
       
   303     {
       
   304     CAknNavigationDecorator* navDec = CreateTabGroupL();
       
   305     CAknTabGroup* tabGroup =
       
   306         static_cast<CAknTabGroup*>( navDec->DecoratedControl() );
       
   307     tabGroup->SetObserver( aObserver );
       
   308 
       
   309     return navDec;
       
   310     }
       
   311 
       
   312 
       
   313 // ----------------------------------------------------------------------------
       
   314 // CAknNavigationControlContainer::CreateTabGroupL
       
   315 // Creates a decorated tab group control to use in navi pane.
       
   316 // ----------------------------------------------------------------------------
       
   317 //
       
   318 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateTabGroupL(
       
   319     TResourceReader& aReader, MAknTabObserver* aObserver )
       
   320     {
       
   321     CAknNavigationDecorator *navDec = CreateTabGroupL( aReader );
       
   322 
       
   323     CAknTabGroup* tabGroup =
       
   324         static_cast<CAknTabGroup*>( navDec->DecoratedControl() );
       
   325     tabGroup->SetObserver( aObserver );
       
   326 
       
   327     return navDec;
       
   328     }
       
   329 
       
   330 
       
   331 // ----------------------------------------------------------------------------
       
   332 // CAknNavigationControlContainer::CreateTabGroupL
       
   333 // Creates a decorated tab group control to use in navi pane.
       
   334 // ----------------------------------------------------------------------------
       
   335 //
       
   336 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateTabGroupL(
       
   337     TResourceReader& aReader)
       
   338     {
       
   339     CAknNavigationDecorator* decoratedTabGroup;
       
   340     decoratedTabGroup  = CreateTabGroupL();
       
   341     CleanupStack::PushL( decoratedTabGroup );
       
   342 
       
   343     CAknTabGroup* tabGroup =
       
   344         static_cast<CAknTabGroup*>( decoratedTabGroup->DecoratedControl() );
       
   345 
       
   346     TInt width = aReader.ReadInt16();
       
   347     tabGroup->SetTabFixedWidthL( width );
       
   348     TInt activeIndex = aReader.ReadInt16();
       
   349 
       
   350     TInt count = aReader.ReadInt16(); // Tab count
       
   351     for ( TInt ii = 0; ii < count; ii++ )
       
   352         {
       
   353         tabGroup->AddTabL( aReader );
       
   354         }
       
   355     tabGroup->SetActiveTabByIndex( activeIndex );
       
   356 
       
   357     CleanupStack::Pop( decoratedTabGroup );
       
   358     return decoratedTabGroup;
       
   359     }
       
   360 
       
   361 
       
   362 // ----------------------------------------------------------------------------
       
   363 // CAknNavigationControlContainer::CreateNavigationLabelL
       
   364 // Creates a decorated navigation label control to use in navi pane.
       
   365 // ----------------------------------------------------------------------------
       
   366 //
       
   367 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateNavigationLabelL(
       
   368     const TDesC& aText )
       
   369     {
       
   370     CAknNaviLabel* label = new (ELeave) CAknNaviLabel;
       
   371     CleanupStack::PushL( label );
       
   372 
       
   373     label->SetContainerWindowL( *this );
       
   374     label->SetTextL( aText );
       
   375     label->SetNaviLabelType( CAknNaviLabel::EAdditionalInfoLabel );
       
   376 
       
   377     CleanupStack::Pop( label );
       
   378     CAknNavigationDecorator* decoratedLabel =
       
   379         CAknNavigationDecorator::NewL( this,
       
   380                                        label,
       
   381                                        CAknNavigationDecorator::ENaviLabel );
       
   382     CleanupStack::PushL( decoratedLabel );
       
   383 
       
   384     decoratedLabel->SetContainerWindowL( *this );
       
   385     decoratedLabel->SetControlContext( this );
       
   386     decoratedLabel->MakeScrollButtonVisible( EFalse );
       
   387 
       
   388     CleanupStack::Pop( decoratedLabel );
       
   389 
       
   390     return decoratedLabel;
       
   391     }
       
   392 
       
   393 
       
   394 // ----------------------------------------------------------------------------
       
   395 // CAknNavigationControlContainer::CreateNavigationLabelL
       
   396 // Creates a decorated navigation label control to use in navi pane.
       
   397 // ----------------------------------------------------------------------------
       
   398 //
       
   399 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateNavigationLabelL(
       
   400     TResourceReader& aReader )
       
   401     {
       
   402     HBufC* txt = aReader.ReadHBufCL();  // Label text
       
   403     CAknNavigationDecorator* decoratedLabel = NULL;
       
   404 
       
   405     if ( txt )
       
   406         {
       
   407         CleanupStack::PushL( txt );
       
   408         decoratedLabel = CreateNavigationLabelL( *txt );
       
   409         CleanupStack::PopAndDestroy( txt );
       
   410         }
       
   411     else
       
   412         {
       
   413         decoratedLabel = CreateNavigationLabelL( KNullDesC );
       
   414         }
       
   415 
       
   416     return decoratedLabel;
       
   417     }
       
   418 
       
   419 
       
   420 // ----------------------------------------------------------------------------
       
   421 // CAknNavigationControlContainer::CreateNavigationImageL
       
   422 // Creates a decorated navigation image control to use in navi pane.
       
   423 // ----------------------------------------------------------------------------
       
   424 //
       
   425 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateNavigationImageL(
       
   426     const CFbsBitmap* aBitmap, const CFbsBitmap* aMaskBitmap )
       
   427     {
       
   428     CEikImage* image = new (ELeave) CEikImage;
       
   429     CleanupStack::PushL( image );
       
   430 
       
   431     image->SetContainerWindowL( *this );
       
   432 
       
   433     TAknWindowComponentLayout layout;
       
   434     if ( AknStatuspaneUtils::StaconPaneActive() )
       
   435         {
       
   436         layout = TAknWindowComponentLayout::Compose(
       
   437                     AknLayoutScalable_Avkon::navi_navi_pane_stacon( 1 ),
       
   438                     AknLayoutScalable_Avkon::navi_navi_icon_text_pane() );
       
   439         }
       
   440     else
       
   441         {
       
   442         layout = TAknWindowComponentLayout::Compose(
       
   443                     AknLayoutScalable_Avkon::navi_navi_pane(),
       
   444                     AknLayoutScalable_Avkon::navi_navi_icon_text_pane() );
       
   445         }
       
   446 
       
   447     TRect parent( Rect() );
       
   448     TAknLayoutRect imageLayoutRect;
       
   449     imageLayoutRect.LayoutRect( parent, layout );
       
   450     TRect imageRect( imageLayoutRect.Rect() );
       
   451 
       
   452     image->SetRect( imageRect );
       
   453 
       
   454     image->SetPictureOwnedExternally( ETrue );
       
   455     image->SetPicture( aBitmap, aMaskBitmap );
       
   456     CleanupStack::Pop( image );
       
   457 
       
   458     CAknNavigationDecorator* decoratedImage =
       
   459         CAknNavigationDecorator::NewL( this,
       
   460                                        image,
       
   461                                        CAknNavigationDecorator::ENaviImage );
       
   462 
       
   463     CleanupStack::PushL( decoratedImage );
       
   464     decoratedImage->SetContainerWindowL( *this );
       
   465     CleanupStack::Pop( decoratedImage );
       
   466 
       
   467     decoratedImage->MakeScrollButtonVisible( EFalse );
       
   468 
       
   469     // Ownership of aBitmap and aMaskBitmap is moved to decoratedImage object
       
   470     // after all leaving methods.
       
   471     image->SetPictureOwnedExternally( EFalse );
       
   472     return decoratedImage;
       
   473     }
       
   474 
       
   475 
       
   476 // ----------------------------------------------------------------------------
       
   477 // CAknNavigationControlContainer::CreateNavigationImageL
       
   478 // Creates a decorated navigation image control to use in navi pane.
       
   479 // ----------------------------------------------------------------------------
       
   480 //
       
   481 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateNavigationImageL(
       
   482     TResourceReader& aReader )
       
   483     {
       
   484     CAknNavigationDecorator* decoratedLabel = NULL;
       
   485 
       
   486     HBufC* bitmapFile = aReader.ReadHBufCL(); // bmp filename
       
   487     TInt   bitmapId   = aReader.ReadInt16();  // bmp id
       
   488     TInt   maskId     = aReader.ReadInt16();  // bmp mask id
       
   489 
       
   490     if ( bitmapFile )
       
   491         {
       
   492         CleanupStack::PushL( bitmapFile );
       
   493 
       
   494         TFileName fileName( *bitmapFile );
       
   495         CompleteWithAppPath( fileName );
       
   496 
       
   497         if ( bitmapId != KErrNotFound )
       
   498             {
       
   499             CFbsBitmap* bitmap;
       
   500 
       
   501             if ( maskId != KErrNotFound )
       
   502                 {
       
   503                 CFbsBitmap* mask;
       
   504                 AknIconUtils::CreateIconL( bitmap,
       
   505                                            mask,
       
   506                                            fileName,
       
   507                                            bitmapId,
       
   508                                            maskId );
       
   509 
       
   510                 TAknLayoutRect rect;
       
   511 
       
   512                 TAknWindowComponentLayout layout;
       
   513                 if ( AknStatuspaneUtils::StaconPaneActive() )
       
   514                     {
       
   515                     layout = TAknWindowComponentLayout::Compose(
       
   516                                 AknLayoutScalable_Avkon::navi_navi_pane(),
       
   517                                 AknLayoutScalable_Avkon::navi_navi_tabs_pane() );
       
   518                     }
       
   519                 else
       
   520                     {
       
   521                     layout = AknLayoutScalable_Avkon::navi_navi_tabs_pane();
       
   522                     }
       
   523 
       
   524                 rect.LayoutRect( Rect(), layout );
       
   525 
       
   526                 AknIconUtils::SetSize( bitmap, rect.Rect().Size() );
       
   527 
       
   528                 decoratedLabel = CreateNavigationImageL( bitmap, mask );
       
   529                 }
       
   530             else
       
   531                 {
       
   532                 bitmap = AknIconUtils::CreateIconL( fileName, bitmapId );
       
   533                 TAknLayoutRect rect;
       
   534 
       
   535                 TAknWindowComponentLayout layout;
       
   536                 if ( AknStatuspaneUtils::StaconPaneActive() )
       
   537                     {
       
   538                     layout = TAknWindowComponentLayout::Compose(
       
   539                                 AknLayoutScalable_Avkon::navi_navi_pane(),
       
   540                                 AknLayoutScalable_Avkon::navi_navi_tabs_pane() );
       
   541                     }
       
   542                 else
       
   543                     {
       
   544                     layout = AknLayoutScalable_Avkon::navi_navi_tabs_pane();
       
   545                     }
       
   546 
       
   547                 rect.LayoutRect( Rect(), layout );
       
   548                 AknIconUtils::SetSize( bitmap, rect.Rect().Size() );
       
   549 
       
   550                 decoratedLabel = CreateNavigationImageL( bitmap );
       
   551                 }
       
   552             }
       
   553         CleanupStack::PopAndDestroy( bitmapFile );
       
   554         }
       
   555 
       
   556     return decoratedLabel;
       
   557     }
       
   558 
       
   559 
       
   560 // ----------------------------------------------------------------------------
       
   561 // CAknNavigationControlContainer::CreateMessageLabelL
       
   562 // Creates a decorated message label control to use in navi pane.
       
   563 // ----------------------------------------------------------------------------
       
   564 //
       
   565 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateMessageLabelL(
       
   566     const TDesC& aText )
       
   567     {
       
   568     CAknNavigationDecorator* decoratedLabel = CreateNavigationLabelL( aText );
       
   569 
       
   570     CAknNaviLabel* label = STATIC_CAST( CAknNaviLabel*,
       
   571                                         decoratedLabel->DecoratedControl() );
       
   572 
       
   573     label->SetNaviLabelType( CAknNaviLabel::EHintText );
       
   574 
       
   575     decoratedLabel->SetControlType( CAknNavigationDecorator::EHintText );
       
   576 
       
   577     return decoratedLabel;
       
   578     }
       
   579 
       
   580 
       
   581 // ----------------------------------------------------------------------------
       
   582 // CAknNavigationControlContainer::CreateMessageLabelL
       
   583 // Creates a decorated message label control to use in navi pane.
       
   584 // ----------------------------------------------------------------------------
       
   585 //
       
   586 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateMessageLabelL(
       
   587     TResourceReader& aReader )
       
   588     {
       
   589     HBufC* txt = aReader.ReadHBufCL();  // message text
       
   590     CAknNavigationDecorator* decoratedLabel = NULL;
       
   591     if ( txt )
       
   592         {
       
   593         CleanupStack::PushL( txt );
       
   594         decoratedLabel = CreateMessageLabelL( *txt );
       
   595         CleanupStack::PopAndDestroy( txt );
       
   596         }
       
   597     else
       
   598         {
       
   599         decoratedLabel = CreateMessageLabelL( KNullDesC );
       
   600         }
       
   601     return decoratedLabel;
       
   602     }
       
   603 
       
   604 
       
   605 // ----------------------------------------------------------------------------
       
   606 // CAknNavigationControlContainer::CreateVolumeIndicatorL
       
   607 // Deprecated, creates a volume popup control.
       
   608 // ----------------------------------------------------------------------------
       
   609 //
       
   610 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateVolumeIndicatorL(
       
   611     TInt aResourceId )
       
   612     {
       
   613     // Navi pane volume control is no longer supported from release 5.0 on,
       
   614     // but to maintain BC a volume popup control is launched instead.
       
   615     CAknVolumePopup* volumeIndicator =
       
   616         CAknVolumePopup::ConstructFromResourceL( aResourceId );
       
   617     
       
   618     CleanupStack::PushL( volumeIndicator );
       
   619     
       
   620     CAknNavigationDecorator* decoratedVolumeIndicator =
       
   621         CAknNavigationDecorator::NewL( this,
       
   622                                        volumeIndicator,
       
   623                                        CAknNavigationDecorator::ENaviVolume );
       
   624     
       
   625     // Set the volume popup's position.    
       
   626     volumeIndicator->SetRect( VolumePopupRect() );
       
   627                                        
       
   628     CleanupStack::Pop( volumeIndicator );
       
   629 
       
   630     return decoratedVolumeIndicator;
       
   631     }
       
   632 
       
   633 
       
   634 // ----------------------------------------------------------------------------
       
   635 // CAknNavigationControlContainer::CreateEditorIndicatorContainerL
       
   636 // Creates a decorated editor indicator container control to use in navi pane.
       
   637 // ----------------------------------------------------------------------------
       
   638 //
       
   639 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::CreateEditorIndicatorContainerL()
       
   640     {
       
   641     CAknIndicatorContainer* editorIndicatorContainer =
       
   642         new (ELeave) CAknIndicatorContainer(
       
   643             CAknIndicatorContainer::ENaviPaneEditorIndicators );
       
   644 
       
   645     CleanupStack::PushL( editorIndicatorContainer );
       
   646 
       
   647     editorIndicatorContainer->SetContainerWindowL( *this );
       
   648 
       
   649     TResourceReader reader;
       
   650     iCoeEnv->CreateResourceReaderLC( reader,
       
   651                                      R_AVKON_NAVI_PANE_EDITOR_INDICATORS );
       
   652     editorIndicatorContainer->ConstructFromResourceL( reader );
       
   653 
       
   654     // Update the signal icon state from status pane layout in small status pane
       
   655     // to keep those two in sync.
       
   656     if ( iStatusPane &&
       
   657          ( iStatusPane->CurrentLayoutResId() ==
       
   658             R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE ||
       
   659            iStatusPane->CurrentLayoutResId() ==
       
   660             R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED ) )
       
   661         {
       
   662         editorIndicatorContainer->SetIndicatorState(
       
   663             TUid::Uid( EAknNaviPaneEditorIndicatorGprs ),
       
   664             EAknIndicatorStateOn,
       
   665             EFalse );
       
   666         }
       
   667 
       
   668     CleanupStack::PopAndDestroy();  // resource reader
       
   669 
       
   670     CleanupStack::Pop( editorIndicatorContainer ); // editorIndicatorContainer
       
   671 
       
   672     CAknNavigationDecorator* decoratedEditorIndicatorContainer =
       
   673         CAknNavigationDecorator::NewL( this,
       
   674                                        editorIndicatorContainer,
       
   675                                        CAknNavigationDecorator::EEditorIndicator );
       
   676 
       
   677     CleanupStack::PushL( decoratedEditorIndicatorContainer );
       
   678 
       
   679     decoratedEditorIndicatorContainer->SetContainerWindowL( *this );
       
   680     CleanupStack::Pop( decoratedEditorIndicatorContainer );
       
   681 
       
   682     decoratedEditorIndicatorContainer->MakeScrollButtonVisible( EFalse );
       
   683 
       
   684     return decoratedEditorIndicatorContainer;
       
   685     }
       
   686 
       
   687 
       
   688 // ----------------------------------------------------------------------------
       
   689 // CAknNavigationControlContainer::PushDefaultL
       
   690 // Pushes the default (empty) navi pane control to the navi pane control stack.
       
   691 // ----------------------------------------------------------------------------
       
   692 //
       
   693 EXPORT_C void CAknNavigationControlContainer::PushDefaultL(
       
   694     TBool aAllowDuplicates )
       
   695     {
       
   696     if ( !aAllowDuplicates )
       
   697         {
       
   698         const TInt last = iNaviPaneControls->Count() - 1;
       
   699         for ( TInt ii = last; ii >= 0; ii-- )
       
   700             {
       
   701             if ( !( iNaviPaneControls->At( ii ) ) )
       
   702                 {
       
   703                 iNaviPaneControls->Delete( ii );
       
   704                 break; // Same reference only once in the stack
       
   705                 }
       
   706             }
       
   707         }
       
   708     const TInt lastAfterDelete = iNaviPaneControls->Count() - 1;
       
   709 
       
   710     // This is required in case the empty navi pane is pushed to the stack, and
       
   711     // the previous navi pane has a direction indication animation ongoing,
       
   712     // in which case the arrow indicator would remain visible on the
       
   713     // empty navi pane.
       
   714     //
       
   715     // Also, if the previous navi pane control is volume control, which
       
   716     // now launches a volume popup, and the popup is visible, then it's closed.
       
   717     //
       
   718     CAknNavigationDecorator* naviControl = NULL;
       
   719     for ( TInt jj = lastAfterDelete; jj >= 0; jj-- )
       
   720         {
       
   721         naviControl = iNaviPaneControls->At( jj );
       
   722         if ( naviControl )
       
   723             {
       
   724             naviControl->CancelTimer();
       
   725             
       
   726             if ( naviControl->ControlType() ==
       
   727                     CAknNavigationDecorator::ENaviVolume )
       
   728                 {
       
   729                 CAknVolumePopup* volumePopup =
       
   730                     static_cast<CAknVolumePopup*> (
       
   731                         naviControl->iDecoratedControl );
       
   732                 if ( volumePopup )
       
   733                     {
       
   734                     volumePopup->CloseVolumePopup();
       
   735                     }
       
   736                 }
       
   737             }
       
   738         }
       
   739 
       
   740     if (lastAfterDelete >= 0 &&
       
   741         IsFepOwnedEditorIndicatorControl( iNaviPaneControls->At(lastAfterDelete) ))
       
   742         {
       
   743         // Insert after FEP owned editor indicator object.
       
   744         iNaviPaneControls->InsertL(lastAfterDelete, NULL);
       
   745         }
       
   746     else
       
   747         {
       
   748         iNaviPaneControls->AppendL( NULL );
       
   749         DrawDeferred();
       
   750         }
       
   751 
       
   752     // Notify contextpane and signalpane that possibly the naviwipe drawing has
       
   753     // been changed.
       
   754     TRAP_IGNORE( NotifyNaviWipeStatusL() );
       
   755     }
       
   756 
       
   757 
       
   758 // ---------------------------------------------------------------------------
       
   759 // CAknNavigationControlContainer::PushL
       
   760 // Pushes a decorated navi pane control to the navi pane control stack.
       
   761 // ---------------------------------------------------------------------------
       
   762 //
       
   763 EXPORT_C void CAknNavigationControlContainer::PushL(
       
   764     CAknNavigationDecorator& aNaviPaneControl )
       
   765     {
       
   766     TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() );
       
   767     
       
   768     if ( AknStatuspaneUtils::FlatLayoutActive() &&
       
   769          iExtension->iPreferredNaviDecoratorLayoutStyle )
       
   770         {
       
   771         // In flat status pane layout it's possible to use the narrow
       
   772         // navi pane variant.
       
   773         CAknNavigationDecorator::TAknNaviControlLayoutStyle layoutStyle;
       
   774         if ( iExtension->iPreferredNaviDecoratorLayoutStyle ==
       
   775                 CAknNavigationDecorator::ENaviControlLayoutNarrow )
       
   776             {
       
   777             // Narrow layout set as preferred, use it.
       
   778             layoutStyle = CAknNavigationDecorator::ENaviControlLayoutNarrow;
       
   779             }
       
   780         else
       
   781             {
       
   782             // Otherwise use the normal layout.
       
   783             layoutStyle = CAknNavigationDecorator::ENaviControlLayoutNormal;
       
   784             }
       
   785 
       
   786         // Check if the layout style is supported in the current layout.
       
   787         if ( aNaviPaneControl.NaviControlLayoutStyleSupported( layoutStyle ) )
       
   788             {
       
   789             aNaviPaneControl.SetNaviControlLayoutStyle( layoutStyle );
       
   790             
       
   791             if ( isLandscape )
       
   792                 {
       
   793                 // In landscape flat status pane layout use the automatic
       
   794                 // navi pane layout mode, so that the navi pane gives
       
   795                 // space to the title pane when necessary.
       
   796                 aNaviPaneControl.SetNaviControlLayoutMode(
       
   797                     CAknNavigationDecorator::ENaviControlLayoutModeAutomatic );
       
   798                 }
       
   799             else
       
   800                 {
       
   801                 // In portrait use the forced mode.
       
   802                 aNaviPaneControl.SetNaviControlLayoutMode(
       
   803                     CAknNavigationDecorator::ENaviControlLayoutModeForced );
       
   804                 }
       
   805             }
       
   806         }
       
   807     else if ( iExtension->iPreferredNaviDecoratorLayoutStyle ==
       
   808                   CAknNavigationDecorator::ENaviControlLayoutWide ||
       
   809               ( AknStatuspaneUtils::UsualLayoutActive() &&
       
   810                 !isLandscape &&
       
   811                 ( aNaviPaneControl.ControlType() !=
       
   812                       CAknNavigationDecorator::ETabGroup ||
       
   813                    AknLayoutUtils::PenEnabled() ) ) )
       
   814         {
       
   815         // In usual portrait status pane layout use the wide navi pane
       
   816         // layout. Exception is tab group control in non-touch devices,
       
   817         // for which the normal layout is used.
       
   818         if ( aNaviPaneControl.NaviControlLayoutStyleSupported(
       
   819                 CAknNavigationDecorator::ENaviControlLayoutWide ) )
       
   820             {
       
   821             aNaviPaneControl.SetNaviControlLayoutStyle(
       
   822                 CAknNavigationDecorator::ENaviControlLayoutWide );
       
   823             aNaviPaneControl.SetNaviControlLayoutMode(
       
   824                 CAknNavigationDecorator::ENaviControlLayoutModeForced );
       
   825             }
       
   826         }
       
   827     else
       
   828         {
       
   829         // Otherwise use the normal layout.
       
   830         aNaviPaneControl.SetNaviControlLayoutStyle(
       
   831             CAknNavigationDecorator::ENaviControlLayoutNormal );
       
   832         aNaviPaneControl.SetNaviControlLayoutMode(
       
   833             CAknNavigationDecorator::ENaviControlLayoutModeAutomatic );
       
   834         }
       
   835 
       
   836     TRect rect( Rect() );
       
   837     aNaviPaneControl.SetRect( rect );
       
   838 
       
   839     // If the object already exists in the stack, delete it first.
       
   840     const TInt last = iNaviPaneControls->Count() - 1;
       
   841     for ( TInt ii = last; ii >= 0; ii-- )
       
   842         {
       
   843         if ( iNaviPaneControls->At(ii) == &aNaviPaneControl )
       
   844             {
       
   845             iNaviPaneControls->Delete(ii);
       
   846             break; // Same reference only once in the stack
       
   847             }
       
   848         }
       
   849 
       
   850     // If the top most object is an editor indicator control, insert
       
   851     // new object after it. New object is put to the top otherwise.
       
   852     const TInt lastAfterDelete = iNaviPaneControls->Count() - 1;
       
   853 
       
   854     // This is required in case the empty navi pane is pushed to the stack, and
       
   855     // the previous navi pane has a direction indication animation ongoing,
       
   856     // in which case the arrow indicator would remain visible on the
       
   857     // empty navi pane.
       
   858     //
       
   859     // Also, if the previous navi pane control is volume control, which
       
   860     // now launches a volume popup, and the popup is visible, then it's closed.
       
   861     //
       
   862     CAknNavigationDecorator* naviControl = NULL;
       
   863     for ( TInt jj = lastAfterDelete; jj >= 0; jj-- )
       
   864         {
       
   865         naviControl = iNaviPaneControls->At( jj );
       
   866         if ( naviControl )
       
   867             {
       
   868             naviControl->CancelTimer();
       
   869             
       
   870             if ( naviControl->ControlType() ==
       
   871                     CAknNavigationDecorator::ENaviVolume )
       
   872                 {
       
   873                 CAknVolumePopup* volumePopup =
       
   874                     static_cast<CAknVolumePopup*> (
       
   875                         naviControl->iDecoratedControl );
       
   876                 if ( volumePopup )
       
   877                     {
       
   878                     volumePopup->CloseVolumePopup();
       
   879                     // Tell the volume control that it's no longer the topmost
       
   880                     // control on the navi stack.
       
   881                     static_cast<CAknVolumeControl*>(
       
   882                         naviControl->DecoratedControl() )->HandleNaviStackChange( EFalse );
       
   883                     }
       
   884                 }
       
   885             }
       
   886         }
       
   887 
       
   888     if ( lastAfterDelete >= 0 &&
       
   889          IsFepOwnedEditorIndicatorControl(
       
   890             iNaviPaneControls->At(lastAfterDelete) ) )
       
   891         {
       
   892         HandleVisibilityOfNonFepOwnedIndicatorControl( &aNaviPaneControl,
       
   893                                                        EFalse );
       
   894         // Insert new object after after FEP owned editor indicator object
       
   895         iNaviPaneControls->InsertL( lastAfterDelete, &aNaviPaneControl );
       
   896 
       
   897         // Tell the navi pane control that it is in this status pane
       
   898         aNaviPaneControl.SetNaviStack( this );
       
   899         aNaviPaneControl.ActivateL();
       
   900 
       
   901         if ( rect != Rect() )
       
   902             {
       
   903             aNaviPaneControl.SetRect( Rect() );
       
   904             }
       
   905         }
       
   906     else
       
   907         {
       
   908         if ( lastAfterDelete >= 0 &&
       
   909              IsFepOwnedEditorIndicatorControl( &aNaviPaneControl ) )
       
   910             {
       
   911             HandleVisibilityOfNonFepOwnedIndicatorControl(
       
   912                 iNaviPaneControls->At( lastAfterDelete ), EFalse );
       
   913             }
       
   914         // Put new object to the top
       
   915         iNaviPaneControls->AppendL( &aNaviPaneControl );
       
   916 
       
   917         // Tell the navi pane control that it is in this status pane
       
   918         aNaviPaneControl.SetNaviStack( this );
       
   919         
       
   920         if ( aNaviPaneControl.ControlType() != CAknNavigationDecorator::ENaviVolume )
       
   921             {
       
   922             aNaviPaneControl.ActivateL();
       
   923 
       
   924             if ( rect != Rect() )
       
   925                 {
       
   926                 aNaviPaneControl.SetRect( Rect() );
       
   927                 }
       
   928                 
       
   929             DrawDeferred();
       
   930             }
       
   931          else
       
   932             {
       
   933             // If the navi pane control is of the ENaviVolume type, a volume popup
       
   934             // is shown instead.
       
   935             CAknVolumeControl* volumeControl =
       
   936                 static_cast<CAknVolumeControl*> ( aNaviPaneControl.DecoratedControl() );
       
   937             
       
   938             // Check also that we are on the foreground.
       
   939             if ( volumeControl &&
       
   940                  iExtension &&
       
   941                  iExtension->iForegroundObserver &&
       
   942                  iExtension->iForegroundObserver->HasForegroundGained() )
       
   943                 {
       
   944                 // Tell the volume control that it's the topmost
       
   945                 // control on the navi stack.
       
   946                 volumeControl->HandleNaviStackChange( ETrue );
       
   947                 }
       
   948             }
       
   949         }
       
   950 
       
   951     // Notify contextpane and signalpane that possibly the naviwipe drawing has
       
   952     // been changed.
       
   953     TRAP_IGNORE( NotifyNaviWipeStatusL() );
       
   954     }
       
   955 
       
   956 
       
   957 // ---------------------------------------------------------------------------
       
   958 // CAknNavigationControlContainer::Pop
       
   959 // Pops the topmost control from the navi stack.
       
   960 // ---------------------------------------------------------------------------
       
   961 //
       
   962 EXPORT_C void CAknNavigationControlContainer::Pop()
       
   963     {
       
   964     const TInt last = iNaviPaneControls->Count() - 1;
       
   965     if ( last >= 0 )
       
   966         {
       
   967         if ( IsFepOwnedEditorIndicatorControl( iNaviPaneControls->At(last) ) )
       
   968             {
       
   969             if ( last > 0)
       
   970                 {
       
   971                 // Tell the control that it is removed from this status pane
       
   972                 CAknNavigationDecorator* controlToDelete =
       
   973                     iNaviPaneControls->At( last - 1 );
       
   974                 if ( controlToDelete )
       
   975                     {
       
   976                     controlToDelete->SetNaviStack( NULL );
       
   977                     }
       
   978 
       
   979                 iNaviPaneControls->Delete( last - 1 );
       
   980                 DrawDeferred();
       
   981                 }
       
   982             }
       
   983         else
       
   984             {
       
   985             // Tell the control that it is removed from this status pane
       
   986             CAknNavigationDecorator* controlToDelete =
       
   987                 iNaviPaneControls->At( last );
       
   988 
       
   989             if ( controlToDelete )
       
   990                 {
       
   991                 if ( controlToDelete->ControlType() ==
       
   992                     CAknNavigationDecorator::ENaviVolume )
       
   993                     {
       
   994                     CAknVolumePopup* volumePopup =
       
   995                         static_cast<CAknVolumePopup*> ( controlToDelete->iDecoratedControl );
       
   996 
       
   997                     if ( volumePopup )
       
   998                         {
       
   999                         // Tell the volume control that it's no longer the topmost
       
  1000                         // control on the navi stack.
       
  1001                         static_cast<CAknVolumeControl*>(
       
  1002                             controlToDelete->DecoratedControl() )->HandleNaviStackChange( EFalse );
       
  1003                         volumePopup->CloseVolumePopup();
       
  1004                         }
       
  1005                     }
       
  1006                 
       
  1007                 controlToDelete->SetNaviStack( NULL );
       
  1008                 }
       
  1009 
       
  1010             iNaviPaneControls->Delete( last );
       
  1011             DrawDeferred();
       
  1012             }
       
  1013         }
       
  1014     
       
  1015     // Volume control must be informed if it's the topmost control in the navi
       
  1016     // pane stack after popping and we have the foreground.
       
  1017     TInt lastAfterDelete = iNaviPaneControls->Count() - 1;
       
  1018     if ( lastAfterDelete >= 0 )
       
  1019         {
       
  1020         CAknNavigationDecorator* naviControl = NULL;
       
  1021 
       
  1022         naviControl = iNaviPaneControls->At( lastAfterDelete );
       
  1023         if ( naviControl &&
       
  1024              iExtension &&
       
  1025              iExtension->iForegroundObserver &&
       
  1026              iExtension->iForegroundObserver->HasForegroundGained() )
       
  1027             {
       
  1028             if ( naviControl->ControlType() ==
       
  1029                     CAknNavigationDecorator::ENaviVolume )
       
  1030                 {
       
  1031                 CAknVolumePopup* volumePopup =
       
  1032                     static_cast<CAknVolumePopup*> (
       
  1033                         naviControl->iDecoratedControl );
       
  1034 
       
  1035                 if ( volumePopup )
       
  1036                     {
       
  1037                     // Tell the volume control that it's the topmost
       
  1038                     // control on the navi stack.
       
  1039                     static_cast<CAknVolumeControl*>(
       
  1040                         naviControl->DecoratedControl() )->HandleNaviStackChange( ETrue );
       
  1041                     }
       
  1042                 }
       
  1043             else
       
  1044                 {
       
  1045                 // Initialize the layout timer if necessary.
       
  1046                 naviControl->SetNaviControlLayoutMode(
       
  1047                     naviControl->NaviControlLayoutMode() );
       
  1048                 }
       
  1049             }
       
  1050         }
       
  1051         
       
  1052     // Notify contextpane and signalpane that possibly the naviwipe drawing has
       
  1053     // been changed.
       
  1054     TRAP_IGNORE( NotifyNaviWipeStatusL() );
       
  1055     }
       
  1056 
       
  1057 
       
  1058 // ---------------------------------------------------------------------------
       
  1059 // CAknNavigationControlContainer::Pop
       
  1060 // Pops a navi pane control from the navi stack.
       
  1061 // ---------------------------------------------------------------------------
       
  1062 //
       
  1063 EXPORT_C void CAknNavigationControlContainer::Pop(
       
  1064     CAknNavigationDecorator* aControl )
       
  1065     {
       
  1066     const TInt last = iNaviPaneControls->Count() - 1;
       
  1067     TInt ii = 0;
       
  1068     for ( ii = last; ii >= 0; ii-- )
       
  1069         {
       
  1070         if ( iNaviPaneControls->At(ii) == aControl )
       
  1071             {
       
  1072             // Tell the control that it is not in this navi pane now.
       
  1073             if ( aControl )
       
  1074                 {
       
  1075                 if ( aControl->ControlType() == CAknNavigationDecorator::ENaviVolume )
       
  1076                     {
       
  1077                     CAknVolumePopup* volumePopup =
       
  1078                         static_cast<CAknVolumePopup*> ( aControl->iDecoratedControl );
       
  1079 
       
  1080                     if ( volumePopup )
       
  1081                         {
       
  1082                         static_cast<CAknVolumeControl*>(
       
  1083                             aControl->DecoratedControl() )->HandleNaviStackChange( EFalse );
       
  1084                         volumePopup->CloseVolumePopup();
       
  1085                         }
       
  1086                     }
       
  1087                 
       
  1088                 aControl->SetNaviStack( NULL );
       
  1089                 }
       
  1090 
       
  1091             iNaviPaneControls->Delete(ii);
       
  1092             break; // Same reference only once in the stack
       
  1093             }
       
  1094         }
       
  1095 
       
  1096     if ( ii == last )  // Drawn only if topmost control was popped
       
  1097         {
       
  1098         const TInt lastAfterDelete = iNaviPaneControls->Count() - 1;
       
  1099         if ( lastAfterDelete >= 0 )
       
  1100             {
       
  1101             HandleVisibilityOfNonFepOwnedIndicatorControl(
       
  1102                 iNaviPaneControls->At( lastAfterDelete ), ETrue );
       
  1103                 
       
  1104             CAknNavigationDecorator* naviControl = NULL;
       
  1105 
       
  1106             naviControl = iNaviPaneControls->At( lastAfterDelete );
       
  1107             if ( naviControl &&
       
  1108                  iExtension &&
       
  1109                  iExtension->iForegroundObserver &&
       
  1110                  iExtension->iForegroundObserver->HasForegroundGained() )
       
  1111                 {
       
  1112                 // Volume control must be informed if it's the topmost control
       
  1113                 // in the navi pane stack after popping
       
  1114                 // and we have the foreground.
       
  1115                 if ( naviControl->ControlType() ==
       
  1116                         CAknNavigationDecorator::ENaviVolume )
       
  1117                     {
       
  1118                     CAknVolumePopup* volumePopup =
       
  1119                         static_cast<CAknVolumePopup*> (
       
  1120                             naviControl->iDecoratedControl );
       
  1121 
       
  1122                     if ( volumePopup )
       
  1123                         {
       
  1124                         static_cast<CAknVolumeControl*>(
       
  1125                             naviControl->DecoratedControl() )->HandleNaviStackChange( ETrue );
       
  1126                         }
       
  1127                     }
       
  1128                 else
       
  1129                     {
       
  1130                     // Initialize the layout timer if necessary.
       
  1131                     naviControl->SetNaviControlLayoutMode(
       
  1132                         naviControl->NaviControlLayoutMode() );
       
  1133                     }
       
  1134                 }
       
  1135             }
       
  1136         DrawDeferred();
       
  1137         }
       
  1138         
       
  1139     // Notify contextpane and signalpane that possibly the naviwipe drawing has
       
  1140     // been changed.
       
  1141     TRAP_IGNORE( NotifyNaviWipeStatusL() );
       
  1142     }
       
  1143 
       
  1144 
       
  1145 // ---------------------------------------------------------------------------
       
  1146 // CAknNavigationControlContainer::Top
       
  1147 // Returns the topmost control on the navi stack.
       
  1148 // ---------------------------------------------------------------------------
       
  1149 //
       
  1150 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::Top()
       
  1151     {
       
  1152     return Top( ETrue );
       
  1153     }
       
  1154 
       
  1155 
       
  1156 // ---------------------------------------------------------------------------
       
  1157 // CAknNavigationControlContainer::Top
       
  1158 // Returns the topmost control on the navi stack.
       
  1159 // ---------------------------------------------------------------------------
       
  1160 //
       
  1161 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::Top(
       
  1162     TBool aIgnoreFepEditorIndicator ) const
       
  1163     {
       
  1164     CAknNavigationDecorator* topMostControl = NULL;
       
  1165 
       
  1166     const TInt last = iNaviPaneControls->Count() - 1;
       
  1167     if ( last >= 0 )
       
  1168         {
       
  1169         topMostControl = iNaviPaneControls->At( last );
       
  1170         if ( IsFepOwnedEditorIndicatorControl( topMostControl ) &&
       
  1171              aIgnoreFepEditorIndicator )
       
  1172             {
       
  1173             if ( last > 0)
       
  1174                 {
       
  1175                 topMostControl = iNaviPaneControls->At( last - 1 );
       
  1176                 }
       
  1177             }
       
  1178         }
       
  1179 
       
  1180     return topMostControl;
       
  1181     }
       
  1182 
       
  1183 
       
  1184 // ---------------------------------------------------------------------------
       
  1185 // CAknNavigationControlContainer::ReplaceL
       
  1186 // Replaces an existing navi pane control with another one.
       
  1187 // ---------------------------------------------------------------------------
       
  1188 //
       
  1189 EXPORT_C TInt CAknNavigationControlContainer::ReplaceL(
       
  1190     CAknNavigationDecorator& aToBeReplaced,
       
  1191     CAknNavigationDecorator& aReplacement )
       
  1192     {
       
  1193     const TInt last = iNaviPaneControls->Count() - 1;
       
  1194     for ( TInt ii = last; ii >= 0; ii-- )
       
  1195         {
       
  1196         if ( iNaviPaneControls->At( ii ) == &aToBeReplaced )
       
  1197             {
       
  1198             TBool redrawNeeded = EFalse;
       
  1199             aReplacement.SetRect( Rect() );
       
  1200             
       
  1201             // If the replaced control is volume control, then
       
  1202             // ensure that the parent control is not set and the
       
  1203             // volume control must be informed about the
       
  1204             // navi stack change.
       
  1205             if ( aToBeReplaced.ControlType() ==
       
  1206                     CAknNavigationDecorator::ENaviVolume )
       
  1207                 {
       
  1208                 CAknVolumePopup* volumePopup =
       
  1209                     static_cast<CAknVolumePopup*> (
       
  1210                         aToBeReplaced.iDecoratedControl );
       
  1211 
       
  1212                 if ( volumePopup )
       
  1213                     {
       
  1214                     volumePopup->CloseVolumePopup();
       
  1215                     }
       
  1216 
       
  1217                 static_cast<CAknVolumeControl*>(
       
  1218                     aToBeReplaced.DecoratedControl() )->HandleNaviStackChange( EFalse );
       
  1219                 }
       
  1220             
       
  1221             aToBeReplaced.SetNaviStack( NULL );
       
  1222             iNaviPaneControls->Delete(ii);
       
  1223             iNaviPaneControls->InsertL( ii, &aReplacement);
       
  1224             aReplacement.SetNaviStack( this );
       
  1225             
       
  1226             // If the replacing control is volume control, then
       
  1227             // ensure that the parent control is not set and the
       
  1228             // volume control must be informed about the
       
  1229             // navi stack change.
       
  1230             if ( aReplacement.ControlType() ==
       
  1231                     CAknNavigationDecorator::ENaviVolume )
       
  1232                 {
       
  1233                 CAknVolumePopup* volumePopup =
       
  1234                     static_cast<CAknVolumePopup*> (
       
  1235                         aReplacement.iDecoratedControl );
       
  1236 
       
  1237                 if ( volumePopup )
       
  1238                     {
       
  1239                     volumePopup->CloseVolumePopup();
       
  1240                     }
       
  1241                     
       
  1242                 static_cast<CAknVolumeControl*>(
       
  1243                     aReplacement.DecoratedControl() )->HandleNaviStackChange( ETrue );
       
  1244                 }
       
  1245             else
       
  1246                 {
       
  1247                 // Must not to do this for volume popup.
       
  1248                 aReplacement.ActivateL();
       
  1249                 }
       
  1250 
       
  1251             if ( ii == last )
       
  1252                 {
       
  1253                 redrawNeeded = ETrue; // Top item replaced, redraw is needed.
       
  1254                 }
       
  1255 
       
  1256             // Delete second copy of aReplacement if it existed on the
       
  1257             // stack before ReplaceL call.
       
  1258             for (TInt jj = last; jj >= 0; jj--)
       
  1259                 {
       
  1260                 if ( jj != ii && iNaviPaneControls->At(jj) == &aReplacement )
       
  1261                     {
       
  1262                     iNaviPaneControls->Delete(jj);
       
  1263                     if ( jj == last )
       
  1264                         {
       
  1265                         redrawNeeded = ETrue; // Top item deleted, redraw is needed.
       
  1266                         }
       
  1267                     break; // Same reference only once in the stack
       
  1268                     }
       
  1269                 }
       
  1270 
       
  1271             if ( redrawNeeded )
       
  1272                 {
       
  1273                 // Initialize the layout timer if necessary.
       
  1274                 aReplacement.SetNaviControlLayoutMode(
       
  1275                     aReplacement.NaviControlLayoutMode() );
       
  1276                     
       
  1277                 // Redraw if top most item was replaced.
       
  1278                 DrawDeferred();
       
  1279                 }
       
  1280             return KErrNone;
       
  1281             }
       
  1282         }
       
  1283     return KErrNotFound;
       
  1284     }
       
  1285 
       
  1286 
       
  1287 // ---------------------------------------------------------------------------
       
  1288 // CAknNavigationControlContainer::ResourceDecorator
       
  1289 // ---------------------------------------------------------------------------
       
  1290 //
       
  1291 EXPORT_C CAknNavigationDecorator* CAknNavigationControlContainer::ResourceDecorator()
       
  1292     {
       
  1293     CAknNavigationDecorator* naviDecorator = iNaviDecoratorFromResource;
       
  1294 
       
  1295     // The ownership of the object is moved to the application.
       
  1296     iNaviDecoratorFromResource = NULL;
       
  1297     return naviDecorator;
       
  1298     }
       
  1299 
       
  1300 
       
  1301 // ---------------------------------------------------------------------------
       
  1302 // CAknNavigationControlContainer::NaviArrowBitmap
       
  1303 // Gets the bitmap for the left or right navigation arrow.
       
  1304 // ---------------------------------------------------------------------------
       
  1305 //
       
  1306 CFbsBitmap& CAknNavigationControlContainer::NaviArrowBitmap( TInt aId )
       
  1307     {
       
  1308     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1309 
       
  1310     TAknsItemID iid = KAknsIIDNone;
       
  1311     if ( aId < 2 )
       
  1312         {
       
  1313         iid = KAknsIIDQgnIndiNaviArrowLeft;
       
  1314         }
       
  1315     else
       
  1316         {
       
  1317         iid = KAknsIIDQgnIndiNaviArrowRight;
       
  1318         }
       
  1319 
       
  1320     CFbsBitmap* skinBitmap = NULL;
       
  1321     CFbsBitmap* skinMask   = NULL;
       
  1322     AknsUtils::GetCachedMaskedBitmap( skin, iid, skinBitmap, skinMask );
       
  1323 
       
  1324     TBool narrowLayoutInUse( EFalse );
       
  1325     CAknNavigationDecorator* topControl = Top( ETrue );
       
  1326     if ( topControl &&
       
  1327          topControl->NaviControlLayoutStyle() == 
       
  1328             CAknNavigationDecorator::ENaviControlLayoutNarrow )
       
  1329         {
       
  1330         narrowLayoutInUse = ETrue;
       
  1331         }
       
  1332 
       
  1333     TSize arrowSize( CAknNavigationDecorator::NaviArrowRect(
       
  1334         CAknNavigationDecorator::ELeftButton, narrowLayoutInUse ).Size() );
       
  1335 
       
  1336     if ( skinBitmap )
       
  1337         {
       
  1338         AknIconUtils::SetSize( skinBitmap, arrowSize );
       
  1339         }
       
  1340     if ( skinMask )
       
  1341         {
       
  1342         AknIconUtils::SetSize( skinMask, arrowSize );
       
  1343         }
       
  1344     
       
  1345     // Set also the default navi arrow bitmap to correct size here.
       
  1346     AknIconUtils::SetSize( iNaviArrowBitmap[aId], arrowSize );
       
  1347 
       
  1348     if( ( aId & 1 ) && skinMask ) // If aId is odd and mask exists
       
  1349         {
       
  1350         return *skinMask;
       
  1351         }
       
  1352     else if( skinBitmap )
       
  1353         {
       
  1354         return *skinBitmap;
       
  1355         }
       
  1356 
       
  1357     return *iNaviArrowBitmap[aId];
       
  1358     }
       
  1359 
       
  1360 
       
  1361 // ---------------------------------------------------------------------------
       
  1362 // CAknNavigationControlContainer::SizeChanged
       
  1363 // Handles size change events.
       
  1364 // ---------------------------------------------------------------------------
       
  1365 //
       
  1366 EXPORT_C void CAknNavigationControlContainer::SizeChanged()
       
  1367     {
       
  1368     TRect rect( Rect() );
       
  1369 
       
  1370     // No fading if staconpane is active.
       
  1371     SetContainerWindowNonFading( AknStatuspaneUtils::StaconPaneActive() );
       
  1372 
       
  1373     TBool narrowLayoutInUse( EFalse );
       
  1374     CAknNavigationDecorator* topControl = Top( ETrue );
       
  1375     if ( topControl &&
       
  1376          topControl->NaviControlLayoutStyle() == 
       
  1377             CAknNavigationDecorator::ENaviControlLayoutNarrow )
       
  1378         {
       
  1379         narrowLayoutInUse = ETrue;
       
  1380         }
       
  1381 
       
  1382     TSize naviArrowSize(
       
  1383         CAknNavigationDecorator::NaviArrowRect(
       
  1384             CAknNavigationDecorator::ELeftButton, narrowLayoutInUse ).Size() );
       
  1385 
       
  1386     AknIconUtils::SetSize( iNaviArrowBitmap[ 0 ], naviArrowSize );
       
  1387     AknIconUtils::SetSize( iNaviArrowBitmap[ 2 ], naviArrowSize );
       
  1388 
       
  1389     const TInt last = iNaviPaneControls->Count() - 1;
       
  1390 
       
  1391     if ( last >= 0 && iNaviPaneControls->At( last ) )
       
  1392         {
       
  1393         if ( iNaviPaneControls->At( last )->ControlType() ==
       
  1394                  CAknNavigationDecorator::ENaviVolume )
       
  1395             {
       
  1396             // Volume popup's position must be set here.
       
  1397             iNaviPaneControls->At( last )->iDecoratedControl->SetRect(
       
  1398                 VolumePopupRect() );
       
  1399             if( last - 1 >= 0 )
       
  1400             	{
       
  1401             		iNaviPaneControls->At( last - 1 )->SetRect( rect );
       
  1402             	}
       
  1403             }
       
  1404         else
       
  1405             {
       
  1406             iNaviPaneControls->At( last )->SetRect( rect );
       
  1407             }
       
  1408         }
       
  1409 
       
  1410     AknsUtils::RegisterControlPosition( this );
       
  1411 
       
  1412     // Notify contextpane and signalpane that possibly the naviwipe drawing has
       
  1413     // been changed.
       
  1414     TRAP_IGNORE( NotifyNaviWipeStatusL() );
       
  1415     }
       
  1416 
       
  1417 
       
  1418 // ---------------------------------------------------------------------------
       
  1419 // CAknNavigationControlContainer::HandleResourceChange
       
  1420 // Handles resource change events.
       
  1421 // ---------------------------------------------------------------------------
       
  1422 //
       
  1423 EXPORT_C void CAknNavigationControlContainer::HandleResourceChange( TInt aType )
       
  1424     {
       
  1425     // CCoeControl::HandleResourceChange forwards events only to topmost items.
       
  1426     // We try this to forward the event and hope that it does not
       
  1427     // break too much things.
       
  1428     if ( aType == KEikDynamicLayoutVariantSwitch ||
       
  1429          aType == KEikColorResourceChange ||
       
  1430          aType == KAknsMessageSkinChange )
       
  1431         {
       
  1432         const TInt last = iNaviPaneControls->Count() - 1;
       
  1433         TInt ii = 0;
       
  1434         CAknNavigationDecorator* control;
       
  1435         for ( ii = last; ii >= 0; ii-- )
       
  1436             {
       
  1437             control = iNaviPaneControls->At( ii );
       
  1438             if ( control )
       
  1439                 {
       
  1440                 if ( control->ControlType() ==
       
  1441                          CAknNavigationDecorator::ENaviVolume )
       
  1442                     {
       
  1443                     // Volume popup's position must be set here.
       
  1444                     control->iDecoratedControl->SetPosition(
       
  1445                         VolumePopupRect().iTl );
       
  1446                     }
       
  1447                     
       
  1448                 control->HandleResourceChange( aType );
       
  1449                 }
       
  1450             }
       
  1451         }
       
  1452     else
       
  1453         {
       
  1454         CCoeControl::HandleResourceChange( aType ) ;
       
  1455         }
       
  1456 
       
  1457     if ( aType == KEikColorResourceChange ||
       
  1458          aType == KEikDynamicLayoutVariantSwitch ||
       
  1459          aType == KAknsMessageSkinChange )
       
  1460         {
       
  1461         TInt colorScheme = ColorScheme();
       
  1462         if ( colorScheme != iExtension->iCurrentColorScheme ||
       
  1463              aType == KEikDynamicLayoutVariantSwitch ||
       
  1464              aType == KAknsMessageSkinChange )
       
  1465             {
       
  1466             iExtension->iCurrentColorScheme = colorScheme;
       
  1467 
       
  1468             // updating color bitmap
       
  1469             TRAP_IGNORE( LoadNaviColorBitmapL() );
       
  1470             }
       
  1471         DrawDeferred();
       
  1472         }
       
  1473     else if ( aType == KEikMessageFadeAllWindows )
       
  1474         {
       
  1475         // Close the volume popup if navi pane is faded.
       
  1476         CAknNavigationDecorator* topControl = Top();
       
  1477     
       
  1478         if ( topControl &&
       
  1479              topControl->ControlType() == CAknNavigationDecorator::ENaviVolume )
       
  1480             {
       
  1481             CAknVolumePopup* volumePopup =
       
  1482                 static_cast<CAknVolumePopup*> ( topControl->iDecoratedControl );
       
  1483 
       
  1484             if ( volumePopup )
       
  1485                 {
       
  1486                 volumePopup->CloseVolumePopup();
       
  1487                 }
       
  1488             }
       
  1489         }
       
  1490     }
       
  1491 
       
  1492 
       
  1493 // ---------------------------------------------------------------------------
       
  1494 // CAknNavigationControlContainer::CountComponentControls
       
  1495 // Report number of component controls.
       
  1496 // ---------------------------------------------------------------------------
       
  1497 //
       
  1498 EXPORT_C TInt CAknNavigationControlContainer::CountComponentControls() const
       
  1499     {
       
  1500     const TInt last = iNaviPaneControls->Count() - 1;
       
  1501     if ( last < 0 || !iNaviPaneControls->At( last ) )
       
  1502         {
       
  1503         return 1;
       
  1504         }
       
  1505 
       
  1506     return 2;
       
  1507     }
       
  1508 
       
  1509 
       
  1510 // ---------------------------------------------------------------------------
       
  1511 // CAknNavigationControlContainer::ComponentControl
       
  1512 // Return a contained control.
       
  1513 // ---------------------------------------------------------------------------
       
  1514 //
       
  1515 EXPORT_C CCoeControl* CAknNavigationControlContainer::ComponentControl(
       
  1516     TInt aIndex ) const
       
  1517     {
       
  1518     CCoeControl* control = NULL;
       
  1519     
       
  1520     if ( aIndex == 0 )
       
  1521         {
       
  1522         control = iExtension->iForegroundObserver;
       
  1523         }
       
  1524     else if ( aIndex == 1 )
       
  1525         {
       
  1526         // Return top item from the navi stack.
       
  1527         // If the top is Volume Control, Return the one next to the top
       
  1528         CAknNavigationDecorator *naviDecorator = iNaviPaneControls->At( iNaviPaneControls->Count() - 1 );
       
  1529         if ( naviDecorator->ControlType() == CAknNavigationDecorator::ENaviVolume )
       
  1530             {
       
  1531             if ( iNaviPaneControls->Count() - 2 >= 0 )\
       
  1532                 {
       
  1533                 control = iNaviPaneControls->At( iNaviPaneControls->Count() - 2 );
       
  1534                 }
       
  1535             }
       
  1536         
       
  1537         if ( control == NULL)
       
  1538             {
       
  1539             control = naviDecorator;
       
  1540             }
       
  1541         }
       
  1542     
       
  1543     return control;
       
  1544     }
       
  1545 
       
  1546 
       
  1547 // ---------------------------------------------------------------------------
       
  1548 // CAknNavigationControlContainer::HandleControlEventL
       
  1549 // ---------------------------------------------------------------------------
       
  1550 //
       
  1551 EXPORT_C void CAknNavigationControlContainer::HandleControlEventL(
       
  1552     CCoeControl* aControl,
       
  1553     TCoeEvent aEventType )
       
  1554     {
       
  1555     switch ( aEventType )
       
  1556         {
       
  1557         case EEventStateChanged:
       
  1558             {
       
  1559             const TInt last = iNaviPaneControls->Count() - 1;
       
  1560             // Drawn only if the object that sent the event is
       
  1561             // topmost at the stack
       
  1562             if ( last > KErrNotFound &&
       
  1563                  aControl == iNaviPaneControls->At( last ) )
       
  1564                 {
       
  1565                 DrawDeferred();
       
  1566                 }
       
  1567             }
       
  1568             break;
       
  1569         default:
       
  1570             break;
       
  1571         }
       
  1572     }
       
  1573 
       
  1574 
       
  1575 // ---------------------------------------------------------------------------
       
  1576 // CAknNavigationControlContainer::Draw
       
  1577 // ---------------------------------------------------------------------------
       
  1578 //
       
  1579 EXPORT_C void CAknNavigationControlContainer::Draw(
       
  1580     const TRect& /*aRect*/ ) const
       
  1581     {
       
  1582     if ( iExtension->iIsActiveIdle )
       
  1583         {
       
  1584         return;
       
  1585         }
       
  1586 
       
  1587     CWindowGc& gc = SystemGc();
       
  1588 
       
  1589     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1590 
       
  1591     if( !skin )
       
  1592         {
       
  1593         // We are in the middle of AppUi destructor, abort to reduce flicker.
       
  1594         return;
       
  1595         }
       
  1596 
       
  1597     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
  1598 
       
  1599     TRect rect( Rect() );
       
  1600 
       
  1601     //
       
  1602     // Navi pane is located in COMBINED CONTROL/STATUSPANE
       
  1603     //
       
  1604     if ( AknStatuspaneUtils::StaconPaneActive() )
       
  1605         {
       
  1606         //
       
  1607         // - Navi wipe is never used
       
  1608         // - No offset in right, left or top
       
  1609         //
       
  1610         if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
  1611             {
       
  1612             gc.SetPenStyle( CGraphicsContext::ENullPen );
       
  1613             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  1614             gc.SetBrushColor(
       
  1615                 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
       
  1616 
       
  1617             gc.DrawRect( rect );
       
  1618             }
       
  1619         return;
       
  1620         }
       
  1621     //
       
  1622     // Navi pane is located in SMALL STATUSPANE
       
  1623     //
       
  1624     else if ( AknStatuspaneUtils::SmallLayoutActive() )
       
  1625         {
       
  1626         // This component is drawn differently in small statuspane.
       
  1627         //
       
  1628         // - Navi wipe is never used
       
  1629         // - No offset in right, left or top
       
  1630         //
       
  1631         gc.SetPenStyle( CGraphicsContext::ENullPen );
       
  1632         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  1633         gc.SetBrushColor(
       
  1634             AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
       
  1635 
       
  1636         if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
  1637             {
       
  1638             gc.DrawRect( rect );
       
  1639             }
       
  1640         return;
       
  1641         }
       
  1642     //
       
  1643     // Navi pane is located in FLAT STATUSPANE
       
  1644     //
       
  1645     else if ( AknStatuspaneUtils::FlatLayoutActive() )
       
  1646         {
       
  1647         //
       
  1648         // - Navi wipe is never used
       
  1649         // - No offset in right, left or top
       
  1650         //
       
  1651         if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
  1652             {
       
  1653             gc.SetPenStyle( CGraphicsContext::ENullPen );
       
  1654             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  1655             gc.SetBrushColor(
       
  1656                 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
       
  1657             gc.DrawRect( rect );
       
  1658             }
       
  1659 
       
  1660         if ( iStatusPane && !AknLayoutUtils::PenEnabled() )
       
  1661             {
       
  1662             // Draw title text or image that overlaps to navipane area.
       
  1663             CCoeControl* navicontrol      = NULL;
       
  1664             CCoeControl* titlecontrol     = NULL;
       
  1665             CCoeControl* titlepaneControl = NULL;
       
  1666         
       
  1667             TRAP_IGNORE( navicontrol =
       
  1668                             iStatusPane->ContainerControlL(
       
  1669                                 TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
  1670             TRAP_IGNORE( titlecontrol =
       
  1671                             iStatusPane->ContainerControlL(
       
  1672                                 TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
  1673             TRAP_IGNORE( titlepaneControl =
       
  1674                             iStatusPane->ControlL(
       
  1675                                 TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
  1676 
       
  1677             if ( navicontrol && titlecontrol && titlepaneControl )
       
  1678                 {
       
  1679                 TRect naviRect(
       
  1680                     navicontrol->Position().iX,
       
  1681                     navicontrol->Position().iY,
       
  1682                     navicontrol->Position().iX + navicontrol->Size().iWidth,
       
  1683                     navicontrol->Position().iY + navicontrol->Size().iHeight );
       
  1684 
       
  1685                 TRect titleRect(
       
  1686                     titlecontrol->Position().iX,
       
  1687                     titlecontrol->Position().iY,
       
  1688                     titlecontrol->Position().iX + titlecontrol->Size().iWidth,
       
  1689                     titlecontrol->Position().iY + titlecontrol->Size().iHeight );
       
  1690 
       
  1691                 TInt offset = titleRect.iTl.iX;
       
  1692 
       
  1693                 titleRect.Intersection( naviRect );
       
  1694                 TRect intersection = titleRect;
       
  1695                 intersection.iTl.iX -= offset;
       
  1696                 intersection.iBr.iX -= offset;
       
  1697 
       
  1698                 CAknTitlePane* titlePane =
       
  1699                     dynamic_cast<CAknTitlePane*> ( titlepaneControl );
       
  1700 
       
  1701                 CAknNavigationDecorator* topControl = Top( ETrue );
       
  1702 
       
  1703                 if ( titlePane && topControl &&
       
  1704                      topControl->NaviControlLayoutStyle() == 
       
  1705                         CAknNavigationDecorator::ENaviControlLayoutNarrow )
       
  1706                     {
       
  1707                     CEikImage* titleImage = titlePane->TitleImage();
       
  1708 
       
  1709                     CAknTitlePaneLabel* titleLabel =
       
  1710                         static_cast<CAknTitlePaneLabel*>(
       
  1711                             titlePane->TextLabel() );
       
  1712                     
       
  1713                     if ( titleImage )
       
  1714                         {
       
  1715                         if ( titleImage->Mask() )
       
  1716                             {
       
  1717                             gc.BitBltMasked( TPoint( 0, 0 ),
       
  1718                                              titleImage->Bitmap(),
       
  1719                                              intersection,
       
  1720                                              titleImage->Mask(),
       
  1721                                              ETrue );
       
  1722                             }
       
  1723                         else
       
  1724                             {
       
  1725                             gc.BitBlt( TPoint( 0, 0 ),
       
  1726                                        titleImage->Bitmap(),
       
  1727                                        intersection );
       
  1728                             }
       
  1729                         }
       
  1730                     else if ( titleLabel &&
       
  1731                               titleLabel->TextAsBitmap() &&
       
  1732                               titleLabel->TextAsMask() )
       
  1733                         {
       
  1734                         gc.BitBltMasked( TPoint( 0, 0 ),
       
  1735                                          titleLabel->TextAsBitmap(),
       
  1736                                          intersection,
       
  1737                                          titleLabel->TextAsMask(),
       
  1738                                          ETrue );
       
  1739                         }
       
  1740                     }
       
  1741                 }
       
  1742             }
       
  1743 
       
  1744         return;
       
  1745         }
       
  1746     //
       
  1747     // Navi pane is located in NORMAL STATUSPANE
       
  1748     //
       
  1749     else
       
  1750         {
       
  1751         TBool naviWipeUsed = NaviWipeUsed();
       
  1752 
       
  1753         TBool skinnedNaviWipeDrawn  = EFalse;
       
  1754         TBool skinnedNaviSolidDrawn = EFalse;
       
  1755         TBool defaultNaviWipeDrawn  = EFalse;
       
  1756         TBool defaultNaviSolidDrawn = EFalse;
       
  1757 
       
  1758         // If naviwipe is to be used, try first skinned draw...
       
  1759         if ( naviWipeUsed )
       
  1760             {
       
  1761             skinnedNaviWipeDrawn = DrawSkinnedNaviWipe( gc, rect, skin, cc );
       
  1762             }
       
  1763 
       
  1764         // If naviwipe is to be used and skinned draw failed,
       
  1765         // draw default wipe draw...
       
  1766         if ( naviWipeUsed && !skinnedNaviWipeDrawn )
       
  1767             {
       
  1768             defaultNaviWipeDrawn = DrawDefaultNaviWipe( gc, rect );
       
  1769             }
       
  1770 
       
  1771         // If naviwipe is not to be drawn or the nawiwipe draws has failed for
       
  1772         // some reason then draw solid. Try skinned solid draw first...
       
  1773         if ( !skinnedNaviWipeDrawn && !defaultNaviWipeDrawn )
       
  1774             {
       
  1775             skinnedNaviSolidDrawn = DrawSkinnedNaviSolid( gc, rect, skin, cc );
       
  1776             }
       
  1777 
       
  1778         // If not any above is the case, then draw the default solid here.
       
  1779         if ( !skinnedNaviWipeDrawn &&
       
  1780              !defaultNaviWipeDrawn &&
       
  1781              !skinnedNaviSolidDrawn &&
       
  1782              !defaultNaviSolidDrawn )
       
  1783             {
       
  1784             defaultNaviSolidDrawn = DrawDefaultNaviSolid( gc, rect );
       
  1785             }
       
  1786         }
       
  1787     }
       
  1788 
       
  1789 
       
  1790 // ---------------------------------------------------------------------------
       
  1791 // CAknNavigationControlContainer::HandlePointerEventL
       
  1792 // ---------------------------------------------------------------------------
       
  1793 //
       
  1794 EXPORT_C void CAknNavigationControlContainer::HandlePointerEventL(
       
  1795     const TPointerEvent& aPointerEvent )
       
  1796     {
       
  1797     CAknControl::HandlePointerEventL( aPointerEvent );
       
  1798     }
       
  1799 
       
  1800 
       
  1801 // ---------------------------------------------------------------------------
       
  1802 // CAknNavigationControlContainer::ExtensionInterface
       
  1803 // ---------------------------------------------------------------------------
       
  1804 //
       
  1805 EXPORT_C void* CAknNavigationControlContainer::ExtensionInterface(
       
  1806     TUid /*aInterface*/ )
       
  1807     {
       
  1808     return NULL;
       
  1809     }
       
  1810 
       
  1811 
       
  1812 // ---------------------------------------------------------------------------
       
  1813 // CAknNavigationControlContainer::ColorScheme
       
  1814 // ---------------------------------------------------------------------------
       
  1815 //
       
  1816 EXPORT_C TInt CAknNavigationControlContainer::ColorScheme()
       
  1817     {
       
  1818     TInt colorScheme = 0;
       
  1819 
       
  1820     CRepository* repository = NULL;
       
  1821     TRAPD( ret, repository = CRepository::NewL( KCRUidPersonalisation ) );
       
  1822     if ( ret == KErrNone )
       
  1823         {
       
  1824         ret = repository->Get( KPslnColorPalette, colorScheme );
       
  1825         }
       
  1826     delete repository;
       
  1827     
       
  1828 #ifdef AVKON_RDEBUG_INFO
       
  1829     _LIT( KDMsg, "Cenrep CAknNavigationControlContainer::ColorScheme %d" );
       
  1830     RDebug::Print( KDMsg, colorScheme );
       
  1831 #endif
       
  1832 
       
  1833     if ( colorScheme < 0 ||
       
  1834          colorScheme >= TInt( sizeof( KNaviWipeBitmaps ) / sizeof( TInt ) ) )
       
  1835         {
       
  1836         // If shared data returned illegal color scheme
       
  1837         // value default blue scheme is returned.
       
  1838         colorScheme = 0;
       
  1839         }
       
  1840 
       
  1841     return colorScheme;
       
  1842     }
       
  1843 
       
  1844 
       
  1845 // ---------------------------------------------------------------------------
       
  1846 // CAknNavigationControlContainer::NotifyNaviWipeStatusL
       
  1847 // ---------------------------------------------------------------------------
       
  1848 //
       
  1849 void CAknNavigationControlContainer::NotifyNaviWipeStatusL()
       
  1850     {
       
  1851     if ( iExtension && iExtension->iDestructionOngoing )
       
  1852         {
       
  1853         return;
       
  1854         }
       
  1855 
       
  1856     // If flat statuspane is active, then we don't have navi wipe on/off,
       
  1857     // but instead we bring title pane to the foreground or let navipane
       
  1858     // partially cover titlepane. But also in this we had to update naviwipe
       
  1859     // statuses, because layout might need to be switched.
       
  1860     if ( AknStatuspaneUtils::FlatLayoutActive() )
       
  1861         {
       
  1862         RWindow* naviwindow      = NULL;
       
  1863         CCoeControl* navicontrol = NULL;
       
  1864 
       
  1865         RWindow* titlewindow      = NULL;
       
  1866         CCoeControl* titlecontrol = NULL;
       
  1867         
       
  1868         RWindow* emptywindow      = NULL;
       
  1869         CCoeControl *emptycontrol = NULL;
       
  1870 
       
  1871         if ( iStatusPane )
       
  1872             {
       
  1873             TRAP_IGNORE( navicontrol =
       
  1874                             iStatusPane->ContainerControlL(
       
  1875                                 TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
  1876             if ( navicontrol )
       
  1877                 {
       
  1878                 RDrawableWindow* drawableWindow = navicontrol->DrawableWindow();
       
  1879                 if ( drawableWindow )
       
  1880                     {
       
  1881                     // trust that container is always RWindow
       
  1882                     naviwindow = static_cast <RWindow*> ( drawableWindow );
       
  1883                     }
       
  1884                 }
       
  1885 
       
  1886             TRAP_IGNORE( titlecontrol =
       
  1887                             iStatusPane->ContainerControlL(
       
  1888                                 TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
  1889             if ( titlecontrol )
       
  1890                 {
       
  1891                 RDrawableWindow* drawableWindow = titlecontrol->DrawableWindow();
       
  1892                 if ( drawableWindow )
       
  1893                     {
       
  1894                     // trust that container is always RWindow
       
  1895                     titlewindow = static_cast <RWindow*> ( drawableWindow );
       
  1896                     }
       
  1897                 }
       
  1898             
       
  1899             TRAP_IGNORE( emptycontrol = 
       
  1900                             iStatusPane->ContainerControlL(
       
  1901                                     TUid::Uid( EEikStatusPaneUidEmpty) ) );
       
  1902             if ( emptycontrol )
       
  1903                 {
       
  1904                 RDrawableWindow *drawableWindow = emptycontrol->DrawableWindow();
       
  1905                 if ( drawableWindow )
       
  1906                     {
       
  1907                     emptywindow = static_cast <RWindow*> ( drawableWindow );
       
  1908                     }
       
  1909                 }
       
  1910             }
       
  1911 
       
  1912         const TInt last = iNaviPaneControls->Count() - 1;
       
  1913         if ( ( last < 0 || !( iNaviPaneControls->At( last ) ) ) ||
       
  1914              ( last >= 0 &&
       
  1915                iNaviPaneControls->At( last ) && 
       
  1916                iNaviPaneControls->At( last )->ControlType() ==
       
  1917                    CAknNavigationDecorator::ENaviVolume ) )
       
  1918             {
       
  1919             // If not controls in navi stack, send navipane behind of titlepane
       
  1920             // Minus ordinal ordinal position number always means set
       
  1921             // the window to be the last one of the windows with the same
       
  1922             // ordinal priority
       
  1923             if ( iExtension->iIsActiveIdle )//Added for active idle's transparent
       
  1924             	{
       
  1925             if ( titlewindow )
       
  1926                 {
       
  1927                 titlewindow->SetOrdinalPosition( 4 );
       
  1928                 }
       
  1929             if ( naviwindow )
       
  1930                 {
       
  1931                 naviwindow->SetOrdinalPosition( 5 );
       
  1932                 }
       
  1933             if ( emptywindow )
       
  1934                 {
       
  1935                 emptywindow->SetOrdinalPosition( 6 );
       
  1936                 }
       
  1937               }
       
  1938            else
       
  1939              {
       
  1940              if ( titlewindow )
       
  1941                 {
       
  1942                 titlewindow->SetOrdinalPosition( -1 );
       
  1943                 }
       
  1944             if ( naviwindow )
       
  1945                 {
       
  1946                 naviwindow->SetOrdinalPosition( -1 );
       
  1947                 }
       
  1948             if ( emptywindow )
       
  1949                 {
       
  1950                 emptywindow->SetOrdinalPosition( -1 );
       
  1951                 }
       
  1952              }
       
  1953             }
       
  1954         else
       
  1955             {
       
  1956             // If  controls in navi stack, send titlepane behind the navipane.
       
  1957             // Minus ordinal ordinal position number always means set
       
  1958             // the window to be the last one of the windows with the same
       
  1959             // ordinal priority
       
  1960             if ( iExtension->iIsActiveIdle )//Added for active idle's transparent
       
  1961             	{
       
  1962             if ( naviwindow )
       
  1963                 {
       
  1964                 naviwindow->SetOrdinalPosition( 4 );
       
  1965                 }
       
  1966             if ( titlewindow )
       
  1967                 {
       
  1968                 titlewindow->SetOrdinalPosition( 5 );
       
  1969                 }
       
  1970             if ( emptywindow )
       
  1971                 {
       
  1972                 emptywindow->SetOrdinalPosition( 6 );
       
  1973                 }
       
  1974               }
       
  1975               else
       
  1976               	{
       
  1977              if ( naviwindow )
       
  1978                 {
       
  1979                 naviwindow->SetOrdinalPosition( -1 );
       
  1980                 }
       
  1981             if ( titlewindow )
       
  1982                 {
       
  1983                 titlewindow->SetOrdinalPosition( -1 );
       
  1984                 }
       
  1985             if ( emptywindow )
       
  1986                 {
       
  1987                 emptywindow->SetOrdinalPosition( -1 );
       
  1988                 }
       
  1989               	}
       
  1990             }
       
  1991 
       
  1992         // Finally request titlepane to refresh itself.
       
  1993         if( titlecontrol )
       
  1994             {
       
  1995             titlecontrol->SetSize( titlecontrol->Size() );
       
  1996             titlecontrol->DrawDeferred();
       
  1997             DrawDeferred();
       
  1998             }
       
  1999         }
       
  2000     }
       
  2001 
       
  2002 
       
  2003 // ---------------------------------------------------------------------------
       
  2004 // CAknNavigationControlContainer::HandleLosingForeground
       
  2005 // ---------------------------------------------------------------------------
       
  2006 //
       
  2007 void CAknNavigationControlContainer::HandleLosingForeground()
       
  2008     {
       
  2009     // If volume popup is shown when the navi pane loses foreground,
       
  2010     // then the popup needs to be closed if shown, and the volume control
       
  2011     // told that it's not the topmost control.    
       
  2012     CAknNavigationDecorator* topControl = Top();
       
  2013     
       
  2014     if ( topControl )
       
  2015         {
       
  2016         if ( topControl &&
       
  2017              topControl->ControlType() == CAknNavigationDecorator::ENaviVolume )
       
  2018             {
       
  2019             CAknVolumePopup* volumePopup =
       
  2020                 static_cast<CAknVolumePopup*> (
       
  2021                     topControl->iDecoratedControl );
       
  2022 
       
  2023             if ( volumePopup )
       
  2024                 {
       
  2025                 volumePopup->CloseVolumePopup();
       
  2026                 static_cast<CAknVolumeControl*>(
       
  2027                     topControl->DecoratedControl() )->HandleNaviStackChange( EFalse );
       
  2028                 }
       
  2029             }
       
  2030         }
       
  2031     }
       
  2032 
       
  2033 
       
  2034 // ---------------------------------------------------------------------------
       
  2035 // CAknNavigationControlContainer::HandleGainingForegroundL
       
  2036 // ---------------------------------------------------------------------------
       
  2037 //
       
  2038 void CAknNavigationControlContainer::HandleGainingForegroundL()
       
  2039     {
       
  2040     if ( iExtension && iExtension->iDestructionOngoing )
       
  2041         {
       
  2042         return;
       
  2043         }
       
  2044         
       
  2045     // Inform the volume popup about the foreground gain if it's the
       
  2046     // topmost control on the navi stack.
       
  2047     CAknNavigationDecorator* topControl = Top();
       
  2048     if ( topControl )
       
  2049         {
       
  2050         if ( topControl &&
       
  2051              topControl->ControlType() == CAknNavigationDecorator::ENaviVolume )
       
  2052             {
       
  2053             CAknVolumePopup* volumePopup =
       
  2054                 static_cast<CAknVolumePopup*> ( topControl->iDecoratedControl );
       
  2055 
       
  2056             if ( volumePopup )
       
  2057                 {
       
  2058                 static_cast<CAknVolumeControl*>(
       
  2059                     topControl->DecoratedControl() )->HandleNaviStackChange( ETrue );
       
  2060                 }
       
  2061             }
       
  2062         }
       
  2063     
       
  2064     NotifyNaviWipeStatusL();
       
  2065     }
       
  2066     
       
  2067 
       
  2068 // ---------------------------------------------------------------------------
       
  2069 // CAknNavigationControlContainer::NaviWipeUsed
       
  2070 // Naviwipe graphics is no more used (since 3.0).
       
  2071 // ---------------------------------------------------------------------------
       
  2072 //
       
  2073 TBool CAknNavigationControlContainer::NaviWipeUsed() const
       
  2074     {
       
  2075     return EFalse;
       
  2076     }
       
  2077 
       
  2078 
       
  2079 // ---------------------------------------------------------------------------
       
  2080 // CAknNavigationControlContainer::IsFepOwnedEditorIndicatorControl
       
  2081 // Checks whether a navi decorator is an editor indicator control owned
       
  2082 // by a FEP.
       
  2083 // ---------------------------------------------------------------------------
       
  2084 //
       
  2085 TBool CAknNavigationControlContainer::IsFepOwnedEditorIndicatorControl(
       
  2086     CAknNavigationDecorator* aDecorator ) const
       
  2087     {
       
  2088     TBool fepOwnedIndicator = EFalse;
       
  2089     MAknEditingStateIndicator* fepIndicator =
       
  2090         CAknEnv::Static()->EditingStateIndicator();
       
  2091     if ( aDecorator &&
       
  2092          aDecorator->ControlType() == CAknNavigationDecorator::EEditorIndicator &&
       
  2093          fepIndicator &&
       
  2094          fepIndicator->IndicatorContainer() == aDecorator->DecoratedControl() )
       
  2095         {
       
  2096         fepOwnedIndicator = ETrue;
       
  2097         }
       
  2098 
       
  2099     return fepOwnedIndicator;
       
  2100     }
       
  2101 
       
  2102 
       
  2103 // -----------------------------------------------------------------------------
       
  2104 // CAknNavigationControlContainer::HandleVisibilityOfNonFepOwnedIndicatorControl
       
  2105 // -----------------------------------------------------------------------------
       
  2106 //
       
  2107 void CAknNavigationControlContainer::HandleVisibilityOfNonFepOwnedIndicatorControl(
       
  2108     CAknNavigationDecorator* aDecorator,
       
  2109     TBool aVisible )
       
  2110     {
       
  2111     if ( aDecorator &&
       
  2112          aDecorator->ControlType() == CAknNavigationDecorator::EEditorIndicator &&
       
  2113          !IsFepOwnedEditorIndicatorControl( aDecorator ) )
       
  2114         {
       
  2115         aDecorator->DecoratedControl()->MakeVisible( aVisible );
       
  2116         }
       
  2117     }
       
  2118 
       
  2119 
       
  2120 // ---------------------------------------------------------------------------
       
  2121 // CAknNavigationControlContainer::DrawDefaultNaviWipe
       
  2122 // Naviwipe graphics is no more used (since 3.0).
       
  2123 // ---------------------------------------------------------------------------
       
  2124 //
       
  2125 TBool CAknNavigationControlContainer::DrawDefaultNaviWipe(
       
  2126     CWindowGc& /*aGc*/,
       
  2127     const TRect& /*aRect*/ ) const
       
  2128     {
       
  2129     return EFalse;
       
  2130     }
       
  2131 
       
  2132 
       
  2133 // ---------------------------------------------------------------------------
       
  2134 // CAknNavigationControlContainer::DrawDefaultNaviSolid
       
  2135 // ---------------------------------------------------------------------------
       
  2136 //
       
  2137 TBool CAknNavigationControlContainer::DrawDefaultNaviSolid(
       
  2138     CWindowGc& aGc,
       
  2139     const TRect& aRect ) const
       
  2140     {
       
  2141     TRect rect( aRect );
       
  2142 
       
  2143     // screen
       
  2144     TRect screenRect;
       
  2145     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
       
  2146 
       
  2147     // application window
       
  2148     TAknLayoutRect applicationWindowLayoutRect;
       
  2149     applicationWindowLayoutRect.LayoutRect(
       
  2150         screenRect,
       
  2151         AknLayoutScalable_Avkon::application_window( 0 ) );
       
  2152     TRect applicationWindowRect( applicationWindowLayoutRect.Rect() );
       
  2153 
       
  2154     // status pane
       
  2155     TAknLayoutRect statusPaneLayoutRect;
       
  2156     statusPaneLayoutRect.LayoutRect(
       
  2157         applicationWindowRect,
       
  2158         AknLayoutScalable_Avkon::status_pane( 0 ) );
       
  2159     TRect statusPaneRect( statusPaneLayoutRect.Rect() );
       
  2160 
       
  2161     // navi pane
       
  2162     TAknLayoutRect naviPaneLayoutRect;
       
  2163     if ( !Layout_Meta_Data::IsLandscapeOrientation() )
       
  2164         {
       
  2165         naviPaneLayoutRect.LayoutRect(
       
  2166             statusPaneRect,
       
  2167             AknLayoutScalable_Avkon::navi_pane( 5 ) );
       
  2168         }
       
  2169     else
       
  2170         {
       
  2171         if ( AknStatuspaneUtils::StaconPaneActive() )
       
  2172             {
       
  2173             TInt skVariety = AknStatuspaneUtils::StaconSoftKeysRight() ? 2 : 3;
       
  2174             naviPaneLayoutRect.LayoutRect(
       
  2175                 statusPaneRect,
       
  2176                 AknLayoutScalable_Avkon::navi_pane_stacon( skVariety ) );
       
  2177             }
       
  2178         else
       
  2179             {
       
  2180             naviPaneLayoutRect.LayoutRect(
       
  2181                 statusPaneRect,
       
  2182                 AknLayoutScalable_Avkon::navi_pane( 0 ) );
       
  2183             }
       
  2184         }
       
  2185     TRect naviPaneRect( naviPaneLayoutRect.Rect() );
       
  2186 
       
  2187     // navi wipe graphics
       
  2188     TAknLayoutRect naviWipeGraphicsLayoutRect;
       
  2189     naviWipeGraphicsLayoutRect.LayoutRect(
       
  2190         statusPaneRect,
       
  2191         AknLayoutScalable_Avkon::status_pane_g1( 0 ) );
       
  2192     TRect naviWipeGraphicsRect( naviWipeGraphicsLayoutRect.Rect() );
       
  2193 
       
  2194     TRect naviWipeNaviPanePart( naviWipeGraphicsRect );
       
  2195 
       
  2196     if ( naviWipeNaviPanePart.Intersects( naviPaneRect ) )
       
  2197         {
       
  2198         naviWipeNaviPanePart.Intersection( naviPaneRect );
       
  2199         // calculate new origo, relative to navipane rect.
       
  2200         naviWipeNaviPanePart.iTl.iX -= naviPaneRect.iTl.iX;
       
  2201         naviWipeNaviPanePart.iTl.iY -= naviPaneRect.iTl.iY;
       
  2202         naviWipeNaviPanePart.iBr.iX -= naviPaneRect.iTl.iX;
       
  2203         naviWipeNaviPanePart.iBr.iY -= naviPaneRect.iTl.iY;
       
  2204         }
       
  2205 
       
  2206     // Finally check where naviwipe intersects this rect
       
  2207     if ( naviWipeNaviPanePart.Intersects( rect ) )
       
  2208         {
       
  2209         naviWipeNaviPanePart.Intersection( rect );
       
  2210         }
       
  2211 
       
  2212     // Clear first to enable 1 pixel borders
       
  2213     aGc.SetPenStyle( CGraphicsContext::ENullPen );
       
  2214     aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  2215     aGc.SetBrushColor( AKN_LAF_COLOR( KStatusPaneBackgroundColor ) );
       
  2216     aGc.DrawRect( rect );
       
  2217 
       
  2218     // Draw the rect
       
  2219     aGc.SetPenStyle( CGraphicsContext::ENullPen );
       
  2220     aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  2221     aGc.SetBrushColor(
       
  2222         AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
       
  2223     aGc.DrawRect( naviWipeNaviPanePart );
       
  2224 
       
  2225     return ETrue;
       
  2226     }
       
  2227 
       
  2228 
       
  2229 // ---------------------------------------------------------------------------
       
  2230 // CAknNavigationControlContainer::DrawSkinnedNaviSolid
       
  2231 // Naviwipe graphics is no more used (since 3.0).
       
  2232 // ---------------------------------------------------------------------------
       
  2233 //
       
  2234 TBool CAknNavigationControlContainer::DrawSkinnedNaviWipe(
       
  2235     CWindowGc& /*aGc*/,
       
  2236     const TRect& /*aRect*/,
       
  2237     MAknsSkinInstance* /*skin*/,
       
  2238     MAknsControlContext* /*aCc*/) const
       
  2239     {
       
  2240     return EFalse;
       
  2241     }
       
  2242 
       
  2243 
       
  2244 // ---------------------------------------------------------------------------
       
  2245 // CAknNavigationControlContainer::DrawSkinnedNaviSolid
       
  2246 // ---------------------------------------------------------------------------
       
  2247 //
       
  2248 TBool CAknNavigationControlContainer::DrawSkinnedNaviSolid(
       
  2249     CWindowGc& aGc,
       
  2250     const TRect& aRect,
       
  2251     MAknsSkinInstance* aSkin,
       
  2252     MAknsControlContext* aCc ) const
       
  2253     {
       
  2254     TRect rect( aRect );
       
  2255 
       
  2256     aGc.SetPenStyle( CGraphicsContext::ENullPen );
       
  2257     aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  2258     aGc.SetBrushColor( AKN_LAF_COLOR( KStatusPaneBackgroundColor ) );
       
  2259 
       
  2260     return AknsDrawUtils::Background( aSkin, aCc, this, aGc, rect );
       
  2261     }
       
  2262 
       
  2263 
       
  2264 // ---------------------------------------------------------------------------
       
  2265 // CAknNavigationControlContainer::MopSupplyObject
       
  2266 // ---------------------------------------------------------------------------
       
  2267 //
       
  2268 TTypeUid::Ptr CAknNavigationControlContainer::MopSupplyObject( TTypeUid aId )
       
  2269     {
       
  2270     if ( aId.iUid == CAknNavigationControlContainer::ETypeId )
       
  2271         {
       
  2272         // Return self, this code makes it possible to workaround the fact
       
  2273         // that statuspane controls cannot be safely casted after
       
  2274         // retrieving them using CEikStatusPaneBase::ControlL().
       
  2275         //
       
  2276         // So now the caller could do something like this rather safely:
       
  2277         //
       
  2278         // CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
       
  2279         // CAknNavigationControlContainer* naviPane = NULL;
       
  2280         //
       
  2281         //if (statusPane &&
       
  2282         //    statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidNavi)).IsInCurrentLayout())
       
  2283         //    {
       
  2284         //    CCoeControl* control = statusPane->ControlL(TUid::Uid( EEikStatusPaneUidNavi ));
       
  2285         //    control->MopGetObject(naviPane);
       
  2286         //    }
       
  2287         //
       
  2288         //if (naviPane)
       
  2289         //  {
       
  2290         //  // The retrieved control was type of CAknNavigationControlContainer
       
  2291         //  }
       
  2292         //else
       
  2293         //  {
       
  2294         //  // The retrieved control was NOT type of CAknNavigationControlContainer.
       
  2295         //  // Someone has perhaps swap the control in the statuspane.
       
  2296         //  }
       
  2297         return aId.MakePtr( this );
       
  2298         }
       
  2299 
       
  2300     return CCoeControl::MopSupplyObject( aId );
       
  2301     }
       
  2302 
       
  2303 
       
  2304 // ---------------------------------------------------------------------------
       
  2305 // CAknNavigationControlContainer::LoadNaviColorBitmapL
       
  2306 // ---------------------------------------------------------------------------
       
  2307 //
       
  2308 void CAknNavigationControlContainer::LoadNaviColorBitmapL()
       
  2309     {
       
  2310     if ( !iExtension )
       
  2311         {
       
  2312         return;
       
  2313         }
       
  2314 
       
  2315     if ( iExtension->iNaviColorBitmap )
       
  2316         {
       
  2317         delete iExtension->iNaviColorBitmap;
       
  2318         iExtension->iNaviColorBitmap = NULL;
       
  2319         }
       
  2320 
       
  2321     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  2322     TRgb color( KRgbGray );
       
  2323 
       
  2324     if ( AknStatuspaneUtils::StaconPaneActive() )
       
  2325         {
       
  2326         AknsUtils::GetCachedColor( skin,
       
  2327                                    color,
       
  2328                                    KAknsIIDQsnIconColors,
       
  2329                                    EAknsCIQsnIconColorsCG25 );
       
  2330         }
       
  2331     else
       
  2332         {
       
  2333         AknsUtils::GetCachedColor( skin,
       
  2334                                    color,
       
  2335                                    KAknsIIDQsnIconColors,
       
  2336                                    EAknsCIQsnIconColorsCG7 );
       
  2337         }
       
  2338 
       
  2339     // Parent rect is searched from laf data because it can be zero sized when
       
  2340     // this method gets called from constructor.
       
  2341 
       
  2342     // screen
       
  2343     TRect screenRect;
       
  2344     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
       
  2345 
       
  2346     // app window
       
  2347     TAknLayoutRect applicationWindowLayoutRect;
       
  2348     applicationWindowLayoutRect.LayoutRect(
       
  2349         screenRect,
       
  2350         AknLayoutScalable_Avkon::application_window( 0 ) );
       
  2351     TRect applicationWindowRect( applicationWindowLayoutRect.Rect() );
       
  2352 
       
  2353     // statuspane
       
  2354     TAknLayoutRect statusPaneLayoutRect;
       
  2355     statusPaneLayoutRect.LayoutRect( applicationWindowRect,
       
  2356                                      AknLayoutScalable_Avkon::status_pane( 0 ) );
       
  2357     TRect statusPaneRect( statusPaneLayoutRect.Rect() );
       
  2358 
       
  2359     // navi pane
       
  2360     TAknLayoutRect naviPaneLayoutRect;
       
  2361     if ( !Layout_Meta_Data::IsLandscapeOrientation() )
       
  2362         {
       
  2363         naviPaneLayoutRect.LayoutRect( statusPaneRect,
       
  2364                                        AknLayoutScalable_Avkon::navi_pane( 5 ) );
       
  2365         }
       
  2366     else
       
  2367         {
       
  2368         if ( AknStatuspaneUtils::StaconPaneActive() )
       
  2369             {
       
  2370             TInt skVariety = AknStatuspaneUtils::StaconSoftKeysRight() ? 2 : 3;
       
  2371             naviPaneLayoutRect.LayoutRect( statusPaneRect,
       
  2372                                            AknLayoutScalable_Avkon::navi_pane_stacon( skVariety ) );
       
  2373             }
       
  2374         else
       
  2375             {
       
  2376             naviPaneLayoutRect.LayoutRect( statusPaneRect,
       
  2377                                            AknLayoutScalable_Avkon::navi_pane( 0 ) );
       
  2378             }
       
  2379         }
       
  2380     TRect naviPaneRect( naviPaneLayoutRect.Rect() );
       
  2381 
       
  2382     TRect parentRect( 0, 0, naviPaneRect.Width(), naviPaneRect.Height() );
       
  2383 
       
  2384     TAknLayoutRect rect;
       
  2385     rect.LayoutRect( parentRect,
       
  2386                      TAknWindowComponentLayout::Compose(
       
  2387                         AknLayoutScalable_Avkon::navi_navi_pane(),
       
  2388                         AknLayoutScalable_Avkon::navi_navi_pane_g1( 0 ) ) );
       
  2389 
       
  2390     iExtension->iNaviColorBitmap = new (ELeave) CFbsBitmap();
       
  2391 
       
  2392     AknIconConfig::TPreferredDisplayMode mode;
       
  2393     AknIconConfig::PreferredDisplayMode( mode, AknIconConfig::EImageTypeOffscreen );
       
  2394     
       
  2395     //To fix TSW Error:ELLI-7UU67E, we have to adjust color bitmap size so as to be
       
  2396     //different from arrow bitmap mask size, since it is weird that the arrow icon can't
       
  2397     //be shown correctly when they were the same size.
       
  2398     //This may be removed when NGA is stable enough.
       
  2399     TSize arrowSize( rect.Rect().Size().iWidth, rect.Rect().Size().iHeight-1 );
       
  2400     
       
  2401     TInt err = iExtension->iNaviColorBitmap->Create( arrowSize,
       
  2402                                                      mode.iBitmapMode );
       
  2403     if ( err != KErrNone )
       
  2404         {
       
  2405         delete iExtension->iNaviColorBitmap;
       
  2406         iExtension->iNaviColorBitmap = NULL;
       
  2407         return;
       
  2408         }
       
  2409 
       
  2410     CFbsBitmapDevice* destinationDevice =
       
  2411         CFbsBitmapDevice::NewL( iExtension->iNaviColorBitmap );
       
  2412     CleanupStack::PushL( destinationDevice );
       
  2413 
       
  2414     CFbsBitGc* destinationGc;
       
  2415     User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );
       
  2416 
       
  2417     destinationGc->SetPenColor( color );
       
  2418     destinationGc->SetPenStyle( CGraphicsContext::ESolidPen );
       
  2419     destinationGc->SetBrushColor( color );
       
  2420     destinationGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  2421     destinationGc->DrawRect( TRect( rect.Rect().Size() ) );
       
  2422 
       
  2423     delete destinationGc;
       
  2424     CleanupStack::PopAndDestroy( destinationDevice );
       
  2425     }
       
  2426 
       
  2427 
       
  2428 // ---------------------------------------------------------------------------
       
  2429 // CAknNavigationControlContainer::NaviColorBitmap
       
  2430 // ---------------------------------------------------------------------------
       
  2431 //
       
  2432 CFbsBitmap* CAknNavigationControlContainer::NaviColorBitmap() const
       
  2433     {
       
  2434     CFbsBitmap* bitmap = NULL;
       
  2435     
       
  2436     if ( iExtension )
       
  2437         {
       
  2438         bitmap = iExtension->iNaviColorBitmap;
       
  2439         }
       
  2440     
       
  2441     return bitmap;
       
  2442     }
       
  2443 
       
  2444 
       
  2445 // ---------------------------------------------------------------------------
       
  2446 // CAknNavigationControlContainer::CurrentNaviWipeBitmap
       
  2447 // Returns the index of the navi wipe graphics to be used.
       
  2448 // ---------------------------------------------------------------------------
       
  2449 //
       
  2450 TInt CAknNavigationControlContainer::CurrentNaviWipeBitmap()
       
  2451     {
       
  2452     TInt bitmapId =
       
  2453         KNaviWipeBitmaps[CAknNavigationControlContainer::ColorScheme()];
       
  2454 
       
  2455     // Do some safety checkings for the bitmap & mask values as AknIconUtils
       
  2456     // cannot cope with situation where one of them is in the mbm range and
       
  2457     // other in mif range. Default to blue if necessary.
       
  2458     if ( EMbmAvkonQgn_graf_navi_wipe_blue_mask > KMifIdFirst )
       
  2459         {
       
  2460         if ( bitmapId < KMifIdFirst && bitmapId != KNaviDrawWithSolidColor )
       
  2461             {
       
  2462             bitmapId = EMbmAvkonQgn_graf_navi_wipe_blue;
       
  2463             }
       
  2464         }
       
  2465     else
       
  2466         {
       
  2467         if ( bitmapId > KMifIdFirst && bitmapId != KNaviDrawWithSolidColor )
       
  2468             {
       
  2469             bitmapId = EMbmAvkonQgn_graf_navi_wipe_blue;
       
  2470             }
       
  2471         }
       
  2472 
       
  2473     return bitmapId;
       
  2474     }
       
  2475 
       
  2476 
       
  2477 // ---------------------------------------------------------------------------
       
  2478 // CAknNavigationControlContainer::SetBackgroundContextAttributes
       
  2479 // Naviwipe graphics is no more used (since 3.0)
       
  2480 // ---------------------------------------------------------------------------
       
  2481 //
       
  2482 void CAknNavigationControlContainer::SetBackgroundContextAttributes(
       
  2483     CCoeControl* /*aControl*/, TBool /*aNaviWipeUsed*/ )
       
  2484     {
       
  2485     return;
       
  2486     }
       
  2487 
       
  2488 
       
  2489 // ---------------------------------------------------------------------------
       
  2490 // CAknNavigationControlContainer::SetContainerWindowNonFading
       
  2491 // Allows/disallows fading of the navi pane.
       
  2492 // ---------------------------------------------------------------------------
       
  2493 //
       
  2494 void CAknNavigationControlContainer::SetContainerWindowNonFading(
       
  2495     TBool aNonFading )
       
  2496     {
       
  2497     if ( iStatusPane )
       
  2498         {
       
  2499         CCoeControl* control = NULL;
       
  2500         TRAPD( err,
       
  2501                control = iStatusPane->ContainerControlL(
       
  2502                             TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
  2503 
       
  2504         if ( !err && control )
       
  2505             {
       
  2506             control->DrawableWindow()->SetNonFading( aNonFading );
       
  2507             }
       
  2508         }
       
  2509     }
       
  2510 
       
  2511 
       
  2512 // ---------------------------------------------------------------------------
       
  2513 // CAknNavigationControlContainer::VolumePopupRect
       
  2514 // Gets the area for volume popup control from the layout data.
       
  2515 // ---------------------------------------------------------------------------
       
  2516 //
       
  2517 TRect CAknNavigationControlContainer::VolumePopupRect()
       
  2518     {
       
  2519     TAknLayoutRect layoutRect;
       
  2520 
       
  2521     TRect appRect;
       
  2522     AknLayoutUtils::LayoutMetricsRect(
       
  2523         AknLayoutUtils::EApplicationWindow,
       
  2524         appRect );
       
  2525     
       
  2526     if ( AknStatuspaneUtils::HDLayoutActive() || 
       
  2527          Layout_Meta_Data::IsLandscapeOrientation() )
       
  2528         {
       
  2529         layoutRect.LayoutRect(
       
  2530             appRect,
       
  2531             AknLayoutScalable_Avkon::main_pane( 13 ) );
       
  2532         }
       
  2533     else
       
  2534         {
       
  2535         layoutRect.LayoutRect(
       
  2536             appRect,
       
  2537             AknLayoutScalable_Avkon::main_pane( 3 ) );
       
  2538         }
       
  2539     
       
  2540     layoutRect.LayoutRect(
       
  2541         layoutRect.Rect(),
       
  2542         AknLayoutScalable_Avkon::popup_slider_window(
       
  2543             Layout_Meta_Data::IsLandscapeOrientation() )  );
       
  2544     
       
  2545     return layoutRect.Rect();
       
  2546     }
       
  2547 
       
  2548 
       
  2549 // ---------------------------------------------------------------------------
       
  2550 // CAknNavigationControlContainer::SetPreferredNaviDecoratorLayoutStyle
       
  2551 // Sets the preferred navi decorator layout.
       
  2552 // ---------------------------------------------------------------------------
       
  2553 //
       
  2554 EXPORT_C void CAknNavigationControlContainer::SetPreferredNaviDecoratorLayoutStyle(
       
  2555     TInt aLayoutStyle )
       
  2556     {
       
  2557     iExtension->iPreferredNaviDecoratorLayoutStyle = aLayoutStyle;
       
  2558     }
       
  2559 
       
  2560 //  End of File