If the height is small even if scrolling is enabled, it should be elide.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / layouting / layout-item-impl.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <dali/integration-api/debug.h>
18
19 #include <dali/public-api/animation/animation.h>
20 #include <dali/public-api/object/type-registry-helper.h>
21 #include <dali-toolkit/public-api/controls/control.h>
22 #include <dali/devel-api/object/handle-devel.h>
23 #include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
24 #include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
25 #include <dali-toolkit/internal/layouting/layout-transition-data-impl.h>
26 #include <dali-toolkit/internal/layouting/layout-item-data-impl.h>
27
28 #include <dali/devel-api/scripting/enum-helper.h>
29
30 namespace
31 {
32
33 #if defined(DEBUG_ENABLED)
34 Debug::Filter* gLayoutFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_LAYOUT" );
35 #endif
36
37 const char* WIDTH_SPECIFICATION_NAME( "widthSpecification" );
38 const char* HEIGHT_SPECIFICATION_NAME( "heightSpecification" );
39
40 }
41
42 namespace Dali
43 {
44 namespace Toolkit
45 {
46 namespace Internal
47 {
48
49 LayoutItem::LayoutItem()
50 : mImpl( new LayoutItem::Impl() ),
51   mSlotDelegate( this )
52 {
53 }
54
55 LayoutItem::~LayoutItem()
56 {
57   // An object with a unique_ptr to an opaque structure must define it's destructor in the translation unit
58   // where the opaque structure is defined. It cannot use the default method in the header file.
59 }
60
61 LayoutItemPtr LayoutItem::New( Handle& owner )
62 {
63   LayoutItemPtr layoutPtr = new LayoutItem();
64   return layoutPtr;
65 }
66
67 void LayoutItem::Initialize( Handle& owner, const std::string& containerType )
68 {
69   mImpl->mOwner = &(owner.GetBaseObject());
70   RegisterChildProperties( containerType );
71   OnInitialize(); // Ensure direct deriving class gets initialized
72 }
73
74 Handle LayoutItem::GetOwner() const
75 {
76   return Handle::DownCast(BaseHandle(mImpl->mOwner));
77 }
78
79 void LayoutItem::Unparent()
80 {
81   // Enable directly derived types to first remove children
82   OnUnparent();
83
84   // Remove myself from parent
85   LayoutParent* parent = GetParent();
86   if( parent )
87   {
88     parent->Remove( *this );
89   }
90
91   // Remove parent reference
92   SetParent(nullptr);
93
94   // Last, clear owner
95   mImpl->mOwner = NULL;
96 }
97
98 LayoutTransitionDataPtr LayoutItem::GetDefaultTransition()
99 {
100   DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::GetDefaultTransition\n" );
101   if ( !mImpl->mDefaultTransitionData.Get() )
102   {
103     auto owner = GetOwner();
104     auto actor = Actor::DownCast( owner );
105
106     mImpl->mDefaultTransitionData = LayoutTransitionData::New();
107     {
108       Property::Map map;
109       map[ Dali::Toolkit::LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
110       map[ Dali::Toolkit::LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
111       map[ Dali::Toolkit::LayoutTransitionData::AnimatorKey::ANIMATOR ] = std::string(); // default animator with default duration
112       // Capture calculated position after layout, apply default linear animation
113       mImpl->mDefaultTransitionData->AddPropertyAnimator( actor, map );
114     }
115     {
116       Property::Map map;
117       map[ Dali::Toolkit::LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
118       map[ Dali::Toolkit::LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
119       map[ Dali::Toolkit::LayoutTransitionData::AnimatorKey::ANIMATOR ] = std::string(); // default animator with default duration
120       // Capture calculated size after layout, apply default linear animation
121       mImpl->mDefaultTransitionData->AddPropertyAnimator( actor, map );
122     }
123   }
124   return mImpl->mDefaultTransitionData;
125 }
126
127 void LayoutItem::SetAnimateLayout( bool animateLayout )
128 {
129   auto owner = GetOwner();
130   auto actor = Actor::DownCast(owner);
131
132   DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetAnimateLayout animateLayout(%s) owner(%s)\n", (animateLayout)?"true":"false",
133                  ( ( Actor::DownCast( owner) ) ? Actor::DownCast(owner).GetName().c_str() : "Invalid Actor" ) );
134
135   mImpl->mAnimated = animateLayout;
136
137   OnAnimationStateChanged( animateLayout );
138 }
139
140 bool LayoutItem::IsLayoutAnimated() const
141 {
142   return mImpl->mAnimated;
143 }
144
145 void LayoutItem::SetTransitionData( int layoutTransitionType, Internal::LayoutTransitionDataPtr layoutTransitionDataPtr )
146 {
147   switch ( layoutTransitionType )
148   {
149   case Dali::Toolkit::LayoutTransitionData::ON_CHILD_ADD:
150     mImpl->mOnChildAddTransitionData = layoutTransitionDataPtr;
151     break;
152   case Dali::Toolkit::LayoutTransitionData::ON_CHILD_REMOVE:
153     mImpl->mOnChildRemoveTransitionData = layoutTransitionDataPtr;
154     break;
155   case Dali::Toolkit::LayoutTransitionData::ON_OWNER_SET:
156     mImpl->mOnOwnerSetTransitionData = layoutTransitionDataPtr;
157     break;
158   default:
159     break;
160   }
161 }
162
163 Internal::LayoutTransitionDataPtr LayoutItem::GetTransitionData( int layoutTransitionType ) const
164 {
165   switch ( layoutTransitionType )
166   {
167   case Dali::Toolkit::LayoutTransitionData::ON_CHILD_ADD:
168     return mImpl->mOnChildAddTransitionData.Get();
169   case Dali::Toolkit::LayoutTransitionData::ON_CHILD_REMOVE:
170     return mImpl->mOnChildRemoveTransitionData.Get();
171   case Dali::Toolkit::LayoutTransitionData::ON_OWNER_SET:
172     return mImpl->mOnOwnerSetTransitionData.Get();
173   default:
174     return LayoutTransitionDataPtr();
175   }
176 }
177
178 void LayoutItem::RegisterChildProperties( const std::string& containerType )
179 {
180   // Call on derived types
181   auto typeInfo = TypeRegistry::Get().GetTypeInfo( containerType );
182   if( typeInfo )
183   {
184     Property::IndexContainer indices;
185     typeInfo.GetChildPropertyIndices( indices );
186
187     if( std::find( indices.Begin(), indices.End(), Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ) ==
188         indices.End() )
189     {
190       ChildPropertyRegistration( typeInfo.GetName(), WIDTH_SPECIFICATION_NAME,
191                                  Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, Property::INTEGER );
192
193       ChildPropertyRegistration( typeInfo.GetName(), HEIGHT_SPECIFICATION_NAME,
194                                  Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, Property::INTEGER );
195     }
196
197     OnRegisterChildProperties( containerType );
198   }
199 }
200
201 void LayoutItem::OnRegisterChildProperties( const std::string& containerType )
202 {
203 }
204
205
206 void LayoutItem::Measure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec )
207 {
208   DALI_LOG_TRACE_METHOD( gLayoutFilter );
209
210   const bool forceLayout = mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
211
212   const bool specChanged =
213     ( widthMeasureSpec  != mImpl->mOldWidthMeasureSpec ) ||
214     ( heightMeasureSpec != mImpl->mOldHeightMeasureSpec );
215
216   const bool isSpecExactly =
217     ( widthMeasureSpec.GetMode() == MeasureSpec::Mode::EXACTLY ) &&
218     ( heightMeasureSpec.GetMode() == MeasureSpec::Mode::EXACTLY );
219
220   const bool matchesSpecSize =
221     ( GetMeasuredWidth() == widthMeasureSpec.GetSize() ) &&
222     ( GetMeasuredHeight() == heightMeasureSpec.GetSize() );
223
224   const bool needsLayout = specChanged && ( !isSpecExactly || !matchesSpecSize );
225
226   DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::Measure("<<widthMeasureSpec<<", "<<heightMeasureSpec<<") Owner:"
227                                                   <<Actor::DownCast(GetOwner()).GetName() <<"  forceLayout="<<forceLayout
228                                                   <<", specChanged="<<specChanged<<", isSpecExactly="<<isSpecExactly
229                                                   <<", matchesSpecSize="<<matchesSpecSize
230                                                   <<", needsLayout="<<needsLayout <<(forceLayout||needsLayout?"  Remeasuring":"  NoChange"));
231
232   if( forceLayout || needsLayout )
233   {
234     mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_MEASURED_DIMENSION_SET );
235
236     // measure ourselves, this should set the measured dimension flag back
237 #if defined(DEBUG_ENABLED)
238     std::ostringstream o;
239     o<<widthMeasureSpec<<","<<heightMeasureSpec;
240     DALI_LOG_INFO( gLayoutFilter, Debug::General, "LayoutItem::Measure Calling %s OnMeasure( %s )\n", Actor::DownCast(GetOwner()).GetName().c_str(), o.str().c_str());
241 #endif
242     OnMeasure( widthMeasureSpec, heightMeasureSpec );
243     mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_MEASURE_NEEDED_BEFORE_LAYOUT );
244
245     // flag not set, setMeasuredDimension() was not invoked, we raise an exception to warn the developer
246     DALI_ASSERT_ALWAYS( mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_MEASURED_DIMENSION_SET ) &&
247                         "Layout's OnMeasure() Measured dimension flag not set" );
248     mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_LAYOUT_REQUIRED );
249   }
250
251   mImpl->mOldWidthMeasureSpec = widthMeasureSpec;
252   mImpl->mOldHeightMeasureSpec = heightMeasureSpec;
253 }
254
255 void LayoutItem::Layout( LayoutLength l, LayoutLength t, LayoutLength r, LayoutLength b )
256 {
257   DALI_LOG_TRACE_METHOD( gLayoutFilter );
258
259   if( mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_MEASURE_NEEDED_BEFORE_LAYOUT ) )
260   {
261     OnMeasure( mImpl->mOldWidthMeasureSpec, mImpl->mOldHeightMeasureSpec );
262     mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_MEASURE_NEEDED_BEFORE_LAYOUT );
263   }
264
265   LayoutData& layoutData = *mImpl->sLayoutData;
266   size_t size = layoutData.childrenPropertyAnimators.size();
267
268   bool changed = SetFrame( l, t, r, b );
269
270   if( changed || mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_LAYOUT_REQUIRED ) )
271   {
272
273     OnLayout( changed, l, t, r, b );
274     mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_LAYOUT_REQUIRED );
275   }
276
277   if ( size != layoutData.childrenPropertyAnimators.size() )
278   {
279     layoutData.childrenPropertyAnimators.resize( size );
280   }
281
282   mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
283   mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_IS_LAID_OUT );
284 }
285
286 LayoutLength LayoutItem::GetMinimumWidth() const
287 {
288   return mImpl->mMinimumSize.GetWidth();
289 }
290
291 LayoutLength LayoutItem::GetMinimumHeight() const
292 {
293   return mImpl->mMinimumSize.GetHeight();
294 }
295
296 void LayoutItem::SetMinimumWidth( LayoutLength minimumWidth )
297 {
298   mImpl->mMinimumSize.SetWidth( minimumWidth );
299   RequestLayout();
300 }
301
302 void LayoutItem::SetMinimumHeight( LayoutLength minimumHeight )
303 {
304   mImpl->mMinimumSize.SetHeight( minimumHeight );
305   RequestLayout();
306 }
307
308 Extents LayoutItem::GetPadding() const
309 {
310   Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
311   if( control )
312   {
313     Extents padding = control.GetProperty<Extents>( Toolkit::Control::Property::PADDING );
314
315     DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::Padding for %s : (%d,%d,%d,%d) \n",
316                    control.GetName().c_str(),
317                    padding.start, padding.end, padding.top, padding.bottom
318                  );
319     return padding;
320   }
321   else
322   {
323     return Extents();
324   }
325 }
326
327 Extents LayoutItem::GetMargin() const
328 {
329   Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
330   if ( control )
331   {
332     return control.GetProperty<Extents>( Toolkit::Control::Property::MARGIN );
333   }
334   else
335   {
336     return Extents();
337   }
338 }
339
340 LayoutLength LayoutItem::GetDefaultSize( LayoutLength size, MeasureSpec measureSpec )
341 {
342   LayoutLength result = size;
343   auto specMode = measureSpec.GetMode();
344   auto specSize = measureSpec.GetSize();
345
346   DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::GetDefaultSize MeasureSpec("<<measureSpec<< ") size:" << size << "\n" );
347
348   switch (specMode)
349   {
350     case MeasureSpec::Mode::UNSPECIFIED:
351     {
352       result = size;
353       break;
354     }
355     case MeasureSpec::Mode::AT_MOST:
356     {
357       // Ensure the default size does not exceed the spec size unless the default size is 0.
358       // Another container could provide a default size of 0.
359       LayoutLength tmp = specSize;
360
361       // Do not set size to 0, use specSize in this case as could be a legacy container
362       if( size < tmp && size > LayoutLength( 0 ) )
363       {
364         result = size;
365       }
366       else
367       {
368         result = specSize;
369       }
370       break;
371     }
372     case MeasureSpec::Mode::EXACTLY:
373     {
374       result = specSize;
375       break;
376     }
377   }
378   DALI_LOG_STREAM( gLayoutFilter, Debug::General, "LayoutItem::GetDefaultSize setting default size:" << result << "\n" );
379   return result;
380 }
381
382 void LayoutItem::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec)
383 {
384   DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::OnMeasure\n");
385
386   // GetDefaultSize will limit the MeasureSpec to the suggested minimumWidth and minimumHeight
387   SetMeasuredDimensions( GetDefaultSize( GetSuggestedMinimumWidth(), widthMeasureSpec ),
388                          GetDefaultSize( GetSuggestedMinimumHeight(), heightMeasureSpec ) );
389 }
390
391 void LayoutItem::OnLayout( bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom )
392 {
393 }
394
395 void LayoutItem::SetParent( LayoutParent* parent )
396 {
397   mImpl->mLayoutParent = parent;
398   mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_SET_FRAME );
399 }
400
401 LayoutParent* LayoutItem::GetParent()
402 {
403   return mImpl->mLayoutParent;
404 }
405
406 void LayoutItem::RequestLayout()
407 {
408   Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
409   if( control )
410   {
411     DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::RequestLayout control(%s)\n",
412         control.GetName().c_str() );
413   }
414   // @todo Enforce failure if called in Measure/Layout passes.
415   mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
416   Toolkit::LayoutController layoutController = Toolkit::LayoutController::Get();
417   layoutController.RequestLayout( Toolkit::LayoutItem( this ) );
418 }
419
420 void LayoutItem::RequestLayout( Dali::Toolkit::LayoutTransitionData::LayoutTransitionType layoutAnimationType )
421 {
422   Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
423   if ( control )
424   {
425     DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::RequestLayout control(%s) layoutTranstionType(%d)\n",
426         control.GetName().c_str(), (int)layoutAnimationType );
427   }
428   // @todo Enforce failure if called in Measure/Layout passes.
429   mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
430   Toolkit::LayoutController layoutController = Toolkit::LayoutController::Get();
431   layoutController.RequestLayout( Toolkit::LayoutItem(this), layoutAnimationType );
432 }
433
434 bool LayoutItem::IsLayoutRequested() const
435 {
436   return mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
437 }
438
439 void LayoutItem::SetLayoutRequested()
440 {
441   mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
442 }
443
444 bool LayoutItem::IsResizePolicyRequired() const
445 {
446   return mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_USE_RESIZE_POLICY );
447 }
448
449 void LayoutItem::SetResizePolicyRequired( bool resizePolicyRequired )
450 {
451   if( resizePolicyRequired )
452   {
453     mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_USE_RESIZE_POLICY );
454   }
455   else
456   {
457     mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_USE_RESIZE_POLICY );
458   }
459 }
460
461 void LayoutItem::SetMeasuredDimensions( MeasuredSize measuredWidth, MeasuredSize measuredHeight )
462 {
463
464   DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetMeasuredDimensions width(" << measuredWidth.GetSize() << ") height(" << measuredHeight.GetSize() << ") Control:" <<
465                         ( ( Actor::DownCast( GetOwner()) ) ? Actor::DownCast(GetOwner()).GetName().c_str() : "Invalid Actor" ) << "\n" );
466
467   mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_MEASURED_DIMENSION_SET );
468   mImpl->mMeasuredWidth = measuredWidth;
469   mImpl->mMeasuredHeight = measuredHeight;
470 }
471
472 LayoutLength LayoutItem::GetMeasuredWidth() const
473 {
474   // Get the size portion of the measured width
475   return  mImpl->mMeasuredWidth.GetSize();
476 }
477
478 LayoutLength LayoutItem::GetMeasuredHeight() const
479 {
480   return  mImpl->mMeasuredHeight.GetSize();
481 }
482
483 MeasuredSize LayoutItem::GetMeasuredWidthAndState() const
484 {
485   return mImpl->mMeasuredWidth;
486 }
487
488 MeasuredSize LayoutItem::GetMeasuredHeightAndState() const
489 {
490   return mImpl->mMeasuredHeight;
491 }
492
493 LayoutLength LayoutItem::GetSuggestedMinimumWidth() const
494 {
495   auto owner = GetOwner();
496   auto actor = Actor::DownCast(owner);
497   auto naturalSize = actor ? actor.GetNaturalSize() : Vector3::ZERO;
498
499   return std::max( mImpl->mMinimumSize.GetWidth(), LayoutLength( naturalSize.width ) );
500 }
501
502 LayoutLength LayoutItem::GetSuggestedMinimumHeight() const
503 {
504   auto owner = GetOwner();
505   auto actor = Actor::DownCast(owner);
506   auto naturalSize = actor ? actor.GetNaturalSize() : Vector3::ZERO;
507
508   return std::max( mImpl->mMinimumSize.GetHeight(), LayoutLength( naturalSize.height ) );
509 }
510
511 MeasuredSize LayoutItem::ResolveSizeAndState( LayoutLength size, MeasureSpec measureSpec, MeasuredSize::State childMeasuredState )
512 {
513   auto specMode = measureSpec.GetMode();
514   LayoutLength specSize = measureSpec.GetSize();
515   MeasuredSize result;
516
517   switch( specMode )
518   {
519     case MeasureSpec::Mode::AT_MOST:
520     {
521       if (specSize < size)
522       {
523         result = MeasuredSize( specSize, MeasuredSize::MEASURED_SIZE_TOO_SMALL );
524       }
525       else
526       {
527         result.SetSize( size );
528       }
529       break;
530     }
531
532     case MeasureSpec::Mode::EXACTLY:
533     {
534       result.SetSize( specSize );
535       break;
536     }
537
538     case MeasureSpec::Mode::UNSPECIFIED:
539     default:
540     {
541       result.SetSize( size );
542       break;
543     }
544   }
545
546   result.SetState( childMeasuredState );
547   return result;
548 }
549
550
551 bool LayoutItem::SetFrame( LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom )
552 {
553   bool changed = false;
554
555   DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame enter(" << left << ", " << top << ", " << right << ", " << bottom << ")\n" );
556
557   if( mImpl->mLeft != left || mImpl->mRight != right || mImpl->mTop != top || mImpl->mBottom != bottom || mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_SET_FRAME ) )
558   {
559     changed = true;
560     mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_FORCE_SET_FRAME );
561   }
562
563   LayoutLength oldWidth = mImpl->mRight - mImpl->mLeft;
564   LayoutLength oldHeight = mImpl->mBottom - mImpl->mTop;
565   LayoutLength newWidth = right - left;
566   LayoutLength newHeight = bottom - top;
567   bool sizeChanged = ( newWidth != oldWidth ) || ( newHeight != oldHeight );
568
569   mImpl->mLeft = left;
570   mImpl->mTop = top;
571   mImpl->mRight = right;
572   mImpl->mBottom = bottom;
573
574   // Reflect up to parent control
575   auto owner = GetOwner();
576   auto actor = Actor::DownCast( owner );
577   LayoutData& layoutData = *mImpl->sLayoutData;
578   if( actor )
579   {
580     if( mImpl->mAnimated && !layoutData.speculativeLayout )
581     {
582
583       LayoutItem* transitionOwner = layoutData.layoutTransition.layoutItem.Get();
584       LayoutTransitionDataPtr layoutTransitionDataPtr = GetTransitionData( layoutData.layoutTransition.layoutTransitionType );
585
586       // Found transition owner
587       if( transitionOwner == this && layoutTransitionDataPtr.Get() )
588       {
589         DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply transition to (%s), transition type (%d)\n", actor.GetName().c_str(), layoutData.layoutTransition.layoutTransitionType );
590         layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), true ) );
591         layoutTransitionDataPtr->ConvertToLayoutDataElements( actor, layoutData );
592         changed = true;
593       }
594       else
595       {
596         if( changed )
597         {
598           DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply default transition to (%s), transition type (%d)\n", actor.GetName().c_str(), layoutData.layoutTransition.layoutTransitionType );
599           layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), true ) );
600           GetDefaultTransition()->ConvertToLayoutDataElements( actor, layoutData );
601         }
602       }
603     }
604     else
605     {
606       if( changed )
607       {
608         layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), false ) );
609       }
610     }
611   }
612
613   // TODO: do we need it
614   if( sizeChanged )
615   {
616     SizeChange( LayoutSize( newWidth, newHeight ), LayoutSize( oldWidth, oldHeight ) );
617   }
618
619   DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame  exit(" << left << ", " << top << ", " << right << ", " << bottom << ")\n" );
620
621   return changed;
622 }
623
624 void LayoutItem::OnLayoutAnimationFinished( Animation& animation )
625 {
626   auto owner = GetOwner();
627   auto actor = Actor::DownCast(owner);
628   if( actor )
629   {
630     actor.SetSize( Vector3( mImpl->mRight.AsInteger() - mImpl->mLeft.AsInteger(), mImpl->mBottom.AsInteger() - mImpl->mTop.AsInteger(), 0.0f ) );
631   }
632 }
633
634 void LayoutItem::SizeChange( LayoutSize newSize, LayoutSize oldSize)
635 {
636   OnSizeChanged( newSize, oldSize );
637 }
638
639
640 void LayoutItem::OnSizeChanged( LayoutSize newSize, LayoutSize oldSize )
641 {
642 }
643
644 void LayoutItem::OnInitialize()
645 {
646 }
647
648
649 } // namespace Internal
650 } // namespace Toolkit
651 } // namespace Dali