1 #ifndef __DALI_TOOLKIT_SCROLL_BAR_H__
2 #define __DALI_TOOLKIT_SCROLL_BAR_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 #include <dali/dali.h>
22 #include <dali-toolkit/public-api/controls/scrollable/scroll-component.h>
24 namespace Dali DALI_IMPORT_API
30 // Forward declarations
31 class ScrollConnector;
33 namespace Internal DALI_INTERNAL
35 // Forward declarations
41 * ScrollBar is a UI component that can be added to the scrollable controls
42 * indicating the current scroll position of the scrollable content.
44 class ScrollBar : public ScrollComponent
49 static const char* const SCROLL_POSITION_NOTIFIED_SIGNAL_NAME; ///< "scroll-position-notified" signal name
50 typedef SignalV2< void ( float ) > ScrollPositionNotifiedSignalType;
55 * @brief Create an uninitialized ScrollBar; this can be initialized with ScrollBar::New()
56 * Calling member functions with an uninitialized Dali::Object is not allowed.
57 * or horizontally (false)
62 * @brief Copy constructor.
64 ScrollBar( const ScrollBar& scrollBar );
67 * @brief Assignment operator.
69 ScrollBar& operator=( const ScrollBar& scrollBar );
72 * @brief Virtual destructor.
73 * Dali::Object derived classes typically do not contain member data.
78 * @brief Create an initialized ScrollBar
79 * @return A pointer to the created ScrollBar.
81 static ScrollBar New();
84 * @brief Downcast an Object handle to ScrollBar. If handle points to a ScrollBar the
85 * downcast produces valid handle. If not the returned handle is left uninitialized.
86 * @param[in] handle Handle to an object
87 * @return handle to a ScrollBar or an uninitialized handle
89 static ScrollBar DownCast( BaseHandle handle );
92 * @brief Sets the image for the background of scroll indicator.
94 * @pre The scroll bar actor has been initialised.
96 * The background image is resized (stretched according to scale settings),
97 * to the size of the ScrollBar.
99 * @param[in] image The image to cover background
100 * @param[in] border The nine patch border for the image.
102 void SetBackgroundImage( Image image, const Vector4& border );
105 * @brief Sets the image for the indicator of scroll bar.
107 * @pre The scroll bar actor has been initialised.
109 * The indicator image is resized (stretched according to scale settings),
110 * to reflect the size of the scroll indicator and minimum/maximum limits
111 * of the scroll position.
113 * @param[in] image The image of indicator that moves to indicate the current scroll position.
114 * @param[in] border The nine patch border for the image.
116 void SetIndicatorImage( Image image, const Vector4& border );
119 * @brief Gets the indicator of scroll bar.
121 * @pre The scroll bar actor has been initialised.
123 * The indicator indicates the current scroll position of the scrollable content.
125 Actor GetScrollIndicator();
128 * @brief Sets the values to get notification when the current scroll position of the scrollable
129 * content goes above or below any of these values.
131 * @pre The scroll bar actor has been initialised.
133 * @param[in] positions List of values to receive notifications for when the current scroll position crosses them
135 void SetPositionNotifications( const std::vector<float>& positions );
138 * @brief Shows the scroll indicator
143 * @brief Hides the scroll indicator
148 * @brief Signal emitted when the current scroll position of the scrollable content goes above or below the values
149 * specified by SetPositionNotifications.
151 * A callback of the following type may be connected:
153 * void YourCallbackName(float currentScrollPosition);
155 * @pre The Object has been initialized.
156 * @return The signal to connect to.
158 ScrollBar::ScrollPositionNotifiedSignalType& ScrollPositionNotifiedSignal();
160 public: // Not intended for application developers
163 * Creates a handle using the Toolkit::Internal implementation.
164 * @param[in] implementation The Control implementation.
166 ScrollBar( Internal::ScrollBar& implementation );
169 * Allows the creation of this Control from an Internal::CustomActor pointer.
170 * @param[in] internal A pointer to the internal CustomActor.
172 ScrollBar( Dali::Internal::CustomActor* internal );
175 } // namespace Toolkit
182 #endif // __DALI_TOOLKIT_SCROLL_BAR_H__