5bd509a36d80adbf4b184293d97b21b3c7bf1920
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / layouting / layout-transition-data.h
1 #ifndef DALI_TOOLKIT_LAYOUTING_LAYOUT_TRANSITION_DATA_H
2 #define DALI_TOOLKIT_LAYOUTING_LAYOUT_TRANSITION_DATA_H
3 /*
4  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #include <memory>
20 #include <cstdint>
21 #include <dali/public-api/common/dali-common.h>
22 #include <dali/public-api/actors/actor-enumerations.h>
23 #include <dali/public-api/animation/animation.h>
24 #include <dali/public-api/object/base-handle.h>
25 #include <dali/public-api/object/property-index-ranges.h>
26 #include <dali/public-api/object/property-map.h>
27 #include <dali-toolkit/public-api/dali-toolkit-common.h>
28
29 namespace Dali
30 {
31 namespace Toolkit
32 {
33
34 namespace Internal
35 {
36 class LayoutTransitionData;
37 }
38
39 class DALI_TOOLKIT_API LayoutTransitionData final : public BaseHandle
40 {
41 public:
42
43   /**
44    * @brief Enumeration for property animator keys belonging to the LayoutTransitionData class.
45    */
46   struct AnimatorKey
47   {
48     enum Type
49     {
50       PROPERTY,           ///< A property to animate
51       INITIAL_VALUE,      ///< Initial value of an animated property
52       TARGET_VALUE,       ///< Target value of an animated property
53       ANIMATOR,           ///< Animator for an animated property
54       TYPE,               ///< Type of an animator
55       NAME,               ///< Name of an animator
56       TIME_PERIOD,        ///< Time period of an property animation
57       DURATION,           ///< Duration of an property animation
58       DELAY,              ///< Delay of an property animation
59       ALPHA_FUNCTION,     ///< Alpha function of a property animation
60     };
61   };
62
63   enum LayoutTransitionType
64   {
65     ON_CHILD_ADD,
66     ON_CHILD_REMOVE,
67     ON_OWNER_SET
68   };
69
70   typedef Signal< void (LayoutTransitionData::LayoutTransitionType, LayoutTransitionData&) > LayoutTransitionSignalType; ///< Transition finished signal
71
72   /**
73    * Create an uninitialized handle
74    *
75    * @SINCE_1_2.12
76    */
77   LayoutTransitionData();
78
79   /**
80    * Destructor - non virtual
81    *
82    * @SINCE_1_2.12
83    */
84   ~LayoutTransitionData() = default;
85
86   /**
87    * Create an initialized LayoutTransitionData
88    */
89   static LayoutTransitionData New();
90
91   /**
92    * @brief Downcasts a handle to LayoutTransitionData handle.
93    *
94    * If handle points to an LayoutTransitionData object, the downcast produces valid handle.
95    * If not, the returned handle is left uninitialized.
96    *
97    * @param[in] handle Handle to an object
98    * @return Handle to an LayoutTransitionData object or an uninitialized handle
99    */
100   static LayoutTransitionData DownCast( BaseHandle handle );
101
102   /**
103    * @brief Add a property animator for an actor
104    *
105    * @param[in] actor An owner of the animated property
106    * @param[in] map The animated property map including animator map
107    */
108   void AddPropertyAnimator( Actor actor, Property::Map map );
109
110   /**
111    * @brief Add a property animator for an actor
112    *
113    * @param[in] actor An owner of the animated property
114    * @param[in] map The properties map
115    * @param[in] keyFrames key frames
116    * @param[in] interpolation An interpolation
117    */
118   void AddPropertyAnimator( Actor actor, Property::Map map, KeyFrames keyFrames, Animation::Interpolation interpolation );
119
120   /**
121    * @brief Add a property animator for an actor
122    *
123    * @param[in] actor An owner of the animated property
124    * @param[in] map A properties map
125    * @param[in] path An animation path
126    * @param[in] forward A forward vector for the path
127    */
128   void AddPropertyAnimator( Actor actor, Property::Map map, Path path, Vector3 forward );
129
130   /**
131     * @brief Connects to this signal to be notified when a transition animation have finished.
132     *
133     * @return A signal object to connect with
134     */
135   LayoutTransitionSignalType& FinishedSignal();
136
137 public:
138   /// @cond internal
139   /**
140    * @brief This constructor is used by LayoutTransitionData::New() method.
141    *
142    * @param[in] layoutTransitonData A pointer to a newly allocated transition data resource
143    */
144   DALI_INTERNAL explicit LayoutTransitionData( Internal::LayoutTransitionData* layoutTransitonData );
145   /// @endcond
146 };
147
148 }//namespace Toolkit
149 }//namespace Dali
150
151 #endif // DALI_TOOLKIT_LAYOUTING_LAYOUT_TRANSITION_DATA_H