/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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/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
{
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));
Actor Actor::GetChildAt(unsigned int 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());
+ Internal::ActorPtr child = GetImplementation(*this).FindChildByName( actorName );
+ return Actor( child.Get() );
}
Actor Actor::FindChildById(const unsigned int 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
void Actor::SetSize(const Vector2& size)
{
- GetImplementation(*this).SetSize(size);
+ GetImplementation(*this).SetSize( size );
}
void Actor::SetSize(const Vector3& size)
{
- GetImplementation(*this).SetSize(size);
+ GetImplementation(*this).SetSize( size );
}
-Vector3 Actor::GetSize() const
+Vector3 Actor::GetTargetSize() const
{
- return GetImplementation(*this).GetSize();
+ return GetImplementation(*this).GetTargetSize();
}
Vector3 Actor::GetCurrentSize() const
void Actor::SetPositionInheritanceMode( PositionInheritanceMode mode )
{
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetPositionInheritanceMode() is deprecated and will be removed from next release. Use SetInheritPosition() instead.\n" );
+
GetImplementation(*this).SetPositionInheritanceMode( mode );
}
PositionInheritanceMode Actor::GetPositionInheritanceMode() const
{
- return GetImplementation(*this).GetPositionInheritanceMode();
-}
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetPositionInheritanceMode() is deprecated and will be removed from next release. Use IsPositionInherited() instead.\n" );
-void Actor::SetOrientation(const Degree& angle, const Vector3& axis)
-{
- GetImplementation(*this).SetOrientation(Radian(angle), axis);
+ return GetImplementation(*this).GetPositionInheritanceMode();
}
void Actor::SetOrientation(const Radian& angle, const Vector3& axis)
GetImplementation(*this).SetOrientation(orientation);
}
-void Actor::RotateBy(const Degree& angle, const Vector3& axis)
-{
- GetImplementation(*this).RotateBy(Radian(angle), axis);
-}
-
void Actor::RotateBy(const Radian& angle, const Vector3& axis)
{
GetImplementation(*this).RotateBy(angle, axis);
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);
return GetImplementation(*this).IsKeyboardFocusable();
}
-Actor::TouchSignalType& Actor::TouchedSignal()
+void Actor::Raise()
{
- return GetImplementation(*this).TouchedSignal();
+ GetImplementation( *this ).Raise();
}
-Actor::HoverSignalType& Actor::HoveredSignal()
+void Actor::Lower()
{
- return GetImplementation(*this).HoveredSignal();
+ GetImplementation( *this ).Lower();
}
-Actor::MouseWheelEventSignalType& Actor::MouseWheelEventSignal()
+void Actor::RaiseToTop()
{
- return GetImplementation(*this).MouseWheelEventSignal();
+ GetImplementation( *this ).RaiseToTop();
}
-Actor::OnStageSignalType& Actor::OnStageSignal()
+void Actor::LowerToBottom()
{
- return GetImplementation(*this).OnStageSignal();
+ GetImplementation( *this ).LowerToBottom();
}
-Actor::OffStageSignalType& Actor::OffStageSignal()
+void Actor::RaiseAbove( Actor target )
{
- return GetImplementation(*this).OffStageSignal();
+ GetImplementation( *this ).RaiseAbove( GetImplementation( target ) );
+}
+
+void Actor::LowerBelow( Actor target )
+{
+ GetImplementation( *this ).LowerBelow( GetImplementation( target ) );
}
-DynamicsBody Actor::EnableDynamics(DynamicsBodyConfig bodyConfig)
+void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
{
-#ifdef DYNAMICS_SUPPORT
- Internal::DynamicsBodyConfig& internal = GetImplementation(bodyConfig);
+ GetImplementation(*this).SetResizePolicy( policy, dimension );
+}
- Internal::DynamicsBodyPtr body( GetImplementation(*this).EnableDynamics( &internal ) );
+ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
+{
+ return GetImplementation(*this).GetResizePolicy( dimension );
+}
- return DynamicsBody( body.Get() );
-#else
- return DynamicsBody();
-#endif
+void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy )
+{
+ GetImplementation(*this).SetSizeScalePolicy( policy );
}
-DynamicsJoint Actor::AddDynamicsJoint( Actor attachedActor, const Vector3& offset )
+SizeScalePolicy::Type Actor::GetSizeScalePolicy() const
{
-#ifdef DYNAMICS_SUPPORT
- Internal::ActorPtr internalActor( &GetImplementation(attachedActor) );
- Internal::DynamicsJointPtr joint( GetImplementation(*this).AddDynamicsJoint( internalActor, offset) );
+ return GetImplementation(*this).GetSizeScalePolicy();
+}
- return DynamicsJoint( joint.Get() );
-#else
- return DynamicsJoint();
-#endif
+float Actor::GetHeightForWidth( float width )
+{
+ return GetImplementation(*this).GetHeightForWidth( width );
}
-DynamicsJoint Actor::AddDynamicsJoint( Actor attachedActor, const Vector3& offsetA, const Vector3& offsetB )
+float Actor::GetWidthForHeight( float height )
{
-#ifdef DYNAMICS_SUPPORT
- Internal::ActorPtr internalActor( &GetImplementation(attachedActor) );
- Internal::DynamicsJointPtr joint( GetImplementation(*this).AddDynamicsJoint( internalActor, offsetA, offsetB) );
+ return GetImplementation(*this).GetWidthForHeight( height );
+}
- return DynamicsJoint( joint.Get() );
-#else
- return DynamicsJoint();
-#endif
+float Actor::GetRelayoutSize( Dimension::Type dimension ) const
+{
+ return GetImplementation(*this).GetRelayoutSize( dimension );
}
-int Actor::GetNumberOfJoints() const
+void Actor::SetPadding( const Padding& padding )
{
-#ifdef DYNAMICS_SUPPORT
- return GetImplementation(*this).GetNumberOfJoints();
-#else
- return int();
-#endif
+ Internal::Actor& impl = GetImplementation(*this);
+
+ Vector2 widthPadding( padding.left, padding.right );
+ impl.SetPadding( widthPadding, Dimension::WIDTH );
+
+ Vector2 heightPadding( padding.bottom, padding.top );
+ impl.SetPadding( heightPadding, Dimension::HEIGHT );
}
-DynamicsJoint Actor::GetDynamicsJointByIndex( const int index )
+void Actor::GetPadding( Padding& paddingOut ) const
{
-#ifdef DYNAMICS_SUPPORT
- Internal::DynamicsJointPtr joint( GetImplementation(*this).GetDynamicsJointByIndex( index ) );
+ const Internal::Actor& impl = GetImplementation(*this);
+
+ Vector2 widthPadding = impl.GetPadding( Dimension::WIDTH );
+ Vector2 heightPadding = impl.GetPadding( Dimension::HEIGHT );
- return DynamicsJoint( joint.Get() );
-#else
- return DynamicsJoint();
-#endif
+ paddingOut.left = widthPadding.x;
+ paddingOut.right = widthPadding.y;
+ paddingOut.bottom = heightPadding.x;
+ paddingOut.top = heightPadding.y;
}
-DynamicsJoint Actor::GetDynamicsJoint( Actor attachedActor )
+void Actor::SetMinimumSize( const Vector2& size )
{
-#ifdef DYNAMICS_SUPPORT
- Internal::DynamicsJointPtr joint( GetImplementation(*this).GetDynamicsJoint( &GetImplementation(attachedActor) ) );
+ Internal::Actor& impl = GetImplementation(*this);
- return DynamicsJoint( joint.Get() );
-#else
- return DynamicsJoint();
-#endif
+ impl.SetMinimumSize( size.x, Dimension::WIDTH );
+ impl.SetMinimumSize( size.y, Dimension::HEIGHT );
}
-void Actor::RemoveDynamicsJoint( DynamicsJoint joint )
+Vector2 Actor::GetMinimumSize()
{
-#ifdef DYNAMICS_SUPPORT
- GetImplementation(*this).RemoveDynamicsJoint( &GetImplementation(joint) );
-#endif
+ Internal::Actor& impl = GetImplementation(*this);
+
+ return Vector2( impl.GetMinimumSize( Dimension::WIDTH ), impl.GetMinimumSize( Dimension::HEIGHT ) );
}
-void Actor::DisableDynamics()
+void Actor::SetMaximumSize( const Vector2& size )
{
-#ifdef DYNAMICS_SUPPORT
- GetImplementation(*this).DisableDynamics();
-#endif
+ Internal::Actor& impl = GetImplementation(*this);
+
+ impl.SetMaximumSize( size.x, Dimension::WIDTH );
+ impl.SetMaximumSize( size.y, Dimension::HEIGHT );
}
-DynamicsBody Actor::GetDynamicsBody()
+Vector2 Actor::GetMaximumSize()
{
-#ifdef DYNAMICS_SUPPORT
- Internal::DynamicsBodyPtr internal(GetImplementation(*this).GetDynamicsBody());
- return DynamicsBody( internal.Get() );
-#else
- return DynamicsBody();
-#endif
+ Internal::Actor& impl = GetImplementation(*this);
+
+ return Vector2( impl.GetMaximumSize( Dimension::WIDTH ), impl.GetMaximumSize( Dimension::HEIGHT ) );
}
-Actor::Actor(Internal::Actor* internal)
-: Handle(internal)
+int Actor::GetHierarchyDepth()
+{
+ return GetImplementation(*this).GetHierarchyDepth();
+}
+
+Actor::TouchSignalType& Actor::TouchedSignal()
+{
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: TouchedSignal() is deprecated and will be removed from next release. Use TouchSignal() instead.\n" );
+
+ return GetImplementation(*this).TouchedSignal();
+}
+
+Actor::TouchDataSignalType& Actor::TouchSignal()
+{
+ return GetImplementation( *this ).TouchSignal();
+}
+
+Actor::HoverSignalType& Actor::HoveredSignal()
+{
+ return GetImplementation(*this).HoveredSignal();
+}
+
+Actor::WheelEventSignalType& Actor::WheelEventSignal()
+{
+ return GetImplementation(*this).WheelEventSignal();
+}
+
+Actor::OnStageSignalType& Actor::OnStageSignal()
+{
+ return GetImplementation(*this).OnStageSignal();
+}
+
+Actor::OffStageSignalType& Actor::OffStageSignal()
{
+ return GetImplementation(*this).OffStageSignal();
+}
+
+unsigned int Actor::AddRenderer( Renderer& renderer )
+{
+ return GetImplementation(*this).AddRenderer( GetImplementation( renderer ) );
+}
+
+unsigned int Actor::GetRendererCount() const
+{
+ return GetImplementation(*this).GetRendererCount();
+}
+
+Renderer Actor::GetRendererAt( unsigned int 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 )
+{
+ GetImplementation(*this).RemoveRenderer( index );
+}
+
+Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
+{
+ return GetImplementation(*this).OnRelayoutSignal();
+}
+
+Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal()
+{
+ return GetImplementation( *this ).LayoutDirectionChangedSignal();
}
-void UnparentAndReset( Actor& actor )
+Actor::Actor(Internal::Actor* internal)
+: Handle(internal)
{
- if( actor )
- {
- actor.Unparent();
- actor.Reset();
- }
}
} // namespace Dali