1 #ifndef DALI_TOOLKIT_SLIDE_TRANSITION_H
2 #define DALI_TOOLKIT_SLIDE_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/public-api/controls/control.h>
23 #include <dali-toolkit/public-api/transition/transition-base.h>
29 namespace Internal DALI_INTERNAL
31 class SlideTransition;
35 * @brief Pre-defined directions to define where the control is comming from or going to.
37 namespace SlideTransitionDirection
39 static constexpr Vector2 TOP(0, -1); // TOP
40 static constexpr Vector2 BOTTOM(0, 1); // BOTTOM
41 static constexpr Vector2 LEFT(-1, 0); // LEFT
42 static constexpr Vector2 RIGHT(1, 0); // RIGHT
46 * @brief SlideTransition provides smoothly appearing/disappearing effects for target Control.
47 * The direction the target Control is comming from or going to can be selected in the pre-defined directions. {UP, DOWN, LEFT, RIGHT}
48 * And, to use custom direction, the direction can be set CUSTOM and use SetDirection(Vector2) method.
50 class DALI_TOOLKIT_API SlideTransition : public TransitionBase
55 * @brief Creates an uninitialized SlideTransition; this can be initialized with SlideTransition::New().
57 * Calling member functions with an uninitialized SlideTransition handle is not allowed.
62 * @brief Creates an initialized SlideTransition.
64 * @param[in] control A control of this transition.
65 * @param[in] direction Relative direction that the control is comming from or going to.
66 * @param[in] timePeriod The duration of the animation.
67 * @return A handle to a newly allocated Dali resource
69 static SlideTransition New(Dali::Toolkit::Control control, const Vector2& direction, TimePeriod timePeriod);
72 * @brief Downcasts a handle to SlideTransition handle.
74 * If handle points to an SlideTransition object, the downcast produces valid handle.
75 * If not, the returned handle is left uninitialized.
77 * @param[in] handle Handle to an object
78 * @return Handle to an SlideTransition object or an uninitialized handle
80 static SlideTransition DownCast(BaseHandle handle);
85 * This is non-virtual since derived Handle types must not contain data or virtual methods.
90 * @brief This copy constructor is required for (smart) pointer semantics.
92 * @param[in] handle A reference to the copied handle
94 SlideTransition(const SlideTransition& handle);
97 * @brief This assignment operator is required for (smart) pointer semantics.
99 * @param[in] rhs A reference to the copied handle
100 * @return A reference to this
102 SlideTransition& operator=(const SlideTransition& rhs);
105 * @brief Move constructor.
107 * @param[in] rhs A reference to the moved handle
109 SlideTransition(SlideTransition&& rhs);
112 * @brief Move assignment operator.
114 * @param[in] rhs A reference to the moved handle
115 * @return A reference to this handle
117 SlideTransition& operator=(SlideTransition&& rhs);
120 * @brief Sets direction to be used to move target Control
122 * @param[in] direction Relative direction that the control is comming from or going to.
124 void SetDirection(const Vector2& direction);
127 * @brief Retrieves direction to be used to move target Control
129 * @note The direction is normalized Vector.
131 Vector2 GetDirection() const;
133 public: // Not intended for use by Application developers
136 * @brief This constructor is used by SlideTransition::New() methods.
137 * @param[in] slideTransition A pointer to a newly allocated Dali resource
139 explicit DALI_INTERNAL SlideTransition(Internal::SlideTransition* slideTransition);
143 } // namespace Toolkit
147 #endif // DALI_TOOLKIT_SLIDE_TRANSITION_H