From: Tom Robinson Date: Tue, 14 Jul 2015 15:09:07 +0000 (+0100) Subject: Removal of Actor::Insert API X-Git-Tag: dali_1.0.49~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=38b7bad4fd586ad73d399167ca65c0efd1c90e32;hp=791024304040b588e7670ecff7337c052759214c;p=platform%2Fcore%2Fuifw%2Fdali-core.git Removal of Actor::Insert API Change-Id: I17c3851fb733d8c97aed024d1c4813e9d3a6fd30 --- diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 952c82b..3ba9bd9 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -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"); diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index b55aae3..5233fd1 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -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) ) diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index afaa5c7..9a5e971 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -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. diff --git a/dali/public-api/actors/actor.cpp b/dali/public-api/actors/actor.cpp index f231920..c37d7db 100644 --- a/dali/public-api/actors/actor.cpp +++ b/dali/public-api/actors/actor.cpp @@ -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)); diff --git a/dali/public-api/actors/actor.h b/dali/public-api/actors/actor.h index e94955f..857395d 100644 --- a/dali/public-api/actors/actor.h +++ b/dali/public-api/actors/actor.h @@ -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.