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