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
41 * TransitionSet is used to control lifetime of multiple Transitions.
42 * Transition could be played with multiple other transitions for a scene change.
43 * For the case, it is more useful to manage a group of transitions with same lifetime and a finished signal.
44 * TransitionSet provides a single Play call and Finished callback for the multiple traisitions those added on it.
46 class DALI_TOOLKIT_API TransitionSet : public BaseHandle
49 using TransitionSetSignalType = Signal<void(TransitionSet&)>; ///< TransitionSet finished signal type
52 * @brief Creates an uninitialized TransitionSet; this can be initialized with TransitionSet::New().
54 * Calling member functions with an uninitialized TransitionSet handle is not allowed.
59 * @brief Creates an initialized TransitionSet.
61 * @return A handle to a newly allocated Dali resource
62 * @note durationSeconds can not be negative.
64 static TransitionSet New();
67 * @brief Downcasts a handle to TransitionSet handle.
69 * If handle points to an TransitionSet object, the downcast produces valid handle.
70 * If not, the returned handle is left uninitialized.
72 * @param[in] handle Handle to an object
73 * @return Handle to an TransitionSet object or an uninitialized handle
75 static TransitionSet DownCast(BaseHandle handle);
80 * This is non-virtual since derived Handle types must not contain data or virtual methods.
85 * @brief This copy constructor is required for (smart) pointer semantics.
87 * @param[in] handle A reference to the copied handle
89 TransitionSet(const TransitionSet& handle);
92 * @brief This assignment operator is required for (smart) pointer semantics.
94 * @param[in] rhs A reference to the copied handle
95 * @return A reference to this
97 TransitionSet& operator=(const TransitionSet& rhs);
100 * @brief Move constructor.
102 * @param[in] rhs A reference to the moved handle
104 TransitionSet(TransitionSet&& rhs);
107 * @brief Move assignment operator.
109 * @param[in] rhs A reference to the moved handle
110 * @return A reference to this handle
112 TransitionSet& operator=(TransitionSet&& rhs);
115 * @brief Add a TransitionBase on this TransitionSet.
117 * @param[in] transition TransitionBase to be added.
119 void AddTransition(TransitionBase transition);
122 * @brief Retrieves a TransitionBase at the index.
124 * @return The TransitionBase of index
126 TransitionBase GetTransitionAt(uint32_t index) const;
129 * @brief Retrieves the number of Transitions added in TransitionSet
131 * @return The number of Transitions
133 uint32_t GetTransitionCount() const;
136 * @brief Play the transition.
137 * This method not make property animation instantly.
138 * Transition requires some world transform properties.
139 * The Transitions currently added on this TransitionSet are queued TransitionQueue
140 * and they are played at the end of this tick of event Thread
145 * @brief Connects to this signal to be notified when all TransitionSet's transitions have finished.
147 * @return A signal object to connect with
149 TransitionSetSignalType& FinishedSignal();
151 public: // Not intended for use by Application developers
154 * @brief This constructor is used by TransitionSet::New() methods.
155 * @param[in] transition A pointer to a newly allocated Dali resource
157 explicit DALI_INTERNAL TransitionSet(Internal::TransitionSet* transition);
161 } // namespace Toolkit
165 #endif // DALI_TOOLKIT_TRANSITION_SET_H