[Tizen] Add codes for Dali Windows Backend
[platform/core/uifw/dali-core.git] / dali / public-api / object / property-conditions.cpp
index 1bfc175..a538a12 100644 (file)
@@ -1,18 +1,19 @@
-//
-// 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) 2015 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/public-api/object/property-conditions.h>
@@ -35,75 +36,92 @@ PropertyCondition::~PropertyCondition()
 
 }
 
-PropertyCondition::ArgumentContainer PropertyCondition::GetArguments()
+PropertyCondition::PropertyCondition( const PropertyCondition& handle )
+: BaseHandle(handle)
 {
-  return GetImplementation(*this).arguments;
 }
 
-const PropertyCondition::ArgumentContainer& PropertyCondition::GetArguments() const
+PropertyCondition& PropertyCondition::operator=( const PropertyCondition& rhs )
 {
-  return GetImplementation(*this).arguments;
+  BaseHandle::operator=(rhs);
+  return *this;
 }
 
-PropertyCondition LessThanCondition(float arg)
+std::size_t PropertyCondition::GetArgumentCount() const
+{
+  return GetImplementation(*this).arguments.Count();
+}
+
+float PropertyCondition::GetArgument( std::size_t index ) const
+{
+  return GetImplementation(*this).arguments[ index ];
+}
+
+PropertyCondition LessThanCondition( float arg )
 {
   PropertyCondition condition;
-  GetImplementation(condition).type = Internal::PropertyCondition::LessThan;
-  GetImplementation(condition).arguments.push_back(Property::Value(arg));
+  Internal::PropertyCondition& impl = GetImplementation( condition );
+  impl.type = Internal::PropertyCondition::LessThan;
+  impl.arguments.PushBack( arg );
 
   return condition;
 }
 
-PropertyCondition GreaterThanCondition(float arg)
+PropertyCondition GreaterThanCondition( float arg )
 {
   PropertyCondition condition;
-  GetImplementation(condition).type = Internal::PropertyCondition::GreaterThan;
-  GetImplementation(condition).arguments.push_back(Property::Value(arg));
+  Internal::PropertyCondition& impl = GetImplementation( condition );
+  impl.type = Internal::PropertyCondition::GreaterThan;
+  impl.arguments.PushBack( arg );
 
   return condition;
 }
 
-PropertyCondition InsideCondition(float arg0, float arg1)
+PropertyCondition InsideCondition( float arg0, float arg1 )
 {
   PropertyCondition condition;
-  GetImplementation(condition).type = Internal::PropertyCondition::Inside;
-  GetImplementation(condition).arguments.push_back(Property::Value(arg0));
-  GetImplementation(condition).arguments.push_back(Property::Value(arg1));
+  Internal::PropertyCondition& impl = GetImplementation( condition );
+  impl.type = Internal::PropertyCondition::Inside;
+  impl.arguments.PushBack( arg0 );
+  impl.arguments.PushBack( arg1 );
 
   return condition;
 }
 
-PropertyCondition OutsideCondition(float arg0, float arg1)
+PropertyCondition OutsideCondition( float arg0, float arg1 )
 {
   PropertyCondition condition;
-  GetImplementation(condition).type = Internal::PropertyCondition::Outside;
-  GetImplementation(condition).arguments.push_back(Property::Value(arg0));
-  GetImplementation(condition).arguments.push_back(Property::Value(arg1));
+  Internal::PropertyCondition& impl = GetImplementation( condition );
+  impl.type = Internal::PropertyCondition::Outside;
+  impl.arguments.PushBack( arg0 );
+  impl.arguments.PushBack( arg1 );
 
   return condition;
 }
 
-PropertyCondition StepCondition(float stepAmount, float referenceValue)
+PropertyCondition StepCondition( float stepAmount, float referenceValue )
 {
   PropertyCondition condition;
-  GetImplementation(condition).type = Internal::PropertyCondition::Step;
-  GetImplementation(condition).arguments.push_back(Property::Value(referenceValue));
-  GetImplementation(condition).arguments.push_back(Property::Value(1.0f / stepAmount));
-  GetImplementation(condition).arguments.push_back(Property::Value(0.0f)); // current step
+  Internal::PropertyCondition& impl = GetImplementation( condition );
+  impl.type = Internal::PropertyCondition::Step;
+  impl.arguments.PushBack( referenceValue );
+  impl.arguments.PushBack( 1.0f / stepAmount );
+  impl.arguments.PushBack( 0.0f ); // current step
 
   return condition;
 }
 
-PropertyCondition VariableStepCondition(const std::vector<float>& stepAmount)
+PropertyCondition VariableStepCondition( const Dali::Vector<float>& stepAmount )
 {
   PropertyCondition condition;
-  GetImplementation(condition).type = Internal::PropertyCondition::VariableStep;
-  GetImplementation(condition).arguments.push_back(Property::Value(0.0f)); // current step
-  int size = stepAmount.size();
-  GetImplementation(condition).arguments.push_back(Property::Value(static_cast<float>(size))); // store number of steps
-  for( std::vector<float>::const_iterator it = stepAmount.begin(), endIt = stepAmount.end(); it != endIt; ++it )
+  Internal::PropertyCondition& impl = GetImplementation( condition );
+  impl.type = Internal::PropertyCondition::VariableStep;
+  impl.arguments.PushBack( 0.0f ); // current step
+  Dali::Vector<float>::SizeType count = stepAmount.Count();
+  impl.arguments.PushBack( float( count ) ); // store number of steps
+  for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
   {
-    GetImplementation(condition).arguments.push_back(Property::Value( *it ));
+    impl.arguments.PushBack( stepAmount[index] );
   }
 
   return condition;