X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fflex-container%2Fflex-container-impl.cpp;h=4a3b065e3e76eacf38955d2ae301db9c145f813f;hp=0fc7588afc76765feb7a062d7e85d946e48a49d3;hb=1895d50b1a4867ad8e3be4bbaf13768465efe6bc;hpb=fca202af829a0657805e44461f08f284cdbf0bbb diff --git a/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp b/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp old mode 100755 new mode 100644 index 0fc7588..4a3b065 --- 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) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,61 +19,57 @@ #include // EXTERNAL INCLUDES -#include -#include -#include -#include #include #include -#include #include +#include +#include +#include +#include +#include + +#include using namespace Dali; namespace { - #if defined(DEBUG_ENABLED) // debugging support, very useful when new features are added or bugs are hunted down // currently not called from code so compiler will optimize these away, kept here for future debugging #define FLEX_CONTAINER_TAG "DALI Toolkit::FlexContainer " -#define FC_LOG(fmt, args,...) Debug::LogMessage(Debug::DebugInfo, FLEX_CONTAINER_TAG fmt, ## args) +#define FC_LOG(fmt, args, ...) Debug::LogMessageWithFunctionLine(Debug::DebugInfo, FLEX_CONTAINER_TAG fmt, ##args) // #define FLEX_CONTAINER_DEBUG 1 #if defined(FLEX_CONTAINER_DEBUG) -void PrintNodes( Toolkit::Internal::FlexContainer::FlexItemNodeContainer itemNodes ) +void PrintNodes(Toolkit::Internal::FlexContainer::FlexItemNodeContainer itemNodes) { // Print the style property and layout of all the children - for( unsigned int i = 0; i < itemNodes.size(); ++i ) + for(unsigned int i = 0; i < itemNodes.size(); ++i) { - FC_LOG( "Item %d style: \n", i ); - YGNodePrint( itemNodes[i].node, (YGPrintOptions)( YGPrintOptionsStyle | YGPrintOptionsChildren ) ); - FC_LOG( "\n" ); - FC_LOG( "Item %d layout: \n", i ); - YGNodePrint( itemNodes[i].node, (YGPrintOptions)( YGPrintOptionsLayout | YGPrintOptionsChildren ) ); - FC_LOG( "\n" ); + FC_LOG("Item %d style: \n", i); + YGNodePrint(itemNodes[i].node, (YGPrintOptions)(YGPrintOptionsStyle | YGPrintOptionsChildren)); + FC_LOG("\n"); + FC_LOG("Item %d layout: \n", i); + YGNodePrint(itemNodes[i].node, (YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren)); + FC_LOG("\n"); } } #endif // defined(FLEX_CONTAINER_DEBUG) #endif // defined(DEBUG_ENABLED) - } // namespace namespace Dali { - namespace Toolkit { - namespace Internal { - namespace { - // Type registration BaseHandle Create() { @@ -81,91 +77,85 @@ BaseHandle Create() } // Setup properties, signals and actions using the type-registry. -DALI_TYPE_REGISTRATION_BEGIN( Toolkit::FlexContainer, Toolkit::Control, Create ); - -DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "contentDirection", INTEGER, CONTENT_DIRECTION ) -DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexDirection", INTEGER, FLEX_DIRECTION ) -DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexWrap", INTEGER, FLEX_WRAP ) -DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "justifyContent", INTEGER, JUSTIFY_CONTENT ) -DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignItems", INTEGER, ALIGN_ITEMS ) -DALI_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignContent", INTEGER, ALIGN_CONTENT ) -DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flex", FLOAT, FLEX ) -DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "alignSelf", INTEGER, ALIGN_SELF ) -DALI_CHILD_PROPERTY_REGISTRATION( Toolkit, FlexContainer, "flexMargin", VECTOR4, FLEX_MARGIN ) +DALI_TYPE_REGISTRATION_BEGIN(Toolkit::FlexContainer, Toolkit::Control, Create); + +DALI_PROPERTY_REGISTRATION(Toolkit, FlexContainer, "contentDirection", INTEGER, CONTENT_DIRECTION) +DALI_PROPERTY_REGISTRATION(Toolkit, FlexContainer, "flexDirection", INTEGER, FLEX_DIRECTION) +DALI_PROPERTY_REGISTRATION(Toolkit, FlexContainer, "flexWrap", INTEGER, FLEX_WRAP) +DALI_PROPERTY_REGISTRATION(Toolkit, FlexContainer, "justifyContent", INTEGER, JUSTIFY_CONTENT) +DALI_PROPERTY_REGISTRATION(Toolkit, FlexContainer, "alignItems", INTEGER, ALIGN_ITEMS) +DALI_PROPERTY_REGISTRATION(Toolkit, FlexContainer, "alignContent", INTEGER, ALIGN_CONTENT) +DALI_CHILD_PROPERTY_REGISTRATION(Toolkit, FlexContainer, "flex", FLOAT, FLEX) +DALI_CHILD_PROPERTY_REGISTRATION(Toolkit, FlexContainer, "alignSelf", INTEGER, ALIGN_SELF) +DALI_CHILD_PROPERTY_REGISTRATION(Toolkit, FlexContainer, "flexMargin", VECTOR4, FLEX_MARGIN) DALI_TYPE_REGISTRATION_END() const Scripting::StringEnum ALIGN_SELF_STRING_TABLE[] = -{ - { "auto", Toolkit::FlexContainer::ALIGN_AUTO }, - { "flexStart", Toolkit::FlexContainer::ALIGN_FLEX_START }, - { "center", Toolkit::FlexContainer::ALIGN_CENTER }, - { "flexEnd", Toolkit::FlexContainer::ALIGN_FLEX_END }, - { "stretch", Toolkit::FlexContainer::ALIGN_STRETCH } -}; -const unsigned int ALIGN_SELF_STRING_TABLE_COUNT = sizeof( ALIGN_SELF_STRING_TABLE ) / sizeof( ALIGN_SELF_STRING_TABLE[0] ); + { + {"auto", Toolkit::FlexContainer::ALIGN_AUTO}, + {"flexStart", Toolkit::FlexContainer::ALIGN_FLEX_START}, + {"center", Toolkit::FlexContainer::ALIGN_CENTER}, + {"flexEnd", Toolkit::FlexContainer::ALIGN_FLEX_END}, + {"stretch", Toolkit::FlexContainer::ALIGN_STRETCH}}; +const unsigned int ALIGN_SELF_STRING_TABLE_COUNT = sizeof(ALIGN_SELF_STRING_TABLE) / sizeof(ALIGN_SELF_STRING_TABLE[0]); const Scripting::StringEnum CONTENT_DIRECTION_STRING_TABLE[] = -{ - { "inherit", Toolkit::FlexContainer::INHERIT }, - { "LTR", Toolkit::FlexContainer::LTR }, - { "RTL", Toolkit::FlexContainer::RTL } -}; -const unsigned int CONTENT_DIRECTION_STRING_TABLE_COUNT = sizeof( CONTENT_DIRECTION_STRING_TABLE ) / sizeof( CONTENT_DIRECTION_STRING_TABLE[0] ); + { + {"inherit", Toolkit::FlexContainer::INHERIT}, + {"LTR", Toolkit::FlexContainer::LTR}, + {"RTL", Toolkit::FlexContainer::RTL}}; +const unsigned int CONTENT_DIRECTION_STRING_TABLE_COUNT = sizeof(CONTENT_DIRECTION_STRING_TABLE) / sizeof(CONTENT_DIRECTION_STRING_TABLE[0]); const Scripting::StringEnum FLEX_DIRECTION_STRING_TABLE[] = -{ - { "column", Toolkit::FlexContainer::COLUMN }, - { "columnReverse", Toolkit::FlexContainer::COLUMN_REVERSE }, - { "row", Toolkit::FlexContainer::ROW }, - { "rowReverse", Toolkit::FlexContainer::ROW_REVERSE } -}; -const unsigned int FLEX_DIRECTION_STRING_TABLE_COUNT = sizeof( FLEX_DIRECTION_STRING_TABLE ) / sizeof( FLEX_DIRECTION_STRING_TABLE[0] ); + { + {"column", Toolkit::FlexContainer::COLUMN}, + {"columnReverse", Toolkit::FlexContainer::COLUMN_REVERSE}, + {"row", Toolkit::FlexContainer::ROW}, + {"rowReverse", Toolkit::FlexContainer::ROW_REVERSE}}; +const unsigned int FLEX_DIRECTION_STRING_TABLE_COUNT = sizeof(FLEX_DIRECTION_STRING_TABLE) / sizeof(FLEX_DIRECTION_STRING_TABLE[0]); const Scripting::StringEnum FLEX_WRAP_STRING_TABLE[] = -{ - { "noWrap", Toolkit::FlexContainer::NO_WRAP }, - { "wrap", Toolkit::FlexContainer::WRAP } -}; -const unsigned int FLEX_WRAP_STRING_TABLE_COUNT = sizeof( FLEX_WRAP_STRING_TABLE ) / sizeof( FLEX_WRAP_STRING_TABLE[0] ); + { + {"noWrap", Toolkit::FlexContainer::NO_WRAP}, + {"wrap", Toolkit::FlexContainer::WRAP}}; +const unsigned int FLEX_WRAP_STRING_TABLE_COUNT = sizeof(FLEX_WRAP_STRING_TABLE) / sizeof(FLEX_WRAP_STRING_TABLE[0]); const Scripting::StringEnum JUSTIFY_CONTENT_STRING_TABLE[] = -{ - { "flexStart", Toolkit::FlexContainer::JUSTIFY_FLEX_START }, - { "center", Toolkit::FlexContainer::JUSTIFY_CENTER }, - { "flexEnd", Toolkit::FlexContainer::JUSTIFY_FLEX_END }, - { "spaceBetween", Toolkit::FlexContainer::JUSTIFY_SPACE_BETWEEN }, - { "spaceAround", Toolkit::FlexContainer::JUSTIFY_SPACE_AROUND } -}; -const unsigned int JUSTIFY_CONTENT_STRING_TABLE_COUNT = sizeof( JUSTIFY_CONTENT_STRING_TABLE ) / sizeof( JUSTIFY_CONTENT_STRING_TABLE[0] ); + { + {"flexStart", Toolkit::FlexContainer::JUSTIFY_FLEX_START}, + {"center", Toolkit::FlexContainer::JUSTIFY_CENTER}, + {"flexEnd", Toolkit::FlexContainer::JUSTIFY_FLEX_END}, + {"spaceBetween", Toolkit::FlexContainer::JUSTIFY_SPACE_BETWEEN}, + {"spaceAround", Toolkit::FlexContainer::JUSTIFY_SPACE_AROUND}, + {"spaceEvenly", Toolkit::FlexContainer::JUSTIFY_SPACE_EVENLY}}; +const unsigned int JUSTIFY_CONTENT_STRING_TABLE_COUNT = sizeof(JUSTIFY_CONTENT_STRING_TABLE) / sizeof(JUSTIFY_CONTENT_STRING_TABLE[0]); const Scripting::StringEnum ALIGN_ITEMS_STRING_TABLE[] = -{ - { "flexStart", Toolkit::FlexContainer::ALIGN_FLEX_START }, - { "center", Toolkit::FlexContainer::ALIGN_CENTER }, - { "flexEnd", Toolkit::FlexContainer::ALIGN_FLEX_END }, - { "stretch", Toolkit::FlexContainer::ALIGN_STRETCH } -}; -const unsigned int ALIGN_ITEMS_STRING_TABLE_COUNT = sizeof( ALIGN_ITEMS_STRING_TABLE ) / sizeof( ALIGN_ITEMS_STRING_TABLE[0] ); + { + {"flexStart", Toolkit::FlexContainer::ALIGN_FLEX_START}, + {"center", Toolkit::FlexContainer::ALIGN_CENTER}, + {"flexEnd", Toolkit::FlexContainer::ALIGN_FLEX_END}, + {"stretch", Toolkit::FlexContainer::ALIGN_STRETCH}}; +const unsigned int ALIGN_ITEMS_STRING_TABLE_COUNT = sizeof(ALIGN_ITEMS_STRING_TABLE) / sizeof(ALIGN_ITEMS_STRING_TABLE[0]); const Scripting::StringEnum ALIGN_CONTENT_STRING_TABLE[] = -{ - { "flexStart", Toolkit::FlexContainer::ALIGN_FLEX_START }, - { "center", Toolkit::FlexContainer::ALIGN_CENTER }, - { "flexEnd", Toolkit::FlexContainer::ALIGN_FLEX_END }, - { "stretch", Toolkit::FlexContainer::ALIGN_STRETCH } -}; -const unsigned int ALIGN_CONTENT_STRING_TABLE_COUNT = sizeof( ALIGN_CONTENT_STRING_TABLE ) / sizeof( ALIGN_CONTENT_STRING_TABLE[0] ); + { + {"flexStart", Toolkit::FlexContainer::ALIGN_FLEX_START}, + {"center", Toolkit::FlexContainer::ALIGN_CENTER}, + {"flexEnd", Toolkit::FlexContainer::ALIGN_FLEX_END}, + {"stretch", Toolkit::FlexContainer::ALIGN_STRETCH}}; +const unsigned int ALIGN_CONTENT_STRING_TABLE_COUNT = sizeof(ALIGN_CONTENT_STRING_TABLE) / sizeof(ALIGN_CONTENT_STRING_TABLE[0]); } // Unnamed namespace Toolkit::FlexContainer FlexContainer::New() { // Create the implementation, temporarily owned by this handle on stack - IntrusivePtr< FlexContainer > impl = new FlexContainer(); + IntrusivePtr impl = new FlexContainer(); // Pass ownership to CustomActor handle - Toolkit::FlexContainer handle( *impl ); + Toolkit::FlexContainer handle(*impl); // Second-phase init of the implementation // This can only be done after the CustomActor connection has been made... @@ -176,29 +166,29 @@ Toolkit::FlexContainer FlexContainer::New() FlexContainer::~FlexContainer() { - YGNodeFree( mRootNode.node ); + YGNodeFree(mRootNode.node); - for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) + for(unsigned int i = 0; i < mChildrenNodes.size(); i++) { - YGNodeFree( mChildrenNodes[i].node ); + YGNodeFree(mChildrenNodes[i].node); } mChildrenNodes.clear(); } -void FlexContainer::SetContentDirection( Toolkit::FlexContainer::ContentDirection contentDirection) +void FlexContainer::SetContentDirection(Toolkit::FlexContainer::ContentDirection contentDirection) { - if( mContentDirection != contentDirection ) + if(mContentDirection != contentDirection) { Dali::CustomActor ownerActor(GetOwner()); - if( Toolkit::FlexContainer::INHERIT != contentDirection ) + if(Toolkit::FlexContainer::INHERIT != contentDirection) { mContentDirection = contentDirection; - ownerActor.SetProperty( Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION, false ); + ownerActor.SetProperty(Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION, false); - if( Toolkit::FlexContainer::LTR == contentDirection ) + if(Toolkit::FlexContainer::LTR == contentDirection) { ownerActor.SetProperty(Dali::Actor::Property::LAYOUT_DIRECTION, Dali::LayoutDirection::LEFT_TO_RIGHT); } @@ -209,11 +199,11 @@ void FlexContainer::SetContentDirection( Toolkit::FlexContainer::ContentDirectio } else { - ownerActor.SetProperty( Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION, true ); + ownerActor.SetProperty(Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION, true); - Dali::LayoutDirection::Type layoutDirection = static_cast( ownerActor.GetParent().GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get() ); + Dali::LayoutDirection::Type layoutDirection = static_cast(ownerActor.GetParent().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); - if( Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection ) + if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection) { mContentDirection = Toolkit::FlexContainer::RTL; } @@ -232,12 +222,12 @@ Toolkit::FlexContainer::ContentDirection FlexContainer::GetContentDirection() return mContentDirection; } -void FlexContainer::SetFlexDirection( Toolkit::FlexContainer::FlexDirection flexDirection ) +void FlexContainer::SetFlexDirection(Toolkit::FlexContainer::FlexDirection flexDirection) { - if( mFlexDirection != flexDirection ) + if(mFlexDirection != flexDirection) { mFlexDirection = flexDirection; - YGNodeStyleSetFlexDirection( mRootNode.node, static_cast( flexDirection ) ); + YGNodeStyleSetFlexDirection(mRootNode.node, static_cast(flexDirection)); RelayoutRequest(); } @@ -248,12 +238,12 @@ Toolkit::FlexContainer::FlexDirection FlexContainer::GetFlexDirection() return mFlexDirection; } -void FlexContainer::SetFlexWrap( Toolkit::FlexContainer::WrapType flexWrap ) +void FlexContainer::SetFlexWrap(Toolkit::FlexContainer::WrapType flexWrap) { - if( mFlexWrap != flexWrap ) + if(mFlexWrap != flexWrap) { mFlexWrap = flexWrap; - YGNodeStyleSetFlexWrap( mRootNode.node, static_cast( flexWrap ) ); + YGNodeStyleSetFlexWrap(mRootNode.node, static_cast(flexWrap)); RelayoutRequest(); } @@ -264,12 +254,12 @@ Toolkit::FlexContainer::WrapType FlexContainer::GetFlexWrap() return mFlexWrap; } -void FlexContainer::SetJustifyContent( Toolkit::FlexContainer::Justification justifyContent ) +void FlexContainer::SetJustifyContent(Toolkit::FlexContainer::Justification justifyContent) { - if( mJustifyContent != justifyContent ) + if(mJustifyContent != justifyContent) { mJustifyContent = justifyContent; - YGNodeStyleSetJustifyContent( mRootNode.node, static_cast( justifyContent ) ); + YGNodeStyleSetJustifyContent(mRootNode.node, static_cast(justifyContent)); RelayoutRequest(); } @@ -280,12 +270,12 @@ Toolkit::FlexContainer::Justification FlexContainer::GetJustifyContent() return mJustifyContent; } -void FlexContainer::SetAlignItems( Toolkit::FlexContainer::Alignment alignItems ) +void FlexContainer::SetAlignItems(Toolkit::FlexContainer::Alignment alignItems) { - if( mAlignItems != alignItems ) + if(mAlignItems != alignItems) { mAlignItems = alignItems; - YGNodeStyleSetAlignItems( mRootNode.node, static_cast( alignItems ) ); + YGNodeStyleSetAlignItems(mRootNode.node, static_cast(alignItems)); RelayoutRequest(); } @@ -296,12 +286,12 @@ Toolkit::FlexContainer::Alignment FlexContainer::GetAlignItems() return mAlignItems; } -void FlexContainer::SetAlignContent( Toolkit::FlexContainer::Alignment alignContent ) +void FlexContainer::SetAlignContent(Toolkit::FlexContainer::Alignment alignContent) { - if( mAlignContent != alignContent ) + if(mAlignContent != alignContent) { mAlignContent = alignContent; - YGNodeStyleSetAlignContent( mRootNode.node, static_cast( alignContent ) ); + YGNodeStyleSetAlignContent(mRootNode.node, static_cast(alignContent)); RelayoutRequest(); } @@ -312,27 +302,27 @@ Toolkit::FlexContainer::Alignment FlexContainer::GetAlignContent() return mAlignContent; } -void FlexContainer::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) +void FlexContainer::SetProperty(BaseObject* object, Property::Index index, const Property::Value& value) { - Toolkit::FlexContainer flexContainer = Toolkit::FlexContainer::DownCast( Dali::BaseHandle( object ) ); + Toolkit::FlexContainer flexContainer = Toolkit::FlexContainer::DownCast(Dali::BaseHandle(object)); - if( flexContainer ) + if(flexContainer) { - FlexContainer& flexContainerImpl( GetImpl( flexContainer ) ); - switch( index ) + FlexContainer& flexContainerImpl(GetImpl(flexContainer)); + switch(index) { case Toolkit::FlexContainer::Property::CONTENT_DIRECTION: { - Toolkit::FlexContainer::ContentDirection contentDirection( Toolkit::FlexContainer::INHERIT ); + Toolkit::FlexContainer::ContentDirection contentDirection(Toolkit::FlexContainer::INHERIT); - if( value.GetType() == Property::INTEGER ) + if(value.GetType() == Property::INTEGER) { - flexContainerImpl.SetContentDirection( static_cast( value.Get< int >() ) ); + flexContainerImpl.SetContentDirection(static_cast(value.Get())); } - else if( Scripting::GetEnumeration< Toolkit::FlexContainer::ContentDirection >( value.Get< std::string >().c_str(), - CONTENT_DIRECTION_STRING_TABLE, - CONTENT_DIRECTION_STRING_TABLE_COUNT, - contentDirection ) ) + else if(Scripting::GetEnumeration(value.Get().c_str(), + CONTENT_DIRECTION_STRING_TABLE, + CONTENT_DIRECTION_STRING_TABLE_COUNT, + contentDirection)) { flexContainerImpl.SetContentDirection(contentDirection); } @@ -340,16 +330,16 @@ void FlexContainer::SetProperty( BaseObject* object, Property::Index index, cons } case Toolkit::FlexContainer::Property::FLEX_DIRECTION: { - Toolkit::FlexContainer::FlexDirection flexDirection( Toolkit::FlexContainer::COLUMN ); + Toolkit::FlexContainer::FlexDirection flexDirection(Toolkit::FlexContainer::COLUMN); - if( value.GetType() == Property::INTEGER ) + if(value.GetType() == Property::INTEGER) { - flexContainerImpl.SetFlexDirection( static_cast( value.Get< int >() ) ); + flexContainerImpl.SetFlexDirection(static_cast(value.Get())); } - else if( Scripting::GetEnumeration< Toolkit::FlexContainer::FlexDirection >( value.Get< std::string >().c_str(), - FLEX_DIRECTION_STRING_TABLE, - FLEX_DIRECTION_STRING_TABLE_COUNT, - flexDirection ) ) + else if(Scripting::GetEnumeration(value.Get().c_str(), + FLEX_DIRECTION_STRING_TABLE, + FLEX_DIRECTION_STRING_TABLE_COUNT, + flexDirection)) { flexContainerImpl.SetFlexDirection(flexDirection); } @@ -357,16 +347,16 @@ void FlexContainer::SetProperty( BaseObject* object, Property::Index index, cons } case Toolkit::FlexContainer::Property::FLEX_WRAP: { - Toolkit::FlexContainer::WrapType flexWrap( Toolkit::FlexContainer::NO_WRAP ); + Toolkit::FlexContainer::WrapType flexWrap(Toolkit::FlexContainer::NO_WRAP); - if( value.GetType() == Property::INTEGER ) + if(value.GetType() == Property::INTEGER) { - flexContainerImpl.SetFlexWrap( static_cast( value.Get< int >() ) ); + flexContainerImpl.SetFlexWrap(static_cast(value.Get())); } - else if( Scripting::GetEnumeration< Toolkit::FlexContainer::WrapType >( value.Get< std::string >().c_str(), - FLEX_WRAP_STRING_TABLE, - FLEX_WRAP_STRING_TABLE_COUNT, - flexWrap ) ) + else if(Scripting::GetEnumeration(value.Get().c_str(), + FLEX_WRAP_STRING_TABLE, + FLEX_WRAP_STRING_TABLE_COUNT, + flexWrap)) { flexContainerImpl.SetFlexWrap(flexWrap); } @@ -374,16 +364,16 @@ void FlexContainer::SetProperty( BaseObject* object, Property::Index index, cons } case Toolkit::FlexContainer::Property::JUSTIFY_CONTENT: { - Toolkit::FlexContainer::Justification justifyContent( Toolkit::FlexContainer::JUSTIFY_FLEX_START ); + Toolkit::FlexContainer::Justification justifyContent(Toolkit::FlexContainer::JUSTIFY_FLEX_START); - if( value.GetType() == Property::INTEGER ) + if(value.GetType() == Property::INTEGER) { - flexContainerImpl.SetJustifyContent( static_cast( value.Get< int >() ) ); + flexContainerImpl.SetJustifyContent(static_cast(value.Get())); } - else if( Scripting::GetEnumeration< Toolkit::FlexContainer::Justification >( value.Get< std::string >().c_str(), - JUSTIFY_CONTENT_STRING_TABLE, - JUSTIFY_CONTENT_STRING_TABLE_COUNT, - justifyContent ) ) + else if(Scripting::GetEnumeration(value.Get().c_str(), + JUSTIFY_CONTENT_STRING_TABLE, + JUSTIFY_CONTENT_STRING_TABLE_COUNT, + justifyContent)) { flexContainerImpl.SetJustifyContent(justifyContent); } @@ -391,16 +381,16 @@ void FlexContainer::SetProperty( BaseObject* object, Property::Index index, cons } case Toolkit::FlexContainer::Property::ALIGN_ITEMS: { - Toolkit::FlexContainer::Alignment alignItems( Toolkit::FlexContainer::ALIGN_STRETCH ); + Toolkit::FlexContainer::Alignment alignItems(Toolkit::FlexContainer::ALIGN_STRETCH); - if( value.GetType() == Property::INTEGER ) + if(value.GetType() == Property::INTEGER) { - flexContainerImpl.SetAlignItems( static_cast( value.Get< int >() ) ); + flexContainerImpl.SetAlignItems(static_cast(value.Get())); } - else if( Scripting::GetEnumeration< Toolkit::FlexContainer::Alignment >( value.Get< std::string >().c_str(), - ALIGN_ITEMS_STRING_TABLE, - ALIGN_ITEMS_STRING_TABLE_COUNT, - alignItems ) ) + else if(Scripting::GetEnumeration(value.Get().c_str(), + ALIGN_ITEMS_STRING_TABLE, + ALIGN_ITEMS_STRING_TABLE_COUNT, + alignItems)) { flexContainerImpl.SetAlignItems(alignItems); } @@ -408,16 +398,16 @@ void FlexContainer::SetProperty( BaseObject* object, Property::Index index, cons } case Toolkit::FlexContainer::Property::ALIGN_CONTENT: { - Toolkit::FlexContainer::Alignment alignContent( Toolkit::FlexContainer::ALIGN_FLEX_START ); + Toolkit::FlexContainer::Alignment alignContent(Toolkit::FlexContainer::ALIGN_FLEX_START); - if( value.GetType() == Property::INTEGER ) + if(value.GetType() == Property::INTEGER) { - flexContainerImpl.SetAlignContent( static_cast( value.Get< int >() ) ); + flexContainerImpl.SetAlignContent(static_cast(value.Get())); } - else if( Scripting::GetEnumeration< Toolkit::FlexContainer::Alignment >( value.Get< std::string >().c_str(), - ALIGN_CONTENT_STRING_TABLE, - ALIGN_CONTENT_STRING_TABLE_COUNT, - alignContent ) ) + else if(Scripting::GetEnumeration(value.Get().c_str(), + ALIGN_CONTENT_STRING_TABLE, + ALIGN_CONTENT_STRING_TABLE_COUNT, + alignContent)) { flexContainerImpl.SetAlignContent(alignContent); } @@ -427,16 +417,16 @@ void FlexContainer::SetProperty( BaseObject* object, Property::Index index, cons } } -Property::Value FlexContainer::GetProperty( BaseObject* object, Property::Index index ) +Property::Value FlexContainer::GetProperty(BaseObject* object, Property::Index index) { Property::Value value; - Toolkit::FlexContainer flexContainer = Toolkit::FlexContainer::DownCast( Dali::BaseHandle( object ) ); + Toolkit::FlexContainer flexContainer = Toolkit::FlexContainer::DownCast(Dali::BaseHandle(object)); - if( flexContainer ) + if(flexContainer) { - FlexContainer& flexContainerImpl( GetImpl( flexContainer ) ); - switch( index ) + FlexContainer& flexContainerImpl(GetImpl(flexContainer)); + switch(index) { case Toolkit::FlexContainer::Property::CONTENT_DIRECTION: { @@ -474,29 +464,29 @@ Property::Value FlexContainer::GetProperty( BaseObject* object, Property::Index return value; } -void FlexContainer::OnChildAdd( Actor& child ) +void FlexContainer::OnChildAdd(Actor& child) { // Create a new node for the child. FlexItemNode childNode; childNode.actor = child; - childNode.node = YGNodeNew(); + childNode.node = YGNodeNew(); - mChildrenNodes.push_back( childNode ); - YGNodeInsertChild( mRootNode.node, childNode.node, mChildrenNodes.size() - 1 ); + mChildrenNodes.push_back(childNode); + YGNodeInsertChild(mRootNode.node, childNode.node, mChildrenNodes.size() - 1); - Control::OnChildAdd( child ); + Control::OnChildAdd(child); } -void FlexContainer::OnChildRemove( Actor& child ) +void FlexContainer::OnChildRemove(Actor& child) { - for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) + for(unsigned int i = 0; i < mChildrenNodes.size(); i++) { - if( mChildrenNodes[i].actor.GetHandle() == child ) + if(mChildrenNodes[i].actor.GetHandle() == child) { - YGNodeRemoveChild( mRootNode.node, mChildrenNodes[i].node ); - YGNodeFree( mChildrenNodes[i].node ); + YGNodeRemoveChild(mRootNode.node, mChildrenNodes[i].node); + YGNodeFree(mChildrenNodes[i].node); - mChildrenNodes.erase( mChildrenNodes.begin() + i ); + mChildrenNodes.erase(mChildrenNodes.begin() + i); // Relayout the container only if instances were found RelayoutRequest(); @@ -504,33 +494,33 @@ void FlexContainer::OnChildRemove( Actor& child ) } } - Control::OnChildRemove( child ); + Control::OnChildRemove(child); } -void FlexContainer::OnRelayout( const Vector2& size, RelayoutContainer& container ) +void FlexContainer::OnRelayout(const Vector2& size, RelayoutContainer& container) { - for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) + for(unsigned int i = 0; i < mChildrenNodes.size(); i++) { Actor child = mChildrenNodes[i].actor.GetHandle(); - if( child ) + if(child) { // Anchor actor to top left of the container - if( child.GetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT ).Get< bool >() ) + if(child.GetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT).Get()) { - child.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); } - child.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); - float negotiatedWidth = child.GetRelayoutSize(Dimension::WIDTH); + float negotiatedWidth = child.GetRelayoutSize(Dimension::WIDTH); float negotiatedHeight = child.GetRelayoutSize(Dimension::HEIGHT); - if( negotiatedWidth > 0 ) + if(negotiatedWidth > 0) { - YGNodeStyleSetWidth( mChildrenNodes[i].node, negotiatedWidth ); + YGNodeStyleSetWidth(mChildrenNodes[i].node, negotiatedWidth); } - if( negotiatedHeight > 0 ) + if(negotiatedHeight > 0) { - YGNodeStyleSetHeight( mChildrenNodes[i].node, negotiatedHeight ); + YGNodeStyleSetHeight(mChildrenNodes[i].node, negotiatedHeight); } } } @@ -538,57 +528,57 @@ void FlexContainer::OnRelayout( const Vector2& size, RelayoutContainer& containe // Relayout the container RelayoutChildren(); #if defined(FLEX_CONTAINER_DEBUG) - PrintNodes( mChildrenNodes ); + PrintNodes(mChildrenNodes); #endif - for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) + for(unsigned int i = 0; i < mChildrenNodes.size(); i++) { Actor child = mChildrenNodes[i].actor.GetHandle(); - if( child ) + if(child) { - if( child.GetPropertyType( Toolkit::FlexContainer::ChildProperty::FLEX ) != Property::NONE ) + if(child.GetPropertyType(Toolkit::FlexContainer::ChildProperty::FLEX) != Property::NONE) { // Only Set to USE_ASSIGNED_SIZE if the child actor is flexible. - if( child.GetResizePolicy( Dimension::WIDTH ) != ResizePolicy::USE_ASSIGNED_SIZE ) + if(child.GetResizePolicy(Dimension::WIDTH) != ResizePolicy::USE_ASSIGNED_SIZE) { - child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::WIDTH ); + child.SetResizePolicy(ResizePolicy::USE_ASSIGNED_SIZE, Dimension::WIDTH); } - if( child.GetResizePolicy( Dimension::HEIGHT ) != ResizePolicy::USE_ASSIGNED_SIZE ) + if(child.GetResizePolicy(Dimension::HEIGHT) != ResizePolicy::USE_ASSIGNED_SIZE) { - child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::HEIGHT ); + child.SetResizePolicy(ResizePolicy::USE_ASSIGNED_SIZE, Dimension::HEIGHT); } } - container.Add( child, Vector2(YGNodeLayoutGetWidth(mChildrenNodes[i].node), YGNodeLayoutGetHeight(mChildrenNodes[i].node) ) ); + container.Add(child, Vector2(YGNodeLayoutGetWidth(mChildrenNodes[i].node), YGNodeLayoutGetHeight(mChildrenNodes[i].node))); } } } -bool FlexContainer::RelayoutDependentOnChildren( Dimension::Type dimension ) +bool FlexContainer::RelayoutDependentOnChildren(Dimension::Type dimension) { return true; } -void FlexContainer::OnSizeSet( const Vector3& size ) +void FlexContainer::OnSizeSet(const Vector3& size) { - if( mRootNode.node ) + if(mRootNode.node) { Actor self = Self(); - YGNodeStyleSetWidth( mRootNode.node, size.x ); - YGNodeStyleSetHeight( mRootNode.node, size.y ); + YGNodeStyleSetWidth(mRootNode.node, size.x); + YGNodeStyleSetHeight(mRootNode.node, size.y); RelayoutRequest(); } - Control::OnSizeSet( size ); + Control::OnSizeSet(size); } -void FlexContainer::OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDirection::Type type ) +void FlexContainer::OnLayoutDirectionChanged(Dali::Actor actor, Dali::LayoutDirection::Type type) { - Toolkit::FlexContainer flexContainer = Toolkit::FlexContainer::DownCast(actor); + Toolkit::FlexContainer flexContainer = Toolkit::FlexContainer::DownCast(actor); Toolkit::FlexContainer::ContentDirection direction; - if( type == Dali::LayoutDirection::RIGHT_TO_LEFT ) + if(type == Dali::LayoutDirection::RIGHT_TO_LEFT) { direction = Toolkit::FlexContainer::RTL; } @@ -597,9 +587,9 @@ void FlexContainer::OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDir direction = Toolkit::FlexContainer::LTR; } - Toolkit::Internal::FlexContainer &flexContainerImpl = GetImpl( flexContainer ); + Toolkit::Internal::FlexContainer& flexContainerImpl = GetImpl(flexContainer); - if( flexContainerImpl.mContentDirection != direction ) + if(flexContainerImpl.mContentDirection != direction) { Dali::CustomActor ownerActor(flexContainerImpl.GetOwner()); flexContainerImpl.mContentDirection = direction; @@ -610,86 +600,86 @@ void FlexContainer::OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDir void FlexContainer::ComputeLayout() { - if( mRootNode.node ) + if(mRootNode.node) { - for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) + for(unsigned int i = 0; i < mChildrenNodes.size(); i++) { - YGNodeRef childNode = mChildrenNodes[i].node; - Actor childActor = mChildrenNodes[i].actor.GetHandle(); + YGNodeRef childNode = mChildrenNodes[i].node; + Actor childActor = mChildrenNodes[i].actor.GetHandle(); // Intialize the style of the child. - YGNodeStyleSetMinWidth( childNode, childActor.GetProperty< Vector2 >( Actor::Property::MINIMUM_SIZE ).x ); - YGNodeStyleSetMinHeight( childNode, childActor.GetProperty< Vector2 >( Actor::Property::MINIMUM_SIZE ).y ); - YGNodeStyleSetMaxWidth( childNode, childActor.GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE ).x ); - YGNodeStyleSetMaxHeight( childNode, childActor.GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE ).y ); + YGNodeStyleSetMinWidth(childNode, childActor.GetProperty(Actor::Property::MINIMUM_SIZE).x); + YGNodeStyleSetMinHeight(childNode, childActor.GetProperty(Actor::Property::MINIMUM_SIZE).y); + YGNodeStyleSetMaxWidth(childNode, childActor.GetProperty(Actor::Property::MAXIMUM_SIZE).x); + YGNodeStyleSetMaxHeight(childNode, childActor.GetProperty(Actor::Property::MAXIMUM_SIZE).y); // Check child properties on the child for how to layout it. // These properties should be dynamically registered to the child which // would be added to FlexContainer. - if( childActor.GetPropertyType( Toolkit::FlexContainer::ChildProperty::FLEX ) != Property::NONE ) + if(childActor.GetPropertyType(Toolkit::FlexContainer::ChildProperty::FLEX) != Property::NONE) { - YGNodeStyleSetFlex( childNode, childActor.GetProperty( Toolkit::FlexContainer::ChildProperty::FLEX ).Get() ); + YGNodeStyleSetFlex(childNode, childActor.GetProperty(Toolkit::FlexContainer::ChildProperty::FLEX).Get()); } - Toolkit::FlexContainer::Alignment alignSelf( Toolkit::FlexContainer::ALIGN_AUTO ); - if( childActor.GetPropertyType( Toolkit::FlexContainer::ChildProperty::ALIGN_SELF ) != Property::NONE ) + Toolkit::FlexContainer::Alignment alignSelf(Toolkit::FlexContainer::ALIGN_AUTO); + if(childActor.GetPropertyType(Toolkit::FlexContainer::ChildProperty::ALIGN_SELF) != Property::NONE) { - Property::Value alignSelfPropertyValue = childActor.GetProperty( Toolkit::FlexContainer::ChildProperty::ALIGN_SELF ); - if( alignSelfPropertyValue.GetType() == Property::INTEGER ) + Property::Value alignSelfPropertyValue = childActor.GetProperty(Toolkit::FlexContainer::ChildProperty::ALIGN_SELF); + if(alignSelfPropertyValue.GetType() == Property::INTEGER) { - alignSelf = static_cast( alignSelfPropertyValue.Get< int >() ); + alignSelf = static_cast(alignSelfPropertyValue.Get()); } - else if( alignSelfPropertyValue.GetType() == Property::STRING ) + else if(alignSelfPropertyValue.GetType() == Property::STRING) { std::string value = alignSelfPropertyValue.Get(); - Scripting::GetEnumeration< Toolkit::FlexContainer::Alignment >( value.c_str(), - ALIGN_SELF_STRING_TABLE, - ALIGN_SELF_STRING_TABLE_COUNT, - alignSelf ); + Scripting::GetEnumeration(value.c_str(), + ALIGN_SELF_STRING_TABLE, + ALIGN_SELF_STRING_TABLE_COUNT, + alignSelf); } - YGNodeStyleSetAlignSelf( childNode, static_cast(alignSelf) ); + YGNodeStyleSetAlignSelf(childNode, static_cast(alignSelf)); } - if( childActor.GetPropertyType( Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN ) != Property::NONE ) + if(childActor.GetPropertyType(Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN) != Property::NONE) { - Vector4 flexMargin = childActor.GetProperty( Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN ).Get(); - YGNodeStyleSetMargin( childNode, YGEdgeLeft, flexMargin.x ); - YGNodeStyleSetMargin( childNode, YGEdgeTop, flexMargin.y ); - YGNodeStyleSetMargin( childNode, YGEdgeRight, flexMargin.z ); - YGNodeStyleSetMargin( childNode, YGEdgeBottom, flexMargin.w ); + Vector4 flexMargin = childActor.GetProperty(Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN).Get(); + YGNodeStyleSetMargin(childNode, YGEdgeLeft, flexMargin.x); + YGNodeStyleSetMargin(childNode, YGEdgeTop, flexMargin.y); + YGNodeStyleSetMargin(childNode, YGEdgeRight, flexMargin.z); + YGNodeStyleSetMargin(childNode, YGEdgeBottom, flexMargin.w); } } // Calculate the layout YGDirection nodeLayoutDirection = YGDirectionInherit; - switch( mContentDirection ) - { - case Dali::Toolkit::FlexContainer::LTR: + switch(mContentDirection) { - nodeLayoutDirection = YGDirectionLTR; - break; - } + case Dali::Toolkit::FlexContainer::LTR: + { + nodeLayoutDirection = YGDirectionLTR; + break; + } - case Dali::Toolkit::FlexContainer::RTL: - { - nodeLayoutDirection = YGDirectionRTL; - break; - } + case Dali::Toolkit::FlexContainer::RTL: + { + nodeLayoutDirection = YGDirectionRTL; + break; + } - case Dali::Toolkit::FlexContainer::INHERIT: - { - nodeLayoutDirection = YGDirectionInherit; - break; - } + case Dali::Toolkit::FlexContainer::INHERIT: + { + nodeLayoutDirection = YGDirectionInherit; + break; + } } #if defined(FLEX_CONTAINER_DEBUG) - YGNodePrint( mRootNode.node, (YGPrintOptions)( YGPrintOptionsLayout | YGPrintOptionsStyle | YGPrintOptionsChildren ) ); + YGNodePrint(mRootNode.node, (YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsStyle | YGPrintOptionsChildren)); #endif - YGNodeCalculateLayout( mRootNode.node, Self().GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE ).x, Self().GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE ).y, nodeLayoutDirection ); + YGNodeCalculateLayout(mRootNode.node, Self().GetProperty(Actor::Property::MAXIMUM_SIZE).x, Self().GetProperty(Actor::Property::MAXIMUM_SIZE).y, nodeLayoutDirection); #if defined(FLEX_CONTAINER_DEBUG) - YGNodePrint( mRootNode.node, (YGPrintOptions)( YGPrintOptionsLayout | YGPrintOptionsStyle | YGPrintOptionsChildren ) ); + YGNodePrint(mRootNode.node, (YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsStyle | YGPrintOptionsChildren)); #endif } } @@ -699,13 +689,13 @@ void FlexContainer::RelayoutChildren() ComputeLayout(); // Set size and position of children according to the layout calculation - for( unsigned int i = 0; i < mChildrenNodes.size(); i++ ) + for(unsigned int i = 0; i < mChildrenNodes.size(); i++) { Dali::Actor child = mChildrenNodes[i].actor.GetHandle(); - if( child ) + if(child) { - child.SetProperty( Actor::Property::POSITION_X, YGNodeLayoutGetLeft( mChildrenNodes[i].node ) ); - child.SetProperty( Actor::Property::POSITION_Y, YGNodeLayoutGetTop( mChildrenNodes[i].node ) ); + child.SetProperty(Actor::Property::POSITION_X, YGNodeLayoutGetLeft(mChildrenNodes[i].node)); + child.SetProperty(Actor::Property::POSITION_Y, YGNodeLayoutGetTop(mChildrenNodes[i].node)); } } } @@ -715,9 +705,9 @@ Actor FlexContainer::GetNextKeyboardFocusableActor(Actor currentFocusedActor, To Actor nextFocusableActor; // First check whether there is any items in the container - if( mChildrenNodes.size() > 0 ) + if(mChildrenNodes.size() > 0) { - if ( !currentFocusedActor || currentFocusedActor == Self() ) + if(!currentFocusedActor || currentFocusedActor == Self()) { // Nothing is currently focused, so the first child in the container should be focused. nextFocusableActor = mChildrenNodes[0].actor.GetHandle(); @@ -726,20 +716,20 @@ Actor FlexContainer::GetNextKeyboardFocusableActor(Actor currentFocusedActor, To { // Check whether the current focused actor is within flex container int currentFocusedActorIndex = -1; - for( unsigned int index = 0; index < mChildrenNodes.size(); index++ ) + for(unsigned int index = 0; index < mChildrenNodes.size(); index++) { - if( currentFocusedActor == mChildrenNodes[index].actor.GetHandle() ) + if(currentFocusedActor == mChildrenNodes[index].actor.GetHandle()) { currentFocusedActorIndex = index; break; } } - if( currentFocusedActorIndex > -1 ) + if(currentFocusedActorIndex > -1) { int previousCheckedActorIndex = -1; - int nextFocusedActorIndex = currentFocusedActorIndex; - switch ( direction ) + int nextFocusedActorIndex = currentFocusedActorIndex; + switch(direction) { case Toolkit::Control::KeyboardFocus::LEFT: case Toolkit::Control::KeyboardFocus::UP: @@ -748,11 +738,11 @@ Actor FlexContainer::GetNextKeyboardFocusableActor(Actor currentFocusedActor, To do { nextFocusedActorIndex--; - if( nextFocusedActorIndex < 0 ) + if(nextFocusedActorIndex < 0) { nextFocusedActorIndex = loopEnabled ? mChildrenNodes.size() - 1 : 0; } - if( nextFocusedActorIndex != previousCheckedActorIndex && nextFocusedActorIndex != currentFocusedActorIndex ) + if(nextFocusedActorIndex != previousCheckedActorIndex && nextFocusedActorIndex != currentFocusedActorIndex) { previousCheckedActorIndex = nextFocusedActorIndex; } @@ -760,7 +750,7 @@ Actor FlexContainer::GetNextKeyboardFocusableActor(Actor currentFocusedActor, To { break; } - } while ( !mChildrenNodes[nextFocusedActorIndex].actor.GetHandle().GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) ); + } while(!mChildrenNodes[nextFocusedActorIndex].actor.GetHandle().GetProperty(Actor::Property::KEYBOARD_FOCUSABLE)); break; } case Toolkit::Control::KeyboardFocus::RIGHT: @@ -770,11 +760,11 @@ Actor FlexContainer::GetNextKeyboardFocusableActor(Actor currentFocusedActor, To do { nextFocusedActorIndex++; - if( nextFocusedActorIndex > static_cast(mChildrenNodes.size() - 1) ) + if(nextFocusedActorIndex > static_cast(mChildrenNodes.size() - 1)) { nextFocusedActorIndex = loopEnabled ? 0 : mChildrenNodes.size() - 1; } - if( nextFocusedActorIndex != previousCheckedActorIndex && nextFocusedActorIndex != currentFocusedActorIndex ) + if(nextFocusedActorIndex != previousCheckedActorIndex && nextFocusedActorIndex != currentFocusedActorIndex) { previousCheckedActorIndex = nextFocusedActorIndex; } @@ -782,7 +772,7 @@ Actor FlexContainer::GetNextKeyboardFocusableActor(Actor currentFocusedActor, To { break; } - } while ( !mChildrenNodes[nextFocusedActorIndex].actor.GetHandle().GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) ); + } while(!mChildrenNodes[nextFocusedActorIndex].actor.GetHandle().GetProperty(Actor::Property::KEYBOARD_FOCUSABLE)); break; } default: @@ -791,7 +781,7 @@ Actor FlexContainer::GetNextKeyboardFocusableActor(Actor currentFocusedActor, To } } - if( nextFocusedActorIndex != currentFocusedActorIndex ) + if(nextFocusedActorIndex != currentFocusedActorIndex) { nextFocusableActor = mChildrenNodes[nextFocusedActorIndex].actor.GetHandle(); } @@ -813,37 +803,42 @@ Actor FlexContainer::GetNextKeyboardFocusableActor(Actor currentFocusedActor, To } FlexContainer::FlexContainer() -: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), - mContentDirection( Toolkit::FlexContainer::INHERIT ), - mFlexDirection( Toolkit::FlexContainer::COLUMN ), - mFlexWrap( Toolkit::FlexContainer::NO_WRAP ), - mJustifyContent( Toolkit::FlexContainer::JUSTIFY_FLEX_START ), - mAlignItems( Toolkit::FlexContainer::ALIGN_STRETCH ), - mAlignContent( Toolkit::FlexContainer::ALIGN_FLEX_START ) -{ - SetKeyboardNavigationSupport( true ); +: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)), + mContentDirection(Toolkit::FlexContainer::INHERIT), + mFlexDirection(Toolkit::FlexContainer::COLUMN), + mFlexWrap(Toolkit::FlexContainer::NO_WRAP), + mJustifyContent(Toolkit::FlexContainer::JUSTIFY_FLEX_START), + mAlignItems(Toolkit::FlexContainer::ALIGN_STRETCH), + mAlignContent(Toolkit::FlexContainer::ALIGN_FLEX_START) +{ + SetKeyboardNavigationSupport(true); } void FlexContainer::OnInitialize() { // Initialize the node for the flex container itself Dali::Actor self = Self(); - self.LayoutDirectionChangedSignal().Connect( this, &FlexContainer::OnLayoutDirectionChanged ); + self.LayoutDirectionChangedSignal().Connect(this, &FlexContainer::OnLayoutDirectionChanged); mRootNode.actor = self; - mRootNode.node = YGNodeNew(); - YGNodeSetContext( mRootNode.node, &mChildrenNodes ); + mRootNode.node = YGNodeNew(); + YGNodeSetContext(mRootNode.node, &mChildrenNodes); // Set default style - YGNodeStyleSetFlexDirection( mRootNode.node, static_cast( mFlexDirection ) ); - YGNodeStyleSetFlexWrap( mRootNode.node, static_cast( mFlexWrap ) ); - YGNodeStyleSetJustifyContent( mRootNode.node, static_cast( mJustifyContent ) ); - YGNodeStyleSetAlignItems( mRootNode.node, static_cast( mAlignItems ) ); - YGNodeStyleSetAlignContent( mRootNode.node, static_cast( mAlignContent ) ); + YGNodeStyleSetFlexDirection(mRootNode.node, static_cast(mFlexDirection)); + YGNodeStyleSetFlexWrap(mRootNode.node, static_cast(mFlexWrap)); + YGNodeStyleSetJustifyContent(mRootNode.node, static_cast(mJustifyContent)); + YGNodeStyleSetAlignItems(mRootNode.node, static_cast(mAlignItems)); + YGNodeStyleSetAlignContent(mRootNode.node, static_cast(mAlignContent)); // Make self as keyboard focusable and focus group - self.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true ); - SetAsKeyboardFocusGroup( true ); + self.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true); + SetAsKeyboardFocusGroup(true); + + DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) { + return std::unique_ptr( + new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER)); + }); } } // namespace Internal