phoneuis/BubbleManager/Src/BMBubbleOutlookBottomImCnap.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:  Bottom outlook with 3-lines and call image.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "BMBubbleManager.h" //for enumerations
       
    21 #include    "BMBubbleOutlookBottomImCnap.h"
       
    22 #include    "BMBubbleImageManager.h"
       
    23 #include    "BMResourceManager.h"
       
    24 #include    "BMBubbleHeader.h"
       
    25 #include    "BMLayout.h"
       
    26 #include    "BMUtils.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    <AknsDrawUtils.h>
       
    35 
       
    36 // ================= MEMBER FUNCTIONS =======================
       
    37 
       
    38 // C++ default constructor can NOT contain any code, that
       
    39 // might leave.
       
    40 //
       
    41 CBubbleOutlookBottomImageCnap::CBubbleOutlookBottomImageCnap
       
    42     ( CBubbleManager& aBubbleManager )
       
    43     : CBubbleOutlookThreeLined( aBubbleManager )
       
    44     {
       
    45     }
       
    46 
       
    47 // Symbian OS constructor can leave.
       
    48 void CBubbleOutlookBottomImageCnap::ConstructL()
       
    49     {
       
    50     CBubbleOutlookThreeLined::ConstructL();
       
    51     }
       
    52 
       
    53     
       
    54 // Destructor
       
    55 CBubbleOutlookBottomImageCnap::~CBubbleOutlookBottomImageCnap()
       
    56     {
       
    57     Reset();
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CBubbleOutlookBottomImageCnap::ReadBubbleHeader
       
    63 //
       
    64 //  
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 void CBubbleOutlookBottomImageCnap::ReadBubbleHeader( CBubbleHeader& aHeader )
       
    68     {
       
    69     iHeader = &aHeader;
       
    70     
       
    71     iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue );        
       
    72     
       
    73     CBubbleOutlookThreeLined::ReadBubbleHeader( aHeader );
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // CBubbleOutlookBottomImageCnap::SizeChanged
       
    78 // called by framwork when the view size is changed
       
    79 //  
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 void CBubbleOutlookBottomImageCnap::SizeChanged()
       
    83     {
       
    84     if( !iHeader )
       
    85         {
       
    86         return;
       
    87         }
       
    88 
       
    89     AknsUtils::RegisterControlPosition( this );
       
    90     
       
    91     if ( !iCallObjectDisplay )
       
    92         {
       
    93         DoCall1Layout();    
       
    94         }
       
    95     else
       
    96         {
       
    97         TRAPD( err, DoCall2LayoutL() );
       
    98         if ( err )    
       
    99             {
       
   100             iBubble->SetPicture( NULL, NULL );
       
   101                 
       
   102             MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   103             AknsDrawUtils::PrepareFrame( skin,
       
   104                                          iOuterRect,
       
   105                                          iInnerRect,
       
   106                                          iFrameId,
       
   107                                          KAknsIIDDefault );
       
   108             }  
       
   109         }      
       
   110     }
       
   111 
       
   112 // ---------------------------------------------------------------------------
       
   113 // CBubbleOutlookBottomImageCnap::PositionChanged
       
   114 // ---------------------------------------------------------------------------
       
   115 //
       
   116 void CBubbleOutlookBottomImageCnap::PositionChanged()
       
   117     {
       
   118     AknsUtils::RegisterControlPosition( this );
       
   119     }
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // CBubbleOutlookBottomImageCnap::DoCall1Layout
       
   123 // ---------------------------------------------------------------------------
       
   124 //    
       
   125 void CBubbleOutlookBottomImageCnap::DoCall1Layout()
       
   126     {
       
   127     }
       
   128 
       
   129 // ---------------------------------------------------------------------------
       
   130 // CBubbleOutlookBottomImageCnap::DoCall2Layout
       
   131 // ---------------------------------------------------------------------------
       
   132 //
       
   133 void CBubbleOutlookBottomImageCnap::DoCall2LayoutL()
       
   134     {
       
   135     iBubble->SetPictureOwnedExternally( EFalse );
       
   136     iBubble->SetPicture( NULL, NULL );
       
   137     
       
   138     const TRect rect = Rect();
       
   139     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   140     switch ( callState )
       
   141         {
       
   142         case CBubbleManager::EDisconnected:
       
   143         case CBubbleManager::EActive:
       
   144         case CBubbleManager::EOnHold:
       
   145             {
       
   146             ///////////////////////////////////////////////////////////////////
       
   147             // First incall layout for single call. Call object image.
       
   148             ///////////////////////////////////////////////////////////////////
       
   149             
       
   150             TAknLayoutRect bubbleRect;
       
   151             bubbleRect.LayoutRect( 
       
   152                 rect, 
       
   153                 BubbleLayout2::popup_call2_audio_first_call_background(20) );
       
   154             
       
   155             TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() );
       
   156             TRect outerRect;
       
   157             TRect innerRect;
       
   158             BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, 
       
   159                                                        outerRect, 
       
   160                                                        innerRect);
       
   161             
       
   162             TAknsItemID coMaskFrameId;
       
   163             if ( callState == CBubbleManager::EOnHold )
       
   164                 {
       
   165                 iFrameId = KAknsIIDQsnFrCall2Bubble;
       
   166                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleCoMask;    
       
   167                 }
       
   168             else if ( callState == CBubbleManager::EDisconnected )
       
   169                 {
       
   170                 iFrameId = KAknsIIDQsnFrCall2BubbleFirstDisconn;
       
   171                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;            
       
   172                 }
       
   173             else
       
   174                 {
       
   175                 iFrameId = KAknsIIDQsnFrCall2BubbleFirst;
       
   176                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;                
       
   177                 } 
       
   178                 
       
   179             iOuterRect = outerRect;
       
   180             iOuterRect.Move( Rect().iTl );
       
   181             iInnerRect = innerRect;
       
   182             iInnerRect.Move( Rect().iTl );                
       
   183             
       
   184             // Call icon
       
   185             BubbleUtils::LayoutCustomElement( 
       
   186                 iSmallCallIndication, 
       
   187                 rect,
       
   188                 BubbleLayout2::popup_call2_audio_first_call_status_icon(19) );
       
   189                 
       
   190             // Ciphering off
       
   191             BubbleUtils::LayoutControl( 
       
   192                 iCyphOffImage, 
       
   193                 rect,
       
   194                 BubbleLayout2::popup_call2_audio_first_call_window_ciphering_icon(16) );
       
   195             
       
   196             // Call type pane    
       
   197             BubbleUtils::LayoutCallTypeIndicators(
       
   198                 rect,
       
   199                 BubbleLayout2::popup_call2_audio_first_call_type_icon(16),
       
   200                 iTypeIndication1,   // Data/Fax
       
   201                 iTypeIndication2 ); // ALS line 2
       
   202 
       
   203             // Text line 1 - cli
       
   204             BubbleUtils::LayoutLabel( 
       
   205                 iTextLine1, 
       
   206                 rect, 
       
   207                 BubbleLayout2::popup_call2_audio_first_call_cli_text(22) );
       
   208             
       
   209             // Text line 2 - phone number
       
   210             BubbleUtils::LayoutLabel( 
       
   211                 iTextLine2, 
       
   212                 rect, 
       
   213                 BubbleLayout2::popup_call2_audio_first_call_number_text(18) );
       
   214 
       
   215             // Smaller rect for text if brand image exists
       
   216             if ( iBrandImage )
       
   217                 {
       
   218                 // Text line 2 - call state
       
   219                 BubbleUtils::LayoutLabel(
       
   220                     iTextLine3,
       
   221                     rect,
       
   222                     BubbleLayout2::popup_call2_audio_first_call_state_text(18) );
       
   223 
       
   224                 // Text line 2 - call timer
       
   225                 BubbleUtils::LayoutLabel(
       
   226                     iTimerCost,
       
   227                     rect,
       
   228                     BubbleLayout2::popup_call2_audio_first_call_state_text(20) );
       
   229 
       
   230                 //Brand image
       
   231                 BubbleUtils::LayoutCustomElement(
       
   232                     iBrandImage,
       
   233                     rect,
       
   234                     BubbleLayout2::popup_call2_audio_first_brand_image2(22) );
       
   235                 }
       
   236             else
       
   237                 {
       
   238                 // Text line 2 - call state
       
   239                 BubbleUtils::LayoutLabel(
       
   240                     iTextLine3,
       
   241                     rect,
       
   242                     BubbleLayout2::popup_call2_audio_first_call_state_text(18) );
       
   243 
       
   244                 // Text line 2 - call timer
       
   245                 BubbleUtils::LayoutLabel(
       
   246                     iTimerCost,
       
   247                     rect,
       
   248                     BubbleLayout2::popup_call2_audio_first_call_state_text(20) );
       
   249                 }
       
   250                 
       
   251             // Create call object bitmaps
       
   252             iBubble->SetRect( bubbleRect.Rect() );                                
       
   253 
       
   254             BubbleUtils::PrepareBubbleImageL( 
       
   255                 iFrameId,
       
   256                 outerRect,
       
   257                 innerRect,
       
   258                 iBubble );
       
   259             
       
   260             // Add transparency
       
   261             BubbleUtils::AddTransparencyToBubbleImageL( 
       
   262                 coMaskFrameId,
       
   263                 outerRect,
       
   264                 innerRect,
       
   265                 iBubble ); 
       
   266                                
       
   267             break;
       
   268             }
       
   269         default:
       
   270             break;
       
   271         }
       
   272     }
       
   273 
       
   274 // ---------------------------------------------------------------------------
       
   275 // CBubbleOutlookBottomImageCnap::GetCall1BubbleBitmaps
       
   276 // ---------------------------------------------------------------------------
       
   277 //    
       
   278 void CBubbleOutlookBottomImageCnap::GetCall1BubbleBitmaps()
       
   279     {
       
   280     }
       
   281 
       
   282 //  End of File