1 #ifndef DALI_TRANSITION_BASE_H
2 #define DALI_TRANSITION_BASE_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/dali-toolkit-common.h>
25 #include <dali/public-api/animation/alpha-function.h>
26 #include <dali/public-api/animation/time-period.h>
27 #include <dali/public-api/object/base-handle.h>
28 #include <cstdint> // uint32_t, uint8_t
34 namespace Internal DALI_INTERNAL
42 * Transition provides continuous and seamless motions for the visually plausible scene change.
43 * And, TransitionBase is a base class for every Transition cases.
45 class DALI_TOOLKIT_API TransitionBase : public BaseHandle
49 * @brief Creates an uninitialized TransitionBase; this can be initialized with TransitionBase::New().
51 * Calling member functions with an uninitialized TransitionBase handle is not allowed.
56 * @brief Creates an initialized TransitionBase.
58 static TransitionBase New();
61 * @brief Downcasts a handle to TransitionBase handle.
63 * If handle points to an TransitionBase object, the downcast produces valid handle.
64 * If not, the returned handle is left uninitialized.
66 * @param[in] handle Handle to an object
67 * @return Handle to an TransitionBase object or an uninitialized handle
69 static TransitionBase DownCast(BaseHandle handle);
74 * This is non-virtual since derived Handle types must not contain data or virtual methods.
79 * @brief This copy constructor is required for (smart) pointer semantics.
81 * @param[in] handle A reference to the copied handle
83 TransitionBase(const TransitionBase& handle);
86 * @brief This assignment operator is required for (smart) pointer semantics.
88 * @param[in] rhs A reference to the copied handle
89 * @return A reference to this
91 TransitionBase& operator=(const TransitionBase& rhs);
94 * @brief Move constructor.
96 * @param[in] rhs A reference to the moved handle
98 TransitionBase(TransitionBase&& rhs);
101 * @brief Move assignment operator.
103 * @param[in] rhs A reference to the moved handle
104 * @return A reference to this handle
106 TransitionBase& operator=(TransitionBase&& rhs);
109 * @brief Sets the duration of an transition.
111 * @param[in] seconds The duration in seconds
112 * @pre DurationSeconds must be greater than zero.
114 void SetDuration(float seconds);
117 * @brief Retrieves the duration of an transition.
119 * @return The duration in seconds
121 float GetDuration() const;
124 * @brief Sets the delay of an transition.
126 * @param[in] seconds The delay in seconds
127 * @pre DelaySeconds must be greater than zero.
129 void SetDelay(float seconds);
132 * @brief Retrieves the delay of an transition.
134 * @return The delay in seconds
136 float GetDelay() const;
139 * Set time period that contains delay and duration
140 * @param[in] timePeriod The time period for an animator.
142 void SetTimePeriod(TimePeriod timePeriod);
145 * @brief Sets the alpha function for an transition.
147 * This is applied to individual property transitions, if no further alpha functions are supplied.
148 * @param[in] alpha The alpha function
150 void SetAlphaFunction(AlphaFunction alpha);
153 * @brief Retrieves the alpha function for an transition.
155 * @return The alpha function
157 AlphaFunction GetAlphaFunction() const;
160 * @brief A View could be transition with its child Views or without them.
162 void TransitionWithChild(bool transitionWithChild);
164 public: // Not intended for use by Application developers
167 * @brief This constructor is used by TransitionBase::New() methods.
168 * @param[in] transitionBase A pointer to a newly allocated Dali resource
170 explicit DALI_INTERNAL TransitionBase(Internal::TransitionBase* transitionBase);
174 } // namespace Toolkit
178 #endif // DALI_TRANSITION_BASE_H