[dali_1.0.15] Merge branch 'tizen'
[platform/core/uifw/dali-core.git] / dali / public-api / animation / constraint-source.h
1 #ifndef __DALI_CONSTRAINT_SOURCE_H__
2 #define __DALI_CONSTRAINT_SOURCE_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/object/handle.h>
23 #include <dali/public-api/object/property.h>
24
25 namespace Dali
26 {
27
28 /**
29  * @brief Constraint source types.
30  *
31  * This specifies the location of a property, which is used as an input for a constraint function.
32  */
33 enum SourceType
34 {
35   OBJECT_PROPERTY, ///< The property comes from an arbitrary object.
36   LOCAL_PROPERTY,  ///< The property comes from the object which the constraint is applied to.
37   PARENT_PROPERTY  ///< The property comes from the parent of the object, which the constraint is applied to.
38 };
39
40
41 /**
42  * @brief Identifies a property from an object.
43  */
44 struct DALI_IMPORT_API LocalSource
45 {
46   /**
47    * @brief Create a local constraint source.
48    *
49    * @param [in] index The index of a property provided by the constrained object.
50    */
51   LocalSource( Property::Index index );
52
53   Property::Index propertyIndex; ///< The index of a property provided by the constrained object.
54 };
55
56 /**
57  * @brief Identifies a property from the parent of an object.
58  */
59 struct DALI_IMPORT_API ParentSource
60 {
61   /**
62    * @brief Create a local constraint source.
63    *
64    * @param [in] index The index of a property, provided by the parent of the constrained object.
65    */
66   ParentSource( Property::Index index );
67
68   Property::Index propertyIndex; ///< The index of a property provided by the parent of the constrained object.
69 };
70
71 /**
72  * @brief Identifies a property from any object.
73  */
74 struct DALI_IMPORT_API Source
75 {
76   /**
77    * @brief Create a constraint source.
78    *
79    * @param [in] object The object providing the property.
80    * @param [in] index The index of a property provided by object.
81    */
82   Source( Handle& object, Property::Index index );
83
84   Property::Index propertyIndex; ///< The index of a property provided by object.
85
86   Handle object; ///< The target object
87 };
88
89 /**
90  * @brief The source of an input property for a constraint.
91  */
92 struct DALI_IMPORT_API ConstraintSource
93 {
94   /**
95    * @brief Create a constraint source.
96    *
97    * @param [in] source A constraint source from an arbitrary object.
98    */
99   ConstraintSource( Source source );
100
101   /**
102    * @brief Create a constraint source.
103    *
104    * @param [in] local A local constraint source.
105    */
106   ConstraintSource( LocalSource local );
107
108   /**
109    * @brief Create a constraint source.
110    *
111    * @param [in] parent A parent constraint source.
112    */
113   ConstraintSource( ParentSource parent );
114
115   SourceType sourceType; ///< The source type
116
117   Property::Index propertyIndex; ///< The index of the source property
118
119   Handle object; ///< The target object; only valid if sourceType == OBJECT_PROPERTY
120 };
121
122 } // namespace Dali
123
124 #endif // __DALI_CONSTRAINT_SOURCE_H__