Merge "DALi Version 1.2.11" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / visual-factory / transition-data.h
1 #ifndef __DALI_TOOLKIT_TRANSITION_DATA_H__
2 #define __DALI_TOOLKIT_TRANSITION_DATA_H__
3
4 /*
5  * Copyright (c) 2016 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 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-handle.h>
23 #include <dali/public-api/animation/alpha-function.h>
24 #include <dali/public-api/object/property-array.h>
25 #include <dali/public-api/object/property-map.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Internal
34 {
35 class TransitionData;
36 }
37
38 /**
39  * @brief This object translates data from a property array of maps
40  * into an array of animators.
41  *
42  * Each animator describes a named object and a named property of that object
43  * to be animated. Internally, these are translated into object instances and
44  * property indices to be animated.
45  * @see Dali::Toolkit::Internal::Control::CreateTransition()
46  *
47  * The animators can each be retrieved as a Property::Map by using Count() and
48  * GetAnimatorAt().
49  *
50  * In psuedo-JSON, the property array can be represented as follows:
51  *
52  * [
53  *   {
54  *     "target": "objectName",
55  *     "property": "propertyKey",
56  *     "initialValue": <value>,  # The property value can be one of several types
57  *     "targetValue":  <value>,
58  *     "animator": {
59  *       "alphaFunction":<easing-function>",
60  *       "timePeriod":{
61  *         "duration": 1.0,
62  *         "delay":    0.0
63  *       }
64  *     }
65  *   },
66  *   # more animators
67  * ]
68  *
69  */
70 class DALI_IMPORT_API TransitionData : public BaseHandle
71 {
72 public:
73   /**
74    * Create an uninitialized handle
75    *
76    * @SINCE_1_2.12
77    */
78   TransitionData();
79
80   /**
81    * Destructor - non virtual
82    *
83    * @SINCE_1_2.12
84    */
85   ~TransitionData();
86
87   /**
88    * @brief Creates a TransitionData object
89    *
90    * @SINCE_1_2.12
91    * @param[in] transition The transition data to store (a single animator)
92    * @return A handle to an initialized data.
93    */
94   static TransitionData New( const Property::Map& transition );
95
96   /**
97    * @brief Creates a TransitionData object
98    *
99    * @SINCE_1_2.12
100    * @param[in] transition The transition data to store (an array of maps of animators)
101    * @return A handle to an initialized data.
102    */
103   static TransitionData New( const Property::Array& transition );
104
105   /**
106    * @brief Downcast to a TransitionData handle
107    *
108    * @SINCE_1_2.12
109    * If handle is not a TransitionData, the returned handle is left uninitialized.
110    * @param[in] handle Handle to an object
111    * @return TransitionData handle or an uninitialized handle.
112    */
113   static TransitionData DownCast( BaseHandle handle );
114
115   /**
116    * @brief Copy constructor
117    *
118    * @SINCE_1_2.12
119    * @param[in] handle Handle to an object
120    */
121   TransitionData( const TransitionData& handle );
122
123   /**
124    * @brief Assignment Operator
125    *
126    * @SINCE_1_2.12
127    * @param[in] handle Handle to an object
128    * @return A reference to this object.
129    */
130   TransitionData& operator=( const TransitionData& handle );
131
132   /**
133    * @brief returns the count of the individual property transitions
134    * stored within this handle.
135    *
136    * @SINCE_1_2.12
137    * @return The count of individual transitions
138    */
139   size_t Count() const;
140
141   /**
142    * @brief Return the animator at the given index as a property map.
143    * @param[in] index The index of the animator ( Must be less than Count() )
144    * @return A property map representing the animator
145    */
146   Property::Map GetAnimatorAt( size_t index );
147
148 public: // Not intended for application developers
149
150   explicit DALI_INTERNAL TransitionData( Internal::TransitionData *impl );
151 };
152
153 } // namespace Toolkit
154 } // namespace Dali
155
156 #endif // __DALI_TOOLKIT_TRANSITION_DATA_H__