uiservicetab/vimpstdetailsviewplugin/src/cvimpstdetailsheadercontrol.cpp
branchRCL_3
changeset 4 f5911524345e
parent 0 5e5d6b214f4f
child 9 9fdee5e1da30
equal deleted inserted replaced
0:5e5d6b214f4f 4:f5911524345e
    40 #include <MVPbkStoreContact.h>
    40 #include <MVPbkStoreContact.h>
    41 
    41 
    42 // constants declaration
    42 // constants declaration
    43 const TInt KLabelLineCount = 3;
    43 const TInt KLabelLineCount = 3;
    44 
    44 
       
    45 // Size of thumbnail images stored to contacts
       
    46 #define KPbkPersonalImageSize TSize(80,96)
       
    47 
    45 // ---------------------------------------------------------------------------
    48 // ---------------------------------------------------------------------------
    46 // NewL, two-phase construction
    49 // NewL, two-phase construction
    47 // ---------------------------------------------------------------------------
    50 // ---------------------------------------------------------------------------
    48 //
    51 //
    49 CVIMPSTDetailsHeaderControl* CVIMPSTDetailsHeaderControl::NewL(CVIMPSTDetailsViewBrandHandler& aBrandHandler,
    52 CVIMPSTDetailsHeaderControl* CVIMPSTDetailsHeaderControl::NewL(CVIMPSTDetailsViewBrandHandler& aBrandHandler,
    87         label->SetAlignment(EHLeftVCenter);// EHCenterVCenter, EHLeftVCenter
    90         label->SetAlignment(EHLeftVCenter);// EHCenterVCenter, EHLeftVCenter
    88         label->CropText();
    91         label->CropText();
    89         iLabels.AppendL(label);
    92         iLabels.AppendL(label);
    90         CleanupStack::Pop(label);
    93         CleanupStack::Pop(label);
    91         }
    94         }
       
    95     iContactImageSize = KPbkPersonalImageSize;
    92    	}
    96    	}
    93 
    97 
    94 // ---------------------------------------------------------------------------
    98 // ---------------------------------------------------------------------------
    95 // Destructor
    99 // Destructor
    96 // ---------------------------------------------------------------------------
   100 // ---------------------------------------------------------------------------
   167     {
   171     {
   168     TInt isLandscape = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
   172     TInt isLandscape = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
   169     
   173     
   170     AknLayoutUtils::LayoutImage(
   174     AknLayoutUtils::LayoutImage(
   171             iImage, Rect(), AknLayoutScalable_Apps::cl_header_pane_g1(isLandscape));
   175             iImage, Rect(), AknLayoutScalable_Apps::cl_header_pane_g1(isLandscape));
       
   176    
       
   177     TPoint position = iImage->Position();
       
   178     TSize size = iImage->Size();
       
   179     
       
   180     const TPoint newImagePosition = TPoint( position.iX/2, position.iY/2 );
       
   181     iImage->SetPosition( newImagePosition );
       
   182     
       
   183     const TSize newImageSize = TSize( size.iWidth + 2*( position.iX - newImagePosition.iX ) ,
       
   184             size.iHeight + 2*( position.iY - newImagePosition.iY ) );
       
   185     
       
   186     iImage->SetSize( newImageSize );
       
   187     
       
   188     iContactImageSize = newImageSize;
       
   189     
       
   190     if ( iImageDecoder )
       
   191         {
       
   192         // if bitmap was set resize it
       
   193         if (iImageDecoder->IsActive())
       
   194             {
       
   195             iImageDecoder->Cancel();
       
   196             }
       
   197         TRAP_IGNORE( iImageDecoder->StartL( iContactImageSize ) );
       
   198         }
   172     
   199     
   173     TAknLayoutRect labelsRect;
   200     TAknLayoutRect labelsRect;
   174     labelsRect.LayoutRect(Rect(), AknLayoutScalable_Apps::cl_header_name_pane(isLandscape));
   201     labelsRect.LayoutRect(Rect(), AknLayoutScalable_Apps::cl_header_name_pane(isLandscape));
   175     
   202     
   176     AknLayoutUtils::LayoutLabel(iLabels[0], labelsRect.Rect(), AknLayoutScalable_Apps::cl_header_name_pane_t1(2));
   203     AknLayoutUtils::LayoutLabel(iLabels[0], labelsRect.Rect(), AknLayoutScalable_Apps::cl_header_name_pane_t1(2));
   342 	                }
   369 	                }
   343 	            delete iImageDecoder;
   370 	            delete iImageDecoder;
   344 	            iImageDecoder = NULL;
   371 	            iImageDecoder = NULL;
   345 	            }
   372 	            }
   346 	        iImageDecoder = CVIMPSTDetailsImageDecoder::NewL(*this, data );
   373 	        iImageDecoder = CVIMPSTDetailsImageDecoder::NewL(*this, data );
   347 	        iImageDecoder->Start();
   374 	        iImageDecoder->StartL(iContactImageSize);
   348 			}
   375 			}
   349 		}
   376 		}
   350 	
   377 	
   351      }
   378      }
   352 
   379