Merge "Remove Actor::OnStage public API" into devel/master
[platform/core/uifw/dali-core.git] / dali / public-api / actors / actor.cpp
index 38c93b0..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/internal/event/size-negotiation/relayout-controller-impl.h>
 
 namespace Dali
 {
@@ -65,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();
@@ -105,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));
@@ -120,26 +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());
+  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
@@ -149,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)
+Vector3 Actor::GetTargetSize() const
 {
-  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
@@ -204,81 +125,11 @@ 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::TranslateBy(const Vector3& distance)
 {
   GetImplementation(*this).TranslateBy(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::SetOrientation(const Degree& angle, const Vector3& axis)
-{
-  GetImplementation(*this).SetOrientation(Radian(angle), axis);
-}
-
-void Actor::SetOrientation(const Radian& angle, const Vector3& axis)
-{
-  GetImplementation(*this).SetOrientation(angle, axis);
-}
-
-void Actor::SetOrientation(const Quaternion& orientation)
-{
-  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);
@@ -289,204 +140,137 @@ void Actor::RotateBy(const Quaternion& relativeRotation)
   GetImplementation(*this).RotateBy(relativeRotation);
 }
 
-Quaternion Actor::GetCurrentOrientation() const
-{
-  return GetImplementation(*this).GetCurrentOrientation();
-}
-
-void Actor::SetInheritOrientation(bool inherit)
-{
-  GetImplementation(*this).SetInheritOrientation(inherit);
-}
-
-bool Actor::IsOrientationInherited() const
-{
-  return GetImplementation(*this).IsOrientationInherited();
-}
-
-Quaternion Actor::GetCurrentWorldOrientation() const
-{
-  return GetImplementation(*this).GetCurrentWorldOrientation();
-}
-
-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)
+bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const
 {
-  GetImplementation(*this).SetSizeModeFactor(factor);
+  return GetImplementation(*this).ScreenToLocal(localX, localY, screenX, screenY);
 }
 
-Vector3 Actor::GetSizeModeFactor() const
+void Actor::Raise()
 {
-  return GetImplementation(*this).GetSizeModeFactor();
+  GetImplementation( *this ).Raise();
 }
 
-Matrix Actor::GetCurrentWorldMatrix() const
+void Actor::Lower()
 {
-  return GetImplementation(*this).GetCurrentWorldMatrix();
+  GetImplementation( *this ).Lower();
 }
 
-void Actor::SetVisible(bool visible)
+void Actor::RaiseToTop()
 {
-  GetImplementation(*this).SetVisible(visible);
+  GetImplementation( *this ).RaiseToTop();
 }
 
-bool Actor::IsVisible() const
+void Actor::LowerToBottom()
 {
-  return GetImplementation(*this).IsVisible();
+  GetImplementation( *this ).LowerToBottom();
 }
 
-void Actor::SetOpacity(float opacity)
+void Actor::RaiseAbove( Actor target )
 {
-  GetImplementation(*this).SetOpacity(opacity);
+  GetImplementation( *this ).RaiseAbove( GetImplementation( target ) );
 }
 
-float Actor::GetCurrentOpacity() const
+void Actor::LowerBelow( Actor target )
 {
-  return GetImplementation(*this).GetCurrentOpacity();
+  GetImplementation( *this ).LowerBelow( GetImplementation( target ) );
 }
 
-void Actor::SetColor(const Vector4& color)
+void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
 {
-  GetImplementation(*this).SetColor(color);
+  GetImplementation(*this).SetResizePolicy( policy, dimension );
 }
 
-Vector4 Actor::GetCurrentColor() const
+ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
 {
-  return GetImplementation(*this).GetCurrentColor();
+  return GetImplementation(*this).GetResizePolicy( dimension );
 }
 
-void Actor::SetColorMode( ColorMode colorMode )
+float Actor::GetHeightForWidth( float width )
 {
-  GetImplementation(*this).SetColorMode(colorMode);
+  return GetImplementation(*this).GetHeightForWidth( width );
 }
 
-ColorMode Actor::GetColorMode() const
+float Actor::GetWidthForHeight( float height )
 {
-  return GetImplementation(*this).GetColorMode();
+  return GetImplementation(*this).GetWidthForHeight( height );
 }
 
-Vector4 Actor::GetCurrentWorldColor() const
+float Actor::GetRelayoutSize( Dimension::Type dimension ) const
 {
-  return GetImplementation(*this).GetCurrentWorldColor();
+  return GetImplementation(*this).GetRelayoutSize( dimension );
 }
 
-void Actor::SetDrawMode( DrawMode::Type drawMode )
+Actor::TouchSignalType& Actor::TouchedSignal()
 {
-  GetImplementation(*this).SetDrawMode( drawMode );
-}
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: TouchedSignal() is deprecated and will be removed from next release. Use TouchSignal() instead.\n" );
 
-DrawMode::Type Actor::GetDrawMode() const
-{
-  return GetImplementation(*this).GetDrawMode();
+  return GetImplementation(*this).TouchedSignal();
 }
 
-void Actor::SetSensitive(bool sensitive)
+Actor::TouchDataSignalType& Actor::TouchSignal()
 {
-  GetImplementation(*this).SetSensitive(sensitive);
+  return GetImplementation( *this ).TouchSignal();
 }
 
-bool Actor::IsSensitive() const
+Actor::HoverSignalType& Actor::HoveredSignal()
 {
-  return GetImplementation(*this).IsSensitive();
+  return GetImplementation(*this).HoveredSignal();
 }
 
-bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const
+Actor::WheelEventSignalType& Actor::WheelEventSignal()
 {
-  return GetImplementation(*this).ScreenToLocal(localX, localY, screenX, screenY);
+  return GetImplementation(*this).WheelEventSignal();
 }
 
-void Actor::SetLeaveRequired(bool required)
+Actor::OnStageSignalType& Actor::OnStageSignal()
 {
-  GetImplementation(*this).SetLeaveRequired(required);
+  return GetImplementation(*this).OnStageSignal();
 }
 
-bool Actor::GetLeaveRequired() const
+Actor::OffStageSignalType& Actor::OffStageSignal()
 {
-  return GetImplementation(*this).GetLeaveRequired();
+  return GetImplementation(*this).OffStageSignal();
 }
 
-void Actor::SetKeyboardFocusable( bool focusable )
+uint32_t Actor::AddRenderer( Renderer& renderer )
 {
-  GetImplementation(*this).SetKeyboardFocusable(focusable);
+  return GetImplementation(*this).AddRenderer( GetImplementation( renderer ) );
 }
 
-bool Actor::IsKeyboardFocusable() const
+uint32_t Actor::GetRendererCount() const
 {
-  return GetImplementation(*this).IsKeyboardFocusable();
+  return GetImplementation(*this).GetRendererCount();
 }
 
-Actor::TouchSignalType& Actor::TouchedSignal()
+Renderer Actor::GetRendererAt( uint32_t index )
 {
-  return GetImplementation(*this).TouchedSignal();
+  Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt( index );
+  return Renderer( renderer.Get() );
 }
 
-Actor::HoverSignalType& Actor::HoveredSignal()
+void Actor::RemoveRenderer( Renderer& renderer )
 {
-  return GetImplementation(*this).HoveredSignal();
+  GetImplementation(*this).RemoveRenderer( GetImplementation( renderer ) );
 }
 
-Actor::MouseWheelEventSignalType& Actor::MouseWheelEventSignal()
+void Actor::RemoveRenderer( uint32_t index )
 {
-  return GetImplementation(*this).MouseWheelEventSignal();
+  GetImplementation(*this).RemoveRenderer( index );
 }
 
-Actor::OnStageSignalType& Actor::OnStageSignal()
+Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
 {
-  return GetImplementation(*this).OnStageSignal();
+  return GetImplementation(*this).OnRelayoutSignal();
 }
 
-Actor::OffStageSignalType& Actor::OffStageSignal()
+Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal()
 {
-  return GetImplementation(*this).OffStageSignal();
+  return GetImplementation( *this ).LayoutDirectionChangedSignal();
 }
 
 Actor::Actor(Internal::Actor* internal)
@@ -494,13 +278,4 @@ Actor::Actor(Internal::Actor* internal)
 {
 }
 
-void UnparentAndReset( Actor& actor )
-{
-  if( actor )
-  {
-    actor.Unparent();
-    actor.Reset();
-  }
-}
-
 } // namespace Dali