X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscrollable%2Fscrollable-impl.h;h=4240a1e46c0c5cfacac359a2277ec06d519b5ac8;hb=4ea0e77009c95a4bb670a8ff44bd842b94f2271b;hp=72cc47adc5bc4ad924105a08a8160fa82e07ca4c;hpb=f77f0cb417df66a09f468c974e14b881142cf15b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/scrollable/scrollable-impl.h b/dali-toolkit/internal/controls/scrollable/scrollable-impl.h index 72cc47a..4240a1e 100644 --- a/dali-toolkit/internal/controls/scrollable/scrollable-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scrollable-impl.h @@ -1,78 +1,56 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_SCROLLABLE_H__ -#define __DALI_TOOLKIT_INTERNAL_SCROLLABLE_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. -// +#ifndef DALI_TOOLKIT_INTERNAL_SCROLLABLE_H +#define DALI_TOOLKIT_INTERNAL_SCROLLABLE_H + +/* + * Copyright (c) 2021 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. + * + */ -// INTERNAL INCLUDES -#include +// EXTERNAL INCLUDES +#include +// INTERNAL INCLUDES +#include +#include #include #include -#include namespace Dali { - namespace Toolkit { - namespace Internal { - class Scrollable; typedef IntrusivePtr ScrollablePtr; /** * @copydoc Toolkit::Scrollable */ -class Scrollable : public ControlImpl +class Scrollable : public Control { public: - static const std::string SCROLLABLE_CAN_SCROLL_VERTICAL; - static const std::string SCROLLABLE_CAN_SCROLL_HORIZONTAL; - - /** - * Create a new Scrollable. - * @return A public handle to the newly allocated Scrollable. - */ -// static Dali::Toolkit::Scrollable New(); - -public: - - /** - * @copydoc Dali::Toolkit::Scrollable::IsScrollComponentEnabled(Scrollable::ScrollComponentType type) - */ - bool IsScrollComponentEnabled(Toolkit::Scrollable::ScrollComponentType type) const; - - /** - * @copydoc Dali::Toolkit::Scrollable::EnableScrollComponent(Scrollable::ScrollComponentType type) - */ - void EnableScrollComponent(Toolkit::Scrollable::ScrollComponentType type); - /** - * @copydoc Dali::Toolkit::Scrollable::DisableScrollComponent(Scrollable::ScrollComponentType type) + * @copydoc Dali::Toolkit::Scrollable::IsOvershootEnabled */ - void DisableScrollComponent(Toolkit::Scrollable::ScrollComponentType type); + bool IsOvershootEnabled() const; /** - * Gets the size of the domain (minimum/maximum extents for each axis to scroll to) - * @return the domain size + * @copydoc Dali::Toolkit::Scrollable::SetOvershootEnabled */ - virtual Vector3 GetDomainSize() const = 0; + void SetOvershootEnabled(bool enable); /** * Adds actor as an Overlay to Scrollable @@ -94,7 +72,7 @@ public: * Retrieves current scroll position. * @returns The current scroll position. */ - virtual Vector3 GetCurrentScrollPosition() const = 0; + virtual Vector2 GetCurrentScrollPosition() const = 0; /** * Scrolls Scrollable to position specified (contents will scroll to this position) @@ -103,38 +81,79 @@ public: * @param[in] position The position to scroll to. * @param[in] duration The duration of the animation in seconds */ - virtual void ScrollTo(const Vector3 &position, float duration) = 0; + virtual void ScrollTo(const Vector2& position, float duration) = 0; -private: + /** + * Set the color of the overshoot effect. + * @parm[in] color The color of the overshoot effect + */ + virtual void SetOvershootEffectColor(const Vector4& color) = 0; /** - * Temporary function to override EnableScrollComponent functionality for overshoot + * Retrieve the color of the overshoot effect. + * @return The color of the overshoot effect. + */ + Vector4 GetOvershootEffectColor() const; + + /** + * @copydoc Dali::Toolkit::Scrollable::SetOvershootAnimationSpeed(float pixelsPerSecond) + */ + void SetOvershootAnimationSpeed(float pixelsPerSecond); + + /** + * @copydoc Dali::Toolkit::Scrollable::GetOvershootAnimationSpeed() + */ + float GetOvershootAnimationSpeed() const; + + /** + * @copydoc Dali::Toolkit::Scrollable::GetOvershootSize() + */ + const Vector2& GetOvershootSize() const; + + /** + * Set the size of the overshoot effect. + * @parm[in] size The size of the overshoot effect + */ + virtual void SetOvershootSize(const Vector2& size) = 0; + +protected: // From Control + struct AccessibleImpl : public DevelControl::AccessibleImpl + { + using DevelControl::AccessibleImpl::AccessibleImpl; + + bool IsScrollable() override; + }; + + /** + * @copydoc Control::OnInitialize + */ + virtual void OnInitialize() override; + +private: + /** + * Temporary function to override EnableScrollOvershoot functionality for overshoot * Only ScrollView needs to override this as HQ has not requested disable functionality in ItemView * @param[in] enable true to enable, false to disable overshoot indicator */ - virtual void SetOvershootEnabled(bool enable) {} + virtual void EnableScrollOvershoot(bool enable) + { + } public: //Signals - /** * @copydoc Dali::Toolkit::Scrollable::ScrollStartedSignal() */ - Toolkit::Scrollable::ScrollStartedSignalV2& ScrollStartedSignal(); + Toolkit::Scrollable::ScrollStartedSignalType& ScrollStartedSignal(); /** * @copydoc Dali::Toolkit::Scrollable::ScrollUpdatedSignal() */ - Toolkit::Scrollable::ScrollUpdatedSignalV2& ScrollUpdatedSignal(); + Toolkit::Scrollable::ScrollUpdatedSignalType& ScrollUpdatedSignal(); /** * @copydoc Dali::Toolkit::Scrollable::ScrollCompletedSignal() */ - Toolkit::Scrollable::ScrollCompletedSignalV2& ScrollCompletedSignal(); - - /** - * @copydoc Dali::Toolkit::Scrollable::ScrollClampedSignal() - */ - Toolkit::Scrollable::ScrollClampedSignalV2& ScrollClampedSignal(); + Toolkit::Scrollable::ScrollCompletedSignalType& ScrollCompletedSignal(); /** * Connects a callback function with the object's signals. @@ -145,73 +164,72 @@ public: //Signals * @return True if the signal was connected. * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. */ - static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); + static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor); -protected: + //properties /** - * Construct a new Scrollable. + * Called when a property of an object of this type is set. + * @param[in] object The object whose property is set. + * @param[in] index The property index. + * @param[in] value The new property value. */ - Scrollable(); + static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value); /** - * A reference counted object may only be deleted by calling Unreference() + * Called to retrieve a property of an object of this type. + * @param[in] object The object whose property is to be retrieved. + * @param[in] index The property index. + * @return The current value of the property. */ - virtual ~Scrollable(); + static Property::Value GetProperty(BaseObject* object, Property::Index index); +protected: /** - * Register common properties + * Removed default constructor. */ - void RegisterCommonProperties(); + Scrollable() = delete; -private: + /** + * @brief Construct a new Scrollable. + * + * @param[in] behaviourFlags Flags to enable + */ + Scrollable(ControlBehaviour behaviourFlags); + + /** + * A reference counted object may only be deleted by calling Unreference() + */ + virtual ~Scrollable(); +private: /** * Gets position property. * * @return The current position */ - Vector3 GetPropertyPosition() const; + Vector2 GetPropertyPosition() const; private: - // Undefined Scrollable(const Scrollable&); // Undefined Scrollable& operator=(const Scrollable& rhs); - /** - * Helper to create an initialized ScrollComponent - * @param[in] scrollable reference to ScrollView implementation - * @param[in] type the type of scroll component to create. - * @return A pointer to the created ScrollComponent. - */ - Toolkit::ScrollComponent NewScrollComponent(Toolkit::Scrollable& scrollable, Toolkit::Scrollable::ScrollComponentType type); - protected: + Vector4 mOvershootEffectColor; /// mComponent; ///< ScrollComponent (such as a scrollbar/page indicator/status) + Dali::AlphaFunction::BuiltinFunction mScrollToAlphaFunction; ///< The ScrollTo() animations use this - Toolkit::Scrollable::ScrollStartedSignalV2 mScrollStartedSignalV2; - Toolkit::Scrollable::ScrollUpdatedSignalV2 mScrollUpdatedSignalV2; - Toolkit::Scrollable::ScrollCompletedSignalV2 mScrollCompletedSignalV2; - Toolkit::Scrollable::ScrollClampedSignalV2 mScrollClampedSignalV2; + Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal; + Toolkit::Scrollable::ScrollUpdatedSignalType mScrollUpdatedSignal; + Toolkit::Scrollable::ScrollCompletedSignalType mScrollCompletedSignal; private: - - typedef std::map ComponentContainer; - typedef ComponentContainer::iterator ComponentIter; - - ComponentContainer mComponents; ///< ScrollComponent (such as a scrollbar/page indicator/status) - bool mOvershootEnabled; + bool mOvershootEnabled : 1; }; } // namespace Internal @@ -240,4 +258,4 @@ inline const Toolkit::Internal::Scrollable& GetImpl(const Toolkit::Scrollable& s } // namespace Dali -#endif // __DALI_TOOLKIT_INTERNAL_SCROLLABLE_H__ +#endif // DALI_TOOLKIT_INTERNAL_SCROLLABLE_H