[AT-SPI] Fix role setting
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / scrollable-impl.h
index 799ed62..ee1e02c 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_SCROLLABLE_H__
-#define __DALI_TOOLKIT_INTERNAL_SCROLLABLE_H__
+#ifndef DALI_TOOLKIT_INTERNAL_SCROLLABLE_H
+#define DALI_TOOLKIT_INTERNAL_SCROLLABLE_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/common/map-wrapper.h>
+#include <dali/public-api/animation/alpha-function.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
-#include <dali-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
 
 namespace Dali
 {
@@ -44,37 +43,16 @@ typedef IntrusivePtr<Scrollable> ScrollablePtr;
 class Scrollable : public Control
 {
 public:
-  static const char* const SCROLLABLE_CAN_SCROLL_VERTICAL;
-  static const char* const SCROLLABLE_CAN_SCROLL_HORIZONTAL;
 
   /**
-   * Create a new Scrollable.
-   * @return A public handle to the newly allocated Scrollable.
+   * @copydoc Dali::Toolkit::Scrollable::IsOvershootEnabled
    */
-//  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);
+  bool IsOvershootEnabled() const;
 
   /**
-   * @copydoc Dali::Toolkit::Scrollable::DisableScrollComponent(Scrollable::ScrollComponentType type)
+   * @copydoc Dali::Toolkit::Scrollable::SetOvershootEnabled
    */
-  void DisableScrollComponent(Toolkit::Scrollable::ScrollComponentType type);
-
-  /**
-   * Gets the size of the domain (minimum/maximum extents for each axis to scroll to)
-   * @return the domain size
-   */
-  virtual Vector3 GetDomainSize() const = 0;
+  void SetOvershootEnabled(bool enable);
 
   /**
    * Adds actor as an Overlay to Scrollable
@@ -96,7 +74,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)
@@ -105,7 +83,7 @@ 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;
 
   /**
    * Set the color of the overshoot effect.
@@ -129,14 +107,32 @@ public:
    */
   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
+
+  /**
+   * @copydoc Control::OnInitialize
+   */
+  virtual void OnInitialize() override;
+
 private:
 
   /**
-   * Temporary function to override EnableScrollComponent functionality for overshoot
+   * 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
 
@@ -187,19 +183,21 @@ public: //Signals
 protected:
 
   /**
-   * Construct a new Scrollable.
+   * Removed default constructor.
    */
-  Scrollable();
+  Scrollable() = delete;
 
   /**
-   * A reference counted object may only be deleted by calling Unreference()
+   * @brief Construct a new Scrollable.
+   *
+   * @param[in] behaviourFlags Flags to enable
    */
-  virtual ~Scrollable();
+  Scrollable( ControlBehaviour behaviourFlags );
 
   /**
-   * Register common properties
+   * A reference counted object may only be deleted by calling Unreference()
    */
-  void RegisterCommonProperties();
+  virtual ~Scrollable();
 
 private:
 
@@ -208,7 +206,7 @@ private:
    *
    * @return The current position
    */
-  Vector3 GetPropertyPosition() const;
+  Vector2 GetPropertyPosition() const;
 
 private:
 
@@ -218,27 +216,13 @@ private:
   // 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;    ///<The color of the overshoot bouncing effect
   float           mOvershootAnimationSpeed; ///<The speed of the overshoot animation (pixels per second)
+  Vector2         mOvershootSize;           ///<The size of the overshoot effect
 
-  Property::Index mPropertyRelativePosition;///< Scroll Relative Position ("scroll-relative-position") [range from 0.0f - 1.0f in each axes]
-  Property::Index mPropertyPositionMin;     ///< Scroll Domain Minimum ("position-min")
-  Property::Index mPropertyPositionMax;     ///< Scroll Domain Maximum ("position-max")
-  Property::Index mPropertyScrollDirection; ///< Scroll direction ("scroll-direction")
-  Property::Index mPropertyCanScrollVertical;    ///< Whether the current scroll domain is large enough to scroll vertically
-  Property::Index mPropertyCanScrollHorizontal;    ///< Whether the current scroll domain is large enough to scroll horizontally
-
-  std::map<Toolkit::Scrollable::ScrollComponentType, ScrollComponentPtr> mComponent;  ///< ScrollComponent (such as a scrollbar/page indicator/status)
+  Dali::AlphaFunction::BuiltinFunction mScrollToAlphaFunction; ///< The ScrollTo() animations use this
 
   Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal;
   Toolkit::Scrollable::ScrollUpdatedSignalType mScrollUpdatedSignal;
@@ -246,10 +230,6 @@ protected:
 
 private:
 
-  typedef std::map<Toolkit::Scrollable::ScrollComponentType, ScrollComponentPtr> ComponentContainer;
-  typedef ComponentContainer::iterator ComponentIter;
-
-  ComponentContainer mComponents;  ///< ScrollComponent (such as a scrollbar/page indicator/status)
   bool mOvershootEnabled:1;
 };
 
@@ -279,4 +259,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