Ensure BaseHandle class move noexcept (core public-api)
[platform/core/uifw/dali-core.git] / dali / public-api / actors / actor.cpp
index 7a7d0bd..0c1b911 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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/math/radian.h>
 #include <dali/public-api/math/vector2.h>
 
+#include <dali/internal/common/const-string.h>
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/actors/layer-impl.h>
-#include <dali/internal/event/rendering/renderer-impl.h>
 #include <dali/internal/event/animation/constraint-impl.h>
+#include <dali/internal/event/rendering/renderer-impl.h>
 #include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
 
 namespace Dali
 {
-
-Actor::Actor()
-{
-}
+Actor::Actor() = default;
 
 Actor Actor::New()
 {
@@ -45,55 +43,20 @@ Actor Actor::New()
   return Actor(internal.Get());
 }
 
-Actor Actor::DownCast( BaseHandle handle )
-{
-  return Actor( dynamic_cast<Dali::Internal::Actor*>(handle.GetObjectPtr()) );
-}
-
-Actor::~Actor()
-{
-}
-
-Actor::Actor(const Actor& copy)
-: Handle(copy)
-{
-}
-
-Actor& Actor::operator=(const Actor& rhs)
+Actor Actor::DownCast(BaseHandle handle)
 {
-  BaseHandle::operator=(rhs);
-  return *this;
+  return Actor(dynamic_cast<Dali::Internal::Actor*>(handle.GetObjectPtr()));
 }
 
-const std::string& Actor::GetName() const
-{
-  return GetImplementation(*this).GetName();
-}
+Actor::~Actor() = default;
 
-void Actor::SetName(const std::string& name)
-{
-  GetImplementation(*this).SetName(name);
-}
+Actor::Actor(const Actor& copy) = default;
 
-unsigned int Actor::GetId() const
-{
-  return GetImplementation(*this).GetId();
-}
+Actor& Actor::operator=(const Actor& rhs) = default;
 
-bool Actor::IsRoot() const
-{
-  return GetImplementation(*this).IsRoot();
-}
+Actor::Actor(Actor&& rhs) noexcept = default;
 
-bool Actor::OnStage() const
-{
-  return GetImplementation(*this).OnStage();
-}
-
-bool Actor::IsLayer() const
-{
-  return GetImplementation(*this).IsLayer();
-}
+Actor& Actor::operator=(Actor&& rhs) noexcept = default;
 
 Layer Actor::GetLayer()
 {
@@ -115,27 +78,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
 {
-  Internal::ActorPtr child = GetImplementation(*this).GetChildAt( index );
-  return Actor( child.Get() );
+  Internal::ActorPtr child = GetImplementation(*this).GetChildAt(index);
+  return Actor(child.Get());
 }
 
-Actor Actor::FindChildByName(const std::string& actorName)
+Actor Actor::FindChildByName(std::string_view actorName)
 {
-  Internal::ActorPtr child = GetImplementation(*this).FindChildByName( actorName );
-  return Actor( child.Get() );
+  Internal::ActorPtr child = GetImplementation(*this).FindChildByName(Internal::ConstString(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
@@ -145,126 +108,21 @@ 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::GetTargetSize() const
 {
   return GetImplementation(*this).GetTargetSize();
 }
 
-Vector3 Actor::GetCurrentSize() const
-{
-  return GetImplementation(*this).GetCurrentSize();
-}
-
 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 Radian& angle, const Vector3& axis)
-{
-  GetImplementation(*this).SetOrientation(angle, axis);
-}
-
-void Actor::SetOrientation(const Quaternion& orientation)
-{
-  GetImplementation(*this).SetOrientation(orientation);
-}
-
 void Actor::RotateBy(const Radian& angle, const Vector3& axis)
 {
   GetImplementation(*this).RotateBy(angle, axis);
@@ -275,266 +133,72 @@ 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::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);
-}
-
-float Actor::GetCurrentOpacity() const
-{
-  return GetImplementation(*this).GetCurrentOpacity();
-}
-
-void Actor::SetColor(const Vector4& color)
-{
-  GetImplementation(*this).SetColor(color);
-}
-
-Vector4 Actor::GetCurrentColor() const
-{
-  return GetImplementation(*this).GetCurrentColor();
-}
-
-void Actor::SetColorMode( ColorMode colorMode )
-{
-  GetImplementation(*this).SetColorMode(colorMode);
-}
-
-ColorMode Actor::GetColorMode() const
-{
-  return GetImplementation(*this).GetColorMode();
-}
-
-Vector4 Actor::GetCurrentWorldColor() const
-{
-  return GetImplementation(*this).GetCurrentWorldColor();
-}
-
-void Actor::SetDrawMode( DrawMode::Type drawMode )
-{
-  GetImplementation(*this).SetDrawMode( drawMode );
-}
-
-DrawMode::Type Actor::GetDrawMode() const
-{
-  return GetImplementation(*this).GetDrawMode();
-}
-
-void Actor::SetSensitive(bool sensitive)
-{
-  GetImplementation(*this).SetSensitive(sensitive);
-}
-
-bool Actor::IsSensitive() const
-{
-  return GetImplementation(*this).IsSensitive();
-}
-
 bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const
 {
   return GetImplementation(*this).ScreenToLocal(localX, localY, screenX, screenY);
 }
 
-void Actor::SetLeaveRequired(bool required)
-{
-  GetImplementation(*this).SetLeaveRequired(required);
-}
-
-bool Actor::GetLeaveRequired() const
-{
-  return GetImplementation(*this).GetLeaveRequired();
-}
-
-void Actor::SetKeyboardFocusable( bool focusable )
-{
-  GetImplementation(*this).SetKeyboardFocusable(focusable);
-}
-
-bool Actor::IsKeyboardFocusable() const
+void Actor::Raise()
 {
-  return GetImplementation(*this).IsKeyboardFocusable();
+  GetImplementation(*this).Raise();
 }
 
-void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
+void Actor::Lower()
 {
-  GetImplementation(*this).SetResizePolicy( policy, dimension );
+  GetImplementation(*this).Lower();
 }
 
-ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
+void Actor::RaiseToTop()
 {
-  return GetImplementation(*this).GetResizePolicy( dimension );
+  GetImplementation(*this).RaiseToTop();
 }
 
-void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy )
+void Actor::LowerToBottom()
 {
-  GetImplementation(*this).SetSizeScalePolicy( policy );
+  GetImplementation(*this).LowerToBottom();
 }
 
-SizeScalePolicy::Type Actor::GetSizeScalePolicy() const
+void Actor::RaiseAbove(Actor target)
 {
-  return GetImplementation(*this).GetSizeScalePolicy();
+  GetImplementation(*this).RaiseAbove(GetImplementation(target));
 }
 
-float Actor::GetHeightForWidth( float width )
+void Actor::LowerBelow(Actor target)
 {
-  return GetImplementation(*this).GetHeightForWidth( width );
+  GetImplementation(*this).LowerBelow(GetImplementation(target));
 }
 
-float Actor::GetWidthForHeight( float height )
+void Actor::SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
 {
-  return GetImplementation(*this).GetWidthForHeight( height );
+  GetImplementation(*this).SetResizePolicy(policy, dimension);
 }
 
-float Actor::GetRelayoutSize( Dimension::Type dimension ) const
+ResizePolicy::Type Actor::GetResizePolicy(Dimension::Type dimension) const
 {
-  return GetImplementation(*this).GetRelayoutSize( dimension );
+  return GetImplementation(*this).GetResizePolicy(dimension);
 }
 
-void Actor::SetPadding( const Padding& padding )
+float Actor::GetHeightForWidth(float width)
 {
-  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 );
+  return GetImplementation(*this).GetHeightForWidth(width);
 }
 
-void Actor::GetPadding( Padding& paddingOut ) const
+float Actor::GetWidthForHeight(float height)
 {
-  const Internal::Actor& impl = GetImplementation(*this);
-
-  Vector2 widthPadding = impl.GetPadding( Dimension::WIDTH );
-  Vector2 heightPadding = impl.GetPadding( Dimension::HEIGHT );
-
-  paddingOut.left = widthPadding.x;
-  paddingOut.right = widthPadding.y;
-  paddingOut.bottom = heightPadding.x;
-  paddingOut.top = heightPadding.y;
+  return GetImplementation(*this).GetWidthForHeight(height);
 }
 
-void Actor::SetMinimumSize( const Vector2& size )
+float Actor::GetRelayoutSize(Dimension::Type dimension) const
 {
-  Internal::Actor& impl = GetImplementation(*this);
-
-  impl.SetMinimumSize( size.x, Dimension::WIDTH );
-  impl.SetMinimumSize( size.y, Dimension::HEIGHT );
+  return GetImplementation(*this).GetRelayoutSize(dimension);
 }
 
-Vector2 Actor::GetMinimumSize()
-{
-  Internal::Actor& impl = GetImplementation(*this);
-
-  return Vector2( impl.GetMinimumSize( Dimension::WIDTH ), impl.GetMinimumSize( Dimension::HEIGHT ) );
-}
-
-void Actor::SetMaximumSize( const Vector2& size )
-{
-  Internal::Actor& impl = GetImplementation(*this);
-
-  impl.SetMaximumSize( size.x, Dimension::WIDTH );
-  impl.SetMaximumSize( size.y, Dimension::HEIGHT );
-}
-
-Vector2 Actor::GetMaximumSize()
-{
-  Internal::Actor& impl = GetImplementation(*this);
-
-  return Vector2( impl.GetMaximumSize( Dimension::WIDTH ), impl.GetMaximumSize( Dimension::HEIGHT ) );
-}
-
-int Actor::GetHierarchyDepth()
-{
-  return GetImplementation(*this).GetHierarchyDepth();
-}
-
-Actor::TouchSignalType& Actor::TouchedSignal()
+Actor::TouchEventSignalType& Actor::TouchedSignal()
 {
   return GetImplementation(*this).TouchedSignal();
 }
@@ -549,40 +213,40 @@ Actor::WheelEventSignalType& Actor::WheelEventSignal()
   return GetImplementation(*this).WheelEventSignal();
 }
 
-Actor::OnStageSignalType& Actor::OnStageSignal()
+Actor::OnSceneSignalType& Actor::OnSceneSignal()
 {
-  return GetImplementation(*this).OnStageSignal();
+  return GetImplementation(*this).OnSceneSignal();
 }
 
-Actor::OffStageSignalType& Actor::OffStageSignal()
+Actor::OffSceneSignalType& Actor::OffSceneSignal()
 {
-  return GetImplementation(*this).OffStageSignal();
+  return GetImplementation(*this).OffSceneSignal();
 }
 
-unsigned int Actor::AddRenderer( Renderer& renderer )
+uint32_t Actor::AddRenderer(Renderer& renderer)
 {
-  return GetImplementation(*this).AddRenderer( GetImplementation( 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)
 {
-  Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt( index );
-  return Renderer( renderer.Get() );
+  Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt(index);
+  return Renderer(renderer.Get());
 }
 
-void Actor::RemoveRenderer( Renderer& renderer )
+void Actor::RemoveRenderer(Renderer& renderer)
 {
-  GetImplementation(*this).RemoveRenderer( GetImplementation( renderer ) );
+  GetImplementation(*this).RemoveRenderer(GetImplementation(renderer));
 }
 
-void Actor::RemoveRenderer( unsigned int index )
+void Actor::RemoveRenderer(uint32_t index)
 {
-  GetImplementation(*this).RemoveRenderer( index );
+  GetImplementation(*this).RemoveRenderer(index);
 }
 
 Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
@@ -590,6 +254,11 @@ Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
   return GetImplementation(*this).OnRelayoutSignal();
 }
 
+Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal()
+{
+  return GetImplementation(*this).LayoutDirectionChangedSignal();
+}
+
 Actor::Actor(Internal::Actor* internal)
 : Handle(internal)
 {