phoneuis/BubbleManager/Src/BMBubbleOutlookBottomCnap.cpp
changeset 0 5f000ab63145
child 1 838b0a10d15b
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 CBubbleOutlookBottomCnap class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "BMBubbleManager.h" //for enumerations
       
    21 #include    "BMBubbleOutlookBottomCnap.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 CBubbleOutlookBottomCnap::CBubbleOutlookBottomCnap
       
    42     ( CBubbleManager& aBubbleManager )
       
    43     : CBubbleOutlookThreeLined( aBubbleManager )
       
    44     {
       
    45     }
       
    46 
       
    47 // Symbian OS constructor can leave.
       
    48 void CBubbleOutlookBottomCnap::ConstructL()
       
    49     {
       
    50     CBubbleOutlookThreeLined::ConstructL();
       
    51     }
       
    52 
       
    53     
       
    54 // Destructor
       
    55 CBubbleOutlookBottomCnap::~CBubbleOutlookBottomCnap()
       
    56     {
       
    57     Reset();
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CBubbleOutlookBottomCnap::ReadBubbleHeader
       
    63 //
       
    64 //  
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 void CBubbleOutlookBottomCnap::ReadBubbleHeader( CBubbleHeader& aHeader )
       
    68     {
       
    69     iHeader = &aHeader;
       
    70     
       
    71     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
    72     
       
    73     iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue );        
       
    74     
       
    75     if ( !iCallObjectDisplay )
       
    76         {
       
    77         GetCall1BubbleBitmaps();    
       
    78         }
       
    79     
       
    80     CBubbleOutlookThreeLined::ReadBubbleHeader( aHeader );
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CBubbleOutlookBottomCnap::SizeChanged
       
    85 // called by framwork when the view size is changed
       
    86 //  
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 void CBubbleOutlookBottomCnap::SizeChanged()
       
    90     {
       
    91     if( !iHeader )
       
    92         {
       
    93         return;
       
    94         }
       
    95 
       
    96     AknsUtils::RegisterControlPosition( this );
       
    97     
       
    98     if ( !iCallObjectDisplay )
       
    99         {
       
   100         DoCall1Layout();    
       
   101         }
       
   102     else
       
   103         {
       
   104         TRAPD( err, DoCall2LayoutL() );
       
   105         if ( err )    
       
   106             {
       
   107             iBubble->SetPicture( NULL, NULL );
       
   108                 
       
   109             MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   110             AknsDrawUtils::PrepareFrame( skin,
       
   111                                          iOuterRect,
       
   112                                          iInnerRect,
       
   113                                          iFrameId,
       
   114                                          KAknsIIDDefault );
       
   115             }  
       
   116         }      
       
   117     }
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CBubbleOutlookBottomCnap::PositionChanged
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 void CBubbleOutlookBottomCnap::PositionChanged()
       
   124     {
       
   125     AknsUtils::RegisterControlPosition( this );
       
   126     }
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // CBubbleOutlookBottomCnap::DoCall1Layout
       
   130 // ---------------------------------------------------------------------------
       
   131 //    
       
   132 void CBubbleOutlookBottomCnap::DoCall1Layout()
       
   133     {
       
   134     // Deprecated
       
   135     }
       
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 // CBubbleOutlookBottomCnap::DoCall2Layout
       
   139 // ---------------------------------------------------------------------------
       
   140 //
       
   141 void CBubbleOutlookBottomCnap::DoCall2LayoutL()
       
   142     {
       
   143     iBubble->SetPictureOwnedExternally( EFalse );
       
   144     iBubble->SetPicture( NULL, NULL );
       
   145     
       
   146     const TRect rect = Rect();
       
   147     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   148     switch ( callState )
       
   149         {
       
   150         case CBubbleManager::EWaiting:
       
   151         case CBubbleManager::EIncoming:
       
   152         case CBubbleManager::EOutgoing:
       
   153         case CBubbleManager::EAlerting:
       
   154         case CBubbleManager::EAlertToDisconnected:
       
   155             {
       
   156             ///////////////////////////////////////////////////////////////////
       
   157             // Incoming call layout for single call. Three lines of text.
       
   158             ///////////////////////////////////////////////////////////////////
       
   159             
       
   160             TAknLayoutRect bubbleRect;
       
   161             bubbleRect.LayoutRect( 
       
   162                 rect, 
       
   163                 BubbleLayout2::popup_call2_audio_in_background(2) );
       
   164             
       
   165             TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() );
       
   166             TRect outerRect;
       
   167             TRect innerRect;
       
   168             BubbleLayout2::RectFrameInnerOuterRects( frameRect, 
       
   169                                                      outerRect, 
       
   170                                                      innerRect);
       
   171             
       
   172             iFrameId = ( callState == CBubbleManager::EAlertToDisconnected ) ?
       
   173                                       KAknsIIDQsnFrCall2RectDisconn : 
       
   174                                       KAknsIIDQsnFrCall2Rect;
       
   175             
       
   176             iOuterRect = outerRect;
       
   177             iOuterRect.Move( Rect().iTl );
       
   178             iInnerRect = innerRect;
       
   179             iInnerRect.Move( Rect().iTl );
       
   180             
       
   181             // Call indicator
       
   182             BubbleUtils::LayoutCustomElement(
       
   183                 iBigCallIndicator, 
       
   184                 rect, 
       
   185                 BubbleLayout2::popup_call2_audio_in_call_waiting_icon(2) );
       
   186             
       
   187             // Ciphering off
       
   188             BubbleUtils::LayoutControl( 
       
   189                 iCyphOffImage, 
       
   190                 rect,
       
   191                 BubbleLayout2::popup_call2_audio_in_ciphering_icon(2) );                
       
   192             
       
   193             // Number type icon
       
   194             BubbleUtils::LayoutCustomElement(
       
   195                 iNumberType, 
       
   196                 rect, 
       
   197                 BubbleLayout2::popup_call2_audio_in_call_number_type_icon(2) );
       
   198 
       
   199             // Text line 1
       
   200             BubbleUtils::LayoutLabel( 
       
   201                 iTextLine1, 
       
   202                 rect, 
       
   203                 BubbleLayout2::popup_call2_audio_in_call_text_1(2) );
       
   204             
       
   205             // Text line 2
       
   206             BubbleUtils::LayoutLabel( 
       
   207                 iTextLine2, 
       
   208                 rect, 
       
   209                 BubbleLayout2::popup_call2_audio_in_call_text_2(2) );
       
   210                 
       
   211             // Smaller rect for text if brand image exists
       
   212             if ( iBrandImage )
       
   213                 {
       
   214                 // Text line 3
       
   215                     BubbleUtils::LayoutLabel(
       
   216                     iTextLine3,
       
   217                     rect,
       
   218                     BubbleLayout2::popup_call2_audio_in_call_text_3(3) );
       
   219 
       
   220                 //Brand image
       
   221                 BubbleUtils::LayoutCustomElement(
       
   222                     iBrandImage,
       
   223                     rect,
       
   224                     BubbleLayout2::popup_call2_audio_in_brand_image(0) );
       
   225                 }
       
   226             else
       
   227                 {
       
   228                 // Text line 3
       
   229                 BubbleUtils::LayoutLabel(
       
   230                     iTextLine3,
       
   231                     rect,
       
   232                     BubbleLayout2::popup_call2_audio_in_call_text_3(0) );
       
   233                 }
       
   234                 
       
   235             // Create call object bitmaps    
       
   236             iBubble->SetRect( bubbleRect.Rect() );                
       
   237 
       
   238             BubbleUtils::PrepareBubbleImageL( 
       
   239                 iFrameId,
       
   240                 outerRect,
       
   241                 innerRect,
       
   242                 iBubble );
       
   243                 
       
   244             if ( iHeader->CallObjectImage() &&
       
   245                  !iHeader->CallObjectText().Length() )
       
   246                 {
       
   247                 // Add transparency
       
   248                 BubbleUtils::AddTransparencyToBubbleImageL( 
       
   249                     KAknsIIDQsnFrCall2RectCoMask, // gradient tp mask
       
   250                     outerRect,
       
   251                     innerRect,
       
   252                     iBubble );                    
       
   253                 }    
       
   254                                 
       
   255             break;
       
   256             }
       
   257         
       
   258         case CBubbleManager::EDisconnected:
       
   259         case CBubbleManager::EActive:
       
   260         case CBubbleManager::EOnHold:
       
   261             {
       
   262             ///////////////////////////////////////////////////////////////////
       
   263             // First call layout for single call. Three lines of text.
       
   264             ///////////////////////////////////////////////////////////////////
       
   265             
       
   266             TAknLayoutRect bubbleRect;
       
   267             bubbleRect.LayoutRect( 
       
   268                 rect, 
       
   269                 BubbleLayout2::popup_call2_audio_first_call_background(20) );
       
   270             
       
   271             TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() );
       
   272             TRect outerRect;
       
   273             TRect innerRect;
       
   274             BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, 
       
   275                                                        outerRect, 
       
   276                                                        innerRect);
       
   277         
       
   278             TAknsItemID coMaskFrameId;
       
   279             if ( callState == CBubbleManager::EOnHold )
       
   280                 {
       
   281                 iFrameId = KAknsIIDQsnFrCall2Bubble;
       
   282                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleCoMask;    
       
   283                 }
       
   284             else if ( callState == CBubbleManager::EDisconnected )
       
   285                 {
       
   286                 iFrameId = KAknsIIDQsnFrCall2BubbleFirstDisconn;
       
   287                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;            
       
   288                 }
       
   289             else
       
   290                 {
       
   291                 iFrameId = KAknsIIDQsnFrCall2BubbleFirst;
       
   292                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;                
       
   293                 }                
       
   294             
       
   295             // for possible frame draw
       
   296             iOuterRect = outerRect;
       
   297             iOuterRect.Move( Rect().iTl );
       
   298             iInnerRect = innerRect;
       
   299             iInnerRect.Move( Rect().iTl );
       
   300 
       
   301             // Call icon
       
   302             BubbleUtils::LayoutCustomElement( 
       
   303                 iSmallCallIndication, 
       
   304                 rect,
       
   305                 BubbleLayout2::popup_call2_audio_first_call_status_icon(19) );
       
   306                 
       
   307             // Ciphering off
       
   308             BubbleUtils::LayoutControl( 
       
   309                 iCyphOffImage, 
       
   310                 rect,
       
   311                 BubbleLayout2::popup_call2_audio_first_call_window_ciphering_icon(16) );
       
   312             
       
   313             // Call type pane
       
   314             BubbleUtils::LayoutCallTypeIndicators(
       
   315                 rect,
       
   316                 BubbleLayout2::popup_call2_audio_first_call_type_icon(16),
       
   317                 iTypeIndication1,   // Data/Fax
       
   318                 iTypeIndication2 ); // ALS line 2               
       
   319 
       
   320             // Text line 1 - cli
       
   321             BubbleUtils::LayoutLabel( 
       
   322                 iTextLine1, 
       
   323                 rect, 
       
   324                 BubbleLayout2::popup_call2_audio_first_call_cli_text(22) );
       
   325             
       
   326             // Text line 2 - phone number
       
   327             BubbleUtils::LayoutLabel( 
       
   328                 iTextLine2, 
       
   329                 rect, 
       
   330                 BubbleLayout2::popup_call2_audio_first_call_number_text(18) );
       
   331             
       
   332             // Smaller rect for text if brand image exists
       
   333             if ( iBrandImage )
       
   334                 {
       
   335                 // Text line 3
       
   336                     BubbleUtils::LayoutLabel(
       
   337                     iTextLine3,
       
   338                     rect,
       
   339                     BubbleLayout2::popup_call2_audio_in_call_text_3(3) );
       
   340 
       
   341                 //Brand image
       
   342                 BubbleUtils::LayoutCustomElement(
       
   343                     iBrandImage,
       
   344                     rect,
       
   345                     BubbleLayout2::popup_call2_audio_in_brand_image(0) );
       
   346                 }
       
   347             else
       
   348                 {
       
   349                 // Text line 3
       
   350                 BubbleUtils::LayoutLabel(
       
   351                     iTextLine3,
       
   352                     rect,
       
   353                     BubbleLayout2::popup_call2_audio_first_call_state_text(18) );
       
   354                 }
       
   355             
       
   356             // Line 3 - call timer
       
   357             BubbleUtils::LayoutLabel( 
       
   358                 iTimerCost, 
       
   359                 rect, 
       
   360                 BubbleLayout2::popup_call2_audio_first_call_state_text(20) );
       
   361                 
       
   362             // Build call object bubble
       
   363             iBubble->SetRect( bubbleRect.Rect() );                                
       
   364 
       
   365             BubbleUtils::PrepareBubbleImageL( 
       
   366                 iFrameId,
       
   367                 outerRect,
       
   368                 innerRect,
       
   369                 iBubble );
       
   370             
       
   371             
       
   372             // Add transparency
       
   373             BubbleUtils::AddTransparencyToBubbleImageL( 
       
   374                 coMaskFrameId,
       
   375                 outerRect,
       
   376                 innerRect,
       
   377                 iBubble ); 
       
   378             
       
   379                 
       
   380             break;
       
   381             }        
       
   382                 
       
   383         default:
       
   384             break;
       
   385         }
       
   386     }
       
   387 
       
   388 // ---------------------------------------------------------------------------
       
   389 // CBubbleOutlookBottomCnap::GetCall1BubbleBitmaps
       
   390 // ---------------------------------------------------------------------------
       
   391 //    
       
   392 void CBubbleOutlookBottomCnap::GetCall1BubbleBitmaps()
       
   393     {
       
   394     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   395     
       
   396     TInt bubblePicture = KErrNotFound;
       
   397     TInt bubblePictureMask = KErrNotFound;
       
   398     
       
   399     switch ( callState )
       
   400         {
       
   401         case CBubbleManager::EWaiting:
       
   402         case CBubbleManager::EIncoming:
       
   403             bubblePicture = EQgn_graf_call_rec_bigger;
       
   404             bubblePictureMask = EQgn_graf_call_rec_bigger_mask;
       
   405             break;
       
   406         case CBubbleManager::EActive:
       
   407             bubblePicture = EQgn_graf_call_first_one_active_emergency;
       
   408             bubblePictureMask = EQgn_graf_call_first_one_active_emergency_mask;
       
   409             break;
       
   410         case CBubbleManager::EAlertToDisconnected:
       
   411         case CBubbleManager::EOnHold:
       
   412         case CBubbleManager::EDisconnected:
       
   413         case CBubbleManager::ENone:
       
   414         default:        
       
   415             bubblePicture = KErrNotFound;
       
   416             bubblePictureMask = KErrNotFound;
       
   417             break;
       
   418         }
       
   419 
       
   420     if ( bubblePicture != KErrNotFound )
       
   421         {
       
   422         if ( bubblePictureMask == KErrNotFound )
       
   423             {
       
   424             iBubbleManager.ImageManager().SetBitmapToImage( 
       
   425                 iBubble, (TBMIcons) bubblePicture );
       
   426             }
       
   427         else
       
   428             {
       
   429             iBubbleManager.ImageManager().SetBitmapToImage( 
       
   430                 iBubble, 
       
   431                 (TBMIcons) bubblePicture , 
       
   432                 (TBMIcons) bubblePictureMask);
       
   433             }
       
   434         }
       
   435         
       
   436     }
       
   437 
       
   438 //  End of File