Removal of Actor::Insert API 60/43860/2
authorTom Robinson <tom.robinson@samsung.com>
Tue, 14 Jul 2015 15:09:07 +0000 (16:09 +0100)
committerTom Robinson <tom.robinson@samsung.com>
Tue, 14 Jul 2015 15:42:42 +0000 (16:42 +0100)
Change-Id: I17c3851fb733d8c97aed024d1c4813e9d3a6fd30

automated-tests/src/dali/utc-Dali-Actor.cpp
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/actors/actor-impl.h
dali/public-api/actors/actor.cpp
dali/public-api/actors/actor.h

index 952c82b..3ba9bd9 100644 (file)
@@ -406,33 +406,6 @@ int UtcDaliActorAddN(void)
   END_TEST;
 }
 
-int UtcDaliActorInsert(void)
-{
-  tet_infoline("Testing Actor::Insert");
-  TestApplication application;
-
-  Actor parent = Actor::New();
-  Stage::GetCurrent().Add( parent );
-  Actor first = Actor::New();
-  Actor second = Actor::New();
-  Actor third = Actor::New();
-
-  parent.Insert(1, first); // test insert beyond range
-  DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
-  parent.Insert(0, second);
-  DALI_TEST_EQUALS( parent.GetChildCount(), 2u, TEST_LOCATION );
-  parent.Insert(1, third);
-
-  DALI_TEST_EQUALS( parent.GetChildCount(), 3u, TEST_LOCATION );
-
-  DALI_TEST_CHECK(parent.GetChildAt(0) == second);
-  DALI_TEST_CHECK(parent.GetChildAt(1) == third);
-  DALI_TEST_CHECK(parent.GetChildAt(2) == first);
-
-  END_TEST;
-}
-
-
 int UtcDaliActorRemoveN(void)
 {
   tet_infoline("Testing Actor::Remove");
index b55aae3..5233fd1 100644 (file)
@@ -425,63 +425,6 @@ void Actor::Add( Actor& child )
   }
 }
 
-void Actor::Insert( unsigned int index, Actor& child )
-{
-  DALI_ASSERT_ALWAYS( this != &child && "Cannot add actor to itself" );
-  DALI_ASSERT_ALWAYS( !child.IsRoot() && "Cannot add root actor" );
-
-  if( !mChildren )
-  {
-    mChildren = new ActorContainer;
-  }
-
-  Actor* const oldParent( child.mParent );
-
-  // since an explicit position has been given, always insert, even if already a child
-  if( oldParent )
-  {
-    oldParent->Remove( child ); // This causes OnChildRemove callback
-
-    // Old parent may need to readjust to missing child
-    if( oldParent->RelayoutDependentOnChildren() )
-    {
-      oldParent->RelayoutRequest();
-    }
-  }
-
-  // Guard against Add() during previous OnChildRemove callback
-  if( !child.mParent )
-  {
-    // Do this first, since user callbacks from within SetParent() may need to remove child
-    if( index < GetChildCount() )
-    {
-      ActorIter it = mChildren->begin();
-      std::advance( it, index );
-      mChildren->insert( it, ActorPtr( &child ) );
-    }
-    else
-    {
-      mChildren->push_back( ActorPtr( &child ) );
-    }
-    // SetParent asserts that child can be added
-    child.SetParent( this, index );
-
-    // Notification for derived classes
-    OnChildAdd( child );
-
-    // Only put in a relayout request if there is a suitable dependency
-    if( RelayoutDependentOnChildren() )
-    {
-      RelayoutRequest();
-    }
-
-    if( child.RelayoutDependentOnParent() )
-    {
-      child.RelayoutRequest();
-    }
-  }
-}
-
 void Actor::Remove( Actor& child )
 {
   if( (this == &child) || (!mChildren) )
index afaa5c7..9a5e971 100644 (file)
@@ -197,16 +197,6 @@ public:
   void Add( Actor& child );
 
   /**
-   * Inserts a child Actor to this Actor's child list
-   * @pre The child actor is not the same as the parent actor.
-   * @pre The child actor does not already have a parent.
-   * @param [in] index in childlist to insert child at
-   * @param [in] child The child.
-   * @post The child will be referenced by its parent.
-   */
-  void Insert( unsigned int index, Actor& child );
-
-  /**
    * Removes a child Actor from this Actor.
    * @param [in] child The child.
    * @post The child will be unreferenced.
index f231920..c37d7db 100644 (file)
@@ -106,11 +106,6 @@ void Actor::Add(Actor actor)
   GetImplementation(*this).Add(GetImplementation(actor));
 }
 
-void Actor::Insert(unsigned int index, Actor actor)
-{
-  GetImplementation(*this).Insert(index, GetImplementation(actor));
-}
-
 void Actor::Remove(Actor actor)
 {
   GetImplementation(*this).Remove(GetImplementation(actor));
index e94955f..857395d 100644 (file)
@@ -433,24 +433,6 @@ public:
   void Add(Actor child);
 
   /**
-   * @brief Inserts a child Actor to this actor's list of children at the given index
-   *
-   * NOTE! if the child already has a parent, it will be removed from old parent
-   * and reparented to this actor. This may change childs position, color,
-   * scale etc as it now inherits them from this actor
-   * @pre This Actor (the parent) has been initialized.
-   * @pre The child actor has been initialized.
-   * @pre The child actor is not the same as the parent actor.
-   * @pre The actor is not the Root actor
-   * @param [in] index of actor to insert before
-   * @param [in] child The child.
-   * @post The child will be referenced by its parent. This means that the child will be kept alive,
-   * even if the handle passed into this method is reset or destroyed.
-   * @post If the index is greater than the current child count, it will be ignored and added at the end.
-   */
-  void Insert(unsigned int index, Actor child);
-
-  /**
    * @brief Removes a child Actor from this Actor.
    *
    * If the actor was not a child of this actor, this is a no-op.