1 #ifndef DALI_TOOLKIT_SCALE_TRANSITION_H
2 #define DALI_TOOLKIT_SCALE_TRANSITION_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/controls/control.h>
23 #include <dali-toolkit/public-api/transition/transition-base.h>
29 namespace Internal DALI_INTERNAL
31 class ScaleTransition;
35 * @brief ScaleTransition provides smoothly appearing/disappearing effects for target Control.
36 * User of this scale transition can set scale factor for this transiton.
37 * The scale factor can be a single float value or Vector2 value.
38 * If it is a single float value, the value is applied to both x and y direction.
40 * If this transition is for appearing, the Control comes out with the scale factor applied
41 * and will be animated at its original scale.
42 * If this transition is for disappearing, the Control starts at its original size
43 * but will become the scale of scale factor and vanished.
45 class DALI_TOOLKIT_API ScaleTransition : public TransitionBase
49 * @brief Creates an uninitialized ScaleTransition; this can be initialized with ScaleTransition::New().
51 * Calling member functions with an uninitialized ScaleTransition handle is not allowed.
56 * @brief Creates an initialized ScaleTransition.
58 * @param[in] control A control of this transition.
59 * @param[in] scaleFactor A scala scale factor that will be applied on both of width and height of the control
60 * @param[in] timePeriod The duration of the animation.
61 * @return A handle to a newly allocated Dali resource
63 static ScaleTransition New(Dali::Toolkit::Control control, float scaleFactor, TimePeriod timePeriod);
66 * @brief Creates an initialized ScaleTransition.
68 * @param[in] control A control of this transition.
69 * @param[in] scaleFactor A scale vector to be applied on control during transition
70 * @param[in] timePeriod The duration of the animation.
71 * @return A handle to a newly allocated Dali resource
73 static ScaleTransition New(Dali::Toolkit::Control control, const Vector2& scaleFactor, TimePeriod timePeriod);
76 * @brief Downcasts a handle to ScaleTransition handle.
78 * If handle points to an ScaleTransition object, the downcast produces valid handle.
79 * If not, the returned handle is left uninitialized.
81 * @param[in] handle Handle to an object
82 * @return Handle to an ScaleTransition object or an uninitialized handle
84 static ScaleTransition DownCast(BaseHandle handle);
89 * This is non-virtual since derived Handle types must not contain data or virtual methods.
94 * @brief This copy constructor is required for (smart) pointer semantics.
96 * @param[in] handle A reference to the copied handle
98 ScaleTransition(const ScaleTransition& handle);
101 * @brief This assignment operator is required for (smart) pointer semantics.
103 * @param[in] rhs A reference to the copied handle
104 * @return A reference to this
106 ScaleTransition& operator=(const ScaleTransition& rhs);
109 * @brief Move constructor.
111 * @param[in] rhs A reference to the moved handle
113 ScaleTransition(ScaleTransition&& rhs) noexcept;
116 * @brief Move assignment operator.
118 * @param[in] rhs A reference to the moved handle
119 * @return A reference to this handle
121 ScaleTransition& operator=(ScaleTransition&& rhs) noexcept;
124 * @brief Sets scaleFactor to be used to scale target Control
126 * @param[in] scaleFactor Relative scaleFactor that will be used when the Control is appearing or disappearing.
128 void SetScaleFactor(const Vector2& scaleFactor);
131 * @brief Retrieves scaleFactor that will be used when the Control is appearing or disappearing.
133 Vector2 GetScaleFactor() const;
135 public: // Not intended for use by Application developers
138 * @brief This constructor is used by ScaleTransition::New() methods.
139 * @param[in] scale A pointer to a newly allocated Dali resource
141 explicit DALI_INTERNAL ScaleTransition(Internal::ScaleTransition* scale);
145 } // namespace Toolkit
149 #endif // DALI_TOOLKIT_SCALE_TRANSITION_H