dali-toolkit property type comment to represent type instead of property enum
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / scrollable / scrollable.h
1 #ifndef __DALI_TOOLKIT_SCROLLABLE_H__
2 #define __DALI_TOOLKIT_SCROLLABLE_H__
3
4 /*
5  * Copyright (c) 2014 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
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 class Scrollable;
33 }
34
35 /**
36  * @brief Base class for derived Scrollables that contains actors that can be scrolled manually
37  * (via touch) or automatically.
38  *
39  * Scrollables such as ScrollView and ItemView can be derived from this class.
40  *
41  * Signals
42  * | %Signal Name      | Method                       |
43  * |-------------------|------------------------------|
44  * | scroll-started    | @ref ScrollStartedSignal()   |
45  * | scroll-completed  | @ref ScrollUpdatedSignal()   |
46  * | scroll-updated    | @ref ScrollCompletedSignal() |
47  */
48 class DALI_IMPORT_API Scrollable : public Control
49 {
50 public:
51
52   /**
53    * @brief Scroll component types
54    */
55   enum ScrollComponentType
56   {
57     HorizontalScrollBar,
58     VerticalScrollBar,
59     OvershootIndicator,
60   };
61
62   // Custom properties
63
64   static const std::string SCROLL_RELATIVE_POSITION_PROPERTY_NAME;      ///< Property, name "scroll-relative-position", type Vector3
65   static const std::string SCROLL_POSITION_MIN_PROPERTY_NAME;           ///< Property, name "scroll-position-min",      type Vector3
66   static const std::string SCROLL_POSITION_MAX_PROPERTY_NAME;           ///< Property, name "scroll-position-max",      type Vector3
67   static const std::string SCROLL_DIRECTION_PROPERTY_NAME;              ///< Property, name "scroll-direction",         type Vector2
68
69   /**
70    * @brief The start and end property ranges for this control.
71    */
72   enum PropertyRange
73   {
74     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
75     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices
76   };
77
78   /**
79    * @brief An enumeration of properties belonging to the Scrollable class.
80    */
81   struct Property
82   {
83     enum
84     {
85       OVERSHOOT_EFFECT_COLOR = PROPERTY_START_INDEX, ///< Property, name "overshoot-effect-color",    @see SetOvershootEffectColor(),    type Vector4
86       OVERSHOOT_ANIMATION_SPEED,                     ///< Property, name "overshoot-animation-speed", @see SetOvershootAnimationSpeed(), type float
87     };
88   };
89
90 public:
91
92   typedef Signal< void ( const Vector3& ) > ScrollStartedSignalType;   ///< ScrollStarted signal type
93   typedef Signal< void ( const Vector3& ) > ScrollCompletedSignalType; ///< ScrollCompleted signal type
94   typedef Signal< void ( const Vector3& ) > ScrollUpdatedSignalType;   ///< Scroll updated signal type
95
96   /**
97    * @brief Signal emitted when the Scrollable has moved (whether by touch or animation).
98    */
99   ScrollStartedSignalType& ScrollStartedSignal();
100
101   /**
102    * @brief Signal emitted when the Scrollable has moved (whether by touch or animation).
103    */
104   ScrollUpdatedSignalType& ScrollUpdatedSignal();
105
106   /**
107    * @brief Signal emitted when the Scrollable has completed movement (whether by touch or animation).
108    */
109   ScrollCompletedSignalType& ScrollCompletedSignal();
110
111 public:
112
113   /**
114    * @brief Creates an uninitialized Scrollable handle.
115    */
116   Scrollable();
117
118   /**
119    * @brief Copy constructor.
120    *
121    * Creates another handle that points to the same real object
122    *
123    * @param handle to copy from
124    */
125   Scrollable( const Scrollable& handle );
126
127   /**
128    * @brief Assignment operator.
129    *
130    * Changes this handle to point to another real object
131    * @param[in] handle to copy from
132    * @return A reference to this
133    */
134   Scrollable& operator=( const Scrollable& handle );
135
136   /**
137    * @brief Destructor
138    *
139    * This is non-virtual since derived Handle types must not contain data or virtual methods.
140    */
141   ~Scrollable();
142
143   /**
144    * @brief Downcast an Object handle to Scrollable.
145    *
146    * If handle points to a Scrollable the downcast produces valid
147    * handle. If not the returned handle is left uninitialized.
148    *
149    * @param[in] handle Handle to an object
150    * @return handle to a Scrollable or an uninitialized handle
151    */
152   static Scrollable DownCast( BaseHandle handle );
153
154   /**
155    * @brief Checks if a ScrollComponent has been enabled or not.
156    *
157    * @param[in] type The Scroll Component Type to check
158    * @return True (if Enabled)
159    */
160   bool IsScrollComponentEnabled(Scrollable::ScrollComponentType type) const;
161
162   /**
163    * @brief Enables a ScrollComponent.
164    *
165    * @param[in] type The Scroll Component Type to enable
166    */
167   void EnableScrollComponent(Scrollable::ScrollComponentType type);
168
169   /**
170    * @brief Disables a ScrollComponent.
171    *
172    * @param[in] type The Scroll Component Type to disable
173    */
174   void DisableScrollComponent(Scrollable::ScrollComponentType type);
175
176   /**
177    * @brief Set the color of the overshoot effect.
178    *
179    * @param[in] color The color of the overshoot effect.
180    */
181   void SetOvershootEffectColor( const Vector4& color );
182
183   /**
184    * @brief Get the color of the overshoot effect.
185    * @return The color of the overshoot effect.
186    */
187   Vector4 GetOvershootEffectColor() const;
188
189   /**
190    * @brief Set the speed of overshoot animation in pixels per second.
191    * When the speed is not greater than 0, the overshoot is set instantly with no animation.
192    * @param[in] pixelsPerSecond The speed of the overshoot animation.
193    */
194   void SetOvershootAnimationSpeed( float pixelsPerSecond );
195
196   /**
197    * @brief Get the speed of overshoot animation in pixels per second.
198    * @return The speed of the overshoot animation.
199    */
200   float GetOvershootAnimationSpeed() const;
201
202 public: // Not intended for application developers
203
204   /**
205    * @brief Creates a handle using the Toolkit::Internal implementation.
206    *
207    * @param[in]  implementation  The Control implementation.
208    */
209   DALI_INTERNAL Scrollable(Internal::Scrollable& implementation);
210
211   /**
212    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
213    *
214    * @param[in]  internal  A pointer to the internal CustomActor.
215    */
216   explicit DALI_INTERNAL Scrollable( Dali::Internal::CustomActor* internal );
217 };
218
219 } // namespace Toolkit
220
221 } // namespace Dali
222
223 #endif // __DALI_TOOLKIT_SCROLLABLE_H__