/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/math/degree.h>
#include <dali/public-api/math/radian.h>
#include <dali/public-api/math/vector2.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/layer-impl.h>
-#include <dali/internal/event/actors/renderer-impl.h>
-#include <dali/internal/event/actor-attachments/actor-attachment-impl.h>
+#include <dali/internal/event/rendering/renderer-impl.h>
#include <dali/internal/event/animation/constraint-impl.h>
-
-#include <dali/public-api/dynamics/dynamics-body.h>
-#include <dali/public-api/dynamics/dynamics-joint.h>
-#include <dali/public-api/dynamics/dynamics-body-config.h>
-
-#ifdef DYNAMICS_SUPPORT
-#include <dali/internal/event/dynamics/dynamics-declarations.h>
-#include <dali/internal/event/dynamics/dynamics-body-config-impl.h>
-#include <dali/internal/event/dynamics/dynamics-body-impl.h>
-#include <dali/internal/event/dynamics/dynamics-joint-impl.h>
-#include <dali/internal/event/dynamics/dynamics-world-impl.h>
-#endif
+#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
namespace Dali
{
return *this;
}
-const std::string& Actor::GetName() const
-{
- return GetImplementation(*this).GetName();
-}
-
-void Actor::SetName(const std::string& name)
-{
- GetImplementation(*this).SetName(name);
-}
-
-unsigned int Actor::GetId() const
-{
- return GetImplementation(*this).GetId();
-}
-
-bool Actor::IsRoot() const
-{
- return GetImplementation(*this).IsRoot();
-}
-
-bool Actor::OnStage() const
-{
- return GetImplementation(*this).OnStage();
-}
-
-bool Actor::IsLayer() const
-{
- return GetImplementation(*this).IsLayer();
-}
-
Layer Actor::GetLayer()
{
return GetImplementation(*this).GetLayer();
GetImplementation(*this).Add(GetImplementation(actor));
}
-void Actor::Insert(unsigned int index, Actor actor)
-{
- GetImplementation(*this).Insert(index, GetImplementation(actor));
-}
-
void Actor::Remove(Actor actor)
{
GetImplementation(*this).Remove(GetImplementation(actor));
GetImplementation(*this).Unparent();
}
-unsigned int Actor::GetChildCount() const
+uint32_t Actor::GetChildCount() const
{
return GetImplementation(*this).GetChildCount();
}
-Actor Actor::GetChildAt(unsigned int index) const
+Actor Actor::GetChildAt( uint32_t index ) const
{
- return GetImplementation(*this).GetChildAt(index);
+ Internal::ActorPtr child = GetImplementation(*this).GetChildAt( index );
+ return Actor( child.Get() );
}
Actor Actor::FindChildByName(const std::string& actorName)
{
- Internal::ActorPtr child = GetImplementation(*this).FindChildByName(actorName);
- return Actor(child.Get());
-}
-
-Actor Actor::FindChildByAlias(const std::string& actorAlias)
-{
- Actor child = GetImplementation(*this).FindChildByAlias(actorAlias);
- return child;
+ Internal::ActorPtr child = GetImplementation(*this).FindChildByName( actorName );
+ return Actor( child.Get() );
}
-Actor Actor::FindChildById(const unsigned int id)
+Actor Actor::FindChildById( const uint32_t id )
{
- Internal::ActorPtr child = GetImplementation(*this).FindChildById(id);
- return Actor(child.Get());
+ Internal::ActorPtr child = GetImplementation(*this).FindChildById( id );
+ return Actor( child.Get() );
}
Actor Actor::GetParent() const
return Actor(parent);
}
-void Actor::SetParentOrigin(const Vector3& origin)
+Vector3 Actor::GetTargetSize() const
{
- GetImplementation(*this).SetParentOrigin(origin);
-}
-
-Vector3 Actor::GetCurrentParentOrigin() const
-{
- return GetImplementation(*this).GetCurrentParentOrigin();
-}
-
-void Actor::SetAnchorPoint(const Vector3& anchorPoint)
-{
- GetImplementation(*this).SetAnchorPoint(anchorPoint);
-}
-
-Vector3 Actor::GetCurrentAnchorPoint() const
-{
- return GetImplementation(*this).GetCurrentAnchorPoint();
-}
-
-void Actor::SetSize(float width, float height)
-{
- GetImplementation(*this).SetSize(width, height);
-}
-
-void Actor::SetSize(float width, float height, float depth)
-{
- GetImplementation(*this).SetSize(width, height, depth);
-}
-
-void Actor::SetSize(const Vector2& size)
-{
- GetImplementation(*this).SetSize(size);
-}
-
-void Actor::SetSize(const Vector3& size)
-{
- GetImplementation(*this).SetSize(size);
-}
-
-Vector3 Actor::GetSize() const
-{
- return GetImplementation(*this).GetSize();
-}
-
-Vector3 Actor::GetCurrentSize() const
-{
- return GetImplementation(*this).GetCurrentSize();
+ return GetImplementation(*this).GetTargetSize();
}
Vector3 Actor::GetNaturalSize() const
return GetImplementation(*this).GetNaturalSize();
}
-void Actor::SetPosition(float x, float y)
-{
- GetImplementation(*this).SetPosition(x, y);
-}
-
-void Actor::SetPosition(float x, float y, float z)
-{
- GetImplementation(*this).SetPosition(x, y, z);
-}
-
-void Actor::SetPosition(const Vector3& position)
-{
- GetImplementation(*this).SetPosition(position);
-}
-
-void Actor::SetX(float x)
-{
- GetImplementation(*this).SetX(x);
-}
-
-void Actor::SetY(float y)
-{
- GetImplementation(*this).SetY(y);
-}
-
-void Actor::SetZ(float z)
-{
- GetImplementation(*this).SetZ(z);
-}
-
-void Actor::MoveBy(const Vector3& distance)
-{
- GetImplementation(*this).MoveBy(distance);
-}
-
-Vector3 Actor::GetCurrentPosition() const
-{
- return GetImplementation(*this).GetCurrentPosition();
-}
-
-Vector3 Actor::GetCurrentWorldPosition() const
-{
- return GetImplementation(*this).GetCurrentWorldPosition();
-}
-
-void Actor::SetPositionInheritanceMode( PositionInheritanceMode mode )
-{
- GetImplementation(*this).SetPositionInheritanceMode( mode );
-}
-
-PositionInheritanceMode Actor::GetPositionInheritanceMode() const
-{
- return GetImplementation(*this).GetPositionInheritanceMode();
-}
-
-void Actor::SetRotation(const Degree& angle, const Vector3& axis)
-{
- GetImplementation(*this).SetRotation(Radian(angle), axis);
-}
-
-void Actor::SetRotation(const Radian& angle, const Vector3& axis)
+void Actor::TranslateBy(const Vector3& distance)
{
- GetImplementation(*this).SetRotation(angle, axis);
-}
-
-void Actor::SetRotation(const Quaternion& rotation)
-{
- GetImplementation(*this).SetRotation(rotation);
-}
-
-void Actor::RotateBy(const Degree& angle, const Vector3& axis)
-{
- GetImplementation(*this).RotateBy(Radian(angle), axis);
+ GetImplementation(*this).TranslateBy(distance);
}
void Actor::RotateBy(const Radian& angle, const Vector3& axis)
GetImplementation(*this).RotateBy(relativeRotation);
}
-Quaternion Actor::GetCurrentRotation() const
-{
- return GetImplementation(*this).GetCurrentRotation();
-}
-
-void Actor::SetInheritRotation(bool inherit)
-{
- GetImplementation(*this).SetInheritRotation(inherit);
-}
-
-bool Actor::IsRotationInherited() const
-{
- return GetImplementation(*this).IsRotationInherited();
-}
-
-Quaternion Actor::GetCurrentWorldRotation() const
-{
- return GetImplementation(*this).GetCurrentWorldRotation();
-}
-
-void Actor::SetScale(float scale)
-{
- GetImplementation(*this).SetScale(scale);
-}
-
-void Actor::SetScale(float scaleX, float scaleY, float scaleZ)
-{
- GetImplementation(*this).SetScale(scaleX, scaleY, scaleZ);
-}
-
-void Actor::SetScale(const Vector3& scale)
-{
- GetImplementation(*this).SetScale(scale);
-}
-
void Actor::ScaleBy(const Vector3& relativeScale)
{
GetImplementation(*this).ScaleBy(relativeScale);
}
-Vector3 Actor::GetCurrentScale() const
-{
- return GetImplementation(*this).GetCurrentScale();
-}
-
-Vector3 Actor::GetCurrentWorldScale() const
-{
- return GetImplementation(*this).GetCurrentWorldScale();
-}
-
-void Actor::SetInheritScale( bool inherit )
-{
- GetImplementation(*this).SetInheritScale( inherit );
-}
-
-bool Actor::IsScaleInherited() const
-{
- return GetImplementation(*this).IsScaleInherited();
-}
-
-void Actor::SetSizeMode(SizeMode mode)
-{
- GetImplementation(*this).SetSizeMode(mode);
-}
-
-SizeMode Actor::GetSizeMode() const
-{
- return GetImplementation(*this).GetSizeMode();
-}
-
-void Actor::SetSizeModeFactor(const Vector3& factor)
-{
- GetImplementation(*this).SetSizeModeFactor(factor);
-}
-
-Vector3 Actor::GetSizeModeFactor() const
-{
- return GetImplementation(*this).GetSizeModeFactor();
-}
-
-Matrix Actor::GetCurrentWorldMatrix() const
-{
- return GetImplementation(*this).GetCurrentWorldMatrix();
-}
-
-void Actor::SetVisible(bool visible)
-{
- GetImplementation(*this).SetVisible(visible);
-}
-
-bool Actor::IsVisible() const
-{
- return GetImplementation(*this).IsVisible();
-}
-
-void Actor::SetOpacity(float opacity)
-{
- GetImplementation(*this).SetOpacity(opacity);
-}
-
-void Actor::OpacityBy(float relativeOpacity)
-{
- GetImplementation(*this).OpacityBy(relativeOpacity);
-}
-
-float Actor::GetCurrentOpacity() const
-{
- return GetImplementation(*this).GetCurrentOpacity();
-}
-
-void Actor::SetColor(const Vector4& color)
+bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const
{
- GetImplementation(*this).SetColor(color);
+ return GetImplementation(*this).ScreenToLocal(localX, localY, screenX, screenY);
}
-void Actor::ColorBy(const Vector4& relativeColor)
+void Actor::Raise()
{
- GetImplementation(*this).ColorBy(relativeColor);
+ GetImplementation( *this ).Raise();
}
-Vector4 Actor::GetCurrentColor() const
+void Actor::Lower()
{
- return GetImplementation(*this).GetCurrentColor();
+ GetImplementation( *this ).Lower();
}
-void Actor::SetColorMode( ColorMode colorMode )
+void Actor::RaiseToTop()
{
- GetImplementation(*this).SetColorMode(colorMode);
+ GetImplementation( *this ).RaiseToTop();
}
-ColorMode Actor::GetColorMode() const
+void Actor::LowerToBottom()
{
- return GetImplementation(*this).GetColorMode();
+ GetImplementation( *this ).LowerToBottom();
}
-Vector4 Actor::GetCurrentWorldColor() const
+void Actor::RaiseAbove( Actor target )
{
- return GetImplementation(*this).GetCurrentWorldColor();
+ GetImplementation( *this ).RaiseAbove( GetImplementation( target ) );
}
-void Actor::SetDrawMode( DrawMode::Type drawMode )
+void Actor::LowerBelow( Actor target )
{
- GetImplementation(*this).SetDrawMode( drawMode );
+ GetImplementation( *this ).LowerBelow( GetImplementation( target ) );
}
-DrawMode::Type Actor::GetDrawMode() const
+void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
{
- return GetImplementation(*this).GetDrawMode();
+ GetImplementation(*this).SetResizePolicy( policy, dimension );
}
-void Actor::SetSensitive(bool sensitive)
+ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
{
- GetImplementation(*this).SetSensitive(sensitive);
+ return GetImplementation(*this).GetResizePolicy( dimension );
}
-bool Actor::IsSensitive() const
+float Actor::GetHeightForWidth( float width )
{
- return GetImplementation(*this).IsSensitive();
+ return GetImplementation(*this).GetHeightForWidth( width );
}
-bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const
+float Actor::GetWidthForHeight( float height )
{
- return GetImplementation(*this).ScreenToLocal(localX, localY, screenX, screenY);
+ return GetImplementation(*this).GetWidthForHeight( height );
}
-void Actor::SetLeaveRequired(bool required)
+float Actor::GetRelayoutSize( Dimension::Type dimension ) const
{
- GetImplementation(*this).SetLeaveRequired(required);
+ return GetImplementation(*this).GetRelayoutSize( dimension );
}
-bool Actor::GetLeaveRequired() const
-{
- return GetImplementation(*this).GetLeaveRequired();
-}
-
-void Actor::SetKeyboardFocusable( bool focusable )
+Actor::TouchSignalType& Actor::TouchedSignal()
{
- GetImplementation(*this).SetKeyboardFocusable(focusable);
-}
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: TouchedSignal() is deprecated and will be removed from next release. Use TouchSignal() instead.\n" );
-bool Actor::IsKeyboardFocusable() const
-{
- return GetImplementation(*this).IsKeyboardFocusable();
+ return GetImplementation(*this).TouchedSignal();
}
-Actor::TouchSignalType& Actor::TouchedSignal()
+Actor::TouchDataSignalType& Actor::TouchSignal()
{
- return GetImplementation(*this).TouchedSignal();
+ return GetImplementation( *this ).TouchSignal();
}
Actor::HoverSignalType& Actor::HoveredSignal()
return GetImplementation(*this).HoveredSignal();
}
-Actor::MouseWheelEventSignalType& Actor::MouseWheelEventSignal()
+Actor::WheelEventSignalType& Actor::WheelEventSignal()
{
- return GetImplementation(*this).MouseWheelEventSignal();
+ return GetImplementation(*this).WheelEventSignal();
}
Actor::OnStageSignalType& Actor::OnStageSignal()
return GetImplementation(*this).OffStageSignal();
}
-unsigned int Actor::AddRenderer( Renderer& renderer )
+uint32_t Actor::AddRenderer( Renderer& renderer )
{
return GetImplementation(*this).AddRenderer( GetImplementation( renderer ) );
}
-unsigned int Actor::GetRendererCount() const
+uint32_t Actor::GetRendererCount() const
{
return GetImplementation(*this).GetRendererCount();
}
-Renderer Actor::GetRendererAt( unsigned int index )
+Renderer Actor::GetRendererAt( uint32_t index )
{
- return Renderer( &GetImplementation(*this).GetRendererAt( index ) );
+ Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt( index );
+ return Renderer( renderer.Get() );
}
void Actor::RemoveRenderer( Renderer& renderer )
GetImplementation(*this).RemoveRenderer( GetImplementation( renderer ) );
}
-void Actor::RemoveRenderer( unsigned int index )
+void Actor::RemoveRenderer( uint32_t index )
{
GetImplementation(*this).RemoveRenderer( index );
}
-DynamicsBody Actor::EnableDynamics(DynamicsBodyConfig bodyConfig)
-{
-#ifdef DYNAMICS_SUPPORT
- Internal::DynamicsBodyConfig& internal = GetImplementation(bodyConfig);
-
- Internal::DynamicsBodyPtr body( GetImplementation(*this).EnableDynamics( &internal ) );
-
- return DynamicsBody( body.Get() );
-#else
- return DynamicsBody();
-#endif
-}
-
-DynamicsJoint Actor::AddDynamicsJoint( Actor attachedActor, const Vector3& offset )
+Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
{
-#ifdef DYNAMICS_SUPPORT
- Internal::ActorPtr internalActor( &GetImplementation(attachedActor) );
- Internal::DynamicsJointPtr joint( GetImplementation(*this).AddDynamicsJoint( internalActor, offset) );
-
- return DynamicsJoint( joint.Get() );
-#else
- return DynamicsJoint();
-#endif
+ return GetImplementation(*this).OnRelayoutSignal();
}
-DynamicsJoint Actor::AddDynamicsJoint( Actor attachedActor, const Vector3& offsetA, const Vector3& offsetB )
+Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal()
{
-#ifdef DYNAMICS_SUPPORT
- Internal::ActorPtr internalActor( &GetImplementation(attachedActor) );
- Internal::DynamicsJointPtr joint( GetImplementation(*this).AddDynamicsJoint( internalActor, offsetA, offsetB) );
-
- return DynamicsJoint( joint.Get() );
-#else
- return DynamicsJoint();
-#endif
-}
-
-int Actor::GetNumberOfJoints() const
-{
-#ifdef DYNAMICS_SUPPORT
- return GetImplementation(*this).GetNumberOfJoints();
-#else
- return int();
-#endif
-}
-
-DynamicsJoint Actor::GetDynamicsJointByIndex( const int index )
-{
-#ifdef DYNAMICS_SUPPORT
- Internal::DynamicsJointPtr joint( GetImplementation(*this).GetDynamicsJointByIndex( index ) );
-
- return DynamicsJoint( joint.Get() );
-#else
- return DynamicsJoint();
-#endif
-}
-
-DynamicsJoint Actor::GetDynamicsJoint( Actor attachedActor )
-{
-#ifdef DYNAMICS_SUPPORT
- Internal::DynamicsJointPtr joint( GetImplementation(*this).GetDynamicsJoint( &GetImplementation(attachedActor) ) );
-
- return DynamicsJoint( joint.Get() );
-#else
- return DynamicsJoint();
-#endif
-}
-
-void Actor::RemoveDynamicsJoint( DynamicsJoint joint )
-{
-#ifdef DYNAMICS_SUPPORT
- GetImplementation(*this).RemoveDynamicsJoint( &GetImplementation(joint) );
-#endif
-}
-
-void Actor::DisableDynamics()
-{
-#ifdef DYNAMICS_SUPPORT
- GetImplementation(*this).DisableDynamics();
-#endif
-}
-
-DynamicsBody Actor::GetDynamicsBody()
-{
-#ifdef DYNAMICS_SUPPORT
- Internal::DynamicsBodyPtr internal(GetImplementation(*this).GetDynamicsBody());
- return DynamicsBody( internal.Get() );
-#else
- return DynamicsBody();
-#endif
+ return GetImplementation( *this ).LayoutDirectionChangedSignal();
}
Actor::Actor(Internal::Actor* internal)
{
}
-void UnparentAndReset( Actor& actor )
-{
- if( actor )
- {
- actor.Unparent();
- actor.Reset();
- }
-}
-
} // namespace Dali