#include <dali/integration-api/debug.h>
//INTERNAL HEARDER
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
}
}
-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( DevelVisual::Property::SHADER, CUSTOM_SHADER );
if( customShaderValue )
{
Property::Map shaderMap;
}
}
- DoInitialize( actor, propertyMap );
-}
+ Property::Value* transform = propertyMap.Find( DevelVisual::Property::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
return 0.f;
}
-void Visual::Base::GetNaturalSize( Vector2& naturalSize ) const
+void Visual::Base::GetNaturalSize( Vector2& naturalSize )
{
naturalSize = Vector2::ZERO;
}
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 )
{
mImpl->mCustomShader->CreatePropertyMap( map );
}
+
+ Property::Map transform;
+ mImpl->mTransform.GetPropertyMap( transform );
+ map.Insert( DevelVisual::Property::TRANSFORM, transform );
}
void Visual::Base::EnablePreMultipliedAlpha( bool preMultipled )
return mImpl->mFlags & Impl::IS_FROM_CACHE;
}
-void Visual::Base::SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- DALI_ASSERT_ALWAYS( ( index > Property::INVALID_INDEX ) &&
- ( index > VISUAL_PROPERTY_BASE_START_INDEX ) && // Change the type of visual is not allowed.
- "Property index is out of bounds" );
-
- if( index < VISUAL_PROPERTY_START_INDEX )
- {
- // TODO set the properties of the visual base.
- }
- else
- {
- DoSetProperty( index, propertyValue );
- }
-}
-
-Dali::Property::Value Visual::Base::GetProperty( Dali::Property::Index index )
-{
- DALI_ASSERT_ALWAYS( ( index > Property::INVALID_INDEX ) &&
- ( index >= VISUAL_PROPERTY_BASE_START_INDEX ) &&
- "Property index is out of bounds" );
-
- Dali::Property::Value value;
-
- if( index < VISUAL_PROPERTY_START_INDEX )
- {
- // TODO retrieve the properties of the visual base.
- }
- else
- {
- value = DoGetProperty( index );
- }
-
- return value;
-}
-
} // namespace Internal
} // namespace Toolkit