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 =
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<FontDescriptionRun> 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<FontDescriptionRun> 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;
}
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 )
{
}
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 )
#include <toolkit-event-thread-callback.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/layouting/absolute-layout.h>
#include <dali-toolkit/devel-api/layouting/grid.h>
{
}
- void operator()( LayoutTransitionData::LayoutTransitionType type, LayoutTransitionData& layoutTransitionData )
+ void operator()( LayoutTransitionData::Type type, LayoutTransitionData& layoutTransitionData )
{
mSignalReceived = true;
}
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;
}
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 );
{
container.Add( iter );
}
-
- container.SetParentOrigin( ParentOrigin::CENTER );
- container.SetAnchorPoint( AnchorPoint::CENTER );
stage.Add( container );
auto layoutTransitionData = LayoutTransitionData::New();
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<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
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 );
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();
{
// 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")
{
// 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()
.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 );
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] );
application.SendNotification();
application.Render();
+ horizontalLayout.SetAnimateLayout( true );
+
auto layoutTransitionData = LayoutTransitionData::New();
{
// Instant resize for parent width
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()
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()
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 );
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 );
DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( 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<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( 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<Vector3>( 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<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( 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<Vector3>( 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<unsigned int>( 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<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+
finishCheck.CheckSignalReceived();
END_TEST;
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();
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 );
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();
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();
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();
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<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( 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<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
+
+ END_TEST;
+}
+
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;
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;
}
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<bool>( 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<bool>( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
int UtcDaliTextEditorGetInputMethodContext(void)
{
ToolkitTestApplication application;
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;
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;
}
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<bool>( 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<bool>( 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;
END_TEST;
}
+
* @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
* @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
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 )
* @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
}
}
- RequestLayout( Dali::Toolkit::LayoutTransitionData::LayoutTransitionType::ON_OWNER_SET );
+ RequestLayout( Dali::Toolkit::LayoutTransitionData::Type::ON_OWNER_SET );
}
}
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 )
if( childLayout )
{
Remove( *childLayout.Get() );
- RequestLayout( Dali::Toolkit::LayoutTransitionData::LayoutTransitionType::ON_CHILD_REMOVE );
+ RequestLayout( Dali::Toolkit::LayoutTransitionData::Type::ON_CHILD_REMOVE, child, Actor() );
}
}
}
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;
}
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();
}
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 )
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 );
{
if( mImpl->mAnimated && !layoutData.speculativeLayout )
{
-
LayoutItem* transitionOwner = layoutData.layoutTransition.layoutItem.Get();
LayoutTransitionDataPtr layoutTransitionDataPtr = GetTransitionData( layoutData.layoutTransition.layoutTransitionType );
{
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 );
}
}
}
*
* 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
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 )
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() );
}
* @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
*
* @return The layout transition data
*/
- LayoutTransitionData GetTransitionData( LayoutTransitionData::LayoutTransitionType layoutTransitionType ) const;
+ LayoutTransitionData GetTransitionData( LayoutTransitionData::Type layoutTransitionType ) const;
public:
/// @cond internal
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 );
}
class LayoutTransitionData;
}
+/**
+ * @brief The LayoutTransitionData class to collect the actors properties animators for layout transitions.
+ */
class DALI_TOOLKIT_API LayoutTransitionData final : public BaseHandle
{
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
};
};
- 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
/**
* @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 );
* @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
* @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
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 )
}
break;
}
+ case Toolkit::DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
+ {
+ if( impl.mController )
+ {
+ impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >());
+ }
+ break;
+ }
} // switch
} // texteditor
}
}
break;
}
+ case Toolkit::DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->IsMatchSystemLanguageDirection();
+ }
+ break;
+ }
} //switch
}
mController->SetNoTextDoubleTapAction( Controller::NoTextTap::HIGHLIGHT );
mController->SetNoTextLongPressAction( Controller::NoTextTap::HIGHLIGHT );
+ // Sets layoutDirection value
+ Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
+ mController->SetLayoutDirection( layoutDirection );
+
// Forward input events to controller
EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
GetTapGestureDetector().SetMaximumTapsRequired( 2 );
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 )
}
break;
}
+ case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
+ {
+ if( impl.mController )
+ {
+ impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >());
+ }
+ break;
+ }
} // switch
} // textfield
}
}
break;
}
+ case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->IsMatchSystemLanguageDirection();
+ }
+ break;
+ }
} //switch
}
mController->SetNoTextDoubleTapAction( Controller::NoTextTap::HIGHLIGHT );
mController->SetNoTextLongPressAction( Controller::NoTextTap::HIGHLIGHT );
+ // Sets layoutDirection value
+ Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
+ mController->SetLayoutDirection( layoutDirection );
+
// Forward input events to controller
EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
GetTapGestureDetector().SetMaximumTapsRequired( 2 );
// 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<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
+ mController->SetLayoutDirection( layoutDirection );
+
Layout::Engine& engine = mController->GetLayoutEngine();
engine.SetCursorWidth( 0u ); // Do not layout space for the cursor.
}
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/layouting/layout-controller-debug.h>
+#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
using namespace Dali;
LayoutController::LayoutController()
: mLayoutRequested( false ),
+ mFocusChangedFunctor( *this ),
mSlotDelegate( this )
{
}
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
{
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 );
}
}
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() );
+ }
}
}
}
{
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() );
/**
* 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.
*/
void PerformLayoutAnimation( LayoutTransition& layoutTransition, LayoutPositionDataArray& layoutPositionDataArray, LayoutDataArray& layoutDataArray, LayoutAnimatorArray& layoutAnimatorArray );
+ /**
+ * Focus change callback.
+ */
+ void KeyInputFocusChangedCallback( Control gainingActor, Control lostActor );
+
protected: // Implementation of Processor
/**
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<LayoutController> mSlotDelegate;
};
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
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");
Vector2 controlPoint2( controlPoints.z, controlPoints.w );
layoutDataAnimator.alphaFunction = AlphaFunction( controlPoint1, controlPoint2 );
}
+ else if ( value.GetType() == Property::INTEGER )
+ {
+ layoutDataAnimator.alphaFunction = AlphaFunction( static_cast<AlphaFunction::BuiltinFunction>( value.Get<int>() ) );
+ }
else if ( value.GetType() == Property::STRING )
{
std::string alphaFunctionValue = value.Get<std::string>();
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;
indexKey = pair.first.indexKey;
}
- if( indexKey == Dali::Toolkit::LayoutTransitionData::AnimatorKey::PROPERTY )
+ if( indexKey == Dali::Toolkit::LayoutTransitionData::AnimatorKey::CONDITION )
+ {
+ layoutDataElement.condition = value.Get<int>();
+ }
+ else if( indexKey == Dali::Toolkit::LayoutTransitionData::AnimatorKey::PROPERTY )
{
if( value.GetType() == Property::STRING )
{
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 )
if ( !mFinishedSignal.Empty() )
{
Dali::Toolkit::LayoutTransitionData handle( this );
- mFinishedSignal.Emit( static_cast<Dali::Toolkit::LayoutTransitionData::LayoutTransitionType>(layoutTransitionType), handle );
+ mFinishedSignal.Emit( static_cast<Dali::Toolkit::LayoutTransitionData::Type>(layoutTransitionType), handle );
}
}
struct LayoutTransition
{
- LayoutTransition( LayoutItem& layoutItem, int layoutTransitionType )
+ LayoutTransition( LayoutItem& layoutItem, int layoutTransitionType, Actor gainedChild, Actor lostChild )
: layoutItem( &layoutItem )
, layoutTransitionType( layoutTransitionType )
+ , gainedChild( gainedChild )
+ , lostChild( lostChild )
{
}
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 );
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 )
{
};
Property::Value targetValue;
int animatorIndex;
int positionDataIndex;
+ int condition;
};
class LayoutTransitionData;
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;
const Vector<LineBreakInfo>& lineBreakInfo,
CharacterIndex startIndex,
Length numberOfCharacters,
- Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo )
+ Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ bool matchSystemLanguageDirection,
+ Dali::LayoutDirection::Type layoutDirection )
{
// Find where to insert the new paragraphs.
BidirectionalRunIndex bidiInfoIndex = 0u;
// 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;
// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/actors/actor-enumerations.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/bidirectional-line-info-run.h>
* @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<Character>& text,
const Vector<ScriptRun>& scripts,
const Vector<LineBreakInfo>& lineBreakInfo,
CharacterIndex startIndex,
Length numberOfCharacters,
- Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo );
+ Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+ bool matchSystemLanguageDirection = false,
+ Dali::LayoutDirection::Type layoutDirection = LayoutDirection::LEFT_TO_RIGHT );
/**
* Sets the visual to logical map tables.
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;
}
{
line.alignmentOffset = 0.5f * ( boxWidth - lineLength );
- if( isRTL )
+ if( isLineRTL )
{
line.alignmentOffset -= line.extraLength;
}
}
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;
}
}
lineBreakInfo,
startIndex,
requestedNumberOfCharacters,
- bidirectionalInfo );
+ bidirectionalInfo,
+ mModel->mMatchSystemLanguageDirection,
+ mLayoutDirection );
if( 0u != bidirectionalInfo.Count() )
{
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:
}
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;
}
}
mImpl->mModel->mMatchSystemLanguageDirection = match;
}
+void Controller::SetLayoutDirection( Dali::LayoutDirection::Type layoutDirection )
+{
+ mImpl->mLayoutDirection = layoutDirection;
+}
+
void Controller::SetLineWrapMode( Text::LineWrap::Mode lineWrapMode )
{
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() )
*/
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.
/**
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
"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":
"enableScrollBar":true,
"scrollBarShowDuration":0.8,
"scrollBarFadeDuration":0.5,
- "enableSelection":false
+ "enableSelection":false,
+ "matchSystemLanguageDirection":true
},
"ProgressBar":
{
-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}
| | |
|--|--|
| 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). |
-|  |  |
+| MATCH_SYSTEM_LANGUAGE_DIRECTION set to TRUE. | MATCH_SYSTEM_LANGUAGE_DIRECTION set to FALSE (default). |
+| BEGIN alignment | BEGIN alignment |
+|   |   |
+| CENTER alignment | CENTER alignment |
+|   |   |
+| END alignment | END alignment |
+|   |   |
+
+
+| | |
+|--|--|
+| Current system language direction left-to-right | Current system language direction right-to-left |
+|   |   |
The examples above assume that the TextLabel size greater than the minimum required.
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