Merge "Fix gradient shader + Remove comment about BorderlineColor" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / transition / scale-transition.h
1 #ifndef DALI_TOOLKIT_SCALE_TRANSITION_H
2 #define DALI_TOOLKIT_SCALE_TRANSITION_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/controls/control.h>
23 #include <dali-toolkit/public-api/transition/transition-base.h>
24
25 namespace Dali
26 {
27 namespace Toolkit
28 {
29 namespace Internal DALI_INTERNAL
30 {
31 class ScaleTransition;
32 }
33
34 /**
35  * @brief ScaleTransition provides smoothly appearing/disappearing effects for target Control.
36  * User of this scale transition can set scale factor for this transiton.
37  * The scale factor can be a single float value or Vector2 value.
38  * If it is a single float value, the value is applied to both x and y direction.
39  *
40  * If this transition is for appearing, the Control comes out with the scale factor applied
41  * and will be animated at its original scale.
42  * If this transition is for disappearing, the Control starts at its original size
43  * but will become the scale of scale factor and vanished.
44  */
45 class DALI_TOOLKIT_API ScaleTransition : public TransitionBase
46 {
47 public:
48   /**
49    * @brief Creates an uninitialized ScaleTransition; this can be initialized with ScaleTransition::New().
50    *
51    * Calling member functions with an uninitialized ScaleTransition handle is not allowed.
52    */
53   ScaleTransition();
54
55   /**
56    * @brief Creates an initialized ScaleTransition.
57    *
58    * @param[in] control A control of this transition.
59    * @param[in] scaleFactor A scala scale factor that will be applied on both of width and height of the control
60    * @param[in] timePeriod The duration of the animation.
61    * @return A handle to a newly allocated Dali resource
62    */
63   static ScaleTransition New(Dali::Toolkit::Control control, float scaleFactor, TimePeriod timePeriod);
64
65   /**
66    * @brief Creates an initialized ScaleTransition.
67    *
68    * @param[in] control A control of this transition.
69    * @param[in] scaleFactor A scale vector to be applied on control during transition
70    * @param[in] timePeriod The duration of the animation.
71    * @return A handle to a newly allocated Dali resource
72    */
73   static ScaleTransition New(Dali::Toolkit::Control control, const Vector2& scaleFactor, TimePeriod timePeriod);
74
75   /**
76    * @brief Downcasts a handle to ScaleTransition handle.
77    *
78    * If handle points to an ScaleTransition object, the downcast produces valid handle.
79    * If not, the returned handle is left uninitialized.
80    *
81    * @param[in] handle Handle to an object
82    * @return Handle to an ScaleTransition object or an uninitialized handle
83    */
84   static ScaleTransition DownCast(BaseHandle handle);
85
86   /**
87    * @brief Destructor.
88    *
89    * This is non-virtual since derived Handle types must not contain data or virtual methods.
90    */
91   ~ScaleTransition();
92
93   /**
94    * @brief This copy constructor is required for (smart) pointer semantics.
95    *
96    * @param[in] handle A reference to the copied handle
97    */
98   ScaleTransition(const ScaleTransition& handle);
99
100   /**
101    * @brief This assignment operator is required for (smart) pointer semantics.
102    *
103    * @param[in] rhs A reference to the copied handle
104    * @return A reference to this
105    */
106   ScaleTransition& operator=(const ScaleTransition& rhs);
107
108   /**
109    * @brief Move constructor.
110    *
111    * @param[in] rhs A reference to the moved handle
112    */
113   ScaleTransition(ScaleTransition&& rhs);
114
115   /**
116    * @brief Move assignment operator.
117    *
118    * @param[in] rhs A reference to the moved handle
119    * @return A reference to this handle
120    */
121   ScaleTransition& operator=(ScaleTransition&& rhs);
122
123   /**
124    * @brief Sets scaleFactor to be used to scale target Control
125    *
126    * @param[in] scaleFactor Relative scaleFactor that will be used when the Control is appearing or disappearing.
127    */
128   void SetScaleFactor(const Vector2& scaleFactor);
129
130   /**
131    * @brief Retrieves scaleFactor that will be used when the Control is appearing or disappearing.
132    */
133   Vector2 GetScaleFactor() const;
134
135 public: // Not intended for use by Application developers
136   /// @cond internal
137   /**
138    * @brief This constructor is used by ScaleTransition::New() methods.
139    * @param[in] scale A pointer to a newly allocated Dali resource
140    */
141   explicit DALI_INTERNAL ScaleTransition(Internal::ScaleTransition* scale);
142   /// @endcond
143 };
144
145 } // namespace Toolkit
146
147 } // namespace Dali
148
149 #endif // DALI_TOOLKIT_SCALE_TRANSITION_H