Fix compile errors after removing boost function include from dali-core
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / item-view / item-view-impl.cpp
index 289290c..a3f222e 100644 (file)
@@ -1,57 +1,69 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // CLASS HEADER
 #include <dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h>
 
 // EXTERNAL INCLUDES
+#include <cstring> // for strcmp
 #include <algorithm>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/animation/constraints.h>
+#include <dali/public-api/common/set-wrapper.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/events/mouse-wheel-event.h>
+#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/type-registry-helper.h>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/events/mouse-wheel-event.h>
 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
-#include <dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h>
+#include <dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.h>
 #include <dali-toolkit/internal/controls/scrollable/scroll-connector-impl.h>
 
-using namespace std;
+using std::string;
+using std::set;
 using namespace Dali;
 
-namespace // unnamed namespace
+namespace // Unnamed namespace
 {
 
 //Type registration
-TypeRegistration mType( typeid(Toolkit::ItemView), typeid(Toolkit::Scrollable), NULL );
+
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::ItemView, Toolkit::Scrollable, NULL )
+DALI_TYPE_REGISTRATION_END()
 
 const float DEFAULT_MINIMUM_SWIPE_SPEED = 1.0f;
 const float DEFAULT_MINIMUM_SWIPE_DISTANCE = 3.0f;
 const float DEFAULT_MOUSE_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION = 0.1f;
 
+const float DEFAULT_MINIMUM_SWIPE_DURATION = 0.45f;
+const float DEFAULT_MAXIMUM_SWIPE_DURATION = 2.6f;
+
 const float DEFAULT_REFRESH_INTERVAL_LAYOUT_POSITIONS = 20.0f; // 1 updates per 20 items
 const int MOUSE_WHEEL_EVENT_FINISHED_TIME_OUT = 500;  // 0.5 second
 
 const float DEFAULT_ANCHORING_DURATION = 1.0f;  // 1 second
-const float DEFAULT_COLOR_VISIBILITY_REMOVE_TIME = 0.5f; // 0.5 second
 
 const float MILLISECONDS_PER_SECONDS = 1000.0f;
 
-const char* OVERSHOOT_OVERLAY_RIPPLE_IMAGE_PATH = DALI_IMAGE_DIR "overshoot_ripple.png";
-const Rect<int> OVERSHOOT_BOUNCE_IMAGE_1_PIXEL_AREA( 0, 0, 720, 58 );
+const Vector2 OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE( 720.0f, 42.0f );
+const float OVERSHOOT_BOUNCE_ACTOR_RESIZE_THRESHOLD = 180.0f;
 const Vector4 OVERSHOOT_OVERLAY_NINE_PATCH_BORDER(0.0f, 0.0f, 1.0f, 12.0f);
-const float MAXIMUM_OVERSHOOT_HEIGHT = 36.0f;  // 36 pixels
-const float DEFAULT_OVERSHOOT_ANIMATION_DURATION = 0.5f;  // 0.5 second
 const float DEFAULT_KEYBOARD_FOCUS_SCROLL_DURATION = 0.2f;
 
 const string LAYOUT_POSITION_PROPERTY_NAME( "item-view-layout-position" );
@@ -61,84 +73,6 @@ const string SCROLL_SPEED_PROPERTY_NAME( "item-view-scroll-speed" );
 const string SCROLL_DIRECTION_PROPERTY_NAME( "item-view-scroll-direction" );
 const string OVERSHOOT_PROPERTY_NAME( "item-view-overshoot" );
 
-// Functors which wrap constraint functions with stored item IDs
-
-struct WrappedVector3Constraint
-{
-  WrappedVector3Constraint(Toolkit::ItemLayout::Vector3Function wrapMe, unsigned int itemId)
-  : mWrapMe(wrapMe),
-    mItemId(itemId)
-  {
-  }
-
-  Vector3 operator()(const Vector3& current, const PropertyInput& layoutPosition, const PropertyInput& scrollSpeed, const PropertyInput& layoutSize)
-  {
-    float offsetLayoutPosition = layoutPosition.GetFloat() + static_cast<float>(mItemId);
-
-    return mWrapMe(current, offsetLayoutPosition, scrollSpeed.GetFloat(), layoutSize.GetVector3());
-  }
-
-  Toolkit::ItemLayout::Vector3Function mWrapMe;
-  unsigned int mItemId;
-};
-
-struct WrappedQuaternionConstraint
-{
-  WrappedQuaternionConstraint(Toolkit::ItemLayout::QuaternionFunction wrapMe, unsigned int itemId)
-  : mWrapMe(wrapMe),
-    mItemId(itemId)
-  {
-  }
-
-  Quaternion operator()(const Quaternion& current, const PropertyInput& layoutPosition, const PropertyInput& scrollSpeed, const PropertyInput& layoutSize)
-  {
-    float offsetLayoutPosition = layoutPosition.GetFloat() + static_cast<float>(mItemId);
-
-    return mWrapMe(current, offsetLayoutPosition, scrollSpeed.GetFloat(), layoutSize.GetVector3());
-  }
-
-  Toolkit::ItemLayout::QuaternionFunction mWrapMe;
-  unsigned int mItemId;
-};
-
-struct WrappedVector4Constraint
-{
-  WrappedVector4Constraint(Toolkit::ItemLayout::Vector4Function wrapMe, unsigned int itemId)
-  : mWrapMe(wrapMe),
-    mItemId(itemId)
-  {
-  }
-
-  Vector4 operator()(const Vector4& current, const PropertyInput& layoutPosition, const PropertyInput& scrollSpeed, const PropertyInput& layoutSize)
-  {
-    float offsetLayoutPosition = layoutPosition.GetFloat() + static_cast<float>(mItemId);
-
-    return mWrapMe(current, offsetLayoutPosition, scrollSpeed.GetFloat(), layoutSize.GetVector3());
-  }
-
-  Toolkit::ItemLayout::Vector4Function mWrapMe;
-  unsigned int mItemId;
-};
-
-struct WrappedBoolConstraint
-{
-  WrappedBoolConstraint(Toolkit::ItemLayout::BoolFunction wrapMe, unsigned int itemId)
-  : mWrapMe(wrapMe),
-    mItemId(itemId)
-  {
-  }
-
-  bool operator()(const bool& current, const PropertyInput& layoutPosition, const PropertyInput& scrollSpeed, const PropertyInput& layoutSize)
-  {
-    float offsetLayoutPosition = layoutPosition.GetFloat() + static_cast<float>(mItemId);
-
-    return mWrapMe(current, offsetLayoutPosition, scrollSpeed.GetFloat(), layoutSize.GetVector3());
-  }
-
-  Toolkit::ItemLayout::BoolFunction mWrapMe;
-  unsigned int mItemId;
-};
-
 /**
  * Local helper to convert pan distance (in actor coordinates) to the layout-specific scrolling direction
  */
@@ -153,199 +87,165 @@ float CalculateScrollDistance(Vector2 panDistance, Toolkit::ItemLayout& layout)
 }
 
 // Overshoot overlay constraints
-
-struct OvershootOverlaySizeConstraint
+void OvershootOverlaySizeConstraint( Vector3& current, const PropertyInputContainer& inputs )
 {
-  float operator()(const float& current,
-                     const PropertyInput& parentScrollDirectionProperty,
-                     const PropertyInput& parentOvershootProperty,
-                     const PropertyInput& parentSizeProperty)
-  {
-    const Vector3 parentScrollDirection = parentScrollDirectionProperty.GetVector3();
-    const Vector3 parentSize = parentSizeProperty.GetVector3();
-    const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
-
-    float overlayWidth;
-
-    if(Toolkit::IsVertical(parentOrientation))
-    {
-      overlayWidth = fabsf(parentScrollDirection.y) > Math::MACHINE_EPSILON_1 ? parentSize.x : parentSize.y;
-    }
-    else
-    {
-      overlayWidth = fabsf(parentScrollDirection.x) > Math::MACHINE_EPSILON_1 ? parentSize.y : parentSize.x;
-    }
+  const Vector3& parentScrollDirection = inputs[0]->GetVector3();
+  const Vector3& parentSize = inputs[1]->GetVector3();
+  const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
 
-    return overlayWidth;
+  if(Toolkit::IsVertical(parentOrientation))
+  {
+    current.width = fabsf(parentScrollDirection.y) > Math::MACHINE_EPSILON_1 ? parentSize.x : parentSize.y;
   }
-};
-
-struct OvershootOverlayRotationConstraint
-{
-  Quaternion operator()(const Quaternion& current,
-                        const PropertyInput& parentScrollDirectionProperty,
-                        const PropertyInput& parentOvershootProperty)
+  else
   {
-    const Vector3 parentScrollDirection = parentScrollDirectionProperty.GetVector3();
-    const float parentOvershoot = parentOvershootProperty.GetFloat();
-    const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
+    current.width = fabsf(parentScrollDirection.x) > Math::MACHINE_EPSILON_1 ? parentSize.y : parentSize.x;
+  }
 
-    Quaternion rotation;
+  current.height = ( current.width > OVERSHOOT_BOUNCE_ACTOR_RESIZE_THRESHOLD ) ? OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height : OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height*0.5f;
+}
 
-    if(Toolkit::IsVertical(parentOrientation))
+void OvershootOverlayRotationConstraint( Quaternion& current, const PropertyInputContainer& inputs )
+{
+  const Vector3& parentScrollDirection = inputs[0]->GetVector3();
+  const float parentOvershoot = inputs[1]->GetFloat();
+  const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
+
+  float multiplier = 0;
+  if(Toolkit::IsVertical(parentOrientation))
+  {
+    if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1)
     {
-      if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1)
-      {
-        if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0)
-            || (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) )
-        {
-          rotation = Quaternion(0.5f * Math::PI, Vector3::ZAXIS);
-        }
-        else
-        {
-          rotation = Quaternion(1.5f * Math::PI, Vector3::ZAXIS);
-        }
-      }
-      else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0)
-            || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) )
+      if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0)
+          || (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) )
       {
-        rotation = Quaternion(0.0f, Vector3::ZAXIS);
+        multiplier = 0.5f;
       }
       else
       {
-        rotation = Quaternion(Math::PI, Vector3::ZAXIS);
+        multiplier = 1.5f;
       }
     }
+    else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0)
+          || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) )
+    {
+      multiplier = 0.0f;
+    }
     else
     {
-      if(fabsf(parentScrollDirection.x) <= Math::MACHINE_EPSILON_1)
-      {
-        if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot > Math::MACHINE_EPSILON_0)
-            ||(parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot < Math::MACHINE_EPSILON_0) )
-        {
-          rotation = Quaternion(Math::PI, Vector3::ZAXIS);
-        }
-        else
-        {
-          rotation = Quaternion(0.0f, Vector3::ZAXIS);
-        }
-      }
-      else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0)
-            || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) )
+      multiplier = 1.0f;
+    }
+  }
+  else
+  {
+    if(fabsf(parentScrollDirection.x) <= Math::MACHINE_EPSILON_1)
+    {
+      if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot > Math::MACHINE_EPSILON_0)
+          ||(parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot < Math::MACHINE_EPSILON_0) )
       {
-        rotation = Quaternion(1.5f * Math::PI, Vector3::ZAXIS);
+        multiplier = 1.0f;
       }
       else
       {
-        rotation = Quaternion(0.5f * Math::PI, Vector3::ZAXIS);
+        multiplier = 0.0f;
       }
     }
-
-    return rotation;
+    else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0)
+          || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) )
+    {
+      multiplier = 1.5f;
+    }
+    else
+    {
+      multiplier = 0.5f;
+    }
   }
-};
 
-struct OvershootOverlayPositionConstraint
+  current = Quaternion( Radian( multiplier * Math::PI ), Vector3::ZAXIS );
+}
+
+void OvershootOverlayPositionConstraint( Vector3& current, const PropertyInputContainer& inputs )
 {
-  Vector3 operator()(const Vector3&    current,
-                     const PropertyInput& parentSizeProperty,
-                     const PropertyInput& parentScrollDirectionProperty,
-                     const PropertyInput& parentOvershootProperty)
-  {
-    const Vector3 parentScrollDirection = parentScrollDirectionProperty.GetVector3();
-    const float parentOvershoot = parentOvershootProperty.GetFloat();
-    const Vector3 parentSize = parentSizeProperty.GetVector3();
-    const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
+  const Vector3& parentSize = inputs[0]->GetVector3();
+  const Vector3& parentScrollDirection = inputs[1]->GetVector3();
+  const float parentOvershoot = inputs[2]->GetFloat();
+  const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
 
-    Vector3 relativeOffset;
+  Vector3 relativeOffset;
 
-    if(Toolkit::IsVertical(parentOrientation))
+  if(Toolkit::IsVertical(parentOrientation))
+  {
+    if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1)
     {
-      if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1)
-      {
-        if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0)
-            || (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) )
-        {
-          relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
-        }
-        else
-        {
-          relativeOffset =Vector3(0.0f, 1.0f, 0.0f);
-        }
-      }
-      else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0)
-            || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) )
+      if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0)
+          || (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) )
       {
-        relativeOffset = Vector3(0.0f, 0.0f, 0.0f);
+        relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
       }
       else
       {
-        relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
+        relativeOffset =Vector3(0.0f, 1.0f, 0.0f);
       }
     }
+    else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0)
+          || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) )
+    {
+      relativeOffset = Vector3(0.0f, 0.0f, 0.0f);
+    }
     else
     {
-      if(fabsf(parentScrollDirection.x) <= Math::MACHINE_EPSILON_1)
-      {
-        if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot < Math::MACHINE_EPSILON_0)
-            || (parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot > Math::MACHINE_EPSILON_0) )
-        {
-          relativeOffset = Vector3(0.0f, 0.0f, 0.0f);
-        }
-        else
-        {
-          relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
-        }
-      }
-      else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0)
-            || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) )
+      relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
+    }
+  }
+  else
+  {
+    if(fabsf(parentScrollDirection.x) <= Math::MACHINE_EPSILON_1)
+    {
+      if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot < Math::MACHINE_EPSILON_0)
+          || (parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot > Math::MACHINE_EPSILON_0) )
       {
-        relativeOffset = Vector3(0.0f, 1.0f, 0.0f);
+        relativeOffset = Vector3(0.0f, 0.0f, 0.0f);
       }
       else
       {
-        relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
+        relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
       }
     }
-
-    return relativeOffset * parentSize;
-
+    else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0)
+          || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) )
+    {
+      relativeOffset = Vector3(0.0f, 1.0f, 0.0f);
+    }
+    else
+    {
+      relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
+    }
   }
-};
 
-struct OvershootOverlayVisibilityConstraint
-{
-  bool operator()(const bool& current,
-                  const PropertyInput& parentLayoutScrollableProperty)
-  {
-    const bool parentLayoutScrollable = parentLayoutScrollableProperty.GetBoolean();
+  current = relativeOffset * parentSize;
+}
 
-    return parentLayoutScrollable;
-  }
-};
+void OvershootOverlayVisibilityConstraint( bool& current, const PropertyInputContainer& inputs )
+{
+  current = inputs[0]->GetBoolean();
+}
 
 /**
  * Relative position Constraint
  * Generates the relative position value of the item view based on the layout position,
  * and it's relation to the layout domain. This is a value from 0.0f to 1.0f in each axis.
  */
-Vector3 RelativePositionConstraint(const Vector3& current,
-                                   const PropertyInput& scrollPositionProperty,
-                                   const PropertyInput& scrollMinProperty,
-                                   const PropertyInput& scrollMaxProperty,
-                                   const PropertyInput& layoutSizeProperty)
+void RelativePositionConstraint( Vector3& current, const PropertyInputContainer& inputs )
 {
-  const Vector3& position = Vector3(0.0f, scrollPositionProperty.GetFloat(), 0.0f);
-  const Vector3& min = scrollMinProperty.GetVector3();
-  const Vector3& max = scrollMaxProperty.GetVector3();
+  const Vector3& position = Vector3(0.0f, inputs[0]->GetFloat(), 0.0f);
+  const Vector3& min = inputs[1]->GetVector3();
+  const Vector3& max = inputs[2]->GetVector3();
 
-  Vector3 relativePosition;
   Vector3 domainSize = max - min;
 
-  relativePosition.x = fabsf(domainSize.x) > Math::MACHINE_EPSILON_1 ? ((min.x - position.x) / fabsf(domainSize.x)) : 0.0f;
-  relativePosition.y = fabsf(domainSize.y) > Math::MACHINE_EPSILON_1 ? ((min.y - position.y) / fabsf(domainSize.y)) : 0.0f;
-
-  return relativePosition;
+  current.x = fabsf(domainSize.x) > Math::MACHINE_EPSILON_1 ? ((min.x - position.x) / fabsf(domainSize.x)) : 0.0f;
+  current.y = fabsf(domainSize.y) > Math::MACHINE_EPSILON_1 ? ((min.y - position.y) / fabsf(domainSize.y)) : 0.0f;
+  current.z = 0.0f;
 }
 
 } // unnamed namespace
@@ -396,22 +296,28 @@ ItemView::ItemView(ItemFactory& factory)
 : Scrollable(),
   mItemFactory(factory),
   mActiveLayout(NULL),
-  mDefaultAlphaFunction(Dali::Constraint::DEFAULT_ALPHA_FUNCTION),
   mAnimatingOvershootOn(false),
   mAnimateOvershootOff(false),
   mAnchoringEnabled(true),
   mAnchoringDuration(DEFAULT_ANCHORING_DURATION),
-  mRefreshIntervalLayoutPositions(DEFAULT_REFRESH_INTERVAL_LAYOUT_POSITIONS),
+  mRefreshIntervalLayoutPositions(0.0f),
   mRefreshOrderHint(true/*Refresh item 0 first*/),
   mMinimumSwipeSpeed(DEFAULT_MINIMUM_SWIPE_SPEED),
   mMinimumSwipeDistance(DEFAULT_MINIMUM_SWIPE_DISTANCE),
+  mMouseWheelScrollDistanceStep(0.0f),
   mScrollDistance(0.0f),
   mScrollSpeed(0.0f),
   mTotalPanDisplacement(Vector2::ZERO),
   mScrollOvershoot(0.0f),
   mIsFlicking(false),
   mGestureState(Gesture::Clear),
-  mAddingItems(false)
+  mAddingItems(false),
+  mPropertyPosition(Property::INVALID_INDEX),
+  mPropertyMinimumLayoutPosition(Property::INVALID_INDEX),
+  mPropertyScrollSpeed(Property::INVALID_INDEX),
+  mRefreshEnabled(true),
+  mItemsParentOrigin( ParentOrigin::CENTER),
+  mItemsAnchorPoint( AnchorPoint::CENTER)
 {
   SetRequiresMouseWheelEvents(true);
   SetKeyboardNavigationSupport(true);
@@ -419,38 +325,26 @@ ItemView::ItemView(ItemFactory& factory)
 
 void ItemView::OnInitialize()
 {
-  SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed );
-
-  RegisterCommonProperties();
-
   Actor self = Self();
 
-  mOvershootEffect = OvershootRippleEffect::New();
-  Image overshootImage = Image::New( OVERSHOOT_OVERLAY_RIPPLE_IMAGE_PATH );
-  mOvershootOverlay = ImageActor::New( overshootImage );
-  mOvershootOverlay.SetParentOrigin(ParentOrigin::TOP_LEFT);
-  mOvershootOverlay.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-  mOvershootOverlay.SetDrawMode(DrawMode::OVERLAY);
-  mOvershootOverlay.SetShaderEffect(mOvershootEffect);
-  mOvershootOverlay.SetPixelArea(OVERSHOOT_BOUNCE_IMAGE_1_PIXEL_AREA);
-  self.Add(mOvershootOverlay);
+  // Disable size negotiation for item views
+  self.SetRelayoutEnabled( false );
 
   mScrollConnector = Dali::Toolkit::ScrollConnector::New();
   mScrollPositionObject = mScrollConnector.GetScrollPositionObject();
+  mScrollConnector.ScrollPositionChangedSignal().Connect( this, &ItemView::OnScrollPositionChanged );
 
   mPropertyMinimumLayoutPosition = self.RegisterProperty(MINIMUM_LAYOUT_POSITION_PROPERTY_NAME, 0.0f);
   mPropertyPosition = self.RegisterProperty(POSITION_PROPERTY_NAME, 0.0f);
   mPropertyScrollSpeed = self.RegisterProperty(SCROLL_SPEED_PROPERTY_NAME, 0.0f);
 
-  ApplyOvershootOverlayConstraints();
+  EnableScrollComponent(Toolkit::Scrollable::OvershootIndicator);
 
-  Constraint constraint = Constraint::New<Vector3>(mPropertyRelativePosition,
-                                                   LocalSource(mPropertyPosition),
-                                                   LocalSource(mPropertyPositionMin),
-                                                   LocalSource(mPropertyPositionMax),
-                                                   LocalSource(Actor::SIZE),
-                                                   RelativePositionConstraint);
-  self.ApplyConstraint(constraint);
+  Constraint constraint = Constraint::New<Vector3>( self, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION, RelativePositionConstraint );
+  constraint.AddSource( LocalSource( mPropertyPosition ) );
+  constraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.Apply();
 
   Vector2 stageSize = Stage::GetCurrent().GetSize();
   mMouseWheelScrollDistanceStep = stageSize.y * DEFAULT_MOUSE_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION;
@@ -460,7 +354,7 @@ void ItemView::OnInitialize()
   mMouseWheelEventFinishedTimer = Timer::New( MOUSE_WHEEL_EVENT_FINISHED_TIME_OUT );
   mMouseWheelEventFinishedTimer.TickSignal().Connect( this, &ItemView::OnMouseWheelEventFinished );
 
-  SetRefreshInterval(mRefreshIntervalLayoutPositions);
+  SetRefreshInterval(DEFAULT_REFRESH_INTERVAL_LAYOUT_POSITIONS);
 }
 
 ItemView::~ItemView()
@@ -506,13 +400,15 @@ ItemLayoutPtr ItemView::GetActiveLayout() const
 
 float ItemView::GetCurrentLayoutPosition(unsigned int itemId) const
 {
-  return mScrollPositionObject.GetProperty<float>( ScrollConnector::SCROLL_POSITION ) + static_cast<float>( itemId );
+  return mScrollConnector.GetScrollPosition() + static_cast<float>( itemId );
 }
 
 void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSize, float durationSeconds)
 {
   DALI_ASSERT_ALWAYS(layoutIndex < mLayouts.size());
 
+  mRefreshEnabled = false;
+
   Actor self = Self();
 
   // The ItemView size should match the active layout size
@@ -524,8 +420,6 @@ void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSiz
 
   // Move the items to the new layout positions...
 
-  bool resizeAnimationNeeded(false);
-
   for (ConstItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
   {
     unsigned int itemId = iter->first;
@@ -537,36 +431,15 @@ void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSiz
     Vector3 size;
     if(mActiveLayout->GetItemSize(itemId, targetSize, size))
     {
-      if( durationSeconds > 0.0f )
-      {
-        // Use a size animation
-        if (!resizeAnimationNeeded)
-        {
-          resizeAnimationNeeded = true;
-          RemoveAnimation(mResizeAnimation);
-          mResizeAnimation = Animation::New(durationSeconds);
-        }
-
-        // The layout provides its own resize animation
-        mActiveLayout->GetResizeAnimation(mResizeAnimation, actor, size, durationSeconds);
-      }
-      else
-      {
-        // resize immediately
-        actor.SetSize(size);
-      }
+      // resize immediately
+      actor.SetSize( size.GetVectorXY() );
     }
 
-    ApplyConstraints(actor, *mActiveLayout, itemId, durationSeconds);
-  }
-
-  if (resizeAnimationNeeded)
-  {
-    mResizeAnimation.Play();
+    mActiveLayout->ApplyConstraints(actor, itemId, durationSeconds, mScrollPositionObject, Self() );
   }
 
   // Refresh the new layout
-  ItemRange range = GetItemRange(*mActiveLayout, targetSize, true/*reserve extra*/);
+  ItemRange range = GetItemRange(*mActiveLayout, targetSize, GetCurrentLayoutPosition(0), false/* don't reserve extra*/);
   AddActorsWithinRange( range, durationSeconds );
 
   // Scroll to an appropriate layout position
@@ -592,9 +465,10 @@ void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSiz
   if (scrollAnimationNeeded)
   {
     RemoveAnimation(mScrollAnimation);
-    mScrollAnimation = Animation::New(mAnchoringDuration);
+    mScrollAnimation = Animation::New(durationSeconds);
     mScrollAnimation.AnimateTo( Property( mScrollPositionObject, ScrollConnector::SCROLL_POSITION ), firstItemScrollPosition, AlphaFunctions::EaseOut );
     mScrollAnimation.AnimateTo( Property(self, mPropertyPosition), GetScrollPosition(firstItemScrollPosition, targetSize), AlphaFunctions::EaseOut );
+    mScrollAnimation.FinishedSignal().Connect(this, &ItemView::OnLayoutActivationScrollFinished);
     mScrollAnimation.Play();
   }
 
@@ -604,7 +478,7 @@ void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSiz
 
   Radian scrollDirection(mActiveLayout->GetScrollDirection());
   float orientation = static_cast<float>(mActiveLayout->GetOrientation());
-  self.SetProperty(mPropertyScrollDirection, Vector3(sinf(scrollDirection), cosf(scrollDirection), orientation));
+  self.SetProperty(Toolkit::Scrollable::Property::SCROLL_DIRECTION, Vector3(sinf(scrollDirection), cosf(scrollDirection), orientation));
 
   self.SetProperty(mPropertyScrollSpeed, mScrollSpeed);
 
@@ -625,26 +499,35 @@ void ItemView::DeactivateCurrentLayout()
   }
 }
 
-void ItemView::SetDefaultAlphaFunction(AlphaFunction func)
+void ItemView::OnRefreshNotification(PropertyNotification& source)
 {
-  mDefaultAlphaFunction = func;
+  if(mRefreshEnabled || mScrollAnimation)
+  {
+    // Only refresh the cache during normal scrolling
+    DoRefresh(GetCurrentLayoutPosition(0), true);
+  }
 }
 
-AlphaFunction ItemView::GetDefaultAlphaFunction() const
+void ItemView::Refresh()
 {
-  return mDefaultAlphaFunction;
+  for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter )
+  {
+    ReleaseActor( iter->first, iter->second );
+  }
+  mItemPool.clear();
+
+  DoRefresh(GetCurrentLayoutPosition(0), true);
 }
 
-void ItemView::OnRefreshNotification(PropertyNotification& source)
+void ItemView::DoRefresh(float currentLayoutPosition, bool cacheExtra)
 {
   if (mActiveLayout)
   {
-    ItemRange range = GetItemRange(*mActiveLayout, mActiveLayoutTargetSize, true/*reserve extra*/);
+    ItemRange range = GetItemRange(*mActiveLayout, mActiveLayoutTargetSize, currentLayoutPosition, cacheExtra/*reserve extra*/);
     RemoveActorsOutsideRange( range );
     AddActorsWithinRange( range, 0.0f/*immediate*/ );
 
-    Vector3 currentScrollPosition = GetCurrentScrollPosition();
-    mScrollUpdatedSignalV2.Emit( currentScrollPosition );
+    mScrollUpdatedSignal.Emit( Vector3(0.0f, currentLayoutPosition, 0.0f) );
   }
 }
 
@@ -700,14 +583,17 @@ float ItemView::GetAnchoringDuration() const
 
 void ItemView::SetRefreshInterval(float intervalLayoutPositions)
 {
-  mRefreshIntervalLayoutPositions = intervalLayoutPositions;
-
-  if(mRefreshNotification)
+  if( !Equals(mRefreshIntervalLayoutPositions, intervalLayoutPositions) )
   {
-    mScrollPositionObject.RemovePropertyNotification(mRefreshNotification);
+    mRefreshIntervalLayoutPositions = intervalLayoutPositions;
+
+    if(mRefreshNotification)
+    {
+      mScrollPositionObject.RemovePropertyNotification(mRefreshNotification);
+    }
+    mRefreshNotification = mScrollPositionObject.AddPropertyNotification( ScrollConnector::SCROLL_POSITION, StepCondition(mRefreshIntervalLayoutPositions, 0.0f) );
+    mRefreshNotification.NotifySignal().Connect( this, &ItemView::OnRefreshNotification );
   }
-  mRefreshNotification = mScrollPositionObject.AddPropertyNotification( ScrollConnector::SCROLL_POSITION, StepCondition(mRefreshIntervalLayoutPositions, 0.0f) );
-  mRefreshNotification.NotifySignal().Connect( this, &ItemView::OnRefreshNotification );
 }
 
 float ItemView::GetRefreshInterval() const
@@ -715,6 +601,11 @@ float ItemView::GetRefreshInterval() const
   return mRefreshIntervalLayoutPositions;
 }
 
+void ItemView::SetRefreshEnabled(bool enabled)
+{
+  mRefreshEnabled = enabled;
+}
+
 Actor ItemView::GetItem(unsigned int itemId) const
 {
   Actor actor;
@@ -748,37 +639,58 @@ void ItemView::InsertItem( Item newItem, float durationSeconds )
 {
   mAddingItems = true;
 
-  SetupActor( newItem, durationSeconds );
-  Self().Add( newItem.second );
+  Actor displacedActor;
+  ItemPoolIter afterDisplacedIter = mItemPool.end();
 
   ItemPoolIter foundIter = mItemPool.find( newItem.first );
   if( mItemPool.end() != foundIter )
   {
-    Actor moveMe = foundIter->second;
+    SetupActor( newItem, durationSeconds );
+    Self().Add( newItem.second );
+
+    displacedActor = foundIter->second;
     foundIter->second = newItem.second;
 
+    afterDisplacedIter = ++foundIter;
+  }
+  else
+  {
+    // Inserting before the existing item range?
+    ItemPoolIter iter = mItemPool.begin();
+    if( iter != mItemPool.end() &&
+        iter->first > newItem.first )
+    {
+      displacedActor = iter->second;
+      mItemPool.erase( iter++ ); // iter is still valid after the erase
+
+      afterDisplacedIter = iter;
+    }
+  }
+
+  if( displacedActor )
+  {
     // Move the existing actors to make room
-    for( ItemPoolIter iter = ++foundIter; mItemPool.end() != iter; ++iter )
+    for( ItemPoolIter iter = afterDisplacedIter; mItemPool.end() != iter; ++iter )
     {
       Actor temp = iter->second;
-      iter->second = moveMe;
-      moveMe = temp;
+      iter->second = displacedActor;
+      displacedActor = temp;
 
       iter->second.RemoveConstraints();
-      ApplyConstraints( iter->second, *mActiveLayout, iter->first, durationSeconds );
+      mActiveLayout->ApplyConstraints( iter->second, iter->first, durationSeconds, mScrollPositionObject, Self() );
     }
 
     // Create last item
-    ItemId lastId = mItemPool.rbegin()->first;
-    Item lastItem( lastId + 1, moveMe );
-    mItemPool.insert( lastItem );
+    ItemPool::reverse_iterator lastIter = mItemPool.rbegin();
+    if ( lastIter != mItemPool.rend() )
+    {
+      ItemId lastId = lastIter->first;
+      Item lastItem( lastId + 1, displacedActor );
+      mItemPool.insert( lastItem );
 
-    lastItem.second.RemoveConstraints();
-    ApplyConstraints( lastItem.second, *mActiveLayout, lastItem.first, durationSeconds );
-  }
-  else
-  {
-    mItemPool.insert( newItem );
+      lastItem.second.RemoveConstraints();
+      mActiveLayout->ApplyConstraints( lastItem.second, lastItem.first, durationSeconds, mScrollPositionObject, Self() );
+    }
   }
 
   CalculateDomainSize(Self().GetCurrentSize());
@@ -791,18 +703,16 @@ void ItemView::InsertItems( const ItemContainer& newItems, float durationSeconds
   mAddingItems = true;
 
   // Insert from lowest id to highest
-  set<Item> sortedItems;
+  std::set<Item> sortedItems;
   for( ConstItemIter iter = newItems.begin(); newItems.end() != iter; ++iter )
   {
     sortedItems.insert( *iter );
   }
 
-  for( set<Item>::iterator iter = sortedItems.begin(); sortedItems.end() != iter; ++iter )
+  for( std::set<Item>::iterator iter = sortedItems.begin(); sortedItems.end() != iter; ++iter )
   {
     Self().Add( iter->second );
 
-    cout << "inserting item: " << iter->first << endl;
-
     ItemPoolIter foundIter = mItemPool.find( iter->first );
     if( mItemPool.end() != foundIter )
     {
@@ -839,7 +749,7 @@ void ItemView::InsertItems( const ItemContainer& newItems, float durationSeconds
     else
     {
       iter->second.RemoveConstraints();
-      ApplyConstraints( iter->second, *mActiveLayout, iter->first, durationSeconds );
+      mActiveLayout->ApplyConstraints( iter->second, iter->first, durationSeconds, mScrollPositionObject, Self() );
     }
   }
 
@@ -850,16 +760,18 @@ void ItemView::InsertItems( const ItemContainer& newItems, float durationSeconds
 
 void ItemView::RemoveItem( unsigned int itemId, float durationSeconds )
 {
-  bool actorRemoved = RemoveActor( itemId );
-  if( actorRemoved )
+  bool actorsReordered = RemoveActor( itemId );
+  if( actorsReordered )
   {
     ReapplyAllConstraints( durationSeconds );
+
+    OnItemsRemoved();
   }
 }
 
 void ItemView::RemoveItems( const ItemIdContainer& itemIds, float durationSeconds )
 {
-  bool actorRemoved( false );
+  bool actorsReordered( false );
 
   // Remove from highest id to lowest
   set<ItemId> sortedItems;
@@ -872,26 +784,44 @@ void ItemView::RemoveItems( const ItemIdContainer& itemIds, float durationSecond
   {
     if( RemoveActor( *iter ) )
     {
-      actorRemoved = true;
+      actorsReordered = true;
     }
   }
 
-  if( actorRemoved )
+  if( actorsReordered )
   {
     ReapplyAllConstraints( durationSeconds );
+
+    OnItemsRemoved();
   }
 }
 
 bool ItemView::RemoveActor(unsigned int itemId)
 {
-  bool removed( false );
+  bool reordered( false );
 
-  const ItemPoolIter removeIter = mItemPool.find( itemId );
+  ItemPoolIter removeIter = mItemPool.find( itemId );
+  if( removeIter != mItemPool.end() )
+  {
+    ReleaseActor(itemId, removeIter->second);
+  }
+  else
+  {
+    // Removing before the existing item range?
+    ItemPoolIter iter = mItemPool.begin();
+    if( iter != mItemPool.end() &&
+        iter->first > itemId )
+    {
+      // In order to decrement the first visible item ID
+      mItemPool.insert( Item(iter->first - 1, Actor()) );
+
+      removeIter = mItemPool.begin();
+    }
+  }
 
   if( removeIter != mItemPool.end() )
   {
-    Self().Remove( removeIter->second );
-    removed = true;
+    reordered = true;
 
     // Adjust the remaining item IDs, for example if item 2 is removed:
     //   Initial actors:     After insert:
@@ -913,7 +843,7 @@ bool ItemView::RemoveActor(unsigned int itemId)
     }
   }
 
-  return removed;
+  return reordered;
 }
 
 void ItemView::ReplaceItem( Item replacementItem, float durationSeconds )
@@ -926,7 +856,7 @@ void ItemView::ReplaceItem( Item replacementItem, float durationSeconds )
   const ItemPoolIter iter = mItemPool.find( replacementItem.first );
   if( mItemPool.end() != iter )
   {
-    Self().Remove( iter->second );
+    ReleaseActor(iter->first, iter->second);
     iter->second = replacementItem.second;
   }
   else
@@ -956,7 +886,7 @@ void ItemView::RemoveActorsOutsideRange( ItemRange range )
 
     if( ! range.Within( current ) )
     {
-      Self().Remove( iter->second );
+      ReleaseActor(iter->first, iter->second);
 
       mItemPool.erase( iter++ ); // erase invalidates the return value of post-increment; iter remains valid
     }
@@ -969,7 +899,7 @@ void ItemView::RemoveActorsOutsideRange( ItemRange range )
 
 void ItemView::AddActorsWithinRange( ItemRange range, float durationSeconds )
 {
-  range.end = min(mItemFactory.GetNumberOfItems(), range.end);
+  range.end = std::min(mItemFactory.GetNumberOfItems(), range.end);
 
   // The order of addition depends on the scroll direction.
   if (mRefreshOrderHint)
@@ -1016,28 +946,34 @@ void ItemView::AddNewActor( unsigned int itemId, float durationSeconds )
 
 void ItemView::SetupActor( Item item, float durationSeconds )
 {
-  item.second.SetParentOrigin( ParentOrigin::CENTER );
-  item.second.SetAnchorPoint( AnchorPoint::CENTER );
+  item.second.SetParentOrigin( mItemsParentOrigin );
+  item.second.SetAnchorPoint( mItemsAnchorPoint );
 
   if( mActiveLayout )
   {
     Vector3 size;
     if( mActiveLayout->GetItemSize( item.first, mActiveLayoutTargetSize, size ) )
     {
-      item.second.SetSize( size );
+      item.second.SetSize( size.GetVectorXY() );
     }
 
-    ApplyConstraints( item.second, *mActiveLayout, item.first, durationSeconds );
+    mActiveLayout->ApplyConstraints( item.second, item.first, durationSeconds, mScrollPositionObject, Self() );
   }
 }
 
-ItemRange ItemView::GetItemRange(ItemLayout& layout, const Vector3& layoutSize, bool reserveExtra)
+void ItemView::ReleaseActor( ItemId item, Actor actor )
+{
+  Self().Remove( actor );
+  mItemFactory.ItemReleased(item, actor);
+}
+
+ItemRange ItemView::GetItemRange(ItemLayout& layout, const Vector3& layoutSize, float layoutPosition, bool reserveExtra)
 {
   unsigned int itemCount = mItemFactory.GetNumberOfItems();
 
   ItemRange available(0u, itemCount);
 
-  ItemRange range = layout.GetItemsWithinArea( GetCurrentLayoutPosition(0), layoutSize );
+  ItemRange range = layout.GetItemsWithinArea( layoutPosition, layoutSize );
 
   if (reserveExtra)
   {
@@ -1055,11 +991,11 @@ void ItemView::OnChildAdd(Actor& child)
   if(!mAddingItems)
   {
     // We don't want to do this downcast check for any item added by ItemView itself.
-    Dali::Toolkit::ScrollBar scrollBar = Dali::Toolkit::ScrollBar::DownCast(child);
-    if(scrollBar)
+    Dali::Toolkit::ScrollComponent scrollComponent = Dali::Toolkit::ScrollComponent::DownCast(child);
+    if(scrollComponent)
     {
       // Set the scroll connector when scroll bar is being added
-      scrollBar.SetScrollConnector(mScrollConnector);
+      scrollComponent.SetScrollConnector(mScrollConnector);
     }
   }
 }
@@ -1084,7 +1020,10 @@ bool ItemView::OnTouchEvent(const TouchEvent& event)
     mScrollOvershoot = 0.0f;
     AnimateScrollOvershoot(0.0f);
 
-    mScrollCompletedSignalV2.Emit(GetCurrentScrollPosition());
+    if(mScrollAnimation)
+    {
+      mScrollCompletedSignal.Emit(GetCurrentScrollPosition());
+    }
 
     RemoveAnimation(mScrollAnimation);
   }
@@ -1099,12 +1038,13 @@ bool ItemView::OnMouseWheelEvent(const MouseWheelEvent& event)
   {
     Actor self = Self();
     const Vector3 layoutSize = Self().GetCurrentSize();
-    float layoutPositionDelta = GetCurrentLayoutPosition(0) + (event.z * mMouseWheelScrollDistanceStep * mActiveLayout->GetScrollSpeedFactor());
+    float layoutPositionDelta = GetCurrentLayoutPosition(0) - (event.z * mMouseWheelScrollDistanceStep * mActiveLayout->GetScrollSpeedFactor());
     float firstItemScrollPosition = ClampFirstItemPosition(layoutPositionDelta, layoutSize, *mActiveLayout);
 
     mScrollPositionObject.SetProperty( ScrollConnector::SCROLL_POSITION, firstItemScrollPosition );
     self.SetProperty(mPropertyPosition, GetScrollPosition(firstItemScrollPosition, layoutSize));
-    mScrollStartedSignalV2.Emit(GetCurrentScrollPosition());
+    mScrollStartedSignal.Emit(GetCurrentScrollPosition());
+    mRefreshEnabled = true;
   }
 
   if (mMouseWheelEventFinishedTimer.IsRunning())
@@ -1135,104 +1075,13 @@ bool ItemView::OnMouseWheelEventFinished()
       mScrollOvershoot = 0.0f;
       AnimateScrollOvershoot(0.0f);
 
-      mScrollCompletedSignalV2.Emit(GetCurrentScrollPosition());
+      mScrollCompletedSignal.Emit(GetCurrentScrollPosition());
     }
   }
 
   return false;
 }
 
-void ItemView::ApplyConstraints(Actor& actor, ItemLayout& layout, unsigned int itemId, float duration)
-{
-  ItemLayout::Vector3Function positionConstraint;
-  if (layout.GetPositionConstraint(itemId, positionConstraint))
-  {
-    WrappedVector3Constraint wrapped(positionConstraint, itemId);
-
-    Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
-                                                      Source( mScrollPositionObject, ScrollConnector::SCROLL_POSITION ),
-                                                      ParentSource( mPropertyScrollSpeed ),
-                                                      ParentSource( Actor::SIZE ),
-                                                      wrapped );
-    constraint.SetApplyTime(duration);
-    constraint.SetAlphaFunction(mDefaultAlphaFunction);
-
-    actor.ApplyConstraint(constraint);
-  }
-
-  ItemLayout::QuaternionFunction rotationConstraint;
-  if (layout.GetRotationConstraint(itemId, rotationConstraint))
-  {
-    WrappedQuaternionConstraint wrapped(rotationConstraint, itemId);
-
-    Constraint constraint = Constraint::New<Quaternion>( Actor::ROTATION,
-                                                         Source( mScrollPositionObject, ScrollConnector::SCROLL_POSITION ),
-                                                         ParentSource( mPropertyScrollSpeed ),
-                                                         ParentSource( Actor::SIZE ),
-                                                         wrapped );
-    constraint.SetApplyTime(duration);
-    constraint.SetAlphaFunction(mDefaultAlphaFunction);
-
-    actor.ApplyConstraint(constraint);
-  }
-
-  ItemLayout::Vector3Function scaleConstraint;
-  if (layout.GetScaleConstraint(itemId, scaleConstraint))
-  {
-    WrappedVector3Constraint wrapped(scaleConstraint, itemId);
-
-    Constraint constraint = Constraint::New<Vector3>( Actor::SCALE,
-                                                      Source( mScrollPositionObject, ScrollConnector::SCROLL_POSITION ),
-                                                      ParentSource( mPropertyScrollSpeed ),
-                                                      ParentSource( Actor::SIZE ),
-                                                      wrapped );
-    constraint.SetApplyTime(duration);
-    constraint.SetAlphaFunction(mDefaultAlphaFunction);
-
-    actor.ApplyConstraint(constraint);
-  }
-
-  ItemLayout::Vector4Function colorConstraint;
-  if (layout.GetColorConstraint(itemId, colorConstraint))
-  {
-    WrappedVector4Constraint wrapped(colorConstraint, itemId);
-
-    Constraint constraint = Constraint::New<Vector4>( Actor::COLOR,
-                                                      Source( mScrollPositionObject, ScrollConnector::SCROLL_POSITION ),
-                                                      ParentSource( mPropertyScrollSpeed ),
-                                                      ParentSource( Actor::SIZE ),
-                                                      wrapped );
-    constraint.SetApplyTime(duration);
-    constraint.SetAlphaFunction(mDefaultAlphaFunction);
-
-    // Release color constraints slowly; this allows ItemView to co-exist with ImageActor fade-in
-    constraint.SetRemoveTime(DEFAULT_COLOR_VISIBILITY_REMOVE_TIME);
-    constraint.SetRemoveAction(Dali::Constraint::Discard);
-
-    actor.ApplyConstraint(constraint);
-  }
-
-  ItemLayout::BoolFunction visibilityConstraint;
-  if (layout.GetVisibilityConstraint(itemId, visibilityConstraint))
-  {
-    WrappedBoolConstraint wrapped(visibilityConstraint, itemId);
-
-    Constraint constraint = Constraint::New<bool>( Actor::VISIBLE,
-                                                   Source( mScrollPositionObject, ScrollConnector::SCROLL_POSITION ),
-                                                   ParentSource( mPropertyScrollSpeed ),
-                                                   ParentSource( Actor::SIZE ),
-                                                   wrapped );
-    constraint.SetApplyTime(duration);
-    constraint.SetAlphaFunction(mDefaultAlphaFunction);
-
-    // Release visibility constraints the same time as the color constraint
-    constraint.SetRemoveTime(DEFAULT_COLOR_VISIBILITY_REMOVE_TIME);
-    constraint.SetRemoveAction(Dali::Constraint::Discard);
-
-    actor.ApplyConstraint(constraint);
-  }
-}
-
 void ItemView::ReapplyAllConstraints( float durationSeconds )
 {
   for (ConstItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
@@ -1241,24 +1090,35 @@ void ItemView::ReapplyAllConstraints( float durationSeconds )
     Actor actor = iter->second;
 
     actor.RemoveConstraints();
-    ApplyConstraints(actor, *mActiveLayout, id, durationSeconds);
+    mActiveLayout->ApplyConstraints(actor, id, durationSeconds, mScrollPositionObject, Self());
   }
+}
 
+void ItemView::OnItemsRemoved()
+{
   CalculateDomainSize(Self().GetCurrentSize());
+
+  // Adjust scroll-position after an item is removed
+  if( mActiveLayout )
+  {
+    float firstItemScrollPosition = ClampFirstItemPosition(GetCurrentLayoutPosition(0), Self().GetCurrentSize(), *mActiveLayout);
+
+    mScrollPositionObject.SetProperty( ScrollConnector::SCROLL_POSITION, firstItemScrollPosition );
+  }
 }
 
 float ItemView::ClampFirstItemPosition(float targetPosition, const Vector3& targetSize, ItemLayout& layout)
 {
   Actor self = Self();
   float minLayoutPosition = layout.GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), targetSize);
-  float clamppedPosition = min(0.0f, max(minLayoutPosition, targetPosition));
+  float clamppedPosition = std::min(0.0f, std::max(minLayoutPosition, targetPosition));
   mScrollOvershoot = targetPosition - clamppedPosition;
   self.SetProperty(mPropertyMinimumLayoutPosition, minLayoutPosition);
 
   return clamppedPosition;
 }
 
-void ItemView::OnPan(PanGesture gesture)
+void ItemView::OnPan( const PanGesture& gesture )
 {
   Actor self = Self();
   const Vector3 layoutSize = Self().GetCurrentSize();
@@ -1298,7 +1158,9 @@ void ItemView::OnPan(PanGesture gesture)
 
         RemoveAnimation(mScrollAnimation);
 
-        float flickAnimationDuration = mActiveLayout->GetItemFlickAnimationDuration() * max(1.0f, fabsf(firstItemScrollPosition - GetCurrentLayoutPosition(0)));
+        float flickAnimationDuration = Clamp( mActiveLayout->GetItemFlickAnimationDuration() * std::max(1.0f, fabsf(firstItemScrollPosition - GetCurrentLayoutPosition(0)))
+                                       , DEFAULT_MINIMUM_SWIPE_DURATION, DEFAULT_MAXIMUM_SWIPE_DURATION);
+
         mScrollAnimation = Animation::New(flickAnimationDuration);
         mScrollAnimation.AnimateTo( Property( mScrollPositionObject, ScrollConnector::SCROLL_POSITION ), firstItemScrollPosition, AlphaFunctions::EaseOut );
         mScrollAnimation.AnimateTo( Property(self, mPropertyPosition), GetScrollPosition(firstItemScrollPosition, layoutSize), AlphaFunctions::EaseOut );
@@ -1321,7 +1183,7 @@ void ItemView::OnPan(PanGesture gesture)
       // Reset the overshoot if no scroll animation.
       if (!mScrollAnimation)
       {
-        mScrollCompletedSignalV2.Emit(GetCurrentScrollPosition());
+        mScrollCompletedSignal.Emit(GetCurrentScrollPosition());
 
         AnimateScrollOvershoot(0.0f, false);
       }
@@ -1331,43 +1193,34 @@ void ItemView::OnPan(PanGesture gesture)
     case Gesture::Started: // Fall through
     {
       mTotalPanDisplacement = Vector2::ZERO;
+      mScrollStartedSignal.Emit(GetCurrentScrollPosition());
+      mRefreshEnabled = true;
     }
 
     case Gesture::Continuing:
     {
       mScrollDistance = CalculateScrollDistance(gesture.displacement, *mActiveLayout);
-      mScrollSpeed = Clamp((gesture.GetSpeed() * mActiveLayout->GetScrollSpeedFactor() * MILLISECONDS_PER_SECONDS), 0.0f, mActiveLayout->GetMaximumSwipeSpeed());
+      mScrollSpeed = Clamp((gesture.GetSpeed() * gesture.GetSpeed() * mActiveLayout->GetFlickSpeedFactor() * MILLISECONDS_PER_SECONDS), 0.0f, mActiveLayout->GetMaximumSwipeSpeed());
 
       // Refresh order depends on the direction of the scroll; negative is towards the last item.
       mRefreshOrderHint = mScrollDistance < 0.0f;
 
-      RemoveAnimation(mScrollSpeedAnimation);
-      mScrollSpeedAnimation = Animation::New(0.3f);
-      mScrollSpeedAnimation.AnimateTo( Property(self, mPropertyScrollSpeed), mScrollSpeed, AlphaFunctions::Linear );
-      mScrollSpeedAnimation.Play();
-
       float layoutPositionDelta = GetCurrentLayoutPosition(0) + (mScrollDistance * mActiveLayout->GetScrollSpeedFactor());
 
       float firstItemScrollPosition = ClampFirstItemPosition(layoutPositionDelta, layoutSize, *mActiveLayout);
 
+      float currentOvershoot = mScrollPositionObject.GetProperty<float>(ScrollConnector::OVERSHOOT);
+
       mScrollPositionObject.SetProperty( ScrollConnector::SCROLL_POSITION, firstItemScrollPosition );
       self.SetProperty(mPropertyPosition, GetScrollPosition(firstItemScrollPosition, layoutSize));
-      mScrollStartedSignalV2.Emit(GetCurrentScrollPosition());
 
-      mTotalPanDisplacement += gesture.displacement;
-      mScrollOvershoot = layoutPositionDelta - firstItemScrollPosition;
-      if( mScrollOvershoot > Math::MACHINE_EPSILON_1 )
+      if( (firstItemScrollPosition >= 0.0f && currentOvershoot < 1.0f) || (firstItemScrollPosition <= mActiveLayout->GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), layoutSize) && currentOvershoot > -1.0f) )
       {
-        AnimateScrollOvershoot(1.0f);
-      }
-      else if( mScrollOvershoot < -Math::MACHINE_EPSILON_1 )
-      {
-        AnimateScrollOvershoot(-1.0f);
-      }
-      else
-      {
-        AnimateScrollOvershoot(0.0f);
+        mTotalPanDisplacement += gesture.displacement;
       }
+
+      mScrollOvershoot = CalculateScrollOvershoot();
+      mScrollPositionObject.SetProperty( ScrollConnector::OVERSHOOT, mScrollOvershoot );
     }
     break;
 
@@ -1394,7 +1247,7 @@ bool ItemView::OnAccessibilityPan(PanGesture gesture)
   return true;
 }
 
-Actor ItemView::GetNextKeyboardFocusableActor(Actor actor, Control::KeyboardFocusNavigationDirection direction, bool loopEnabled)
+Actor ItemView::GetNextKeyboardFocusableActor(Actor actor, Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled)
 {
   Actor nextFocusActor;
   if(mActiveLayout)
@@ -1437,12 +1290,6 @@ void ItemView::OnKeyboardFocusChangeCommitted(Actor commitedFocusableActor)
     int nextItemID = GetItemId(commitedFocusableActor);
     float layoutPosition = GetCurrentLayoutPosition(0);
     Vector3 layoutSize = Self().GetCurrentSize();
-    Vector3 focusItemPosition = Vector3::ZERO;
-    ItemLayout::Vector3Function itemPositionConstraint;
-    if (mActiveLayout->GetPositionConstraint(nextItemID, itemPositionConstraint))
-    {
-      focusItemPosition = itemPositionConstraint(Vector3::ZERO, layoutPosition + nextItemID, 0.0f, layoutSize);
-    }
 
     float scrollTo = mActiveLayout->GetClosestOnScreenLayoutPosition(nextItemID, layoutPosition, layoutSize);
     ScrollTo(Vector3(0.0f, scrollTo, 0.0f), DEFAULT_KEYBOARD_FOCUS_SCROLL_DURATION);
@@ -1477,7 +1324,7 @@ void ItemView::OnScrollFinished(Animation& source)
 
   RemoveAnimation(mScrollAnimation); // mScrollAnimation is used to query whether we're scrolling
 
-  mScrollCompletedSignalV2.Emit(GetCurrentScrollPosition());
+  mScrollCompletedSignal.Emit(GetCurrentScrollPosition());
 
   if(mIsFlicking && fabsf(mScrollOvershoot) > Math::MACHINE_EPSILON_1)
   {
@@ -1493,6 +1340,13 @@ void ItemView::OnScrollFinished(Animation& source)
   mScrollOvershoot = 0.0f;
 }
 
+void ItemView::OnLayoutActivationScrollFinished(Animation& source)
+{
+  RemoveAnimation(mScrollAnimation);
+  mRefreshEnabled = true;
+  DoRefresh(GetCurrentLayoutPosition(0), true);
+}
+
 void ItemView::OnOvershootOnFinished(Animation& animation)
 {
   mAnimatingOvershootOn = false;
@@ -1525,7 +1379,8 @@ void ItemView::ScrollToItem(unsigned int itemId, float durationSeconds)
     AnimateScrollOvershoot(0.0f);
   }
 
-  mScrollStartedSignalV2.Emit(GetCurrentScrollPosition());
+  mScrollStartedSignal.Emit(GetCurrentScrollPosition());
+  mRefreshEnabled = true;
 }
 
 void ItemView::RemoveAnimation(Animation& animation)
@@ -1547,41 +1402,32 @@ void ItemView::CalculateDomainSize(const Vector3& layoutSize)
 
   if(mActiveLayout)
   {
-    ItemLayout::Vector3Function firstItemPositionConstraint;
-    if (mActiveLayout->GetPositionConstraint(0, firstItemPositionConstraint))
-    {
-      firstItemPosition = firstItemPositionConstraint(Vector3::ZERO, 0, 0.0f, layoutSize);
-    }
+    firstItemPosition = mActiveLayout->GetItemPosition( 0,0,layoutSize );
 
     float minLayoutPosition = mActiveLayout->GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), layoutSize);
     self.SetProperty(mPropertyMinimumLayoutPosition, minLayoutPosition);
-
-    ItemLayout::Vector3Function lastItemPositionConstraint;
-    if (mActiveLayout->GetPositionConstraint(fabs(minLayoutPosition), lastItemPositionConstraint))
-    {
-      lastItemPosition = lastItemPositionConstraint(Vector3::ZERO, fabs(minLayoutPosition), 0.0f, layoutSize);
-    }
+    lastItemPosition = mActiveLayout->GetItemPosition( fabs(minLayoutPosition),fabs(minLayoutPosition),layoutSize );
 
     float domainSize;
 
     if(IsHorizontal(mActiveLayout->GetOrientation()))
     {
-      self.SetProperty(mPropertyPositionMin, Vector3(0.0f, firstItemPosition.x, 0.0f));
-      self.SetProperty(mPropertyPositionMax, Vector3(0.0f, lastItemPosition.x, 0.0f));
+      self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN, Vector3(0.0f, firstItemPosition.x, 0.0f));
+      self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, Vector3(0.0f, lastItemPosition.x, 0.0f));
       domainSize = fabs(firstItemPosition.x - lastItemPosition.x);
     }
     else
     {
-      self.SetProperty(mPropertyPositionMin, Vector3(0.0f, firstItemPosition.y, 0.0f));
-      self.SetProperty(mPropertyPositionMax, Vector3(0.0f, lastItemPosition.y, 0.0f));
+      self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN, Vector3(0.0f, firstItemPosition.y, 0.0f));
+      self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, Vector3(0.0f, lastItemPosition.y, 0.0f));
       domainSize = fabs(firstItemPosition.y - lastItemPosition.y);
     }
 
     mScrollConnector.SetScrollDomain(minLayoutPosition, 0.0f, domainSize);
 
     bool isLayoutScrollable = IsLayoutScrollable(layoutSize);
-    self.SetProperty(mPropertyCanScrollVertical, isLayoutScrollable);
-    self.SetProperty(mPropertyCanScrollHorizontal, false);
+    self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL, isLayoutScrollable);
+    self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL, false);
   }
 }
 
@@ -1589,8 +1435,8 @@ Vector3 ItemView::GetDomainSize() const
 {
   Actor self = Self();
 
-  float minScrollPosition = self.GetProperty<float>(mPropertyPositionMin);
-  float maxScrollPosition = self.GetProperty<float>(mPropertyPositionMax);
+  float minScrollPosition = self.GetProperty<float>(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN);
+  float maxScrollPosition = self.GetProperty<float>(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX);
 
   return Vector3(0.0f, fabs(maxScrollPosition - minScrollPosition), 0.0f);
 }
@@ -1608,13 +1454,7 @@ bool ItemView::IsLayoutScrollable(const Vector3& layoutSize)
 
 float ItemView::GetScrollPosition(float layoutPosition, const Vector3& layoutSize) const
 {
-  Vector3 firstItemPosition(Vector3::ZERO);
-  ItemLayout::Vector3Function firstItemPositionConstraint;
-  if (mActiveLayout->GetPositionConstraint(0, firstItemPositionConstraint))
-  {
-    firstItemPosition = firstItemPositionConstraint(Vector3::ZERO, layoutPosition, 0.0f, layoutSize);
-  }
-
+  Vector3 firstItemPosition( mActiveLayout->GetItemPosition(0, layoutPosition, layoutSize ) );
   return IsHorizontal(mActiveLayout->GetOrientation()) ? firstItemPosition.x: firstItemPosition.y;
 }
 
@@ -1656,43 +1496,66 @@ void ItemView::ScrollTo(const Vector3& position, float duration)
     AnimateScrollOvershoot(0.0f);
   }
 
-  mScrollStartedSignalV2.Emit(GetCurrentScrollPosition());
+  mScrollStartedSignal.Emit(GetCurrentScrollPosition());
+  mRefreshEnabled = true;
 }
 
-void ItemView::ApplyOvershootOverlayConstraints()
+void ItemView::SetOvershootEffectColor( const Vector4& color )
 {
-  Constraint constraint = Constraint::New<float>( Actor::SIZE_WIDTH,
-                                                    ParentSource( mPropertyScrollDirection ),
-                                                    Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ),
-                                                    ParentSource( Actor::SIZE ),
-                                                    OvershootOverlaySizeConstraint() );
-  mOvershootOverlay.ApplyConstraint(constraint);
-  mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_IMAGE_1_PIXEL_AREA.width, OVERSHOOT_BOUNCE_IMAGE_1_PIXEL_AREA.height);
-
-  constraint = Constraint::New<Quaternion>( Actor::ROTATION,
-                                            ParentSource( mPropertyScrollDirection ),
-                                            Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ),
-                                            OvershootOverlayRotationConstraint() );
-  mOvershootOverlay.ApplyConstraint(constraint);
-
-  constraint = Constraint::New<Vector3>( Actor::POSITION,
-                                         ParentSource( Actor::SIZE ),
-                                         ParentSource( mPropertyScrollDirection ),
-                                         Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ),
-                                         OvershootOverlayPositionConstraint() );
-  mOvershootOverlay.ApplyConstraint(constraint);
-
-  constraint = Constraint::New<bool>( Actor::VISIBLE,
-                                      ParentSource( mPropertyCanScrollVertical ),
-                                      OvershootOverlayVisibilityConstraint() );
-  mOvershootOverlay.ApplyConstraint(constraint);
+  mOvershootEffectColor = color;
+  if( mOvershootOverlay )
+  {
+    mOvershootOverlay.SetColor( color );
+  }
+}
 
-  int effectOvershootPropertyIndex = mOvershootEffect.GetPropertyIndex(mOvershootEffect.GetOvershootPropertyName());
+void ItemView::SetOvershootEnabled( bool enable )
+{
   Actor self = Self();
-  constraint = Constraint::New<float>( effectOvershootPropertyIndex,
-                                       Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ),
-                                       EqualToConstraint() );
-  mOvershootEffect.ApplyConstraint(constraint);
+  if( enable )
+  {
+    Property::Index effectOvershootPropertyIndex = Property::INVALID_INDEX;
+    mOvershootOverlay = CreateBouncingEffectActor( effectOvershootPropertyIndex );
+    mOvershootOverlay.SetColor(mOvershootEffectColor);
+    mOvershootOverlay.SetParentOrigin(ParentOrigin::TOP_LEFT);
+    mOvershootOverlay.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+    mOvershootOverlay.SetDrawMode(DrawMode::OVERLAY);
+    self.Add(mOvershootOverlay);
+
+    Constraint constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::SIZE, OvershootOverlaySizeConstraint );
+    constraint.AddSource( ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+    constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+    constraint.Apply();
+
+    mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height);
+
+    constraint = Constraint::New<Quaternion>( mOvershootOverlay, Actor::Property::ORIENTATION, OvershootOverlayRotationConstraint );
+    constraint.AddSource( ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+    constraint.AddSource( Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ) );
+    constraint.Apply();
+
+    constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::POSITION, OvershootOverlayPositionConstraint );
+    constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+    constraint.AddSource( ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+    constraint.AddSource( Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ) );
+    constraint.Apply();
+
+    constraint = Constraint::New<bool>( mOvershootOverlay, Actor::Property::VISIBLE, OvershootOverlayVisibilityConstraint );
+    constraint.AddSource( ParentSource( Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL ) );
+    constraint.Apply();
+
+    constraint = Constraint::New<float>( mOvershootOverlay, effectOvershootPropertyIndex, EqualToConstraint() );
+    constraint.AddSource( Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ) );
+    constraint.Apply();
+  }
+  else
+  {
+    if( mOvershootOverlay )
+    {
+      self.Remove(mOvershootOverlay);
+      mOvershootOverlay.Reset();
+    }
+  }
 }
 
 float ItemView::CalculateScrollOvershoot()
@@ -1708,11 +1571,11 @@ float ItemView::CalculateScrollOvershoot()
     float positionDelta = GetCurrentLayoutPosition(0) + scrollDistance;
     float minLayoutPosition = mActiveLayout->GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), Self().GetCurrentSize());
     self.SetProperty(mPropertyMinimumLayoutPosition, minLayoutPosition);
-    float clamppedPosition = min(0.0f, max(minLayoutPosition, positionDelta));
+    float clamppedPosition = std::min(0.0f, std::max(minLayoutPosition, positionDelta));
     overshoot = positionDelta - clamppedPosition;
   }
 
-  return overshoot;
+  return overshoot > 0.0f ? std::min(overshoot, 1.0f) : std::max(overshoot, -1.0f);
 }
 
 void ItemView::AnimateScrollOvershoot(float overshootAmount, bool animateBack)
@@ -1728,17 +1591,85 @@ void ItemView::AnimateScrollOvershoot(float overshootAmount, bool animateBack)
     return;
   }
 
-  Actor self = Self();
-  float currentOvershoot = mScrollPositionObject.GetProperty<float>(ScrollConnector::OVERSHOOT);
-  float duration = DEFAULT_OVERSHOOT_ANIMATION_DURATION * (animatingOn ? (1.0f - fabsf(currentOvershoot)) : fabsf(currentOvershoot));
+  if(mOvershootAnimationSpeed > Math::MACHINE_EPSILON_0)
+  {
+    float currentOvershoot = mScrollPositionObject.GetProperty<float>(ScrollConnector::OVERSHOOT);
+    float duration = 0.0f;
 
-  RemoveAnimation(mScrollOvershootAnimation);
-  mScrollOvershootAnimation = Animation::New(duration);
-  mScrollOvershootAnimation.FinishedSignal().Connect(this, &ItemView::OnOvershootOnFinished);
-  mScrollOvershootAnimation.AnimateTo( Property(mScrollPositionObject, ScrollConnector::OVERSHOOT), overshootAmount, TimePeriod(0.0f, duration) );
-  mScrollOvershootAnimation.Play();
+    if (mOvershootOverlay)
+    {
+      duration = mOvershootOverlay.GetCurrentSize().height * (animatingOn ? (1.0f - fabsf(currentOvershoot)) : fabsf(currentOvershoot)) / mOvershootAnimationSpeed;
+    }
+
+    RemoveAnimation(mScrollOvershootAnimation);
+    mScrollOvershootAnimation = Animation::New(duration);
+    mScrollOvershootAnimation.FinishedSignal().Connect(this, &ItemView::OnOvershootOnFinished);
+    mScrollOvershootAnimation.AnimateTo( Property(mScrollPositionObject, ScrollConnector::OVERSHOOT), overshootAmount, TimePeriod(0.0f, duration) );
+    mScrollOvershootAnimation.Play();
+
+    mAnimatingOvershootOn = animatingOn;
+  }
+  else
+  {
+    mScrollPositionObject.SetProperty( ScrollConnector::OVERSHOOT, overshootAmount );
+  }
+}
+
+void ItemView::SetItemsParentOrigin( const Vector3& parentOrigin )
+{
+  if( parentOrigin != mItemsParentOrigin )
+  {
+    mItemsParentOrigin = parentOrigin;
+    for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+    {
+      iter->second.SetParentOrigin(parentOrigin);
+    }
+  }
+}
+
+Vector3 ItemView::GetItemsParentOrigin() const
+{
+  return mItemsParentOrigin;
+}
+
+void ItemView::SetItemsAnchorPoint( const Vector3& anchorPoint )
+{
+  if( anchorPoint != mItemsAnchorPoint )
+  {
+    mItemsAnchorPoint = anchorPoint;
+    for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+    {
+      iter->second.SetAnchorPoint(anchorPoint);
+    }
+  }
+}
+
+Vector3 ItemView::GetItemsAnchorPoint() const
+{
+  return mItemsAnchorPoint;
+}
+
+void ItemView::GetItemsRange(ItemRange& range)
+{
+  if( !mItemPool.empty() )
+  {
+    range.begin = mItemPool.begin()->first;
+    range.end = mItemPool.rbegin()->first + 1;
+  }
+  else
+  {
+    range.begin = 0;
+    range.end = 0;
+  }
+}
+
+void ItemView::OnScrollPositionChanged( float position )
+{
+  // Cancel scroll animation to prevent any fighting of setting the scroll position property.
+  RemoveAnimation(mScrollAnimation);
 
-  mAnimatingOvershootOn = animatingOn;
+  // Refresh the cache immediately when the scroll position is changed.
+  DoRefresh(position, false); // No need to cache extra items.
 }
 
 } // namespace Internal