uifw/EikStd/coctlsrc/EIKLBX.CPP
branchRCL_3
changeset 50 a1caeb42b3a3
parent 38 c52421ed5f07
child 51 fcdfafb36fe7
--- a/uifw/EikStd/coctlsrc/EIKLBX.CPP	Mon Jun 21 15:57:43 2010 +0300
+++ b/uifw/EikStd/coctlsrc/EIKLBX.CPP	Thu Jul 15 18:56:19 2010 +0300
@@ -1872,7 +1872,8 @@
         TInt topItemIndex = iListBox.iView->TopItemIndex();
         TInt itemHeight = iListBox.iView->ItemHeight();
         TInt numberOfItems = iListBox.iModel->NumberOfItems();
-
+        TInt emptySpaceOffset ( 0 );
+        
         TSize viewSize( iListBox.iView->ViewRect().Size() );
         TSize worldSize( viewSize.iWidth, itemHeight * numberOfItems );
         
@@ -1887,6 +1888,15 @@
                 {
                 worldSize.iHeight += itemHeight;
                 }
+            
+            // Check empty space below the grid
+            if ( topItemIndex != 0 )
+                {
+                TInt lastItemBottomY = 
+                        iListBox.iView->ItemPos( 
+                                numberOfItems - 1 ).iY + itemHeight +1;
+                emptySpaceOffset = Min( 0, lastItemBottomY - viewSize.iHeight );
+                }
             }
             
         // Reset offset if view's size has changed - this is needed if e.g.
@@ -1897,6 +1907,7 @@
             }
 
         TPoint viewCenter( viewSize.iWidth / 2, ( topItemIndex / iItemsInSingleLine ) * itemHeight - iListBox.iView->ItemOffsetInPixels() + ( viewSize.iHeight / 2 ) );
+        viewCenter.iY += emptySpaceOffset;
 
         // Make sure that world's size is always at least view size.
         worldSize.iHeight = Max( worldSize.iHeight, viewSize.iHeight );
@@ -6787,18 +6798,18 @@
                     ( newListBottomPos >= iListBoxExt->ListBottomLimit() ) ||
                     ( newListTopPos <= 0 && newListTopPos + viewHeight >= 0 && newListLastItemPos > viewHeight ) )
                     {
-                    if ( CAknPhysics::EAknPhysicsActionFlicking == iListBoxExt->iPhysics->OngoingPhysicsAction() || 
-                         CAknPhysics::EAknPhysicsActionBouncing == iListBoxExt->iPhysics->OngoingPhysicsAction() )
+                    switch(iListBoxExt->iPhysics->OngoingPhysicsAction())
                         {
-                        iListBoxExt->ImmediateFeedback( ETouchFeedbackSensitiveList,
-                                                        TTouchFeedbackType( ETouchFeedbackVibra ),
-                                                        TPointerEvent() );
-                        }
-                    else if ( CAknPhysics::EAknPhysicsActionDragging == iListBoxExt->iPhysics->OngoingPhysicsAction() )
-                        {
-                        iListBoxExt->ImmediateFeedback( ETouchFeedbackSensitiveList,
-                                                        TTouchFeedbackType( ETouchFeedbackVibra | ETouchFeedbackAudio ),
-                                                        TPointerEvent() );
+                        case CAknPhysics::EAknPhysicsActionBouncing:
+                        case CAknPhysics::EAknPhysicsActionDragging:
+                        case CAknPhysics::EAknPhysicsActionFlicking:
+                            iListBoxExt->ImmediateFeedback( 
+                                    ETouchFeedbackSensitiveList,
+                                    TTouchFeedbackType( ETouchFeedbackVibra ),
+                                    TPointerEvent() );
+                            break;
+                        default:
+                            break;
                         }
                     }
                 }