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 #include <dali-toolkit/public-api/controls/control.h>
24 namespace Dali DALI_IMPORT_API
30 namespace Internal DALI_INTERNAL
36 * @brief How axes/rotation or scale are clamped
40 NotClamped, ///< The quantity isn't clamped
41 ClampedToMin, ///< The quantity is clamped to the min value
42 ClampedToMax ///< The quantity is clamped to the max value
46 * @brief A 2 dimensional clamp
50 ClampState x; ///< The clamp state of the x axis
51 ClampState y; ///< The clamp state of the y axis
55 * @brief A 3 dimensional clamp
59 ClampState x; ///< The clamp state of the x axis
60 ClampState y; ///< The clamp state of the y axis
61 ClampState z; ///< The clamp state of the z axis
65 * @brief Base class for derived Scrollables that contains actors that can be scrolled manually
66 * (via touch) or automatically.
68 * Scrollables such as ScrollView and ItemView can be derived from this class.
70 class Scrollable : public Control
75 * @brief Clamp signal event's data
79 ClampState3 scale; ///< Clamp information for scale axes
80 ClampState3 position; ///< Clamp information for position axes
81 ClampState rotation; ///< Clamp information for rotation
85 * @brief Scroll component types
87 enum ScrollComponentType
96 static const std::string SCROLL_RELATIVE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-relative-position", type VECTOR3
97 static const std::string SCROLL_POSITION_MIN_PROPERTY_NAME; ///< Property, name "scroll-position-min", type VECTOR3
98 static const std::string SCROLL_POSITION_MAX_PROPERTY_NAME; ///< Property, name "scroll-position-max", type VECTOR3
99 static const std::string SCROLL_DIRECTION_PROPERTY_NAME; ///< Property, name "scroll-direction", type VECTOR2
103 static const Property::Index PROPERTY_OVERSHOOT_EFFECT_COLOR; ///< Property, name "overshoot-effect-color", @see SetOvershootEffectColor(), type VECTOR4
108 static const char* const SIGNAL_SCROLL_STARTED; ///< "scroll-started";
109 static const char* const SIGNAL_SCROLL_COMPLETED; ///< "scroll-completed";
110 static const char* const SIGNAL_SCROLL_UPDATED; ///< "scroll-updated";
111 static const char* const SIGNAL_SCROLL_CLAMPED; ///< "scroll-clamped";
116 typedef SignalV2< void ( const Vector3& ) > ScrollStartedSignalV2; ///< ScrollStarted signal type
117 typedef SignalV2< void ( const Vector3& ) > ScrollCompletedSignalV2; ///< ScrollCompleted signal type
118 typedef SignalV2< void ( const Vector3& ) > ScrollUpdatedSignalV2; ///< Scroll updated signal type
119 typedef SignalV2< void ( const ClampEvent& ) > ScrollClampedSignalV2; ///< Scroll clamped signal type
122 * @brief Signal emitted when the Scrollable has moved (whether by touch or animation).
124 ScrollStartedSignalV2& ScrollStartedSignal();
127 * @brief Signal emitted when the Scrollable has moved (whether by touch or animation).
129 ScrollUpdatedSignalV2& ScrollUpdatedSignal();
132 * @brief Signal emitted when the Scrollable has completed movement (whether by touch or animation).
134 ScrollCompletedSignalV2& ScrollCompletedSignal();
137 * @brief Signal emitted when the Scrollable is pushing against a domain boundary
138 * (in either position, scale, or rotation).
140 * @return The signal to connect to
142 ScrollClampedSignalV2& ScrollClampedSignal();
147 * @brief Creates an uninitialized Scrollable handle.
152 * @brief Copy constructor.
154 * Creates another handle that points to the same real object
156 * @param handle to copy from
158 Scrollable( const Scrollable& handle );
161 * @brief Assignment operator.
163 * Changes this handle to point to another real object
164 * @param[in] handle to copy from
165 * @return A reference to this
167 Scrollable& operator=( const Scrollable& handle );
172 * This is non-virtual since derived Handle types must not contain data or virtual methods.
177 * @brief Downcast an Object handle to Scrollable.
179 * If handle points to a Scrollable the downcast produces valid
180 * handle. If not the returned handle is left uninitialized.
182 * @param[in] handle Handle to an object
183 * @return handle to a Scrollable or an uninitialized handle
185 static Scrollable DownCast( BaseHandle handle );
188 * @brief Checks if a ScrollComponent has been enabled or not.
190 * @param[in] type The Scroll Component Type to check
191 * @return True (if Enabled)
193 bool IsScrollComponentEnabled(Scrollable::ScrollComponentType type) const;
196 * @brief Enables a ScrollComponent.
198 * @param[in] type The Scroll Component Type to enable
200 void EnableScrollComponent(Scrollable::ScrollComponentType type);
203 * @brief Disables a ScrollComponent.
205 * @param[in] type The Scroll Component Type to disable
207 void DisableScrollComponent(Scrollable::ScrollComponentType type);
210 * @brief Set the color of the overshoot effect.
212 * @param[in] color The color of the overshoot effect.
214 void SetOvershootEffectColor( const Vector4& color );
217 * @brief Get the color of the overshoot effect.
218 * @return The color of the overshoot effect.
220 Vector4 GetOvershootEffectColor() const;
222 public: // Not intended for application developers
225 * @brief Creates a handle using the Toolkit::Internal implementation.
227 * @param[in] implementation The Control implementation.
229 Scrollable(Internal::Scrollable& implementation);
232 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
234 * @param[in] internal A pointer to the internal CustomActor.
236 Scrollable( Dali::Internal::CustomActor* internal );
239 } // namespace Toolkit
243 #endif // __DALI_TOOLKIT_SCROLLABLE_H__