Controls are LayoutGroups instead of LayoutItems
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / layouting / linear-layout-impl.cpp
index 6b91bc0..f989a54 100644 (file)
@@ -61,7 +61,11 @@ LinearLayout::~LinearLayout()
 
 void LinearLayout::SetCellPadding( LayoutSize size )
 {
-  mCellPadding = size;
+  if ( mCellPadding != size )
+  {
+    mCellPadding = size;
+    RequestLayout();
+  }
 }
 
 LayoutSize LinearLayout::GetCellPadding()
@@ -71,7 +75,11 @@ LayoutSize LinearLayout::GetCellPadding()
 
 void LinearLayout::SetOrientation( Dali::Toolkit::LinearLayout::Orientation orientation )
 {
-  mOrientation = orientation;
+  if ( mOrientation != orientation )
+  {
+    mOrientation = orientation;
+    RequestLayout();
+  }
 }
 
 Dali::Toolkit::LinearLayout::Orientation LinearLayout::GetOrientation()
@@ -265,7 +273,7 @@ void LinearLayout::LayoutHorizontal( LayoutLength left, LayoutLength top, Layout
 
   Extents padding = GetPadding();
 
-  LayoutLength childTop( 0 );
+  LayoutLength childTop( padding.top );
   LayoutLength childLeft( padding.start );
 
   // Where bottom of child should go
@@ -425,7 +433,7 @@ void LinearLayout::LayoutVertical( LayoutLength left, LayoutLength top, LayoutLe
 {
   Extents padding = GetPadding();
 
-  LayoutLength childTop( 0 );
+  LayoutLength childTop( padding.top );
   LayoutLength childLeft( padding.start );
 
   // Where bottom of child should go
@@ -445,7 +453,7 @@ void LinearLayout::LayoutVertical( LayoutLength left, LayoutLength top, LayoutLe
       auto childMargin = childLayout->GetMargin();
 
       childTop += childMargin.top;
-      childLeft = ( childSpace - childWidth ) / 2 + childMargin.start - childMargin.end;
+      childLeft = LayoutLength( padding.start ) + ( childSpace - childWidth ) / 2 + childMargin.start - childMargin.end;
 
       childLayout->Layout( childLeft, childTop, childLeft + childWidth, childTop + childHeight );
       childTop += childHeight + childMargin.bottom + mCellPadding.height;