X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fscrollable%2Fscrollable.h;h=b2622126f31421d56a258ce987bb474c792c0755;hb=50047908e4f93aca3d2924dd6f42f5ebdabe9967;hp=715134f99887e9563da27a4a1836b88040eddb58;hpb=e217915091790637a8b4ea7e34480e852d242efd;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/public-api/controls/scrollable/scrollable.h b/dali-toolkit/public-api/controls/scrollable/scrollable.h index 715134f..b262212 100644 --- a/dali-toolkit/public-api/controls/scrollable/scrollable.h +++ b/dali-toolkit/public-api/controls/scrollable/scrollable.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_SCROLLABLE_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 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. @@ -50,48 +50,46 @@ class DALI_IMPORT_API Scrollable : public Control public: /** - * @brief Scroll component types + * @brief The start and end property ranges for this control. */ - enum ScrollComponentType + enum PropertyRange { - HorizontalScrollBar, - VerticalScrollBar, - OvershootIndicator, - }; - - // Custom properties - - static const std::string SCROLL_RELATIVE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-relative-position", type VECTOR3 - static const std::string SCROLL_POSITION_MIN_PROPERTY_NAME; ///< Property, name "scroll-position-min", type VECTOR3 - static const std::string SCROLL_POSITION_MAX_PROPERTY_NAME; ///< Property, name "scroll-position-max", type VECTOR3 - static const std::string SCROLL_DIRECTION_PROPERTY_NAME; ///< Property, name "scroll-direction", type VECTOR2 - - /// @name Properties - /** @{ */ - static const Property::Index PROPERTY_OVERSHOOT_EFFECT_COLOR; ///< Property, name "overshoot-effect-color", @see SetOvershootEffectColor(), type VECTOR4 - static const Property::Index PROPERTY_OVERSHOOT_ANIMATION_SPEED; ///< Property, name "overshoot-animation-speed", @see SetOvershootAnimationSpeed(), type FLOAT - /** @} */ - -public: + PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices - typedef Signal< void ( const Vector3& ) > ScrollStartedSignalType; ///< ScrollStarted signal type - typedef Signal< void ( const Vector3& ) > ScrollCompletedSignalType; ///< ScrollCompleted signal type - typedef Signal< void ( const Vector3& ) > ScrollUpdatedSignalType; ///< Scroll updated signal type + ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, + ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve animatable property indices + }; /** - * @brief Signal emitted when the Scrollable has moved (whether by touch or animation). + * @brief An enumeration of properties belonging to the Scrollable class. */ - ScrollStartedSignalType& ScrollStartedSignal(); + struct Property + { + enum + { + // Event side properties + OVERSHOOT_EFFECT_COLOR = PROPERTY_START_INDEX, ///< Property, name "overshoot-effect-color", @see SetOvershootEffectColor(), type Vector4 + OVERSHOOT_ANIMATION_SPEED, ///< Property, name "overshoot-animation-speed", @see SetOvershootAnimationSpeed(), type float + + // Animatable properties + SCROLL_RELATIVE_POSITION = ANIMATABLE_PROPERTY_START_INDEX, ///< Property, name "scroll-relative-position", type Vector2 + SCROLL_POSITION_MIN, ///< Property, name "scroll-position-min", type Vector2 + SCROLL_POSITION_MIN_X, ///< Property, name "scroll-position-min-x", type float + SCROLL_POSITION_MIN_Y, ///< Property, name "scroll-position-min-y", type float + SCROLL_POSITION_MAX, ///< Property, name "scroll-position-max", type Vector2 + SCROLL_POSITION_MAX_X, ///< Property, name "scroll-position-max-x", type float + SCROLL_POSITION_MAX_Y, ///< Property, name "scroll-position-max-y", type float + CAN_SCROLL_VERTICAL, ///< Property, name "can-scroll-vertical", type bool + CAN_SCROLL_HORIZONTAL ///< Property, name "can-scroll-horizontal", type bool + }; + }; - /** - * @brief Signal emitted when the Scrollable has moved (whether by touch or animation). - */ - ScrollUpdatedSignalType& ScrollUpdatedSignal(); + // Typedefs - /** - * @brief Signal emitted when the Scrollable has completed movement (whether by touch or animation). - */ - ScrollCompletedSignalType& ScrollCompletedSignal(); + typedef Signal< void ( const Vector2& ) > ScrollStartedSignalType; ///< ScrollStarted signal type + typedef Signal< void ( const Vector2& ) > ScrollCompletedSignalType; ///< ScrollCompleted signal type + typedef Signal< void ( const Vector2& ) > ScrollUpdatedSignalType; ///< Scroll updated signal type public: @@ -137,26 +135,18 @@ public: static Scrollable DownCast( BaseHandle handle ); /** - * @brief Checks if a ScrollComponent has been enabled or not. - * - * @param[in] type The Scroll Component Type to check - * @return True (if Enabled) - */ - bool IsScrollComponentEnabled(Scrollable::ScrollComponentType type) const; - - /** - * @brief Enables a ScrollComponent. + * @brief Checks if scroll overshoot has been enabled or not. * - * @param[in] type The Scroll Component Type to enable + * @return Whether the scroll obvershoot is enabled */ - void EnableScrollComponent(Scrollable::ScrollComponentType type); + bool IsOvershootEnabled() const; /** - * @brief Disables a ScrollComponent. + * @brief Sets whether to enables or disable scroll overshoot. * - * @param[in] type The Scroll Component Type to disable + * @param[in] enable Whether to enable the scroll obvershoot or not */ - void DisableScrollComponent(Scrollable::ScrollComponentType type); + void SetOvershootEnabled(bool enable); /** * @brief Set the color of the overshoot effect. @@ -184,6 +174,44 @@ public: */ float GetOvershootAnimationSpeed() const; +public: // Signals + + /** + * @brief Signal emitted when the Scrollable has moved (whether by touch or animation). + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(const Vector2& currentScrollPosition); + * @endcode + * @pre The Object has been initialized. + * @return The signal to connect to. + */ + ScrollStartedSignalType& ScrollStartedSignal(); + + /** + * @brief Signal emitted when the Scrollable has moved (whether by touch or animation). + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(const Vector2& currentScrollPosition); + * @endcode + * @pre The Object has been initialized. + * @return The signal to connect to. + */ + ScrollUpdatedSignalType& ScrollUpdatedSignal(); + + /** + * @brief Signal emitted when the Scrollable has completed movement (whether by touch or animation). + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(const Vector2& currentScrollPosition); + * @endcode + * @pre The Object has been initialized. + * @return The signal to connect to. + */ + ScrollCompletedSignalType& ScrollCompletedSignal(); + public: // Not intended for application developers /**