From: Victor Cebollada Date: Fri, 9 Nov 2018 09:37:18 +0000 (+0000) Subject: [dali_1.3.49] Merge branch 'devel/master' X-Git-Tag: dali_1.9.8~5^2~72 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=71cf2e93c6219b9dd75800d5ebbf85ac15dc28ec;hp=141d88c741ff0aef9aa74259f116fc17023e043a [dali_1.3.49] Merge branch 'devel/master' Change-Id: Ic8baae5cd3d71ae89ac1c2467859eb07e98cedfa --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp index bc9d08b..b9278e3 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp @@ -5316,7 +5316,7 @@ int UtcDaliTextAlign10(void) fontDescriptionRuns.PushBack( fontDescriptionRun05 ); fontDescriptionRuns.PushBack( fontDescriptionRun06 ); - float positions[] = { -4.f, 0.f, 0.f, 0.f, 0.f, 0.f }; + float positions[] = { 0.f, 0.f, 0.f, 0.f, 0.f, 0.f }; Size textArea( 100.f, 300.f ); AlignData data = @@ -5345,6 +5345,248 @@ int UtcDaliTextAlign10(void) END_TEST; } +int UtcDaliTextAlign11(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextAlign11"); + + // Calculate text alignment. + + const std::string fontLatin( "TizenSans" ); + const std::string fontHebrew( "TizenSansHebrew" ); + const std::string fontArabic( "TizenSansArabic" ); + + // Set a known font description + FontDescriptionRun fontDescriptionRun01; + fontDescriptionRun01.characterRun.characterIndex = 0u; + fontDescriptionRun01.characterRun.numberOfCharacters = 12u; + fontDescriptionRun01.familyLength = fontLatin.size(); + fontDescriptionRun01.familyName = new char[fontDescriptionRun01.familyLength]; + memcpy( fontDescriptionRun01.familyName, fontLatin.c_str(), fontDescriptionRun01.familyLength ); + fontDescriptionRun01.familyDefined = true; + fontDescriptionRun01.weightDefined = false; + fontDescriptionRun01.widthDefined = false; + fontDescriptionRun01.slantDefined = false; + fontDescriptionRun01.sizeDefined = false; + + FontDescriptionRun fontDescriptionRun02; + fontDescriptionRun02.characterRun.characterIndex = 12u; + fontDescriptionRun02.characterRun.numberOfCharacters = 10u; + fontDescriptionRun02.familyLength = fontHebrew.size(); + fontDescriptionRun02.familyName = new char[fontDescriptionRun02.familyLength]; + memcpy( fontDescriptionRun02.familyName, fontHebrew.c_str(), fontDescriptionRun02.familyLength ); + fontDescriptionRun02.familyDefined = true; + fontDescriptionRun02.weightDefined = false; + fontDescriptionRun02.widthDefined = false; + fontDescriptionRun02.slantDefined = false; + fontDescriptionRun02.sizeDefined = false; + + FontDescriptionRun fontDescriptionRun03; + fontDescriptionRun03.characterRun.characterIndex = 22u; + fontDescriptionRun03.characterRun.numberOfCharacters = 14u; + fontDescriptionRun03.familyLength = fontArabic.size(); + fontDescriptionRun03.familyName = new char[fontDescriptionRun03.familyLength]; + memcpy( fontDescriptionRun03.familyName, fontArabic.c_str(), fontDescriptionRun03.familyLength ); + fontDescriptionRun03.familyDefined = true; + fontDescriptionRun03.weightDefined = false; + fontDescriptionRun03.widthDefined = false; + fontDescriptionRun03.slantDefined = false; + fontDescriptionRun03.sizeDefined = false; + + FontDescriptionRun fontDescriptionRun04; + fontDescriptionRun04.characterRun.characterIndex = 36u; + fontDescriptionRun04.characterRun.numberOfCharacters = 12u; + fontDescriptionRun04.familyLength = fontLatin.size(); + fontDescriptionRun04.familyName = new char[fontDescriptionRun04.familyLength]; + memcpy( fontDescriptionRun04.familyName, fontLatin.c_str(), fontDescriptionRun04.familyLength ); + fontDescriptionRun04.familyDefined = true; + fontDescriptionRun04.weightDefined = false; + fontDescriptionRun04.widthDefined = false; + fontDescriptionRun04.slantDefined = false; + fontDescriptionRun04.sizeDefined = false; + + FontDescriptionRun fontDescriptionRun05; + fontDescriptionRun05.characterRun.characterIndex = 48u; + fontDescriptionRun05.characterRun.numberOfCharacters = 12u; + fontDescriptionRun05.familyLength = fontLatin.size(); + fontDescriptionRun05.familyName = new char[fontDescriptionRun05.familyLength]; + memcpy( fontDescriptionRun05.familyName, fontLatin.c_str(), fontDescriptionRun05.familyLength ); + fontDescriptionRun05.familyDefined = true; + fontDescriptionRun05.weightDefined = false; + fontDescriptionRun05.widthDefined = false; + fontDescriptionRun05.slantDefined = false; + fontDescriptionRun05.sizeDefined = false; + + FontDescriptionRun fontDescriptionRun06; + fontDescriptionRun06.characterRun.characterIndex = 60u; + fontDescriptionRun06.characterRun.numberOfCharacters = 14u; + fontDescriptionRun06.familyLength = fontArabic.size(); + fontDescriptionRun06.familyName = new char[fontDescriptionRun06.familyLength]; + memcpy( fontDescriptionRun06.familyName, fontArabic.c_str(), fontDescriptionRun06.familyLength ); + fontDescriptionRun06.familyDefined = true; + fontDescriptionRun06.weightDefined = false; + fontDescriptionRun06.widthDefined = false; + fontDescriptionRun06.slantDefined = false; + fontDescriptionRun06.sizeDefined = false; + + Vector fontDescriptionRuns; + fontDescriptionRuns.PushBack( fontDescriptionRun01 ); + fontDescriptionRuns.PushBack( fontDescriptionRun02 ); + fontDescriptionRuns.PushBack( fontDescriptionRun03 ); + fontDescriptionRuns.PushBack( fontDescriptionRun04 ); + fontDescriptionRuns.PushBack( fontDescriptionRun05 ); + fontDescriptionRuns.PushBack( fontDescriptionRun06 ); + + float positions[] = { 20.f, 33.f, 2.f, 0.f, 0.f, 0.f }; + + Size textArea( 100.f, 300.f ); + AlignData data = + { + "End alignment for the last paragraph.", + "Hello world שלום עולם\nمرحبا بالعالم Hello world\nHello world مرحبا بالعالم.", + textArea, + 6u, + fontDescriptionRuns.Begin(), + Text::HorizontalAlignment::END, + Text::VerticalAlignment::TOP, + 0u, + 26u, + 6u, + positions, + Dali::LayoutDirection::LEFT_TO_RIGHT, + true + }; + + if( !AlignTest( data ) ) + { + tet_result(TET_FAIL); + } + + tet_result(TET_PASS); + END_TEST; +} + +int UtcDaliTextAlign12(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextAlign12"); + + // Calculate text alignment. + + const std::string fontLatin( "TizenSans" ); + const std::string fontHebrew( "TizenSansHebrew" ); + const std::string fontArabic( "TizenSansArabic" ); + + // Set a known font description + FontDescriptionRun fontDescriptionRun01; + fontDescriptionRun01.characterRun.characterIndex = 0u; + fontDescriptionRun01.characterRun.numberOfCharacters = 12u; + fontDescriptionRun01.familyLength = fontLatin.size(); + fontDescriptionRun01.familyName = new char[fontDescriptionRun01.familyLength]; + memcpy( fontDescriptionRun01.familyName, fontLatin.c_str(), fontDescriptionRun01.familyLength ); + fontDescriptionRun01.familyDefined = true; + fontDescriptionRun01.weightDefined = false; + fontDescriptionRun01.widthDefined = false; + fontDescriptionRun01.slantDefined = false; + fontDescriptionRun01.sizeDefined = false; + + FontDescriptionRun fontDescriptionRun02; + fontDescriptionRun02.characterRun.characterIndex = 12u; + fontDescriptionRun02.characterRun.numberOfCharacters = 10u; + fontDescriptionRun02.familyLength = fontHebrew.size(); + fontDescriptionRun02.familyName = new char[fontDescriptionRun02.familyLength]; + memcpy( fontDescriptionRun02.familyName, fontHebrew.c_str(), fontDescriptionRun02.familyLength ); + fontDescriptionRun02.familyDefined = true; + fontDescriptionRun02.weightDefined = false; + fontDescriptionRun02.widthDefined = false; + fontDescriptionRun02.slantDefined = false; + fontDescriptionRun02.sizeDefined = false; + + FontDescriptionRun fontDescriptionRun03; + fontDescriptionRun03.characterRun.characterIndex = 22u; + fontDescriptionRun03.characterRun.numberOfCharacters = 14u; + fontDescriptionRun03.familyLength = fontArabic.size(); + fontDescriptionRun03.familyName = new char[fontDescriptionRun03.familyLength]; + memcpy( fontDescriptionRun03.familyName, fontArabic.c_str(), fontDescriptionRun03.familyLength ); + fontDescriptionRun03.familyDefined = true; + fontDescriptionRun03.weightDefined = false; + fontDescriptionRun03.widthDefined = false; + fontDescriptionRun03.slantDefined = false; + fontDescriptionRun03.sizeDefined = false; + + FontDescriptionRun fontDescriptionRun04; + fontDescriptionRun04.characterRun.characterIndex = 36u; + fontDescriptionRun04.characterRun.numberOfCharacters = 12u; + fontDescriptionRun04.familyLength = fontLatin.size(); + fontDescriptionRun04.familyName = new char[fontDescriptionRun04.familyLength]; + memcpy( fontDescriptionRun04.familyName, fontLatin.c_str(), fontDescriptionRun04.familyLength ); + fontDescriptionRun04.familyDefined = true; + fontDescriptionRun04.weightDefined = false; + fontDescriptionRun04.widthDefined = false; + fontDescriptionRun04.slantDefined = false; + fontDescriptionRun04.sizeDefined = false; + + FontDescriptionRun fontDescriptionRun05; + fontDescriptionRun05.characterRun.characterIndex = 48u; + fontDescriptionRun05.characterRun.numberOfCharacters = 12u; + fontDescriptionRun05.familyLength = fontLatin.size(); + fontDescriptionRun05.familyName = new char[fontDescriptionRun05.familyLength]; + memcpy( fontDescriptionRun05.familyName, fontLatin.c_str(), fontDescriptionRun05.familyLength ); + fontDescriptionRun05.familyDefined = true; + fontDescriptionRun05.weightDefined = false; + fontDescriptionRun05.widthDefined = false; + fontDescriptionRun05.slantDefined = false; + fontDescriptionRun05.sizeDefined = false; + + FontDescriptionRun fontDescriptionRun06; + fontDescriptionRun06.characterRun.characterIndex = 60u; + fontDescriptionRun06.characterRun.numberOfCharacters = 14u; + fontDescriptionRun06.familyLength = fontArabic.size(); + fontDescriptionRun06.familyName = new char[fontDescriptionRun06.familyLength]; + memcpy( fontDescriptionRun06.familyName, fontArabic.c_str(), fontDescriptionRun06.familyLength ); + fontDescriptionRun06.familyDefined = true; + fontDescriptionRun06.weightDefined = false; + fontDescriptionRun06.widthDefined = false; + fontDescriptionRun06.slantDefined = false; + fontDescriptionRun06.sizeDefined = false; + + Vector fontDescriptionRuns; + fontDescriptionRuns.PushBack( fontDescriptionRun01 ); + fontDescriptionRuns.PushBack( fontDescriptionRun02 ); + fontDescriptionRuns.PushBack( fontDescriptionRun03 ); + fontDescriptionRuns.PushBack( fontDescriptionRun04 ); + fontDescriptionRuns.PushBack( fontDescriptionRun05 ); + fontDescriptionRuns.PushBack( fontDescriptionRun06 ); + + float positions[] = { 0.f, 0.f, 0.f, 0.f, 0.f, 0.f }; + + Size textArea( 100.f, 300.f ); + AlignData data = + { + "Begin alignment for the first paragraph.", + "Hello world שלום עולם\nمرحبا بالعالم Hello world\nHello world مرحبا بالعالم.", + textArea, + 6u, + fontDescriptionRuns.Begin(), + Text::HorizontalAlignment::BEGIN, + Text::VerticalAlignment::TOP, + 48u, + 26u, + 6u, + positions, + Dali::LayoutDirection::LEFT_TO_RIGHT, + true + }; + + if( !AlignTest( data ) ) + { + tet_result(TET_FAIL); + } + + tet_result(TET_PASS); + END_TEST; +} + int UtcDaliTextLayoutSetGetDefaultLineSpacing(void) { ToolkitTestApplication application; diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-text-abstraction.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-text-abstraction.cpp index 75312ef..bef3271 100755 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-text-abstraction.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-text-abstraction.cpp @@ -70,7 +70,8 @@ public: } return bidirectionalSupportHandle; } - BidiInfoIndex CreateInfo( const Character* const paragraph, Length numberOfCharacters ){return 0;} + BidiInfoIndex CreateInfo( const Character* const paragraph, Length numberOfCharacters, + bool matchSystemLanguageDirection, LayoutDirection::Type layoutDirection ){return 0;} void DestroyInfo( BidiInfoIndex bidiInfoIndex ) { @@ -302,9 +303,11 @@ BidirectionalSupport BidirectionalSupport::Get() } BidiInfoIndex BidirectionalSupport::CreateInfo( const Character* const paragraph, - Length numberOfCharacters ) + Length numberOfCharacters, + bool matchSystemLanguageDirection, + LayoutDirection::Type layoutDirection ) { - return GetImplementation( *this ).CreateInfo( paragraph, numberOfCharacters ); + return GetImplementation( *this ).CreateInfo( paragraph, numberOfCharacters, matchSystemLanguageDirection, layoutDirection ); } void BidirectionalSupport::DestroyInfo( BidiInfoIndex bidiInfoIndex ) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-LayoutingAnimation.cpp b/automated-tests/src/dali-toolkit/utc-Dali-LayoutingAnimation.cpp index ead839d..c7e2e4f 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-LayoutingAnimation.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-LayoutingAnimation.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -56,7 +57,7 @@ struct LayoutTransitionFinishCheck { } - void operator()( LayoutTransitionData::LayoutTransitionType type, LayoutTransitionData& layoutTransitionData ) + void operator()( LayoutTransitionData::Type type, LayoutTransitionData& layoutTransitionData ) { mSignalReceived = true; } @@ -153,22 +154,44 @@ int UtcDaliLayouting_LayoutTransitionDataSetGetTransition(void) auto layout = LinearLayout::New(); auto layoutTransitionData = LayoutTransitionData::New(); - layout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, layoutTransitionData ); - DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == layoutTransitionData ); - DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() ); - DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() ); - - layout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, LayoutTransitionData() ); layout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData ); - DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() ); DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == layoutTransitionData ); DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() ); layout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, LayoutTransitionData() ); layout.SetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE, layoutTransitionData ); - DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() ); DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() ); DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == layoutTransitionData ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() ); + + layout.SetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE, LayoutTransitionData() ); + layout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == layoutTransitionData ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() ); + + layout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, LayoutTransitionData() ); + layout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, layoutTransitionData ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == layoutTransitionData ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() ); + + layout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, LayoutTransitionData() ); + layout.SetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE, layoutTransitionData ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() ); + DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == layoutTransitionData ); END_TEST; } @@ -181,11 +204,11 @@ int UtcDaliLayouting_SetLayoutTransition01(void) Stage stage = Stage::GetCurrent(); auto container = Control::New(); auto horizontalLayout = LinearLayout::New(); - horizontalLayout.SetAnimateLayout( true ); + horizontalLayout.SetAnimateLayout( false ); horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); auto verticalLayout = LinearLayout::New(); - verticalLayout.SetAnimateLayout( true ); + verticalLayout.SetAnimateLayout( false ); verticalLayout.SetOrientation( LinearLayout::Orientation::VERTICAL ); DevelControl::SetLayout( container, horizontalLayout ); @@ -198,9 +221,6 @@ int UtcDaliLayouting_SetLayoutTransition01(void) { container.Add( iter ); } - - container.SetParentOrigin( ParentOrigin::CENTER ); - container.SetAnchorPoint( AnchorPoint::CENTER ); stage.Add( container ); auto layoutTransitionData = LayoutTransitionData::New(); @@ -257,12 +277,11 @@ int UtcDaliLayouting_SetLayoutTransition01(void) application.Render(); // First round, no animation - // TODO: container size (0, 0) after it is added to the stage should be fixed with HQ patch soon DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); @@ -270,6 +289,9 @@ int UtcDaliLayouting_SetLayoutTransition01(void) LayoutTransitionFinishCheck finishCheck(signalReceived); layoutTransitionData.FinishedSignal().Connect(&application, finishCheck); + horizontalLayout.SetAnimateLayout( true ); + verticalLayout.SetAnimateLayout( true ); + // Change a layout, start transition verticalLayout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, layoutTransitionData ); DevelControl::SetLayout( container, verticalLayout ); @@ -373,8 +395,6 @@ int UtcDaliLayouting_AddChildLayoutTransition01(void) std::vector< Control > controls; controls.push_back( CreateLeafControl( 100, 100 ) ); - container.SetParentOrigin( ParentOrigin::CENTER ); - container.SetAnchorPoint( AnchorPoint::CENTER ); stage.Add( container ); auto layoutTransitionData = LayoutTransitionData::New(); @@ -393,6 +413,7 @@ int UtcDaliLayouting_AddChildLayoutTransition01(void) { // Instant position for a child Property::Map map; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::NONE; map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = "position"; map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR") @@ -404,6 +425,7 @@ int UtcDaliLayouting_AddChildLayoutTransition01(void) { // Grow a child from (0,0) size to full size (captured) Property::Map map; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_ADD; map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = "size"; map[ LayoutTransitionData::AnimatorKey::INITIAL_VALUE ] = Vector3( 0.0f, 0.0f, 0 ); map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() @@ -411,7 +433,7 @@ int UtcDaliLayouting_AddChildLayoutTransition01(void) .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); - layoutTransitionData.AddPropertyAnimator( controls[0], map ); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to an added child } horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData ); @@ -462,17 +484,16 @@ int UtcDaliLayouting_RemoveChildLayoutTransition01(void) Stage stage = Stage::GetCurrent(); auto container = Control::New(); auto horizontalLayout = LinearLayout::New(); - horizontalLayout.SetAnimateLayout( true ); + horizontalLayout.SetAnimateLayout( false ); horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); DevelControl::SetLayout( container, horizontalLayout ); - container.SetName( "Container"); + container.SetName( "Container" ); std::vector< Control > controls; controls.push_back( CreateLeafControl( 100, 100 ) ); controls.push_back( CreateLeafControl( 100, 100 ) ); - container.SetParentOrigin( ParentOrigin::CENTER ); - container.SetAnchorPoint( AnchorPoint::CENTER ); + stage.Add( container ); container.Add( controls[0] ); container.Add( controls[1] ); @@ -481,6 +502,8 @@ int UtcDaliLayouting_RemoveChildLayoutTransition01(void) application.SendNotification(); application.Render(); + horizontalLayout.SetAnimateLayout( true ); + auto layoutTransitionData = LayoutTransitionData::New(); { // Instant resize for parent width @@ -561,7 +584,21 @@ int UtcDaliLayouting_RemoveChildLayoutTransition01(void) layoutTransitionData.AddPropertyAnimator( Actor(), map ); } { - // Instant position for a child + // Shrink the removed child + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_REMOVE; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Size( 0.0f, 0.0f ); + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" ) + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR") + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); + } + { + // Instant position for children Property::Map map; map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION_X; map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() @@ -573,7 +610,7 @@ int UtcDaliLayouting_RemoveChildLayoutTransition01(void) layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent } { - // Instant position for a child + // Instant position for children Property::Map map; map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION_Y; map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() @@ -602,7 +639,7 @@ int UtcDaliLayouting_RemoveChildLayoutTransition01(void) DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 0.0f, 0.0f, 0.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); // this control is already removed from the tree. DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); @@ -613,7 +650,7 @@ int UtcDaliLayouting_RemoveChildLayoutTransition01(void) DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); // this control is already removed from the tree. - DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION ); DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 0.0f, 0.0f, 0.0f ), 1.0f, TEST_LOCATION ); @@ -627,13 +664,153 @@ int UtcDaliLayouting_RemoveChildLayoutTransition01(void) DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); // this control is already removed from the tree. + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + // this control is already removed from the tree. + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); + + finishCheck.CheckSignalReceived(); + + END_TEST; +} + +int UtcDaliLayouting_FocusChildLayoutTransition01(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition01"); + + Stage stage = Stage::GetCurrent(); + auto container = Control::New(); + auto horizontalLayout = LinearLayout::New(); + horizontalLayout.SetAnimateLayout( false ); + horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); + + DevelControl::SetLayout( container, horizontalLayout ); + container.SetName( "Container" ); + + std::vector< Control > controls; + controls.push_back( CreateLeafControl( 100, 100 ) ); + controls.push_back( CreateLeafControl( 100, 100 ) ); + + stage.Add( container ); + container.Add( controls[0] ); + container.Add( controls[1] ); + + KeyInputFocusManager manager = KeyInputFocusManager::Get(); + manager.SetFocus( controls[0] ); + + // Initial rendering done + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - // this control is already removed from the tree. DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + horizontalLayout.SetAnimateLayout( true ); + + auto layoutTransitionData = LayoutTransitionData::New(); + { + // Instant resize for parent + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); + layoutTransitionData.AddPropertyAnimator( container, map ); + } + { + // Instant position for parent + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR") + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent + } + { + // Shrink the lost focus child + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 80.0f, 80.0f, 0 ); + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR") + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child + } + { + // Grow the gained focus child + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; + map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 120.0f, 120.0f, 0 ); + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR") + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus gained child + } + + horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData ); + + bool signalReceived(false); + LayoutTransitionFinishCheck finishCheck(signalReceived); + layoutTransitionData.FinishedSignal().Connect(&application, finishCheck); + manager.SetFocus( controls[1] ); + + application.SendNotification(); + application.Render( 1u /*just very beginning of the animation*/ ); + + finishCheck.CheckSignalNotReceived(); + // Animation just started + DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(static_cast( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ ); + + // Animation just finished + DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 80.0f, 80.0f, 0.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 120.0f, 120.0f, 0.0f ), 1.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render( 10u /* wait a bit more for a signal */ ); + + // Now sizes and positions are finally set + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + finishCheck.CheckSignalReceived(); END_TEST; @@ -655,8 +832,6 @@ int UtcDaliLayouting_AddChildLayoutTransition02_KeyFrames(void) std::vector< Control > controls; controls.push_back( CreateLeafControl( 100, 100 ) ); - container.SetParentOrigin( ParentOrigin::CENTER ); - container.SetAnchorPoint( AnchorPoint::CENTER ); stage.Add( container ); auto layoutTransitionData = LayoutTransitionData::New(); @@ -690,14 +865,15 @@ int UtcDaliLayouting_AddChildLayoutTransition02_KeyFrames(void) keyFrames.Add( 0.5f, Vector3( 100.0f, 100.0f, 0 ) ); Property::Map map; - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() - .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_BETWEEN") - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR") - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); - layoutTransitionData.AddPropertyAnimator( controls[0], map, keyFrames, Animation::Interpolation::Linear ); + map[ "property" ] = Actor::Property::SIZE; + map[ "condition" ] = LayoutTransitionData::Condition::ON_ADD; + map[ "animator" ] = Property::Map() + .Add( "type", "ANIMATE_BETWEEN") + .Add( "alphaFunction", "LINEAR") + .Add( "timePeriod", Property::Map() + .Add( "delay", 0.0f) + .Add( "duration", 0.5f)); + layoutTransitionData.AddPropertyAnimator( Actor(), map, keyFrames, Animation::Interpolation::Linear ); } horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData ); @@ -756,8 +932,6 @@ int UtcDaliLayouting_AddChildLayoutTransition03_Path(void) std::vector< Control > controls; controls.push_back( CreateLeafControl( 100, 100 ) ); - container.SetParentOrigin( ParentOrigin::CENTER ); - container.SetAnchorPoint( AnchorPoint::CENTER ); stage.Add( container ); auto layoutTransitionData = LayoutTransitionData::New(); @@ -886,8 +1060,6 @@ int UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy(void) std::vector< Control > controls; controls.push_back( CreateLeafControl( 100, 100 ) ); - container.SetParentOrigin( ParentOrigin::CENTER ); - container.SetAnchorPoint( AnchorPoint::CENTER ); stage.Add( container ); auto layoutTransitionData = LayoutTransitionData::New(); @@ -983,8 +1155,6 @@ int UtcDaliLayouting_AddChildLayoutTransition05(void) std::vector< Control > controls; controls.push_back( CreateLeafControl( 100, 100 ) ); - container.SetParentOrigin( ParentOrigin::CENTER ); - container.SetAnchorPoint( AnchorPoint::CENTER ); stage.Add( container ); auto layoutTransitionData = LayoutTransitionData::New(); @@ -1209,3 +1379,119 @@ int UtcDaliLayouting_AddChildLayoutTransition05(void) END_TEST; } +int UtcDaliLayouting_DefaultTransition01(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliLayouting_DefaultTransition01"); + + Stage stage = Stage::GetCurrent(); + auto container = Control::New(); + auto horizontalLayout = LinearLayout::New(); + horizontalLayout.SetAnimateLayout( false ); + horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); + + DevelControl::SetLayout( container, horizontalLayout ); + container.SetName( "Container" ); + + std::vector< Control > controls; + controls.push_back( CreateLeafControl( 100, 100 ) ); + controls.push_back( CreateLeafControl( 100, 100 ) ); + + stage.Add( container ); + container.Add( controls[0] ); + container.Add( controls[1] ); + + // Initial rendering done + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + horizontalLayout.SetAnimateLayout( true ); + + auto layoutTransitionData0 = LayoutTransitionData::New(); + { + // Default instant resize + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); + layoutTransitionData0.AddPropertyAnimator( controls[0], map ); + } + { + // Instant instant position + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); + layoutTransitionData0.AddPropertyAnimator( controls[0], map ); + } + DevelControl::GetLayout( controls[0] ).SetTransitionData(LayoutTransitionData::Type::ON_LAYOUT_CHANGE, layoutTransitionData0 ); + + auto layoutTransitionData1 = LayoutTransitionData::New(); + { + // Default instant resize + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); + layoutTransitionData1.AddPropertyAnimator( controls[1], map ); + } + { + // Instant instant position + Property::Map map; + map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; + map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update + map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() + .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) + .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() + .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) + .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); + layoutTransitionData0.AddPropertyAnimator( controls[1], map ); + } + DevelControl::GetLayout( controls[1] ).SetTransitionData(LayoutTransitionData::Type::ON_LAYOUT_CHANGE, layoutTransitionData1 ); + + horizontalLayout.SetOrientation( LinearLayout::Orientation::VERTICAL ); + + application.SendNotification(); + application.Render( 10u /*just very beginning of the animation*/ ); + + // Animation just finished + DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION ); + + // Now sizes and positions are set + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( container.GetProperty( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + END_TEST; +} + diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index dd538d4..49889ff 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -101,6 +101,8 @@ const char* const PROPERTY_NAME_ENABLE_SELECTION = "enableSe const char* const PROPERTY_NAME_PLACEHOLDER = "placeholder"; const char* const PROPERTY_NAME_ENABLE_SHIFT_SELECTION = "enableShiftSelection"; const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE = "enableGrabHandle"; +const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection"; + const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND; @@ -542,6 +544,7 @@ int UtcDaliTextEditorGetPropertyP(void) DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR ) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR ); DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION ); DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE ) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE ); + DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION ) == DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ); END_TEST; } @@ -2877,6 +2880,34 @@ int UtcDaliTextEditorEnableGrabHandleProperty(void) END_TEST; } +int UtcDaliTextEditorMatchSystemLanguageDirectionProperty(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTextEditorMatchSystemLanguageDirectionProperty"); + + TextEditor editor = TextEditor::New(); + DALI_TEST_CHECK( editor ); + editor.SetSize( 300.f, 50.f ); + editor.SetParentOrigin( ParentOrigin::TOP_LEFT ); + editor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + Stage::GetCurrent().Add( editor ); + + application.SendNotification(); + application.Render(); + + // The default value of MATCH_SYSTEM_LANGUAGE_DIRECTION is 'false'. + DALI_TEST_EQUALS( editor.GetProperty( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), false, TEST_LOCATION ); + + // Check the enable match system language direction property + editor.SetProperty( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true ); + DALI_TEST_EQUALS( editor.GetProperty( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + END_TEST; +} + int UtcDaliTextEditorGetInputMethodContext(void) { ToolkitTestApplication application; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 64a5d55..4a2d453 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -103,6 +103,7 @@ const char* const PROPERTY_NAME_PLACEHOLDER = "placehol const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis"; const char* const PROPERTY_NAME_ENABLE_SHIFT_SELECTION = "enableShiftSelection"; const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE = "enableGrabHandle"; +const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection"; const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND; @@ -548,6 +549,7 @@ int UtcDaliTextFieldGetPropertyP(void) DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextField::Property::ELLIPSIS ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextField::Property::ENABLE_SHIFT_SELECTION ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE ) == DevelTextField::Property::ENABLE_GRAB_HANDLE ); + DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION ) == DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ); END_TEST; } @@ -2823,6 +2825,120 @@ int UtcDaliTextFieldEnableGrabHandleProperty(void) END_TEST; } +int UtcDaliTextFieldMatchSystemLanguageDirectionProperty(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTextFieldMatchSystemLanguageDirectionProperty"); + + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + field.SetSize( 300.f, 50.f ); + field.SetParentOrigin( ParentOrigin::TOP_LEFT ); + field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + Stage::GetCurrent().Add( field ); + + application.SendNotification(); + application.Render(); + + // The default value of MATCH_SYSTEM_LANGUAGE_DIRECTION is 'false'. + DALI_TEST_EQUALS( field.GetProperty( DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), false, TEST_LOCATION ); + + // Check the match system language direction property + field.SetProperty( DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true ); + DALI_TEST_EQUALS( field.GetProperty( DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + END_TEST; +} + +int utcDaliTextFieldLayoutDirectionCoverage(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextFieldLayoutDirectionCoverage"); + + // Creates a tap event. After creating a tap event the text field should + // have the focus and add text with key events should be possible. + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + + Stage::GetCurrent().Add( field ); + + field.SetSize( 300.f, 50.f ); + field.SetParentOrigin( ParentOrigin::TOP_LEFT ); + field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + + // Render and notify + application.SendNotification(); + application.Render(); + + // init direction for coverage + // Set horizontal alignment END + field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "END"); + + // Create a tap event to touch the text field. + application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Set MATCH_SYSTEM_LANGUAGE_DIRECTION to true to use the layout direction. + field.SetProperty( DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true ); + field.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); + + // Set horizontal alignment BEGIN + field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN"); + + // Create a tap event to touch the text field. + application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Set horizontal alignment CENTER + field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "CENTER"); + + // Create a tap event to touch the text field. + application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Set horizontal alignment END + field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "END"); + + // Create a tap event to touch the text field. + application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Generate a Esc key event. The text field should lose the focus. + application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( false, field.HasKeyInputFocus(), TEST_LOCATION ); + + END_TEST; +} + + int UtcDaliTextFieldGetInputMethodContext(void) { ToolkitTestApplication application; @@ -2833,3 +2949,4 @@ int UtcDaliTextFieldGetInputMethodContext(void) END_TEST; } + diff --git a/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h index 7bed333..4d600b5 100755 --- a/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h @@ -110,7 +110,14 @@ namespace Property * @details Name "enableGrabHandle", type Property::BOOLEAN. * @note The default value is true, which means the grab handles are enabled by default. */ - ENABLE_GRAB_HANDLE + ENABLE_GRAB_HANDLE, + + /** + * @brief Modifies the default text alignment to match the direction of the system language. + * @details Name "matchSystemLanguageDirection", type (Property::BOOLEAN), Read/Write + * @note The default value is false + */ + MATCH_SYSTEM_LANGUAGE_DIRECTION }; } // namespace Property diff --git a/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h index dea5ded..7608577 100755 --- a/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h @@ -100,7 +100,15 @@ namespace Property * @details Name "enableGrabHandle", type Property::BOOLEAN. * @note The default value is true, which means the grab handles are enabled by default. */ - ENABLE_GRAB_HANDLE = ELLIPSIS + 2 + ENABLE_GRAB_HANDLE = ELLIPSIS + 2, + + /** + * @brief Modifies the default text alignment to match the direction of the system language. + * @details Name "matchSystemLanguageDirection", type (Property::BOOLEAN), Read/Write + * @note The default value is false + */ + MATCH_SYSTEM_LANGUAGE_DIRECTION = ELLIPSIS + 3 + }; } // namespace Property diff --git a/dali-toolkit/devel-api/layouting/layout-controller.cpp b/dali-toolkit/devel-api/layouting/layout-controller.cpp index ba87af2..95a2619 100644 --- a/dali-toolkit/devel-api/layouting/layout-controller.cpp +++ b/dali-toolkit/devel-api/layouting/layout-controller.cpp @@ -68,12 +68,17 @@ LayoutController LayoutController::Get() void LayoutController::RequestLayout( LayoutItem layout ) { - GetImpl( *this ).RequestLayout( GetImplementation( layout ), -1 ); + GetImpl( *this ).RequestLayout( GetImplementation( layout ), -1, Actor(), Actor() ); } -void LayoutController::RequestLayout( LayoutItem layout, Dali::Toolkit::LayoutTransitionData::LayoutTransitionType layoutTransitionType ) +void LayoutController::RequestLayout( LayoutItem layout, Dali::Toolkit::LayoutTransitionData::Type layoutTransitionType ) { - GetImpl( *this ).RequestLayout( GetImplementation( layout ), layoutTransitionType ); + GetImpl( *this ).RequestLayout( GetImplementation( layout ), layoutTransitionType, Actor(), Actor() ); +} + +void LayoutController::RequestLayout( LayoutItem layout, Dali::Toolkit::LayoutTransitionData::Type layoutTransitionType, Actor gainedChild, Actor lostChild ) +{ + GetImpl( *this ).RequestLayout( GetImplementation( layout ), layoutTransitionType, gainedChild, lostChild ); } LayoutController::LayoutController( Internal::LayoutController *impl ) diff --git a/dali-toolkit/devel-api/layouting/layout-controller.h b/dali-toolkit/devel-api/layouting/layout-controller.h index 062793d..951a4fc 100755 --- a/dali-toolkit/devel-api/layouting/layout-controller.h +++ b/dali-toolkit/devel-api/layouting/layout-controller.h @@ -74,7 +74,17 @@ public: * @param[in] layout The layout to measure & relayout. * @param[in] layoutTransitionType The layout transition type. */ - void RequestLayout( LayoutItem layout, Dali::Toolkit::LayoutTransitionData::LayoutTransitionType layoutTransitionType ); + void RequestLayout( LayoutItem layout, Dali::Toolkit::LayoutTransitionData::Type layoutTransitionType ); + + /** + * @brief Request for a particular layout (wrapping a control or a visual) to be measured and laid out. A specified layout transition + * will be triggered during the layout. + * @param[in] layout The layout to measure & relayout. + * @param[in] layoutTransitionType The layout transition type. + * @param[in] gainedChild The gained layout owner's child. + * @param[in] lostChild The lost layout owner's child. + */ + void RequestLayout( LayoutItem layout, Dali::Toolkit::LayoutTransitionData::Type layoutTransitionType, Actor gainedChild, Actor lostChild ); public: /// @cond internal diff --git a/dali-toolkit/devel-api/layouting/layout-group-impl.cpp b/dali-toolkit/devel-api/layouting/layout-group-impl.cpp index 06305bd..cec64d4 100644 --- a/dali-toolkit/devel-api/layouting/layout-group-impl.cpp +++ b/dali-toolkit/devel-api/layouting/layout-group-impl.cpp @@ -552,7 +552,7 @@ void LayoutGroup::OnInitialize() } } - RequestLayout( Dali::Toolkit::LayoutTransitionData::LayoutTransitionType::ON_OWNER_SET ); + RequestLayout( Dali::Toolkit::LayoutTransitionData::Type::ON_OWNER_SET ); } } @@ -585,7 +585,7 @@ void LayoutGroup::RemoveChild( LayoutItem& item ) void LayoutGroup::ChildAddedToOwner( Actor child ) { ChildAddedToOwnerImpl( child ); - RequestLayout( Dali::Toolkit::LayoutTransitionData::LayoutTransitionType::ON_CHILD_ADD ); + RequestLayout( Dali::Toolkit::LayoutTransitionData::Type::ON_CHILD_ADD, child, Actor() ); } void LayoutGroup::ChildAddedToOwnerImpl( Actor child ) @@ -670,7 +670,7 @@ void LayoutGroup::ChildRemovedFromOwner( Actor child ) if( childLayout ) { Remove( *childLayout.Get() ); - RequestLayout( Dali::Toolkit::LayoutTransitionData::LayoutTransitionType::ON_CHILD_REMOVE ); + RequestLayout( Dali::Toolkit::LayoutTransitionData::Type::ON_CHILD_REMOVE, child, Actor() ); } } } diff --git a/dali-toolkit/devel-api/layouting/layout-item-impl.cpp b/dali-toolkit/devel-api/layouting/layout-item-impl.cpp index cd4cf40..0b638de 100644 --- a/dali-toolkit/devel-api/layouting/layout-item-impl.cpp +++ b/dali-toolkit/devel-api/layouting/layout-item-impl.cpp @@ -152,9 +152,15 @@ void LayoutItem::SetTransitionData( int layoutTransitionType, Internal::LayoutTr case Dali::Toolkit::LayoutTransitionData::ON_CHILD_REMOVE: mImpl->mOnChildRemoveTransitionData = layoutTransitionDataPtr; break; + case Dali::Toolkit::LayoutTransitionData::ON_CHILD_FOCUS: + mImpl->mOnChildFocusTransitionData = layoutTransitionDataPtr; + break; case Dali::Toolkit::LayoutTransitionData::ON_OWNER_SET: mImpl->mOnOwnerSetTransitionData = layoutTransitionDataPtr; break; + case Dali::Toolkit::LayoutTransitionData::ON_LAYOUT_CHANGE: + mImpl->mOnLayoutChangeTransitionData = layoutTransitionDataPtr; + break; default: break; } @@ -168,8 +174,12 @@ Internal::LayoutTransitionDataPtr LayoutItem::GetTransitionData( int layoutTrans return mImpl->mOnChildAddTransitionData.Get(); case Dali::Toolkit::LayoutTransitionData::ON_CHILD_REMOVE: return mImpl->mOnChildRemoveTransitionData.Get(); + case Dali::Toolkit::LayoutTransitionData::ON_CHILD_FOCUS: + return mImpl->mOnChildFocusTransitionData.Get(); case Dali::Toolkit::LayoutTransitionData::ON_OWNER_SET: return mImpl->mOnOwnerSetTransitionData.Get(); + case Dali::Toolkit::LayoutTransitionData::ON_LAYOUT_CHANGE: + return mImpl->mOnLayoutChangeTransitionData.Get(); default: return LayoutTransitionDataPtr(); } @@ -417,7 +427,7 @@ void LayoutItem::RequestLayout() layoutController.RequestLayout( Toolkit::LayoutItem( this ) ); } -void LayoutItem::RequestLayout( Dali::Toolkit::LayoutTransitionData::LayoutTransitionType layoutAnimationType ) +void LayoutItem::RequestLayout( Dali::Toolkit::LayoutTransitionData::Type layoutAnimationType ) { Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner ); if ( control ) @@ -431,6 +441,20 @@ void LayoutItem::RequestLayout( Dali::Toolkit::LayoutTransitionData::LayoutTrans layoutController.RequestLayout( Toolkit::LayoutItem(this), layoutAnimationType ); } +void LayoutItem::RequestLayout( Dali::Toolkit::LayoutTransitionData::Type layoutAnimationType, Actor gainedChild, Actor lostChild ) +{ + Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner ); + if ( control ) + { + DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::RequestLayout control(%s) layoutTranstionType(%d)\n", + control.GetName().c_str(), (int)layoutAnimationType ); + } + // @todo Enforce failure if called in Measure/Layout passes. + mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT ); + Toolkit::LayoutController layoutController = Toolkit::LayoutController::Get(); + layoutController.RequestLayout( Toolkit::LayoutItem(this), layoutAnimationType, gainedChild, lostChild ); +} + bool LayoutItem::IsLayoutRequested() const { return mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT ); @@ -579,7 +603,6 @@ bool LayoutItem::SetFrame( LayoutLength left, LayoutLength top, LayoutLength rig { if( mImpl->mAnimated && !layoutData.speculativeLayout ) { - LayoutItem* transitionOwner = layoutData.layoutTransition.layoutItem.Get(); LayoutTransitionDataPtr layoutTransitionDataPtr = GetTransitionData( layoutData.layoutTransition.layoutTransitionType ); @@ -595,9 +618,25 @@ bool LayoutItem::SetFrame( LayoutLength left, LayoutLength top, LayoutLength rig { if( changed ) { - DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply default transition to (%s), transition type (%d)\n", actor.GetName().c_str(), layoutData.layoutTransition.layoutTransitionType ); + layoutTransitionDataPtr = GetTransitionData( Dali::Toolkit::LayoutTransitionData::ON_LAYOUT_CHANGE ); + if ( layoutTransitionDataPtr ) + { + DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply custom default transition to (%s), transition type (%d)\n", actor.GetName().c_str(), Dali::Toolkit::LayoutTransitionData::ON_LAYOUT_CHANGE ); + layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), true ) ); + layoutTransitionDataPtr->ConvertToLayoutDataElements( actor, layoutData ); + } + else + { + DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply default transition to (%s), transition type (%d)\n", actor.GetName().c_str(), layoutData.layoutTransition.layoutTransitionType ); + layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), true ) ); + GetDefaultTransition()->ConvertToLayoutDataElements( actor, layoutData ); + } + } + else + { + DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply children animators to (%s), transition type (%d)\n", actor.GetName().c_str(), layoutData.layoutTransition.layoutTransitionType ); layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), true ) ); - GetDefaultTransition()->ConvertToLayoutDataElements( actor, layoutData ); + LayoutTransitionData::ConvertChildrenAnimatorsToLayoutDataElements( actor, layoutData ); } } } diff --git a/dali-toolkit/devel-api/layouting/layout-item-impl.h b/dali-toolkit/devel-api/layouting/layout-item-impl.h index 19b61d5..47d65cc 100644 --- a/dali-toolkit/devel-api/layouting/layout-item-impl.h +++ b/dali-toolkit/devel-api/layouting/layout-item-impl.h @@ -209,7 +209,17 @@ public: * * This will make this layout and all it's parent layouts dirty and set the transition queued. */ - void RequestLayout( Dali::Toolkit::LayoutTransitionData::LayoutTransitionType layoutTranstionType ); + void RequestLayout( Dali::Toolkit::LayoutTransitionData::Type layoutTranstionType ); + + /** + * @brief Request that this layout is re-laid out with particular transition. + * @param[in] layoutTranstionType The transition type + * @param[in] gainedChild The gained owners's child due to add/remove or focus gained/lost + * @param[in] lostChild The lost owners's child due to add/remove or focus gained/lost + * + * This will make this layout and all it's parent layouts dirty and set the transition queued. + */ + void RequestLayout( Dali::Toolkit::LayoutTransitionData::Type layoutTranstionType, Actor gainedChild, Actor lostChild ); /** * @brief Predicate to determine if this layout has been requested to re-layout diff --git a/dali-toolkit/devel-api/layouting/layout-item.cpp b/dali-toolkit/devel-api/layouting/layout-item.cpp index a84b45d..315faa4 100644 --- a/dali-toolkit/devel-api/layouting/layout-item.cpp +++ b/dali-toolkit/devel-api/layouting/layout-item.cpp @@ -55,7 +55,7 @@ bool LayoutItem::IsLayoutAnimated() const return GetImplementation( *this ).IsLayoutAnimated(); } -void LayoutItem::SetTransitionData( LayoutTransitionData::LayoutTransitionType layoutTransitionType, LayoutTransitionData layoutTransitionData ) +void LayoutItem::SetTransitionData( LayoutTransitionData::Type layoutTransitionType, LayoutTransitionData layoutTransitionData ) { Toolkit::Internal::LayoutTransitionDataPtr layoutTransitionDataPtr = Toolkit::Internal::LayoutTransitionDataPtr(); if ( layoutTransitionData ) @@ -65,7 +65,7 @@ void LayoutItem::SetTransitionData( LayoutTransitionData::LayoutTransitionType l GetImplementation( *this ).SetTransitionData( layoutTransitionType, layoutTransitionDataPtr ); } -LayoutTransitionData LayoutItem::GetTransitionData( LayoutTransitionData::LayoutTransitionType layoutTransitionType ) const +LayoutTransitionData LayoutItem::GetTransitionData( LayoutTransitionData::Type layoutTransitionType ) const { return LayoutTransitionData( GetImplementation( *this ).GetTransitionData( layoutTransitionType ).Get() ); } diff --git a/dali-toolkit/devel-api/layouting/layout-item.h b/dali-toolkit/devel-api/layouting/layout-item.h index 1ad32ed..3513182 100755 --- a/dali-toolkit/devel-api/layouting/layout-item.h +++ b/dali-toolkit/devel-api/layouting/layout-item.h @@ -123,7 +123,7 @@ public: * @param[in] layoutTransitionType The type of the layout transition * @param[in] layoutTransitionData The layout transition data */ - void SetTransitionData( LayoutTransitionData::LayoutTransitionType layoutTransitionType, LayoutTransitionData layoutTransitionData ); + void SetTransitionData( LayoutTransitionData::Type layoutTransitionType, LayoutTransitionData layoutTransitionData ); /** * @brief Get the layout transition data @@ -132,7 +132,7 @@ public: * * @return The layout transition data */ - LayoutTransitionData GetTransitionData( LayoutTransitionData::LayoutTransitionType layoutTransitionType ) const; + LayoutTransitionData GetTransitionData( LayoutTransitionData::Type layoutTransitionType ) const; public: /// @cond internal diff --git a/dali-toolkit/devel-api/layouting/layout-transition-data.cpp b/dali-toolkit/devel-api/layouting/layout-transition-data.cpp index c01b2dd..ad36ca8 100644 --- a/dali-toolkit/devel-api/layouting/layout-transition-data.cpp +++ b/dali-toolkit/devel-api/layouting/layout-transition-data.cpp @@ -48,7 +48,7 @@ void LayoutTransitionData::AddPropertyAnimator( Actor actor, Property::Map map ) GetImplementation( *this ).AddPropertyAnimator( actor, map ); } -void LayoutTransitionData::AddPropertyAnimator( Actor actor, Property::Map map, KeyFrames keyFrames, Animation::Interpolation interpolation ) +void LayoutTransitionData::AddPropertyAnimator( Actor actor, Property::Map map, KeyFrames keyFrames, Animation::Interpolation interpolation ) { GetImplementation( *this ).AddPropertyAnimator( actor, map, keyFrames, interpolation ); } diff --git a/dali-toolkit/devel-api/layouting/layout-transition-data.h b/dali-toolkit/devel-api/layouting/layout-transition-data.h index 5bd509a..d51d28a 100644 --- a/dali-toolkit/devel-api/layouting/layout-transition-data.h +++ b/dali-toolkit/devel-api/layouting/layout-transition-data.h @@ -36,6 +36,9 @@ namespace Internal class LayoutTransitionData; } +/** + * @brief The LayoutTransitionData class to collect the actors properties animators for layout transitions. + */ class DALI_TOOLKIT_API LayoutTransitionData final : public BaseHandle { public: @@ -47,6 +50,7 @@ public: { enum Type { + CONDITION, ///< A condition triggering the transition animation (the actor is added/removed/focus gained/focus lost) PROPERTY, ///< A property to animate INITIAL_VALUE, ///< Initial value of an animated property TARGET_VALUE, ///< Target value of an animated property @@ -60,14 +64,30 @@ public: }; }; - enum LayoutTransitionType + struct Condition + { + enum Type + { + NONE, ///< Default, no conditions to animate property. The property is animated for all relevant animations related to a control + ON_ADD, ///< A condition to animate property when a control is added to the container + ON_REMOVE, ///< A condition to animate property when a control is removed from the container + ON_FOCUS_GAINED, ///< A condition to animate property when a control focus is gained + ON_FOCUS_LOST, ///< A condition to animate property when a control focus is lost + }; + }; + + enum Type { - ON_CHILD_ADD, - ON_CHILD_REMOVE, - ON_OWNER_SET + // Children related transitions + ON_CHILD_ADD, ///< A transition is triggered when a control is added to the container + ON_CHILD_REMOVE, ///< A transition is triggered when a control is removed from the container + ON_CHILD_FOCUS, ///< A transition is triggered when a control focus is changed in the container + // Layout related transitions + ON_OWNER_SET, ///< A transition is triggered when a layout is set to a new container + ON_LAYOUT_CHANGE, ///< A transition is triggered when a layout geometry is changed }; - typedef Signal< void (LayoutTransitionData::LayoutTransitionType, LayoutTransitionData&) > LayoutTransitionSignalType; ///< Transition finished signal + typedef Signal< void (LayoutTransitionData::Type, LayoutTransitionData&) > LayoutTransitionSignalType; ///< Transition finished signal /** * Create an uninitialized handle @@ -102,7 +122,8 @@ public: /** * @brief Add a property animator for an actor * - * @param[in] actor An owner of the animated property + * @param[in] actor An owner of the animated property. + * If actor is empty then the property animator is generic and apply to all children excluding the parent if the condition is met. * @param[in] map The animated property map including animator map */ void AddPropertyAnimator( Actor actor, Property::Map map ); @@ -111,6 +132,7 @@ public: * @brief Add a property animator for an actor * * @param[in] actor An owner of the animated property + * If actor is empty then the property animator is generic and apply to all children excluding the parent if the condition is met. * @param[in] map The properties map * @param[in] keyFrames key frames * @param[in] interpolation An interpolation @@ -121,6 +143,7 @@ public: * @brief Add a property animator for an actor * * @param[in] actor An owner of the animated property + * If actor is empty then the property animator is generic and apply to all children excluding the parent if the condition is met. * @param[in] map A properties map * @param[in] path An animation path * @param[in] forward A forward vector for the path diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index af57128..b065e99 100755 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -138,6 +138,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholderText", DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholderTextColor", VECTOR4, PLACEHOLDER_TEXT_COLOR ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableShiftSelection", BOOLEAN, ENABLE_SHIFT_SELECTION ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableGrabHandle", BOOLEAN, ENABLE_GRAB_HANDLE ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "matchSystemLanguageDirection", BOOLEAN, MATCH_SYSTEM_LANGUAGE_DIRECTION ) DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED ) @@ -745,6 +746,14 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P } break; } + case Toolkit::DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: + { + if( impl.mController ) + { + impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >()); + } + break; + } } // switch } // texteditor } @@ -1145,6 +1154,14 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind } break; } + case Toolkit::DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: + { + if( impl.mController ) + { + value = impl.mController->IsMatchSystemLanguageDirection(); + } + break; + } } //switch } @@ -1226,6 +1243,10 @@ void TextEditor::OnInitialize() mController->SetNoTextDoubleTapAction( Controller::NoTextTap::HIGHLIGHT ); mController->SetNoTextLongPressAction( Controller::NoTextTap::HIGHLIGHT ); + // Sets layoutDirection value + Dali::LayoutDirection::Type layoutDirection = static_cast( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get() ); + mController->SetLayoutDirection( layoutDirection ); + // Forward input events to controller EnableGestureDetection( static_cast( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) ); GetTapGestureDetector().SetMaximumTapsRequired( 2 ); diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index d4485ba..655c335 100755 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -132,6 +132,7 @@ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholder", DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "ellipsis", BOOLEAN, ELLIPSIS ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableShiftSelection", BOOLEAN, ENABLE_SHIFT_SELECTION ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandle", BOOLEAN, ENABLE_GRAB_HANDLE ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "matchSystemLanguageDirection", BOOLEAN, MATCH_SYSTEM_LANGUAGE_DIRECTION ) DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED ) @@ -785,6 +786,14 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: + { + if( impl.mController ) + { + impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >()); + } + break; + } } // switch } // textfield } @@ -1200,6 +1209,14 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } break; } + case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: + { + if( impl.mController ) + { + value = impl.mController->IsMatchSystemLanguageDirection(); + } + break; + } } //switch } @@ -1286,6 +1303,10 @@ void TextField::OnInitialize() mController->SetNoTextDoubleTapAction( Controller::NoTextTap::HIGHLIGHT ); mController->SetNoTextLongPressAction( Controller::NoTextTap::HIGHLIGHT ); + // Sets layoutDirection value + Dali::LayoutDirection::Type layoutDirection = static_cast( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get() ); + mController->SetLayoutDirection( layoutDirection ); + // Forward input events to controller EnableGestureDetection( static_cast( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) ); GetTapGestureDetector().SetMaximumTapsRequired( 2 ); diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 7a8c283..376709a 100755 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -884,6 +884,10 @@ void TextLabel::OnInitialize() // Enable the text ellipsis. mController->SetTextElideEnabled( true ); // If false then text larger than control will overflow + // Sets layoutDirection value + Dali::LayoutDirection::Type layoutDirection = static_cast( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get() ); + mController->SetLayoutDirection( layoutDirection ); + Layout::Engine& engine = mController->GetLayoutEngine(); engine.SetCursorWidth( 0u ); // Do not layout space for the cursor. } diff --git a/dali-toolkit/internal/layouting/layout-controller-impl.cpp b/dali-toolkit/internal/layouting/layout-controller-impl.cpp index 17a75a6..d2e0119 100644 --- a/dali-toolkit/internal/layouting/layout-controller-impl.cpp +++ b/dali-toolkit/internal/layouting/layout-controller-impl.cpp @@ -23,6 +23,7 @@ #include #include #include +#include using namespace Dali; @@ -44,6 +45,7 @@ namespace Internal LayoutController::LayoutController() : mLayoutRequested( false ), + mFocusChangedFunctor( *this ), mSlotDelegate( this ) { } @@ -55,14 +57,32 @@ LayoutController::~LayoutController() void LayoutController::Initialize() { mAnimation = Animation::New( 0.0f ); + + Dali::Toolkit::KeyInputFocusManager manager = Dali::Toolkit::KeyInputFocusManager::Get(); + manager.KeyInputFocusChangedSignal().Connect( mSlotDelegate.GetConnectionTracker(), mFocusChangedFunctor ); +} + +void LayoutController::FocusChangedFunctor::operator() ( Dali::Toolkit::Control gainingControl, Dali::Toolkit::Control lostControl ) +{ + Toolkit::LayoutItem layoutItem = Toolkit::DevelControl::GetLayout( gainingControl ); + if( layoutItem ) + { + Toolkit::Internal::LayoutItem& layoutItemImpl = GetImplementation( layoutItem ); + LayoutParent* layoutParent = layoutItemImpl.GetParent(); + if( layoutParent ) + { + LayoutGroup* layoutGroup = static_cast< LayoutGroup* >( layoutParent ); + layoutController.RequestLayout( dynamic_cast< Toolkit::Internal::LayoutItem& >( *layoutGroup ), Dali::Toolkit::LayoutTransitionData::ON_CHILD_FOCUS, gainingControl, lostControl ); + } + } } -void LayoutController::RequestLayout( LayoutItem& layoutItem, int layoutTransitionType ) +void LayoutController::RequestLayout( LayoutItem& layoutItem, int layoutTransitionType, Actor gainedChild, Actor lostChild ) { auto actor = Actor::DownCast( layoutItem.GetOwner() ); if ( actor ) { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "LayoutController::RequestLayout owner[%s] layoutItem[%p] layoutAnimationType(%d)\n", actor.GetName().c_str(), &layoutItem, layoutTransitionType ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "LayoutController::RequestLayout owner[%s] layoutItem[%p] layoutTransitionType(%d)\n", actor.GetName().c_str(), &layoutItem, layoutTransitionType ); } else { @@ -72,9 +92,10 @@ void LayoutController::RequestLayout( LayoutItem& layoutItem, int layoutTransiti mLayoutRequested = true; if( layoutTransitionType != -1 ) { - LayoutTransition layoutTransition = LayoutTransition( layoutItem, layoutTransitionType ); + LayoutTransition layoutTransition = LayoutTransition( layoutItem, layoutTransitionType, gainedChild, lostChild ); if( std::find( mLayoutTransitions.begin(), mLayoutTransitions.end(), layoutTransition ) == mLayoutTransitions.end() && layoutItem.GetTransitionData( layoutTransitionType ).Get() ) { + DALI_LOG_INFO( gLogFilter, Debug::Concise, "LayoutController::RequestLayout Add transition layoutTransitionType(%d)\n", layoutTransitionType ); mLayoutTransitions.push_back( layoutTransition ); } } @@ -215,8 +236,16 @@ void LayoutController::PerformLayoutPositioning( LayoutPositionDataArray& layout if( actor && ( !layoutPositionData.animated || all ) ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutController::PerformLayoutPositioning %s\n", actor.GetName().c_str() ); - actor.SetPosition( layoutPositionData.left, layoutPositionData.top ); - actor.SetSize( layoutPositionData.right - layoutPositionData.left, layoutPositionData.bottom - layoutPositionData.top ); + if ( !layoutPositionData.animated ) + { + actor.SetPosition( layoutPositionData.left, layoutPositionData.top ); + actor.SetSize( layoutPositionData.right - layoutPositionData.left, layoutPositionData.bottom - layoutPositionData.top ); + } + else + { + actor.SetPosition( actor.GetCurrentPosition() ); + actor.SetSize( actor.GetCurrentSize() ); + } } } } @@ -328,13 +357,8 @@ void LayoutController::PerformLayoutAnimation( LayoutTransition& layoutTransitio { if( mAnimation.GetState() == Animation::PLAYING ) { - mAnimation.Clear(); - if( mAnimationFinishedFunctors.size() != 0 ) - { - mAnimationFinishedFunctors.front()( mAnimation ); - } + mAnimation.SetCurrentProgress( 1.0f ); } - mAnimation = animation; mAnimationFinishedFunctors.push_back( AnimationFinishedFunctor( *this, layoutTransition, layoutPositionDataArray ) ); mAnimation.FinishedSignal().Connect( mSlotDelegate.GetConnectionTracker(), mAnimationFinishedFunctors.back() ); diff --git a/dali-toolkit/internal/layouting/layout-controller-impl.h b/dali-toolkit/internal/layouting/layout-controller-impl.h index 1c3130d..71c947c 100644 --- a/dali-toolkit/internal/layouting/layout-controller-impl.h +++ b/dali-toolkit/internal/layouting/layout-controller-impl.h @@ -57,7 +57,7 @@ public: /** * This marks the given layout and all its parents as dirty and triggers a transition if set. */ - void RequestLayout( LayoutItem& layout, int layoutTransitionType ); + void RequestLayout( LayoutItem& layout, int layoutTransitionType, Actor gainedChild, Actor lostChild ); /** * Measures next level of layouts in the actor hierarchy. @@ -79,6 +79,11 @@ public: */ void PerformLayoutAnimation( LayoutTransition& layoutTransition, LayoutPositionDataArray& layoutPositionDataArray, LayoutDataArray& layoutDataArray, LayoutAnimatorArray& layoutAnimatorArray ); + /** + * Focus change callback. + */ + void KeyInputFocusChangedCallback( Control gainingActor, Control lostActor ); + protected: // Implementation of Processor /** @@ -120,6 +125,18 @@ private: Animation mAnimation; std::list< AnimationFinishedFunctor > mAnimationFinishedFunctors; + struct FocusChangedFunctor + { + FocusChangedFunctor( LayoutController& layoutController ) + : layoutController( layoutController ) + { + } + + void operator() ( Dali::Toolkit::Control gainingControl, Dali::Toolkit::Control lostActor ); + LayoutController& layoutController; + }; + FocusChangedFunctor mFocusChangedFunctor; + SlotDelegate mSlotDelegate; }; diff --git a/dali-toolkit/internal/layouting/layout-item-data-impl.h b/dali-toolkit/internal/layouting/layout-item-data-impl.h index 0e68977..0b415ad 100644 --- a/dali-toolkit/internal/layouting/layout-item-data-impl.h +++ b/dali-toolkit/internal/layouting/layout-item-data-impl.h @@ -80,9 +80,13 @@ public: static bool sUseZeroUnspecifiedMeasureSpec; + // Custom transitions LayoutTransitionDataPtr mOnChildAddTransitionData; LayoutTransitionDataPtr mOnChildRemoveTransitionData; + LayoutTransitionDataPtr mOnChildFocusTransitionData; LayoutTransitionDataPtr mOnOwnerSetTransitionData; + LayoutTransitionDataPtr mOnLayoutChangeTransitionData; + // Default transition LayoutTransitionDataPtr mDefaultTransitionData; // To pass layout data during perform layout diff --git a/dali-toolkit/internal/layouting/layout-transition-data-impl.cpp b/dali-toolkit/internal/layouting/layout-transition-data-impl.cpp index f43ee79..f65f874 100644 --- a/dali-toolkit/internal/layouting/layout-transition-data-impl.cpp +++ b/dali-toolkit/internal/layouting/layout-transition-data-impl.cpp @@ -30,7 +30,12 @@ namespace { +#if defined(DEBUG_ENABLED) +Debug::Filter* gLayoutFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_LAYOUT" ); +#endif + // Key tokens +const char* TOKEN_CONDITION("condition"); const char* TOKEN_PROPERTY("property"); const char* TOKEN_INITIAL_VALUE("initialValue"); const char* TOKEN_TARGET_VALUE("targetValue"); @@ -209,6 +214,10 @@ bool LayoutTransitionData::ConvertToLayoutAnimator( const Property::Map& animato Vector2 controlPoint2( controlPoints.z, controlPoints.w ); layoutDataAnimator.alphaFunction = AlphaFunction( controlPoint1, controlPoint2 ); } + else if ( value.GetType() == Property::INTEGER ) + { + layoutDataAnimator.alphaFunction = AlphaFunction( static_cast( value.Get() ) ); + } else if ( value.GetType() == Property::STRING ) { std::string alphaFunctionValue = value.Get(); @@ -371,6 +380,10 @@ bool LayoutTransitionData::ConvertToLayoutDataElement( const PropertyAnimator& p if ( pair.first.type == Property::Key::STRING ) { const std::string& key( pair.first.stringKey ); + if ( key == TOKEN_CONDITION ) + { + indexKey = Dali::Toolkit::LayoutTransitionData::AnimatorKey::CONDITION; + } if ( key == TOKEN_PROPERTY ) { indexKey = Dali::Toolkit::LayoutTransitionData::AnimatorKey::PROPERTY; @@ -393,7 +406,11 @@ bool LayoutTransitionData::ConvertToLayoutDataElement( const PropertyAnimator& p indexKey = pair.first.indexKey; } - if( indexKey == Dali::Toolkit::LayoutTransitionData::AnimatorKey::PROPERTY ) + if( indexKey == Dali::Toolkit::LayoutTransitionData::AnimatorKey::CONDITION ) + { + layoutDataElement.condition = value.Get(); + } + else if( indexKey == Dali::Toolkit::LayoutTransitionData::AnimatorKey::PROPERTY ) { if( value.GetType() == Property::STRING ) { @@ -449,21 +466,63 @@ bool LayoutTransitionData::ConvertToLayoutDataElement( const PropertyAnimator& p return propertyFound; } -void LayoutTransitionData::ConvertToLayoutDataElements( Actor owner, LayoutData& layoutData ) +void LayoutTransitionData::ConvertChildrenAnimatorsToLayoutDataElements( Actor child, LayoutData& layoutData ) { LayoutDataArray& layoutDataArray = layoutData.layoutDataArray; // Add the children animators for( const PropertyAnimator& iter : layoutData.childrenPropertyAnimators ) { LayoutDataElement layoutDataElement; - layoutDataElement.handle = owner; + layoutDataElement.handle = child; layoutDataElement.positionDataIndex = layoutData.layoutPositionDataArray.size() - 1; if( ConvertToLayoutDataElement( iter, layoutDataElement, layoutData ) ) { + switch ( layoutDataElement.condition ) + { + case Dali::Toolkit::LayoutTransitionData::Condition::ON_ADD: + if ( layoutData.layoutTransition.layoutTransitionType != Dali::Toolkit::LayoutTransitionData::ON_CHILD_ADD + || layoutData.layoutTransition.gainedChild != child ) + { + continue; + } + break; + case Dali::Toolkit::LayoutTransitionData::Condition::ON_REMOVE: + if( layoutData.layoutTransition.layoutTransitionType != Dali::Toolkit::LayoutTransitionData::ON_CHILD_REMOVE + || layoutData.layoutTransition.lostChild != child ) + { + continue; + } + break; + case Dali::Toolkit::LayoutTransitionData::Condition::ON_FOCUS_GAINED: + if( layoutData.layoutTransition.layoutTransitionType != Dali::Toolkit::LayoutTransitionData::ON_CHILD_FOCUS + || layoutData.layoutTransition.gainedChild != child ) + { + continue; + } + break; + case Dali::Toolkit::LayoutTransitionData::Condition::ON_FOCUS_LOST: + if( layoutData.layoutTransition.layoutTransitionType != Dali::Toolkit::LayoutTransitionData::ON_CHILD_FOCUS + || layoutData.layoutTransition.lostChild != child ) + { + continue; + } + break; + default: + break; + } + layoutDataArray.push_back( layoutDataElement ); } } +} + +void LayoutTransitionData::ConvertToLayoutDataElements( Actor owner, LayoutData& layoutData ) +{ + LayoutDataArray& layoutDataArray = layoutData.layoutDataArray; + + // Add the children animators + ConvertChildrenAnimatorsToLayoutDataElements( owner, layoutData ); // Add the transition animators for( const PropertyAnimator& iter : mPropertyAnimators ) @@ -493,7 +552,7 @@ void LayoutTransitionData::EmitSignalFinish( int layoutTransitionType ) if ( !mFinishedSignal.Empty() ) { Dali::Toolkit::LayoutTransitionData handle( this ); - mFinishedSignal.Emit( static_cast(layoutTransitionType), handle ); + mFinishedSignal.Emit( static_cast(layoutTransitionType), handle ); } } diff --git a/dali-toolkit/internal/layouting/layout-transition-data-impl.h b/dali-toolkit/internal/layouting/layout-transition-data-impl.h index eb9e9d9..dec0b76 100644 --- a/dali-toolkit/internal/layouting/layout-transition-data-impl.h +++ b/dali-toolkit/internal/layouting/layout-transition-data-impl.h @@ -37,9 +37,11 @@ namespace Internal struct LayoutTransition { - LayoutTransition( LayoutItem& layoutItem, int layoutTransitionType ) + LayoutTransition( LayoutItem& layoutItem, int layoutTransitionType, Actor gainedChild, Actor lostChild ) : layoutItem( &layoutItem ) , layoutTransitionType( layoutTransitionType ) + , gainedChild( gainedChild ) + , lostChild( lostChild ) { } @@ -50,11 +52,16 @@ struct LayoutTransition bool operator==( const LayoutTransition& rhs ) { - return ( ( layoutItem.Get() == rhs.layoutItem.Get() ) && layoutTransitionType == rhs.layoutTransitionType ); + return ( layoutItem.Get() == rhs.layoutItem.Get() + && layoutTransitionType == rhs.layoutTransitionType + && gainedChild == rhs.gainedChild + && lostChild == rhs.lostChild ); } LayoutItemPtr layoutItem; int layoutTransitionType; + Actor gainedChild; + Actor lostChild; }; const float DEFAULT_TRANSITION_DURATION( 0.5f ); @@ -111,16 +118,10 @@ using LayoutPositionDataArray = std::vector< LayoutPositionData >; struct LayoutDataElement { LayoutDataElement() - : propertyIndex( Property::INVALID_KEY ), animatorIndex( -1 ), positionDataIndex(-1 ) - { - }; - - LayoutDataElement( Actor actor, Property::Index propertyIndex, Property::Value value ) - : handle( actor ), - propertyIndex( propertyIndex ), - targetValue( value ), + : propertyIndex( Property::INVALID_KEY ), animatorIndex( -1 ), - positionDataIndex( -1 ) + positionDataIndex(-1 ), + condition( Dali::Toolkit::LayoutTransitionData::Condition::NONE ) { }; @@ -130,6 +131,7 @@ struct LayoutDataElement Property::Value targetValue; int animatorIndex; int positionDataIndex; + int condition; }; class LayoutTransitionData; @@ -166,22 +168,86 @@ public: LayoutTransitionData( const LayoutTransitionData& ) = delete; LayoutTransitionData& operator=( const LayoutTransitionData& ) = delete; + /** + * @brief Add a property animator for an actor in the transition + * @param[in] actor The actor + * @param[in] map The map containing the transition animator keys + * + * This will add the property animator to the list of animators related to this transition + */ void AddPropertyAnimator( Actor actor, Property::Map map ); + + /** + * @brief Add a property animator for an actor in the transition + * @param[in] actor The actor + * @param[in] map The map containing the transition animator keys + * @param[in] keyFrames The key frames used by the property animator + * @param[in] interpolation The interpolation used by the property animator + * + * This will add the property animator to the list of animators related to this transition + */ void AddPropertyAnimator( Actor actor, Property::Map map, KeyFrames keyFrames, Animation::Interpolation interpolation ); + + /** + * @brief Add a property animator for an actor in the transition + * @param[in] actor The actor + * @param[in] map The map containing the transition animator keys + * @param[in] path The path for the property animator + * @param[in] forward The forward vector for the property animator + * + * This will add the property animator to the list of animators related to this transition + */ void AddPropertyAnimator( Actor actor, Property::Map map, Path path, Vector3 forward ); + /** + * @brief Convert the transition property animators to the layout data elements + * @param[in] actor The actor the transition property animators are applied to + * @param[in] layoutData The layout data containing layout data elements array for the layout update + * + * This will parse the property animators and add the layout data elements to the layout data elements array + */ void ConvertToLayoutDataElements( Actor, LayoutData& layoutData ); /** - * @copydoc Dali::Animation::FinishedSignal() + * @brief Convert the transition children property animators to the layout data elements + * @param[in] actor The actor the transition property animators are applied to + * @param[in] layoutData The layout data containing layout data elements array for the layout update + * + * This will parse the children property animators and add the layout data elements to the layout data elements array + */ + static void ConvertChildrenAnimatorsToLayoutDataElements( Actor, LayoutData& layoutData ); + + /** + * @copydoc Dali::Toolkit::LayoutTransitionData::FinishedSignal() */ Dali::Toolkit::LayoutTransitionData::LayoutTransitionSignalType& FinishedSignal(); + /** + * @brief Emit the transition finish signal + * @param[in] layoutTransitionType The transition type + */ void EmitSignalFinish( int layoutTransitionType ); private: - bool ConvertToLayoutAnimator( const Property::Map& animatorData, const PropertyAnimator& propertyAnimator, LayoutDataAnimator& layoutAnimator ); - bool ConvertToLayoutDataElement( const PropertyAnimator& propertyAnimator, LayoutDataElement& layoutDataElement, LayoutData& layoutData ); + /** + * @brief Convert the property animator data to the layout data animator + * @param[in] animatorData The animator data map + * @param[in] propertyAnimator The property animator + * @param[in] layoutAnimator The layout animator + * + * This will parse the property animator data and add the layout data element animator + */ + static bool ConvertToLayoutAnimator( const Property::Map& animatorData, const PropertyAnimator& propertyAnimator, LayoutDataAnimator& layoutAnimator ); + + /** + * @brief Convert the property animator to the layout data element + * @param[in] propertyAnimator The property animator + * @param[in] layoutDataElement The layout data element + * @param[in] layoutDataElement The layout data + * + * This will parse the children property animators and add the layout data elements to the layout data elements array + */ + static bool ConvertToLayoutDataElement( const PropertyAnimator& propertyAnimator, LayoutDataElement& layoutDataElement, LayoutData& layoutData ); PropertyAnimatorArray mPropertyAnimators; diff --git a/dali-toolkit/internal/text/bidirectional-support.cpp b/dali-toolkit/internal/text/bidirectional-support.cpp old mode 100644 new mode 100755 index 57dc613..9f9bddc --- a/dali-toolkit/internal/text/bidirectional-support.cpp +++ b/dali-toolkit/internal/text/bidirectional-support.cpp @@ -88,7 +88,9 @@ void SetBidirectionalInfo( const Vector& text, const Vector& lineBreakInfo, CharacterIndex startIndex, Length numberOfCharacters, - Vector& bidirectionalInfo ) + Vector& bidirectionalInfo, + bool matchSystemLanguageDirection, + Dali::LayoutDirection::Type layoutDirection ) { // Find where to insert the new paragraphs. BidirectionalRunIndex bidiInfoIndex = 0u; @@ -165,7 +167,9 @@ void SetBidirectionalInfo( const Vector& text, // Create the bidirectional info for the whole paragraph and store the index to the table with this info in the run. bidirectionalRun.bidirectionalInfoIndex = bidirectionalSupport.CreateInfo( textBuffer + bidirectionalRun.characterRun.characterIndex, - bidirectionalRun.characterRun.numberOfCharacters ); + bidirectionalRun.characterRun.numberOfCharacters, + matchSystemLanguageDirection, + layoutDirection ); bidirectionalInfo.Insert( bidirectionalInfo.Begin() + bidiInfoIndex, bidirectionalRun ); ++bidiInfoIndex; diff --git a/dali-toolkit/internal/text/bidirectional-support.h b/dali-toolkit/internal/text/bidirectional-support.h old mode 100644 new mode 100755 index 39ec9d6..c29f401 --- a/dali-toolkit/internal/text/bidirectional-support.h +++ b/dali-toolkit/internal/text/bidirectional-support.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include @@ -45,13 +46,17 @@ namespace Text * @param[in] startIndex The character from where the bidirectional info is set. * @param[in] numberOfCharacters The number of characters. * @param[out] bidirectionalInfo Vector with the bidirectional infor for each paragraph. + * @param[in] matchSystemLanguageDirection Whether match for system language direction or not. + * @param[in] layoutDirection The direction of the system language. */ void SetBidirectionalInfo( const Vector& text, const Vector& scripts, const Vector& lineBreakInfo, CharacterIndex startIndex, Length numberOfCharacters, - Vector& bidirectionalInfo ); + Vector& bidirectionalInfo, + bool matchSystemLanguageDirection = false, + Dali::LayoutDirection::Type layoutDirection = LayoutDirection::LEFT_TO_RIGHT ); /** * Sets the visual to logical map tables. diff --git a/dali-toolkit/internal/text/layouts/layout-engine.cpp b/dali-toolkit/internal/text/layouts/layout-engine.cpp index 0c3d9df..4f9876c 100755 --- a/dali-toolkit/internal/text/layouts/layout-engine.cpp +++ b/dali-toolkit/internal/text/layouts/layout-engine.cpp @@ -1150,51 +1150,41 @@ struct Engine::Impl bool matchSystemLanguageDirection ) { line.alignmentOffset = 0.f; - bool isRTL = RTL == line.direction; + const bool isLineRTL = RTL == line.direction; + // Whether to swap the alignment. + // Swap if the line is RTL and is not required to match the direction of the system's language or if it's required to match the direction of the system's language and it's RTL. + bool isLayoutRTL = isLineRTL; float lineLength = line.width; - HorizontalAlignment::Type alignment = horizontalAlignment; // match align for system language direction if( matchSystemLanguageDirection ) { - isRTL = layoutDirection == LayoutDirection::RIGHT_TO_LEFT; + // Swap the alignment type if the line is right to left. + isLayoutRTL = layoutDirection == LayoutDirection::RIGHT_TO_LEFT; } - - // Swap the alignment type if the line is right to left. - if( isRTL ) - { - switch( alignment ) - { - case HorizontalAlignment::BEGIN: - { - alignment = HorizontalAlignment::END; - break; - } - case HorizontalAlignment::CENTER: - { - // Nothing to do. - break; - } - case HorizontalAlignment::END: - { - alignment = HorizontalAlignment::BEGIN; - break; - } - } - - } - // Calculate the horizontal line offset. - switch( alignment ) + switch( horizontalAlignment ) { case HorizontalAlignment::BEGIN: { - line.alignmentOffset = 0.f; + if( isLayoutRTL ) + { + if( isLineRTL ) + { + lineLength += line.extraLength; + } - if( isRTL ) + line.alignmentOffset = boxWidth - lineLength; + } + else { - // 'Remove' the white spaces at the end of the line (which are at the beginning in visual order) - line.alignmentOffset -= line.extraLength; + line.alignmentOffset = 0.f; + + if( isLineRTL ) + { + // 'Remove' the white spaces at the end of the line (which are at the beginning in visual order) + line.alignmentOffset -= line.extraLength; + } } break; } @@ -1202,7 +1192,7 @@ struct Engine::Impl { line.alignmentOffset = 0.5f * ( boxWidth - lineLength ); - if( isRTL ) + if( isLineRTL ) { line.alignmentOffset -= line.extraLength; } @@ -1212,12 +1202,25 @@ struct Engine::Impl } case HorizontalAlignment::END: { - if( isRTL ) + if( isLayoutRTL ) { - lineLength += line.extraLength; + line.alignmentOffset = 0.f; + + if( isLineRTL ) + { + // 'Remove' the white spaces at the end of the line (which are at the beginning in visual order) + line.alignmentOffset -= line.extraLength; + } } + else + { + if( isLineRTL ) + { + lineLength += line.extraLength; + } - line.alignmentOffset = boxWidth - lineLength; + line.alignmentOffset = boxWidth - lineLength; + } break; } } diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index caefc0c..acf6291 100755 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -963,7 +963,9 @@ bool Controller::Impl::UpdateModel( OperationsMask operationsRequired ) lineBreakInfo, startIndex, requestedNumberOfCharacters, - bidirectionalInfo ); + bidirectionalInfo, + mModel->mMatchSystemLanguageDirection, + mLayoutDirection ); if( 0u != bidirectionalInfo.Count() ) { @@ -2739,11 +2741,24 @@ void Controller::Impl::GetCursorPosition( CharacterIndex logical, cursorInfo.lineHeight = GetDefaultFontLineHeight(); cursorInfo.primaryCursorHeight = cursorInfo.lineHeight; + bool isRTL = false; + if( mModel->mMatchSystemLanguageDirection ) + { + isRTL = mLayoutDirection == LayoutDirection::RIGHT_TO_LEFT; + } + switch( mModel->mHorizontalAlignment ) { case Text::HorizontalAlignment::BEGIN : { - cursorInfo.primaryPosition.x = 0.f; + if( isRTL ) + { + cursorInfo.primaryPosition.x = mModel->mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth(); + } + else + { + cursorInfo.primaryPosition.x = 0.f; + } break; } case Text::HorizontalAlignment::CENTER: @@ -2753,7 +2768,14 @@ void Controller::Impl::GetCursorPosition( CharacterIndex logical, } case Text::HorizontalAlignment::END: { - cursorInfo.primaryPosition.x = mModel->mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth(); + if( isRTL ) + { + cursorInfo.primaryPosition.x = 0.f; + } + else + { + cursorInfo.primaryPosition.x = mModel->mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth(); + } break; } } diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index f0b496f..6c1bf75 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -427,6 +427,11 @@ void Controller::SetMatchSystemLanguageDirection( bool match ) mImpl->mModel->mMatchSystemLanguageDirection = match; } +void Controller::SetLayoutDirection( Dali::LayoutDirection::Type layoutDirection ) +{ + mImpl->mLayoutDirection = layoutDirection; +} + void Controller::SetLineWrapMode( Text::LineWrap::Mode lineWrapMode ) { @@ -2424,6 +2429,7 @@ void Controller::KeyboardFocusGainEvent() mImpl->ChangeState( EventData::EDITING ); mImpl->mEventData->mUpdateCursorPosition = true; //If editing started without tap event, cursor update must be triggered. mImpl->mEventData->mUpdateInputStyle = true; + mImpl->mEventData->mScrollAfterUpdatePosition = true; } mImpl->NotifyInputMethodContextMultiLineStatus(); if( mImpl->IsShowingPlaceholderText() ) diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index f92a69d..33f1f8f 100755 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -1255,6 +1255,13 @@ public: // Queries & retrieves. */ void SetMatchSystemLanguageDirection( bool match ); + /** + * @brief Sets layoutDirection value + * @param[in] layoutDirection The value of system language direction + */ + void SetLayoutDirection( Dali::LayoutDirection::Type layoutDirection ); + + public: // Relayout. /** diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 245d4b7..fdfca42 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 3; -const unsigned int TOOLKIT_MICRO_VERSION = 48; +const unsigned int TOOLKIT_MICRO_VERSION = 49; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json b/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json old mode 100644 new mode 100755 index 842a568..4322001 --- a/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json +++ b/dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json @@ -102,7 +102,8 @@ "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png", "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" }, "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }, - "enableSelection":false + "enableSelection":false, + "matchSystemLanguageDirection":true }, "TextFieldFontSize0": @@ -218,7 +219,8 @@ "enableScrollBar":true, "scrollBarShowDuration":0.8, "scrollBarFadeDuration":0.5, - "enableSelection":false + "enableSelection":false, + "matchSystemLanguageDirection":true }, "ProgressBar": { diff --git a/docs/content/images/text-controls/HelloWorld-Default-BEGIN.png b/docs/content/images/text-controls/HelloWorld-Default-BEGIN.png new file mode 100755 index 0000000..ca9d860 Binary files /dev/null and b/docs/content/images/text-controls/HelloWorld-Default-BEGIN.png differ diff --git a/docs/content/images/text-controls/HelloWorld-Default-CENTER.png b/docs/content/images/text-controls/HelloWorld-Default-CENTER.png new file mode 100755 index 0000000..cb28206 Binary files /dev/null and b/docs/content/images/text-controls/HelloWorld-Default-CENTER.png differ diff --git a/docs/content/images/text-controls/HelloWorld-Default-END.png b/docs/content/images/text-controls/HelloWorld-Default-END.png index 3302d08..204ba94 100755 Binary files a/docs/content/images/text-controls/HelloWorld-Default-END.png and b/docs/content/images/text-controls/HelloWorld-Default-END.png differ diff --git a/docs/content/images/text-controls/HelloWorld-System-BEGIN.png b/docs/content/images/text-controls/HelloWorld-System-BEGIN.png new file mode 100755 index 0000000..11c8eda Binary files /dev/null and b/docs/content/images/text-controls/HelloWorld-System-BEGIN.png differ diff --git a/docs/content/images/text-controls/HelloWorld-System-CENTER.png b/docs/content/images/text-controls/HelloWorld-System-CENTER.png new file mode 100755 index 0000000..cb28206 Binary files /dev/null and b/docs/content/images/text-controls/HelloWorld-System-CENTER.png differ diff --git a/docs/content/images/text-controls/HelloWorld-System-END.png b/docs/content/images/text-controls/HelloWorld-System-END.png index 2794090..d8c674b 100755 Binary files a/docs/content/images/text-controls/HelloWorld-System-END.png and b/docs/content/images/text-controls/HelloWorld-System-END.png differ diff --git a/docs/content/images/text-controls/LTR_RTL.png b/docs/content/images/text-controls/LTR_RTL.png new file mode 100755 index 0000000..d9defc3 Binary files /dev/null and b/docs/content/images/text-controls/LTR_RTL.png differ diff --git a/docs/content/images/text-controls/LTR_order.png b/docs/content/images/text-controls/LTR_order.png new file mode 100755 index 0000000..6e8a3c1 Binary files /dev/null and b/docs/content/images/text-controls/LTR_order.png differ diff --git a/docs/content/images/text-controls/RTL_order.png b/docs/content/images/text-controls/RTL_order.png new file mode 100755 index 0000000..b97e0f8 Binary files /dev/null and b/docs/content/images/text-controls/RTL_order.png differ diff --git a/docs/content/shared-javascript-and-cpp-documentation/text-label.md b/docs/content/shared-javascript-and-cpp-documentation/text-label.md index 9b463e4..8b9d4d6 100755 --- a/docs/content/shared-javascript-and-cpp-documentation/text-label.md +++ b/docs/content/shared-javascript-and-cpp-documentation/text-label.md @@ -90,14 +90,14 @@ label.HorizontalAlignment = "BEGIN"; // "CENTER" or "END" -The text's alignment can be modified to match the direction of the system language. +The text's alignment and order can be modified to match the direction of the system language. -If the MATCH_SYSTEM_LANGUAGE_DIRECTION property is set to true then the direction of the text is ignored, instead the text is aligned as the system default language. +If the MATCH_SYSTEM_LANGUAGE_DIRECTION property is set to true then the direction of the text is ignored, instead the text is aligned and ordered as the system default language. ~~~{.cpp} // C++ -label.SetProperty( TextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true ); +label.SetProperty( Toolkit::DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true ); ~~~ ~~~{.js} @@ -109,8 +109,19 @@ label.matchSystemLanguageDirection = true; | | | |--|--| | Current system language direction left-to-right | | -| END alignment and MATCH_SYSTEM_LANGUAGE_DIRECTION set to TRUE. | END alignment and MATCH_SYSTEM_LANGUAGE_DIRECTION set to FALSE (default). | -| ![ ](HelloWorld-System-END.png) | ![ ](HelloWorld-Default-END.png) | +| MATCH_SYSTEM_LANGUAGE_DIRECTION set to TRUE. | MATCH_SYSTEM_LANGUAGE_DIRECTION set to FALSE (default). | +| BEGIN alignment | BEGIN alignment | +| ![ ](../assets/img/text-controls/HelloWorld-System-BEGIN.png) ![ ](HelloWorld-System-BEGIN.png) | ![ ](../assets/img/text-controls/HelloWorld-Default-BEGIN.png) ![ ](HelloWorld-Default-BEGIN.png) | +| CENTER alignment | CENTER alignment | +| ![ ](../assets/img/text-controls/HelloWorld-System-CENTER.png) ![ ](HelloWorld-System-CENTER.png) | ![ ](../assets/img/text-controls/HelloWorld-Default-CENTER.png) ![ ](HelloWorld-Default-CENTER.png) | +| END alignment | END alignment | +| ![ ](../assets/img/text-controls/HelloWorld-System-END.png) ![ ](HelloWorld-System-END.png) | ![ ](../assets/img/text-controls/HelloWorld-Default-END.png) ![ ](HelloWorld-Default-END.png) | + + +| | | +|--|--| +| Current system language direction left-to-right | Current system language direction right-to-left | +| ![ ](../assets/img/text-controls/LTR_order.png) ![ ](LTR_order.png) | ![ ](../assets/img/text-controls/RTL_order.png) ![ ](RTL_order.png) | The examples above assume that the TextLabel size greater than the minimum required. diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 77a78bf..a3b4879 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: Dali 3D engine Toolkit -Version: 1.3.48 +Version: 1.3.49 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT