Merge "Remove Actor::OnStage public API" into devel/master
[platform/core/uifw/dali-core.git] / dali / public-api / actors / actor.cpp
index 2293fbb..cf897e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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/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
 {
 
-const char* const Actor::SIGNAL_TOUCHED = "touched";
-const char* const Actor::SIGNAL_HOVERED = "hovered";
-const char* const Actor::SIGNAL_MOUSE_WHEEL_EVENT = "mouse-wheel-event";
-const char* const Actor::SIGNAL_ON_STAGE = "on-stage";
-const char* const Actor::SIGNAL_OFF_STAGE = "off-stage";
-
-const char* const Actor::ACTION_SHOW = "show";
-const char* const Actor::ACTION_HIDE = "hide";
-
 Actor::Actor()
 {
 }
@@ -76,7 +55,7 @@ Actor::~Actor()
 }
 
 Actor::Actor(const Actor& copy)
-: Constrainable(copy)
+: Handle(copy)
 {
 }
 
@@ -86,36 +65,6 @@ Actor& Actor::operator=(const Actor& rhs)
   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();
@@ -126,11 +75,6 @@ void Actor::Add(Actor actor)
   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));
@@ -141,32 +85,27 @@ void Actor::Unparent()
   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
@@ -176,54 +115,9 @@ Actor Actor::GetParent() const
   return Actor(parent);
 }
 
-void Actor::SetParentOrigin(const Vector3& origin)
-{
-  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
+Vector3 Actor::GetTargetSize() const
 {
-  return GetImplementation(*this).GetCurrentSize();
+  return GetImplementation(*this).GetTargetSize();
 }
 
 Vector3 Actor::GetNaturalSize() const
@@ -231,79 +125,9 @@ 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)
-{
-  GetImplementation(*this).SetRotation(angle, axis);
-}
-
-void Actor::SetRotation(const Quaternion& rotation)
+void Actor::TranslateBy(const Vector3& distance)
 {
-  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)
@@ -316,194 +140,81 @@ void Actor::RotateBy(const Quaternion& relativeRotation)
   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()
@@ -511,9 +222,9 @@ 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()
@@ -526,110 +237,45 @@ Actor::OffStageSignalType& Actor::OffStageSignal()
   return GetImplementation(*this).OffStageSignal();
 }
 
-DynamicsBody Actor::EnableDynamics(DynamicsBodyConfig bodyConfig)
+uint32_t Actor::AddRenderer( Renderer& renderer )
 {
-#ifdef DYNAMICS_SUPPORT
-  Internal::DynamicsBodyConfig& internal = GetImplementation(bodyConfig);
-
-  Internal::DynamicsBodyPtr body( GetImplementation(*this).EnableDynamics( &internal ) );
-
-  return DynamicsBody( body.Get() );
-#else
-  return DynamicsBody();
-#endif
+  return GetImplementation(*this).AddRenderer( GetImplementation( renderer ) );
 }
 
-DynamicsJoint Actor::AddDynamicsJoint( Actor attachedActor, const Vector3& offset )
+uint32_t Actor::GetRendererCount() const
 {
-#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).GetRendererCount();
 }
 
-DynamicsJoint Actor::AddDynamicsJoint( Actor attachedActor, const Vector3& offsetA, const Vector3& offsetB )
+Renderer Actor::GetRendererAt( uint32_t index )
 {
-#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
+  Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt( index );
+  return Renderer( renderer.Get() );
 }
 
-int Actor::GetNumberOfJoints() const
+void Actor::RemoveRenderer( Renderer& renderer )
 {
-#ifdef DYNAMICS_SUPPORT
-  return GetImplementation(*this).GetNumberOfJoints();
-#else
-  return int();
-#endif
+  GetImplementation(*this).RemoveRenderer( GetImplementation( renderer ) );
 }
 
-DynamicsJoint Actor::GetDynamicsJointByIndex( const int index )
+void Actor::RemoveRenderer( uint32_t 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
+  GetImplementation(*this).RemoveRenderer( index );
 }
 
-void Actor::RemoveDynamicsJoint( DynamicsJoint joint )
+Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
 {
-#ifdef DYNAMICS_SUPPORT
-  GetImplementation(*this).RemoveDynamicsJoint( &GetImplementation(joint) );
-#endif
+  return GetImplementation(*this).OnRelayoutSignal();
 }
 
-void Actor::DisableDynamics()
+Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal()
 {
-#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)
-: Constrainable(internal)
-{
-}
-
-void UnparentAndReset( Actor& actor )
+: Handle(internal)
 {
-  if( actor )
-  {
-    actor.Unparent();
-    actor.Reset();
-  }
 }
 
 } // namespace Dali