1 #ifndef DALI_TOOLKIT_INTERNAL_TRANSITION_H
2 #define DALI_TOOLKIT_INTERNAL_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/transition.h>
27 #include <dali/public-api/object/weak-handle.h>
35 using TransitionPtr = IntrusivePtr<Transition>;
37 class Transition : public TransitionBase
41 * @brief Create a new Transition object.
42 * @param[in] source A source control of this transition.
43 * @param[in] destination A destination control of this transition.
44 * @param[in] useDestinationTarget True if this transition uses destination control as target.
45 * @param[in] timePeriod The timePeriod of the animation.
46 * @return A smart-pointer to the newly allocated Transition.
48 static TransitionPtr New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, bool useDestinationTarget, TimePeriod timePeriod);
52 * @copydoc Dali::Toolkit::Transition::OnPlay()
54 void OnPlay() override;
57 * @brief Emit the Finished signal
59 void OnFinished() override;
63 * @brief Construct a new Transition.
65 Transition(Dali::Toolkit::Control source,
66 Dali::Toolkit::Control destination,
67 bool useDestinationTarget,
68 TimePeriod timePeriod);
71 * @brief A reference counted object may only be deleted by calling Unreference()
73 ~Transition() override;
77 Transition(const Transition&);
80 Transition& operator=(const Transition& rhs);
83 Dali::Toolkit::Control GetTargetControl();
84 Dali::Toolkit::Control GetWaitingControl();
87 bool mUseDestinationTarget;
88 Vector3 mOriginalSize;
89 std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>> mOriginalVisualProperties;
90 WeakHandle<Dali::Toolkit::Control> mSourceControl;
91 WeakHandle<Dali::Toolkit::Control> mDestinationControl;
94 } // namespace Internal
96 // Helpers for public-api forwarding methods
98 inline Internal::Transition& GetImplementation(Dali::Toolkit::Transition& transition)
100 DALI_ASSERT_ALWAYS(transition && "Transition handle is empty");
102 BaseObject& handle = transition.GetBaseObject();
104 return static_cast<Internal::Transition&>(handle);
107 inline const Internal::Transition& GetImplementation(const Dali::Toolkit::Transition& transition)
109 DALI_ASSERT_ALWAYS(transition && "Transition handle is empty");
111 const BaseObject& handle = transition.GetBaseObject();
113 return static_cast<const Internal::Transition&>(handle);
116 } // namespace Toolkit
120 #endif // DALI_TOOLKIT_INTERNAL_TRANSITION_H