1 #ifndef DALI_CONSTRAINT_SOURCE_H
2 #define DALI_CONSTRAINT_SOURCE_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/handle.h>
23 #include <dali/public-api/object/property.h>
28 * @addtogroup dali_core_animation
33 * @brief Enumeration for constraint source types.
35 * This specifies the location of a property, which is used as an input for a constraint function.
40 OBJECT_PROPERTY, ///< The property comes from an arbitrary object. @SINCE_1_0.0
41 LOCAL_PROPERTY, ///< The property comes from the object which the constraint is applied to. @SINCE_1_0.0
42 PARENT_PROPERTY ///< The property comes from the parent of the object, which the constraint is applied to. @SINCE_1_0.0
46 * @brief Identifies a property from an object.
49 struct DALI_CORE_API LocalSource
52 * @brief Creates a local constraint source.
55 * @param[in] index The index of a property provided by the constrained object
57 LocalSource(Property::Index index);
59 Property::Index propertyIndex; ///< The index of a property provided by the constrained object.
63 * @brief Identifies a property from the parent of an object.
66 struct DALI_CORE_API ParentSource
69 * @brief Creates a parent constraint source.
72 * @param[in] index The index of a property, provided by the parent of the constrained object
74 ParentSource(Property::Index index);
76 Property::Index propertyIndex; ///< The index of a property provided by the parent of the constrained object.
80 * @brief Identifies a property from any object.
83 struct DALI_CORE_API Source
86 * @brief Creates a constraint source.
89 * @param[in] object The object providing the property
90 * @param[in] index The index of a property provided by object
92 Source(Handle& object, Property::Index index);
94 Property::Index propertyIndex; ///< The index of a property provided by object.
96 Handle object; ///< The target object
100 * @brief The source of an input property for a constraint.
103 struct DALI_CORE_API ConstraintSource
106 * @brief Creates a constraint source.
109 * @param[in] source A constraint source from an arbitrary object
111 ConstraintSource(Source source);
114 * @brief Creates a constraint source.
117 * @param[in] local A local constraint source
119 ConstraintSource(LocalSource local);
122 * @brief Creates a constraint source.
125 * @param[in] parent A parent constraint source
127 ConstraintSource(ParentSource parent);
129 SourceType sourceType; ///< The source type
131 Property::Index propertyIndex; ///< The index of the source property
133 Handle object; ///< The target object; only valid if sourceType == OBJECT_PROPERTY
141 #endif // DALI_CONSTRAINT_SOURCE_H