Merge "Add cmake to the required system packages list in dali_env" into tizen
[platform/core/uifw/dali-core.git] / dali / public-api / actors / actor.cpp
index f3beeb8..1b31452 100644 (file)
 #include <dali/internal/event/actors/layer-impl.h>
 #include <dali/internal/event/actor-attachments/actor-attachment-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
 {
@@ -67,7 +56,7 @@ Actor::~Actor()
 }
 
 Actor::Actor(const Actor& copy)
-: Constrainable(copy)
+: Handle(copy)
 {
 }
 
@@ -148,12 +137,6 @@ Actor Actor::FindChildByName(const std::string& actorName)
   return Actor(child.Get());
 }
 
-Actor Actor::FindChildByAlias(const std::string& actorAlias)
-{
-  Actor child = GetImplementation(*this).FindChildByAlias(actorAlias);
-  return child;
-}
-
 Actor Actor::FindChildById(const unsigned int id)
 {
   Internal::ActorPtr child = GetImplementation(*this).FindChildById(id);
@@ -199,17 +182,17 @@ void Actor::SetSize(float width, float height, float depth)
 
 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
@@ -252,9 +235,9 @@ void Actor::SetZ(float z)
   GetImplementation(*this).SetZ(z);
 }
 
-void Actor::MoveBy(const Vector3& distance)
+void Actor::TranslateBy(const Vector3& distance)
 {
-  GetImplementation(*this).MoveBy(distance);
+  GetImplementation(*this).TranslateBy(distance);
 }
 
 Vector3 Actor::GetCurrentPosition() const
@@ -277,19 +260,19 @@ PositionInheritanceMode Actor::GetPositionInheritanceMode() const
   return GetImplementation(*this).GetPositionInheritanceMode();
 }
 
-void Actor::SetRotation(const Degree& angle, const Vector3& axis)
+void Actor::SetOrientation(const Degree& angle, const Vector3& axis)
 {
-  GetImplementation(*this).SetRotation(Radian(angle), axis);
+  GetImplementation(*this).SetOrientation(Radian(angle), axis);
 }
 
-void Actor::SetRotation(const Radian& angle, const Vector3& axis)
+void Actor::SetOrientation(const Radian& angle, const Vector3& axis)
 {
-  GetImplementation(*this).SetRotation(angle, axis);
+  GetImplementation(*this).SetOrientation(angle, axis);
 }
 
-void Actor::SetRotation(const Quaternion& rotation)
+void Actor::SetOrientation(const Quaternion& orientation)
 {
-  GetImplementation(*this).SetRotation(rotation);
+  GetImplementation(*this).SetOrientation(orientation);
 }
 
 void Actor::RotateBy(const Degree& angle, const Vector3& axis)
@@ -307,24 +290,24 @@ void Actor::RotateBy(const Quaternion& relativeRotation)
   GetImplementation(*this).RotateBy(relativeRotation);
 }
 
-Quaternion Actor::GetCurrentRotation() const
+Quaternion Actor::GetCurrentOrientation() const
 {
-  return GetImplementation(*this).GetCurrentRotation();
+  return GetImplementation(*this).GetCurrentOrientation();
 }
 
-void Actor::SetInheritRotation(bool inherit)
+void Actor::SetInheritOrientation(bool inherit)
 {
-  GetImplementation(*this).SetInheritRotation(inherit);
+  GetImplementation(*this).SetInheritOrientation(inherit);
 }
 
-bool Actor::IsRotationInherited() const
+bool Actor::IsOrientationInherited() const
 {
-  return GetImplementation(*this).IsRotationInherited();
+  return GetImplementation(*this).IsOrientationInherited();
 }
 
-Quaternion Actor::GetCurrentWorldRotation() const
+Quaternion Actor::GetCurrentWorldOrientation() const
 {
-  return GetImplementation(*this).GetCurrentWorldRotation();
+  return GetImplementation(*this).GetCurrentWorldOrientation();
 }
 
 void Actor::SetScale(float scale)
@@ -367,16 +350,6 @@ 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);
@@ -407,11 +380,6 @@ 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();
@@ -422,11 +390,6 @@ void Actor::SetColor(const Vector4& color)
   GetImplementation(*this).SetColor(color);
 }
 
-void Actor::ColorBy(const Vector4& relativeColor)
-{
-  GetImplementation(*this).ColorBy(relativeColor);
-}
-
 Vector4 Actor::GetCurrentColor() const
 {
   return GetImplementation(*this).GetCurrentColor();
@@ -492,125 +455,147 @@ bool Actor::IsKeyboardFocusable() const
   return GetImplementation(*this).IsKeyboardFocusable();
 }
 
-Actor::TouchSignalType& Actor::TouchedSignal()
+void Actor::SetRelayoutEnabled( bool enabled )
 {
-  return GetImplementation(*this).TouchedSignal();
+  GetImplementation(*this).SetRelayoutEnabled( enabled );
 }
 
-Actor::HoverSignalType& Actor::HoveredSignal()
+bool Actor::IsRelayoutEnabled() const
 {
-  return GetImplementation(*this).HoveredSignal();
+  return GetImplementation(*this).IsRelayoutEnabled();
 }
 
-Actor::MouseWheelEventSignalType& Actor::MouseWheelEventSignal()
+void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
 {
-  return GetImplementation(*this).MouseWheelEventSignal();
+  GetImplementation(*this).SetResizePolicy( policy, dimension );
 }
 
-Actor::OnStageSignalType& Actor::OnStageSignal()
+ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
 {
-  return GetImplementation(*this).OnStageSignal();
+  return GetImplementation(*this).GetResizePolicy( dimension );
 }
 
-Actor::OffStageSignalType& Actor::OffStageSignal()
+void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy )
 {
-  return GetImplementation(*this).OffStageSignal();
+  GetImplementation(*this).SetSizeScalePolicy( policy );
+}
+
+SizeScalePolicy::Type Actor::GetSizeScalePolicy() const
+{
+  return GetImplementation(*this).GetSizeScalePolicy();
+}
+
+float Actor::GetHeightForWidth( float width )
+{
+  return GetImplementation(*this).GetHeightForWidth( width );
 }
 
-DynamicsBody Actor::EnableDynamics(DynamicsBodyConfig bodyConfig)
+float Actor::GetWidthForHeight( float height )
 {
-#ifdef DYNAMICS_SUPPORT
-  Internal::DynamicsBodyConfig& internal = GetImplementation(bodyConfig);
+  return GetImplementation(*this).GetWidthForHeight( height );
+}
 
-  Internal::DynamicsBodyPtr body( GetImplementation(*this).EnableDynamics( &internal ) );
+float Actor::GetRelayoutSize( Dimension::Type dimension ) const
+{
+  return GetImplementation(*this).GetRelayoutSize( dimension );
+}
 
-  return DynamicsBody( body.Get() );
-#else
-  return DynamicsBody();
-#endif
+void Actor::RelayoutRequestTree()
+{
+  GetImplementation(*this).RelayoutRequestTree();
 }
 
-DynamicsJoint Actor::AddDynamicsJoint( Actor attachedActor, const Vector3& offset )
+void Actor::PropagateRelayoutFlags()
 {
-#ifdef DYNAMICS_SUPPORT
-  Internal::ActorPtr internalActor( &GetImplementation(attachedActor) );
-  Internal::DynamicsJointPtr joint( GetImplementation(*this).AddDynamicsJoint( internalActor, offset) );
+  GetImplementation(*this).PropagateRelayoutFlags();
+}
 
-  return DynamicsJoint( joint.Get() );
-#else
-  return DynamicsJoint();
-#endif
+void Actor::SetPadding( const Padding& padding )
+{
+  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::AddDynamicsJoint( Actor attachedActor, const Vector3& offsetA, const Vector3& offsetB )
+void Actor::GetPadding( Padding& paddingOut ) const
 {
-#ifdef DYNAMICS_SUPPORT
-  Internal::ActorPtr internalActor( &GetImplementation(attachedActor) );
-  Internal::DynamicsJointPtr joint( GetImplementation(*this).AddDynamicsJoint( internalActor, offsetA, offsetB) );
+  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;
 }
 
-int Actor::GetNumberOfJoints() const
+void Actor::SetMinimumSize( const Vector2& size )
 {
-#ifdef DYNAMICS_SUPPORT
-  return GetImplementation(*this).GetNumberOfJoints();
-#else
-  return int();
-#endif
+  Internal::Actor& impl = GetImplementation(*this);
+
+  impl.SetMinimumSize( size.x, Dimension::WIDTH );
+  impl.SetMinimumSize( size.y, Dimension::HEIGHT );
+}
+
+Vector2 Actor::GetMinimumSize()
+{
+  Internal::Actor& impl = GetImplementation(*this);
+
+  return Vector2( impl.GetMinimumSize( Dimension::WIDTH ), impl.GetMinimumSize( Dimension::HEIGHT ) );
 }
 
-DynamicsJoint Actor::GetDynamicsJointByIndex( const int index )
+void Actor::SetMaximumSize( const Vector2& size )
 {
-#ifdef DYNAMICS_SUPPORT
-  Internal::DynamicsJointPtr joint( GetImplementation(*this).GetDynamicsJointByIndex( index ) );
+  Internal::Actor& impl = GetImplementation(*this);
 
-  return DynamicsJoint( joint.Get() );
-#else
-  return DynamicsJoint();
-#endif
+  impl.SetMaximumSize( size.x, Dimension::WIDTH );
+  impl.SetMaximumSize( size.y, Dimension::HEIGHT );
 }
 
-DynamicsJoint Actor::GetDynamicsJoint( Actor attachedActor )
+Vector2 Actor::GetMaximumSize()
 {
-#ifdef DYNAMICS_SUPPORT
-  Internal::DynamicsJointPtr joint( GetImplementation(*this).GetDynamicsJoint( &GetImplementation(attachedActor) ) );
+  Internal::Actor& impl = GetImplementation(*this);
 
-  return DynamicsJoint( joint.Get() );
-#else
-  return DynamicsJoint();
-#endif
+  return Vector2( impl.GetMaximumSize( Dimension::WIDTH ), impl.GetMaximumSize( Dimension::HEIGHT ) );
 }
 
-void Actor::RemoveDynamicsJoint( DynamicsJoint joint )
+Actor::TouchSignalType& Actor::TouchedSignal()
 {
-#ifdef DYNAMICS_SUPPORT
-  GetImplementation(*this).RemoveDynamicsJoint( &GetImplementation(joint) );
-#endif
+  return GetImplementation(*this).TouchedSignal();
 }
 
-void Actor::DisableDynamics()
+Actor::HoverSignalType& Actor::HoveredSignal()
 {
-#ifdef DYNAMICS_SUPPORT
-  GetImplementation(*this).DisableDynamics();
-#endif
+  return GetImplementation(*this).HoveredSignal();
+}
+
+Actor::MouseWheelEventSignalType& Actor::MouseWheelEventSignal()
+{
+  return GetImplementation(*this).MouseWheelEventSignal();
+}
+
+Actor::OnStageSignalType& Actor::OnStageSignal()
+{
+  return GetImplementation(*this).OnStageSignal();
+}
+
+Actor::OffStageSignalType& Actor::OffStageSignal()
+{
+  return GetImplementation(*this).OffStageSignal();
 }
 
-DynamicsBody Actor::GetDynamicsBody()
+Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
 {
-#ifdef DYNAMICS_SUPPORT
-  Internal::DynamicsBodyPtr internal(GetImplementation(*this).GetDynamicsBody());
-  return DynamicsBody( internal.Get() );
-#else
-  return DynamicsBody();
-#endif
+  return GetImplementation(*this).OnRelayoutSignal();
 }
 
 Actor::Actor(Internal::Actor* internal)
-: Constrainable(internal)
+: Handle(internal)
 {
 }