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 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/dali.h>
23 #include <dali-toolkit/public-api/controls/scrollable/scroll-component.h>
25 namespace Dali DALI_IMPORT_API
31 // Forward declarations
32 class ScrollConnector;
34 namespace Internal DALI_INTERNAL
36 // Forward declarations
42 * ScrollBar is a UI component that can be added to the scrollable controls
43 * indicating the current scroll position of the scrollable content.
45 class ScrollBar : public ScrollComponent
50 static const char* const SCROLL_POSITION_NOTIFIED_SIGNAL_NAME; ///< "scroll-position-notified" signal name
51 typedef SignalV2< void ( float ) > ScrollPositionNotifiedSignalType;
56 * @brief Create an uninitialized ScrollBar; this can be initialized with ScrollBar::New()
57 * Calling member functions with an uninitialized Dali::Object is not allowed.
58 * or horizontally (false)
63 * @brief Copy constructor.
65 ScrollBar( const ScrollBar& scrollBar );
68 * @brief Assignment operator.
70 ScrollBar& operator=( const ScrollBar& scrollBar );
73 * @brief Virtual destructor.
74 * Dali::Object derived classes typically do not contain member data.
79 * @brief Create an initialized ScrollBar
80 * @return A pointer to the created ScrollBar.
82 static ScrollBar New();
85 * @brief Downcast an Object handle to ScrollBar. If handle points to a ScrollBar the
86 * downcast produces valid handle. If not the returned handle is left uninitialized.
87 * @param[in] handle Handle to an object
88 * @return handle to a ScrollBar or an uninitialized handle
90 static ScrollBar DownCast( BaseHandle handle );
93 * @brief Sets the image for the background of scroll indicator.
95 * @pre The scroll bar actor has been initialised.
97 * The background image is resized (stretched according to scale settings),
98 * to the size of the ScrollBar.
100 * @param[in] image The image to cover background
101 * @param[in] border The nine patch border for the image.
103 void SetBackgroundImage( Image image, const Vector4& border );
106 * @brief Sets the image for the indicator of scroll bar.
108 * @pre The scroll bar actor has been initialised.
110 * The indicator image is resized (stretched according to scale settings),
111 * to reflect the size of the scroll indicator and minimum/maximum limits
112 * of the scroll position.
114 * @param[in] image The image of indicator that moves to indicate the current scroll position.
115 * @param[in] border The nine patch border for the image.
117 void SetIndicatorImage( Image image, const Vector4& border );
120 * @brief Gets the indicator of scroll bar.
122 * @pre The scroll bar actor has been initialised.
124 * The indicator indicates the current scroll position of the scrollable content.
126 Actor GetScrollIndicator();
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.
132 * @pre The scroll bar actor has been initialised.
134 * @param[in] positions List of values to receive notifications for when the current scroll position crosses them
136 void SetPositionNotifications( const std::vector<float>& positions );
139 * @brief Shows the scroll indicator
144 * @brief Hides the scroll indicator
149 * @brief Signal emitted when the current scroll position of the scrollable content goes above or below the values
150 * specified by SetPositionNotifications.
152 * A callback of the following type may be connected:
154 * void YourCallbackName(float currentScrollPosition);
156 * @pre The Object has been initialized.
157 * @return The signal to connect to.
159 ScrollBar::ScrollPositionNotifiedSignalType& ScrollPositionNotifiedSignal();
161 public: // Not intended for application developers
164 * Creates a handle using the Toolkit::Internal implementation.
165 * @param[in] implementation The Control implementation.
167 ScrollBar( Internal::ScrollBar& implementation );
170 * Allows the creation of this Control from an Internal::CustomActor pointer.
171 * @param[in] internal A pointer to the internal CustomActor.
173 ScrollBar( Dali::Internal::CustomActor* internal );
176 } // namespace Toolkit
183 #endif // __DALI_TOOLKIT_SCROLL_BAR_H__