Add Layout complex animation.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / layouting / layout-item-impl.h
index c44d251..19b61d5 100644 (file)
 
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/object/base-object.h>
+#include <dali/public-api/object/property-map.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/actors/actor-enumerations.h>
+#include <dali/public-api/animation/animation.h>
 #include <dali-toolkit/devel-api/layouting/child-layout-data.h>
 #include <dali-toolkit/devel-api/layouting/layout-item.h>
-#include <dali-toolkit/devel-api/layouting/layout-parent-impl.h>
+#include <dali-toolkit/devel-api/layouting/layout-child-impl.h>
 #include <dali-toolkit/devel-api/layouting/layout-controller.h>
 #include <dali-toolkit/devel-api/layouting/layout-size.h>
 #include <dali-toolkit/devel-api/layouting/measure-spec.h>
@@ -37,15 +39,19 @@ namespace Toolkit
 namespace Internal
 {
 
+struct LayoutData;
+
 class LayoutItem;
 using LayoutItemPtr = IntrusivePtr<LayoutItem>;
 
+class LayoutTransitionData;
+using LayoutTransitionDataPtr = IntrusivePtr<LayoutTransitionData>;
 
 /**
  * Base class for layouts.
  */
-class DALI_IMPORT_API LayoutItem : public BaseObject,
-                                   public LayoutParent
+class DALI_TOOLKIT_API LayoutItem : public BaseObject,
+                                    public LayoutChild
 {
 public:
   /**
@@ -94,7 +100,8 @@ public:
   Handle GetOwner() const;
 
   /**
-   * @brief Unparent this layout from it's owner, and remove any layout children in derived types
+   * @brief Unparent this layout from it's parent, remove it from it's owner
+   * and remove any layout children in derived types.
    */
   void Unparent();
 
@@ -113,6 +120,28 @@ public:
   bool IsLayoutAnimated() const;
 
   /**
+   * @brief Get the default transition
+   *
+   * @return The default transition
+   */
+  LayoutTransitionDataPtr GetDefaultTransition();
+
+  /**
+   * @brief Set the layout transition data
+   * @param[in] layoutTransitionType The type of the transition
+   * @param[in] layoutTransitionDataPtr The transition data pointer
+   */
+  void SetTransitionData( int layoutTransitionType, LayoutTransitionDataPtr layoutTransitionDataPtr );
+
+  /**
+   * @brief Get the transition data
+   * @param[in] layoutTransitionType The type of the transition
+   *
+   * @return The transition
+   */
+  LayoutTransitionDataPtr GetTransitionData( int layoutTransitionType ) const;
+
+  /**
    * @brief  This is called to find out how big a layout should be.
    *
    * The parent supplies constraint information in the width and height parameters.
@@ -158,9 +187,14 @@ public:
   static LayoutLength GetDefaultSize( LayoutLength size, MeasureSpec measureSpec );
 
   /**
-   * @copydoc LayoutParent::GetParent
+   * @copydoc LayoutChild::SetParent
+   */
+  void SetParent( LayoutParent* parent ) override;
+
+  /**
+   * @copydoc LayoutChild::GetParent
    */
-  virtual LayoutParent* GetParent() override;
+  LayoutParent* GetParent() override;
 
   /**
    * @brief Request that this layout is re-laid out.
@@ -170,6 +204,14 @@ public:
   void RequestLayout();
 
   /**
+   * @brief Request that this layout is re-laid out with particular transition.
+   * @param[in] layoutTranstionType The transition type
+   *
+   * This will make this layout and all it's parent layouts dirty and set the transition queued.
+   */
+  void RequestLayout( Dali::Toolkit::LayoutTransitionData::LayoutTransitionType layoutTranstionType );
+
+  /**
    * @brief Predicate to determine if this layout has been requested to re-layout
    *
    * @return True if a layout request has occured on this layout
@@ -182,6 +224,18 @@ public:
   void SetLayoutRequested();
 
   /**
+   * @brief Checks if the Resize policy is being used for this LayoutItem
+   * @return true is ResizePolicy is used
+   */
+  bool IsResizePolicyRequired() const;
+
+  /**
+   * @brief Sets if the ResizePolicy is needed or not for this LayoutItem
+   * @param[in] resizeRequired true or false flag
+   */
+  void SetResizePolicyRequired( bool resizeRequired );
+
+  /**
    * @brief Get the measured width (without any measurement flags).
    *
    * This method should be used only during measurement and layout calculations.
@@ -390,10 +444,9 @@ protected:
                                            MeasuredSize::State childMeasuredState );
 
   /**
-   * @brief Sets the frame (the size and position) of the layout onto it's owner
+   * @brief Sets the frame (the size and position) of the layout onto it's owner.
+   * Collect all properties to animate after the layout update.
    *
-   * @todo Consider instead, collating properties into LayoutCollector in order to set/animate them all
-   * in one block.
    * @param[in] left The horizontal position of the left edge of this frame within the parent layout
    * @param[in] top The vertical position of the top edge of this frame within the parent layout
    * @param[in] right The horizontal position of the right edge of this frame within the parent layout
@@ -414,6 +467,11 @@ protected:
    */
   virtual void OnInitialize();
 
+  /**
+   * @brief Called when a layer animation state is changed.
+   */
+  virtual void OnAnimationStateChanged( bool animateLayout ) {}
+
 private:
   /**
    * @brief Called to change the size of the layout.
@@ -443,7 +501,6 @@ private:
 public:
   class Impl; // Class declaration is public so we can add devel API's in the future
 
-
 private:
   std::unique_ptr<Impl> mImpl; ///< Implementation class holds all the data
   SlotDelegate<LayoutItem> mSlotDelegate;