From 63c292a68921d0087b9509933f838558c90e9e69 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Fri, 29 Sep 2017 18:44:46 +0100 Subject: [PATCH] Moved some Actor APIs to the Public API Change-Id: I2f2d9dcd542ac9d9472dd7b31e6b6a5ab6c7443a --- automated-tests/src/dali/utc-Dali-Actor.cpp | 152 +++++++++---------- dali/devel-api/actors/actor-devel.cpp | 35 ----- dali/devel-api/actors/actor-devel.h | 226 ++++++++-------------------- dali/internal/event/actors/actor-impl.cpp | 28 ++-- dali/internal/event/actors/actor-impl.h | 12 +- dali/public-api/actors/actor-enumerations.h | 194 ++++++++++++++---------- dali/public-api/actors/actor.cpp | 37 ++++- dali/public-api/actors/actor.h | 90 ++++++++++- 8 files changed, 393 insertions(+), 381 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 786be23..439f2d1 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -51,7 +51,7 @@ bool gHoverCallBackCalled=false; static bool gTestConstraintCalled; -DevelActor::LayoutDirection::Type gLayoutDirectionType; +LayoutDirection::Type gLayoutDirectionType; struct TestConstraint { @@ -4431,7 +4431,7 @@ int UtcDaliActorRaiseLower(void) Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER ); value.Get( preActorOrder ); - DevelActor::Raise( actorB ); + actorB.Raise(); // Ensure sort order is calculated before next touch event application.SendNotification(); @@ -4453,7 +4453,7 @@ int UtcDaliActorRaiseLower(void) value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER ); value.Get( preActorOrder ); - DevelActor::Lower( actorB ); + actorB.Lower(); application.SendNotification(); // ensure sort order calculated before next touch event value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER ); @@ -4580,7 +4580,7 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) tet_printf( "RaiseToTop ActorA\n" ); - DevelActor::RaiseToTop( actorA ); + actorA.RaiseToTop(); application.SendNotification(); // ensure sorting order is calculated before next touch event application.ProcessEvent( touchEvent ); @@ -4611,7 +4611,7 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) tet_printf( "RaiseToTop ActorB\n" ); - DevelActor::RaiseToTop( actorB ); + actorB.RaiseToTop(); application.SendNotification(); // Ensure sort order is calculated before next touch event application.ProcessEvent( touchEvent ); @@ -4642,11 +4642,11 @@ int UtcDaliActorRaiseToTopLowerToBottom(void) tet_printf( "LowerToBottom ActorA then ActorB leaving Actor C at Top\n" ); - DevelActor::LowerToBottom( actorA ); + actorA.LowerToBottom(); application.SendNotification(); application.Render(); - DevelActor::LowerToBottom( actorB ); + actorB.LowerToBottom(); application.SendNotification(); application.Render(); @@ -4745,7 +4745,7 @@ int UtcDaliActorRaiseAbove(void) tet_printf( "Raise actor B Above Actor C\n" ); - DevelActor::RaiseAbove( actorB, actorC ); + actorB.RaiseAbove( actorC ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -4759,7 +4759,7 @@ int UtcDaliActorRaiseAbove(void) tet_printf( "Raise actor A Above Actor B\n" ); - DevelActor::RaiseAbove( actorA, actorB ); + actorA.RaiseAbove( actorB ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -4893,7 +4893,7 @@ int UtcDaliActorLowerBelow(void) tet_printf( "Lower actor C below Actor B ( actor B and A on same level due to insertion order) so C is below both \n" ); - DevelActor::LowerBelow( actorC, actorB ); + actorC.LowerBelow( actorB ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); @@ -4925,7 +4925,7 @@ int UtcDaliActorLowerBelow(void) tet_printf( "Lower actor C below Actor A leaving B on top\n" ); - DevelActor::LowerBelow( actorC, actorA ); + actorC.LowerBelow( actorA ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); @@ -4954,7 +4954,7 @@ int UtcDaliActorLowerBelow(void) tet_printf( "Lower actor B below Actor C leaving A on top\n" ); - DevelActor::LowerBelow( actorB, actorC ); + actorB.LowerBelow( actorC ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); @@ -5063,7 +5063,7 @@ int UtcDaliActorRaiseAboveDifferentParentsN(void) tet_printf( "Raise actor A Above Actor C which have different parents\n" ); - DevelActor::RaiseAbove( actorA, actorC ); + actorA.RaiseAbove( actorC ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5132,7 +5132,7 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) tet_printf( "Raise actor A Above Actor C which have no parents\n" ); - DevelActor::RaiseAbove( actorA, actorC ); + actorA.RaiseAbove( actorC ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5148,7 +5148,7 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) stage.Add ( actorB ); tet_printf( "Lower actor A below Actor C when only A is not on stage \n" ); - DevelActor::LowerBelow( actorA, actorC ); + actorA.LowerBelow( actorC ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5170,7 +5170,7 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) application.Render(); tet_printf( "Raise actor B Above Actor C when only B has a parent\n" ); - DevelActor::RaiseAbove( actorB, actorC ); + actorB.RaiseAbove( actorC ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5184,7 +5184,7 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) ResetTouchCallbacks(); tet_printf( "Lower actor A below Actor C when only A has a parent\n" ); - DevelActor::LowerBelow( actorA, actorC ); + actorA.LowerBelow( actorC ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); @@ -5198,7 +5198,7 @@ int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void) ResetTouchCallbacks(); stage.Add ( actorC ); - DevelActor::RaiseAbove( actorA, actorC ); + actorA.RaiseAbove( actorC ); // Ensure sorting happens at end of Core::ProcessEvents() before next touch application.SendNotification(); application.Render(); @@ -5260,7 +5260,7 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) stage.Add ( actorA ); tet_printf( "Raise actor B Above Actor C but B not parented\n" ); - DevelActor::Raise( actorB ); + actorB.Raise(); application.SendNotification(); application.Render(); @@ -5276,7 +5276,7 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) tet_printf( "Raise actor B Above Actor C but B not parented\n" ); ResetTouchCallbacks(); - DevelActor::Lower( actorC ); + actorC.Lower(); // Sort actor tree before next touch event application.SendNotification(); application.Render(); @@ -5292,7 +5292,7 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) tet_printf( "Lower actor C below B but C not parented\n" ); - DevelActor::Lower( actorB ); + actorB.Lower(); // Sort actor tree before next touch event application.SendNotification(); application.Render(); @@ -5308,7 +5308,7 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) tet_printf( "Raise actor B to top\n" ); - DevelActor::RaiseToTop( actorB ); + actorB.RaiseToTop(); // Sort actor tree before next touch event application.SendNotification(); application.Render(); @@ -5328,7 +5328,7 @@ int UtcDaliActorTestAllAPIwhenActorNotParented(void) tet_printf( "Lower actor C to Bottom, B stays at top\n" ); - DevelActor::LowerToBottom( actorC ); + actorC.LowerToBottom(); application.SendNotification(); application.Render(); @@ -5407,7 +5407,7 @@ int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void) tet_infoline( "Raise actor A Above Actor A which is the same actor!!\n" ); - DevelActor::RaiseAbove( actorA, actorA ); + actorA.RaiseAbove( actorA ); application.SendNotification(); application.Render(); @@ -5421,7 +5421,7 @@ int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void) ResetTouchCallbacks(); - DevelActor::RaiseAbove( actorA, actorC ); + actorA.RaiseAbove( actorC ); application.SendNotification(); application.Render(); @@ -6124,7 +6124,7 @@ int utcDaliActorVisibilityChangeSignalAfterAnimation(void) } -static void LayoutDirectionChanged( Actor actor, DevelActor::LayoutDirection::Type type ) +static void LayoutDirectionChanged( Actor actor, LayoutDirection::Type type ) { gLayoutDirectionType = type; } @@ -6135,47 +6135,47 @@ int UtcDaliActorLayoutDirectionProperty(void) tet_infoline( "Check layout direction property" ); Actor actor0 = Actor::New(); - DALI_TEST_EQUALS( actor0.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor0.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); Stage::GetCurrent().Add( actor0 ); application.SendNotification(); application.Render(); Actor actor1 = Actor::New(); - DALI_TEST_EQUALS( actor1.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); Actor actor2 = Actor::New(); - DALI_TEST_EQUALS( actor2.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); Actor actor3 = Actor::New(); - DALI_TEST_EQUALS( actor3.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor3.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); Actor actor4 = Actor::New(); - DALI_TEST_EQUALS( actor4.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor4.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); Actor actor5 = Actor::New(); - DALI_TEST_EQUALS( actor5.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor5.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); Actor actor6 = Actor::New(); - DALI_TEST_EQUALS( actor6.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor6.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); Actor actor7 = Actor::New(); - DALI_TEST_EQUALS( actor7.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); Actor actor8 = Actor::New(); - DALI_TEST_EQUALS( actor8.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); Actor actor9 = Actor::New(); - DALI_TEST_EQUALS( actor9.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); actor1.Add( actor2 ); - gLayoutDirectionType = DevelActor::LayoutDirection::LTR; - DevelActor::LayoutDirectionChangedSignal( actor2 ).Connect( LayoutDirectionChanged ); + gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT; + actor2.LayoutDirectionChangedSignal().Connect( LayoutDirectionChanged ); - DALI_TEST_EQUALS( actor1.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION ); - actor1.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, DevelActor::LayoutDirection::RTL ); - DALI_TEST_EQUALS( actor1.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION ); + DALI_TEST_EQUALS( actor1.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION ); + actor1.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); + DALI_TEST_EQUALS( actor1.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( actor1.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::RTL ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor2.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::RTL ), TEST_LOCATION ); - DALI_TEST_EQUALS( gLayoutDirectionType, DevelActor::LayoutDirection::RTL, TEST_LOCATION ); + DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + DALI_TEST_EQUALS( gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION ); - actor1.SetProperty( DevelActor::Property::INHERIT_LAYOUT_DIRECTION, true ); + actor1.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, true ); actor0.Add( actor1 ); - DALI_TEST_EQUALS( actor1.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor2.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); Stage::GetCurrent().Add( actor3 ); actor3.Add( actor4 ); @@ -6184,35 +6184,35 @@ int UtcDaliActorLayoutDirectionProperty(void) actor5.Add( actor7 ); actor7.Add( actor8 ); actor8.Add( actor9 ); - actor3.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, "RTL" ); - actor5.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, DevelActor::LayoutDirection::LTR ); - - DALI_TEST_EQUALS( actor8.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION ); - actor8.SetProperty( DevelActor::Property::INHERIT_LAYOUT_DIRECTION, false ); - DALI_TEST_EQUALS( actor8.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION ); - - actor7.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, "RTL" ); - - DALI_TEST_EQUALS( actor3.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::RTL ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor4.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::RTL ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor5.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor6.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor7.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::RTL ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor8.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor9.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); - - actor8.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, "RTL" ); - DALI_TEST_EQUALS( actor8.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::RTL ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor9.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::RTL ), TEST_LOCATION ); - - actor7.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, DevelActor::LayoutDirection::LTR ); - DALI_TEST_EQUALS( actor7.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor8.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::RTL ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor9.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::RTL ), TEST_LOCATION ); - - actor8.SetProperty( DevelActor::Property::INHERIT_LAYOUT_DIRECTION, true ); - DALI_TEST_EQUALS( actor8.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); - DALI_TEST_EQUALS( actor9.GetProperty< int >( DevelActor::Property::LAYOUT_DIRECTION ), static_cast< int >( DevelActor::LayoutDirection::LTR ), TEST_LOCATION ); + actor3.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" ); + actor5.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); + + DALI_TEST_EQUALS( actor8.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION ); + actor8.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, false ); + DALI_TEST_EQUALS( actor8.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION ); + + actor7.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" ); + + DALI_TEST_EQUALS( actor3.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor4.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor5.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor6.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + + actor8.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" ); + DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + + actor7.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); + DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + + actor8.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, true ); + DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION ); END_TEST; } diff --git a/dali/devel-api/actors/actor-devel.cpp b/dali/devel-api/actors/actor-devel.cpp index 52b4cf1..eabcb3a 100644 --- a/dali/devel-api/actors/actor-devel.cpp +++ b/dali/devel-api/actors/actor-devel.cpp @@ -25,46 +25,11 @@ namespace Dali namespace DevelActor { -void Raise( Actor actor ) -{ - GetImplementation( actor ).Raise(); -} - -void Lower( Actor actor ) -{ - GetImplementation( actor ).Lower(); -} - -void RaiseToTop( Actor actor ) -{ - GetImplementation( actor ).RaiseToTop(); -} - -void LowerToBottom( Actor actor ) -{ - GetImplementation( actor ).LowerToBottom(); -} - -void RaiseAbove( Actor actor, Actor target ) -{ - GetImplementation( actor ).RaiseAbove( GetImplementation( target ) ); -} - -void LowerBelow( Actor actor, Actor target ) -{ - GetImplementation( actor ).LowerBelow( GetImplementation( target ) ); -} - VisibilityChangedSignalType& VisibilityChangedSignal( Actor actor ) { return GetImplementation( actor ).VisibilityChangedSignal(); } -LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal( Actor actor ) -{ - return GetImplementation( actor ).LayoutDirectionChangedSignal(); -} - } // namespace DevelActor } // namespace Dali diff --git a/dali/devel-api/actors/actor-devel.h b/dali/devel-api/actors/actor-devel.h index 20d136e..254ca39 100644 --- a/dali/devel-api/actors/actor-devel.h +++ b/dali/devel-api/actors/actor-devel.h @@ -32,60 +32,62 @@ namespace Property enum Type { - PARENT_ORIGIN = Dali::Actor::Property::PARENT_ORIGIN, - PARENT_ORIGIN_X = Dali::Actor::Property::PARENT_ORIGIN_X, - PARENT_ORIGIN_Y = Dali::Actor::Property::PARENT_ORIGIN_Y, - PARENT_ORIGIN_Z = Dali::Actor::Property::PARENT_ORIGIN_Z, - ANCHOR_POINT = Dali::Actor::Property::ANCHOR_POINT, - ANCHOR_POINT_X = Dali::Actor::Property::ANCHOR_POINT_X, - ANCHOR_POINT_Y = Dali::Actor::Property::ANCHOR_POINT_Y, - ANCHOR_POINT_Z = Dali::Actor::Property::ANCHOR_POINT_Z, - SIZE = Dali::Actor::Property::SIZE, - SIZE_WIDTH = Dali::Actor::Property::SIZE_WIDTH, - SIZE_HEIGHT = Dali::Actor::Property::SIZE_HEIGHT, - SIZE_DEPTH = Dali::Actor::Property::SIZE_DEPTH, - POSITION = Dali::Actor::Property::POSITION, - POSITION_X = Dali::Actor::Property::POSITION_X, - POSITION_Y = Dali::Actor::Property::POSITION_Y, - POSITION_Z = Dali::Actor::Property::POSITION_Z, - WORLD_POSITION = Dali::Actor::Property::WORLD_POSITION, - WORLD_POSITION_X = Dali::Actor::Property::WORLD_POSITION_X, - WORLD_POSITION_Y = Dali::Actor::Property::WORLD_POSITION_Y, - WORLD_POSITION_Z = Dali::Actor::Property::WORLD_POSITION_Z, - ORIENTATION = Dali::Actor::Property::ORIENTATION, - WORLD_ORIENTATION = Dali::Actor::Property::WORLD_ORIENTATION, - SCALE = Dali::Actor::Property::SCALE, - SCALE_X = Dali::Actor::Property::SCALE_X, - SCALE_Y = Dali::Actor::Property::SCALE_Y, - SCALE_Z = Dali::Actor::Property::SCALE_Z, - WORLD_SCALE = Dali::Actor::Property::WORLD_SCALE, - VISIBLE = Dali::Actor::Property::VISIBLE, - COLOR = Dali::Actor::Property::COLOR, - COLOR_RED = Dali::Actor::Property::COLOR_RED, - COLOR_GREEN = Dali::Actor::Property::COLOR_GREEN, - COLOR_BLUE = Dali::Actor::Property::COLOR_BLUE, - COLOR_ALPHA = Dali::Actor::Property::COLOR_ALPHA, - WORLD_COLOR = Dali::Actor::Property::WORLD_COLOR, - WORLD_MATRIX = Dali::Actor::Property::WORLD_MATRIX, - NAME = Dali::Actor::Property::NAME, - SENSITIVE = Dali::Actor::Property::SENSITIVE, - LEAVE_REQUIRED = Dali::Actor::Property::LEAVE_REQUIRED, - INHERIT_ORIENTATION = Dali::Actor::Property::INHERIT_ORIENTATION, - INHERIT_SCALE = Dali::Actor::Property::INHERIT_SCALE, - COLOR_MODE = Dali::Actor::Property::COLOR_MODE, - POSITION_INHERITANCE = Dali::Actor::Property::POSITION_INHERITANCE, - DRAW_MODE = Dali::Actor::Property::DRAW_MODE, - SIZE_MODE_FACTOR = Dali::Actor::Property::SIZE_MODE_FACTOR, - WIDTH_RESIZE_POLICY = Dali::Actor::Property::WIDTH_RESIZE_POLICY, - HEIGHT_RESIZE_POLICY = Dali::Actor::Property::HEIGHT_RESIZE_POLICY, - SIZE_SCALE_POLICY = Dali::Actor::Property::SIZE_SCALE_POLICY, - WIDTH_FOR_HEIGHT = Dali::Actor::Property::WIDTH_FOR_HEIGHT, - HEIGHT_FOR_WIDTH = Dali::Actor::Property::HEIGHT_FOR_WIDTH, - PADDING = Dali::Actor::Property::PADDING, - MINIMUM_SIZE = Dali::Actor::Property::MINIMUM_SIZE, - MAXIMUM_SIZE = Dali::Actor::Property::MAXIMUM_SIZE, - INHERIT_POSITION = Dali::Actor::Property::INHERIT_POSITION, - CLIPPING_MODE = Dali::Actor::Property::CLIPPING_MODE, + PARENT_ORIGIN = Dali::Actor::Property::PARENT_ORIGIN, + PARENT_ORIGIN_X = Dali::Actor::Property::PARENT_ORIGIN_X, + PARENT_ORIGIN_Y = Dali::Actor::Property::PARENT_ORIGIN_Y, + PARENT_ORIGIN_Z = Dali::Actor::Property::PARENT_ORIGIN_Z, + ANCHOR_POINT = Dali::Actor::Property::ANCHOR_POINT, + ANCHOR_POINT_X = Dali::Actor::Property::ANCHOR_POINT_X, + ANCHOR_POINT_Y = Dali::Actor::Property::ANCHOR_POINT_Y, + ANCHOR_POINT_Z = Dali::Actor::Property::ANCHOR_POINT_Z, + SIZE = Dali::Actor::Property::SIZE, + SIZE_WIDTH = Dali::Actor::Property::SIZE_WIDTH, + SIZE_HEIGHT = Dali::Actor::Property::SIZE_HEIGHT, + SIZE_DEPTH = Dali::Actor::Property::SIZE_DEPTH, + POSITION = Dali::Actor::Property::POSITION, + POSITION_X = Dali::Actor::Property::POSITION_X, + POSITION_Y = Dali::Actor::Property::POSITION_Y, + POSITION_Z = Dali::Actor::Property::POSITION_Z, + WORLD_POSITION = Dali::Actor::Property::WORLD_POSITION, + WORLD_POSITION_X = Dali::Actor::Property::WORLD_POSITION_X, + WORLD_POSITION_Y = Dali::Actor::Property::WORLD_POSITION_Y, + WORLD_POSITION_Z = Dali::Actor::Property::WORLD_POSITION_Z, + ORIENTATION = Dali::Actor::Property::ORIENTATION, + WORLD_ORIENTATION = Dali::Actor::Property::WORLD_ORIENTATION, + SCALE = Dali::Actor::Property::SCALE, + SCALE_X = Dali::Actor::Property::SCALE_X, + SCALE_Y = Dali::Actor::Property::SCALE_Y, + SCALE_Z = Dali::Actor::Property::SCALE_Z, + WORLD_SCALE = Dali::Actor::Property::WORLD_SCALE, + VISIBLE = Dali::Actor::Property::VISIBLE, + COLOR = Dali::Actor::Property::COLOR, + COLOR_RED = Dali::Actor::Property::COLOR_RED, + COLOR_GREEN = Dali::Actor::Property::COLOR_GREEN, + COLOR_BLUE = Dali::Actor::Property::COLOR_BLUE, + COLOR_ALPHA = Dali::Actor::Property::COLOR_ALPHA, + WORLD_COLOR = Dali::Actor::Property::WORLD_COLOR, + WORLD_MATRIX = Dali::Actor::Property::WORLD_MATRIX, + NAME = Dali::Actor::Property::NAME, + SENSITIVE = Dali::Actor::Property::SENSITIVE, + LEAVE_REQUIRED = Dali::Actor::Property::LEAVE_REQUIRED, + INHERIT_ORIENTATION = Dali::Actor::Property::INHERIT_ORIENTATION, + INHERIT_SCALE = Dali::Actor::Property::INHERIT_SCALE, + COLOR_MODE = Dali::Actor::Property::COLOR_MODE, + POSITION_INHERITANCE = Dali::Actor::Property::POSITION_INHERITANCE, + DRAW_MODE = Dali::Actor::Property::DRAW_MODE, + SIZE_MODE_FACTOR = Dali::Actor::Property::SIZE_MODE_FACTOR, + WIDTH_RESIZE_POLICY = Dali::Actor::Property::WIDTH_RESIZE_POLICY, + HEIGHT_RESIZE_POLICY = Dali::Actor::Property::HEIGHT_RESIZE_POLICY, + SIZE_SCALE_POLICY = Dali::Actor::Property::SIZE_SCALE_POLICY, + WIDTH_FOR_HEIGHT = Dali::Actor::Property::WIDTH_FOR_HEIGHT, + HEIGHT_FOR_WIDTH = Dali::Actor::Property::HEIGHT_FOR_WIDTH, + PADDING = Dali::Actor::Property::PADDING, + MINIMUM_SIZE = Dali::Actor::Property::MINIMUM_SIZE, + MAXIMUM_SIZE = Dali::Actor::Property::MAXIMUM_SIZE, + INHERIT_POSITION = Dali::Actor::Property::INHERIT_POSITION, + CLIPPING_MODE = Dali::Actor::Property::CLIPPING_MODE, + LAYOUT_DIRECTION = Dali::Actor::Property::LAYOUT_DIRECTION, + INHERIT_LAYOUT_DIRECTION = Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION, /** * @brief Sets the sibling order of the actor so depth position can be defined within the same parent. @@ -94,20 +96,20 @@ enum Type * @note Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove and LowerBelow will override the * sibling order. The values set by this Property will likely change. */ - SIBLING_ORDER = CLIPPING_MODE + 1, + SIBLING_ORDER = INHERIT_LAYOUT_DIRECTION + 1, /** * @brief The opacity of the actor. * @details Name "opacity", type Property::FLOAT. */ - OPACITY = CLIPPING_MODE + 2, + OPACITY = INHERIT_LAYOUT_DIRECTION + 2, /** * @brief Returns the screen position of the Actor * @details Name "screenPosition", type Property::VECTOR2. Read-only * @note This assumes default camera and default render-task and the Z position is ZERO. */ - SCREEN_POSITION = CLIPPING_MODE + 3, + SCREEN_POSITION = INHERIT_LAYOUT_DIRECTION + 3, /** * @brief Determines whether the anchor point should be used to determine the position of the actor. @@ -116,19 +118,7 @@ enum Type * @note If false, then the top-left of the actor is used for the position. * @note Setting this to false will allow scaling or rotation around the anchor-point without affecting the actor's position. */ - POSITION_USES_ANCHOR_POINT = CLIPPING_MODE + 4, - - /** - * @brief The direction of layout. - * @details Name "layoutDirection", type Property::INTEGER, @see LayoutDirection::Type for supported values. - */ - LAYOUT_DIRECTION = CLIPPING_MODE + 5, - - /** - * @brief Determines whether child actors inherit the layout direction from a parent. - * @details Name "layoutDirectionInheritance", type Property::BOOLEAN. - */ - INHERIT_LAYOUT_DIRECTION = CLIPPING_MODE + 6 + POSITION_USES_ANCHOR_POINT = INHERIT_LAYOUT_DIRECTION + 4, }; } // namespace Property @@ -144,90 +134,8 @@ enum Type } // namespace VisibilityChange -namespace LayoutDirection -{ - -enum Type -{ - LTR, ///< Layout direction is from Left to Right direction. - RTL ///< Layout direction is from Right to Left direction. -}; - -} // namespace - typedef Signal< void ( Actor, bool, VisibilityChange::Type ) > VisibilityChangedSignalType; ///< Signal type of VisibilityChangedSignalType -typedef Signal< void ( Actor, LayoutDirection::Type ) > LayoutDirectionChangedSignalType; ///< Signal type of LayoutDirectionChangedSignal - -/** - * @brief Raise actor above the next highest level of actor(s). - * - * @param[in] actor The Actor to raise - * @note Sibling order of actors within the parent will be updated automatically. - * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors. - * Initially actors added to a parent will have the same sibling order and shown in relation to insertion order. - * Raising this actor above actors with the same sibling order as each other will raise this actor above them. - * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion. - * - */ -DALI_IMPORT_API void Raise( Actor actor ); - -/** - * @brief Lower the actor to underneath the level below actor(s). - * - * @param[in] actor The Actor to lower - * @note Sibling order of actors within the parent will be updated automatically. - * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors. - * Lowering this actor below actors with the same sibling order as each other will lower this actor above them. - * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion. - */ -DALI_IMPORT_API void Lower( Actor actor ); - -/** - * @brief Raise actor above all other actors. - * - * @param[in] actor The Actor to raise to the top - * @note Sibling order of actors within the parent will be updated automatically. - * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors. - * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion. - */ -DALI_IMPORT_API void RaiseToTop( Actor actor ); - -/** - * @brief Lower actor to the bottom of all actors. - * - * @param[in] actor The Actor to lower to the bottom - * @note Sibling order of actors within the parent will be updated automatically. - * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors. - * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion. - */ -DALI_IMPORT_API void LowerToBottom( Actor actor ); - -/** - * @brief Raise the actor to above the target actor. - * - * @param[in] actor The actor to raise - * @param[in] target Will be raised above this actor - * @note Sibling order of actors within the parent will be updated automatically. - * Actors on the level above the target actor will still be shown above this actor. - * Raising this actor above actors with the same sibling order as each other will raise this actor above them. - * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors. - * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion. - */ -DALI_IMPORT_API void RaiseAbove( Actor actor, Dali::Actor target ); - -/** - * @brief Lower the actor to below the target actor. - * - * @param[in] actor The Actor to lower - * @param[in] target Will be lowered below this actor - * @note Sibling order of actors within the parent will be updated automatically. - * Using this API means a limit of DevelLayer::SIBLING_ORDER_MULTIPLIER Actors. - * Lowering this actor below actors with the same sibling order as each other will lower this actor above them. - * Once a raise or lower API is used that actor will then have an exclusive sibling order independent of insertion. - */ -DALI_IMPORT_API void LowerBelow( Actor actor, Dali::Actor target ); - /** * @brief This signal is emitted when the visible property of this or a parent actor is changed. * @@ -244,20 +152,6 @@ DALI_IMPORT_API void LowerBelow( Actor actor, Dali::Actor target ); */ DALI_IMPORT_API VisibilityChangedSignalType& VisibilityChangedSignal( Actor actor ); -/** - * @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 laytou direction has changed - * type: Whether the actor's layout direction property has changed or a parent's. - * @return The signal to connect to - * @pre The Actor has been initialized. - */ -DALI_IMPORT_API LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal( Actor actor ); - } // namespace DevelActor } // namespace Dali diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index e16eed2..4e5d866 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -207,12 +207,12 @@ DALI_PROPERTY( "minimumSize", VECTOR2, true, false, false, Dali: DALI_PROPERTY( "maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE ) DALI_PROPERTY( "inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION ) DALI_PROPERTY( "clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE ) +DALI_PROPERTY( "layoutDirection", STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION ) +DALI_PROPERTY( "inheritLayoutDirection", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION ) DALI_PROPERTY( "siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER ) DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::DevelActor::Property::OPACITY ) DALI_PROPERTY( "screenPosition", VECTOR2, false, false, false, Dali::DevelActor::Property::SCREEN_POSITION ) DALI_PROPERTY( "positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT ) -DALI_PROPERTY( "layoutDirection", STRING, true, false, false, Dali::DevelActor::Property::LAYOUT_DIRECTION ) -DALI_PROPERTY( "inheritLayoutDirection", BOOLEAN, true, false, false, Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION ) DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX ) // Signals @@ -309,8 +309,8 @@ DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, CLIP_CHILDREN ) DALI_ENUM_TO_STRING_TABLE_END( CLIPPING_MODE ) DALI_ENUM_TO_STRING_TABLE_BEGIN( LAYOUT_DIRECTION ) -DALI_ENUM_TO_STRING_WITH_SCOPE( DevelActor::LayoutDirection, LTR ) -DALI_ENUM_TO_STRING_WITH_SCOPE( DevelActor::LayoutDirection, RTL ) +DALI_ENUM_TO_STRING_WITH_SCOPE( LayoutDirection, LEFT_TO_RIGHT ) +DALI_ENUM_TO_STRING_WITH_SCOPE( LayoutDirection, RIGHT_TO_LEFT ) DALI_ENUM_TO_STRING_TABLE_END( LAYOUT_DIRECTION ) bool GetAnchorPointConstant( const std::string& value, Vector3& anchor ) @@ -1993,7 +1993,7 @@ void Actor::EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityCha } } -void Actor::EmitLayoutDirectionChangedSignal( DevelActor::LayoutDirection::Type type ) +void Actor::EmitLayoutDirectionChangedSignal( LayoutDirection::Type type ) { if( ! mLayoutDirectionChangedSignal.Empty() ) { @@ -2042,7 +2042,7 @@ DevelActor::VisibilityChangedSignalType& Actor::VisibilityChangedSignal() return mVisibilityChangedSignal; } -DevelActor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal() +Dali::Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal() { return mLayoutDirectionChangedSignal; } @@ -2124,7 +2124,7 @@ Actor::Actor( DerivedType derivedType ) mPositionUsesAnchorPoint( true ), mVisible( true ), mInheritLayoutDirection( true ), - mLayoutDirection( DevelActor::LayoutDirection::LTR ), + mLayoutDirection( LayoutDirection::LEFT_TO_RIGHT ), mDrawMode( DrawMode::NORMAL ), mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ), mColorMode( Node::DEFAULT_COLOR_MODE ), @@ -2883,19 +2883,19 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr break; } - case Dali::DevelActor::Property::LAYOUT_DIRECTION: + case Dali::Actor::Property::LAYOUT_DIRECTION: { - Dali::DevelActor::LayoutDirection::Type direction = mLayoutDirection; + Dali::LayoutDirection::Type direction = mLayoutDirection; mInheritLayoutDirection = false; - if( Scripting::GetEnumerationProperty< DevelActor::LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) ) + if( Scripting::GetEnumerationProperty< LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) ) { InheritLayoutDirectionRecursively( this, direction, true ); } break; } - case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION: + case Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION: { bool value = false; if( property.Get( value ) ) @@ -4147,13 +4147,13 @@ bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& valu break; } - case Dali::DevelActor::Property::LAYOUT_DIRECTION: + case Dali::Actor::Property::LAYOUT_DIRECTION: { value = mLayoutDirection; break; } - case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION: + case Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION: { value = IsLayoutDirectionInherited(); break; @@ -5347,7 +5347,7 @@ bool Actor::IsLayoutDirectionInherited() const return mInheritLayoutDirection; } -void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::DevelActor::LayoutDirection::Type direction, bool set ) +void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::LayoutDirection::Type direction, bool set ) { if( actor && ( actor->mInheritLayoutDirection || set ) ) { diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index 1a45748..b45b8a6 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -1422,7 +1422,7 @@ public: * @brief Emits the layout direction change signal for this actor and all its children. * @param[in] type Whether the actor's layout direction property has changed or a parent's. */ - void EmitLayoutDirectionChangedSignal( DevelActor::LayoutDirection::Type type ); + void EmitLayoutDirectionChangedSignal( LayoutDirection::Type type ); /** * @copydoc Dali::Actor::TouchedSignal() @@ -1465,9 +1465,9 @@ public: DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal(); /** - * @copydoc DevelActor::LayoutDirectionChangedSignal + * @copydoc LayoutDirectionChangedSignal */ - DevelActor::LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal(); + Dali::Actor::LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal(); /** * Connects a callback function with the object's signals. @@ -1937,7 +1937,7 @@ private: * @param[in] actor The actor for seting layout direction. * @param[in] direction New layout direction. */ - void InheritLayoutDirectionRecursively( ActorPtr actor, Dali::DevelActor::LayoutDirection::Type direction, bool set = false ); + void InheritLayoutDirectionRecursively( ActorPtr actor, Dali::LayoutDirection::Type direction, bool set = false ); protected: @@ -1963,7 +1963,7 @@ protected: Dali::Actor::OffStageSignalType mOffStageSignal; Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal; DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal; - DevelActor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal; + Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal; Quaternion mTargetOrientation; ///< Event-side storage for orientation Vector4 mTargetColor; ///< Event-side storage for color @@ -1995,7 +1995,7 @@ protected: bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not. bool mVisible : 1; ///< Cached: Whether the actor is visible or not. bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent. - DevelActor::LayoutDirection::Type mLayoutDirection : 1; ///< Layout direction, Left to Right or Right to Left. + LayoutDirection::Type mLayoutDirection : 1; ///< Layout direction, Left to Right or Right to Left. DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited ColorMode mColorMode : 2; ///< Cached: Determines whether mWorldColor is inherited diff --git a/dali/public-api/actors/actor-enumerations.h b/dali/public-api/actors/actor-enumerations.h index 72d3d42..a60e8c7 100644 --- a/dali/public-api/actors/actor-enumerations.h +++ b/dali/public-api/actors/actor-enumerations.h @@ -2,7 +2,7 @@ #define DALI_ACTOR_ENUMERATIONS_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -59,27 +59,29 @@ enum PositionInheritanceMode */ namespace Dimension { - /** - * @brief Enumeration for Dimension types. - * @SINCE_1_0.0 - */ - enum Type - { - WIDTH = 0x1, ///< Width dimension @SINCE_1_0.0 - HEIGHT = 0x2, ///< Height dimension @SINCE_1_0.0 - - ALL_DIMENSIONS = 0x3 ///< Mask to cover all flags @SINCE_1_0.0 - }; - - /** - * @brief Enumeration for Dimension number. - * @SINCE_1_0.0 - */ - enum Meta - { - DIMENSION_COUNT = 2 ///< Number of dimensions - update this if adding new dimension @SINCE_1_0.0 - }; -} + +/** + * @brief Enumeration for Dimension types. + * @SINCE_1_0.0 + */ +enum Type +{ + WIDTH = 0x1, ///< Width dimension @SINCE_1_0.0 + HEIGHT = 0x2, ///< Height dimension @SINCE_1_0.0 + + ALL_DIMENSIONS = 0x3 ///< Mask to cover all flags @SINCE_1_0.0 +}; + +/** + * @brief Enumeration for Dimension number. + * @SINCE_1_0.0 + */ +enum Meta +{ + DIMENSION_COUNT = 2 ///< Number of dimensions - update this if adding new dimension @SINCE_1_0.0 +}; + +} // namespace Dimension /** * @brief Enumeration for size negotiation resize policies. @@ -87,23 +89,25 @@ namespace Dimension */ namespace ResizePolicy { - /** - * @brief Enumeration for ResizePolicy types. - * @SINCE_1_0.0 - */ - enum Type - { - FIXED, ///< Size is fixed as set by SetSize @SINCE_1_0.0 - USE_NATURAL_SIZE, ///< Size is to use the actor's natural size @SINCE_1_0.0 @see Actor::GetNaturalSize() - FILL_TO_PARENT, ///< Size is to fill up to the actor's parent's bounds. Aspect ratio is not maintained. @SINCE_1_0.0 - SIZE_RELATIVE_TO_PARENT, ///< The actors size will be ( ParentSize * SizeRelativeToParentFactor ). @SINCE_1_0.0 - SIZE_FIXED_OFFSET_FROM_PARENT, ///< The actors size will be ( ParentSize + SizeRelativeToParentFactor ). @SINCE_1_0.0 - FIT_TO_CHILDREN, ///< Size will adjust to wrap around all children @SINCE_1_0.0 - DIMENSION_DEPENDENCY, ///< One dimension is dependent on the other @SINCE_1_0.0 - USE_ASSIGNED_SIZE ///< The size will be assigned to the actor @SINCE_1_0.0 - }; - const Type DEFAULT = USE_NATURAL_SIZE; ///< Default resize policy -} + +/** + * @brief Enumeration for ResizePolicy types. + * @SINCE_1_0.0 + */ +enum Type +{ + FIXED, ///< Size is fixed as set by SetSize @SINCE_1_0.0 + USE_NATURAL_SIZE, ///< Size is to use the actor's natural size @SINCE_1_0.0 @see Actor::GetNaturalSize() + FILL_TO_PARENT, ///< Size is to fill up to the actor's parent's bounds. Aspect ratio is not maintained. @SINCE_1_0.0 + SIZE_RELATIVE_TO_PARENT, ///< The actors size will be ( ParentSize * SizeRelativeToParentFactor ). @SINCE_1_0.0 + SIZE_FIXED_OFFSET_FROM_PARENT, ///< The actors size will be ( ParentSize + SizeRelativeToParentFactor ). @SINCE_1_0.0 + FIT_TO_CHILDREN, ///< Size will adjust to wrap around all children @SINCE_1_0.0 + DIMENSION_DEPENDENCY, ///< One dimension is dependent on the other @SINCE_1_0.0 + USE_ASSIGNED_SIZE ///< The size will be assigned to the actor @SINCE_1_0.0 +}; +const Type DEFAULT = USE_NATURAL_SIZE; ///< Default resize policy + +} // namespace ResizePolicy /** * @brief Enumeration for policies to determine how an actor should resize itself when having its size set in size negotiation. @@ -111,17 +115,19 @@ namespace ResizePolicy */ namespace SizeScalePolicy { - /** - * @brief Enumeration for SizeScalePolicy types. - * @SINCE_1_0.0 - */ - enum Type - { - USE_SIZE_SET, ///< Use the size that was set @SINCE_1_0.0 - FIT_WITH_ASPECT_RATIO, ///< Fit within the size set maintaining natural size aspect ratio @SINCE_1_0.0 - FILL_WITH_ASPECT_RATIO ///< Fill up the size set maintaining natural size aspect ratio. May exceed size bounds in one dimension. @SINCE_1_0.0 - }; -} + +/** + * @brief Enumeration for SizeScalePolicy types. + * @SINCE_1_0.0 + */ +enum Type +{ + USE_SIZE_SET, ///< Use the size that was set @SINCE_1_0.0 + FIT_WITH_ASPECT_RATIO, ///< Fit within the size set maintaining natural size aspect ratio @SINCE_1_0.0 + FILL_WITH_ASPECT_RATIO ///< Fill up the size set maintaining natural size aspect ratio. May exceed size bounds in one dimension. @SINCE_1_0.0 +}; + +} // namespace SizeScalePolicy /** * @brief Enumeration for horizontal alignment types. @@ -129,17 +135,19 @@ namespace SizeScalePolicy */ namespace HorizontalAlignment { - /** - * @brief Enumeration for HorizontalAlignment types. - * @SINCE_1_0.0 - */ - enum Type - { - LEFT, ///< Align horizontally left @SINCE_1_0.0 - CENTER, ///< Align horizontally center @SINCE_1_0.0 - RIGHT ///< Align horizontally right @SINCE_1_0.0 - }; -} + +/** + * @brief Enumeration for HorizontalAlignment types. + * @SINCE_1_0.0 + */ +enum Type +{ + LEFT, ///< Align horizontally left @SINCE_1_0.0 + CENTER, ///< Align horizontally center @SINCE_1_0.0 + RIGHT ///< Align horizontally right @SINCE_1_0.0 +}; + +} // namespace HorizontalAlignment /** * @brief Enumeration for vertical alignment types. @@ -147,17 +155,19 @@ namespace HorizontalAlignment */ namespace VerticalAlignment { - /** - * @brief Enumeration for VerticalAlignment types. - * @SINCE_1_0.0 - */ - enum Type - { - TOP, ///< Align vertically top @SINCE_1_0.0 - CENTER, ///< Align vertically center @SINCE_1_0.0 - BOTTOM ///< Align vertically bottom @SINCE_1_0.0 - }; -} + +/** + * @brief Enumeration for VerticalAlignment types. + * @SINCE_1_0.0 + */ +enum Type +{ + TOP, ///< Align vertically top @SINCE_1_0.0 + CENTER, ///< Align vertically center @SINCE_1_0.0 + BOTTOM ///< Align vertically bottom @SINCE_1_0.0 +}; + +} // namespace VerticalAlignment /** * @brief Enumeration for ClippingMode describing how this Actor's children will be clipped against it. @@ -165,17 +175,37 @@ namespace VerticalAlignment */ namespace ClippingMode { - /** - * @brief Enumeration for ClippingMode types. - * @SINCE_1_2_5 - */ - enum Type - { - DISABLED, ///< This Actor will not clip its children. @SINCE_1_2_5 - CLIP_CHILDREN, ///< This Actor will clip all children to within its boundaries (the actor will also be visible itself). @SINCE_1_2_5 - }; -} +/** + * @brief Enumeration for ClippingMode types. + * @SINCE_1_2_5 + */ +enum Type +{ + DISABLED, ///< This Actor will not clip its children. @SINCE_1_2_5 + CLIP_CHILDREN, ///< This Actor will clip all children to within its boundaries (the actor will also be visible itself). @SINCE_1_2_5 +}; + +} // namespace ClippingMode + +/** + * @brief Enumeration for the direction of the layout. + * @SINCE_1_2.60 + */ +namespace LayoutDirection +{ + +/** + * @brief Enumeration for the LayoutDirection types. + * @SINCE_1_2.60 + */ +enum Type +{ + LEFT_TO_RIGHT, ///< Layout direction is from Left to Right direction. @SINCE_1_2.60 + RIGHT_TO_LEFT ///< Layout direction is from Right to Left direction. @SINCE_1_2.60 +}; + +} // namespace LayoutDirection /** * @} diff --git a/dali/public-api/actors/actor.cpp b/dali/public-api/actors/actor.cpp index b96283f..0cd89e1 100644 --- a/dali/public-api/actors/actor.cpp +++ b/dali/public-api/actors/actor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -444,6 +444,36 @@ bool Actor::IsKeyboardFocusable() const return GetImplementation(*this).IsKeyboardFocusable(); } +void Actor::Raise() +{ + GetImplementation( *this ).Raise(); +} + +void Actor::Lower() +{ + GetImplementation( *this ).Lower(); +} + +void Actor::RaiseToTop() +{ + GetImplementation( *this ).RaiseToTop(); +} + +void Actor::LowerToBottom() +{ + GetImplementation( *this ).LowerToBottom(); +} + +void Actor::RaiseAbove( Actor target ) +{ + GetImplementation( *this ).RaiseAbove( GetImplementation( target ) ); +} + +void Actor::LowerBelow( Actor target ) +{ + GetImplementation( *this ).LowerBelow( GetImplementation( target ) ); +} + void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) { GetImplementation(*this).SetResizePolicy( policy, dimension ); @@ -601,6 +631,11 @@ Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal() return GetImplementation(*this).OnRelayoutSignal(); } +Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal() +{ + return GetImplementation( *this ).LayoutDirectionChangedSignal(); +} + Actor::Actor(Internal::Actor* internal) : Handle(internal) { diff --git a/dali/public-api/actors/actor.h b/dali/public-api/actors/actor.h index ae5be1e..f917250 100644 --- a/dali/public-api/actors/actor.h +++ b/dali/public-api/actors/actor.h @@ -2,7 +2,7 @@ #define DALI_ACTOR_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -308,6 +308,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 +335,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 @@ -1238,6 +1254,62 @@ 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 + * @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 + * @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 /** @@ -1555,6 +1627,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 laytou 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 -- 2.7.4