Merge "Force the actors in the relayout container to do a size negotiation" into...
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-impl.h
index 9a5e971..1ff3035 100644 (file)
@@ -57,6 +57,9 @@ typedef std::vector< ActorPtr > ActorContainer;
 typedef ActorContainer::iterator ActorIter;
 typedef ActorContainer::const_iterator ActorConstIter;
 
+typedef std::vector< RendererPtr > RendererContainer;
+typedef RendererContainer::iterator RendererIter;
+
 /**
  * Actor is the primary object which Dali applications interact with.
  * UI controls can be built by combining multiple actors.
@@ -162,13 +165,13 @@ public:
   bool OnStage() const;
 
   /**
-   * Query whether the actor is a RenderableActor derived type.
+   * Query whether the actor has any renderers.
    * @return True if the actor is renderable.
    */
   bool IsRenderable() const
   {
     // inlined as this is called a lot in hit testing
-    return mIsRenderable;
+    return mRenderers && !mRenderers->empty();
   }
 
   /**
@@ -483,6 +486,16 @@ public:
   PositionInheritanceMode GetPositionInheritanceMode() const;
 
   /**
+   * @copydoc Dali::Actor::SetInheritPosition()
+   */
+  void SetInheritPosition( bool inherit );
+
+  /**
+   * @copydoc Dali::Actor::IsPositionInherited()
+   */
+  bool IsPositionInherited() const;
+
+  /**
    * Sets the orientation of the Actor.
    * @param [in] angleRadians The new orientation angle in radians.
    * @param [in] axis The new axis of orientation.
@@ -1196,7 +1209,7 @@ public:
    * @copydoc Dali::Actor::GetMaximumSize
    */
   float GetMaximumSize( Dimension::Type dimension ) const;
-  
+
   /**
    * @copydoc Dali::Actor::AddRenderer()
    */
@@ -1210,7 +1223,7 @@ public:
   /**
    * @copydoc Dali::Actor::GetRendererAt()
    */
-  Renderer& GetRendererAt( unsigned int index );
+  RendererPtr GetRendererAt( unsigned int index );
 
   /**
    * @copydoc Dali::Actor::RemoveRenderer()
@@ -1245,7 +1258,7 @@ public:
    * @param[in] screenY The screen Y-coordinate.
    * @return True if the conversion succeeded.
    */
-  bool ScreenToLocal( RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const;
+  bool ScreenToLocal( const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const;
 
   /**
    * Converts from the actor's coordinate system to screen coordinates.
@@ -1451,10 +1464,11 @@ public:
   void NotifySizeAnimation( Animation& animation, const Vector3& targetSize );
 
   /**
-   * This should only be called by Animation, when the actors SIZE_WIDTH or SIZE_HEIGHT property is animated.
+   * This should only be called by Animation, when the actors SIZE_WIDTH or SIZE_HEIGHT or SIZE_DEPTH property is animated.
    *
    * @param[in] animation The animation that resized the actor
    * @param[in] targetSize The new target size of the actor
+   * @param[in] property The index of the property being animated
    */
   void NotifySizeAnimation( Animation& animation, float targetSize, Property::Index property );
 
@@ -1466,11 +1480,28 @@ public:
   {
   }
 
+  /**
+   * This should only be called by Animation, when the actors POSITION property is animated.
+   *
+   * @param[in] animation The animation that repositioned the actor
+   * @param[in] targetPosition The new target position of the actor
+   */
+  void NotifyPositionAnimation( Animation& animation, const Vector3& targetPosition );
+
+  /**
+   * This should only be called by Animation, when the actors POSITION_X or POSITION_Y or POSITION_Z property is animated.
+   *
+   * @param[in] animation The animation that repositioned the actor
+   * @param[in] targetPosition The new target position of the actor
+   * @param[in] property The index of the property being animated
+   */
+  void NotifyPositionAnimation( Animation& animation, float targetPosition, Property::Index property );
+
 protected:
 
   enum DerivedType
   {
-    BASIC, RENDERABLE, LAYER, ROOT_LAYER
+    BASIC, LAYER, ROOT_LAYER
   };
 
   /**
@@ -1492,26 +1523,22 @@ protected:
 
   /**
    * Called on a child during Add() when the parent actor is connected to the Stage.
-   * @param[in] stage The stage.
-   * @param[in] parentDepth The depth of the parent in the hierarchy
-   * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
+   * @param[in] parentDepth The depth of the parent in the hierarchy.
    */
-  void ConnectToStage( unsigned int parentDepth, int index = -1 );
+  void ConnectToStage( unsigned int parentDepth );
 
   /**
    * Helper for ConnectToStage, to recursively connect a tree of actors.
    * This is atomic i.e. not interrupted by user callbacks.
-   * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
-   * @param[in] depth The depth in the hierarchy of the actor
+   * @param[in]  depth The depth in the hierarchy of the actor
    * @param[out] connectionList On return, the list of connected actors which require notification.
    */
-  void RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth, int index = -1 );
+  void RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth );
 
   /**
    * Connect the Node associated with this Actor to the scene-graph.
-   * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
    */
-  void ConnectToSceneGraph( int index = -1 );
+  void ConnectToSceneGraph();
 
   /**
    * Helper for ConnectToStage, to notify a connected actor through the public API.
@@ -1546,16 +1573,8 @@ protected:
    */
   bool IsNodeConnected() const;
 
-  /**
-   * Calculate the size of the z dimension for a 2D size
-   *
-   * @param[in] size The 2D size (X, Y) to calculate Z from
-   *
-   * @return Return the Z dimension for this size
-   */
-  float CalculateSizeZ( const Vector2& size ) const;
-
 public:
+
   // Default property extensions from Object
 
   /**
@@ -1652,9 +1671,8 @@ private:
   /**
    * Set the actors parent.
    * @param[in] parent The new parent.
-   * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
    */
-  void SetParent( Actor* parent, int index = -1 );
+  void SetParent( Actor* parent );
 
   /**
    * Helper to create a Node for this Actor.
@@ -1778,6 +1796,8 @@ protected:
 
   Actor* mParent;                 ///< Each actor (except the root) can have one parent
   ActorContainer* mChildren;      ///< Container of referenced actors
+  RendererContainer* mRenderers;   ///< Renderer container
+
   const SceneGraph::Node* mNode;  ///< Not owned
   Vector3* mParentOrigin;         ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
   Vector3* mAnchorPoint;          ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
@@ -1805,7 +1825,6 @@ protected:
 
   unsigned short mDepth                            :12; ///< Cached: The depth in the hierarchy of the actor. Only 4096 levels of depth are supported
   const bool mIsRoot                               : 1; ///< Flag to identify the root actor
-  const bool mIsRenderable                         : 1; ///< Flag to identify that this is a renderable actor
   const bool mIsLayer                              : 1; ///< Flag to identify that this is a layer
   bool mIsOnStage                                  : 1; ///< Flag to identify whether the actor is on-stage
   bool mSensitive                                  : 1; ///< Whether the actor emits touch event signals
@@ -1816,6 +1835,7 @@ protected:
   bool mDerivedRequiresWheelEvent                  : 1; ///< Whether the derived actor type requires wheel event signals
   bool mOnStageSignalled                           : 1; ///< Set to true before OnStageConnection signal is emitted, and false before OnStageDisconnection
   bool mInsideOnSizeSet                            : 1; ///< Whether we are inside OnSizeSet
+  bool mInheritPosition                            : 1; ///< Cached: Whether the parent's position should be inherited.
   bool mInheritOrientation                         : 1; ///< Cached: Whether the parent's orientation should be inherited.
   bool mInheritScale                               : 1; ///< Cached: Whether the parent's scale should be inherited.
   DrawMode::Type mDrawMode                         : 2; ///< Cached: How the actor and its children should be drawn