2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/public-api/object/property-conditions.h>
22 #include <dali/public-api/object/property-value.h>
23 #include <dali/internal/event/common/property-conditions-impl.h>
28 PropertyCondition::PropertyCondition()
29 : BaseHandle(new Internal::PropertyCondition())
34 PropertyCondition::~PropertyCondition()
39 PropertyCondition::ArgumentContainer PropertyCondition::GetArguments()
41 return GetImplementation(*this).arguments;
44 const PropertyCondition::ArgumentContainer& PropertyCondition::GetArguments() const
46 return GetImplementation(*this).arguments;
49 PropertyCondition LessThanCondition(float arg)
51 PropertyCondition condition;
52 GetImplementation(condition).type = Internal::PropertyCondition::LessThan;
53 GetImplementation(condition).arguments.push_back(Property::Value(arg));
58 PropertyCondition GreaterThanCondition(float arg)
60 PropertyCondition condition;
61 GetImplementation(condition).type = Internal::PropertyCondition::GreaterThan;
62 GetImplementation(condition).arguments.push_back(Property::Value(arg));
67 PropertyCondition InsideCondition(float arg0, float arg1)
69 PropertyCondition condition;
70 GetImplementation(condition).type = Internal::PropertyCondition::Inside;
71 GetImplementation(condition).arguments.push_back(Property::Value(arg0));
72 GetImplementation(condition).arguments.push_back(Property::Value(arg1));
77 PropertyCondition OutsideCondition(float arg0, float arg1)
79 PropertyCondition condition;
80 GetImplementation(condition).type = Internal::PropertyCondition::Outside;
81 GetImplementation(condition).arguments.push_back(Property::Value(arg0));
82 GetImplementation(condition).arguments.push_back(Property::Value(arg1));
87 PropertyCondition StepCondition(float stepAmount, float referenceValue)
89 PropertyCondition condition;
90 GetImplementation(condition).type = Internal::PropertyCondition::Step;
91 GetImplementation(condition).arguments.push_back(Property::Value(referenceValue));
92 GetImplementation(condition).arguments.push_back(Property::Value(1.0f / stepAmount));
93 GetImplementation(condition).arguments.push_back(Property::Value(0.0f)); // current step
98 PropertyCondition VariableStepCondition(const std::vector<float>& stepAmount)
100 PropertyCondition condition;
101 GetImplementation(condition).type = Internal::PropertyCondition::VariableStep;
102 GetImplementation(condition).arguments.push_back(Property::Value(0.0f)); // current step
103 int size = stepAmount.size();
104 GetImplementation(condition).arguments.push_back(Property::Value(static_cast<float>(size))); // store number of steps
105 for( std::vector<float>::const_iterator it = stepAmount.begin(), endIt = stepAmount.end(); it != endIt; ++it )
107 GetImplementation(condition).arguments.push_back(Property::Value( *it ));