Property refactor in dali-core: Toolkit changes for compiling
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-view-cube-effect-impl.cpp
index f0c6f7a..d50ffb9 100644 (file)
@@ -1,22 +1,27 @@
-//
-// 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.
+ *
+ */
 
 // EXTERNAL INCLUDES
 #include <boost/bind.hpp>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-input.h>
 
+// INTERNAL INCLUDES
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.h>
 
@@ -43,7 +48,7 @@ namespace // unnamed namespace
  * When at middle of the screen the position is not altered.
  * When one screen away from middle the position is rotated about it's origin + mAnchor
  */
-class ScrollCubeEffectInfo : public Dali::RefObject
+class ScrollCubeEffectInfo
 {
 public:
 
@@ -284,8 +289,6 @@ public:
   Vector3 mPositionSwing;                                 ///< Maximum amount in X and Y axes to alter position.
 };
 
-typedef IntrusivePtr<ScrollCubeEffectInfo> ScrollCubeEffectInfoPtr;
-
 /**
  * Helper: Applies the 3D scroll cube constraints to the child actor
  *
@@ -296,40 +299,40 @@ typedef IntrusivePtr<ScrollCubeEffectInfo> ScrollCubeEffectInfoPtr;
 void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView,
                                 Actor child,
                                 Actor parentPage,
-                                ScrollCubeEffectInfoPtr info)
+                                const ScrollCubeEffectInfo& info)
 {
   // Apply constraints to this actor //
   Constraint constraint;
-  constraint = Constraint::New<Quaternion>( Actor::ROTATION,
-                                         Source(parentPage, Actor::POSITION),
+  constraint = Constraint::New<Quaternion>( Actor::Property::Rotation,
+                                         Source(parentPage, Actor::Property::Position),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ),
-                                         Source(scrollView, Actor::SIZE ),
+                                         Source(scrollView, Actor::Property::Size ),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ),
                                          boost::bind( &ScrollCubeEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
 
   constraint.SetRemoveAction( Constraint::Discard );
   child.ApplyConstraint( constraint );
 
-  constraint = Constraint::New<Vector4>( Actor::COLOR,
-                                         Source(parentPage, Actor::POSITION),
+  constraint = Constraint::New<Vector4>( Actor::Property::Color,
+                                         Source(parentPage, Actor::Property::Position),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ),
-                                         Source(scrollView, Actor::SIZE ),
+                                         Source(scrollView, Actor::Property::Size ),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ),
                                          boost::bind( &ScrollCubeEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
 
   constraint.SetRemoveAction( Constraint::Discard );
   child.ApplyConstraint( constraint );
 
-  constraint = Constraint::New<Vector3>( Actor::POSITION,
-                                         Source(parentPage, Actor::POSITION),
+  constraint = Constraint::New<Vector3>( Actor::Property::Position,
+                                         Source(parentPage, Actor::Property::Position),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ),
-                                         Source(scrollView, Actor::SIZE ),
+                                         Source(scrollView, Actor::Property::Size ),
                                          Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ),
                                          boost::bind( &ScrollCubeEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
 
@@ -362,7 +365,7 @@ void ScrollViewCubeEffect::ApplyToActor(Actor child,
                                         const Vector2& angleSwing,
                                         const Vector2& positionSwing)
 {
-  ScrollCubeEffectInfoPtr info(new ScrollCubeEffectInfo(anchor, angleSwing, positionSwing));
+  ScrollCubeEffectInfo info( anchor, angleSwing, positionSwing );
 
   ApplyScrollCubeConstraints( GetScrollView(), child, child.GetParent(), info );
 }
@@ -373,7 +376,7 @@ void ScrollViewCubeEffect::ApplyToActor(Actor child,
                                         const Vector2& angleSwing,
                                         const Vector2& positionSwing)
 {
-  ScrollCubeEffectInfoPtr info(new ScrollCubeEffectInfo(anchor, angleSwing, positionSwing));
+  ScrollCubeEffectInfo info( anchor, angleSwing, positionSwing );
 
   ApplyScrollCubeConstraints( GetScrollView(), child, parentPage, info );
 }