X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-base-impl.cpp;h=12b6b35c53572f17295d912f164c3b87bd5a84ee;hb=d0b03f52573948c53cdca89ec5e3be201737c3bb;hp=48df29a81623f2f9961fc662784972f6d3b289da;hpb=bf8ef7cb5b533057ad73140803e59acd3c0b0914;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/visual-base-impl.cpp b/dali-toolkit/internal/visuals/visual-base-impl.cpp index 48df29a..12b6b35 100644 --- a/dali-toolkit/internal/visuals/visual-base-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-base-impl.cpp @@ -23,7 +23,7 @@ #include //INTERNAL HEARDER -#include +#include #include #include @@ -59,9 +59,9 @@ void Visual::Base::SetCustomShader( const Property::Map& shaderMap ) } } -void Visual::Base::Initialize( Actor& actor, const Property::Map& propertyMap ) +void Visual::Base::SetProperties( const Property::Map& propertyMap ) { - Property::Value* customShaderValue = propertyMap.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER ); + Property::Value* customShaderValue = propertyMap.Find( VisualProperty::SHADER, CUSTOM_SHADER ); if( customShaderValue ) { Property::Map shaderMap; @@ -71,27 +71,34 @@ void Visual::Base::Initialize( Actor& actor, const Property::Map& propertyMap ) } } - DoInitialize( actor, propertyMap ); -} + Property::Value* transform = propertyMap.Find( Toolkit::Visual::DevelProperty::TRANSFORM, TRANSFORM ); + if( transform ) + { + Property::Map map; + if( transform->Get( map ) ) + { + mImpl->mTransform.SetPropertyMap( map ); + } + } -void Visual::Base::SetName( const std::string& name ) -{ - mImpl->mName = name; + DoSetProperties( propertyMap ); } -const std::string& Visual::Base::GetName() +void Visual::Base::SetTransformAndSize( const Property::Map& transform, Size controlSize ) { - return mImpl->mName; + mImpl->mControlSize = controlSize; + mImpl->mTransform.SetPropertyMap( transform ); + OnSetTransform(); } -void Visual::Base::SetSize( const Vector2& size ) +void Visual::Base::SetName( const std::string& name ) { - mImpl->mSize = size; + mImpl->mName = name; } -const Vector2& Visual::Base::GetSize() const +const std::string& Visual::Base::GetName() { - return mImpl->mSize; + return mImpl->mName; } float Visual::Base::GetHeightForWidth( float width ) const @@ -99,7 +106,7 @@ float Visual::Base::GetHeightForWidth( float width ) const return 0.f; } -void Visual::Base::GetNaturalSize( Vector2& naturalSize ) const +void Visual::Base::GetNaturalSize( Vector2& naturalSize ) { naturalSize = Vector2::ZERO; } @@ -120,13 +127,19 @@ float Visual::Base::GetDepthIndex() const void Visual::Base::SetOnStage( Actor& actor ) { - // To display the actor correctly, renderer should not be added to actor until all required resources are ready. - // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing. - DoSetOnStage( actor ); + if( !IsOnStage() ) + { + // To display the actor correctly, renderer should not be added to actor until all required resources are ready. + // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing. + DoSetOnStage( actor ); - mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled()); - mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex ); - mImpl->mFlags |= Impl::IS_ON_STAGE; + if( mImpl->mRenderer ) + { + mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled()); + mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex ); + mImpl->mFlags |= Impl::IS_ON_STAGE; // Only sets the flag if renderer exists + } + } } void Visual::Base::SetOffStage( Actor& actor ) @@ -147,6 +160,10 @@ void Visual::Base::CreatePropertyMap( Property::Map& map ) const { mImpl->mCustomShader->CreatePropertyMap( map ); } + + Property::Map transform; + mImpl->mTransform.GetPropertyMap( transform ); + map.Insert( Toolkit::Visual::DevelProperty::TRANSFORM, transform ); } void Visual::Base::EnablePreMultipliedAlpha( bool preMultipled ) @@ -195,6 +212,15 @@ void Visual::Base::SetProperty( Dali::Property::Index index, const Dali::Propert if( index < VISUAL_PROPERTY_START_INDEX ) { + if( index == Dali::Toolkit::Visual::DevelProperty::TRANSFORM ) + { + Property::Map* transformMap = propertyValue.GetMap(); + if( transformMap ) + { + SetTransformAndSize( *transformMap, mImpl->mControlSize ); + } + } + // TODO set the properties of the visual base. } else @@ -213,6 +239,12 @@ Dali::Property::Value Visual::Base::GetProperty( Dali::Property::Index index ) if( index < VISUAL_PROPERTY_START_INDEX ) { + if( index == Dali::Toolkit::Visual::DevelProperty::TRANSFORM ) + { + Property::Map map; + mImpl->mTransform.GetPropertyMap( map ); + return map; + } // TODO retrieve the properties of the visual base. } else