1 #ifndef DALI_TOOLKIT_INTERNAL_FADE_TRANSITION_H
2 #define DALI_TOOLKIT_INTERNAL_FADE_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/fade-transition.h>
27 #include <dali/public-api/object/weak-handle.h>
35 using FadeTransitionPtr = IntrusivePtr<FadeTransition>;
37 class FadeTransition : public TransitionBase
41 * @brief Create a new FadeTransition object.
42 * @param[in] control A control of this transition.
43 * @param[in] opacity opacity value the control Opacity property will be changed from/to.
44 * @param[in] timePeriod The duration of the animation.
45 * @return A smart-pointer to the newly allocated FadeTransition.
47 static FadeTransitionPtr New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod);
51 * @copydoc Dali::Toolkit::FadeTransition::OnPlay()
53 void OnPlay() override;
57 * @brief Construct a new FadeTransition.
59 FadeTransition(Dali::Toolkit::Control control,
61 TimePeriod timePeriod);
64 * @brief A reference counted object may only be deleted by calling Unreference()
66 ~FadeTransition() override;
70 FadeTransition(const FadeTransition&);
73 FadeTransition& operator=(const FadeTransition& rhs);
76 WeakHandle<Dali::Toolkit::Control> mTargetControl;
80 } // namespace Internal
82 // Helpers for public-api forwarding methods
84 inline Internal::FadeTransition& GetImplementation(Dali::Toolkit::FadeTransition& fade)
86 DALI_ASSERT_ALWAYS(fade && "FadeTransition handle is empty");
88 BaseObject& handle = fade.GetBaseObject();
90 return static_cast<Internal::FadeTransition&>(handle);
93 inline const Internal::FadeTransition& GetImplementation(const Dali::Toolkit::FadeTransition& fade)
95 DALI_ASSERT_ALWAYS(fade && "FadeTransition handle is empty");
97 const BaseObject& handle = fade.GetBaseObject();
99 return static_cast<const Internal::FadeTransition&>(handle);
102 } // namespace Toolkit
106 #endif // DALI_TOOLKIT_INTERNAL_FADE_TRANSITION_H