uifw/AvKon/src/AknIncallStatusBubble.cpp
changeset 0 2f259fa3e83a
child 18 fcdfafb36fe7
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:  Handles incall status bubble drawing.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // SYSTEM INCLUDE FILES
       
    20 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    21 #include <uikon/eikdefmacros.h>
       
    22 #endif
       
    23 #include    <eikimage.h>
       
    24 #include    <eikenv.h>
       
    25 #include    <barsread.h>            // Resource reader
       
    26 #include    <bautils.h>             // erase
       
    27 #include    <avkon.rsg>
       
    28 #include    <AknsUtils.h>
       
    29 #include    <AknsDrawUtils.h>
       
    30 #include    <aknlayoutscalable_apps.cdl.h>
       
    31 #include    <layoutmetadata.cdl.h>
       
    32 #include    <AknIconUtils.h>
       
    33 #include    <featmgr.h>
       
    34 #include    <akniconconfig.h>
       
    35 #include    <coeaui.h>
       
    36 #include    <coemain.h>
       
    37 #include    <coreapplicationuisdomainpskeys.h> // KCoreAppUIsAutolockStatus
       
    38 
       
    39 #include <AknTasHook.h>
       
    40 // USER INCLUDE FILES
       
    41 #include    "AknIncallStatusBubble.h"
       
    42 #include    "AknBitmapAnimation.h"  // Animation definition
       
    43 #include    "AknUtils.h"
       
    44 #include    "aknappui.h"
       
    45 #include    "AknDef.h"
       
    46 #include    "aknconsts.h"
       
    47 #include    "AknStatuspaneUtils.h"
       
    48 
       
    49 // CONSTANTS
       
    50 
       
    51 // There does not seem to be any way to query WSERV wheter TRANSPARENCY option has been
       
    52 // defined. We use this constant to decide which way we do things.
       
    53 // const TBool KTransparentWindowsUsed = EFalse;  // Disabled at the moment for performance reasons.
       
    54 
       
    55 const TUid KPhoneAppUid      = { 0x100058B3 };
       
    56 const TUid KPhoneViewUid     = { 0x10282D81 };
       
    57 const TUid KPhoneVievCommand = { 0x2 }; // forces call handling to foreground
       
    58 const TUid KVideoCallUid     = { 0x101F8681 }; 
       
    59 
       
    60 // Note that some icons are masked and some are non-masked.
       
    61 
       
    62 enum // Grouped by icon layout...
       
    63     {
       
    64     // Layout1
       
    65     EIndexCallstatusQgn_indi_call_active = 0,
       
    66     EIndexCallstatusQgn_indi_call_active_mask,
       
    67     EIndexCallstatusQgn_indi_call_active_2,
       
    68     EIndexCallstatusQgn_indi_call_active_2_mask,
       
    69     EIndexCallstatusQgn_indi_call_active_cyph_off,
       
    70     EIndexCallstatusQgn_indi_call_active_cyph_off_mask,
       
    71     EIndexCallstatusQgn_indi_call_disconn,
       
    72     EIndexCallstatusQgn_indi_call_disconn_mask,
       
    73     EIndexCallstatusQgn_indi_call_disconn_cyph_off,
       
    74     EIndexCallstatusQgn_indi_call_disconn_cyph_off_mask,
       
    75     EIndexCallstatusQgn_indi_call_held,
       
    76     EIndexCallstatusQgn_indi_call_held_mask,
       
    77     EIndexCallstatusQgn_indi_call_held_cyph_off,
       
    78     EIndexCallstatusQgn_indi_call_held_cyph_off_mask,
       
    79     EIndexCallstatusQgn_indi_call_muted_callsta,
       
    80     EIndexCallstatusQgn_indi_call_muted_callsta_mask,
       
    81     EIndexCallstatusQgn_indi_call_video_callsta,
       
    82     EIndexCallstatusQgn_indi_call_video_callsta_mask,
       
    83     EIndexCallstatusQgn_indi_call_video_callsta_1,
       
    84     EIndexCallstatusQgn_indi_call_video_callsta_1_mask,
       
    85     EIndexCallstatusQgn_indi_call_video_callsta_2,
       
    86     EIndexCallstatusQgn_indi_call_video_callsta_2_mask,
       
    87     EIndexCallstatusQgn_indi_call_active_emergency,
       
    88     EIndexCallstatusQgn_indi_call_active_emergency_mask,
       
    89     EIndexCallstatusQgn_indi_call_video_1,
       
    90     EIndexCallstatusQgn_indi_call_video_1_mask,
       
    91     EIndexCallstatusQgn_indi_call_video_disconn,
       
    92     EIndexCallstatusQgn_indi_call_video_disconn_mask,
       
    93     EIndexCallStatusQgn_indi_call_voip_active,
       
    94     EIndexCallStatusQgn_indi_call_voip_active_mask,
       
    95     EIndexCallStatusQgn_indi_call_voip_active_2,
       
    96     EIndexCallStatusQgn_indi_call_voip_active_2_mask,
       
    97     EIndexCallStatusQgn_indi_call_voip_disconn,
       
    98     EIndexCallStatusQgn_indi_call_voip_disconn_mask,
       
    99     EIndexCallStatusQgn_indi_call_voip_held,
       
   100     EIndexCallStatusQgn_indi_call_voip_held_mask,
       
   101     ELayout1End = EIndexCallStatusQgn_indi_call_voip_held_mask,
       
   102 
       
   103     // Layout2
       
   104     EIndexCallstatusQgn_graf_bubble_incall,
       
   105     EIndexCallstatusQgn_graf_bubble_incall_mask,
       
   106     EIndexCallstatusQgn_graf_bubble_incall_disconn,
       
   107     EIndexCallstatusQgn_graf_bubble_incall_disconn_mask,
       
   108     ELayout2End = EIndexCallstatusQgn_graf_bubble_incall_disconn_mask,
       
   109 
       
   110     // Layout3
       
   111     EIndexCallstatusQgn_indi_call_cyphering_off,
       
   112     EIndexCallstatusQgn_indi_call_cyphering_off_mask, // not used, but AknIconUtils & SVG needs this to exist
       
   113     //ELayout3End = EIndexCallstatusQgn_indi_call_cyphering_off,
       
   114     ELayout3End = EIndexCallstatusQgn_indi_call_cyphering_off_mask,
       
   115 
       
   116     // Layout4
       
   117     EIndexCallstatusQgn_indi_call_data,
       
   118     EIndexCallstatusQgn_indi_call_data_mask, // not used, but AknIconUtils & SVG needs this to exist
       
   119     EIndexCallstatusQgn_indi_call_data_hscsd,
       
   120     EIndexCallstatusQgn_indi_call_data_hscsd_mask, // not used, but AknIconUtils & SVG needs this to exist
       
   121     EIndexCallstatusQgn_indi_call_fax,
       
   122     EIndexCallstatusQgn_indi_call_fax_mask, // not used, but AknIconUtils & SVG needs this to exist
       
   123     //ELayout4End = EIndexCallstatusQgn_indi_call_fax,
       
   124     ELayout4End = EIndexCallstatusQgn_indi_call_fax_mask,
       
   125 
       
   126     // Layout5
       
   127     EIndexCallstatusQgn_indi_call_line2,
       
   128     EIndexCallstatusQgn_indi_call_line2_mask, // not used, but AknIconUtils & SVG needs this to exist
       
   129     //ELayout5End = EIndexCallstatusQgn_indi_call_line2
       
   130     ELayout5End = EIndexCallstatusQgn_indi_call_line2_mask
       
   131     };
       
   132 
       
   133 // Cleanup stack helper.
       
   134 
       
   135 NONSHARABLE_CLASS( CCleanupGuard ) : public CBase
       
   136     {
       
   137     public:
       
   138         inline CCleanupGuard() {}
       
   139         ~CCleanupGuard();
       
   140     public:
       
   141         inline void SetItem1( CBase* aItem ) {iItem1 = aItem;}
       
   142         inline void SetItem2( CBase* aItem ) {iItem2 = aItem;}
       
   143     private:
       
   144         CBase* iItem1;
       
   145         CBase* iItem2;
       
   146     };
       
   147 
       
   148 CCleanupGuard::~CCleanupGuard()
       
   149     {
       
   150     delete iItem1;
       
   151     delete iItem2;
       
   152     }
       
   153 
       
   154 // ==== CIncallAnim  CLASS ======================
       
   155 
       
   156 /**
       
   157 * Helper class for animation control
       
   158 */
       
   159 NONSHARABLE_CLASS( CIncallAnim ) : public CCoeControl
       
   160     {
       
   161     public:
       
   162 
       
   163     enum
       
   164         {
       
   165         EDefaultCallAnim,
       
   166         EVoipCallAnim,
       
   167         EVideoCallAnim
       
   168         };
       
   169 
       
   170 
       
   171     public:
       
   172         void ConstructL( CIncallStatusBubble& aImages );
       
   173         ~CIncallAnim();
       
   174         void MakeVisible( TBool aVisible );
       
   175 
       
   176         void ClearAnimation();
       
   177         void SetAnimationL( CIncallStatusBubble& aImages,
       
   178                             TInt aCallAnimType = EDefaultCallAnim );
       
   179         void SetAnimationType( TInt aCallAnimType );
       
   180         void CreateBackGroundImageL( const CFbsBitmap* aBubbleBitmap,
       
   181                                      const CFbsBitmap* aBubbleMask,
       
   182                                      TRect aBubbleRect );
       
   183 
       
   184     private:
       
   185         void UpdateAnimationL( CIncallStatusBubble& aImages,
       
   186                                TInt aCallAnimType = EDefaultCallAnim );
       
   187         void SizeChanged();
       
   188         void Draw( const TRect& aRect ) const;
       
   189     private:
       
   190         CAknBitmapAnimation* iIndiAnim;
       
   191         CAknBitmapAnimation* iIndiVoIPAnim;
       
   192         CAknBitmapAnimation* iIndiVideoAnim;
       
   193         CFbsBitmap* iAnimBackGroundImage;
       
   194         mutable TBool iIsRunning;
       
   195         mutable TBool iIsVoIPRunning;
       
   196         mutable TBool iIsVideoRunning;
       
   197         TInt iCallAnimType;
       
   198     };
       
   199 
       
   200 // Constructor
       
   201 void CIncallAnim::ConstructL( CIncallStatusBubble& aImages )
       
   202     {
       
   203     iCallAnimType = EDefaultCallAnim;
       
   204 
       
   205     iAnimBackGroundImage = new ( ELeave ) CFbsBitmap();
       
   206 
       
   207     SetAnimationL( aImages );
       
   208 
       
   209     ActivateL();
       
   210 
       
   211     CCoeControl::MakeVisible( EFalse );
       
   212     }
       
   213 
       
   214 // Destructor
       
   215 CIncallAnim::~CIncallAnim()
       
   216     {
       
   217     delete iIndiAnim;
       
   218     delete iIndiVoIPAnim;
       
   219     delete iIndiVideoAnim;
       
   220     delete iAnimBackGroundImage;
       
   221     }
       
   222 
       
   223 void CIncallAnim::CreateBackGroundImageL(const CFbsBitmap* aBubbleBitmap, const CFbsBitmap* aBubbleMask, TRect aBubbleRect)
       
   224     {
       
   225     if (iAnimBackGroundImage && aBubbleBitmap && aBubbleMask)
       
   226         {
       
   227         CFbsBitmapDevice* destinationDevice = CFbsBitmapDevice::NewL(iAnimBackGroundImage);
       
   228         CleanupStack::PushL(destinationDevice);
       
   229 
       
   230         CFbsBitGc* destinationGc;
       
   231         User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );
       
   232 
       
   233         TRect rect = Rect();
       
   234         rect.Move(-aBubbleRect.iTl);
       
   235         destinationGc->BitBltMasked(TPoint(0,0), aBubbleBitmap, rect, aBubbleMask, ETrue);
       
   236 
       
   237         delete destinationGc;
       
   238         CleanupStack::PopAndDestroy(destinationDevice);
       
   239         }
       
   240     }
       
   241 
       
   242 // Position/Size changed
       
   243 void CIncallAnim::SizeChanged()
       
   244     {
       
   245     TRect rect( Rect() );
       
   246 
       
   247     if ( !iIndiAnim || !iIndiVoIPAnim || !iIndiVideoAnim )
       
   248         {
       
   249         return;
       
   250         }
       
   251 
       
   252     if ( Rect().IsEmpty() )
       
   253         return;
       
   254 
       
   255     if ( ( rect.Size() != iIndiAnim->Size() ) ||
       
   256          ( rect.Size() != iIndiVoIPAnim->Size() ) ||
       
   257          ( rect.Size() != iIndiVideoAnim->Size() ))
       
   258         {
       
   259         AknIconConfig::TPreferredDisplayMode mode;
       
   260         AknIconConfig::PreferredDisplayMode(mode, AknIconConfig::EImageTypeOffscreen);
       
   261         iAnimBackGroundImage->Create(
       
   262             Size(),
       
   263             mode.iBitmapMode);
       
   264         }
       
   265     iIndiAnim->SetRect( rect );
       
   266     iIndiVoIPAnim->SetRect( rect );
       
   267     iIndiVideoAnim->SetRect( rect );
       
   268     }
       
   269 
       
   270 // Draws the animation
       
   271 void CIncallAnim::Draw( const TRect& /*aRect*/ ) const
       
   272     {
       
   273     CAknBitmapAnimation* ok = NULL;
       
   274     switch (iCallAnimType)
       
   275         {
       
   276         case EDefaultCallAnim:
       
   277             ok = iIndiAnim;
       
   278             break;
       
   279         case EVoipCallAnim:
       
   280             ok = iIndiAnim;
       
   281             break;
       
   282         case EVideoCallAnim:
       
   283             ok = iIndiAnim;
       
   284             break;
       
   285         default:
       
   286             ok = NULL;
       
   287             break;
       
   288         }
       
   289     
       
   290     if ( !ok )
       
   291         {
       
   292         return;
       
   293         }
       
   294 
       
   295 
       
   296     // Background is no more copied from screen because it does not work very well.
       
   297     // Instead we use the image that has been set.
       
   298     if (iAnimBackGroundImage)
       
   299         {
       
   300         // Create frame for background
       
   301         CBitmapFrameData* data = NULL;
       
   302         TRAPD( error , ( data = CBitmapFrameData::NewL() ) );
       
   303         if ( error != KErrNone || data == NULL )
       
   304             {
       
   305             iIsRunning = EFalse;
       
   306             iIsVoIPRunning = EFalse;
       
   307             return;
       
   308             }
       
   309 
       
   310         data->SetBitmapsOwnedExternally( ETrue );
       
   311         data->SetBitmap( iAnimBackGroundImage );
       
   312         data->SetInterval( -1 );
       
   313 
       
   314         // Set frame to animation
       
   315         CBitmapAnimClientData* animData;
       
   316 
       
   317         if ( iCallAnimType == EVoipCallAnim )
       
   318             {
       
   319             animData = iIndiVoIPAnim->BitmapAnimData();
       
   320             }
       
   321         else if ( iCallAnimType == EVideoCallAnim )
       
   322             {
       
   323             animData = iIndiVideoAnim->BitmapAnimData();
       
   324             }
       
   325         else
       
   326             {
       
   327             animData = iIndiAnim->BitmapAnimData();
       
   328             }
       
   329 
       
   330         animData->SetBackgroundFrame( data );
       
   331 
       
   332         // This is a const function so mutable cast is needed
       
   333         // to change member variables
       
   334         CIncallAnim* mutableThis =
       
   335             MUTABLE_CAST( CIncallAnim* , this );
       
   336 
       
   337         // Start animation - we can't do a thing if this fails
       
   338         if ( iCallAnimType == EVoipCallAnim )
       
   339             {
       
   340             TRAP( error , iIndiVoIPAnim->StartAnimationL(EFalse) );
       
   341             mutableThis->iIsVoIPRunning = ETrue;
       
   342             mutableThis->iIsRunning = EFalse;
       
   343             mutableThis->iIsVideoRunning = EFalse;
       
   344             }
       
   345         else if ( iCallAnimType == EVideoCallAnim )
       
   346             {
       
   347             TRAP( error , iIndiVideoAnim->StartAnimationL(EFalse) );
       
   348             mutableThis->iIsVoIPRunning = EFalse;
       
   349             mutableThis->iIsVideoRunning = ETrue;
       
   350             mutableThis->iIsRunning = EFalse;
       
   351             }
       
   352         else
       
   353             {
       
   354             TRAP( error , iIndiAnim->StartAnimationL(EFalse) );
       
   355             mutableThis->iIsVoIPRunning = EFalse;
       
   356             mutableThis->iIsRunning = ETrue;
       
   357             mutableThis->iIsVideoRunning = EFalse;
       
   358             }
       
   359         }
       
   360     }
       
   361 
       
   362 // Creates new animation frames
       
   363 void CIncallAnim::SetAnimationL( CIncallStatusBubble& aImages, TInt aCallAnimType )
       
   364     {
       
   365     iCallAnimType = aCallAnimType;
       
   366 
       
   367     // Create new animation
       
   368     iIndiAnim = CAknBitmapAnimation::NewL();
       
   369     iIndiAnim->SetContainerWindowL( *this );
       
   370     iIndiVoIPAnim = CAknBitmapAnimation::NewL();
       
   371     iIndiVoIPAnim->SetContainerWindowL( *this );
       
   372     iIndiVideoAnim = CAknBitmapAnimation::NewL();
       
   373     iIndiVideoAnim->SetContainerWindowL( *this );
       
   374 
       
   375     TInt resourceReaderId = 0;
       
   376     resourceReaderId = R_BUBBLEMANAGER_ALERTING_ANIM;
       
   377     TResourceReader rr;
       
   378     iCoeEnv->CreateResourceReaderLC( rr , resourceReaderId );
       
   379     iIndiAnim->ConstructFromResourceL(rr);
       
   380     CleanupStack::PopAndDestroy(); // rr
       
   381 
       
   382     resourceReaderId = R_BUBBLEMANAGER_ALERTING_VOIP_ANIM;
       
   383     TResourceReader rr2;
       
   384     iCoeEnv->CreateResourceReaderLC( rr2 , resourceReaderId );
       
   385     iIndiVoIPAnim->ConstructFromResourceL(rr2);
       
   386     CleanupStack::PopAndDestroy(); // rr2
       
   387 
       
   388     resourceReaderId = R_BUBBLEMANAGER_ALERTING_VIDEO_ANIM;
       
   389     TResourceReader rr3;
       
   390     iCoeEnv->CreateResourceReaderLC( rr3 , resourceReaderId );
       
   391     iIndiVideoAnim->ConstructFromResourceL(rr3);
       
   392     CleanupStack::PopAndDestroy(); // rr3
       
   393 
       
   394     UpdateAnimationL( aImages, EDefaultCallAnim );// Normal CS call.
       
   395     UpdateAnimationL( aImages, EVoipCallAnim ); // VoIP call.
       
   396     UpdateAnimationL( aImages, EVideoCallAnim ); // Video call.
       
   397     }
       
   398 
       
   399 void CIncallAnim::UpdateAnimationL( CIncallStatusBubble& aImages, TInt aCallAnimType )
       
   400     {
       
   401     // Clear old data:
       
   402     CBitmapAnimClientData* animData;
       
   403     if ( aCallAnimType == EVoipCallAnim )
       
   404         {
       
   405         animData = iIndiVoIPAnim->BitmapAnimData();
       
   406         }
       
   407     else if (iCallAnimType == EVideoCallAnim)
       
   408         {
       
   409         animData = iIndiVideoAnim->BitmapAnimData();
       
   410         }
       
   411     else
       
   412         {
       
   413         animData = iIndiAnim->BitmapAnimData();
       
   414         }
       
   415 
       
   416     animData->ResetFrameArray();
       
   417 
       
   418     // Create frame 1
       
   419     CEikImage* image1 = new (ELeave) CEikImage;
       
   420     image1->SetPictureOwnedExternally( ETrue );
       
   421     CleanupStack::PushL( image1 );
       
   422 
       
   423     if ( aCallAnimType == EVoipCallAnim )
       
   424         {
       
   425         aImages.GetImage(
       
   426             *image1,
       
   427             EIndexCallStatusQgn_indi_call_voip_active,
       
   428             EIndexCallStatusQgn_indi_call_voip_active_mask
       
   429             );
       
   430         }
       
   431     else if (iCallAnimType == EVideoCallAnim)
       
   432         {
       
   433         aImages.GetImage(
       
   434             *image1,
       
   435             EIndexCallstatusQgn_indi_call_video_callsta_1,
       
   436             EIndexCallstatusQgn_indi_call_video_callsta_1_mask
       
   437             );
       
   438         }
       
   439     else
       
   440         {
       
   441         aImages.GetImage(
       
   442             *image1,
       
   443             EIndexCallstatusQgn_indi_call_active,
       
   444             EIndexCallstatusQgn_indi_call_active_mask
       
   445             );
       
   446         }
       
   447 
       
   448     CBitmapFrameData* frame1 = CBitmapFrameData::NewL(
       
   449         MUTABLE_CAST( CFbsBitmap*, image1->Bitmap() ),
       
   450         MUTABLE_CAST( CFbsBitmap*, image1->Mask() ) );
       
   451 
       
   452     frame1->SetInterval( KErrNotFound );
       
   453     frame1->SetBitmapsOwnedExternally( ETrue );
       
   454     CleanupStack::PushL( frame1 );
       
   455 
       
   456     animData->AppendFrameL( frame1 ); // Takes ownership
       
   457 
       
   458     CleanupStack::Pop( frame1 );
       
   459     CleanupStack::PopAndDestroy( image1 );
       
   460 
       
   461     // Create frame 2
       
   462     CEikImage* image2 = new (ELeave) CEikImage;
       
   463     image2->SetPictureOwnedExternally( ETrue );
       
   464     CleanupStack::PushL( image2 );
       
   465 
       
   466     if ( aCallAnimType == EVoipCallAnim )
       
   467         {
       
   468         aImages.GetImage(
       
   469             *image2,
       
   470             EIndexCallStatusQgn_indi_call_voip_active_2,
       
   471             EIndexCallStatusQgn_indi_call_voip_active_2_mask
       
   472             );
       
   473         }
       
   474     else if (iCallAnimType == EVideoCallAnim)
       
   475         {
       
   476         aImages.GetImage(
       
   477             *image2,
       
   478             EIndexCallstatusQgn_indi_call_video_callsta_2,
       
   479             EIndexCallstatusQgn_indi_call_video_callsta_2_mask
       
   480             );
       
   481         }
       
   482     else
       
   483         {
       
   484         aImages.GetImage(
       
   485             *image2,
       
   486             EIndexCallstatusQgn_indi_call_active_2,
       
   487             EIndexCallstatusQgn_indi_call_active_2_mask
       
   488             );
       
   489         }
       
   490 
       
   491     CBitmapFrameData* frame2 = CBitmapFrameData::NewL(
       
   492         MUTABLE_CAST( CFbsBitmap*, image2->Bitmap() ),
       
   493         MUTABLE_CAST( CFbsBitmap*, image2->Mask() ) );
       
   494 
       
   495     frame2->SetInterval( KErrNotFound );
       
   496     frame2->SetBitmapsOwnedExternally( ETrue );
       
   497     CleanupStack::PushL( frame2 );
       
   498 
       
   499     animData->AppendFrameL( frame2 ); // Takes ownership
       
   500 
       
   501     CleanupStack::Pop( frame2 );
       
   502     CleanupStack::PopAndDestroy( image2 );
       
   503     }
       
   504 
       
   505 void CIncallAnim::SetAnimationType( TInt aCallAnimType )
       
   506     {
       
   507     iCallAnimType = aCallAnimType;
       
   508     }
       
   509 
       
   510 // Clears current animation
       
   511 void CIncallAnim::ClearAnimation()
       
   512     {
       
   513     if ( iIndiAnim )
       
   514         {
       
   515         CBitmapAnimClientData* animData = iIndiAnim->BitmapAnimData();
       
   516         animData->ResetFrameArray();
       
   517         }
       
   518     delete iIndiAnim;
       
   519     iIndiAnim = NULL;
       
   520 
       
   521     if ( iIndiVoIPAnim )
       
   522         {
       
   523         CBitmapAnimClientData* animData = iIndiVoIPAnim->BitmapAnimData();
       
   524         animData->ResetFrameArray();
       
   525         }
       
   526     delete iIndiVoIPAnim;
       
   527     iIndiVoIPAnim = NULL;
       
   528 
       
   529     if ( iIndiVideoAnim )
       
   530         {
       
   531         CBitmapAnimClientData* animData = iIndiVideoAnim->BitmapAnimData();
       
   532         animData->ResetFrameArray();
       
   533         }
       
   534     delete iIndiVideoAnim;
       
   535     iIndiVideoAnim = NULL;
       
   536 
       
   537     }
       
   538 
       
   539 // Make visible
       
   540 void CIncallAnim::MakeVisible( TBool aVisible )
       
   541     {
       
   542     if ( IsVisible() && !aVisible && iIndiAnim && iIsRunning )
       
   543         {
       
   544         TInt err = iIndiAnim->CancelAnimation();
       
   545         if ( err == KErrNone )
       
   546             {
       
   547             iIsRunning = EFalse;
       
   548             }
       
   549         }
       
   550 
       
   551     if ( IsVisible() && !aVisible && iIndiVoIPAnim && iIsVoIPRunning )
       
   552         {
       
   553         TInt err = iIndiVoIPAnim->CancelAnimation();
       
   554         if ( err == KErrNone )
       
   555             {
       
   556             iIsVoIPRunning = EFalse;
       
   557             }
       
   558         }
       
   559 
       
   560     if ( IsVisible() && !aVisible && iIndiVideoAnim && iIsVideoRunning )
       
   561         {
       
   562         TInt err = iIndiVideoAnim->CancelAnimation();
       
   563         if ( err == KErrNone )
       
   564             {
       
   565             iIsVideoRunning = EFalse;
       
   566             }
       
   567         }
       
   568 
       
   569     CCoeControl::MakeVisible( aVisible ); // a call to parent's method
       
   570     }
       
   571 
       
   572 // ==== CIncallAnim  CLASS ======================
       
   573 
       
   574 /**
       
   575 * Helper class for muted icon (has its own window)
       
   576 */
       
   577 NONSHARABLE_CLASS(CIncallMuted) : public CCoeControl
       
   578     {
       
   579     public:
       
   580         void ConstructL( CCoeControl& aParent );
       
   581         ~CIncallMuted();
       
   582 
       
   583         void SetMutedImage(
       
   584             const CFbsBitmap* aBitmap ,
       
   585             const CFbsBitmap* aMask );
       
   586 
       
   587         TInt CountComponentControls() const;
       
   588         CCoeControl* ComponentControl(TInt aIndex) const;
       
   589     private:
       
   590         void SizeChanged();
       
   591         void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   592 
       
   593     private:
       
   594         CEikImage* iMutedImage;
       
   595         CIncallStatusBubble *iIncallStatusBubble;
       
   596     };
       
   597 
       
   598 // Constructor
       
   599 void CIncallMuted::ConstructL( CCoeControl& aParent )
       
   600     {
       
   601     SetContainerWindowL( aParent );
       
   602 
       
   603     iIncallStatusBubble = ( CIncallStatusBubble* ) &aParent;
       
   604 
       
   605     iMutedImage = new( ELeave ) CEikImage;
       
   606     iMutedImage->SetContainerWindowL( *this );
       
   607     iMutedImage->SetPictureOwnedExternally( ETrue );
       
   608     iMutedImage->MakeVisible( EFalse );
       
   609 
       
   610     SetComponentsToInheritVisibility();
       
   611     Window().SetPointerGrab( ETrue );
       
   612     EnableDragEvents();
       
   613     }
       
   614 
       
   615 // Destructor
       
   616 CIncallMuted::~CIncallMuted()
       
   617     {
       
   618     delete iMutedImage;
       
   619     }
       
   620 
       
   621 // Sets images
       
   622 void CIncallMuted::SetMutedImage(
       
   623     const CFbsBitmap* aBitmap ,
       
   624     const CFbsBitmap* aMask )
       
   625     {
       
   626     iMutedImage->SetPicture( aBitmap , aMask );
       
   627     SizeChanged();
       
   628     }
       
   629 
       
   630 // Count component control
       
   631 TInt CIncallMuted::CountComponentControls() const
       
   632     {
       
   633     return 1;
       
   634     }
       
   635 
       
   636 // Component control
       
   637 CCoeControl* CIncallMuted::ComponentControl( TInt /*aIndex*/ ) const
       
   638     {
       
   639     return iMutedImage;
       
   640     }
       
   641 
       
   642 // New size is checked.
       
   643 void CIncallMuted::SizeChanged()
       
   644     {
       
   645     if ( !iMutedImage )
       
   646         {
       
   647         return;
       
   648         }
       
   649 
       
   650     iMutedImage->SetRect( Rect() );
       
   651 
       
   652     CFbsBitmap* bitmap = (CFbsBitmap*)iMutedImage->Bitmap();
       
   653     if ( bitmap )
       
   654         {
       
   655         AknIconUtils::SetSize( bitmap, Size() );
       
   656         }
       
   657     }
       
   658 
       
   659 
       
   660 void CIncallMuted::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   661     {
       
   662     CCoeControl::HandlePointerEventL( aPointerEvent );
       
   663 
       
   664     iIncallStatusBubble->HandlePointerEventL( aPointerEvent );
       
   665     }
       
   666 
       
   667 // ================ CIncallStatusBubble CLASS ===============
       
   668 
       
   669 // ================= MEMBER FUNCTIONS =======================
       
   670 
       
   671 // Constructor
       
   672 CIncallStatusBubble::CIncallStatusBubble() : iOrder( CompareSkinnedData )
       
   673     {
       
   674     }
       
   675 
       
   676 // NewL
       
   677 CIncallStatusBubble* CIncallStatusBubble::NewL( const TRect& aRect )
       
   678     {
       
   679     CIncallStatusBubble* self = new ( ELeave ) CIncallStatusBubble;
       
   680     CleanupStack::PushL( self );
       
   681     self->ConstructL( aRect );
       
   682     CleanupStack::Pop();
       
   683     AKNTASHOOK_ADDL( self, "CIncallStatusBubble" );
       
   684     return self;
       
   685     }
       
   686 
       
   687 
       
   688 // ---------------------------------------------------------
       
   689 // CIncallStatusBubble::ConstructL(const TRect& aRect)
       
   690 // EPOC two phased constructor
       
   691 //
       
   692 // ---------------------------------------------------------
       
   693 //
       
   694 void CIncallStatusBubble::ConstructL( const TRect& aRect )
       
   695     {
       
   696     iMyWindowGroup=RWindowGroup( iCoeEnv->WsSession() );
       
   697     User::LeaveIfError( iMyWindowGroup.Construct( (TUint32)&iMyWindowGroup,
       
   698                                                    EFalse ) );
       
   699     iMyWindowGroup.SetOrdinalPosition( 0, ECoeWinPriorityMedium );
       
   700     CreateWindowL( &iMyWindowGroup );
       
   701 
       
   702     // Load bitmaps to an array
       
   703     iBitmaps = new ( ELeave ) CArrayPtrFlat<CFbsBitmap>( 4 );
       
   704     LoadImagesL();
       
   705 
       
   706     // Create skinned animation
       
   707     iSmallIndiAnim = new( ELeave ) CIncallAnim;
       
   708     iSmallIndiAnim->SetContainerWindowL( *this );
       
   709     iSmallIndiAnim->ConstructL( *this );
       
   710 
       
   711     // call indication
       
   712     iSmallCallIndication = CreateNewEikImageL();
       
   713 
       
   714     // bubble icon
       
   715     iBubble = CreateNewEikImageL();
       
   716 
       
   717     // type indicatiors
       
   718     iTypeIndication1 = CreateNewEikImageL();
       
   719     iTypeIndication2 = CreateNewEikImageL();
       
   720 
       
   721     // skinned muted icon
       
   722     iMutedIcon = new(ELeave) CIncallMuted;
       
   723     iMutedIcon->ConstructL( *this );
       
   724     CEikImage* tmpMutedImage = new(ELeave) CEikImage;
       
   725     CleanupStack::PushL( tmpMutedImage );
       
   726     tmpMutedImage->SetPictureOwnedExternally( ETrue );
       
   727     GetImage(
       
   728         *tmpMutedImage,
       
   729         EIndexCallstatusQgn_indi_call_muted_callsta,
       
   730         EIndexCallstatusQgn_indi_call_muted_callsta_mask
       
   731         );
       
   732     iMutedIcon->SetMutedImage(tmpMutedImage->Bitmap(), tmpMutedImage->Mask());
       
   733     CleanupStack::PopAndDestroy( tmpMutedImage );
       
   734     iMutedIcon->MakeVisible( EFalse );
       
   735 
       
   736     // Cyph off image
       
   737     iCyphOffIcon = CreateNewEikImageL();
       
   738     iPressedDown = EFalse; 
       
   739     // finnish the job
       
   740     MakeVisible( EFalse );
       
   741     SetRect( aRect );
       
   742     Window().SetPointerGrab( ETrue );
       
   743     EnableDragEvents();
       
   744 
       
   745     ActivateL();
       
   746     }
       
   747 
       
   748 // ---------------------------------------------------------
       
   749 // CIncallStatusBubble::CreateNewEikImageL
       
   750 //
       
   751 // ---------------------------------------------------------
       
   752 //
       
   753 CEikImage* CIncallStatusBubble::CreateNewEikImageL() const
       
   754     {
       
   755     CEikImage* newImage = new( ELeave ) CEikImage;
       
   756     CleanupStack::PushL( newImage );
       
   757     newImage->SetContainerWindowL( *this );
       
   758     newImage->SetPictureOwnedExternally( ETrue );
       
   759     newImage->SetPicture( NULL );
       
   760     newImage->MakeVisible( EFalse );
       
   761     CleanupStack::Pop(); // newImage
       
   762     return newImage;
       
   763     }
       
   764 
       
   765 // ---------------------------------------------------------
       
   766 // CIncallStatusBubble::LoadImagesL
       
   767 //
       
   768 // ---------------------------------------------------------
       
   769 //
       
   770 void CIncallStatusBubble::LoadImagesL()
       
   771     {
       
   772     // These need to be loaded in the same order as defined in the
       
   773     // enumeration in the beginning of this file.
       
   774 
       
   775     LoadImageL(
       
   776         EMbmCallstatusQgn_indi_call_active,
       
   777         EMbmCallstatusQgn_indi_call_active_mask );
       
   778 
       
   779     LoadImageL(
       
   780         EMbmCallstatusQgn_indi_call_active_2,
       
   781         EMbmCallstatusQgn_indi_call_active_2_mask );
       
   782 
       
   783     LoadImageL(
       
   784         EMbmCallstatusQgn_indi_call_active_cyph_off,
       
   785         EMbmCallstatusQgn_indi_call_active_cyph_off_mask );
       
   786 
       
   787     LoadImageL(
       
   788         EMbmCallstatusQgn_indi_call_disconn,
       
   789         EMbmCallstatusQgn_indi_call_disconn_mask );
       
   790 
       
   791     LoadImageL(
       
   792         EMbmCallstatusQgn_indi_call_disconn_cyph_off,
       
   793         EMbmCallstatusQgn_indi_call_disconn_cyph_off_mask );
       
   794 
       
   795     LoadImageL(
       
   796         EMbmCallstatusQgn_indi_call_held,
       
   797         EMbmCallstatusQgn_indi_call_held_mask );
       
   798 
       
   799     LoadImageL(
       
   800         EMbmCallstatusQgn_indi_call_held_cyph_off,
       
   801         EMbmCallstatusQgn_indi_call_held_cyph_off_mask );
       
   802 
       
   803     LoadImageL(
       
   804         EMbmCallstatusQgn_indi_call_muted_callsta,
       
   805         EMbmCallstatusQgn_indi_call_muted_callsta_mask );
       
   806 
       
   807     LoadImageL(
       
   808         EMbmCallstatusQgn_indi_call_video_callsta,
       
   809         EMbmCallstatusQgn_indi_call_video_callsta_mask );
       
   810 
       
   811     LoadImageL(
       
   812         EMbmCallstatusQgn_indi_call_video_callsta_1,
       
   813         EMbmCallstatusQgn_indi_call_video_callsta_1_mask );
       
   814 
       
   815     LoadImageL(
       
   816         EMbmCallstatusQgn_indi_call_video_callsta_2,
       
   817         EMbmCallstatusQgn_indi_call_video_callsta_2_mask );
       
   818 
       
   819     LoadImageL(
       
   820         EMbmCallstatusQgn_indi_call_active_emergency,
       
   821         EMbmCallstatusQgn_indi_call_active_emergency_mask );
       
   822 
       
   823     LoadImageL(
       
   824         EMbmCallstatusQgn_indi_call_video_1,
       
   825         EMbmCallstatusQgn_indi_call_video_1_mask );
       
   826 
       
   827     LoadImageL(
       
   828         EMbmCallstatusQgn_indi_call_video_disconn,
       
   829         EMbmCallstatusQgn_indi_call_video_disconn_mask );
       
   830 
       
   831     LoadImageL(
       
   832         EMbmCallstatusQgn_indi_call_voip_active,
       
   833         EMbmCallstatusQgn_indi_call_voip_active_mask );
       
   834 
       
   835     LoadImageL(
       
   836         EMbmCallstatusQgn_indi_call_voip_active_2,
       
   837         EMbmCallstatusQgn_indi_call_voip_active_2_mask );
       
   838 
       
   839     LoadImageL(
       
   840         EMbmCallstatusQgn_indi_call_voip_disconn,
       
   841         EMbmCallstatusQgn_indi_call_voip_disconn_mask );
       
   842 
       
   843     LoadImageL(
       
   844         EMbmCallstatusQgn_indi_call_voip_held,
       
   845         EMbmCallstatusQgn_indi_call_voip_held_mask );
       
   846 
       
   847     LoadImageL(
       
   848         EMbmCallstatusQgn_graf_bubble_incall,
       
   849         EMbmCallstatusQgn_graf_bubble_incall_mask );
       
   850 
       
   851     LoadImageL(
       
   852         EMbmCallstatusQgn_graf_bubble_incall_disconn,
       
   853         EMbmCallstatusQgn_graf_bubble_incall_disconn_mask );
       
   854 
       
   855     LoadImageL( EMbmCallstatusQgn_indi_call_cyphering_off );
       
   856 
       
   857     LoadImageL( EMbmCallstatusQgn_indi_call_data );
       
   858 
       
   859     LoadImageL( EMbmCallstatusQgn_indi_call_data_hscsd );
       
   860 
       
   861     LoadImageL( EMbmCallstatusQgn_indi_call_fax );
       
   862 
       
   863     LoadImageL( EMbmCallstatusQgn_indi_call_line2 );
       
   864     }
       
   865 
       
   866 
       
   867 // Destructor
       
   868 CIncallStatusBubble::~CIncallStatusBubble()
       
   869     {
       
   870     AKNTASHOOK_REMOVE();
       
   871     delete iMutedIcon;
       
   872     delete iSmallCallIndication;
       
   873     delete iSmallIndiAnim;
       
   874     delete iTypeIndication1;
       
   875     delete iTypeIndication2;
       
   876     delete iCyphOffIcon;
       
   877     delete iBubble;
       
   878 
       
   879     iSkins.ResetAndDestroy();
       
   880     delete iSkinnedColourBitmap;
       
   881 
       
   882     if ( iBitmaps )
       
   883         {
       
   884         iBitmaps->ResetAndDestroy( );
       
   885         delete iBitmaps;
       
   886         }
       
   887 
       
   888     iMyWindowGroup.Close();
       
   889     }
       
   890 
       
   891 // ---------------------------------------------------------
       
   892 // CIncallStatusBubble::SizeChanged()
       
   893 // Called by framework when the view size is changed
       
   894 //
       
   895 // ---------------------------------------------------------
       
   896 //
       
   897 void CIncallStatusBubble::SizeChanged()
       
   898     {
       
   899     // For performance optimization purposes we do not continue if
       
   900     // we are not visible. Assumed that SetIncallBubbleFlags() causes
       
   901     // this method to be called again.
       
   902     if (!IsVisible() && !(iFlags & ESBVisible))
       
   903         return;
       
   904 
       
   905     TRect rect( Rect() );
       
   906     TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() );
       
   907 
       
   908     // Set componets to right places
       
   909 
       
   910     TAknWindowLineLayout layout1(
       
   911         AknLayoutScalable_Apps::popup_call_status_window_g1(
       
   912             isLandscape ).LayoutLine() );
       
   913 
       
   914     TAknWindowLineLayout layout2(
       
   915         AknLayoutScalable_Apps::popup_call_status_window_g2(
       
   916             isLandscape ).LayoutLine() );
       
   917 
       
   918     TAknWindowLineLayout layout3(
       
   919         AknLayoutScalable_Apps::popup_call_status_window_g3( isLandscape ).LayoutLine() );
       
   920 
       
   921     TAknWindowLineLayout layout4(
       
   922         AknLayoutScalable_Apps::call_type_pane_g1().LayoutLine() );
       
   923 
       
   924     TAknWindowLineLayout layout5(
       
   925         AknLayoutScalable_Apps::call_type_pane_g2().LayoutLine() );
       
   926 
       
   927     AknLayoutUtils::LayoutImage( iBubble, rect, layout1 );
       
   928 
       
   929     AknLayoutUtils::LayoutControl( iSmallCallIndication, rect, layout2 );
       
   930 
       
   931     AknLayoutUtils::LayoutControl( iSmallIndiAnim, rect, layout2 );
       
   932 
       
   933     AknLayoutUtils::LayoutControl( iMutedIcon, rect, layout2 );
       
   934 
       
   935     TAknLayoutRect callTypeIndicationLayoutRect;
       
   936     callTypeIndicationLayoutRect.LayoutRect(
       
   937         rect,
       
   938         AknLayoutScalable_Apps::call_type_pane( isLandscape ) );
       
   939     TRect callTypeIndicationRect( callTypeIndicationLayoutRect.Rect() );
       
   940     
       
   941     TBool hideTypeIndication = isLandscape && !AknStatuspaneUtils::HDLayoutActive();
       
   942     	
       
   943     if ( iFlags & ESBVideo )
       
   944         {
       
   945         // video indicator is different size than others
       
   946         AknLayoutUtils::LayoutControl( iTypeIndication1, rect,  layout2 );
       
   947         }
       
   948     else
       
   949         {
       
   950         if ( hideTypeIndication )
       
   951             {
       
   952             // Not shown in landscape, because there's not enough space.
       
   953             TRect nullRect( 0, 0, 0, 0 );
       
   954             iTypeIndication1->SetRect( nullRect );
       
   955             iTypeIndication2->SetRect( nullRect );
       
   956             iCyphOffIcon->SetRect( nullRect );
       
   957             }
       
   958         else
       
   959             {
       
   960             AknLayoutUtils::LayoutControl( iTypeIndication1,
       
   961                                            callTypeIndicationRect,
       
   962                                            layout4 );
       
   963 
       
   964             AknLayoutUtils::LayoutControl( iTypeIndication2,
       
   965                                            callTypeIndicationRect,
       
   966                                            layout5 );
       
   967 
       
   968             AknLayoutUtils::LayoutControl( iCyphOffIcon,
       
   969                                            rect,
       
   970                                            layout3 );
       
   971             }
       
   972         }
       
   973 
       
   974     // Bitmaps must be validated (size is set) before they can be used.
       
   975     TAknLayoutRect layoutRect;
       
   976 
       
   977     TInt ii;
       
   978 
       
   979     // Layout group 1
       
   980     layoutRect.LayoutRect( rect, layout2 );
       
   981     for ( ii = EIndexCallstatusQgn_indi_call_active; ii <= ELayout1End; ii++ )
       
   982         {
       
   983         AknIconUtils::SetSize( iBitmaps->At(ii), layoutRect.Rect().Size() );
       
   984         }
       
   985 
       
   986     if ( iSmallCallIndication )
       
   987         {
       
   988         CFbsBitmap* bitmap = (CFbsBitmap*)iSmallCallIndication->Bitmap();
       
   989         if ( bitmap )
       
   990             {
       
   991             AknIconUtils::SetSize( bitmap, iSmallCallIndication->Rect().Size() );
       
   992             }
       
   993         }
       
   994 
       
   995 
       
   996     // Layout group 2
       
   997     layoutRect.LayoutRect( rect, layout1 );
       
   998     for ( ii = EIndexCallstatusQgn_graf_bubble_incall; ii < ELayout2End; ii++ )
       
   999         {
       
  1000         AknIconUtils::SetSize( iBitmaps->At(ii), layoutRect.Rect().Size() );
       
  1001         }
       
  1002 
       
  1003     if ( iBubble )
       
  1004         {
       
  1005         CFbsBitmap* bitmap = (CFbsBitmap*)iBubble->Bitmap();
       
  1006         if ( bitmap )
       
  1007             {
       
  1008             AknIconUtils::SetSize( bitmap, iBubble->Rect().Size() );
       
  1009             }
       
  1010         }
       
  1011 
       
  1012 
       
  1013     // Layout group 3
       
  1014     layoutRect.LayoutRect( rect, layout3 );
       
  1015     for ( ii = EIndexCallstatusQgn_indi_call_cyphering_off; ii <= ELayout3End; ii++ )
       
  1016         {
       
  1017         if ( hideTypeIndication )
       
  1018             {
       
  1019             // Not shown in landscape, because there's not enough space.
       
  1020             AknIconUtils::SetSize( iBitmaps->At(ii), TSize(0,0) );
       
  1021             }
       
  1022         else
       
  1023             {
       
  1024             AknIconUtils::SetSize( iBitmaps->At(ii), layoutRect.Rect().Size() );
       
  1025             }
       
  1026         }
       
  1027 
       
  1028     if ( iCyphOffIcon )
       
  1029         {
       
  1030         CFbsBitmap* bitmap = (CFbsBitmap*)iCyphOffIcon->Bitmap();
       
  1031         if ( bitmap )
       
  1032             {
       
  1033             if ( hideTypeIndication )
       
  1034                 {
       
  1035                 // Not shown in landscape, because there's not enough space.
       
  1036                 AknIconUtils::SetSize( bitmap, TSize(0,0) );
       
  1037                 }
       
  1038             else
       
  1039                 {
       
  1040                 AknIconUtils::SetSize( bitmap, iCyphOffIcon->Rect().Size() );
       
  1041                 }
       
  1042             }
       
  1043         }
       
  1044 
       
  1045 
       
  1046     // Layout group 4
       
  1047     layoutRect.LayoutRect( callTypeIndicationRect, layout4 );
       
  1048     for ( ii = EIndexCallstatusQgn_indi_call_data; ii <= ELayout4End; ii++ )
       
  1049         {
       
  1050         if ( hideTypeIndication )
       
  1051             {
       
  1052             // Not shown in landscape, because there's not enough space.
       
  1053             AknIconUtils::SetSize( iBitmaps->At(ii), TSize(0,0) );
       
  1054             }
       
  1055         else
       
  1056             {
       
  1057             AknIconUtils::SetSize( iBitmaps->At(ii), layoutRect.Rect().Size() );
       
  1058             }
       
  1059         }
       
  1060 
       
  1061     if ( iTypeIndication1 )
       
  1062         {
       
  1063         CFbsBitmap* bitmap = (CFbsBitmap*)iTypeIndication1->Bitmap();
       
  1064         if ( bitmap )
       
  1065             {
       
  1066             if ( hideTypeIndication )
       
  1067                 {
       
  1068                 // Not shown in landscape, because there's not enough space.
       
  1069                 AknIconUtils::SetSize( bitmap, TSize(0,0) );
       
  1070                 }
       
  1071             else
       
  1072                 {
       
  1073                 AknIconUtils::SetSize(bitmap, iTypeIndication1->Rect().Size());
       
  1074                 }
       
  1075             }
       
  1076         }
       
  1077 
       
  1078 
       
  1079     // Layout group 5
       
  1080     layoutRect.LayoutRect( callTypeIndicationRect, layout5 );
       
  1081     for ( ii = EIndexCallstatusQgn_indi_call_line2; ii <= ELayout5End; ii++ )
       
  1082         {
       
  1083         if ( hideTypeIndication )
       
  1084             {
       
  1085             // Not shown in landscape, because there's not enough space.
       
  1086             AknIconUtils::SetSize( iBitmaps->At(ii), TSize(0,0) );
       
  1087             }
       
  1088         else
       
  1089             {
       
  1090             AknIconUtils::SetSize(iBitmaps->At(ii), layoutRect.Rect().Size());
       
  1091             }
       
  1092         }
       
  1093 
       
  1094     if ( iTypeIndication2 )
       
  1095         {
       
  1096         CFbsBitmap* bitmap = (CFbsBitmap*)iTypeIndication2->Bitmap();
       
  1097         if ( bitmap )
       
  1098             {
       
  1099             if ( hideTypeIndication )
       
  1100                 {
       
  1101                 // Not shown in landscape, because there's not enough space.
       
  1102                 AknIconUtils::SetSize( bitmap, TSize(0,0) );
       
  1103                 }
       
  1104             else
       
  1105                 {
       
  1106                 AknIconUtils::SetSize(bitmap, iTypeIndication2->Rect().Size());
       
  1107                 }
       
  1108             }
       
  1109         }
       
  1110 
       
  1111     Window().SetTransparencyAlphaChannel();
       
  1112     Window().SetBackgroundColor( ~0 );
       
  1113 
       
  1114     // Update background of animation
       
  1115     if ( iSmallIndiAnim && iBubble && iBubble->Bitmap() && iBubble->Mask() )
       
  1116         TRAP_IGNORE( iSmallIndiAnim->CreateBackGroundImageL(
       
  1117             iBubble->Bitmap(),
       
  1118             iBubble->Mask(),
       
  1119             TRect( iBubble->Position(), iBubble->Bitmap()->SizeInPixels() ) ) );
       
  1120 
       
  1121     // Make draw
       
  1122     DrawDeferred();
       
  1123     }
       
  1124 
       
  1125 // ---------------------------------------------------------
       
  1126 // CIncallStatusBubble::CountComponentControls() const
       
  1127 //
       
  1128 //
       
  1129 // ---------------------------------------------------------
       
  1130 //
       
  1131 TInt CIncallStatusBubble::CountComponentControls() const
       
  1132     {
       
  1133     return 7; // bubble, small indi, anim , 2* type icons, cyph off and muted
       
  1134     }
       
  1135 
       
  1136 // ---------------------------------------------------------
       
  1137 // CIncallStatusBubble::ComponentControl(TInt aIndex) const
       
  1138 //
       
  1139 // ---------------------------------------------------------
       
  1140 //
       
  1141 CCoeControl* CIncallStatusBubble::ComponentControl(TInt aIndex) const
       
  1142     {
       
  1143     switch ( aIndex )
       
  1144         {
       
  1145         case 0:
       
  1146             return iBubble;
       
  1147         case 1:
       
  1148             return iSmallCallIndication;
       
  1149         case 2:
       
  1150             return iTypeIndication1;
       
  1151         case 3:
       
  1152             return iTypeIndication2;
       
  1153         case 4:
       
  1154             return iCyphOffIcon;
       
  1155         case 5:
       
  1156             return iSmallIndiAnim;
       
  1157         case 6:
       
  1158             return iMutedIcon;
       
  1159         default:
       
  1160             return NULL;
       
  1161         }
       
  1162     }
       
  1163 
       
  1164 // ---------------------------------------------------------
       
  1165 // CIncallStatusBubble::Draw
       
  1166 //
       
  1167 // ---------------------------------------------------------
       
  1168 //
       
  1169 void CIncallStatusBubble::Draw(const TRect& /*aRect*/) const
       
  1170     {
       
  1171     CWindowGc&  gc = SystemGc();
       
  1172     gc.Clear();
       
  1173     }
       
  1174 
       
  1175 // ---------------------------------------------------------
       
  1176 // CIncallStatusBubble::SetFlags
       
  1177 //
       
  1178 // ---------------------------------------------------------
       
  1179 //
       
  1180 void CIncallStatusBubble::SetFlags( const TInt& aFlags )
       
  1181     {
       
  1182     iFlags = aFlags;
       
  1183     SelectImages();
       
  1184     SizeChanged();
       
  1185     }
       
  1186 
       
  1187 // ---------------------------------------------------------
       
  1188 // CIncallStatusBubble::Flags
       
  1189 // Two versions to eliminate compiler warnings
       
  1190 // ---------------------------------------------------------
       
  1191 //
       
  1192 #ifdef __WINS__
       
  1193 const TInt CIncallStatusBubble::Flags()
       
  1194     {
       
  1195     return iFlags;
       
  1196     }
       
  1197 #else
       
  1198 TInt CIncallStatusBubble::Flags()
       
  1199     {
       
  1200     return iFlags;
       
  1201     }
       
  1202 #endif
       
  1203 
       
  1204 // ---------------------------------------------------------
       
  1205 // CIncallStatusBubble::SetFaded
       
  1206 //
       
  1207 // ---------------------------------------------------------
       
  1208 //
       
  1209 void CIncallStatusBubble::SetFaded(TBool aFaded)
       
  1210     {
       
  1211     if (!COMPARE_BOOLS(Window().IsFaded(), aFaded))
       
  1212         {
       
  1213         iMyWindowGroup.SetFaded(
       
  1214             aFaded, RWindowTreeNode::EFadeIncludeChildren);
       
  1215         }
       
  1216     }
       
  1217 
       
  1218 // ---------------------------------------------------------
       
  1219 // CIncallStatusBubble::SelectImages
       
  1220 //
       
  1221 // ---------------------------------------------------------
       
  1222 //
       
  1223 void CIncallStatusBubble::SelectImages()
       
  1224     {
       
  1225     if ( ! ( iFlags & ESBVisible ) )
       
  1226         {
       
  1227         iSmallCallIndication->MakeVisible( EFalse );
       
  1228         iBubble->MakeVisible( EFalse );
       
  1229         iSmallIndiAnim->MakeVisible( EFalse );
       
  1230         iTypeIndication1->MakeVisible( EFalse );
       
  1231         iTypeIndication2->MakeVisible( EFalse );
       
  1232         iCyphOffIcon->MakeVisible( EFalse );
       
  1233         iMutedIcon->MakeVisible( EFalse );
       
  1234         return;
       
  1235         }
       
  1236 
       
  1237     TRect rect( Rect() );
       
  1238 
       
  1239     // first set call indication and bubble image
       
  1240     TInt indiBitmap = KErrNotFound;
       
  1241     TInt indiMask = KErrNotFound;
       
  1242     iSmallIndiAnim->MakeVisible( EFalse );
       
  1243 
       
  1244 
       
  1245     GetImage(
       
  1246         *iBubble,
       
  1247         EIndexCallstatusQgn_graf_bubble_incall,
       
  1248         EIndexCallstatusQgn_graf_bubble_incall_mask );
       
  1249     iBubble->MakeVisible( ETrue );
       
  1250 
       
  1251     switch ( iFlags & (ESBAlerting|ESBActive|ESBOnHold|ESBDisconnected ) ) // two last bits
       
  1252         {
       
  1253         case ESBAlerting:
       
  1254         case ESBActive:
       
  1255             if ( iFlags & ESBVoIPCall &&
       
  1256                 FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
  1257                 {
       
  1258                 indiBitmap = EIndexCallStatusQgn_indi_call_voip_active;
       
  1259                 indiMask = EIndexCallStatusQgn_indi_call_voip_active_mask;
       
  1260                 }
       
  1261 
       
  1262             else if ( iFlags & ESBVideo )
       
  1263                 {
       
  1264                 indiBitmap = EIndexCallstatusQgn_indi_call_video_callsta_1;
       
  1265                 indiMask = EIndexCallstatusQgn_indi_call_video_callsta_1_mask;
       
  1266                 }
       
  1267 
       
  1268             else
       
  1269                 {
       
  1270                 indiBitmap = EIndexCallstatusQgn_indi_call_active;
       
  1271                 indiMask = EIndexCallstatusQgn_indi_call_active_mask;
       
  1272                 }
       
  1273             break;
       
  1274         case ESBOnHold:
       
  1275             if ( iFlags & ESBVoIPCall &&
       
  1276                 FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
  1277                 {
       
  1278                 indiBitmap = EIndexCallStatusQgn_indi_call_voip_held;
       
  1279                 indiMask = EIndexCallStatusQgn_indi_call_voip_held_mask;
       
  1280                 }
       
  1281             else
       
  1282                 {
       
  1283                 indiBitmap = EIndexCallstatusQgn_indi_call_held;
       
  1284                 indiMask = EIndexCallstatusQgn_indi_call_held_mask;
       
  1285                 }
       
  1286             break;
       
  1287         case ESBDisconnected:
       
  1288             if ( iFlags & ESBVoIPCall &&
       
  1289                 FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
  1290                 {
       
  1291                 indiBitmap = EIndexCallStatusQgn_indi_call_voip_disconn;
       
  1292                 indiMask = EIndexCallStatusQgn_indi_call_voip_disconn_mask;
       
  1293                 }
       
  1294 
       
  1295             else if ( iFlags & ESBVideo )
       
  1296                 {
       
  1297                 indiBitmap = EIndexCallstatusQgn_indi_call_video_disconn;
       
  1298                 indiMask = EIndexCallstatusQgn_indi_call_video_disconn_mask;
       
  1299                 }
       
  1300 
       
  1301             else
       
  1302                 {
       
  1303                 indiBitmap = EIndexCallstatusQgn_indi_call_disconn;
       
  1304                 indiMask = EIndexCallstatusQgn_indi_call_disconn_mask;
       
  1305                 }
       
  1306 
       
  1307             GetImage(
       
  1308                 *iBubble,
       
  1309                 EIndexCallstatusQgn_graf_bubble_incall_disconn,
       
  1310                 EIndexCallstatusQgn_graf_bubble_incall_disconn_mask );
       
  1311             break;
       
  1312         default:
       
  1313             _LIT(KCallStatus,"CallStatus");
       
  1314             User::Panic(KCallStatus , 0 );
       
  1315             break;
       
  1316         }
       
  1317 
       
  1318     // Cyph off
       
  1319     if ( iFlags & ESBNoCiphering )
       
  1320         {
       
  1321         GetImage(
       
  1322             *iCyphOffIcon,
       
  1323             EIndexCallstatusQgn_indi_call_cyphering_off );
       
  1324         iCyphOffIcon->MakeVisible( ETrue );
       
  1325         }
       
  1326     else
       
  1327         {
       
  1328         iCyphOffIcon->MakeVisible( EFalse );
       
  1329         }
       
  1330 
       
  1331     // Muted icon
       
  1332     if ( iFlags & ESBMuted )
       
  1333         {
       
  1334         iMutedIcon->MakeVisible( ETrue );
       
  1335         }
       
  1336     else
       
  1337         {
       
  1338         iMutedIcon->MakeVisible( EFalse );
       
  1339         }
       
  1340 
       
  1341     // Animation
       
  1342     if ( (iFlags & (ESBAlerting|ESBActive|ESBOnHold|ESBDisconnected )) == ESBAlerting )
       
  1343         {
       
  1344         if ( iFlags & ESBVoIPCall &&
       
  1345             FeatureManager::FeatureSupported( KFeatureIdCommonVoip ))
       
  1346             {
       
  1347             iSmallIndiAnim->SetAnimationType( CIncallAnim::EVoipCallAnim );  // We have VoIP call.
       
  1348             }
       
  1349         else if (iFlags & ESBVideo)
       
  1350             {
       
  1351             iSmallIndiAnim->SetAnimationType( CIncallAnim::EVideoCallAnim );  // We have Video call.
       
  1352             }
       
  1353         else
       
  1354             {
       
  1355             iSmallIndiAnim->SetAnimationType( CIncallAnim::EDefaultCallAnim ); // We have normal CS call.
       
  1356             }
       
  1357 
       
  1358         iSmallIndiAnim->MakeVisible( ETrue );
       
  1359         }
       
  1360     else
       
  1361         {
       
  1362         iSmallIndiAnim->MakeVisible( EFalse );
       
  1363         }
       
  1364 
       
  1365 
       
  1366     // Emergency call
       
  1367     if ( (iFlags & (ESBAlerting|ESBActive|ESBOnHold|ESBDisconnected )) == ESBActive &&
       
  1368          (iFlags & ESBEmergency) )
       
  1369         {
       
  1370         indiBitmap = EIndexCallstatusQgn_indi_call_active_emergency;
       
  1371         indiMask = EIndexCallstatusQgn_indi_call_active_emergency_mask;
       
  1372         }
       
  1373 
       
  1374 
       
  1375     if ( indiBitmap != KErrNotFound )
       
  1376         {
       
  1377         GetImage(
       
  1378             *iSmallCallIndication,
       
  1379             indiBitmap ,
       
  1380             indiMask );
       
  1381 
       
  1382         iSmallCallIndication->MakeVisible( ETrue );
       
  1383         }
       
  1384 
       
  1385 
       
  1386 
       
  1387     // set type pane
       
  1388     TInt picture1 = KErrNotFound;
       
  1389     TInt picture2 = KErrNotFound;
       
  1390 
       
  1391     TInt mask1 = KErrNotFound;
       
  1392 
       
  1393     if ( iFlags & ESBFax )
       
  1394         {
       
  1395         picture1 = EIndexCallstatusQgn_indi_call_fax;
       
  1396         }
       
  1397     else if ( iFlags & ESBDataHscsd )
       
  1398         {
       
  1399         picture1 = EIndexCallstatusQgn_indi_call_data_hscsd;
       
  1400         }
       
  1401     else if ( iFlags & ESBData )
       
  1402         {
       
  1403         picture1 = EIndexCallstatusQgn_indi_call_data;
       
  1404         }
       
  1405     else if ( iFlags & ESBVideo )
       
  1406         {
       
  1407         // type pane is used for video call, it should not be need to use other
       
  1408         // other types with video call
       
  1409         picture1 = EIndexCallstatusQgn_indi_call_video_callsta;
       
  1410         mask1 = EIndexCallstatusQgn_indi_call_video_callsta_mask;
       
  1411         }
       
  1412 
       
  1413     if ( iFlags & ESBLine2 )
       
  1414         {
       
  1415         if ( picture1 == KErrNotFound )
       
  1416             {
       
  1417             picture1 = EIndexCallstatusQgn_indi_call_line2;
       
  1418             }
       
  1419         else
       
  1420             {
       
  1421             picture2 = EIndexCallstatusQgn_indi_call_line2;
       
  1422             }
       
  1423         }
       
  1424 
       
  1425     if ( picture1 != KErrNotFound )
       
  1426         {
       
  1427         TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() );
       
  1428 
       
  1429         GetImage(
       
  1430             *iTypeIndication1,
       
  1431             picture1,
       
  1432             mask1);
       
  1433 
       
  1434         if ( iFlags & ESBVideo )
       
  1435             {
       
  1436             // video indicator is different size than others
       
  1437             AknLayoutUtils::LayoutControl(
       
  1438                 iTypeIndication1,
       
  1439                 rect,
       
  1440                 AknLayoutScalable_Apps::popup_call_status_window_g2(
       
  1441                     isLandscape ).LayoutLine() );
       
  1442 
       
  1443             // muted icon is never shown with video call
       
  1444             iMutedIcon->MakeVisible( EFalse );
       
  1445 
       
  1446             // line2 indication never shown with video call
       
  1447             picture2 = KErrNotFound;
       
  1448             }
       
  1449         else
       
  1450             {
       
  1451             if ( isLandscape )
       
  1452                 {
       
  1453                 // Not shown in landscape.
       
  1454                 iTypeIndication1->SetRect( TRect( 0, 0, 0, 0 ) );
       
  1455                 }
       
  1456             else
       
  1457                 {
       
  1458                 TAknLayoutRect callTypeIndicationRect;
       
  1459                 callTypeIndicationRect.LayoutRect(
       
  1460                     rect,
       
  1461                     AknLayoutScalable_Apps::call_type_pane() );
       
  1462                 AknLayoutUtils::LayoutControl(
       
  1463                     iTypeIndication1,
       
  1464                     callTypeIndicationRect.Rect(),
       
  1465                     AknLayoutScalable_Apps::call_type_pane_g1().LayoutLine() );
       
  1466                 }
       
  1467             }
       
  1468 
       
  1469         // "Video hold" does not have its own graphics, so we show it differently for now.
       
  1470         if ( iFlags & ESBVideo &&
       
  1471            ((iFlags & ( ESBAlerting | ESBActive | ESBOnHold | ESBDisconnected )) != ESBOnHold))
       
  1472             {
       
  1473             iTypeIndication1->MakeVisible( EFalse );
       
  1474             }
       
  1475         else
       
  1476             {
       
  1477             iTypeIndication1->MakeVisible( ETrue );
       
  1478             }
       
  1479 
       
  1480 
       
  1481         if ( picture2 != KErrNotFound )
       
  1482             {
       
  1483             GetImage( *iTypeIndication2,
       
  1484                       picture2 );
       
  1485             iTypeIndication2->MakeVisible( ETrue );
       
  1486 
       
  1487             }
       
  1488         else
       
  1489             {
       
  1490             iTypeIndication2->MakeVisible( EFalse );
       
  1491             }
       
  1492 
       
  1493         }
       
  1494     else
       
  1495         {
       
  1496         iTypeIndication1->MakeVisible( EFalse );
       
  1497         iTypeIndication2->MakeVisible( EFalse );
       
  1498         }
       
  1499     }
       
  1500 
       
  1501 // ---------------------------------------------------------
       
  1502 // CIncallStatusBubble::SetRect
       
  1503 //
       
  1504 // ---------------------------------------------------------
       
  1505 //
       
  1506 void CIncallStatusBubble::SetRect( const TRect& aRect )
       
  1507     {
       
  1508     CCoeControl::SetRect( aRect );
       
  1509     }
       
  1510 
       
  1511 // ---------------------------------------------------------
       
  1512 // CIncallStatusBubble::MapEnumToSkin
       
  1513 //
       
  1514 // ---------------------------------------------------------
       
  1515 //
       
  1516 void CIncallStatusBubble::MapEnumToSkin(
       
  1517     const TInt aBmIcon, TAknsItemID& aID )
       
  1518     {
       
  1519     switch ( aBmIcon )
       
  1520         {
       
  1521         // Skinned bitmap:
       
  1522         case EIndexCallstatusQgn_indi_call_active:
       
  1523             aID = KAknsIIDQgnIndiCallActive;
       
  1524             break;
       
  1525         case EIndexCallstatusQgn_indi_call_disconn:
       
  1526             aID = KAknsIIDQgnIndiCallDisconn;
       
  1527             break;
       
  1528         case EIndexCallstatusQgn_indi_call_held:
       
  1529             aID = KAknsIIDQgnIndiCallHeld;
       
  1530             break;
       
  1531         case EIndexCallstatusQgn_indi_call_active_2:
       
  1532             aID = KAknsIIDQgnIndiCallActive2;
       
  1533             break;
       
  1534         case EIndexCallstatusQgn_indi_call_muted_callsta:
       
  1535             aID = KAknsIIDQgnIndiCallMutedCallsta;
       
  1536             break;
       
  1537         case EIndexCallstatusQgn_graf_bubble_incall:
       
  1538             aID = KAknsIIDQgnGrafBubbleIncall;
       
  1539             break;
       
  1540         case EIndexCallstatusQgn_graf_bubble_incall_disconn:
       
  1541             aID = KAknsIIDQgnGrafBubbleIncallDisconn;
       
  1542             break;
       
  1543         case EIndexCallStatusQgn_indi_call_voip_active:
       
  1544             aID = KAknsIIDQgnIndiCallVoipActive;
       
  1545             break;
       
  1546         case EIndexCallStatusQgn_indi_call_voip_active_2:
       
  1547             aID = KAknsIIDQgnIndiCallVoipActive2;
       
  1548             break;
       
  1549         case EIndexCallStatusQgn_indi_call_voip_disconn:
       
  1550             aID = KAknsIIDQgnIndiCallVoipDisconn;
       
  1551             break;
       
  1552         case EIndexCallStatusQgn_indi_call_voip_held:
       
  1553             aID = KAknsIIDQgnIndiCallVoipHeld;
       
  1554             break;
       
  1555         case EIndexCallstatusQgn_indi_call_video_callsta:
       
  1556             aID = KAknsIIDQgnIndiCallVideoCallsta;
       
  1557             break;
       
  1558         case EIndexCallstatusQgn_indi_call_video_callsta_1:
       
  1559             aID = KAknsIIDQgnIndiCallVideoCallsta1;
       
  1560             break;
       
  1561         case EIndexCallstatusQgn_indi_call_video_callsta_2:
       
  1562             aID = KAknsIIDQgnIndiCallVideoCallsta2;
       
  1563             break;
       
  1564         case EIndexCallstatusQgn_indi_call_video_disconn:
       
  1565             aID = KAknsIIDQgnIndiCallVideoCallstaDisconn;
       
  1566             break;
       
  1567 
       
  1568         // Colour change:
       
  1569         case EIndexCallstatusQgn_indi_call_data:
       
  1570         case EIndexCallstatusQgn_indi_call_data_hscsd:
       
  1571         case EIndexCallstatusQgn_indi_call_fax:
       
  1572         case EIndexCallstatusQgn_indi_call_line2:
       
  1573         case EIndexCallstatusQgn_indi_call_cyphering_off:
       
  1574             aID = KAknsIIDQsnTextColors;
       
  1575             break;
       
  1576         default:
       
  1577             break;
       
  1578         }
       
  1579     }
       
  1580 
       
  1581 // ---------------------------------------------------------
       
  1582 // CIncallStatusBubble::GetSkinForIcon
       
  1583 //
       
  1584 // ---------------------------------------------------------
       
  1585 //
       
  1586 CAknsItemData* CIncallStatusBubble::GetSkinForIcon(
       
  1587     const TInt aBmIcon )
       
  1588     {
       
  1589     CAknsItemData* data = NULL;
       
  1590 
       
  1591     TAknsItemID skinId = KAknsIIDNone;
       
  1592     MapEnumToSkin( aBmIcon, skinId );
       
  1593     if ( skinId == KAknsIIDNone )
       
  1594         {
       
  1595         return NULL;
       
  1596         }
       
  1597 
       
  1598     SSkinnedImage skinnedImage;
       
  1599     skinnedImage.iId = skinId;
       
  1600 
       
  1601     TInt index = iSkins.FindInOrder( &skinnedImage, iOrder );
       
  1602     if ( index != KErrNotFound )
       
  1603         {
       
  1604         data = iSkins[ index ]->iItemData;
       
  1605         }
       
  1606     else
       
  1607         {
       
  1608         TRAP_IGNORE( data = LoadAndAppendSkinL( skinId ) );
       
  1609         }
       
  1610     return data;
       
  1611     }
       
  1612 
       
  1613 // ---------------------------------------------------------
       
  1614 // CIncallStatusBubble::LoadAndAppendSkinL
       
  1615 //
       
  1616 // ---------------------------------------------------------
       
  1617 //
       
  1618 CAknsItemData* CIncallStatusBubble::LoadAndAppendSkinL(
       
  1619     const TAknsItemID& aId )
       
  1620     {
       
  1621     SSkinnedImage* newImage = new(ELeave) SSkinnedImage;
       
  1622     CleanupStack::PushL( newImage );
       
  1623 
       
  1624     newImage->iId = aId;
       
  1625     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1626     newImage->iItemData = skin->CreateUncachedItemDataL( aId );
       
  1627 
       
  1628     User::LeaveIfError( iSkins.InsertInOrder( newImage, iOrder ) );
       
  1629     CleanupStack::Pop( newImage ); // Ownership was given to iSkins array
       
  1630 
       
  1631     return newImage->iItemData;
       
  1632     }
       
  1633 
       
  1634 // ---------------------------------------------------------------------------
       
  1635 // CIncallStatusBubble::GetSkin
       
  1636 // ---------------------------------------------------------------------------
       
  1637 //
       
  1638 TBool CIncallStatusBubble::GetSkin( CEikImage& aImage, const TInt aBmIcon )
       
  1639     {
       
  1640     CAknsItemData* data    = GetSkinForIcon( aBmIcon );
       
  1641 
       
  1642     CFbsBitmap* bitmap     = NULL;
       
  1643     CFbsBitmap* bitmapMask = NULL;
       
  1644 
       
  1645     if ( data )
       
  1646         {
       
  1647         switch ( data->Type() )
       
  1648             {
       
  1649             case EAknsITMaskedBitmap:
       
  1650                 {
       
  1651                 CAknsMaskedBitmapItemData* maskedBitmapData =
       
  1652                     static_cast< CAknsMaskedBitmapItemData* >( data );
       
  1653                 bitmapMask = maskedBitmapData->Mask();
       
  1654                 }
       
  1655                 // Flow through
       
  1656             case EAknsITBitmap:
       
  1657                 {
       
  1658                 CAknsBitmapItemData* bitmapData =
       
  1659                     static_cast< CAknsBitmapItemData* >( data );
       
  1660                 bitmap = bitmapData->Bitmap();
       
  1661                 }
       
  1662                 break;
       
  1663             case EAknsITColorTable:
       
  1664                 {
       
  1665                 // If the color for call bubble texts is not defined in the
       
  1666                 // current skin, use gray.
       
  1667                 TRgb colour( KRgbGray );
       
  1668                 MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1669                 AknsUtils::GetCachedColor(
       
  1670                     skin,
       
  1671                     colour,
       
  1672                     KAknsIIDQsnTextColors,
       
  1673                     EAknsCIQsnTextColorsCG51 );
       
  1674 
       
  1675                 // Load the coloured bitmap if not already loaded.
       
  1676                 if ( !iSkinnedColourBitmap )
       
  1677                     {
       
  1678                     // Color bitmaps are not anymore supported by scalable
       
  1679                     // skin server, we create our own color bitmap here.
       
  1680                     TRAP_IGNORE( iSkinnedColourBitmap = CreateSkinnedColourBitmapL() );
       
  1681                     }
       
  1682                 // If found, use the full colour bitmap as the image and
       
  1683                 // use the "real" bitmap" as the mask.
       
  1684                 if ( iSkinnedColourBitmap )
       
  1685                     {
       
  1686                     bitmap     = iSkinnedColourBitmap;
       
  1687                     bitmapMask = iBitmaps->At( aBmIcon );
       
  1688                     }
       
  1689                 }
       
  1690 
       
  1691             default:
       
  1692                 {
       
  1693                 break;
       
  1694                 }
       
  1695             }
       
  1696         }
       
  1697 
       
  1698     if ( bitmap )
       
  1699         {
       
  1700         aImage.SetBitmap( bitmap );
       
  1701         aImage.SetMask( bitmapMask ); // Might be NULL
       
  1702         return ETrue;
       
  1703         }
       
  1704 
       
  1705     return EFalse;
       
  1706     }
       
  1707 
       
  1708 // ---------------------------------------------------------
       
  1709 // CIncallStatusBubble::CompareSkinnedData
       
  1710 //
       
  1711 // ---------------------------------------------------------
       
  1712 //
       
  1713 TInt CIncallStatusBubble::CompareSkinnedData(
       
  1714     const SSkinnedImage& aSkin1, const SSkinnedImage& aSkin2 )
       
  1715     {
       
  1716     return aSkin1.iId.iMinor-aSkin2.iId.iMinor ?
       
  1717         aSkin1.iId.iMinor-aSkin2.iId.iMinor :
       
  1718         aSkin1.iId.iMajor-aSkin2.iId.iMajor;
       
  1719     }
       
  1720 
       
  1721 // ---------------------------------------------------------
       
  1722 // CIncallStatusBubble::LoadImageL
       
  1723 //
       
  1724 // ---------------------------------------------------------
       
  1725 //
       
  1726 void CIncallStatusBubble::LoadImageL( TInt aBitmapId )
       
  1727     {
       
  1728     CFbsBitmap* bitmap;
       
  1729     CFbsBitmap* mask;
       
  1730 
       
  1731     CCleanupGuard* guard = new( ELeave ) CCleanupGuard;
       
  1732     CleanupStack::PushL( guard );
       
  1733 
       
  1734     AknIconUtils::CreateIconL(
       
  1735         bitmap, mask, KCallStatusBitmapFile, aBitmapId, aBitmapId ); // use bitmap id for both mask and bitmap because of 1-bit icons
       
  1736 
       
  1737     guard->SetItem1( bitmap );
       
  1738     guard->SetItem2( mask );
       
  1739 
       
  1740     iBitmaps->AppendL( mask );
       
  1741     guard->SetItem2( NULL ); // mask
       
  1742     iBitmaps->AppendL( bitmap );
       
  1743     guard->SetItem1( NULL ); // bitmap
       
  1744 
       
  1745     CleanupStack::PopAndDestroy(); // guard
       
  1746 
       
  1747     }
       
  1748 
       
  1749 // ---------------------------------------------------------
       
  1750 // CIncallStatusBubble::LoadImageL
       
  1751 //
       
  1752 // ---------------------------------------------------------
       
  1753 //
       
  1754 void CIncallStatusBubble::LoadImageL( TInt aBitmapId, TInt aMaskId )
       
  1755     {
       
  1756     CFbsBitmap* bitmap;
       
  1757     CFbsBitmap* mask;
       
  1758 
       
  1759     CCleanupGuard* guard = new( ELeave ) CCleanupGuard;
       
  1760     CleanupStack::PushL( guard );
       
  1761 
       
  1762     AknIconUtils::CreateIconL(
       
  1763         bitmap, mask, KCallStatusBitmapFile, aBitmapId, aMaskId );
       
  1764 
       
  1765     guard->SetItem1( bitmap );
       
  1766     guard->SetItem2( mask );
       
  1767 
       
  1768     iBitmaps->AppendL( bitmap );
       
  1769     guard->SetItem1( NULL ); // bitmap
       
  1770     iBitmaps->AppendL( mask );
       
  1771     guard->SetItem2( NULL ); // mask
       
  1772 
       
  1773     CleanupStack::PopAndDestroy(); // guard
       
  1774     }
       
  1775 
       
  1776 // ---------------------------------------------------------
       
  1777 // CIncallStatusBubble::GetImage
       
  1778 //
       
  1779 // ---------------------------------------------------------
       
  1780 //
       
  1781 void CIncallStatusBubble::GetImage(
       
  1782     CEikImage& aImage,
       
  1783     const TInt& aImageId,
       
  1784     const TInt aImageMaskId )
       
  1785     {
       
  1786     if ( GetSkin( aImage, aImageId ) )
       
  1787         {
       
  1788         return;
       
  1789         }
       
  1790 
       
  1791     aImage.SetBitmap( iBitmaps->At( aImageId ) );
       
  1792     if ( aImageMaskId != KErrNotFound )
       
  1793         {
       
  1794         aImage.SetMask( iBitmaps->At( aImageMaskId ) );
       
  1795         }
       
  1796     }
       
  1797 
       
  1798 // ---------------------------------------------------------
       
  1799 // CIncallStatusBubble::HandleResourceChange
       
  1800 //
       
  1801 // ---------------------------------------------------------
       
  1802 //
       
  1803 void CIncallStatusBubble::HandleResourceChange( TInt aType )
       
  1804     {
       
  1805     if ( aType == KAknsMessageSkinChange ||
       
  1806          aType == KEikDynamicLayoutVariantSwitch )
       
  1807         {
       
  1808         // Clear all handles
       
  1809         iSmallCallIndication->SetPicture( NULL );
       
  1810         iBubble->SetPicture( NULL );
       
  1811         iTypeIndication1->SetPicture( NULL );
       
  1812         iTypeIndication2->SetPicture( NULL );
       
  1813         iCyphOffIcon->SetPicture( NULL );
       
  1814         
       
  1815         iMutedIcon->SetMutedImage( NULL, NULL );
       
  1816 
       
  1817         iSmallIndiAnim->MakeVisible( EFalse );
       
  1818         iSmallIndiAnim->ClearAnimation();
       
  1819 
       
  1820         // Delete old skins
       
  1821         iSkins.ResetAndDestroy();
       
  1822         delete iSkinnedColourBitmap;
       
  1823         iSkinnedColourBitmap = NULL;
       
  1824 
       
  1825         // Update muted icon
       
  1826         CEikImage* tmpMutedImage = new CEikImage;
       
  1827         if ( tmpMutedImage )
       
  1828             {
       
  1829             tmpMutedImage->SetPictureOwnedExternally( ETrue );
       
  1830             GetImage(
       
  1831                 *tmpMutedImage,
       
  1832                 EIndexCallstatusQgn_indi_call_muted_callsta,
       
  1833                 EIndexCallstatusQgn_indi_call_muted_callsta_mask
       
  1834                 );
       
  1835             iMutedIcon->SetMutedImage(
       
  1836                 tmpMutedImage->Bitmap(), tmpMutedImage->Mask() );
       
  1837             delete tmpMutedImage;
       
  1838             }
       
  1839 
       
  1840         // Update animation
       
  1841         TInt err = KErrNone;
       
  1842         if ( iFlags & ESBVoIPCall &&
       
  1843             FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
       
  1844             {
       
  1845             TRAP( err, iSmallIndiAnim->SetAnimationL( *this, CIncallAnim::EVoipCallAnim ) );
       
  1846             }
       
  1847         else if (iFlags & ESBVideo)
       
  1848             {
       
  1849             TRAP( err, iSmallIndiAnim->SetAnimationL( *this, CIncallAnim::EVideoCallAnim ) );
       
  1850             }
       
  1851         else
       
  1852             {
       
  1853             TRAP( err, iSmallIndiAnim->SetAnimationL( *this, CIncallAnim::EDefaultCallAnim ) );
       
  1854             }
       
  1855 
       
  1856         if ( err )
       
  1857             {
       
  1858             iSmallIndiAnim->ClearAnimation();
       
  1859             }
       
  1860 
       
  1861         // Get the other items:
       
  1862         SelectImages();
       
  1863         SizeChanged();
       
  1864         return;
       
  1865         }
       
  1866 
       
  1867     CCoeControl::HandleResourceChange(aType);
       
  1868     }
       
  1869 
       
  1870 
       
  1871 // ----------------------------------------------------------------------------
       
  1872 // CIncallStatusBubble::HandlePointerEventL
       
  1873 // ----------------------------------------------------------------------------
       
  1874 //
       
  1875 void CIncallStatusBubble::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
  1876     {
       
  1877     // the tap event shall be igored when the keyboard is locked
       
  1878     TInt autolockState = EAutolockOff;
       
  1879     RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState );
       
  1880     TPoint pdOffset( 3, 3 );  // Move icon to a little for "pressed" effect
       
  1881      if ( !Window().IsFaded() && 
       
  1882           AknLayoutUtils::PenEnabled() && 
       
  1883           autolockState <= EAutolockOff ) 
       
  1884          { 
       
  1885          if ( ( aPointerEvent.iType == TPointerEvent::EButton1Down || 
       
  1886                 aPointerEvent.iType == TPointerEvent::EDrag ) && 
       
  1887               Rect().Contains( aPointerEvent.iPosition ) ) 
       
  1888              { 
       
  1889              // Draw  down effects. 
       
  1890              if ( ! iPressedDown ) 
       
  1891                  { 
       
  1892                  GetImage(
       
  1893                      *iBubble,
       
  1894                      EIndexCallstatusQgn_graf_bubble_incall_disconn,
       
  1895                      EIndexCallstatusQgn_graf_bubble_incall_disconn_mask );
       
  1896 
       
  1897                  TRect newRect = Rect();
       
  1898 
       
  1899                  newRect.Move( PositionRelativeToScreen() + pdOffset );
       
  1900 
       
  1901                  SetRect( newRect );
       
  1902 
       
  1903                  iPressedDown = ! iPressedDown; 
       
  1904                  } 
       
  1905              } 
       
  1906          else if ( aPointerEvent.iType == TPointerEvent::EDrag || 
       
  1907                    aPointerEvent.iType == TPointerEvent::EButton1Up ) 
       
  1908              { 
       
  1909              // Clear pressed down effects. 
       
  1910                if ( iPressedDown ) 
       
  1911                    { 
       
  1912                  GetImage(
       
  1913                      *iBubble,
       
  1914                      EIndexCallstatusQgn_graf_bubble_incall,
       
  1915                      EIndexCallstatusQgn_graf_bubble_incall_mask );
       
  1916 
       
  1917                  TRect newRect = Rect();
       
  1918 
       
  1919                  newRect.Move( PositionRelativeToScreen() - pdOffset );
       
  1920 
       
  1921                  SetRect( newRect );
       
  1922 
       
  1923                    iPressedDown = !iPressedDown; 
       
  1924                    } 
       
  1925                
       
  1926                if ( aPointerEvent.iType == TPointerEvent::EButton1Up && 
       
  1927                     Rect().Contains( aPointerEvent.iPosition ) ) 
       
  1928                    { 
       
  1929                    
       
  1930                    CCoeEnv* coeEnv = CCoeEnv::Static();
       
  1931                    CCoeAppUi* appUi = NULL;
       
  1932                    if ( coeEnv )
       
  1933                        {
       
  1934                        appUi = coeEnv->AppUi();
       
  1935                        }
       
  1936                    
       
  1937                    if ( appUi )
       
  1938                        {
       
  1939                        if ( ( iFlags & ESBVideo ) && ( iFlags & ESBActive ) )
       
  1940                            {
       
  1941                            TVwsViewId viewId( KVideoCallUid, KVideoCallUid );
       
  1942                            appUi->CreateActivateViewEventL(viewId, KNullUid, KNullDesC8());
       
  1943                            }
       
  1944                        else
       
  1945                            {
       
  1946                            TVwsViewId diallerView( KPhoneAppUid, KPhoneViewUid );
       
  1947                            appUi->CreateActivateViewEventL( diallerView,  KPhoneVievCommand, KNullDesC8() );
       
  1948                            }
       
  1949                        }
       
  1950                    }
       
  1951              }
       
  1952         }
       
  1953     else if (aPointerEvent.iType == TPointerEvent::EButton1Up)
       
  1954         {
       
  1955         CEikMenuBar* menuBar = CEikonEnv::Static()->AppUiFactory()->MenuBar();            
       
  1956         if( menuBar && menuBar->IsVisible() )
       
  1957             {
       
  1958             //Stops displaying the uifactory's menu bar.
       
  1959             menuBar->StopDisplayingMenuBar();  
       
  1960             }
       
  1961         else
       
  1962             {
       
  1963             //Stops displaying the application's menu bar.
       
  1964             CEikonEnv::Static()->EikAppUi()->StopDisplayingMenuBar();
       
  1965             }
       
  1966         }
       
  1967     }
       
  1968 
       
  1969 CFbsBitmap* CIncallStatusBubble::CreateSkinnedColourBitmapL()
       
  1970     {
       
  1971     TSize size( Rect().Size() );
       
  1972     if ( size == TSize( 0, 0 ) )
       
  1973     {
       
  1974         return NULL;
       
  1975     }
       
  1976 
       
  1977     TRgb colour( KRgbGray );
       
  1978     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  1979     AknsUtils::GetCachedColor(
       
  1980         skin,
       
  1981         colour,
       
  1982         KAknsIIDQsnTextColors,
       
  1983         EAknsCIQsnTextColorsCG51 );
       
  1984 
       
  1985     CFbsBitmap* destinationBitmap = new (ELeave) CFbsBitmap();
       
  1986     CleanupStack::PushL( destinationBitmap );
       
  1987     User::LeaveIfNull( destinationBitmap );
       
  1988 
       
  1989     User::LeaveIfError( destinationBitmap->Create( size, EColor16M ) );
       
  1990 
       
  1991     CFbsBitmapDevice* destinationDevice = CFbsBitmapDevice::NewL( destinationBitmap );
       
  1992     CleanupStack::PushL( destinationDevice );
       
  1993 
       
  1994     CFbsBitGc* destinationGc;
       
  1995     User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );
       
  1996 
       
  1997     destinationGc->SetPenColor( colour );
       
  1998     destinationGc->SetPenStyle( CGraphicsContext::ESolidPen );
       
  1999     destinationGc->SetBrushColor( colour );
       
  2000     destinationGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  2001     destinationGc->DrawRect( TRect( size ) );
       
  2002 
       
  2003     delete destinationGc;
       
  2004     CleanupStack::PopAndDestroy( destinationDevice );
       
  2005     CleanupStack::Pop( destinationBitmap );
       
  2006 
       
  2007     return destinationBitmap;
       
  2008     }
       
  2009 
       
  2010 // End of File