#define DALI_INTERNAL_ACTOR_H
/*
- * Copyright (c) 2020 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/devel-api/actors/actor-devel.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
+#include <dali/internal/common/const-string.h>
#include <dali/internal/common/internal-constants.h>
#include <dali/internal/common/memory-pool-object-allocator.h>
#include <dali/internal/event/actors/actor-declarations.h>
#include <dali/internal/event/actors/actor-parent.h>
#include <dali/internal/event/common/object-impl.h>
#include <dali/internal/event/common/stage-def.h>
-#include <dali/internal/event/rendering/renderer-impl.h>
-#include <dali/internal/update/manager/update-manager.h>
#include <dali/internal/update/nodes/node-declarations.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/common/dali-common.h>
class Renderer;
class Scene;
+using RendererPtr = IntrusivePtr<Renderer>;
using RendererContainer = std::vector<RendererPtr>;
using RendererIter = RendererContainer::iterator;
* Retrieve the name of the actor.
* @return The name.
*/
- const std::string& GetName() const
+ std::string_view GetName() const
{
- return mName;
+ return mName.GetStringView();
}
/**
* Set the name of the actor.
* @param[in] name The new name.
*/
- void SetName(const std::string& name);
+ void SetName(std::string_view name);
/**
* @copydoc Dali::Actor::GetId
/**
* @copydoc Dali::Internal::ActorParent::Add()
*/
- void Add(Actor& child) override;
+ void Add(Actor& child, bool notify = true) override;
/**
* @copydoc Dali::Internal::ActorParent::Remove()
*/
- void Remove(Actor& child) override;
+ void Remove(Actor& child, bool notify = true) override;
+
+ /**
+ * @copydoc Dali::DevelActor::SwitchParent()
+ */
+ void SwitchParent(Actor& newParent);
/**
* @copydoc Dali::Actor::Unparent
/**
* @copydoc Dali::Internal::ActorParent::FindChildByName
*/
- ActorPtr FindChildByName(const std::string& actorName) override;
+ ActorPtr FindChildByName(ConstString actorName) override;
/**
* @copydoc Dali::Internal::ActorParent::FindChildById
Rect<> CalculateScreenExtents() const;
/**
+ * @copydoc DevelActor::SetNeedGesturePropagation.
+ */
+ void SetNeedGesturePropagation(bool propagation);
+
+ /**
+ * Retrieve need gesture propagation value
+ * @return The actor's need gesture propagation value.
+ */
+ bool NeedGesturePropagation();
+
+ /**
* Sets the size of an actor.
* This does not interfere with the actors scale factor.
* @param [in] width The new width.
void RemoveRenderer(uint32_t index);
/**
- * Set BlendEquation at each renderer that added on this Actor.
+ * @brief Set BlendEquation at each renderer that added on this Actor.
*/
void SetBlendEquation(DevelBlendEquation::Type blendEquation);
*/
DevelBlendEquation::Type GetBlendEquation() const;
+ /**
+ * @brief Set this Actor is transparent or not without any affection on the child Actors.
+ */
+ void SetTransparent(bool transparent);
+
+ /**
+ * @brief Get this Actor is transparent or not.
+ */
+ bool IsTransparent() const;
+
public:
/**
* Converts screen coordinates into the actor's coordinate system.
}
/**
- * Sets the touch area of an actor.
- * @param [in] area The new area.
+ * Sets the touch area offset of an actor.
+ * @param [in] offset The new offset of area (left, right, bottom, top).
*/
- void SetTouchArea(Vector2 area)
+ void SetTouchAreaOffset(Rect<int> offset)
{
- mTouchArea = area;
+ mTouchAreaOffset = offset;
}
/**
- * Retrieve the Actor's touch area.
- * @return The Actor's touch area.
+ * Retrieve the Actor's touch area offset.
+ * @return The Actor's touch area offset.
*/
- const Vector2& GetTouchArea() const
+ const Rect<int>& GetTouchAreaOffset() const
{
- return mTouchArea;
+ return mTouchAreaOffset;
}
// Gestures
* Retrieve the actor's node.
* @return The node used by this actor
*/
- const SceneGraph::Node& GetNode() const
- {
- return *static_cast<const SceneGraph::Node*>(mUpdateObject);
- }
+ const SceneGraph::Node& GetNode() const;
/**
* @copydoc Dali::DevelActor::Raise()
/**
* Set the actor's parent.
* @param[in] parent The new parent.
+ * @param[in] keepOnScene Keep this actor to be on Scene if this is true.
*/
- void SetParent(ActorParent* parent);
+ void SetParent(ActorParent* parent, bool keepOnScene = false);
/**
* For use in derived classes, called after Initialize()
Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
Vector3 mTargetScale; ///< Event-side storage for scale
Vector3 mAnimatedSize; ///< Event-side storage for size animation
- Vector2 mTouchArea; ///< touch area
+ Rect<int> mTouchAreaOffset; ///< touch area offset (left, right, bottom, top)
- std::string mName; ///< Name of the actor
+ ConstString mName; ///< Name of the actor
uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported
uint16_t mUseAnimatedSize; ///< Whether the size is animated.
bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent.
bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area.
+ bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
+ bool mNeedGesturePropagation : 1; ///< Whether the parent listens for gesture events or not
LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left.
DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use.
DevelBlendEquation::Type mBlendEquation : 16; ///< Cached: Determines which blend equation will be used to render renderers.
- bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
private:
static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)