Formatting API
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / scrollable / item-view / item-layout.h
index e9c5068..c8821d9 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_ITEM_LAYOUT_H__
-#define __DALI_TOOLKIT_ITEM_LAYOUT_H__
+#ifndef DALI_TOOLKIT_ITEM_LAYOUT_H
+#define DALI_TOOLKIT_ITEM_LAYOUT_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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/animation/alpha-function.h>
+#include <dali/public-api/object/property-key.h>
+#include <dali/public-api/object/property-map.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/public-api/enums.h>
 #include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/enums.h>
+
+#undef min
+#undef max
 
 namespace Dali
 {
-
 namespace Toolkit
 {
 /**
@@ -46,11 +50,11 @@ typedef IntrusivePtr<ItemLayout> ItemLayoutPtr; ///< Pointer to a Dali::Toolkit:
 struct ItemRange
 {
   /**
-   * @brief Create a range of item identifiers.
+   * @brief Creates a range of item identifiers.
    *
    * @SINCE_1_0.0
-   * @param[in] beginItem The first item within the range.
-   * @param[in] endItem The past-the-end item.
+   * @param[in] beginItem The first item within the range
+   * @param[in] endItem The past-the-end item
    */
   ItemRange(unsigned int beginItem, unsigned int endItem)
   : begin(beginItem),
@@ -62,7 +66,7 @@ struct ItemRange
    * @brief Copy Constructor.
    *
    * @SINCE_1_0.0
-   * @param[in] copy ItemRange we should copy from.
+   * @param[in] copy ItemRange we should copy from
    */
   ItemRange(const ItemRange& copy)
   : begin(copy.begin),
@@ -74,25 +78,25 @@ struct ItemRange
    * @brief Assignment operator.
    *
    * @SINCE_1_0.0
-   * @param[in] range The Range to assign from.
-   * @return The updated range.
+   * @param[in] range The Range to assign from
+   * @return The updated range
    */
   ItemRange& operator=(const ItemRange& range)
   {
-    if( this != &range )
+    if(this != &range)
     {
       begin = range.begin;
-      end = range.end;
+      end   = range.end;
     }
     return *this;
   }
 
   /**
-   * @brief Test whether an item is within the range.
+   * @brief Tests whether an item is within the range.
    *
    * @SINCE_1_0.0
-   * @param[in] itemId The item identifier.
-   * @return True if the item is within the range.
+   * @param[in] itemId The item identifier
+   * @return true if the item is within the range
    */
   bool Within(unsigned int itemId)
   {
@@ -101,19 +105,19 @@ struct ItemRange
   }
 
   /**
-   * @brief Create the intersection of two ranges.
+   * @brief Creates the intersection of two ranges.
    *
    * @SINCE_1_0.0
-   * @param[in] second The second range.
-   * @return The intersection.
+   * @param[in] second The second range
+   * @return The intersection
    */
   ItemRange Intersection(const ItemRange& second)
   {
     ItemRange intersection(0u, 0u);
 
     // If the ranges intersect
-    if ( (begin < second.end && end > second.begin) ||
-         (second.begin < end && second.end > begin) )
+    if((begin < second.end && end > second.begin) ||
+       (second.begin < end && second.end > begin))
     {
       intersection.begin = std::max(begin, second.begin);
       intersection.end   = std::min(end, second.end);
@@ -136,17 +140,16 @@ struct ItemRange
  * Whilst scrolling, the layout provides a range of items that are within a layout-area (3D bounding volume).
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API ItemLayout : public RefObject
+class DALI_TOOLKIT_API ItemLayout : public RefObject
 {
 public:
-
   class Extension; ///< Forward declare future extension interface
 
   /**
    * @brief Virtual destructor.
    * @SINCE_1_0.0
    */
-  DALI_IMPORT_API virtual ~ItemLayout();
+  virtual ~ItemLayout();
 
   /**
    * @brief Set the orientation of the layout.
@@ -154,7 +157,7 @@ public:
    * @SINCE_1_0.0
    * @param[in] orientation The orientation of the layout.
    */
-  DALI_IMPORT_API void SetOrientation(ControlOrientation::Type orientation);
+  void SetOrientation(ControlOrientation::Type orientation);
 
   /**
    * @brief Query the orientation of the layout.
@@ -162,7 +165,21 @@ public:
    * @SINCE_1_0.0
    * @return the orientation of the layout.
    */
-  DALI_IMPORT_API ControlOrientation::Type GetOrientation() const;
+  ControlOrientation::Type GetOrientation() const;
+
+  /**
+   * @brief Apply the layout Properties.
+   * @SINCE_1_2.20
+   * @param[in] properties The properties the layout.
+   */
+  void SetLayoutProperties(const Property::Map& properties);
+
+  /**
+   * @brief Get the layout Properties.
+   * @SINCE_1_2.20
+   * @return the property of the layout.
+   */
+  Property::Map GetLayoutProperties();
 
   /**
    * @brief Retrieve the target size of an item in the layout.
@@ -176,7 +193,7 @@ public:
    * @note layout-position is not provided as a parameter, since applying size constraints is not recommended.
    * Animating to target-sizes is preferable, since this allows controls to perform layouting without constraints.
    */
-  DALI_IMPORT_API void GetItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const;
+  void GetItemSize(unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize) const;
 
   /**
    * @brief Overrides the default size for the layout.
@@ -184,7 +201,7 @@ public:
    * @SINCE_1_0.0
    * @param[in] itemSize The size of each item.
    */
-  DALI_IMPORT_API void SetItemSize( const Vector3& itemSize );
+  void SetItemSize(const Vector3& itemSize);
 
   /**
    * @brief Query the minimum valid layout position; this is a negative value.
@@ -245,7 +262,7 @@ public:
    * @param[in] layoutSize the current size of the item view instance
    * @return The layout position
    */
-  DALI_IMPORT_API virtual float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize);
+  virtual float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize);
 
   /**
    * @brief Query the number of items that should be reserved, for scrolling purposes.
@@ -267,7 +284,7 @@ public:
    * @note layout-position is not provided as a parameter, since applying size constraints is not recommended.
    * Animating to target-sizes is preferable, since this allows controls to perform layouting without constraints.
    */
-  virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const = 0;
+  virtual void GetDefaultItemSize(unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize) const = 0;
 
   /**
    * @brief Query the scroll direction of the layout.
@@ -324,7 +341,7 @@ public:
    * @param[in] loopEnabled Whether the KeyboardFocusManager is set to wrap around between first and last item
    * @return The next item ID.
    */
-  DALI_IMPORT_API virtual int GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled);
+  virtual int GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled);
 
   /**
    * @brief Query the flick speed factor of the layout while swipping.
@@ -339,9 +356,9 @@ public:
    * @SINCE_1_0.0
    * @return The scroll speed factor of the layout.
    */
-  DALI_IMPORT_API virtual float GetFlickSpeedFactor() const;
+  virtual float GetFlickSpeedFactor() const;
 
-  /*
+  /**
    * @brief Applies constraints defined by the layout to an actor.
    *
    * @param[in] actor The actor to constrain.
@@ -349,7 +366,7 @@ public:
    * @param[in] layoutSize The current size of the item view instance.
    * @param[in] itemViewActor The item view instance which requests the application of constraints.
    */
-  DALI_IMPORT_API virtual void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor ) = 0;
+  virtual void ApplyConstraints(Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor) = 0;
 
   /**
    * @brief Gets the position of a given item
@@ -360,7 +377,7 @@ public:
    * @param[in] layoutSize The current size of the item view instance
    * @return The item position (x,y,z)
    */
-  DALI_IMPORT_API virtual Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const = 0;
+  virtual Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const = 0;
 
   /**
    * @brief Retrieve the extension for this layout.
@@ -374,29 +391,26 @@ public:
   }
 
 protected:
-
   /**
    * @brief Create a new ItemLayout; Only derived versions are instantiatable.
    * @SINCE_1_0.0
    */
-  DALI_IMPORT_API ItemLayout();
+  ItemLayout();
 
 private:
-
   /**
    * @brief Don't allow copy constructor
    * @SINCE_1_0.0
    */
-  ItemLayout( const ItemLayout& handle );
+  ItemLayout(const ItemLayout& handle);
 
   /**
    * @brief Don't allow copy operator
    * @SINCE_1_0.0
    */
-  ItemLayout& operator=( const ItemLayout& handle );
+  ItemLayout& operator=(const ItemLayout& handle);
 
 protected:
-
   struct Impl;
   Impl* mImpl;
 };
@@ -408,4 +422,4 @@ protected:
 
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_ITEM_LAYOUT_H__
+#endif // DALI_TOOLKIT_ITEM_LAYOUT_H