+ default:
+ break;
+ }
+ }
+
+ return property;
+}
+
+int Actor::GetPropertyComponentIndex( Property::Index index ) const
+{
+ int componentIndex( Property::INVALID_COMPONENT_INDEX );
+
+ if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
+ {
+ // check whether the animatable property is registered already, if not then register one.
+ AnimatablePropertyMetadata* animatableProperty = RegisterAnimatableProperty(index);
+ if( animatableProperty )
+ {
+ componentIndex = animatableProperty->componentIndex;
+ }
+ }
+ else
+ {
+ switch( index )
+ {
+ case Dali::Actor::Property::PARENT_ORIGIN_X:
+ case Dali::Actor::Property::ANCHOR_POINT_X:
+ case Dali::Actor::Property::SIZE_WIDTH:
+ case Dali::Actor::Property::POSITION_X:
+ case Dali::Actor::Property::WORLD_POSITION_X:
+ case Dali::Actor::Property::SCALE_X:
+ case Dali::Actor::Property::COLOR_RED:
+ {
+ componentIndex = 0;
+ break;
+ }
+
+ case Dali::Actor::Property::PARENT_ORIGIN_Y:
+ case Dali::Actor::Property::ANCHOR_POINT_Y:
+ case Dali::Actor::Property::SIZE_HEIGHT:
+ case Dali::Actor::Property::POSITION_Y:
+ case Dali::Actor::Property::WORLD_POSITION_Y:
+ case Dali::Actor::Property::SCALE_Y:
+ case Dali::Actor::Property::COLOR_GREEN:
+ {
+ componentIndex = 1;
+ break;
+ }
+
+ case Dali::Actor::Property::PARENT_ORIGIN_Z:
+ case Dali::Actor::Property::ANCHOR_POINT_Z:
+ case Dali::Actor::Property::SIZE_DEPTH:
+ case Dali::Actor::Property::POSITION_Z:
+ case Dali::Actor::Property::WORLD_POSITION_Z:
+ case Dali::Actor::Property::SCALE_Z:
+ case Dali::Actor::Property::COLOR_BLUE:
+ {
+ componentIndex = 2;
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_ALPHA:
+ case Dali::DevelActor::Property::OPACITY:
+ {
+ componentIndex = 3;
+ break;
+ }
+
+ default:
+ {
+ // Do nothing
+ break;
+ }
+ }
+ }
+
+ return componentIndex;
+}
+
+void Actor::SetParent( Actor* parent )
+{
+ if( parent )
+ {
+ DALI_ASSERT_ALWAYS( !mParent && "Actor cannot have 2 parents" );
+
+ mParent = parent;
+
+ if ( EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ parent->OnStage() )
+ {
+ // Instruct each actor to create a corresponding node in the scene graph
+ ConnectToStage( parent->GetHierarchyDepth() );
+ }
+
+ // Resolve the name and index for the child properties if any
+ ResolveChildProperties();
+ }
+ else // parent being set to NULL
+ {
+ DALI_ASSERT_ALWAYS( mParent != NULL && "Actor should have a parent" );
+
+ mParent = NULL;
+
+ if ( EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ OnStage() )
+ {
+ DALI_ASSERT_ALWAYS( mNode != NULL );
+
+ if( NULL != mNode )
+ {
+ // Disconnect the Node & its children from the scene-graph.
+ DisconnectNodeMessage( GetEventThreadServices().GetUpdateManager(), *mNode );
+ }
+
+ // Instruct each actor to discard pointers to the scene-graph
+ DisconnectFromStage();
+ }
+ }
+}
+
+SceneGraph::Node* Actor::CreateNode() const
+{
+ return Node::New();
+}
+
+bool Actor::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& /* attributes */ )
+{
+ bool done = false;
+ Actor* actor = dynamic_cast< Actor* >( object );
+
+ if( actor )
+ {
+ if( 0 == actionName.compare( ACTION_SHOW ) )
+ {
+ actor->SetVisible( true );
+ done = true;
+ }
+ else if( 0 == actionName.compare( ACTION_HIDE ) )
+ {
+ actor->SetVisible( false );
+ done = true;
+ }
+ }
+
+ return done;
+}
+
+bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& value ) const
+{
+ bool valueSet = true;
+
+ switch( index )
+ {
+ case Dali::Actor::Property::PARENT_ORIGIN:
+ {
+ value = GetCurrentParentOrigin();
+ break;
+ }
+
+ case Dali::Actor::Property::PARENT_ORIGIN_X:
+ {
+ value = GetCurrentParentOrigin().x;
+ break;
+ }
+
+ case Dali::Actor::Property::PARENT_ORIGIN_Y:
+ {
+ value = GetCurrentParentOrigin().y;
+ break;
+ }
+
+ case Dali::Actor::Property::PARENT_ORIGIN_Z:
+ {
+ value = GetCurrentParentOrigin().z;
+ break;
+ }
+
+ case Dali::Actor::Property::ANCHOR_POINT:
+ {
+ value = GetCurrentAnchorPoint();
+ break;
+ }
+
+ case Dali::Actor::Property::ANCHOR_POINT_X:
+ {
+ value = GetCurrentAnchorPoint().x;
+ break;
+ }
+
+ case Dali::Actor::Property::ANCHOR_POINT_Y:
+ {
+ value = GetCurrentAnchorPoint().y;
+ break;
+ }
+
+ case Dali::Actor::Property::ANCHOR_POINT_Z:
+ {
+ value = GetCurrentAnchorPoint().z;
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE:
+ {
+ value = GetTargetSize();
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_WIDTH:
+ {
+ value = GetTargetSize().width;
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_HEIGHT:
+ {
+ value = GetTargetSize().height;
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_DEPTH:
+ {
+ value = GetTargetSize().depth;
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION:
+ {
+ value = GetTargetPosition();
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_X:
+ {
+ value = GetTargetPosition().x;
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_Y:
+ {
+ value = GetTargetPosition().y;
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_Z:
+ {
+ value = GetTargetPosition().z;
+ break;
+ }
+
+ case Dali::Actor::Property::ORIENTATION:
+ {
+ value = mTargetOrientation;
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE:
+ {
+ value = mTargetScale;
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE_X:
+ {
+ value = mTargetScale.x;
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE_Y:
+ {
+ value = mTargetScale.y;
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE_Z:
+ {
+ value = mTargetScale.z;
+ break;
+ }
+
+ case Dali::Actor::Property::VISIBLE:
+ {
+ value = mVisible;
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR:
+ {
+ value = mTargetColor;
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_RED:
+ {
+ value = mTargetColor.r;
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_GREEN:
+ {
+ value = mTargetColor.g;
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_BLUE:
+ {
+ value = mTargetColor.b;
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_ALPHA:
+ case Dali::DevelActor::Property::OPACITY:
+ {
+ value = mTargetColor.a;
+ break;
+ }
+
+ case Dali::Actor::Property::NAME:
+ {
+ value = GetName();
+ break;
+ }
+
+ case Dali::Actor::Property::SENSITIVE:
+ {
+ value = IsSensitive();
+ break;
+ }
+
+ case Dali::Actor::Property::LEAVE_REQUIRED:
+ {
+ value = GetLeaveRequired();
+ break;
+ }
+
+ case Dali::Actor::Property::INHERIT_POSITION:
+ {
+ value = IsPositionInherited();
+ break;
+ }
+
+ case Dali::Actor::Property::INHERIT_ORIENTATION:
+ {
+ value = IsOrientationInherited();
+ break;
+ }
+
+ case Dali::Actor::Property::INHERIT_SCALE:
+ {
+ value = IsScaleInherited();
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_MODE:
+ {
+ value = Scripting::GetLinearEnumerationName< ColorMode >( GetColorMode(), COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT );
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_INHERITANCE:
+ {
+ value = Scripting::GetLinearEnumerationName< PositionInheritanceMode >( GetPositionInheritanceMode(), POSITION_INHERITANCE_MODE_TABLE, POSITION_INHERITANCE_MODE_TABLE_COUNT );
+ break;
+ }
+
+ case Dali::Actor::Property::DRAW_MODE:
+ {
+ value = Scripting::GetEnumerationName< DrawMode::Type >( GetDrawMode(), DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT );
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_MODE_FACTOR:
+ {
+ value = GetSizeModeFactor();
+ break;
+ }
+
+ case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
+ {
+ value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( GetResizePolicy( Dimension::WIDTH ), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT );
+ break;
+ }
+
+ case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
+ {
+ value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( GetResizePolicy( Dimension::HEIGHT ), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT );
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_SCALE_POLICY:
+ {
+ value = Scripting::GetLinearEnumerationName< SizeScalePolicy::Type >( GetSizeScalePolicy(), SIZE_SCALE_POLICY_TABLE, SIZE_SCALE_POLICY_TABLE_COUNT );
+ break;
+ }
+
+ case Dali::Actor::Property::WIDTH_FOR_HEIGHT:
+ {
+ value = ( GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( GetDimensionDependency( Dimension::WIDTH ) == Dimension::HEIGHT );
+ break;
+ }
+
+ case Dali::Actor::Property::HEIGHT_FOR_WIDTH:
+ {
+ value = ( GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( GetDimensionDependency( Dimension::HEIGHT ) == Dimension::WIDTH );
+ break;
+ }
+
+ case Dali::Actor::Property::PADDING:
+ {
+ Vector2 widthPadding = GetPadding( Dimension::WIDTH );
+ Vector2 heightPadding = GetPadding( Dimension::HEIGHT );
+ value = Vector4( widthPadding.x, widthPadding.y, heightPadding.x, heightPadding.y );
+ break;
+ }
+
+ case Dali::Actor::Property::MINIMUM_SIZE:
+ {
+ value = Vector2( GetMinimumSize( Dimension::WIDTH ), GetMinimumSize( Dimension::HEIGHT ) );
+ break;
+ }
+
+ case Dali::Actor::Property::MAXIMUM_SIZE:
+ {
+ value = Vector2( GetMaximumSize( Dimension::WIDTH ), GetMaximumSize( Dimension::HEIGHT ) );
+ break;
+ }
+
+ case Dali::Actor::Property::CLIPPING_MODE:
+ {
+ value = mClippingMode;
+ break;
+ }
+
+ case Dali::DevelActor::Property::SIBLING_ORDER:
+ {
+ value = static_cast<int>(mSiblingOrder);
+ break;
+ }
+
+ case Dali::DevelActor::Property::SCREEN_POSITION:
+ {
+ value = GetCurrentScreenPosition();
+ break;
+ }
+
+ case Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT:
+ {
+ value = mPositionUsesAnchorPoint;
+ break;
+ }
+
+ default:
+ {
+ // Must be a scene-graph only property
+ valueSet = false;
+ break;
+ }
+ }
+
+ return valueSet;
+}
+
+bool Actor::GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const
+{
+ bool valueSet = true;
+
+ switch( index )
+ {
+ case Dali::Actor::Property::SIZE:
+ {
+ value = GetCurrentSize();
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_WIDTH:
+ {
+ value = GetCurrentSize().width;
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_HEIGHT:
+ {
+ value = GetCurrentSize().height;
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_DEPTH:
+ {
+ value = GetCurrentSize().depth;
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION:
+ {
+ value = GetCurrentPosition();
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_X:
+ {
+ value = GetCurrentPosition().x;
+ break;