Remove std::vector dependency for dali-signal.h
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / transition / transition-impl.h
1 #ifndef DALI_TOOLKIT_INTERNAL_TRANSITION_H
2 #define DALI_TOOLKIT_INTERNAL_TRANSITION_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
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>
25
26 // EXTERNAL INCLUDES
27 #include <dali/public-api/common/vector-wrapper.h>
28 #include <dali/public-api/object/weak-handle.h>
29
30 namespace Dali
31 {
32 namespace Toolkit
33 {
34 namespace Internal
35 {
36 using TransitionPtr = IntrusivePtr<Transition>;
37
38 class Transition : public TransitionBase
39 {
40 public:
41   /**
42    * @brief Create a new Transition object.
43    * @param[in] source A source control of this transition.
44    * @param[in] destination A destination control of this transition.
45    * @param[in] useDestinationTarget True if this transition uses destination control as target.
46    * @param[in] timePeriod The timePeriod of the animation.
47    * @return A smart-pointer to the newly allocated Transition.
48    */
49   static TransitionPtr New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, bool useDestinationTarget, TimePeriod timePeriod);
50
51 protected:
52   /**
53    * @copydoc Dali::Toolkit::Transition::OnPlay()
54    */
55   void OnPlay() override;
56
57   /**
58    * @brief Emit the Finished signal
59    */
60   void OnFinished() override;
61
62 protected:
63   /**
64    * @brief Construct a new Transition.
65    */
66   Transition(Dali::Toolkit::Control source,
67              Dali::Toolkit::Control destination,
68              bool                   useDestinationTarget,
69              TimePeriod             timePeriod);
70
71   /**
72    * @brief A reference counted object may only be deleted by calling Unreference()
73    */
74   ~Transition() override;
75
76 private:
77   // Undefined
78   Transition(const Transition&);
79
80   // Undefined
81   Transition& operator=(const Transition& rhs);
82
83 private:
84   Dali::Toolkit::Control GetTargetControl();
85   Dali::Toolkit::Control GetWaitingControl();
86
87 private:
88   bool                                                               mUseDestinationTarget;
89   Vector3                                                            mOriginalSize;
90   std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>> mOriginalVisualProperties;
91   WeakHandle<Dali::Toolkit::Control>                                 mSourceControl;
92   WeakHandle<Dali::Toolkit::Control>                                 mDestinationControl;
93 };
94
95 } // namespace Internal
96
97 // Helpers for public-api forwarding methods
98
99 inline Internal::Transition& GetImplementation(Dali::Toolkit::Transition& transition)
100 {
101   DALI_ASSERT_ALWAYS(transition && "Transition handle is empty");
102
103   BaseObject& handle = transition.GetBaseObject();
104
105   return static_cast<Internal::Transition&>(handle);
106 }
107
108 inline const Internal::Transition& GetImplementation(const Dali::Toolkit::Transition& transition)
109 {
110   DALI_ASSERT_ALWAYS(transition && "Transition handle is empty");
111
112   const BaseObject& handle = transition.GetBaseObject();
113
114   return static_cast<const Internal::Transition&>(handle);
115 }
116
117 } // namespace Toolkit
118
119 } // namespace Dali
120
121 #endif // DALI_TOOLKIT_INTERNAL_TRANSITION_H