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