1 #ifndef __DALI_TOOLKIT_SCROLLABLE_H__
2 #define __DALI_TOOLKIT_SCROLLABLE_H__
5 * Copyright (c) 2014 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 * @addtogroup CAPI_DALI_TOOLKIT_SCROLLABLE_MODULE
27 #include <dali-toolkit/public-api/controls/control.h>
29 namespace Dali DALI_IMPORT_API
35 namespace Internal DALI_INTERNAL
41 * @brief How axes/rotation or scale are clamped
45 NotClamped, ///< The quantity isn't clamped
46 ClampedToMin, ///< The quantity is clamped to the min value
47 ClampedToMax ///< The quantity is clamped to the max value
51 * @brief A 2 dimensional clamp
55 ClampState x; ///< The clamp state of the x axis
56 ClampState y; ///< The clamp state of the y axis
60 * @brief A 3 dimensional clamp
64 ClampState x; ///< The clamp state of the x axis
65 ClampState y; ///< The clamp state of the y axis
66 ClampState z; ///< The clamp state of the z axis
70 * @brief Base class for derived Scrollables that contains actors that can be scrolled manually
71 * (via touch) or automatically.
73 * Scrollables such as ScrollView and ItemView can be derived from this class.
75 class Scrollable : public Control
80 * @brief Clamp signal event's data
84 ClampState3 scale; ///< Clamp information for scale axes
85 ClampState3 position; ///< Clamp information for position axes
86 ClampState rotation; ///< Clamp information for rotation
90 * @brief Scroll component types
92 enum ScrollComponentType
101 static const std::string SCROLL_RELATIVE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-relative-position", type VECTOR3
102 static const std::string SCROLL_POSITION_MIN_PROPERTY_NAME; ///< Property, name "scroll-position-min", type VECTOR3
103 static const std::string SCROLL_POSITION_MAX_PROPERTY_NAME; ///< Property, name "scroll-position-max", type VECTOR3
104 static const std::string SCROLL_DIRECTION_PROPERTY_NAME; ///< Property, name "scroll-direction", type VECTOR2
107 static const char* const SIGNAL_SCROLL_STARTED; ///< "scroll-started";
108 static const char* const SIGNAL_SCROLL_COMPLETED; ///< "scroll-completed";
109 static const char* const SIGNAL_SCROLL_UPDATED; ///< "scroll-updated";
110 static const char* const SIGNAL_SCROLL_CLAMPED; ///< "scroll-clamped";
114 typedef SignalV2< void ( const Vector3& ) > ScrollStartedSignalV2; ///< ScrollStarted signal type
115 typedef SignalV2< void ( const Vector3& ) > ScrollCompletedSignalV2; ///< ScrollCompleted signal type
116 typedef SignalV2< void ( const Vector3& ) > ScrollUpdatedSignalV2; ///< Scroll updated signal type
117 typedef SignalV2< void ( const ClampEvent& ) > ScrollClampedSignalV2; ///< Scroll clamped signal type
120 * @brief Signal emitted when the Scrollable has moved (whether by touch or animation).
122 ScrollStartedSignalV2& ScrollStartedSignal();
125 * @brief Signal emitted when the Scrollable has moved (whether by touch or animation).
127 ScrollUpdatedSignalV2& ScrollUpdatedSignal();
130 * @brief Signal emitted when the Scrollable has completed movement (whether by touch or animation).
132 ScrollCompletedSignalV2& ScrollCompletedSignal();
135 * @brief Signal emitted when the Scrollable is pushing against a domain boundary
136 * (in either position, scale, or rotation).
138 * @return The signal to connect to
140 ScrollClampedSignalV2& ScrollClampedSignal();
145 * @brief Creates an uninitialized Scrollable handle.
150 * @brief Copy constructor.
152 * Creates another handle that points to the same real object
154 * @param handle to copy from
156 Scrollable( const Scrollable& handle );
159 * @brief Assignment operator.
161 * Changes this handle to point to another real object
162 * @param[in] handle to copy from
163 * @return A reference to this
165 Scrollable& operator=( const Scrollable& handle );
170 * This is non-virtual since derived Handle types must not contain data or virtual methods.
175 * @brief Downcast an Object handle to Scrollable.
177 * If handle points to a Scrollable the downcast produces valid
178 * handle. If not the returned handle is left uninitialized.
180 * @param[in] handle Handle to an object
181 * @return handle to a Scrollable or an uninitialized handle
183 static Scrollable DownCast( BaseHandle handle );
186 * @brief Checks if a ScrollComponent has been enabled or not.
188 * @param[in] type The Scroll Component Type to check
189 * @return True (if Enabled)
191 bool IsScrollComponentEnabled(Scrollable::ScrollComponentType type) const;
194 * @brief Enables a ScrollComponent.
196 * @param[in] type The Scroll Component Type to enable
198 void EnableScrollComponent(Scrollable::ScrollComponentType type);
201 * @brief Disables a ScrollComponent.
203 * @param[in] type The Scroll Component Type to disable
205 void DisableScrollComponent(Scrollable::ScrollComponentType type);
207 public: // Not intended for application developers
210 * @brief Creates a handle using the Toolkit::Internal implementation.
212 * @param[in] implementation The Control implementation.
214 Scrollable(Internal::Scrollable& implementation);
217 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
219 * @param[in] internal A pointer to the internal CustomActor.
221 Scrollable( Dali::Internal::CustomActor* internal );
224 } // namespace Toolkit
231 #endif // __DALI_TOOLKIT_SCROLLABLE_H__