1 #ifndef DALI_TOOLKIT_TRANSITION_SET_H
2 #define DALI_TOOLKIT_TRANSITION_SET_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali-toolkit/public-api/transition/transition-base.h>
25 #include <dali/public-api/object/handle.h>
26 #include <dali/public-api/signals/dali-signal.h>
27 #include <cstdint> // uint32_t, uint8_t
33 namespace Internal DALI_INTERNAL
40 * TransitionSet is used to control lifetime of multiple Transitions.
41 * Transition could be played with multiple other transitions for a scene change.
42 * For the case, it is more useful to manage a group of transitions with same lifetime and a finished signal.
43 * TransitionSet provides a single Play call and Finished callback for the multiple traisitions those added on it.
46 * Do not add transitions for a View by dividing them into multiple TransitionSets.
48 class DALI_TOOLKIT_API TransitionSet : public BaseHandle
51 using TransitionSetSignalType = Signal<void(TransitionSet&)>; ///< TransitionSet finished signal type
54 * @brief Creates an uninitialized TransitionSet; this can be initialized with TransitionSet::New().
56 * Calling member functions with an uninitialized TransitionSet handle is not allowed.
61 * @brief Creates an initialized TransitionSet.
63 * @return A handle to a newly allocated Dali resource
64 * @note durationSeconds can not be negative.
66 static TransitionSet New();
69 * @brief Downcasts a handle to TransitionSet handle.
71 * If handle points to an TransitionSet object, the downcast produces valid handle.
72 * If not, the returned handle is left uninitialized.
74 * @param[in] handle Handle to an object
75 * @return Handle to an TransitionSet object or an uninitialized handle
77 static TransitionSet DownCast(BaseHandle handle);
82 * This is non-virtual since derived Handle types must not contain data or virtual methods.
87 * @brief This copy constructor is required for (smart) pointer semantics.
89 * @param[in] handle A reference to the copied handle
91 TransitionSet(const TransitionSet& handle);
94 * @brief This assignment operator is required for (smart) pointer semantics.
96 * @param[in] rhs A reference to the copied handle
97 * @return A reference to this
99 TransitionSet& operator=(const TransitionSet& rhs);
102 * @brief Move constructor.
104 * @param[in] rhs A reference to the moved handle
106 TransitionSet(TransitionSet&& rhs);
109 * @brief Move assignment operator.
111 * @param[in] rhs A reference to the moved handle
112 * @return A reference to this handle
114 TransitionSet& operator=(TransitionSet&& rhs);
117 * @brief Add a TransitionBase on this TransitionSet.
119 * @param[in] transition TransitionBase to be added.
121 void AddTransition(TransitionBase transition);
124 * @brief Retrieves a TransitionBase at the index.
126 * @return The TransitionBase of index
128 TransitionBase GetTransitionAt(uint32_t index) const;
131 * @brief Retrieves the number of Transitions added in TransitionSet
133 * @return The number of Transitions
135 uint32_t GetTransitionCount() const;
138 * @brief Play the transition.
139 * This method not make property animation instantly.
140 * Transition requires some world transform properties.
141 * The Transitions currently added on this TransitionSet are queued TransitionQueue
142 * and they are played at the end of this tick of event Thread
147 * @brief Connects to this signal to be notified when all TransitionSet's transitions have finished.
149 * @return A signal object to connect with
151 TransitionSetSignalType& FinishedSignal();
153 public: // Not intended for use by Application developers
156 * @brief This constructor is used by TransitionSet::New() methods.
157 * @param[in] transition A pointer to a newly allocated Dali resource
159 explicit DALI_INTERNAL TransitionSet(Internal::TransitionSet* transition);
163 } // namespace Toolkit
167 #endif // DALI_TOOLKIT_TRANSITION_SET_H