Merge "Added generic signal binding for toolkit controls in JavaScript" into devel...
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 12 Nov 2015 17:18:38 +0000 (09:18 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 12 Nov 2015 17:18:39 +0000 (09:18 -0800)
dali-toolkit/devel-api/shader-effects/dissolve-effect.h
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp

index f97f4f4..4953e4d 100644 (file)
 #include <string.h>
 #include <dali/devel-api/rendering/shader.h>
 
-namespace
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+/**
+ * @brief Only registers the required property if it has not registered it before.
+ *
+ * @tparam  T  The type of the property.
+ *
+ * @param[in]  actor  The actor to register the property with.
+ * @param[in]  name   The name of the property.
+ * @param[in]  value  The value the property should be set to.
+ */
+template < typename T>
+DALI_INTERNAL void SafeSetCustomProperty( Dali::Actor& actor, const std::string& name, const T& value )
 {
-  template < typename T>
-  void SafeSetCustomProperty( Dali::Actor& actor, const std::string& name, const T& value )
+  Dali::Property::Index index = actor.GetPropertyIndex( name );
+  if ( Dali::Property::INVALID_INDEX == index )
   {
-    Dali::Property::Index index = actor.GetPropertyIndex( name );
-    if ( Dali::Property::INVALID_INDEX == index )
-    {
-      index = actor.RegisterProperty( name, value );
-    }
-    else
-    {
-      actor.SetProperty( index, value );
-    }
+    index = actor.RegisterProperty( name, value );
   }
-
-  template < typename T>
-  void SafeSetCustomProperty( Dali::Actor& actor, const std::string& name, const T& value, Dali::Property::AccessMode accessMode )
+  else
   {
-    Dali::Property::Index index = actor.GetPropertyIndex( name );
-    if ( Dali::Property::INVALID_INDEX == index )
-    {
-      index = actor.RegisterProperty( name, value, accessMode );
-    }
-    else
-    {
-      actor.SetProperty( index, value );
-    }
+    actor.SetProperty( index, value );
   }
+}
 
-};
-
-namespace Dali
-{
-
-namespace Toolkit
+/**
+ * @brief Only registers the required property if it has not registered it before.
+ *
+ * @tparam  T  The type of the property.
+ *
+ * @param[in]  actor       The actor to register the property with.
+ * @param[in]  name        The name of the property.
+ * @param[in]  value       The value the property should be set to.
+ * @param[in]  accessMode  The accessMode required for the property.
+ */
+template < typename T>
+DALI_INTERNAL void SafeSetCustomProperty( Dali::Actor& actor, const std::string& name, const T& value, Dali::Property::AccessMode accessMode )
 {
+  Dali::Property::Index index = actor.GetPropertyIndex( name );
+  if ( Dali::Property::INVALID_INDEX == index )
+  {
+    index = actor.RegisterProperty( name, value, accessMode );
+  }
+  else
+  {
+    actor.SetProperty( index, value );
+  }
+}
 
 /**
  * @brief Set the dissolve central line.
index dc52940..aa6443d 100644 (file)
@@ -1514,42 +1514,45 @@ void ItemView::EnableScrollOvershoot( bool enable )
   Actor self = Self();
   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_2D );
-    self.Add(mOvershootOverlay);
-
-    Constraint constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::SIZE, OvershootOverlaySizeConstraint(mOvershootSize.height) );
-    constraint.AddSource( ParentSource( Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
-    constraint.AddSource( ParentSource( Toolkit::ItemView::Property::LAYOUT_ORIENTATION ) );
-    constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
-    constraint.Apply();
-
-    mOvershootOverlay.SetSize(mOvershootSize.width, mOvershootSize.height);
-
-    constraint = Constraint::New<Quaternion>( mOvershootOverlay, Actor::Property::ORIENTATION, OvershootOverlayRotationConstraint );
-    constraint.AddSource( ParentSource( Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
-    constraint.AddSource( ParentSource( Toolkit::ItemView::Property::LAYOUT_ORIENTATION ) );
-    constraint.AddSource( ParentSource( Toolkit::ItemView::Property::OVERSHOOT ) );
-    constraint.Apply();
-
-    constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::POSITION, OvershootOverlayPositionConstraint );
-    constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
-    constraint.AddSource( ParentSource( Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
-    constraint.AddSource( ParentSource( Toolkit::ItemView::Property::LAYOUT_ORIENTATION ) );
-    constraint.AddSource( ParentSource( Toolkit::ItemView::Property::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( ParentSource( Toolkit::ItemView::Property::OVERSHOOT ) );
-    constraint.Apply();
+    if( !mOvershootOverlay )
+    {
+      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_2D );
+      self.Add(mOvershootOverlay);
+
+      Constraint constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::SIZE, OvershootOverlaySizeConstraint(mOvershootSize.height) );
+      constraint.AddSource( ParentSource( Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
+      constraint.AddSource( ParentSource( Toolkit::ItemView::Property::LAYOUT_ORIENTATION ) );
+      constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+      constraint.Apply();
+
+      mOvershootOverlay.SetSize(mOvershootSize.width, mOvershootSize.height);
+
+      constraint = Constraint::New<Quaternion>( mOvershootOverlay, Actor::Property::ORIENTATION, OvershootOverlayRotationConstraint );
+      constraint.AddSource( ParentSource( Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
+      constraint.AddSource( ParentSource( Toolkit::ItemView::Property::LAYOUT_ORIENTATION ) );
+      constraint.AddSource( ParentSource( Toolkit::ItemView::Property::OVERSHOOT ) );
+      constraint.Apply();
+
+      constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::POSITION, OvershootOverlayPositionConstraint );
+      constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+      constraint.AddSource( ParentSource( Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
+      constraint.AddSource( ParentSource( Toolkit::ItemView::Property::LAYOUT_ORIENTATION ) );
+      constraint.AddSource( ParentSource( Toolkit::ItemView::Property::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( ParentSource( Toolkit::ItemView::Property::OVERSHOOT ) );
+      constraint.Apply();
+    }
   }
   else
   {