Control Padding and Margin Properties used for layouts
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / layouting / layout-item-impl.cpp
index e31045f..be5b0ed 100644 (file)
 #include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
 #include <dali-toolkit/internal/layouting/layout-item-data-impl.h>
 
+namespace
+{
+
 #if defined(DEBUG_ENABLED)
-    Debug::Filter* gLayoutFilter = Debug::Filter::New( Debug::Verbose, false, "LOG_LAYOUT" );
+Debug::Filter* gLayoutFilter = Debug::Filter::New( Debug::Verbose, false, "LOG_LAYOUT" );
 #endif
 
-namespace
-{
 const char* WIDTH_SPECIFICATION_NAME( "widthSpecification" );
 const char* HEIGHT_SPECIFICATION_NAME( "heightSpecification" );
 
@@ -121,6 +122,8 @@ void LayoutItem::OnRegisterChildProperties( const std::string& containerType )
 
 void LayoutItem::Measure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec )
 {
+  DALI_LOG_TRACE_METHOD( gLayoutFilter );
+
   const bool forceLayout = mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
 
   const bool specChanged =
@@ -199,7 +202,34 @@ void LayoutItem::SetMinimumHeight( LayoutLength minimumHeight )
 
 Extents LayoutItem::GetPadding() const
 {
-  return mImpl->mPadding;
+  Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
+  if( control )
+  {
+    Extents padding = control.GetProperty<Extents>( Toolkit::Control::Property::PADDING );
+
+    DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutBase::Padding for %s : (%d,%d,%d,%d) \n",
+                   control.GetName().c_str(),
+                   padding.start, padding.end, padding.top, padding.bottom
+                 );
+    return padding;
+  }
+  else
+  {
+    return Extents();
+  }
+}
+
+Extents LayoutItem::GetMargin() const
+{
+  Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
+  if ( control )
+  {
+    return control.GetProperty<Extents>( Toolkit::Control::Property::MARGIN );
+  }
+  else
+  {
+    return Extents();
+  }
 }
 
 LayoutLength LayoutItem::GetDefaultSize( LayoutLength size, MeasureSpec measureSpec )
@@ -255,6 +285,11 @@ bool LayoutItem::IsLayoutRequested() const
 
 void LayoutItem::SetMeasuredDimensions( MeasuredSize measuredWidth, MeasuredSize measuredHeight )
 {
+  DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutBase::SetMeasuredDimensions width(%d) height(%d) \n",
+                                                 MeasureSpec::IntType( measuredWidth.GetSize() ),
+                                                 MeasureSpec::IntType( measuredHeight.GetSize() )
+               );
+
   mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_MEASURED_DIMENSION_SET );
   mImpl->mMeasuredWidth = measuredWidth;
   mImpl->mMeasuredHeight = measuredHeight;