X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fbuilder%2Fbuilder-impl.cpp;h=4a23ed1fe74dd10f867fa80b0537252da0472867;hp=48d2e2ba5cd92a2f065ab5e06099a412dee1b04a;hb=e92dc54dd0580f27586bcaf04bf9fa2a6ae798dc;hpb=1e86d6f1a754a11410f1d5b89a4520757cb53ff5 diff --git a/dali-toolkit/internal/builder/builder-impl.cpp b/dali-toolkit/internal/builder/builder-impl.cpp index 48d2e2b..4a23ed1 100644 --- a/dali-toolkit/internal/builder/builder-impl.cpp +++ b/dali-toolkit/internal/builder/builder-impl.cpp @@ -179,9 +179,10 @@ void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::U } else { + // load configuration map + LoadConfiguration( *parser.GetRoot(), mConfigurationMap ); // load constant map (allows the user to override the constants in the json after loading) LoadConstants( *parser.GetRoot(), mReplacementMap ); - // merge includes if( OptionalChild includes = IsChild(*parser.GetRoot(), KEYNAME_INCLUDES) ) { @@ -228,6 +229,11 @@ void Builder::AddConstant( const std::string& key, const Property::Value& value mReplacementMap[key] = value; } +const Property::Map& Builder::GetConfigurations() const +{ + return mConfigurationMap; +} + const Property::Map& Builder::GetConstants() const { return mReplacementMap; @@ -773,6 +779,25 @@ Builder::~Builder() { } +void Builder::LoadConfiguration( const TreeNode& root, Property::Map& intoMap ) +{ + Replacement replacer(intoMap); + + if( OptionalChild constants = IsChild(root, "config") ) + { + for(TreeNode::ConstIterator iter = (*constants).CBegin(); + iter != (*constants).CEnd(); ++iter) + { + Dali::Property::Value property; + if( (*iter).second.GetName() ) + { + DeterminePropertyFromNode( (*iter).second, property, replacer ); + intoMap[ (*iter).second.GetName() ] = property; + } + } + } +} + void Builder::LoadConstants( const TreeNode& root, Property::Map& intoMap ) { Replacement replacer(intoMap); @@ -1139,7 +1164,8 @@ void Builder::ApplyAllStyleProperties( const TreeNode& root, const TreeNode& nod if( matchedStyle ) { StylePtr style( *matchedStyle ); - style->ApplyVisualsAndPropertiesRecursively( handle ); // (recurses through states) + Dictionary instancedProperties; + style->ApplyVisualsAndPropertiesRecursively( handle, instancedProperties ); } else // If there were no styles, instead set properties {