[Tizen] Adds transition effect
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / transition / transition-base.h
1 #ifndef DALI_TRANSITION_BASE_H
2 #define DALI_TRANSITION_BASE_H
3
4 /*
5  * Copyright (c) 2021 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/public-api/dali-toolkit-common.h>
23
24 // EXTERNAL INCLUDES
25 #include <dali/public-api/animation/alpha-function.h>
26 #include <dali/public-api/animation/time-period.h>
27 #include <dali/public-api/object/base-handle.h>
28 #include <cstdint> // uint32_t, uint8_t
29
30 namespace Dali
31 {
32 namespace Toolkit
33 {
34 namespace Internal DALI_INTERNAL
35 {
36 class TransitionBase;
37 }
38
39 /**
40  * @brief
41  *
42  * Transition provides continuous and seamless motions for the visually plausible scene change.
43  * And, TransitionBase is a base class for every Transition cases.
44  */
45 class DALI_TOOLKIT_API TransitionBase : public BaseHandle
46 {
47 public:
48   /**
49    * @brief Creates an uninitialized TransitionBase; this can be initialized with TransitionBase::New().
50    *
51    * Calling member functions with an uninitialized TransitionBase handle is not allowed.
52    */
53   TransitionBase();
54
55   /**
56    * @brief Creates an initialized TransitionBase.
57    */
58   static TransitionBase New();
59
60   /**
61    * @brief Downcasts a handle to TransitionBase handle.
62    *
63    * If handle points to an TransitionBase object, the downcast produces valid handle.
64    * If not, the returned handle is left uninitialized.
65    *
66    * @param[in] handle Handle to an object
67    * @return Handle to an TransitionBase object or an uninitialized handle
68    */
69   static TransitionBase DownCast(BaseHandle handle);
70
71   /**
72    * @brief Destructor.
73    *
74    * This is non-virtual since derived Handle types must not contain data or virtual methods.
75    */
76   ~TransitionBase();
77
78   /**
79    * @brief This copy constructor is required for (smart) pointer semantics.
80    *
81    * @param[in] handle A reference to the copied handle
82    */
83   TransitionBase(const TransitionBase& handle);
84
85   /**
86    * @brief This assignment operator is required for (smart) pointer semantics.
87    *
88    * @param[in] rhs A reference to the copied handle
89    * @return A reference to this
90    */
91   TransitionBase& operator=(const TransitionBase& rhs);
92
93   /**
94    * @brief Move constructor.
95    *
96    * @param[in] rhs A reference to the moved handle
97    */
98   TransitionBase(TransitionBase&& rhs);
99
100   /**
101    * @brief Move assignment operator.
102    *
103    * @param[in] rhs A reference to the moved handle
104    * @return A reference to this handle
105    */
106   TransitionBase& operator=(TransitionBase&& rhs);
107
108   /**
109    * @brief Sets the duration of an transition.
110    *
111    * @param[in] seconds The duration in seconds
112    * @pre DurationSeconds must be greater than zero.
113    */
114   void SetDuration(float seconds);
115
116   /**
117    * @brief Retrieves the duration of an transition.
118    *
119    * @return The duration in seconds
120    */
121   float GetDuration() const;
122
123   /**
124    * @brief Sets the delay of an transition.
125    *
126    * @param[in] seconds The delay in seconds
127    * @pre DelaySeconds must be greater than zero.
128    */
129   void SetDelay(float seconds);
130
131   /**
132    * @brief Retrieves the delay of an transition.
133    *
134    * @return The delay in seconds
135    */
136   float GetDelay() const;
137
138   /**
139    * Set time period that contains delay and duration
140    * @param[in] timePeriod The time period for an animator.
141    */
142   void SetTimePeriod(TimePeriod timePeriod);
143
144   /**
145    * @brief Sets the alpha function for an transition.
146    *
147    * This is applied to individual property transitions, if no further alpha functions are supplied.
148    * @param[in] alpha The alpha function
149    */
150   void SetAlphaFunction(AlphaFunction alpha);
151
152   /**
153    * @brief Retrieves the alpha function for an transition.
154    *
155    * @return The alpha function
156    */
157   AlphaFunction GetAlphaFunction() const;
158
159   /**
160    * @brief A View could be transition with its child Views or without them.
161    */
162   void TransitionWithChild(bool transitionWithChild);
163
164 public: // Not intended for use by Application developers
165   /// @cond internal
166   /**
167    * @brief This constructor is used by TransitionBase::New() methods.
168    * @param[in] transitionBase A pointer to a newly allocated Dali resource
169    */
170   explicit DALI_INTERNAL TransitionBase(Internal::TransitionBase* transitionBase);
171   /// @endcond
172 };
173
174 } // namespace Toolkit
175
176 } // namespace Dali
177
178 #endif // DALI_TRANSITION_BASE_H