X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fscroll-bar%2Fscroll-bar.h;h=c9b04d8ed8c7a7ed74d341ca58b5ce3476e93b14;hp=5adb04c425a9a643747e7c82950c91806c697653;hb=c8ffcb9f46ded14981915479af62d85970798db5;hpb=818994dc0acac601b0b27c0b715259b504ef4ceb diff --git a/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h b/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h index 5adb04c..c9b04d8 100755 --- a/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h +++ b/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h @@ -1,27 +1,30 @@ #ifndef __DALI_TOOLKIT_SCROLL_BAR_H__ #define __DALI_TOOLKIT_SCROLL_BAR_H__ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include // INTERNAL INCLUDES -#include -#include +#include -namespace Dali DALI_IMPORT_API +namespace Dali { namespace Toolkit @@ -40,18 +43,37 @@ class ScrollBar; /** * ScrollBar is a UI component that can be added to the scrollable controls * indicating the current scroll position of the scrollable content. + * + * Signals + * | %Signal Name | Method | + * |--------------------------|-------------------------------------| + * | scroll-position-notified | @ref ScrollPositionNotifiedSignal() | */ -class ScrollBar : public Control +class DALI_IMPORT_API ScrollBar : public ScrollComponent { public: // Signals - static const char* const SCROLL_POSITION_NOTIFIED_SIGNAL_NAME; ///< "scroll-position-notified" signal name - typedef SignalV2< void ( float ) > ScrollPositionNotifiedSignalType; + typedef Signal< void ( float ) > ScrollPositionNotifiedSignalType; + + // Properties + static const Dali::Property::Index PROPERTY_INDICATOR_HEIGHT_POLICY; ///< name "indicator-height-policy", @see SetIndicatorHeightPolicy(), type STRING + static const Dali::Property::Index PROPERTY_INDICATOR_FIXED_HEIGHT; ///< name "indicator-fixed-height", @see SetIndicatorFixedHeight(), type FLOAT + static const Dali::Property::Index PROPERTY_INDICATOR_SHOW_DURATION; ///< name "indicator-show-duration", @see SetIndicatorShowDuration(), type FLOAT + static const Dali::Property::Index PROPERTY_INDICATOR_HIDE_DURATION; ///< name "indicator-hide-duration", @see SetIndicatorHideDuration(), type FLOAT public: /** + * @brief Indicator height policy. + */ + enum IndicatorHeightPolicy + { + Variable = 0, ///< Variable height changed dynamically according to the length of scroll content + Fixed ///< Fixed height regardless of the length of scroll content + }; + + /** * @brief Create an uninitialized ScrollBar; this can be initialized with ScrollBar::New() * Calling member functions with an uninitialized Dali::Object is not allowed. * or horizontally (false) @@ -69,10 +91,11 @@ public: ScrollBar& operator=( const ScrollBar& scrollBar ); /** - * @brief Virtual destructor. - * Dali::Object derived classes typically do not contain member data. + * @brief Destructor + * + * This is non-virtual since derived Handle types must not contain data or virtual methods. */ - virtual ~ScrollBar(); + ~ScrollBar(); /** * @brief Create an initialized ScrollBar @@ -89,59 +112,100 @@ public: static ScrollBar DownCast( BaseHandle handle ); /** - * @brief Sets the scroll connector for the scroll bar. + * @brief Sets the image for the indicator of scroll bar. * * @pre The scroll bar actor has been initialised. * - * @param[in] connector Scroll connector used to connect scrollable container with this ScrollBar + * The indicator image is resized (stretched according to scale settings), + * to reflect the size of the scroll indicator and minimum/maximum limits + * of the scroll position. + * + * @param[in] image The image of indicator that moves to indicate the current scroll position. */ - void SetScrollConnector( ScrollConnector connector ); + void SetIndicatorImage( Image image ); /** - * @brief Sets the image for the background of scroll indicator. + * @brief Gets the indicator of scroll bar. * * @pre The scroll bar actor has been initialised. * - * The background image is resized (stretched according to scale settings), - * to the size of the ScrollBar. + * @return The indicator indicates the current scroll position of the scrollable content. + */ + Actor GetScrollIndicator(); + + /** + * @brief Sets the values to get notification when the current scroll position of the scrollable + * content goes above or below any of these values. * - * @param[in] image The image to cover background - * @param[in] border The nine patch border for the image. + * @pre The scroll bar actor has been initialised. + * + * @param[in] positions List of values to receive notifications for when the current scroll position crosses them */ - void SetBackgroundImage( Image image, const Vector4& border ); + void SetPositionNotifications( const std::vector& positions ); /** - * @brief Sets the image for the indicator of scroll bar. + * @brief Sets the height policy of scroll indicator to have either variable or fixed height. * * @pre The scroll bar actor has been initialised. * - * The indicator image is resized (stretched according to scale settings), - * to reflect the size of the scroll indicator and minimum/maximum limits - * of the scroll position. + * @param[in] policy The height policy of scroll indicator + */ + void SetIndicatorHeightPolicy( IndicatorHeightPolicy policy ); + + /** + * @brief Gets the height policy of scroll indicator. * - * @param[in] image The image of indicator that moves to indicate the current scroll position. - * @param[in] border The nine patch border for the image. + * @return The height policy of scroll indicator */ - void SetIndicatorImage( Image image, const Vector4& border ); + IndicatorHeightPolicy GetIndicatorHeightPolicy(); /** - * @brief Gets the indicator of scroll bar. + * @brief Sets the fixed height of scroll indicator. + * Normally the height of scroll indicator is changed dynamically according to the length of scroll content. + * However, when the height policy of scroll indicator is set to be fixed, the height will keep fixed + * regardless of the length of scroll content. * * @pre The scroll bar actor has been initialised. * - * The indicator indicates the current scroll position of the scrollable content. + * @param[in] height The fixed height of the scroll indicator */ - Actor GetScrollIndicator(); + void SetIndicatorFixedHeight( float height ); /** - * @brief Sets the values to get notification when the current scroll position of the scrollable - * content goes above or below any of these values. + * @brief Gets the fix height of scroll indicator. + * @return The fixed height of the scroll indicator + */ + float GetIndicatorFixedHeight(); + + /** + * @brief Sets the duration in second for the scroll indicator to become fully visible * * @pre The scroll bar actor has been initialised. * - * @param[in] positions List of values to receive notifications for when the current scroll position crosses them + * @param[in] durationSeconds The duration for the scroll indicator to become fully visible */ - void SetPositionNotifications( const std::vector& positions ); + void SetIndicatorShowDuration( float durationSeconds ); + + /** + * @brief Gets the duration in second for the scroll indicator to become fully visible + * @return The duration for the scroll indicator to become fully visible + */ + float GetIndicatorShowDuration(); + + /** + * @brief Sets the duration in second for the scroll indicator to become fully invisible + * + * @pre The scroll bar actor has been initialised. + * + * @param[in] durationSeconds The duration for the scroll indicator to become fully invisible + */ + void SetIndicatorHideDuration( float durationSeconds ); + + /** + * @brief Gets the duration in second for the scroll indicator to become fully invisible + * @return The duration for the scroll indicator to become fully invisible + */ + float GetIndicatorHideDuration(); /** * @brief Shows the scroll indicator @@ -172,13 +236,13 @@ public: // Not intended for application developers * Creates a handle using the Toolkit::Internal implementation. * @param[in] implementation The Control implementation. */ - ScrollBar( Internal::ScrollBar& implementation ); + DALI_INTERNAL ScrollBar( Internal::ScrollBar& implementation ); /** * Allows the creation of this Control from an Internal::CustomActor pointer. * @param[in] internal A pointer to the internal CustomActor. */ - ScrollBar( Dali::Internal::CustomActor* internal ); + explicit DALI_INTERNAL ScrollBar( Dali::Internal::CustomActor* internal ); }; } // namespace Toolkit