phoneuis/BubbleManager/Src/BMBubbleOutlookBottomImage.cpp
changeset 0 5f000ab63145
child 19 544e34b3255a
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Bubble to display gallery images.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "BMBubbleManager.h" //for enumerations
       
    21 #include    "BMBubbleOutlookBottomImage.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 #include    "telbubblecustomelement.h"
       
    29 
       
    30 #include    <eiklabel.h> 
       
    31 #include    <eikimage.h>
       
    32 #include    <eikenv.h>
       
    33 #include    <AknsUtils.h>
       
    34 #include    <AknUtils.h>
       
    35 #include    <AknsDrawUtils.h>
       
    36 
       
    37 // ========================= MEMBER FUNCTIONS ================================
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // CBubbleOutlookBottomImage::CBubbleOutlookBottomImage
       
    41 //
       
    42 //  
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 CBubbleOutlookBottomImage::CBubbleOutlookBottomImage( 
       
    46     CBubbleManager& aBubbleManager ) : CBubbleOutlookTwoLined( aBubbleManager )
       
    47     {
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // CBubbleOutlookBottomImage::ConstructL
       
    52 // 
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CBubbleOutlookBottomImage::ConstructL()
       
    56     { 
       
    57     CBubbleOutlookTwoLined::ConstructL();
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // CBubbleOutlookBottomImage::~CBubbleOutlookBottomImage
       
    62 //
       
    63 //  
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 CBubbleOutlookBottomImage::~CBubbleOutlookBottomImage()
       
    67     {
       
    68     Reset();
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // CBubbleOutlookBottomImage::ReadBubbleHeader
       
    73 //
       
    74 //  
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 void CBubbleOutlookBottomImage::ReadBubbleHeader( CBubbleHeader& aHeader )
       
    78     {
       
    79     iHeader = &aHeader;
       
    80     
       
    81     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
    82     
       
    83     iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue );        
       
    84     
       
    85     CBubbleOutlookTwoLined::ReadBubbleHeader( aHeader );
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CBubbleOutlookBottomImage::SizeChanged
       
    90 // called by framework when the view size is changed
       
    91 //  
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 void CBubbleOutlookBottomImage::SizeChanged()
       
    95     {
       
    96     if( !iHeader )
       
    97         {
       
    98         return;
       
    99         }
       
   100 
       
   101     AknsUtils::RegisterControlPosition( this );
       
   102     
       
   103     TRAPD( err, DoCall2LayoutL() );
       
   104     if ( err )    
       
   105         {
       
   106         iBubble->SetPicture( NULL, NULL );
       
   107                 
       
   108         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   109         AknsDrawUtils::PrepareFrame( skin,
       
   110                                      iOuterRect,
       
   111                                      iInnerRect,
       
   112                                      iFrameId,
       
   113                                      KAknsIIDDefault );    
       
   114         }        
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CBubbleOutlookBottomImage::PositionChanged
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 void CBubbleOutlookBottomImage::PositionChanged()
       
   122     {
       
   123     AknsUtils::RegisterControlPosition( this );
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CBubbleOutlookBottomImage::DoCall2Layout
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 void CBubbleOutlookBottomImage::DoCall2LayoutL()
       
   131     {
       
   132     iBubble->SetPictureOwnedExternally( EFalse );
       
   133     iBubble->SetPicture( NULL, NULL );
       
   134     
       
   135     const TRect rect = Rect();
       
   136     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   137     switch ( callState )
       
   138         {
       
   139         case CBubbleManager::EDisconnected:
       
   140         case CBubbleManager::EActive:
       
   141         case CBubbleManager::EOnHold:
       
   142             {
       
   143             ///////////////////////////////////////////////////////////////////
       
   144             // First incall layout for single call. Call object image.
       
   145             ///////////////////////////////////////////////////////////////////
       
   146             
       
   147             TAknLayoutRect bubbleRect;
       
   148             bubbleRect.LayoutRect( 
       
   149                 rect, 
       
   150                 BubbleLayout2::popup_call2_audio_first_call_background(14) );
       
   151             
       
   152             TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() );
       
   153             TRect outerRect;
       
   154             TRect innerRect;
       
   155             BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, 
       
   156                                                        outerRect, 
       
   157                                                        innerRect);
       
   158             
       
   159             TAknsItemID coMaskFrameId;
       
   160             if ( callState == CBubbleManager::EOnHold )
       
   161                 {
       
   162                 iFrameId = KAknsIIDQsnFrCall2Bubble;
       
   163                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleCoMask;    
       
   164                 }
       
   165             else if ( callState == CBubbleManager::EDisconnected )
       
   166                 {
       
   167                 iFrameId = KAknsIIDQsnFrCall2BubbleFirstDisconn;
       
   168                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;            
       
   169                 }
       
   170             else
       
   171                 {
       
   172                 iFrameId = KAknsIIDQsnFrCall2BubbleFirst;
       
   173                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;                
       
   174                 } 
       
   175                 
       
   176             iOuterRect = outerRect;
       
   177             iOuterRect.Move( Rect().iTl );
       
   178             iInnerRect = innerRect;
       
   179             iInnerRect.Move( Rect().iTl );                
       
   180             
       
   181             // Call icon
       
   182             BubbleUtils::LayoutCustomElement( 
       
   183                 iSmallCallIndication, 
       
   184                 rect,
       
   185                 BubbleLayout2::popup_call2_audio_first_call_status_icon(13) );
       
   186                 
       
   187             // Ciphering off
       
   188             BubbleUtils::LayoutControl( 
       
   189                 iCyphOffImage, 
       
   190                 rect,
       
   191                 BubbleLayout2::popup_call2_audio_first_call_window_ciphering_icon(12) );
       
   192             
       
   193             // Call type pane    
       
   194             BubbleUtils::LayoutCallTypeIndicators(
       
   195                 rect,
       
   196                 BubbleLayout2::popup_call2_audio_first_call_type_icon(12),
       
   197                 iTypeIndication1,   // Data/Fax
       
   198                 iTypeIndication2 ); // ALS line 2
       
   199 
       
   200             // Text line 1
       
   201             BubbleUtils::LayoutLabel( 
       
   202                 iTextLine1, 
       
   203                 rect, 
       
   204                 BubbleLayout2::popup_call2_audio_first_call_cli_text(16) );
       
   205 
       
   206             // Smaller rect for text if brand image exists
       
   207             if ( iBrandImage )
       
   208                 {
       
   209                 // Text line 2 - call state
       
   210                 BubbleUtils::LayoutLabel(
       
   211                     iTextLine2,
       
   212                     rect,
       
   213                     BubbleLayout2::popup_call2_audio_first_call_state_text(16) );
       
   214 
       
   215                 // Text line 2 - call timer
       
   216                 BubbleUtils::LayoutLabel(
       
   217                     iTimerCost,
       
   218                     rect,
       
   219                     BubbleLayout2::popup_call2_audio_first_call_state_text(17) );
       
   220 
       
   221                 //Brand image
       
   222                 BubbleUtils::LayoutCustomElement(
       
   223                     iBrandImage,
       
   224                     rect,
       
   225                     BubbleLayout2::popup_call2_audio_first_brand_image2(1) );
       
   226                 }
       
   227             else
       
   228                 {
       
   229                 // Text line 2 - call state
       
   230                 BubbleUtils::LayoutLabel(
       
   231                     iTextLine2,
       
   232                     rect,
       
   233                     BubbleLayout2::popup_call2_audio_first_call_state_text(12) );
       
   234 
       
   235                 // Text line 2 - call timer
       
   236                 BubbleUtils::LayoutLabel(
       
   237                     iTimerCost,
       
   238                     rect,
       
   239                     BubbleLayout2::popup_call2_audio_first_call_state_text(13) );
       
   240                 }
       
   241                 
       
   242             // Create call object bitmaps
       
   243             iBubble->SetRect( bubbleRect.Rect() );                                
       
   244 
       
   245             BubbleUtils::PrepareBubbleImageL( 
       
   246                 iFrameId,
       
   247                 outerRect,
       
   248                 innerRect,
       
   249                 iBubble );
       
   250             
       
   251             // Add transparency
       
   252             BubbleUtils::AddTransparencyToBubbleImageL( 
       
   253                 coMaskFrameId,
       
   254                 outerRect,
       
   255                 innerRect,
       
   256                 iBubble );
       
   257                                
       
   258             break;
       
   259             }
       
   260         case CBubbleManager::ENone:
       
   261         default:
       
   262             break;
       
   263         }
       
   264     }
       
   265 
       
   266 // End of File