1 #ifndef DALI_TOOLKIT_INTERNAL_SCALE_TRANSITION_H
2 #define DALI_TOOLKIT_INTERNAL_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/internal/transition/transition-base-impl.h>
23 #include <dali-toolkit/public-api/controls/control.h>
24 #include <dali-toolkit/public-api/transition/scale-transition.h>
27 #include <dali/public-api/object/weak-handle.h>
35 using ScaleTransitionPtr = IntrusivePtr<ScaleTransition>;
37 class ScaleTransition : public TransitionBase
41 * @brief Create a new ScaleTransition object.
42 * @param[in] control A control of this transition.
43 * @param[in] scaleFactor A scale value to be applied on control during transition
44 * @param[in] timePeriod The duration of the animation.
45 * @return A smart-pointer to the newly allocated ScaleTransition.
47 static ScaleTransitionPtr New(Dali::Toolkit::Control control, const Vector2& scaleFactor, TimePeriod timePeriod);
50 * @copydoc Dali::Toolkit::ScaleTransition::SetScaleFactor()
52 void SetScaleFactor(const Vector2& scaleFactor);
55 * @copydoc Dali::Toolkit::ScaleTransition::GetDirection()
57 Vector2 GetScaleFactor() const;
61 * @copydoc Dali::Toolkit::ScaleTransition::OnPlay()
63 void OnPlay() override;
67 * @brief Construct a new ScaleTransition.
69 ScaleTransition(Dali::Toolkit::Control control,
70 const Vector2& scaleFactor,
71 TimePeriod timePeriod);
74 * @brief A reference counted object may only be deleted by calling Unreference()
76 ~ScaleTransition() override;
80 ScaleTransition(const ScaleTransition&);
83 ScaleTransition& operator=(const ScaleTransition& rhs);
86 WeakHandle<Dali::Toolkit::Control> mTargetControl;
90 } // namespace Internal
92 // Helpers for public-api forwarding methods
94 inline Internal::ScaleTransition& GetImplementation(Dali::Toolkit::ScaleTransition& scale)
96 DALI_ASSERT_ALWAYS(scale && "ScaleTransition handle is empty");
98 BaseObject& handle = scale.GetBaseObject();
100 return static_cast<Internal::ScaleTransition&>(handle);
103 inline const Internal::ScaleTransition& GetImplementation(const Dali::Toolkit::ScaleTransition& scale)
105 DALI_ASSERT_ALWAYS(scale && "ScaleTransition handle is empty");
107 const BaseObject& handle = scale.GetBaseObject();
109 return static_cast<const Internal::ScaleTransition&>(handle);
112 } // namespace Toolkit
116 #endif // DALI_TOOLKIT_INTERNAL_FADE_H