1 #ifndef __DALI_TOOLKIT_SCROLLABLE_H__
2 #define __DALI_TOOLKIT_SCROLLABLE_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 * @addtogroup CAPI_DALI_TOOLKIT_SCROLLABLE_MODULE
26 #include <dali-toolkit/public-api/controls/control.h>
28 namespace Dali DALI_IMPORT_API
34 namespace Internal DALI_INTERNAL
40 * @brief How axes/rotation or scale are clamped
44 NotClamped, ///< The quantity isn't clamped
45 ClampedToMin, ///< The quantity is clamped to the min value
46 ClampedToMax ///< The quantity is clamped to the max value
50 * @brief A 2 dimensional clamp
54 ClampState x; ///< The clamp state of the x axis
55 ClampState y; ///< The clamp state of the y axis
59 * @brief A 3 dimensional clamp
63 ClampState x; ///< The clamp state of the x axis
64 ClampState y; ///< The clamp state of the y axis
65 ClampState z; ///< The clamp state of the z axis
69 * @brief Base class for derived Scrollables that contains actors that can be scrolled manually
70 * (via touch) or automatically.
72 * Scrollables such as ScrollView and ItemView can be derived from this class.
74 class Scrollable : public Control
79 * @brief Clamp signal event's data
83 ClampState3 scale; ///< Clamp information for scale axes
84 ClampState3 position; ///< Clamp information for position axes
85 ClampState rotation; ///< Clamp information for rotation
89 * @brief Scroll component types
91 enum ScrollComponentType
100 static const std::string SCROLL_RELATIVE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-relative-position", type VECTOR3
101 static const std::string SCROLL_POSITION_MIN_PROPERTY_NAME; ///< Property, name "scroll-position-min", type VECTOR3
102 static const std::string SCROLL_POSITION_MAX_PROPERTY_NAME; ///< Property, name "scroll-position-max", type VECTOR3
103 static const std::string SCROLL_DIRECTION_PROPERTY_NAME; ///< Property, name "scroll-direction", type VECTOR2
106 static const char* const SIGNAL_SCROLL_STARTED; ///< "scroll-started";
107 static const char* const SIGNAL_SCROLL_COMPLETED; ///< "scroll-completed";
108 static const char* const SIGNAL_SCROLL_UPDATED; ///< "scroll-updated";
109 static const char* const SIGNAL_SCROLL_CLAMPED; ///< "scroll-clamped";
113 typedef SignalV2< void ( const Vector3& ) > ScrollStartedSignalV2; ///< ScrollStarted signal type
114 typedef SignalV2< void ( const Vector3& ) > ScrollCompletedSignalV2; ///< ScrollCompleted signal type
115 typedef SignalV2< void ( const Vector3& ) > ScrollUpdatedSignalV2; ///< Scroll updated signal type
116 typedef SignalV2< void ( const ClampEvent& ) > ScrollClampedSignalV2; ///< Scroll clamped signal type
119 * @brief Signal emitted when the Scrollable has moved (whether by touch or animation).
121 ScrollStartedSignalV2& ScrollStartedSignal();
124 * @brief Signal emitted when the Scrollable has moved (whether by touch or animation).
126 ScrollUpdatedSignalV2& ScrollUpdatedSignal();
129 * @brief Signal emitted when the Scrollable has completed movement (whether by touch or animation).
131 ScrollCompletedSignalV2& ScrollCompletedSignal();
134 * @brief Signal emitted when the Scrollable is pushing against a domain boundary
135 * (in either position, scale, or rotation).
137 * @return The signal to connect to
139 ScrollClampedSignalV2& ScrollClampedSignal();
144 * @brief Creates an uninitialized Scrollable handle.
149 * @brief Copy constructor.
151 * Creates another handle that points to the same real object
153 * @param handle to copy from
155 Scrollable( const Scrollable& handle );
158 * @brief Assignment operator.
160 * Changes this handle to point to another real object
161 * @param[in] handle to copy from
162 * @return A reference to this
164 Scrollable& operator=( const Scrollable& handle );
167 * @brief Virtual destructor.
169 * Dali::Object derived classes typically do not contain member data.
171 virtual ~Scrollable();
174 * @brief Downcast an Object handle to Scrollable.
176 * If handle points to a Scrollable the downcast produces valid
177 * handle. If not the returned handle is left uninitialized.
179 * @param[in] handle Handle to an object
180 * @return handle to a Scrollable or an uninitialized handle
182 static Scrollable DownCast( BaseHandle handle );
185 * @brief Checks if a ScrollComponent has been enabled or not.
187 * @param[in] type The Scroll Component Type to check
188 * @return True (if Enabled)
190 bool IsScrollComponentEnabled(Scrollable::ScrollComponentType type) const;
193 * @brief Enables a ScrollComponent.
195 * @param[in] type The Scroll Component Type to enable
197 void EnableScrollComponent(Scrollable::ScrollComponentType type);
200 * @brief Disables a ScrollComponent.
202 * @param[in] type The Scroll Component Type to disable
204 void DisableScrollComponent(Scrollable::ScrollComponentType type);
206 public: // Not intended for application developers
209 * @brief Creates a handle using the Toolkit::Internal implementation.
211 * @param[in] implementation The Control implementation.
213 Scrollable(Internal::Scrollable& implementation);
216 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
218 * @param[in] internal A pointer to the internal CustomActor.
220 Scrollable( Dali::Internal::CustomActor* internal );
223 } // namespace Toolkit
230 #endif // __DALI_TOOLKIT_SCROLLABLE_H__