X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fflex-container%2Fflex-container-impl.cpp;h=650e5cf4ca901394b8aa4061808b3a2433fbe30e;hb=be1b4b7c6c0e02c121a293cba7b22fa0353b3272;hp=c520ede1bb9e4eb0cc0d47b471d281cedd0991b5;hpb=a3ab994876ea86236784101dd85370815c336e8b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp b/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp index c520ede..650e5cf 100644 --- a/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp +++ b/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -465,12 +466,6 @@ Property::Value FlexContainer::GetProperty( BaseObject* object, Property::Index void FlexContainer::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - - // Anchor actor to top left of the container - child.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - child.SetParentOrigin( ParentOrigin::TOP_LEFT ); - // Create a new node for the child. FlexItemNode childNode; childNode.actor = child; @@ -478,6 +473,8 @@ void FlexContainer::OnChildAdd( Actor& child ) childNode.node->get_child = GetChildNodeAtIndex; childNode.node->is_dirty = IsNodeDirty; mChildrenNodes.push_back(childNode); + + Control::OnChildAdd( child ); } void FlexContainer::OnChildRemove( Actor& child ) @@ -505,6 +502,13 @@ void FlexContainer::OnRelayout( const Vector2& size, RelayoutContainer& containe Actor child = mChildrenNodes[i].actor.GetHandle(); if( child ) { + // Anchor actor to top left of the container + if( child.GetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT ).Get< bool >() ) + { + child.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + } + child.SetParentOrigin( ParentOrigin::TOP_LEFT ); + float negotiatedWidth = child.GetRelayoutSize(Dimension::WIDTH); float negotiatedHeight = child.GetRelayoutSize(Dimension::HEIGHT); @@ -527,13 +531,18 @@ void FlexContainer::OnRelayout( const Vector2& size, RelayoutContainer& containe Actor child = mChildrenNodes[i].actor.GetHandle(); if( child ) { - if( child.GetResizePolicy( Dimension::WIDTH ) != ResizePolicy::USE_ASSIGNED_SIZE ) - { - child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::WIDTH ); - } - if( child.GetResizePolicy( Dimension::HEIGHT ) != ResizePolicy::USE_ASSIGNED_SIZE ) + if( child.GetPropertyType( Toolkit::FlexContainer::ChildProperty::FLEX ) != Property::NONE ) { - child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::HEIGHT ); + // Only Set to USE_ASSIGNED_SIZE if the child actor is flexible. + + if( child.GetResizePolicy( Dimension::WIDTH ) != ResizePolicy::USE_ASSIGNED_SIZE ) + { + child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::WIDTH ); + } + if( child.GetResizePolicy( Dimension::HEIGHT ) != ResizePolicy::USE_ASSIGNED_SIZE ) + { + child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::HEIGHT ); + } } container.Add( child, Vector2(mChildrenNodes[i].node->layout.dimensions[CSS_WIDTH], mChildrenNodes[i].node->layout.dimensions[CSS_HEIGHT] ) ); @@ -557,11 +566,8 @@ void FlexContainer::OnSizeSet( const Vector3& size ) RelayoutRequest(); } -} -void FlexContainer::OnSizeAnimation( Animation& animation, const Vector3& targetSize ) -{ - // @todo Animate the children to their target size and position + Control::OnSizeSet( size ); } void FlexContainer::ComputeLayout() @@ -730,6 +736,10 @@ Actor FlexContainer::GetNextKeyboardFocusableActor(Actor currentFocusedActor, To } while ( !mChildrenNodes[nextFocusedActorIndex].actor.GetHandle().IsKeyboardFocusable() ); break; } + default: + { + break; + } } if( nextFocusedActorIndex != currentFocusedActorIndex )