Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / custom-actor-internal.h
index deed407..a70d884 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_CUSTOM_ACTOR_H__
-#define __DALI_INTERNAL_CUSTOM_ACTOR_H__
+#ifndef DALI_INTERNAL_CUSTOM_ACTOR_H
+#define DALI_INTERNAL_CUSTOM_ACTOR_H
 
 /*
- * Copyright (c) 2014 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.
  */
 
 // INTERNAL INCLUDES
-#include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/actors/actor-declarations.h>
+#include <dali/internal/event/actors/actor-impl.h>
 #include <dali/public-api/actors/custom-actor.h>
 #include <dali/public-api/animation/animation.h>
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 class CustomActor : public Actor
 {
 public:
-
   /**
    * Create a new custom actor.
    * @return A smart-pointer to the newly allocated Actor.
@@ -58,35 +55,40 @@ public:
     return *mImpl;
   }
 
-protected:
+  /**
+   * Get the type info associated with this object.
+   *
+   * @return The type info
+   */
+  Dali::TypeInfo GetTypeInfo();
 
+protected:
   /**
    * A reference counted object may only be deleted by calling Unreference()
    */
-  virtual ~CustomActor();
+  ~CustomActor() override;
 
 private:
-
   /**
-   * @copydoc Internal::Actor::OnStageConnectionExternal
+   * @copydoc Internal::Actor::OnSceneConnectionExternal
    */
-  virtual void OnStageConnectionExternal()
+  void OnSceneConnectionExternal(int32_t depth) override
   {
-    mImpl->OnStageConnection();
+    mImpl->OnSceneConnection(depth);
   }
 
   /**
-   * @copydoc Internal::Actor::OnStageDisconnectionExternal
+   * @copydoc Internal::Actor::OnSceneDisconnectionExternal
    */
-  virtual void OnStageDisconnectionExternal()
+  void OnSceneDisconnectionExternal() override
   {
-    mImpl->OnStageDisconnection();
+    mImpl->OnSceneDisconnection();
   }
 
   /**
    * @copydoc Internal::Actor::OnChildAdd
    */
-  virtual void OnChildAdd(Actor& child)
+  void OnChildAdd(Actor& child) override
   {
     Dali::Actor handle(&child);
     mImpl->OnChildAdd(handle);
@@ -95,7 +97,7 @@ private:
   /**
    * @copydoc Internal::Actor::OnChildRemove
    */
-  virtual void OnChildRemove(Actor& child)
+  void OnChildRemove(Actor& child) override
   {
     Dali::Actor handle(&child);
     mImpl->OnChildRemove(handle);
@@ -104,7 +106,7 @@ private:
   /**
    * @copydoc Internal::Actor::OnPropertySet
    */
-  virtual void OnPropertySet( Property::Index index, Property::Value propertyValue )
+  void OnPropertySet(Property::Index index, const Property::Value& propertyValue) override
   {
     mImpl->OnPropertySet(index, propertyValue);
   }
@@ -112,7 +114,7 @@ private:
   /**
    * @copydoc Internal::Actor::OnSizeSet
    */
-  virtual void OnSizeSet(const Vector3& targetSize)
+  void OnSizeSet(const Vector3& targetSize) override
   {
     mImpl->OnSizeSet(targetSize);
   }
@@ -120,65 +122,95 @@ private:
   /**
    * @copydoc Internal::Actor::OnSizeAnimation
    */
-  virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
+  void OnSizeAnimation(Animation& animation, const Vector3& targetSize) override
   {
     Dali::Animation animationHandle(&animation);
     mImpl->OnSizeAnimation(animationHandle, targetSize);
   }
 
   /**
-   * @copydoc Internal::Actor::OnTouchEvent
+   * @copydoc Internal::Actor::OnRelayout
    */
-  virtual bool OnTouchEvent(const TouchEvent& event)
+  void OnRelayout(const Vector2& size, RelayoutContainer& container) override
   {
-    return mImpl->OnTouchEvent(event);
+    mImpl->OnRelayout(size, container);
   }
 
   /**
-   * @copydoc Internal::Actor::OnHoverEvent
+   * @copydoc Internal::Actor::OnSetResizePolicy
    */
-  virtual bool OnHoverEvent(const HoverEvent& event)
+  void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) override
   {
-    return mImpl->OnHoverEvent(event);
+    mImpl->OnSetResizePolicy(policy, dimension);
   }
 
   /**
-   * @copydoc Internal::Actor::OnKeyEvent
+   * @copydoc Internal::Actor::GetNaturalSize
    */
-  virtual bool OnKeyEvent(const KeyEvent& event)
+  Vector3 GetNaturalSize() const override
   {
-    return mImpl->OnKeyEvent(event);
+    return mImpl->GetNaturalSize();
   }
 
   /**
-   * @copydoc Internal::Actor::OnMouseWheelEvent
+   * @copydoc Internal::Actor::CalculateChildSize
    */
-  virtual bool OnMouseWheelEvent(const MouseWheelEvent& event)
+  float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension) override
   {
-    return mImpl->OnMouseWheelEvent(event);
+    return mImpl->CalculateChildSize(child, dimension);
   }
 
   /**
-   * @copydoc Internal::Actor::GetNaturalSize
+   * @copydoc Internal::Actor::GetHeightForWidth
    */
-  virtual Vector3 GetNaturalSize() const
+  float GetHeightForWidth(float width) override
   {
-    return mImpl->GetNaturalSize();
+    return mImpl->GetHeightForWidth(width);
   }
 
   /**
-   * Private constructor; see also CustomActor::New()
+   * @copydoc Internal::Actor::GetWidthForHeight
+   */
+  float GetWidthForHeight(float height) override
+  {
+    return mImpl->GetWidthForHeight(height);
+  }
+
+  /**
+   * @copydoc Internal::Actor::RelayoutDependentOnChildren
+   */
+  bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) override
+  {
+    return mImpl->RelayoutDependentOnChildren(dimension);
+  }
+
+  /**
+   * @copydoc Internal::Actor::OnCalculateRelayoutSize
+   */
+  void OnCalculateRelayoutSize(Dimension::Type dimension) override
+  {
+    return mImpl->OnCalculateRelayoutSize(dimension);
+  }
+
+  /**
+   * @copydoc Internal::Actor::OnLayoutNegotiated
    */
-  CustomActor(CustomActorImpl& extension);
+  void OnLayoutNegotiated(float size, Dimension::Type dimension) override
+  {
+    return mImpl->OnLayoutNegotiated(size, dimension);
+  }
 
-  // Undefined
-  CustomActor(const CustomActor&);
+  /**
+   * Private constructor; see also CustomActor::New()
+   */
+  CustomActor(const SceneGraph::Node& node, CustomActorImpl& extension);
 
-  // Undefined
-  CustomActor& operator=(const CustomActor& rhs);
+  // no default or copy constructor or assignment
+  CustomActor()                   = delete;
+  CustomActor(const CustomActor&) = delete;
+  CustomActor& operator=(const CustomActor& rhs) = delete;
 
 protected:
-
   CustomActorImplPtr mImpl;
 };
 
@@ -188,7 +220,7 @@ protected:
 
 inline Internal::CustomActor& GetImpl(Dali::CustomActor& actor)
 {
-  DALI_ASSERT_ALWAYS( actor && "CustomActor handle is empty" );
+  DALI_ASSERT_ALWAYS(actor && "CustomActor handle is empty");
 
   BaseObject& handle = actor.GetBaseObject();
 
@@ -197,7 +229,7 @@ inline Internal::CustomActor& GetImpl(Dali::CustomActor& actor)
 
 inline const Internal::CustomActor& GetImpl(const Dali::CustomActor& actor)
 {
-  DALI_ASSERT_ALWAYS( actor && "CustomActor handle is empty" );
+  DALI_ASSERT_ALWAYS(actor && "CustomActor handle is empty");
 
   const BaseObject& handle = actor.GetBaseObject();
 
@@ -206,4 +238,4 @@ inline const Internal::CustomActor& GetImpl(const Dali::CustomActor& actor)
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_CUSTOM_ACTOR_H__
+#endif // DALI_INTERNAL_CUSTOM_ACTOR_H