Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t
[platform/core/uifw/dali-core.git] / dali / public-api / actors / actor.h
index ae5be1e..97756b0 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_ACTOR_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <string>
+#include <cstdint> // uint32_t
 
 // INTERNAL INCLUDES
 #include <dali/public-api/actors/actor-enumerations.h>
@@ -238,7 +239,7 @@ typedef Rect<float> Padding;      ///< Padding definition @SINCE_1_0.0
  * @SINCE_1_0.0
  */
 
-class DALI_IMPORT_API Actor : public Handle
+class DALI_CORE_API Actor : public Handle
 {
 public:
 
@@ -308,6 +309,21 @@ public:
       MAXIMUM_SIZE,                                       ///< name "maximumSize",           type Vector2     @SINCE_1_0.0
       INHERIT_POSITION,                                   ///< name "inheritPosition",       type bool        @SINCE_1_1.24
       CLIPPING_MODE,                                      ///< name "clippingMode",          type String      @SINCE_1_2_5
+
+      /**
+       * @brief The direction of the layout.
+       * @details Name "layoutDirection", type LayoutDirection::Type (Property::INTEGER) or Property::STRING.
+       * @SINCE_1_2.60
+       * @see LayoutDirection::Type for supported values.
+       */
+      LAYOUT_DIRECTION,
+
+      /**
+       * @brief Determines whether child actors inherit the layout direction from a parent.
+       * @details Name "layoutDirectionInheritance", type Property::BOOLEAN.
+       * @SINCE_1_2.60
+       */
+      INHERIT_LAYOUT_DIRECTION,
     };
   };
 
@@ -320,6 +336,7 @@ public:
   typedef Signal< void (Actor) > OnStageSignalType;                         ///< Stage connection signal type @SINCE_1_0.0
   typedef Signal< void (Actor) > OffStageSignalType;                        ///< Stage disconnection signal type @SINCE_1_0.0
   typedef Signal< void (Actor) > OnRelayoutSignalType;                      ///< Called when the actor is relaid out @SINCE_1_0.0
+  typedef Signal< void ( Actor, LayoutDirection::Type ) > LayoutDirectionChangedSignalType; ///< Layout direction changes signal type. @SINCE_1_2.60
 
   // Creation
 
@@ -401,7 +418,7 @@ public:
    * @return The ID
    * @pre The Actor has been initialized.
    */
-  unsigned int GetId() const;
+  uint32_t GetId() const;
 
   // Containment
 
@@ -487,7 +504,7 @@ public:
    * @return The number of children
    * @pre The Actor has been initialized.
    */
-  unsigned int GetChildCount() const;
+  uint32_t GetChildCount() const;
 
   /**
    * @brief Retrieve and child actor by index.
@@ -497,7 +514,7 @@ public:
    * @return The actor for the given index or empty handle if children not initialized
    * @pre The Actor has been initialized.
    */
-  Actor GetChildAt(unsigned int index) const;
+  Actor GetChildAt( uint32_t index ) const;
 
   /**
    * @brief Search through this actor's hierarchy for an actor with the given name.
@@ -519,7 +536,7 @@ public:
    * @return A handle to the actor if found, or an empty handle if not
    * @pre The Actor has been initialized.
    */
-  Actor FindChildById(const unsigned int id);
+  Actor FindChildById( const uint32_t id );
 
   /**
    * @brief Retrieves the actor's parent.
@@ -1238,6 +1255,64 @@ public:
    */
   bool IsKeyboardFocusable() const;
 
+  /**
+   * @brief Raise actor above the next sibling actor.
+   *
+   * @SINCE_1_2.60
+   * @pre The Actor has been initialized.
+   * @pre The Actor has been parented.
+   */
+  void Raise();
+
+  /**
+   * @brief Lower the actor below the previous sibling actor.
+   *
+   * @SINCE_1_2.60
+   * @pre The Actor has been initialized.
+   * @pre The Actor has been parented.
+   */
+  void Lower();
+
+  /**
+   * @brief Raise actor above all other sibling actors.
+   *
+   * @SINCE_1_2.60
+   * @pre The Actor has been initialized.
+   * @pre The Actor has been parented.
+   */
+  void RaiseToTop();
+
+  /**
+   * @brief Lower actor to the bottom of all other sibling actors.
+   *
+   * @SINCE_1_2.60
+   * @pre The Actor has been initialized.
+   * @pre The Actor has been parented.
+   */
+  void LowerToBottom();
+
+  /**
+   * @brief Raises the actor above the target actor.
+   *
+   * @SINCE_1_2.60
+   * @param[in] target The target actor
+   * @pre The Actor has been initialized.
+   * @pre The Actor has been parented.
+   * @pre The target actor is a sibling.
+   */
+  void RaiseAbove( Actor target );
+
+  /**
+   * @brief Lower the actor to below the target actor.
+   *
+   * @SINCE_1_2.60
+   * @param[in] target The target actor
+   * @pre The Actor has been initialized.
+   * @pre The Actor has been parented.
+   * @pre The target actor is a sibling.
+   */
+  void LowerBelow( Actor target );
+
   // SIZE NEGOTIATION
 
   /**
@@ -1358,7 +1433,7 @@ public:
    * @brief Returns the minimum relayout size.
    *
    * @SINCE_1_0.0
-   * @return Return the mininmum size
+   * @return Return the minimum size
    */
   Vector2 GetMinimumSize();
 
@@ -1384,7 +1459,7 @@ public:
    * @SINCE_1_0.0
    * @return The current depth in the hierarchy of the actor, or @c -1 if actor is not in the hierarchy
    */
-  int GetHierarchyDepth();
+  int32_t GetHierarchyDepth();
 
 public: // Renderer
 
@@ -1397,7 +1472,7 @@ public: // Renderer
    * @pre The renderer must be initialized.
    *
    */
-  unsigned int AddRenderer( Renderer& renderer );
+  uint32_t AddRenderer( Renderer& renderer );
 
   /**
    * @brief Gets the number of renderers on this actor.
@@ -1405,7 +1480,7 @@ public: // Renderer
    * @SINCE_1_0.0
    * @return The number of renderers on this actor
    */
-  unsigned int GetRendererCount() const;
+  uint32_t GetRendererCount() const;
 
   /**
    * @brief Gets a Renderer by index.
@@ -1416,7 +1491,7 @@ public: // Renderer
    * @pre The index must be between 0 and GetRendererCount()-1
    *
    */
-  Renderer GetRendererAt( unsigned int index );
+  Renderer GetRendererAt( uint32_t index );
 
   /**
    * @brief Removes a renderer from the actor.
@@ -1434,7 +1509,7 @@ public: // Renderer
    * @pre The index must be between 0 and GetRendererCount()-1
    *
    */
-  void RemoveRenderer( unsigned int index );
+  void RemoveRenderer( uint32_t index );
 
 public: // Signals
 
@@ -1555,6 +1630,22 @@ public: // Signals
    */
   OnRelayoutSignalType& OnRelayoutSignal();
 
+  /**
+   * @brief This signal is emitted when the layout direction property of this or a parent actor is changed.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName( Actor actor, LayoutDirection::Type type );
+   * @endcode
+   * actor: The actor, or child of actor, whose layout direction has changed
+   * type: Whether the actor's layout direction property has changed or a parent's.
+   *
+   * @SINCE_1_2.60
+   * @return The signal to connect to
+   * @pre The Actor has been initialized.
+   */
+  LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal();
+
 public: // Not intended for application developers
 
   /// @cond internal