Add child property support for FlexLayout 89/237889/8
authorYeongjong Lee <yj34.lee@samsung.com>
Mon, 6 Jul 2020 08:24:49 +0000 (17:24 +0900)
committerYeongjong Lee <yj34.lee@samsung.com>
Tue, 14 Jul 2020 09:28:54 +0000 (18:28 +0900)
Child properties are added for FlexLayout.
 - FlexAlignmentSelf
 - FlexPositionType
 - FlexAspectRatio
 - FlexBasis
 - FlexShrink
 - FlexGrow

See also,
dali-toolkit: https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-toolkit/+/237889/
dali-csharp-binder: https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-csharp-binder/+/237888/
NUI: https://github.com/Samsung/TizenFX/pull/1803

Change-Id: I5b9265931150c7c497e707624b3cdbe981b3a25b

automated-tests/src/dali-toolkit/utc-Dali-FlexNode.cpp
dali-toolkit/devel-api/layouting/flex-node.cpp
dali-toolkit/devel-api/layouting/flex-node.h

index a22f57c..0c1ff77 100755 (executable)
@@ -175,38 +175,44 @@ int UtcDaliToolkitFlexNodeAddChildrenColumnJustify(void)
   // Position elements in a Column
   flexNode->SetFlexDirection(Flex::FlexDirection::COLUMN);
 
-  tet_infoline("Justify to the Start, align to start");
+  tet_infoline("Justify to the Start, align to start, third item should be displayed at the top and the end");
   flexNode->SetFlexJustification(Flex::Justification::FLEX_START);
   flexNode->SetFlexItemsAlignment( Flex::Alignment::FLEX_START );
 
-  // Create two actors and add them to the parent flex node
+  // Create three actors and add them to the parent flex node
   Actor actor1 = Actor::New();
   Actor actor2 = Actor::New();
+  Actor actor3 = Actor::New();
   DALI_TEST_CHECK( actor1 );
   DALI_TEST_CHECK( actor2 );
+  DALI_TEST_CHECK( actor3 );
 
   DALI_TEST_EQUALS( (int)flexNode->GetFlexJustification(), (int)Flex::Justification::FLEX_START, TEST_LOCATION );
   DALI_TEST_EQUALS( (int)flexNode->GetFlexItemsAlignment(), (int)Flex::Alignment::FLEX_START, TEST_LOCATION );
 
   flexNode->AddChild(actor1, Extents(0,0,0,0), &MeasureChild, 0);
   flexNode->AddChild(actor2, Extents(0,0,0,0), &MeasureChild, 1);
+  Flex::Node* actor3node = flexNode->AddChild(actor3, Extents(0,0,0,0), &MeasureChild, 2);
+  actor3node->SetFlexAlignmentSelf( Flex::Alignment::FLEX_END );
 
   flexNode->CalculateLayout(480, 800, false);
 
   Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
   Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
   Vector4 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
+  Vector4 actor3Frame = flexNode->GetNodeFrame(2); // 2 is third child
 
   tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
 
   tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
   tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
+  tet_printf("Actor 3 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor3Frame.x, actor3Frame.y, actor3Frame.z, actor3Frame.w);
 
   /*
     ---------
     |1      |
     |2      |
-    |       |
+    |      3|
     |       |
     |       |
     ---------
@@ -214,8 +220,9 @@ int UtcDaliToolkitFlexNodeAddChildrenColumnJustify(void)
 
   DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
   DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, ITEM_SIZE.height, ITEM_SIZE.width, ITEM_SIZE.height *2 ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor3Frame, Vector4( root.z - ITEM_SIZE.width, ITEM_SIZE.height *2, root.z, ITEM_SIZE.height *3 ), TEST_LOCATION );
 
-  tet_infoline(" Justify to the End, items should now be displayed at the bottom");
+  tet_infoline(" Justify to the End, items should now be displayed at the bottom, third item should now be displayed at the end");
   flexNode->SetFlexJustification( Flex::Justification::FLEX_END );
   flexNode->SetFlexItemsAlignment( Flex::Alignment::FLEX_START );
 
@@ -225,24 +232,27 @@ int UtcDaliToolkitFlexNodeAddChildrenColumnJustify(void)
   root = flexNode->GetNodeFrame(-1); // -1 is the root
   actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
   actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
+  actor3Frame = flexNode->GetNodeFrame(2); // 2 is third child
 
   tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
 
   tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
   tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
+  tet_printf("Actor 3 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor3Frame.x, actor3Frame.y, actor3Frame.z, actor3Frame.w);
 
   /*
     ---------
     |       |
     |       |
-    |       |
     |1      |
     |2      |
+    |      3|
     ---------
   */
 
-  DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, root.w - (ITEM_SIZE.height*2), ITEM_SIZE.width,  root.w - ITEM_SIZE.height ), TEST_LOCATION );
-  DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, root.w - ITEM_SIZE.height, ITEM_SIZE.width, root.w ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, root.w - (ITEM_SIZE.height*3), ITEM_SIZE.width,  root.w - (ITEM_SIZE.height*2) ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, root.w - (ITEM_SIZE.height*2), ITEM_SIZE.width, root.w - ITEM_SIZE.height ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor3Frame, Vector4( root.z - ITEM_SIZE.width, root.w - ITEM_SIZE.height, root.z, root.w ), TEST_LOCATION );
 
   tet_infoline(" Align to End, items should now be displayed at the bottom and the end");
   flexNode->SetFlexJustification( Flex::Justification::FLEX_END );
@@ -253,22 +263,25 @@ int UtcDaliToolkitFlexNodeAddChildrenColumnJustify(void)
   root = flexNode->GetNodeFrame(-1); // -1 is the root
   actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
   actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
+  actor3Frame = flexNode->GetNodeFrame(2); // 2 is third child
 
   tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
   tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
+  tet_printf("Actor 3 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor3Frame.x, actor3Frame.y, actor3Frame.z, actor3Frame.w);
 
   /*
     ---------
     |       |
     |       |
-    |       |
     |      1|
     |      2|
+    |      3|
     ---------
   */
 
-  DALI_TEST_EQUALS( actor1Frame, Vector4( root.z - ITEM_SIZE.width, root.w - (ITEM_SIZE.height*2), root.z,  root.w - ITEM_SIZE.height ), TEST_LOCATION );
-  DALI_TEST_EQUALS( actor2Frame, Vector4( root.z - ITEM_SIZE.width, root.w - ITEM_SIZE.height, root.z, root.w ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor1Frame, Vector4( root.z - ITEM_SIZE.width, root.w - (ITEM_SIZE.height*3), root.z,  root.w - (ITEM_SIZE.height*2) ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor2Frame, Vector4( root.z - ITEM_SIZE.width, root.w - (ITEM_SIZE.height*2), root.z,  root.w - ITEM_SIZE.height ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor3Frame, Vector4( root.z - ITEM_SIZE.width, root.w - ITEM_SIZE.height, root.z, root.w ), TEST_LOCATION );
 
   END_TEST;
 }
@@ -558,3 +571,240 @@ int UtcDaliToolkitFlexNodeCallbackTestP(void)
 
   END_TEST;
 }
+
+int UtcDaliToolkitFlexNodeFlexPositionType(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliToolkitFlexNodeFlexPositionType");
+  Flex::Node* flexNode = new Flex::Node();
+  DALI_TEST_CHECK( flexNode );
+
+  tet_infoline(" FlexPositionType is RELATIVE by default");
+
+  // Create two actors and add them to the parent flex node
+  Actor actor1 = Actor::New();
+  Actor actor2 = Actor::New();
+  DALI_TEST_CHECK( actor1 );
+  DALI_TEST_CHECK( actor2 );
+
+  flexNode->AddChild(actor1, Extents(0,0,0,0), &MeasureChild, 0);
+  Flex::Node* actor2node = flexNode->AddChild(actor2, Extents(0,0,0,0), &MeasureChild, 1);
+
+  DALI_TEST_EQUALS( (int)actor2node->GetFlexPositionType(), (int)Flex::PositionType::RELATIVE, TEST_LOCATION );
+
+  flexNode->CalculateLayout(480, 800, false);
+
+  Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
+  Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
+  Vector4 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
+
+  tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
+
+  tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
+  tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
+
+  /*
+    ---------
+    |1      |
+    |2      |
+    |       |
+    |       |
+    |       |
+    ---------
+  */
+
+  DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, ITEM_SIZE.height, ITEM_SIZE.width, ITEM_SIZE.height *2 ), TEST_LOCATION );
+
+  tet_infoline(" ABSOLUTE FlexPositionType, second item should now be ignore any properties");
+  actor2node->SetFlexPositionType( Flex::PositionType::ABSOLUTE );
+
+  // Recalulate layout
+  flexNode->CalculateLayout(480, 800, false);
+
+  root = flexNode->GetNodeFrame(-1); // -1 is the root
+  actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
+  actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
+
+  tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
+
+  tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
+  tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
+
+  /*
+    ---------
+    |1(2)   |
+    |       |
+    |       |
+    |       |
+    |       |
+    ---------
+  */
+
+  DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor2Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliToolkitFlexNodeFlexAspectRatio(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliToolkitFlexNodeFlexAspectRatio");
+  Flex::Node* flexNode = new Flex::Node();
+  DALI_TEST_CHECK( flexNode );
+
+  // Create a actor and add them to the parent flex node
+  Actor actor1 = Actor::New();
+  DALI_TEST_CHECK( actor1 );
+
+  tet_infoline(" 1.0 FlexAspectRatio");
+  Flex::Node* actor1node = flexNode->AddChild(actor1, Extents(0,0,0,0), &MeasureChild, 0);
+  actor1node->SetFlexAspectRatio(1.0);
+
+  DALI_TEST_EQUALS( actor1node->GetFlexAspectRatio(), 1.0f, TEST_LOCATION );
+
+  flexNode->CalculateLayout(480, 800, false);
+
+  Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
+  Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
+
+  tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
+
+  tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
+
+  /*
+    ---------
+    |---    |
+    ||1|    |
+    |---    |
+    |       |
+    |       |
+    ---------
+  */
+
+  DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height ), TEST_LOCATION );
+
+  tet_infoline(" 2.0 FlexAspectRatio");
+  actor1node->SetFlexAspectRatio(2.0);
+
+  DALI_TEST_EQUALS( actor1node->GetFlexAspectRatio(), 2.0f, TEST_LOCATION );
+
+  // Recalulate layout
+  flexNode->CalculateLayout(480, 800, false);
+
+  root = flexNode->GetNodeFrame(-1); // -1 is the root
+  actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
+
+  tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
+
+  tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
+
+  /*
+    ---------
+    |------ |
+    || 1  | |
+    |------ |
+    |       |
+    |       |
+    ---------
+  */
+
+  DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, ITEM_SIZE.width*2, ITEM_SIZE.height ), TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliToolkitFlexNodeFlexBasisShrinkGrow(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliToolkitFlexNodeFlexBasisShrinkGrow");
+  Flex::Node* flexNode = new Flex::Node();
+  DALI_TEST_CHECK( flexNode );
+
+  // Position elements as a Row
+  flexNode->SetFlexDirection(Flex::FlexDirection::ROW);
+
+  // Create three actors and add them to the parent flex node
+  Actor actor1 = Actor::New();
+  Actor actor2 = Actor::New();
+  Actor actor3 = Actor::New();
+  DALI_TEST_CHECK( actor1 );
+  DALI_TEST_CHECK( actor2 );
+  DALI_TEST_CHECK( actor3 );
+
+  Flex::Node* actor1node = flexNode->AddChild(actor1, Extents(0,0,0,0), &MeasureChild, 0);
+  Flex::Node* actor2node = flexNode->AddChild(actor2, Extents(0,0,0,0), &MeasureChild, 1);
+  Flex::Node* actor3node = flexNode->AddChild(actor3, Extents(0,0,0,0), &MeasureChild, 2);
+
+  float basis = 5;
+
+  actor1node->SetFlexGrow(0.0);
+  actor2node->SetFlexGrow(0.0);
+  actor3node->SetFlexGrow(0.0);
+  actor1node->SetFlexShrink(1.0);
+  actor2node->SetFlexShrink(1.0);
+  actor3node->SetFlexShrink(1.0);
+  actor1node->SetFlexBasis(basis);
+  actor2node->SetFlexBasis(basis);
+  actor3node->SetFlexBasis(basis);
+
+  DALI_TEST_EQUALS( actor1node->GetFlexGrow(), 0.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( actor1node->GetFlexShrink(), 1.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( actor1node->GetFlexBasis(), basis, TEST_LOCATION );
+
+  flexNode->CalculateLayout(600, 200, false);
+
+  Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
+  Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
+  Vector4 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
+  Vector4 actor3Frame = flexNode->GetNodeFrame(2); // 2 is third child
+
+  tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
+
+  tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
+  tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
+  tet_printf("Actor 3 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor3Frame.x, actor3Frame.y, actor3Frame.z, actor3Frame.w);
+
+  /*
+    -------------------
+    ||1||2||3|        |
+    |                 |
+    -------------------
+  */
+
+  DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, basis, ITEM_SIZE.height ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor2Frame, Vector4( basis, 0.0f, basis*2, ITEM_SIZE.height ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor3Frame, Vector4( basis*2, 0.0f, basis*3, ITEM_SIZE.height ), TEST_LOCATION );
+
+
+  actor2node->SetFlexGrow(1.0);
+  actor3node->SetFlexGrow(1.0);
+
+  // Recalulate layout
+  flexNode->CalculateLayout(605, 200, false);
+
+  root = flexNode->GetNodeFrame(-1); // -1 is the root
+  actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
+  actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
+  actor3Frame = flexNode->GetNodeFrame(2); // 2 is third child
+
+  tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
+
+  tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
+  tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
+  tet_printf("Actor 3 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor3Frame.x, actor3Frame.y, actor3Frame.z, actor3Frame.w);
+
+  /*
+    -------------------
+    ||1||  2  ||  3  ||
+    |                 |
+    -------------------
+  */
+
+  DALI_TEST_EQUALS( actor1Frame, Vector4( 0.0f, 0.0f, basis, ITEM_SIZE.height ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor2Frame, Vector4( basis, 0.0f, basis + (root.z-basis)/2, ITEM_SIZE.height ), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor3Frame, Vector4( basis + (root.z-basis)/2, 0.0f, root.z, ITEM_SIZE.height ), TEST_LOCATION );
+
+  END_TEST;
+}
index cbac8b2..194adae 100644 (file)
@@ -101,7 +101,7 @@ Node::~Node()
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Destructor() <<\n");
 }
 
-void Node::AddChild( Actor child, Extents margin, MeasureCallback measureFunction, int index )
+Node* Node::AddChild( Actor child, Extents margin, MeasureCallback measureFunction, int index )
 {
   if( child )
   {
@@ -130,8 +130,12 @@ void Node::AddChild( Actor child, Extents margin, MeasureCallback measureFunctio
 
     YGNodeInsertChild( mImpl->mYogaNode, childNode->mImpl->mYogaNode, index );
 
+    Node* result = childNode.get();
     mImpl->mChildNodes.emplace_back( std::move(childNode) );
+
+    return result;;
   }
+  return nullptr;
 }
 
 void Node::RemoveChild( Actor child )
@@ -250,6 +254,78 @@ Dali::Toolkit::Flex::Alignment Node::GetFlexItemsAlignment() const
   return static_cast<Dali::Toolkit::Flex::Alignment>( YGNodeStyleGetAlignItems( mImpl->mYogaNode ));
 }
 
+void Node::SetFlexAlignmentSelf( Dali::Toolkit::Flex::Alignment flexAlignmentSelf )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Set flex alignment self [%d] on mYogaNode[%p]\n", flexAlignmentSelf, mImpl->mYogaNode )
+
+  YGNodeStyleSetAlignSelf( mImpl->mYogaNode, static_cast<YGAlign>(flexAlignmentSelf) );
+}
+
+Dali::Toolkit::Flex::Alignment Node::GetFlexAlignmentSelf() const
+{
+  return static_cast<Dali::Toolkit::Flex::Alignment>(YGNodeStyleGetAlignSelf( mImpl->mYogaNode ));
+}
+
+void Node::SetFlexPositionType( Dali::Toolkit::Flex::PositionType flexPositionType )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Set flex position type [%d] on mYogaNode[%p]\n", flexPositionType, mImpl->mYogaNode )
+
+  YGNodeStyleSetPositionType( mImpl->mYogaNode, static_cast<YGPositionType>(flexPositionType) );
+}
+
+Dali::Toolkit::Flex::PositionType Node::GetFlexPositionType() const
+{
+  return static_cast<Dali::Toolkit::Flex::PositionType>(YGNodeStyleGetPositionType( mImpl->mYogaNode ));
+}
+
+void Node::SetFlexAspectRatio( float flexAspectRatio )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Set flex aspect ratio [%d] on mYogaNode[%p]\n", flexAspectRatio, mImpl->mYogaNode )
+
+  YGNodeStyleSetAspectRatio( mImpl->mYogaNode, static_cast<float>(flexAspectRatio) );
+}
+
+float Node::GetFlexAspectRatio() const
+{
+  return static_cast<float>(YGNodeStyleGetAspectRatio( mImpl->mYogaNode ));
+}
+
+void Node::SetFlexBasis( float flexBasis )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Set flex basis [%d] on mYogaNode[%p]\n", flexBasis, mImpl->mYogaNode )
+
+  YGNodeStyleSetFlexBasis( mImpl->mYogaNode, static_cast<float>(flexBasis) );
+}
+
+float Node::GetFlexBasis() const
+{
+  return static_cast<float>(YGNodeStyleGetFlexBasis( mImpl->mYogaNode ).value);
+}
+
+void Node::SetFlexShrink( float flexShrink )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Set flex shrink [%d] on mYogaNode[%p]\n", flexShrink, mImpl->mYogaNode )
+
+  YGNodeStyleSetFlexShrink( mImpl->mYogaNode, static_cast<float>(flexShrink) );
+}
+
+float Node::GetFlexShrink() const
+{
+  return static_cast<float>(YGNodeStyleGetFlexShrink( mImpl->mYogaNode ));
+}
+
+void Node::SetFlexGrow( float flexGrow )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Set flex grow [%d] on mYogaNode[%p]\n", flexGrow, mImpl->mYogaNode )
+
+  YGNodeStyleSetFlexGrow( mImpl->mYogaNode, static_cast<float>(flexGrow) );
+}
+
+float Node::GetFlexGrow() const
+{
+  return static_cast<float>(YGNodeStyleGetFlexGrow( mImpl->mYogaNode ));
+}
+
 float Node::GetFlexWidth() const
 {
   float flexWidth = YGNodeLayoutGetWidth( mImpl->mYogaNode );
index 1b76f76..3542f7d 100644 (file)
@@ -84,6 +84,14 @@ enum class Alignment
     STRETCH                ///< Stretch to fit the container
 };
 
+/**
+ * @brief Enumeration for the position type of the flex item how it is positioned within its parent.
+ */
+enum class PositionType
+{
+    RELATIVE,              ///< Flex items laid out relatively
+    ABSOLUTE               ///< Flex items laid out absolutely
+};
 
 /**
  * Struct used for MeasureCallback
@@ -133,8 +141,9 @@ public:
    * @param[in] margin of child Actor.
    * @param[in] measureFunction for the child.
    * @param[in] index to insert at.
+   * @return child node pointer
    */
-  void AddChild( Actor child, Extents margin, MeasureCallback measureFunction, int index );
+  Node* AddChild( Actor child, Extents margin, MeasureCallback measureFunction, int index );
 
   /**
    * @brief Remove child from the FlexLayout at the given index.
@@ -241,6 +250,78 @@ public:
   Alignment GetFlexItemsAlignment() const;
 
   /**
+   * @brief Set the alignment self of the layout items.
+   * @param[in] flexAlignmentSelf The alignment self of the items.
+   */
+  void SetFlexAlignmentSelf( Alignment flexAlignmentSelf );
+
+  /**
+   * @brief Get the alignment self of the layout items.
+   * @return The flex items alignment self.
+   */
+  Alignment GetFlexAlignmentSelf() const;
+
+  /**
+   * @brief Set the position type of the layout items.
+   * @param[in] flexPositionType The position type of the items.
+   */
+  void SetFlexPositionType( PositionType flexPositionType );
+
+  /**
+   * @brief Get the position type of the layout items.
+   * @return The flex position type.
+   */
+  PositionType GetFlexPositionType() const;
+
+  /**
+   * @brief Set the aspect ratio of the layout items.
+   * @param[in] flexAspectRatio The aspect ratio of the items.
+   */
+  void SetFlexAspectRatio( float flexAspectRatio );
+
+  /**
+   * @brief Get the aspect ratio of the layout items.
+   * @return The flex aspect ratio.
+   */
+  float GetFlexAspectRatio() const;
+
+  /**
+   * @brief Set the basis of the layout items.
+   * @param[in] flexBasis The basis of the items.
+   */
+  void SetFlexBasis( float flexBasis );
+
+  /**
+   * @brief Get the basis of the layout items.
+   * @return The flex basis.
+   */
+  float GetFlexBasis() const;
+
+  /**
+   * @brief Set the shrink of the layout items.
+   * @param[in] flexShrink The shrink of the items.
+   */
+  void SetFlexShrink( float flexShrink );
+
+  /**
+   * @brief Get the shrink of the layout items.
+   * @return The flex shrink.
+   */
+  float GetFlexShrink() const;
+
+  /**
+   * @brief Set the grow of the layout items.
+   * @param[in] flexGrow The grow of the items.
+   */
+  void SetFlexGrow( float flexGrow );
+
+  /**
+   * @brief Get the grow of the layout items.
+   * @return The flex grow.
+   */
+  float GetFlexGrow() const;
+
+  /**
    * @brief Set the margin.
    * @param[in] margin The margin value.
    */