phoneuis/BubbleManager/Src/BMBubbleOutlookTopLeft.cpp
changeset 0 5f000ab63145
child 7 544e34b3255a
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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 CBubbleOutlookTopLeft class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "BMBubbleManager.h" //for enumerations
       
    21 #include    "BMBubbleOutlookTopLeft.h"
       
    22 #include    "BMBubbleImageManager.h"
       
    23 #include    "BMResourceManager.h"
       
    24 #include    "BMBubbleHeader.h"
       
    25 #include    "BMUtils.h"
       
    26 #include    "BMLayout.h"
       
    27 #include    "BMLayout2.h"
       
    28 
       
    29 #include    <eiklabel.h> 
       
    30 #include    <eikimage.h>
       
    31 #include    <eikenv.h>
       
    32 #include    <AknsUtils.h>
       
    33 #include    <AknsDrawUtils.h>
       
    34 
       
    35 // ========================= MEMBER FUNCTIONS ================================
       
    36 
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // CBubbleOutlookTopLeft::CBubbleOutlookTopLeft
       
    40 //
       
    41 //  
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 CBubbleOutlookTopLeft::CBubbleOutlookTopLeft( 
       
    45                                    CBubbleManager& aBubbleManager ) 
       
    46 : CBubbleOutlookOneLined( aBubbleManager )                               
       
    47     {
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // CBubbleOutlookTopLeft::ConstructL
       
    52 // 
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CBubbleOutlookTopLeft::ConstructL()
       
    56     {
       
    57     CBubbleOutlookOneLined::ConstructL( );
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // CBubbleOutlookTopLeft::~CBubbleOutlookTopLeft
       
    62 //  
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 CBubbleOutlookTopLeft::~CBubbleOutlookTopLeft()
       
    66     {
       
    67 
       
    68     }
       
    69 
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // CBubbleOutlookTopLeft::ReadBubbleHeader
       
    73 //
       
    74 //  
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 void CBubbleOutlookTopLeft::ReadBubbleHeader( CBubbleHeader& aHeader )
       
    78     {
       
    79     iHeader = &aHeader;
       
    80 
       
    81     iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue );        
       
    82     
       
    83     if ( !iCallObjectDisplay )
       
    84         {
       
    85         GetCall1BubbleBitmaps();    
       
    86         }
       
    87     
       
    88     CBubbleOutlookOneLined::ReadBubbleHeader( aHeader );
       
    89     }
       
    90 
       
    91 
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // CBubbleOutlookTopLeft::SizeChanged
       
    95 // called by framwork when the view size is changed
       
    96 //  
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 void CBubbleOutlookTopLeft::SizeChanged()
       
   100     {
       
   101     if( !iHeader )
       
   102         {
       
   103         return;
       
   104         }
       
   105 
       
   106     AknsUtils::RegisterControlPosition( this );
       
   107     
       
   108     if ( !iCallObjectDisplay )
       
   109         {
       
   110         DoCall1Layout();    
       
   111         }
       
   112     else
       
   113         {
       
   114         TRAPD( err, DoCall2LayoutL() );
       
   115         if ( err )    
       
   116             {
       
   117             iBubble->SetPicture( NULL, NULL );
       
   118                 
       
   119             MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   120             AknsDrawUtils::PrepareFrame( skin,
       
   121                                          iOuterRect,
       
   122                                          iInnerRect,
       
   123                                          iFrameId,
       
   124                                          KAknsIIDDefault );    
       
   125             }
       
   126         }     
       
   127     }
       
   128 
       
   129     
       
   130 // ---------------------------------------------------------------------------
       
   131 // CBubbleOutlookTopLeft::DoCall1Layout
       
   132 // ---------------------------------------------------------------------------
       
   133 //    
       
   134 void CBubbleOutlookTopLeft::DoCall1Layout()
       
   135     {
       
   136     // Deprecated
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // CBubbleOutlookTopLeft::DoCall2Layout
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 void CBubbleOutlookTopLeft::DoCall2LayoutL()
       
   144     {
       
   145     iBubble->SetPictureOwnedExternally( EFalse );
       
   146     iBubble->SetPicture( NULL, NULL );
       
   147     
       
   148     const TRect rect = Rect();
       
   149     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   150     switch ( callState )
       
   151         {
       
   152         case CBubbleManager::EWaiting:
       
   153             {
       
   154             ///////////////////////////////////////////////////////////////////
       
   155             // Waiting call layout
       
   156             ///////////////////////////////////////////////////////////////////
       
   157             
       
   158             TAknLayoutRect bubbleRect;
       
   159             bubbleRect.LayoutRect( 
       
   160                 rect, 
       
   161                 BubbleLayout2::popup_call2_audio_wait_call_background() );
       
   162             
       
   163             TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() );
       
   164             TRect outerRect;
       
   165             TRect innerRect;
       
   166             BubbleLayout2::RectFrameInnerOuterRects( frameRect, 
       
   167                                                      outerRect, 
       
   168                                                      innerRect );
       
   169             
       
   170             iFrameId = ( callState == CBubbleManager::EAlertToDisconnected ) ?
       
   171                                       KAknsIIDQsnFrCall2RectDisconn : 
       
   172                                       KAknsIIDQsnFrCall2Rect;
       
   173             
       
   174             iOuterRect = outerRect;
       
   175             iOuterRect.Move( Rect().iTl );
       
   176             iInnerRect = innerRect;
       
   177             iInnerRect.Move( Rect().iTl );
       
   178             
       
   179             // Call icon
       
   180             BubbleUtils::LayoutCustomElement(
       
   181                 iSmallCallIndication, 
       
   182                 rect, 
       
   183                 BubbleLayout2::popup_call2_audio_wait_call_status_icon() );
       
   184                 
       
   185             // Ciphering off
       
   186             BubbleUtils::LayoutControl( 
       
   187                 iCyphOffImage, 
       
   188                 rect,
       
   189                 BubbleLayout2::popup_call2_audio_wait_call_cyphering_icon() );
       
   190                 
       
   191             
       
   192             // Call type pane    
       
   193             BubbleUtils::LayoutCallTypeIndicators(
       
   194                 rect,
       
   195                 BubbleLayout2::popup_call2_audio_wait_call_type_icon(),
       
   196                 iTypeIndication1,   // Data/Fax
       
   197                 iTypeIndication2 ); // ALS line 2
       
   198             
       
   199             // Text
       
   200             BubbleUtils::LayoutLabel( 
       
   201                 iTextLine1, 
       
   202                 rect, 
       
   203                 BubbleLayout2::popup_call2_audio_wait_call_cli_text() );
       
   204                 
       
   205             // Create call object bitmaps
       
   206             iBubble->SetRect( bubbleRect.Rect() );                
       
   207             
       
   208             BubbleUtils::PrepareBubbleImageL( 
       
   209                 iFrameId,
       
   210                 outerRect,
       
   211                 innerRect,
       
   212                 iBubble );
       
   213                 
       
   214             if ( iHeader->CallObjectImage() &&
       
   215                  !iHeader->CallObjectText().Length() )
       
   216                 {
       
   217                 // Add transparency
       
   218                 BubbleUtils::AddTransparencyToBubbleImageL( 
       
   219                     KAknsIIDQsnFrCall2RectCoMask, // gradient tp mask
       
   220                     outerRect,
       
   221                     innerRect,
       
   222                     iBubble );                    
       
   223                 }                
       
   224             break;
       
   225             }
       
   226         case CBubbleManager::EDisconnected:
       
   227         case CBubbleManager::EActive:
       
   228         case CBubbleManager::EOnHold:
       
   229             {
       
   230             ///////////////////////////////////////////////////////////////////
       
   231             // First call layout. Two calls and number entry.
       
   232             ///////////////////////////////////////////////////////////////////
       
   233             
       
   234             // Create bubble image
       
   235             TAknLayoutRect bubbleRect;
       
   236             bubbleRect.LayoutRect( 
       
   237                 rect, 
       
   238                 BubbleLayout2::popup_call2_audio_first_call_background(15) );
       
   239             
       
   240             TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() );
       
   241             TRect outerRect;
       
   242             TRect innerRect;
       
   243             BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, 
       
   244                                                        outerRect, 
       
   245                                                        innerRect);
       
   246             TAknsItemID coMaskFrameId;
       
   247             if ( callState == CBubbleManager::EOnHold )
       
   248                 {
       
   249                 iFrameId = KAknsIIDQsnFrCall2Bubble;
       
   250                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleCoMask;
       
   251                 }
       
   252             else if ( callState == CBubbleManager::EDisconnected )
       
   253                 {
       
   254                 iFrameId = KAknsIIDQsnFrCall2BubbleFirstDisconn;
       
   255                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;
       
   256                 }
       
   257             else
       
   258                 {
       
   259                 iFrameId = KAknsIIDQsnFrCall2BubbleFirst;
       
   260                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;
       
   261                 }                
       
   262             
       
   263             iOuterRect = outerRect;
       
   264             iOuterRect.Move( Rect().iTl );
       
   265             iInnerRect = innerRect;
       
   266             iInnerRect.Move( Rect().iTl );
       
   267 
       
   268             // Call icon
       
   269             BubbleUtils::LayoutCustomElement( 
       
   270                 iSmallCallIndication, 
       
   271                 rect,
       
   272                 BubbleLayout2::popup_call2_audio_first_call_status_icon(14) );
       
   273                 
       
   274             // Ciphering off
       
   275             BubbleUtils::LayoutControl( 
       
   276                 iCyphOffImage, 
       
   277                 rect,
       
   278                 BubbleLayout2::popup_call2_audio_first_call_window_ciphering_icon(13) );
       
   279             
       
   280             // Call type pane
       
   281             BubbleUtils::LayoutCallTypeIndicators(
       
   282                 rect,
       
   283                 BubbleLayout2::popup_call2_audio_first_call_type_icon(13),
       
   284                 iTypeIndication1,   // Data/Fax
       
   285                 iTypeIndication2 ); // ALS line 2
       
   286                 
       
   287             // Text line 1
       
   288             BubbleUtils::LayoutLabel( 
       
   289                 iTextLine1, 
       
   290                 rect, 
       
   291                 BubbleLayout2::popup_call2_audio_first_call_cli_text(17) );
       
   292                 
       
   293             // Create call bubble
       
   294             iBubble->SetRect( bubbleRect.Rect() );                                
       
   295             
       
   296             BubbleUtils::PrepareBubbleImageL( 
       
   297                 iFrameId,
       
   298                 outerRect,
       
   299                 innerRect,
       
   300                 iBubble );
       
   301             
       
   302             // Add transparency
       
   303             BubbleUtils::AddTransparencyToBubbleImageL( 
       
   304                 coMaskFrameId,
       
   305                 outerRect,
       
   306                 innerRect,
       
   307                 iBubble );
       
   308                 
       
   309             break;
       
   310             }
       
   311         case CBubbleManager::ENone:
       
   312         default:
       
   313             break;
       
   314         }
       
   315     }
       
   316 
       
   317 // ---------------------------------------------------------------------------
       
   318 // CBubbleOutlookTopLeft::GetCall1BubbleBitmaps
       
   319 // ---------------------------------------------------------------------------
       
   320 //    
       
   321 void CBubbleOutlookTopLeft::GetCall1BubbleBitmaps()
       
   322     {
       
   323     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   324     
       
   325     TInt bubblePicture = KErrNotFound;
       
   326     TInt bubblePictureMask = KErrNotFound;
       
   327     
       
   328     // set call indications and bubble
       
   329         // set call indications and bubble
       
   330     switch ( callState )
       
   331         {
       
   332         case CBubbleManager::EWaiting:
       
   333             bubblePicture = EQgn_graf_call_rec_small_left;
       
   334             bubblePictureMask = EQgn_graf_call_rec_small_left_mask;
       
   335             break;
       
   336         case CBubbleManager::EActive:
       
   337             bubblePicture = EQgn_graf_call_first_three_active;
       
   338             bubblePictureMask = EQgn_graf_call_first_three_active_mask;
       
   339             break;
       
   340         case CBubbleManager::EOnHold:
       
   341             bubblePicture = EQgn_graf_call_first_three_held;
       
   342             bubblePictureMask = EQgn_graf_call_first_three_held_mask;
       
   343             break;
       
   344         case CBubbleManager::EDisconnected:
       
   345             bubblePicture = EQgn_graf_call_first_three_disconn;
       
   346             bubblePictureMask = EQgn_graf_call_first_three_disconn_mask; 
       
   347             break;
       
   348         case CBubbleManager::EIncoming:
       
   349         case CBubbleManager::EOutgoing:
       
   350         case CBubbleManager::EAlertToDisconnected:
       
   351         case CBubbleManager::EAlerting:
       
   352         case CBubbleManager::ENone:
       
   353         default:
       
   354             bubblePicture = KErrNotFound;
       
   355             bubblePictureMask = KErrNotFound;
       
   356             break;
       
   357         }
       
   358 
       
   359     if ( bubblePicture != KErrNotFound )
       
   360         {
       
   361         if ( bubblePictureMask == KErrNotFound )
       
   362             {
       
   363             iBubbleManager.ImageManager().SetBitmapToImage( 
       
   364                 iBubble, (TBMIcons) bubblePicture );
       
   365             }
       
   366         else
       
   367             {
       
   368             iBubbleManager.ImageManager().SetBitmapToImage( 
       
   369                 iBubble, 
       
   370                 (TBMIcons) bubblePicture , 
       
   371                 (TBMIcons) bubblePictureMask);
       
   372             }
       
   373         }
       
   374         
       
   375     }    
       
   376 
       
   377 // End of File