phoneuis/easydialing/src/easydialinglistbox.cpp
branchRCL_3
changeset 23 40a3f856b14d
parent 20 3c221667e687
equal deleted inserted replaced
22:94dc1107e8b2 23:40a3f856b14d
    54 extern TRect ContactImageBoundingBox( const TRect& aItemRect );
    54 extern TRect ContactImageBoundingBox( const TRect& aItemRect );
    55 extern TRect ActionMenuIconBoundingBox(const TRect& aItemRect);
    55 extern TRect ActionMenuIconBoundingBox(const TRect& aItemRect);
    56 
    56 
    57 // CONSTANTS
    57 // CONSTANTS
    58 static const TInt KListBoxMarginWidth = 2;
    58 static const TInt KListBoxMarginWidth = 2;
    59 static const TInt KMaxVisibleItemsPortrait = 3;
       
    60 static const TInt KMaxVisibleItemsLandscape = 2;
       
    61 
    59 
    62 // MACROS
    60 // MACROS
    63 
    61 
    64 // LOCAL CONSTANTS AND MACROS
    62 // LOCAL CONSTANTS AND MACROS
    65 
    63 
   382     TInt variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 );
   380     TInt variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 );
   383     TAknLayoutRect maxViewLayout;
   381     TAknLayoutRect maxViewLayout;
   384     maxViewLayout.LayoutRect( aMaxRect, AknLayoutScalable_Apps::dia3_list_pane( variety ) );
   382     maxViewLayout.LayoutRect( aMaxRect, AknLayoutScalable_Apps::dia3_list_pane( variety ) );
   385     TRect maxViewRect( maxViewLayout.Rect() );
   383     TRect maxViewRect( maxViewLayout.Rect() );
   386     maxViewRect.Shrink( KListBoxMarginWidth, KListBoxMarginWidth ); // layout data doens't include any margins but we have added some
   384     maxViewRect.Shrink( KListBoxMarginWidth, KListBoxMarginWidth ); // layout data doens't include any margins but we have added some
   387     
   385 
   388     TInt maxItemsShown = ( variety ? KMaxVisibleItemsLandscape : KMaxVisibleItemsPortrait );
   386     // Read list item size aid from layout data. Use it to determine how many
       
   387     // items to show in listbox.
       
   388     TAknLayoutRect listSizeAid;
       
   389     listSizeAid.LayoutRect( aMaxRect, AknLayoutScalable_Apps::aid_size_list_single_double() );
       
   390     TInt itemHeightAid = listSizeAid.Rect().Height();
       
   391     
       
   392     TInt maxItemsShown = maxViewRect.Height() / itemHeightAid;
       
   393     if ( maxViewRect.Height() % itemHeightAid > itemHeightAid / 2 )
       
   394         {
       
   395         maxItemsShown++;
       
   396         }
       
   397     
   389     TInt itemHeight = maxViewRect.Height() / maxItemsShown;
   398     TInt itemHeight = maxViewRect.Height() / maxItemsShown;
   390     TRAP_IGNORE( SetItemHeightL( itemHeight ) );
   399     TRAP_IGNORE( SetItemHeightL( itemHeight ) );
   391 
   400 
   392     // Calculate new thumbnail rect from item size
   401     // Calculate new thumbnail rect from item size
   393     TSize itemSize( maxViewRect.Width(), itemHeight );
   402     TSize itemSize( maxViewRect.Width(), itemHeight );