Remove Deprecated APIs
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / scroll-bar / scroll-bar.h
1 #ifndef __DALI_TOOLKIT_SCROLL_BAR_H__
2 #define __DALI_TOOLKIT_SCROLL_BAR_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/dali.h>
23 #include <dali-toolkit/public-api/controls/scrollable/scroll-component.h>
24
25 namespace Dali DALI_IMPORT_API
26 {
27
28 namespace Toolkit
29 {
30
31 // Forward declarations
32 class ScrollConnector;
33
34 namespace Internal DALI_INTERNAL
35 {
36 // Forward declarations
37
38 class ScrollBar;
39 }
40
41 /**
42  * ScrollBar is a UI component that can be added to the scrollable controls
43  * indicating the current scroll position of the scrollable content.
44  */
45 class ScrollBar : public ScrollComponent
46 {
47 public:
48
49   // Signals
50   static const char* const SCROLL_POSITION_NOTIFIED_SIGNAL_NAME;        ///< "scroll-position-notified" signal name
51   typedef SignalV2< void ( float ) > ScrollPositionNotifiedSignalType;
52
53   // Properties
54   static const Property::Index PROPERTY_INDICATOR_HEIGHT_POLICY;         ///< name "indicator-height-policy", type STRING
55   static const Property::Index PROPERTY_INDICATOR_FIXED_HEIGHT;          ///< name "indicator-fixed-height",  type FLOAT
56
57 public:
58
59   /**
60    * @brief Indicator height policy.
61    */
62   enum IndicatorHeightPolicy
63   {
64     Variable = 0,  ///< Variable height changed dynamically according to the length of scroll content
65     Fixed          ///< Fixed height regardless of the length of scroll content
66   };
67
68   /**
69    * @brief Create an uninitialized ScrollBar; this can be initialized with ScrollBar::New()
70    * Calling member functions with an uninitialized Dali::Object is not allowed.
71    * or horizontally (false)
72    */
73   ScrollBar();
74
75   /**
76    * @brief Copy constructor.
77    */
78   ScrollBar( const ScrollBar& scrollBar );
79
80   /**
81    * @brief Assignment operator.
82    */
83   ScrollBar& operator=( const ScrollBar& scrollBar );
84
85   /**
86    * @brief Destructor
87    *
88    * This is non-virtual since derived Handle types must not contain data or virtual methods.
89    */
90   ~ScrollBar();
91
92   /**
93    * @brief Create an initialized ScrollBar
94    * @return A pointer to the created ScrollBar.
95    */
96   static ScrollBar New();
97
98   /**
99    * @brief Downcast an Object handle to ScrollBar. If handle points to a ScrollBar the
100    * downcast produces valid handle. If not the returned handle is left uninitialized.
101    * @param[in] handle Handle to an object
102    * @return handle to a ScrollBar or an uninitialized handle
103    */
104   static ScrollBar DownCast( BaseHandle handle );
105
106   /**
107    * @brief Sets the image for the indicator of scroll bar.
108    *
109    * @pre The scroll bar actor has been initialised.
110    *
111    * The indicator image is resized (stretched according to scale settings),
112    * to reflect the size of the scroll indicator and minimum/maximum limits
113    * of the scroll position.
114    *
115    * @param[in] image The image of indicator that moves to indicate the current scroll position.
116    */
117   void SetIndicatorImage( Image image );
118
119   /**
120    * @brief Gets the indicator of scroll bar.
121    *
122    * @pre The scroll bar actor has been initialised.
123    *
124    * @return The indicator indicates the current scroll position of the scrollable content.
125    */
126   Actor GetScrollIndicator();
127
128   /**
129    * @brief Sets the values to get notification when the current scroll position of the scrollable
130    * content goes above or below any of these values.
131    *
132    * @pre The scroll bar actor has been initialised.
133    *
134    * @param[in] positions List of values to receive notifications for when the current scroll position crosses them
135    */
136   void SetPositionNotifications( const std::vector<float>& positions );
137
138   /**
139    * @brief Sets the height policy of scroll indicator to have either variable or fixed height.
140    *
141    * @pre The scroll bar actor has been initialised.
142    *
143    * @param[in] policy The height policy of scroll indicator
144    */
145   void SetIndicatorHeightPolicy( IndicatorHeightPolicy policy );
146
147   /**
148    * @brief Gets the height policy of scroll indicator.
149    *
150    * @return The height policy of scroll indicator
151    */
152   IndicatorHeightPolicy GetIndicatorHeightPolicy();
153
154   /**
155    * @brief Sets the fixed height of scroll indicator.
156    * Normally the height of scroll indicator is changed dynamically according to the length of scroll content.
157    * However, when the height policy of scroll indicator is set to be fixed, the height will keep fixed
158    * regardless of the length of scroll content.
159    *
160    * @pre The scroll bar actor has been initialised.
161    *
162    * @param[in] height The fixed height of the scroll indicator
163    */
164   void SetIndicatorFixedHeight( float height );
165
166   /**
167    * @brief Gets the fix height of scroll indicator.
168    * @return The fixed height of the scroll indicator
169    */
170   float GetIndicatorFixedHeight();
171
172   /**
173    * @brief Shows the scroll indicator
174    */
175   void Show();
176
177   /**
178    * @brief Hides the scroll indicator
179    */
180   void Hide();
181
182   /**
183    * @brief Signal emitted when the current scroll position of the scrollable content goes above or below the values
184    * specified by SetPositionNotifications.
185    *
186    * A callback of the following type may be connected:
187    * @code
188    *   void YourCallbackName(float currentScrollPosition);
189    * @endcode
190    * @pre The Object has been initialized.
191    * @return The signal to connect to.
192    */
193   ScrollBar::ScrollPositionNotifiedSignalType& ScrollPositionNotifiedSignal();
194
195 public: // Not intended for application developers
196
197   /**
198    * Creates a handle using the Toolkit::Internal implementation.
199    * @param[in]  implementation  The Control implementation.
200    */
201   ScrollBar( Internal::ScrollBar& implementation );
202
203   /**
204    * Allows the creation of this Control from an Internal::CustomActor pointer.
205    * @param[in]  internal  A pointer to the internal CustomActor.
206    */
207   ScrollBar( Dali::Internal::CustomActor* internal );
208 };
209
210 } // namespace Toolkit
211
212 } // namespace Dali
213
214 /**
215  * @}
216  */
217 #endif // __DALI_TOOLKIT_SCROLL_BAR_H__