uifw/ganes/src/HgScroller.cpp
branchRCL_3
changeset 9 0aa5fbdfbc30
parent 8 71dd06cfe933
child 10 3d340a0166ff
--- a/uifw/ganes/src/HgScroller.cpp	Wed Apr 14 16:14:00 2010 +0300
+++ b/uifw/ganes/src/HgScroller.cpp	Tue Apr 27 16:55:05 2010 +0300
@@ -173,7 +173,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CHgScroller::RefreshScreen()
+// CHgScroller::FirstIndexOnScreen()
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt CHgScroller::FirstIndexOnScreen()
@@ -182,7 +182,16 @@
     }
 
 // -----------------------------------------------------------------------------
-// CHgScroller::RefreshScreen()
+// CHgScroller::SetFirstIndexOnScreen()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CHgScroller::SetFirstIndexOnScreen( TInt aFirstIndexOnScreen )
+    {
+    FitTopItemToView( aFirstIndexOnScreen );
+    }
+
+// -----------------------------------------------------------------------------
+// CHgScroller::ItemsOnScreen()
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt CHgScroller::ItemsOnScreen()
@@ -191,7 +200,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CHgScroller::RefreshScreen()
+// CHgScroller::SelectedIndex()
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt CHgScroller::SelectedIndex()
@@ -200,7 +209,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CHgScroller::RefreshScreen()
+// CHgScroller::SetSelectedIndex()
 // -----------------------------------------------------------------------------
 //
 EXPORT_C void CHgScroller::SetSelectedIndex( TInt aIndex )
@@ -292,6 +301,7 @@
 //
 EXPORT_C void CHgScroller::GetMarkedItemsL( RArray<TInt>& aIndexes )
     {
+    ::CleanupClosePushL(aIndexes);
     for(TInt i = 0; i < iItems.Count(); ++i)
         {
         if(iItems[i]->Flags() & CHgItem::EHgItemFlagMarked )
@@ -299,6 +309,7 @@
             aIndexes.AppendL( i );
             }
         }
+    CleanupStack::Pop(&aIndexes);
     }
 
 // -----------------------------------------------------------------------------
@@ -610,6 +621,21 @@
     if( iScrollbar )
         {
         sbHandles = iScrollbar->HandlePointerEventL( aEvent );
+        
+        if(  sbHandles 
+                && iPhysics 
+                && iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionFlicking )
+            {
+            iPhysics->StopPhysics();
+            iScrollbar->Reset();
+            MTouchFeedback* feedback = MTouchFeedback::Instance();
+            if ( feedback )
+                {
+                feedback->InstantFeedback( this, ETouchFeedbackList, aEvent );
+                }
+            return sbHandles;
+            }
+        
         if ( sbHandles && !iScrollbar->IsStatic() )
             {
             MTouchFeedback* feedback = MTouchFeedback::Instance();
@@ -634,7 +660,7 @@
                     feedback->StartFeedback( this, 
                                              ETouchContinuousSlider, 
                                              &aEvent, 
-                                             KIntensity, // intensity 50%
+                                             KIntensity, // intensity
                                              timeout );
                     }
                 }
@@ -745,8 +771,6 @@
 //
 void CHgScroller::HandleUpEventL( const TPointerEvent& aEvent )
     {
-    MTouchFeedback* feedback = MTouchFeedback::Instance();
-    TTouchFeedbackType type = ETouchFeedbackVibra;
     if( iPanning )
         {
         // enable physics
@@ -754,17 +778,14 @@
         if(iLandscapeScrolling && AknLayoutUtils::LayoutMirrored())
             drag = -drag;
         iPhysics->StartPhysics(drag, iStartTime);
-        if ( feedback && iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionFlicking )
-            {
-            feedback->InstantFeedback( this, ETouchFeedbackFlick, type, aEvent );
-            }
         }
     else
         {
         HandleSelectionL();
+        MTouchFeedback* feedback = MTouchFeedback::Instance();
         if ( feedback && iSelectedIndex != KErrNotFound )
             {
-            feedback->InstantFeedback( this, ETouchFeedbackList, type, aEvent );
+            feedback->InstantFeedback( this, ETouchFeedbackList, ETouchFeedbackVibra, aEvent );
             }
         }
     }
@@ -1016,6 +1037,9 @@
 //
 void CHgScroller::ScrollBarPositionChanged( const TPoint& aNewPosition )
     {
+    if( iPhysics->OngoingPhysicsAction() == CAknPhysics::EAknPhysicsActionFlicking )
+        return;
+    
     iViewPosition = aNewPosition;
     iPhysics->StopPhysics();
     
@@ -1088,8 +1112,8 @@
         iCurrentRow = newRow;
         
         TBool needsFeedback = 
-                ( iCurrentRow >= 0 && iCurrentRow <= iItems.Count() )
-                || ( iItems.Count() - iCurrentRow > ItemsOnScreen() );
+                ( CurrentIndex() > 0 && CurrentIndex() <= iItems.Count() )
+                || ( iItems.Count() - CurrentIndex() > ItemsOnScreen() );
         
         TInt action = iPhysics->OngoingPhysicsAction();
         if( action !=  CAknPhysics::EAknPhysicsActionNone && needsFeedback )