Merge remote-tracking branch 'origin/tizen' into new_text
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / scrollable / item-view / spiral-layout.cpp
index fd142f1..07b5a78 100644 (file)
@@ -1,26 +1,29 @@
-//
-// 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/public-api/controls/scrollable/item-view/spiral-layout.h>
 
+// EXTERNAL INCLUDES
 #include <algorithm>
-
-#include <dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.h>
+#include <dali/public-api/animation/animation.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
-using namespace std;
 
 namespace // unnamed namespace
 {
@@ -368,7 +371,7 @@ void SpiralLayout::SetItemSpacing(Radian itemSpacing)
 {
   mImpl->mItemSpacingRadians = itemSpacing;
 
-  float itemsPerSpiral = max(1.0f, (2.0f*(float)Math::PI) / mImpl->mItemSpacingRadians);
+  float itemsPerSpiral = std::max(1.0f, (2.0f*(float)Math::PI) / mImpl->mItemSpacingRadians);
   mImpl->mItemDescent = mImpl->mRevolutionDistance / itemsPerSpiral;
 }
 
@@ -381,7 +384,7 @@ void SpiralLayout::SetRevolutionDistance(float distance)
 {
   mImpl->mRevolutionDistance = distance;
 
-  float itemsPerSpiral = max(1.0f, (2.0f*(float)Math::PI) / mImpl->mItemSpacingRadians);
+  float itemsPerSpiral = std::max(1.0f, (2.0f*(float)Math::PI) / mImpl->mItemSpacingRadians);
   mImpl->mItemDescent = mImpl->mRevolutionDistance / itemsPerSpiral;
 }
 
@@ -460,10 +463,10 @@ ItemRange SpiralLayout::GetItemsWithinArea(float firstItemPosition, Vector3 layo
   float layoutHeight = IsHorizontal(mOrientation) ? layoutSize.width : layoutSize.height;
   float itemsPerSpiral = layoutHeight / mImpl->mItemDescent;
   float itemsCachedBeforeTopItem = layoutHeight * (mImpl->mTopItemAlignment + 0.5f) / mImpl->mItemDescent;
-  float itemsViewable = min(itemsPerSpiral, itemsPerSpiral - itemsCachedBeforeTopItem - firstItemPosition + 1.0f);
+  float itemsViewable = std::min(itemsPerSpiral, itemsPerSpiral - itemsCachedBeforeTopItem - firstItemPosition + 1.0f);
 
-  unsigned int firstItem = static_cast<unsigned int>(max(0.0f, -firstItemPosition - itemsCachedBeforeTopItem - 1.0f));
-  unsigned int lastItem  = static_cast<unsigned int>(max(0.0f, firstItem + itemsViewable));
+  unsigned int firstItem = static_cast<unsigned int>(std::max(0.0f, -firstItemPosition - itemsCachedBeforeTopItem - 1.0f));
+  unsigned int lastItem  = static_cast<unsigned int>(std::max(0.0f, firstItem + itemsViewable));
 
   return ItemRange(firstItem, lastItem+1);
 }
@@ -486,7 +489,7 @@ void SpiralLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3
 {
   if(animation)
   {
-    animation.Resize(actor, size);
+    animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size );
   }
 }