phoneuis/easydialing/src/easydialinglistbox.cpp
branchRCL_3
changeset 81 c26cc2a7c548
parent 62 5266b1f337bd
equal deleted inserted replaced
73:e30d4a1b8bad 81:c26cc2a7c548
    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;
    59 
    61 
    60 // MACROS
    62 // MACROS
    61 
    63 
    62 // LOCAL CONSTANTS AND MACROS
    64 // LOCAL CONSTANTS AND MACROS
    63 
    65 
   380     TInt variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 );
   382     TInt variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 );
   381     TAknLayoutRect maxViewLayout;
   383     TAknLayoutRect maxViewLayout;
   382     maxViewLayout.LayoutRect( aMaxRect, AknLayoutScalable_Apps::dia3_list_pane( variety ) );
   384     maxViewLayout.LayoutRect( aMaxRect, AknLayoutScalable_Apps::dia3_list_pane( variety ) );
   383     TRect maxViewRect( maxViewLayout.Rect() );
   385     TRect maxViewRect( maxViewLayout.Rect() );
   384     maxViewRect.Shrink( KListBoxMarginWidth, KListBoxMarginWidth ); // layout data doens't include any margins but we have added some
   386     maxViewRect.Shrink( KListBoxMarginWidth, KListBoxMarginWidth ); // layout data doens't include any margins but we have added some
   385 
   387     
   386     // Read list item size aid from layout data. Use it to determine how many
   388     TInt maxItemsShown = ( variety ? KMaxVisibleItemsLandscape : KMaxVisibleItemsPortrait );
   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     
       
   398     TInt itemHeight = maxViewRect.Height() / maxItemsShown;
   389     TInt itemHeight = maxViewRect.Height() / maxItemsShown;
   399     TRAP_IGNORE( SetItemHeightL( itemHeight ) );
   390     TRAP_IGNORE( SetItemHeightL( itemHeight ) );
   400 
   391 
   401     // Calculate new thumbnail rect from item size
   392     // Calculate new thumbnail rect from item size
   402     TSize itemSize( maxViewRect.Width(), itemHeight );
   393     TSize itemSize( maxViewRect.Width(), itemHeight );