// EXTERNAL HEADER
#include <dali-toolkit/public-api/dali-toolkit-common.h>
-#include <dali/devel-api/object/handle-devel.h>
#include <dali/devel-api/scripting/enum-helper.h>
#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/integration-api/debug.h>
{
matchKey = Property::Key( Toolkit::DevelVisual::Property::CORNER_RADIUS );
}
+ else if( matchKey == CORNER_RADIUS_POLICY )
+ {
+ matchKey = Property::Key( Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY );
+ }
}
switch( matchKey.indexKey )
}
break;
}
+ case Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY:
+ {
+ int policy;
+ if( value.Get( policy ) )
+ {
+ switch( policy )
+ {
+ case Toolkit::Visual::Transform::Policy::RELATIVE:
+ case Toolkit::Visual::Transform::Policy::ABSOLUTE:
+ {
+ mImpl->mCornerRadiusPolicy = policy;
+ break;
+ }
+ default:
+ {
+ DALI_LOG_ERROR( "Unsupported policy: %d\n", policy );
+ break;
+ }
+ }
+ }
+ break;
+ }
}
}
return mImpl->mDepthIndex;
}
-void Visual::Base::SetOnStage( Actor& actor )
+void Visual::Base::SetOnScene( Actor& actor )
{
- if( !IsOnStage() )
+ if( !IsOnScene() )
{
// 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 );
+ DoSetOnScene( actor );
if( mImpl->mRenderer )
{
if( IsRoundedCornerRequired() )
{
mImpl->mCornerRadiusIndex = mImpl->mRenderer.RegisterProperty( CORNER_RADIUS, mImpl->mCornerRadius );
+ mImpl->mRenderer.RegisterProperty( CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy );
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
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
+ mImpl->mFlags |= Impl::IS_ON_SCENE; // Only sets the flag if renderer exists
}
}
}
-void Visual::Base::SetOffStage( Actor& actor )
+void Visual::Base::SetOffScene( Actor& actor )
{
- if( IsOnStage() )
+ if( IsOnScene() )
{
- DoSetOffStage( actor );
+ DoSetOffScene( actor );
mImpl->mMixColorIndex = Property::INVALID_INDEX;
mImpl->mCornerRadiusIndex = Property::INVALID_INDEX;
- mImpl->mFlags &= ~Impl::IS_ON_STAGE;
+ mImpl->mFlags &= ~Impl::IS_ON_SCENE;
}
}
// which is ok, because they have a different key value range.
map.Insert( Toolkit::Visual::Property::MIX_COLOR, mImpl->mMixColor ); // vec4
map.Insert( Toolkit::Visual::Property::OPACITY, mImpl->mMixColor.a );
- map.Insert( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, IsSynchronousLoadingRequired() );
auto fittingModeString = Scripting::GetLinearEnumerationName< FittingMode >(
mImpl->mFittingMode, VISUAL_FITTING_MODE_TABLE, VISUAL_FITTING_MODE_TABLE_COUNT );
map.Insert( Toolkit::DevelVisual::Property::VISUAL_FITTING_MODE, fittingModeString );
map.Insert( Toolkit::DevelVisual::Property::CORNER_RADIUS, mImpl->mCornerRadius );
+ map.Insert( Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, static_cast< int >( mImpl->mCornerRadiusPolicy ) );
}
void Visual::Base::CreateInstancePropertyMap( Property::Map& map ) const
return mImpl->mFlags & Impl::IS_PREMULTIPLIED_ALPHA;
}
-void Visual::Base::DoSetOffStage( Actor& actor )
+void Visual::Base::DoSetOffScene( Actor& actor )
{
actor.RemoveRenderer( mImpl->mRenderer );
mImpl->mRenderer.Reset();
}
-bool Visual::Base::IsOnStage() const
+bool Visual::Base::IsOnScene() const
{
- return mImpl->mFlags & Impl::IS_ON_STAGE;
+ return mImpl->mFlags & Impl::IS_ON_SCENE;
}
bool Visual::Base::IsRoundedCornerRequired() const
// (Color and Primitive visuals will register their own and save to this index)
if( mImpl->mMixColorIndex == Property::INVALID_INDEX )
{
- mImpl->mMixColorIndex = DevelHandle::RegisterProperty(
- mImpl->mRenderer,
+ mImpl->mMixColorIndex = mImpl->mRenderer.RegisterProperty(
Toolkit::Visual::Property::MIX_COLOR,
MIX_COLOR,
Vector3(mImpl->mMixColor) );
Property::Index Visual::Base::GetPropertyIndex( Property::Key key )
{
- Property::Index index = DevelHandle::GetPropertyIndex( mImpl->mRenderer, key );
+ Property::Index index = mImpl->mRenderer.GetPropertyIndex( key );
if( index == Property::INVALID_INDEX )
{
// Is it a shader property?
Shader shader = mImpl->mRenderer.GetShader();
- index = DevelHandle::GetPropertyIndex( shader, key );
+ index = shader.GetPropertyIndex( key );
if( index != Property::INVALID_INDEX )
{
// Yes - we should register it in the Renderer so it can be set / animated
// Leave keyIndex as INVALID_KEY - it can still be registered against the string key.
}
Property::Value value = shader.GetProperty( index );
- index = DevelHandle::RegisterProperty( mImpl->mRenderer, keyIndex, keyName, value );
+ index = mImpl->mRenderer.RegisterProperty( keyIndex, keyName, value );
}
}
return index;