X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fbuilder%2Fbuilder-actor.cpp;h=d8271e401c4f5c1d0b03faea9fb932fd281d7789;hp=a57129fcc4f9561387ea31e1656f5725f71498c5;hb=57869973578f6a0b0f836d396c7232ddb8302c6b;hpb=e2e00e5c207b546067d57a0a747f4803a18c27bd diff --git a/dali-toolkit/internal/builder/builder-actor.cpp b/dali-toolkit/internal/builder/builder-actor.cpp index a57129f..d8271e4 100644 --- a/dali-toolkit/internal/builder/builder-actor.cpp +++ b/dali-toolkit/internal/builder/builder-actor.cpp @@ -1,18 +1,19 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // EXTERNAL INCLUDES #include @@ -20,7 +21,8 @@ #include // INTERNAL INCLUDES -#include +#include +#include namespace Dali { @@ -32,12 +34,13 @@ namespace Internal { using namespace Dali::Scripting; +extern bool SetPropertyFromNode( const TreeNode& node, Property::Value& value, const Replacement& constant ); /* * Handles special case actor configuration (anything thats not already a property) * */ -Actor SetupActor( const TreeNode& child, Actor& actor ) +Actor SetupActor( const TreeNode& child, Actor& actor, const Replacement& constant ) { DALI_ASSERT_ALWAYS( actor && "Empty actor handle" ); @@ -68,6 +71,32 @@ Actor SetupActor( const TreeNode& child, Actor& actor ) } } + // Add custom properties + if( OptionalChild customPropertiesChild = IsChild(child, "custom-properties") ) + { + const TreeNode& customPropertiesNode = *customPropertiesChild; + const TreeConstIter endIter = customPropertiesNode.CEnd(); + for( TreeConstIter iter = customPropertiesNode.CBegin(); endIter != iter; ++iter ) + { + const TreeNode::KeyNodePair& keyChild = *iter; + std::string key( keyChild.first ); + + Property::Index index = actor.GetPropertyIndex( key ); + Property::Value value; + if( SetPropertyFromNode( keyChild.second, value, constant )) + { + if( Property::INVALID_INDEX == index ) + { + actor.RegisterProperty( key, value ); + } + else + { + actor.SetProperty( index, value ); + } + } + } + } + return actor; }