1 #ifndef DALI_TOOLKIT_LAYOUTING_LAYOUT_TRANSITION_DATA_H
2 #define DALI_TOOLKIT_LAYOUTING_LAYOUT_TRANSITION_DATA_H
4 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
36 class LayoutTransitionData;
40 * @brief The LayoutTransitionData class to collect the actors properties animators for layout transitions.
42 class DALI_TOOLKIT_API LayoutTransitionData final : public BaseHandle
47 * @brief Enumeration for property animator keys belonging to the LayoutTransitionData class.
53 CONDITION, ///< A condition triggering the transition animation (the actor is added/removed/focus gained/focus lost)
54 PROPERTY, ///< A property to animate
55 INITIAL_VALUE, ///< Initial value of an animated property
56 TARGET_VALUE, ///< Target value of an animated property
57 ANIMATOR, ///< Animator for an animated property
58 TYPE, ///< Type of an animator
59 NAME, ///< Name of an animator
60 TIME_PERIOD, ///< Time period of an property animation
61 DURATION, ///< Duration of an property animation
62 DELAY, ///< Delay of an property animation
63 ALPHA_FUNCTION, ///< Alpha function of a property animation
64 AFFECTS_SIBLINGS, ///< Might change the actor siblings positions etc by updating the actor measured size if the actor size is changed due to the animation. False by default.
72 ANIMATE_TO, ///< Animate to property target value
73 ANIMATE_BY, ///< Animate by property target value
74 ANIMATE_BETWEEN, ///< Animate between property initial and target values
75 ANIMATE_PATH ///< Animate using the animation path
83 NONE, ///< Default, no conditions to animate property. The property is animated for all relevant animations related to a control
84 ON_ADD, ///< A condition to animate property when a control is added to the container
85 ON_REMOVE, ///< A condition to animate property when a control is removed from the container
86 ON_FOCUS_GAINED, ///< A condition to animate property when a control focus is gained
87 ON_FOCUS_LOST, ///< A condition to animate property when a control focus is lost
93 // Children related transitions
94 ON_CHILD_ADD, ///< A transition is triggered when a control is added to the container
95 ON_CHILD_REMOVE, ///< A transition is triggered when a control is removed from the container
96 ON_CHILD_FOCUS, ///< A transition is triggered when a control focus is changed in the container
97 // Layout related transitions
98 ON_OWNER_SET, ///< A transition is triggered when a layout is set to a new container
99 ON_LAYOUT_CHANGE, ///< A transition is triggered when a layout geometry is changed
102 typedef Signal< void (LayoutTransitionData::Type, LayoutTransitionData&) > LayoutTransitionSignalType; ///< Transition finished signal
105 * Create an uninitialized handle
109 LayoutTransitionData();
112 * Destructor - non virtual
116 ~LayoutTransitionData() = default;
119 * Create an initialized LayoutTransitionData
121 static LayoutTransitionData New();
124 * @brief Downcasts a handle to LayoutTransitionData handle.
126 * If handle points to an LayoutTransitionData object, the downcast produces valid handle.
127 * If not, the returned handle is left uninitialized.
129 * @param[in] handle Handle to an object
130 * @return Handle to an LayoutTransitionData object or an uninitialized handle
132 static LayoutTransitionData DownCast( BaseHandle handle );
135 * @brief Add a property animator for an actor
137 * @param[in] actor An owner of the animated property.
138 * If actor is empty then the property animator is generic and apply to all children excluding the parent if the condition is met.
139 * @param[in] map The animated property map including animator map
141 void AddPropertyAnimator( Actor actor, Property::Map map );
144 * @brief Add a property animator for an actor
146 * @param[in] actor An owner of the animated property
147 * If actor is empty then the property animator is generic and apply to all children excluding the parent if the condition is met.
148 * @param[in] map The properties map
149 * @param[in] keyFrames key frames
150 * @param[in] interpolation An interpolation
152 void AddPropertyAnimator( Actor actor, Property::Map map, KeyFrames keyFrames, Animation::Interpolation interpolation );
155 * @brief Add a property animator for an actor
157 * @param[in] actor An owner of the animated property
158 * If actor is empty then the property animator is generic and apply to all children excluding the parent if the condition is met.
159 * @param[in] map A properties map
160 * @param[in] path An animation path
161 * @param[in] forward A forward vector for the path
163 void AddPropertyAnimator( Actor actor, Property::Map map, Path path, Vector3 forward );
166 * @brief Connects to this signal to be notified when a transition animation have finished.
168 * @return A signal object to connect with
170 LayoutTransitionSignalType& FinishedSignal();
175 * @brief This constructor is used by LayoutTransitionData::New() method.
177 * @param[in] layoutTransitonData A pointer to a newly allocated transition data resource
179 DALI_INTERNAL explicit LayoutTransitionData( Internal::LayoutTransitionData* layoutTransitonData );
186 #endif // DALI_TOOLKIT_LAYOUTING_LAYOUT_TRANSITION_DATA_H