#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.
#include <string>
// INTERNAL INCLUDES
-#include <dali/public-api/actors/actor.h>
#include <dali/devel-api/actors/actor-devel.h>
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/events/gesture.h>
-#include <dali/public-api/math/viewport.h>
-#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/size-negotiation/relayout-container.h>
-#include <dali/devel-api/events/gesture-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-impl.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/nodes/node-declarations.h>
-#include <dali/internal/update/manager/update-manager.h>
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/events/gesture.h>
+#include <dali/public-api/math/viewport.h>
+#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/size-negotiation/relayout-container.h>
namespace Dali
{
-
-struct KeyEvent;
+class KeyEvent;
class TouchData;
class TouchEvent;
-struct WheelEvent;
+class WheelEvent;
namespace Internal
{
-
class Actor;
class ActorGestureData;
class Animation;
class Renderer;
class Scene;
-typedef std::vector< ActorPtr > ActorContainer;
-typedef ActorContainer::iterator ActorIter;
-typedef ActorContainer::const_iterator ActorConstIter;
-
-typedef std::vector< RendererPtr > RendererContainer;
-typedef RendererContainer::iterator RendererIter;
+using RendererPtr = IntrusivePtr<Renderer>;
+using RendererContainer = std::vector<RendererPtr>;
+using RendererIter = RendererContainer::iterator;
class ActorDepthTreeNode;
-typedef Dali::Internal::MemoryPoolObjectAllocator< ActorDepthTreeNode > DepthNodeMemoryPool;
+using DepthNodeMemoryPool = Dali::Internal::MemoryPoolObjectAllocator<ActorDepthTreeNode>;
/**
- * Actor is the primary object which Dali applications interact with.
+ * Actor is the primary object with which Dali applications interact.
* UI controls can be built by combining multiple actors.
* Multi-Touch events are received through signals emitted by the actor tree.
*
* The scene-graph can be updated in a separate thread, so the connection is done using an asynchronous message.
* When a tree of Actors is detached from the Stage, a message is sent to destroy the associated nodes.
*/
-class Actor : public Object
+class Actor : public Object, public ActorParent
{
public:
-
/**
* @brief Struct to hold an actor and a dimension
*/
* @param[in] newActor The actor to assign
* @param[in] newDimension The dimension to assign
*/
- ActorDimensionPair( Actor* newActor, Dimension::Type newDimension )
- : actor( newActor ),
- dimension( newDimension )
+ ActorDimensionPair(Actor* newActor, Dimension::Type newDimension)
+ : actor(newActor),
+ dimension(newDimension)
{
}
* @param[in] lhs The left hand side argument
* @param[in] rhs The right hand side argument
*/
- bool operator== ( const ActorDimensionPair& rhs )
+ bool operator==(const ActorDimensionPair& rhs)
{
- return ( actor == rhs.actor ) && ( dimension == rhs.dimension );
+ return (actor == rhs.actor) && (dimension == rhs.dimension);
}
- Actor* actor; ///< The actor to hold
- Dimension::Type dimension; ///< The dimension to hold
+ Actor* actor; ///< The actor to hold
+ Dimension::Type dimension; ///< The dimension to hold
};
- typedef std::vector< ActorDimensionPair > ActorDimensionStack;
+ using ActorDimensionStack = std::vector<ActorDimensionPair>;
public:
-
/**
* Create a new actor.
* @return A smart-pointer to the newly allocated Actor.
* Retrieve the name of the actor.
* @return The name.
*/
- const std::string& GetName() const;
+ std::string_view GetName() const
+ {
+ 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
/**
* Query whether the actor is connected to the Scene.
*/
- bool OnScene() const;
+ bool OnScene() const
+ {
+ return mIsOnScene;
+ }
/**
* Query whether the actor has any renderers.
Dali::Layer GetLayer();
/**
- * Adds a child Actor to this Actor.
- * @pre The child actor is not the same as the parent actor.
- * @pre The child actor does not already have a parent.
- * @param [in] child The child.
- * @post The child will be referenced by its parent.
+ * @copydoc Dali::Internal::ActorParent::Add()
+ */
+ void Add(Actor& child, bool notify = true) override;
+
+ /**
+ * @copydoc Dali::Internal::ActorParent::Remove()
*/
- void Add( Actor& child );
+ void Remove(Actor& child, bool notify = true) override;
/**
- * Removes a child Actor from this Actor.
- * @param [in] child The child.
- * @post The child will be unreferenced.
+ * @copydoc Dali::DevelActor::SwitchParent()
*/
- void Remove( Actor& child );
+ void SwitchParent(Actor& newParent);
/**
* @copydoc Dali::Actor::Unparent
void Unparent();
/**
- * Retrieve the number of children held by the actor.
- * @return The number of children
+ * @copydoc Dali::Internal::ActorParent::GetChildCount()
*/
- uint32_t GetChildCount() const;
+ uint32_t GetChildCount() const override;
/**
- * @copydoc Dali::Actor::GetChildAt
+ * @copydoc Dali::Internal::ActorParent::GetChildAt
*/
- ActorPtr GetChildAt( uint32_t index ) const;
+ ActorPtr GetChildAt(uint32_t index) const override;
/**
* Retrieve a reference to Actor's children.
* @return A reference to the container of children.
* @note The internal container is lazily initialized so ensure you check the child count before using the value returned by this method.
*/
- ActorContainer& GetChildrenInternal()
- {
- return *mChildren;
- }
+ ActorContainer& GetChildrenInternal();
/**
- * @copydoc Dali::Actor::FindChildByName
+ * @copydoc Dali::Internal::ActorParent::FindChildByName
*/
- ActorPtr FindChildByName( const std::string& actorName );
+ ActorPtr FindChildByName(ConstString actorName) override;
/**
- * @copydoc Dali::Actor::FindChildById
+ * @copydoc Dali::Internal::ActorParent::FindChildById
*/
- ActorPtr FindChildById( const uint32_t id );
+ ActorPtr FindChildById(const uint32_t id) override;
+
+ /**
+ * @copydoc Dali::Internal::ActorParent::UnparentChildren
+ */
+ void UnparentChildren() override;
/**
* Retrieve the parent of an Actor.
*/
Actor* GetParent() const
{
- return mParent;
+ return static_cast<Actor*>(mParent);
}
/**
*
* @return pair of two values, position of top-left corner on screen and size respectively.
*/
- Rect<> CalculateScreenExtents( ) const;
+ 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.
* @param [in] width The new width.
* @param [in] height The new height.
*/
- void SetSize( float width, float height );
+ void SetSize(float width, float height);
/**
* Sets the size of an actor.
* @param [in] height The size of the actor along the y-axis.
* @param [in] depth The size of the actor along the z-axis.
*/
- void SetSize( float width, float height, float depth );
+ void SetSize(float width, float height, float depth);
/**
* Sets the size of an actor.
* This does not interfere with the actors scale factor.
* @param [in] size The new size.
*/
- void SetSize( const Vector2& size );
+ void SetSize(const Vector2& size);
/**
* Sets the update size for an actor.
*
* @param[in] size The size to set.
*/
- void SetSizeInternal( const Vector2& size );
+ void SetSizeInternal(const Vector2& size);
/**
* Sets the size of an actor.
* This does not interfere with the actors scale factor.
* @param [in] size The new size.
*/
- void SetSize( const Vector3& size );
+ void SetSize(const Vector3& size);
/**
* Sets the update size for an actor.
*
* @param[in] size The size to set.
*/
- void SetSizeInternal( const Vector3& size );
+ void SetSizeInternal(const Vector3& size);
/**
* Set the width component of the Actor's size.
* @param [in] width The new width component.
*/
- void SetWidth( float width );
+ void SetWidth(float width);
/**
* Set the height component of the Actor's size.
* @param [in] height The new height component.
*/
- void SetHeight( float height );
+ void SetHeight(float height);
/**
* Set the depth component of the Actor's size.
* @param [in] depth The new depth component.
*/
- void SetDepth( float depth );
+ void SetDepth(float depth);
/**
* Retrieve the Actor's size from event side.
* An actor position is the distance between this origin, and the actors anchor-point.
* @param [in] origin The new parent-origin.
*/
- void SetParentOrigin( const Vector3& origin );
-
- /**
- * Set the x component of the parent-origin
- * @param [in] x The new x value.
- */
- void SetParentOriginX( float x );
-
- /**
- * Set the y component of the parent-origin
- * @param [in] y The new y value.
- */
- void SetParentOriginY( float y );
-
- /**
- * Set the z component of the parent-origin
- * @param [in] z The new z value.
- */
- void SetParentOriginZ( float z );
+ void SetParentOrigin(const Vector3& origin);
/**
* Retrieve the parent-origin of an actor.
* An actor's rotation is centered around its anchor-point.
* @param [in] anchorPoint The new anchor-point.
*/
- void SetAnchorPoint( const Vector3& anchorPoint );
-
- /**
- * Set the x component of the anchor-point.
- * @param [in] x The new x value.
- */
- void SetAnchorPointX( float x );
-
- /**
- * Set the y component of the anchor-point.
- * @param [in] y The new y value.
- */
- void SetAnchorPointY( float y );
-
- /**
- * Set the z component of the anchor-point.
- * @param [in] z The new z value.
- */
- void SetAnchorPointZ( float z );
+ void SetAnchorPoint(const Vector3& anchorPoint);
/**
* Retrieve the anchor-point of an actor.
* @param [in] x The new x position
* @param [in] y The new y position
*/
- void SetPosition( float x, float y );
+ void SetPosition(float x, float y);
/**
* Sets the position of the Actor.
* @param [in] y The new y position
* @param [in] z The new z position
*/
- void SetPosition( float x, float y, float z );
+ void SetPosition(float x, float y, float z);
/**
* Sets the position of the Actor.
* The coordinates are relative to the Actor's parent.
* @param [in] position The new position.
*/
- void SetPosition( const Vector3& position );
+ void SetPosition(const Vector3& position);
/**
* Set the position of an actor along the X-axis.
* @param [in] x The new x position
*/
- void SetX( float x );
+ void SetX(float x);
/**
* Set the position of an actor along the Y-axis.
* @param [in] y The new y position.
*/
- void SetY( float y );
+ void SetY(float y);
/**
* Set the position of an actor along the Z-axis.
* @param [in] z The new z position
*/
- void SetZ( float z );
+ void SetZ(float z);
/**
* Translate an actor relative to its existing position.
* @param[in] distance The actor will move by this distance.
*/
- void TranslateBy( const Vector3& distance );
+ void TranslateBy(const Vector3& distance);
/**
* Retrieve the position of the Actor.
* The coordinates are relative to the Actor's parent.
* @return the Actor's position.
*/
- const Vector3& GetTargetPosition() const;
+ const Vector3& GetTargetPosition() const
+ {
+ return mTargetPosition;
+ }
/**
* @copydoc Dali::Actor::GetCurrentWorldPosition()
/**
* @copydoc Dali::Actor::SetInheritPosition()
*/
- void SetInheritPosition( bool inherit );
+ void SetInheritPosition(bool inherit);
/**
* @copydoc Dali::Actor::IsPositionInherited()
*/
- bool IsPositionInherited() const;
+ bool IsPositionInherited() const
+ {
+ return mInheritPosition;
+ }
/**
* Sets the orientation of the Actor.
* @param [in] angleRadians The new orientation angle in radians.
* @param [in] axis The new axis of orientation.
*/
- void SetOrientation( const Radian& angleRadians, const Vector3& axis );
+ void SetOrientation(const Radian& angleRadians, const Vector3& axis);
/**
* Sets the orientation of the Actor.
* @param [in] orientation The new orientation.
*/
- void SetOrientation( const Quaternion& orientation );
+ void SetOrientation(const Quaternion& orientation);
/**
* Rotate an actor around its existing rotation axis.
* @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
* @param[in] axis The axis of the rotation to combine with the existing rotation.
*/
- void RotateBy( const Radian& angleRadians, const Vector3& axis );
+ void RotateBy(const Radian& angleRadians, const Vector3& axis);
/**
* Apply a relative rotation to an actor.
* @param[in] relativeRotation The rotation to combine with the actors existing rotation.
*/
- void RotateBy( const Quaternion& relativeRotation );
+ void RotateBy(const Quaternion& relativeRotation);
/**
* Retreive the Actor's orientation.
* Switching this off means that using SetOrientation() sets the actor's world orientation.
* @param[in] inherit - true if the actor should inherit orientation, false otherwise.
*/
- void SetInheritOrientation( bool inherit );
+ void SetInheritOrientation(bool inherit);
/**
* Returns whether the actor inherit's it's parent's orientation.
* @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
*/
- bool IsOrientationInherited() const;
+ bool IsOrientationInherited() const
+ {
+ return mInheritOrientation;
+ }
/**
* Sets the factor of the parents size used for the child actor.
* Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
* @param[in] factor The vector to multiply the parents size by to get the childs size.
*/
- void SetSizeModeFactor( const Vector3& factor );
+ void SetSizeModeFactor(const Vector3& factor);
/**
* Gets the factor of the parents size used for the child actor.
* Sets a scale factor applied to an actor.
* @param [in] scale The scale factor applied on all axes.
*/
- void SetScale( float scale );
+ void SetScale(float scale);
/**
* Sets a scale factor applied to an actor.
* @param [in] scaleY The scale factor applied along the y-axis.
* @param [in] scaleZ The scale factor applied along the z-axis.
*/
- void SetScale( float scaleX, float scaleY, float scaleZ );
+ void SetScale(float scaleX, float scaleY, float scaleZ);
/**
* Sets a scale factor applied to an actor.
* @param [in] scale A vector representing the scale factor for each axis.
*/
- void SetScale( const Vector3& scale );
+ void SetScale(const Vector3& scale);
/**
* Set the x component of the scale factor.
* @param [in] x The new x value.
*/
- void SetScaleX( float x );
+ void SetScaleX(float x);
/**
* Set the y component of the scale factor.
* @param [in] y The new y value.
*/
- void SetScaleY( float y );
+ void SetScaleY(float y);
/**
* Set the z component of the scale factor.
* @param [in] z The new z value.
*/
- void SetScaleZ( float z );
+ void SetScaleZ(float z);
/**
* Apply a relative scale to an actor.
* @param[in] relativeScale The scale to combine with the actors existing scale.
*/
- void ScaleBy( const Vector3& relativeScale );
+ void ScaleBy(const Vector3& relativeScale);
/**
* Retrieve the scale factor applied to an actor.
/**
* @copydoc Dali::Actor::SetInheritScale()
*/
- void SetInheritScale( bool inherit );
+ void SetInheritScale(bool inherit);
/**
* @copydoc Dali::Actor::IsScaleInherited()
*/
- bool IsScaleInherited() const;
+ bool IsScaleInherited() const
+ {
+ return mInheritScale;
+ }
/**
* @copydoc Dali::Actor::GetCurrentWorldMatrix()
* Sets the visibility flag of an actor.
* @param[in] visible The new visibility flag.
*/
- void SetVisible( bool visible );
+ void SetVisible(bool visible);
/**
* Retrieve the visibility flag of an actor.
* Sets the opacity of an actor.
* @param [in] opacity The new opacity.
*/
- void SetOpacity( float opacity );
+ void SetOpacity(float opacity);
/**
* Retrieve the actor's opacity.
* Retrieve the actor's clipping mode.
* @return The actor's clipping mode (cached)
*/
- ClippingMode::Type GetClippingMode() const;
+ ClippingMode::Type GetClippingMode() const
+ {
+ return mClippingMode;
+ }
/**
* Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
* @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
* @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
*/
- void SetSensitive( bool sensitive )
+ void SetSensitive(bool sensitive)
{
mSensitive = sensitive;
}
/**
* @copydoc Dali::Actor::SetDrawMode
*/
- void SetDrawMode( DrawMode::Type drawMode );
+ void SetDrawMode(DrawMode::Type drawMode);
/**
* @copydoc Dali::Actor::GetDrawMode
*/
- DrawMode::Type GetDrawMode() const;
+ DrawMode::Type GetDrawMode() const
+ {
+ return mDrawMode;
+ }
/**
* @copydoc Dali::Actor::IsOverlay
*/
- bool IsOverlay() const;
+ bool IsOverlay() const
+ {
+ return (DrawMode::OVERLAY_2D == mDrawMode);
+ }
/**
* Sets the actor's color. The final color of actor depends on its color mode.
* This final color is applied to the drawable elements of an actor.
* @param [in] color The new color.
*/
- void SetColor( const Vector4& color );
+ void SetColor(const Vector4& color);
/**
* Set the red component of the color.
* @param [in] red The new red component.
*/
- void SetColorRed( float red );
+ void SetColorRed(float red);
/**
* Set the green component of the color.
* @param [in] green The new green component.
*/
- void SetColorGreen( float green );
+ void SetColorGreen(float green);
/**
* Set the blue component of the scale factor.
* @param [in] blue The new blue value.
*/
- void SetColorBlue( float blue );
+ void SetColorBlue(float blue);
/**
* Retrieve the actor's color.
* Color mode specifies whether Actor uses its own color or inherits its parent color
* @param [in] colorMode to use.
*/
- void SetColorMode( ColorMode colorMode );
+ void SetColorMode(ColorMode colorMode);
/**
* Returns the actor's color mode.
* @return currently used colorMode.
*/
- ColorMode GetColorMode() const;
+ ColorMode GetColorMode() const
+ {
+ return mColorMode;
+ }
/**
* @copydoc Dali::Actor::GetCurrentWorldColor()
*/
inline int32_t GetHierarchyDepth() const
{
- if( mIsOnScene )
+ if(mIsOnScene)
{
return mDepth;
}
*
* @return The depth used for hit-testing and renderer sorting
*/
- uint32_t GetSortingDepth();
+ uint32_t GetSortingDepth()
+ {
+ return mSortedDepth;
+ }
public:
-
// Size negotiation virtual functions
/**
* @param[in,out] container The control should add actors to this container that it is not able
* to allocate a size for.
*/
- virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
+ virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
{
}
* @param[in] policy The policy being set
* @param[in] dimension The dimension the policy is being set for
*/
- virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) {}
+ virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
+ {
+ }
/**
* @brief Virtual method to notify deriving classes that relayout dependencies have been
*
* @param dimension The dimension that is about to be calculated
*/
- virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
+ virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
+ {
+ }
/**
* @brief Virtual method to notify deriving classes that the size for a dimension
* @param[in] size The new size for the given dimension
* @param[in] dimension The dimension that was just negotiated
*/
- virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
+ virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
+ {
+ }
/**
* @brief Determine if this actor is dependent on it's children for relayout
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's children
*/
- virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Determine if this actor is dependent on it's children for relayout.
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's children
*/
- virtual bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ virtual bool RelayoutDependentOnChildrenBase(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Calculate the size for a child
* @param[in] dimension The dimension to calculate the size for. E.g. width or height.
* @return Return the calculated size for the given dimension
*/
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
+ virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension);
/**
* @brief This method is called during size negotiation when a height is required for a given width.
* @param width to use.
* @return the height based on the width.
*/
- virtual float GetHeightForWidth( float width );
+ virtual float GetHeightForWidth(float width);
/**
* @brief This method is called during size negotiation when a width is required for a given height.
* @param height to use.
* @return the width based on the width.
*/
- virtual float GetWidthForHeight( float height );
+ virtual float GetWidthForHeight(float height);
public:
-
// Size negotiation
/**
* @param[in,out] container The container that holds actors that are fed back into the
* RelayoutController algorithm.
*/
- void NegotiateSize( const Vector2& size, RelayoutContainer& container );
+ void NegotiateSize(const Vector2& size, RelayoutContainer& container);
/**
* @brief Set whether size negotiation should use the assigned size of the actor
* @param[in] use Whether the assigned size of the actor should be used
* @param[in] dimension The dimension(s) to set. Can be a bitfield of multiple dimensions
*/
- void SetUseAssignedSize( bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetUseAssignedSize(bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Returns whether size negotiation should use the assigned size of the actor
* @param[in] dimension The dimension to get
* @return Return whether the assigned size of the actor should be used. If more than one dimension is requested, just return the first one found
*/
- bool GetUseAssignedSize( Dimension::Type dimension ) const;
+ bool GetUseAssignedSize(Dimension::Type dimension) const;
/**
* @copydoc Dali::Actor::SetResizePolicy()
*/
- void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @copydoc Dali::Actor::GetResizePolicy()
*/
- ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
+ ResizePolicy::Type GetResizePolicy(Dimension::Type dimension) const;
/**
* @copydoc Dali::Actor::SetSizeScalePolicy()
*/
- void SetSizeScalePolicy( SizeScalePolicy::Type policy );
+ void SetSizeScalePolicy(SizeScalePolicy::Type policy);
/**
* @copydoc Dali::Actor::GetSizeScalePolicy()
/**
* @copydoc Dali::Actor::SetDimensionDependency()
*/
- void SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency );
+ void SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency);
/**
* @copydoc Dali::Actor::GetDimensionDependency()
*/
- Dimension::Type GetDimensionDependency( Dimension::Type dimension ) const;
+ Dimension::Type GetDimensionDependency(Dimension::Type dimension) const;
/**
* @brief Set the size negotiation relayout enabled on this actor
*
* @param[in] relayoutEnabled Boolean to enable or disable relayout
*/
- void SetRelayoutEnabled( bool relayoutEnabled );
+ void SetRelayoutEnabled(bool relayoutEnabled);
/**
* @brief Return if relayout is enabled
* @param dirty Whether to mark actor as dirty or not
* @param dimension The dimension(s) to mark as dirty
*/
- void SetLayoutDirty( bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetLayoutDirty(bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Return if any of an actor's dimensions are marked as dirty
* @param dimension The dimension(s) to check
* @return Return if any of the requested dimensions are dirty
*/
- bool IsLayoutDirty( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+ bool IsLayoutDirty(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
/**
* @brief Returns if relayout is enabled and the actor is not dirty
*
* @return Return if it is possible to relayout the actor
*/
- bool RelayoutPossible( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+ bool RelayoutPossible(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
/**
* @brief Returns if relayout is enabled and the actor is dirty
*
* @return Return if it is required to relayout the actor
*/
- bool RelayoutRequired( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+ bool RelayoutRequired(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
/**
* @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
* @note RelayoutRequest() can be called multiple times; the size negotiation is still
* only performed once, i.e. there is no need to keep track of this in the calling side.
*/
- void RelayoutRequest( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void RelayoutRequest(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Determine if this actor is dependent on it's parent for relayout
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's parent
*/
- bool RelayoutDependentOnParent( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ bool RelayoutDependentOnParent(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Determine if this actor has another dimension depedent on the specified one
* @param dependentDimension The dimension to check for dependency with
* @return Return if the actor is dependent on this dimension
*/
- bool RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension );
-
- /**
- * Negotiate sizes for a control in all dimensions
- *
- * @param[in] allocatedSize The size constraint that the control must respect
- */
- void NegotiateDimensions( const Vector2& allocatedSize );
-
- /**
- * Negotiate size for a specific dimension
- *
- * The algorithm adopts a recursive dependency checking approach. Meaning, that wherever dependencies
- * are found, e.g. an actor dependent on its parent, the dependency will be calculated first with NegotiatedDimension and
- * LayoutDimensionNegotiated flags being filled in on the actor.
- *
- * @post All actors that exist in the dependency chain connected to the given actor will have had their NegotiatedDimensions
- * calculated and set as well as the LayoutDimensionNegotiated flags.
- *
- * @param[in] dimension The dimension to negotiate on
- * @param[in] allocatedSize The size constraint that the actor must respect
- */
- void NegotiateDimension( Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack );
+ bool RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension);
/**
* @brief Calculate the size of a dimension
* @param[in] maximumSize The upper bounds on the size
* @return Return the calculated size for the dimension
*/
- float CalculateSize( Dimension::Type dimension, const Vector2& maximumSize );
-
- /**
- * @brief Clamp a dimension given the relayout constraints on this actor
- *
- * @param[in] size The size to constrain
- * @param[in] dimension The dimension the size exists in
- * @return Return the clamped size
- */
- float ClampDimension( float size, Dimension::Type dimension );
+ float CalculateSize(Dimension::Type dimension, const Vector2& maximumSize);
/**
* Negotiate a dimension based on the size of the parent
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromParent( Dimension::Type dimension );
+ float NegotiateFromParent(Dimension::Type dimension);
/**
* Negotiate a dimension based on the size of the parent. Fitting inside.
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromParentFit( Dimension::Type dimension );
+ float NegotiateFromParentFit(Dimension::Type dimension);
/**
* Negotiate a dimension based on the size of the parent. Flooding the whole space.
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromParentFlood( Dimension::Type dimension );
+ float NegotiateFromParentFlood(Dimension::Type dimension);
/**
* @brief Negotiate a dimension based on the size of the children
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromChildren( Dimension::Type dimension );
+ float NegotiateFromChildren(Dimension::Type dimension);
/**
* Set the negotiated dimension value for the given dimension(s)
* @param negotiatedDimension The value to set
* @param dimension The dimension(s) to set the value for
*/
- void SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetNegotiatedDimension(float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* Return the value of negotiated dimension for the given dimension
* @param dimension The dimension to retrieve
* @return Return the value of the negotiated dimension
*/
- float GetNegotiatedDimension( Dimension::Type dimension ) const;
+ float GetNegotiatedDimension(Dimension::Type dimension) const;
/**
* @brief Set the padding for a dimension
* @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
* @param[in] dimension The dimension to set
*/
- void SetPadding( const Vector2& padding, Dimension::Type dimension );
+ void SetPadding(const Vector2& padding, Dimension::Type dimension);
/**
* Return the value of padding for the given dimension
* @param dimension The dimension to retrieve
* @return Return the value of padding for the dimension
*/
- Vector2 GetPadding( Dimension::Type dimension ) const;
+ Vector2 GetPadding(Dimension::Type dimension) const;
/**
* Return the actor size for a given dimension
* @param[in] dimension The dimension to retrieve the size for
* @return Return the size for the given dimension
*/
- float GetSize( Dimension::Type dimension ) const;
+ float GetSize(Dimension::Type dimension) const;
/**
* Return the natural size of the actor for a given dimension
* @param[in] dimension The dimension to retrieve the size for
* @return Return the natural size for the given dimension
*/
- float GetNaturalSize( Dimension::Type dimension ) const;
+ float GetNaturalSize(Dimension::Type dimension) const;
/**
* @brief Return the amount of size allocated for relayout
* @param[in] dimension The dimension to retrieve
* @return Return the size
*/
- float GetRelayoutSize( Dimension::Type dimension ) const;
+ float GetRelayoutSize(Dimension::Type dimension) const;
/**
* @brief If the size has been negotiated return that else return normal size
* @param[in] dimension The dimension to retrieve
* @return Return the size
*/
- float GetLatestSize( Dimension::Type dimension ) const;
+ float GetLatestSize(Dimension::Type dimension) const;
/**
* Apply the negotiated size to the actor
*
* @param[in] container The container to fill with actors that require further relayout
*/
- void SetNegotiatedSize( RelayoutContainer& container );
+ void SetNegotiatedSize(RelayoutContainer& container);
/**
* @brief Flag the actor as having it's layout dimension negotiated.
* @param[in] negotiated The status of the flag to set.
* @param[in] dimension The dimension to set the flag for
*/
- void SetLayoutNegotiated( bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetLayoutNegotiated(bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Test whether the layout dimension for this actor has been negotiated or not.
* @param[in] dimension The dimension to determine the value of the flag for
* @return Return if the layout dimension is negotiated or not.
*/
- bool IsLayoutNegotiated( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+ bool IsLayoutNegotiated(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
/**
* @brief provides the Actor implementation of GetHeightForWidth
* @param width to use.
* @return the height based on the width.
*/
- float GetHeightForWidthBase( float width );
+ float GetHeightForWidthBase(float width);
/**
* @brief provides the Actor implementation of GetWidthForHeight
* @param height to use.
* @return the width based on the height.
*/
- float GetWidthForHeightBase( float height );
+ float GetWidthForHeightBase(float height);
/**
* @brief Calculate the size for a child
* @param[in] dimension The dimension to calculate the size for. E.g. width or height.
* @return Return the calculated size for the given dimension
*/
- float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
+ float CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension);
/**
* @brief Set the preferred size for size negotiation
*
* @param[in] size The preferred size to set
*/
- void SetPreferredSize( const Vector2& size );
+ void SetPreferredSize(const Vector2& size);
/**
* @brief Return the preferred size used for size negotiation
/**
* @copydoc Dali::Actor::SetMinimumSize
*/
- void SetMinimumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetMinimumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @copydoc Dali::Actor::GetMinimumSize
*/
- float GetMinimumSize( Dimension::Type dimension ) const;
+ float GetMinimumSize(Dimension::Type dimension) const;
/**
* @copydoc Dali::Actor::SetMaximumSize
*/
- void SetMaximumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetMaximumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @copydoc Dali::Actor::GetMaximumSize
*/
- float GetMaximumSize( Dimension::Type dimension ) const;
+ float GetMaximumSize(Dimension::Type dimension) const;
/**
* @copydoc Dali::Actor::AddRenderer()
*/
- uint32_t AddRenderer( Renderer& renderer );
+ uint32_t AddRenderer(Renderer& renderer);
/**
* @copydoc Dali::Actor::GetRendererCount()
/**
* @copydoc Dali::Actor::GetRendererAt()
*/
- RendererPtr GetRendererAt( uint32_t index );
+ RendererPtr GetRendererAt(uint32_t index);
/**
* @copydoc Dali::Actor::RemoveRenderer()
*/
- void RemoveRenderer( Renderer& renderer );
+ void RemoveRenderer(Renderer& renderer);
/**
* @copydoc Dali::Actor::RemoveRenderer()
*/
- void RemoveRenderer( uint32_t index );
+ void RemoveRenderer(uint32_t index);
-public:
+ /**
+ * @brief Set BlendEquation at each renderer that added on this Actor.
+ */
+ void SetBlendEquation(DevelBlendEquation::Type blendEquation);
+
+ /**
+ * @brief Get Blend Equation that applied to this Actor
+ */
+ 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.
* @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
* @param[out] localX On return, the X-coordinate relative to the actor.
* @param[in] screenY The screen Y-coordinate.
* @return True if the conversion succeeded.
*/
- bool ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const;
+ bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const;
/**
* Converts screen coordinates into the actor's coordinate system.
* @param[in] screenY The screen Y-coordinate.
* @return True if the conversion succeeded.
*/
- bool ScreenToLocal( const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const;
+ bool ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const;
/**
* Converts from the actor's coordinate system to screen coordinates.
* @param[in] screenY The screen Y-coordinate.
* @return True if the conversion succeeded.
*/
- bool ScreenToLocal( const Matrix& viewMatrix,
- const Matrix& projectionMatrix,
- const Viewport& viewport,
- float& localX,
- float& localY,
- float screenX,
- float screenY ) const;
-
- /**
- * Performs a ray-sphere test with the given pick-ray and the actor's bounding sphere.
- * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
- * @param[in] rayOrigin The ray origin in the world's reference system.
- * @param[in] rayDir The ray director vector in the world's reference system.
- * @return True if the ray intersects the actor's bounding sphere.
- */
- bool RaySphereTest( const Vector4& rayOrigin, const Vector4& rayDir ) const;
-
- /**
- * Performs a ray-actor test with the given pick-ray and the actor's geometry.
- * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
- * @param[in] rayOrigin The ray origin in the world's reference system.
- * @param[in] rayDir The ray director vector in the world's reference system.
- * @param[out] hitPointLocal The hit point in the Actor's local reference system.
- * @param[out] distance The distance from the hit point to the camera.
- * @return True if the ray intersects the actor's geometry.
- */
- bool RayActorTest( const Vector4& rayOrigin,
- const Vector4& rayDir,
- Vector2& hitPointLocal,
- float& distance ) const;
+ bool ScreenToLocal(const Matrix& viewMatrix,
+ const Matrix& projectionMatrix,
+ const Viewport& viewport,
+ float& localX,
+ float& localY,
+ float screenX,
+ float screenY) const;
/**
* Sets whether the actor should receive a notification when touch or hover motion events leave
*
* @param[in] required Should be set to true if a Leave event is required
*/
- void SetLeaveRequired( bool required );
+ void SetLeaveRequired(bool required)
+ {
+ mLeaveRequired = required;
+ }
/**
* This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
* the boundary of the actor.
* @return true if a Leave event is required, false otherwise.
*/
- bool GetLeaveRequired() const;
+ bool GetLeaveRequired() const
+ {
+ return mLeaveRequired;
+ }
/**
* @copydoc Dali::Actor::SetKeyboardFocusable()
*/
- void SetKeyboardFocusable( bool focusable );
+ void SetKeyboardFocusable(bool focusable)
+ {
+ mKeyboardFocusable = focusable;
+ }
/**
* @copydoc Dali::Actor::IsKeyboardFocusable()
*/
- bool IsKeyboardFocusable() const;
+ bool IsKeyboardFocusable() const
+ {
+ return mKeyboardFocusable;
+ }
+
+ /**
+ * Query whether the application or derived actor type requires intercept touch events.
+ * @return True if intercept touch events are required.
+ */
+ bool GetInterceptTouchRequired() const
+ {
+ return !mInterceptTouchedSignal.Empty();
+ }
/**
* Query whether the application or derived actor type requires touch events.
* @return True if touch events are required.
*/
- bool GetTouchRequired() const;
+ bool GetTouchRequired() const
+ {
+ return !mTouchedSignal.Empty();
+ }
/**
* Query whether the application or derived actor type requires hover events.
* @return True if hover events are required.
*/
- bool GetHoverRequired() const;
+ bool GetHoverRequired() const
+ {
+ return !mHoveredSignal.Empty();
+ }
/**
* Query whether the application or derived actor type requires wheel events.
* @return True if wheel events are required.
*/
- bool GetWheelEventRequired() const;
+ bool GetWheelEventRequired() const
+ {
+ return !mWheelEventSignal.Empty();
+ }
/**
* Query whether the actor is actually hittable. This method checks whether the actor is
* sensitive, has the visibility flag set to true and is not fully transparent.
* @return true, if it can be hit, false otherwise.
*/
- bool IsHittable() const;
+ bool IsHittable() const
+ {
+ return IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
+ }
/**
* Query whether the actor captures all touch after it starts even if touch leaves its boundary.
return mCaptureAllTouchAfterStart;
}
+ /**
+ * Sets the touch area offset of an actor.
+ * @param [in] offset The new offset of area (left, right, bottom, top).
+ */
+ void SetTouchAreaOffset(Rect<int> offset)
+ {
+ mTouchAreaOffset = offset;
+ }
+
+ /**
+ * Retrieve the Actor's touch area offset.
+ * @return The Actor's touch area offset.
+ */
+ const Rect<int>& GetTouchAreaOffset() const
+ {
+ return mTouchAreaOffset;
+ }
+
// Gestures
/**
* @param[in] type The gesture type.
* @return True if the gesture is required, false otherwise.
*/
- bool IsGestureRequred( DevelGesture::Type type ) const;
+ bool IsGestureRequired(GestureType::Value type) const;
// Signals
/**
+ * Used by the EventProcessor to emit intercept touch event signals.
+ * @param[in] touch The touch data.
+ * @return True if the event was intercepted.
+ */
+ bool EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch);
+
+ /**
* Used by the EventProcessor to emit touch event signals.
* @param[in] touch The touch data.
* @return True if the event was consumed.
*/
- bool EmitTouchEventSignal( const Dali::TouchEvent& touch );
+ bool EmitTouchEventSignal(const Dali::TouchEvent& touch);
/**
* Used by the EventProcessor to emit hover event signals.
* @param[in] event The hover event.
* @return True if the event was consumed.
*/
- bool EmitHoverEventSignal( const Dali::HoverEvent& event );
+ bool EmitHoverEventSignal(const Dali::HoverEvent& event);
/**
* Used by the EventProcessor to emit wheel event signals.
* @param[in] event The wheel event.
* @return True if the event was consumed.
*/
- bool EmitWheelEventSignal( const WheelEvent& event );
+ bool EmitWheelEventSignal(const Dali::WheelEvent& event);
/**
* @brief Emits the visibility change signal for this actor and all its children.
* @param[in] visible Whether the actor has become visible or not.
* @param[in] type Whether the actor's visible property has changed or a parent's.
*/
- void EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityChange::Type type );
+ void EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type);
/**
* @brief Emits the layout direction change signal for this actor and all its children.
* @param[in] type Whether the actor's layout direction property has changed or a parent's.
*/
- void EmitLayoutDirectionChangedSignal( LayoutDirection::Type type );
+ void EmitLayoutDirectionChangedSignal(LayoutDirection::Type type);
/**
- * @brief Emits the ChildAdded signal for this actor
- * @param[in] child The child actor that has been added
+ * @copydoc DevelActor::InterceptTouchedSignal()
*/
- void EmitChildAddedSignal( Actor& child );
-
- /**
- * @brief Emits the ChildRemoved signal for this actor
- * @param[in] child The child actor that has been removed
- */
- void EmitChildRemovedSignal( Actor& child );
+ Dali::Actor::TouchEventSignalType& InterceptTouchedSignal()
+ {
+ return mInterceptTouchedSignal;
+ }
/**
- * @copydoc Dali::Actor::TouchEventSignal()
+ * @copydoc Dali::Actor::TouchedSignal()
*/
- Dali::Actor::TouchEventSignalType& TouchSignal();
+ Dali::Actor::TouchEventSignalType& TouchedSignal()
+ {
+ return mTouchedSignal;
+ }
/**
* @copydoc Dali::Actor::HoveredSignal()
*/
- Dali::Actor::HoverSignalType& HoveredSignal();
+ Dali::Actor::HoverSignalType& HoveredSignal()
+ {
+ return mHoveredSignal;
+ }
/**
* @copydoc Dali::Actor::WheelEventSignal()
*/
- Dali::Actor::WheelEventSignalType& WheelEventSignal();
+ Dali::Actor::WheelEventSignalType& WheelEventSignal()
+ {
+ return mWheelEventSignal;
+ }
/**
* @copydoc Dali::Actor::OnSceneSignal()
*/
- Dali::Actor::OnSceneSignalType& OnSceneSignal();
+ Dali::Actor::OnSceneSignalType& OnSceneSignal()
+ {
+ return mOnSceneSignal;
+ }
/**
* @copydoc Dali::Actor::OffSceneSignal()
*/
- Dali::Actor::OffSceneSignalType& OffSceneSignal();
+ Dali::Actor::OffSceneSignalType& OffSceneSignal()
+ {
+ return mOffSceneSignal;
+ }
/**
* @copydoc Dali::Actor::OnRelayoutSignal()
*/
- Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal();
+ Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal()
+ {
+ return mOnRelayoutSignal;
+ }
/**
* @copydoc DevelActor::VisibilityChangedSignal
*/
- DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal();
+ DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal()
+ {
+ return mVisibilityChangedSignal;
+ }
/**
* @copydoc LayoutDirectionChangedSignal
*/
- Dali::Actor::LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal();
+ Dali::Actor::LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal()
+ {
+ return mLayoutDirectionChangedSignal;
+ }
/**
* @copydoc DevelActor::ChildAddedSignal
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object,
- ConnectionTrackerInterface* tracker,
- const std::string& signalName,
- FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object,
+ ConnectionTrackerInterface* tracker,
+ const std::string& signalName,
+ FunctorDelegate* functor);
/**
* Performs actions as requested using the action name.
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if the action was done.
*/
- static bool DoAction( BaseObject* object,
- const std::string& actionName,
- const Property::Map& attributes );
+ static bool DoAction(BaseObject* object,
+ const std::string& actionName,
+ const Property::Map& attributes);
public:
// For Animation
* For use in derived classes.
* This should only be called by Animation, when the actor is resized using Animation::Resize().
*/
- virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize )
+ virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
{
}
protected:
-
enum DerivedType
{
- BASIC, LAYER, ROOT_LAYER
+ BASIC,
+ LAYER,
+ ROOT_LAYER
};
/**
* @param[in] derivedType The derived type of actor (if any).
* @param[in] reference to the node
*/
- Actor( DerivedType derivedType, const SceneGraph::Node& node );
+ Actor(DerivedType derivedType, const SceneGraph::Node& node);
/**
* Second-phase constructor. Must be called immediately after creating a new Actor;
*/
- void Initialize( void );
+ void Initialize(void);
/**
* A reference counted object may only be deleted by calling Unreference()
*/
- virtual ~Actor();
+ ~Actor() override;
/**
* Called on a child during Add() when the parent actor is connected to the Scene.
* @param[in] parentDepth The depth of the parent in the hierarchy.
*/
- void ConnectToScene( uint32_t parentDepth );
+ void ConnectToScene(uint32_t parentDepth);
/**
* Helper for ConnectToScene, to recursively connect a tree of actors.
* @param[in] depth The depth in the hierarchy of the actor
* @param[out] connectionList On return, the list of connected actors which require notification.
*/
- void RecursiveConnectToScene( ActorContainer& connectionList, uint32_t depth );
+ void RecursiveConnectToScene(ActorContainer& connectionList, uint32_t depth);
/**
* Connect the Node associated with this Actor to the scene-graph.
* This is atomic i.e. not interrupted by user callbacks.
* @param[out] disconnectionList On return, the list of disconnected actors which require notification.
*/
- void RecursiveDisconnectFromStage( ActorContainer& disconnectionList );
+ void RecursiveDisconnectFromStage(ActorContainer& disconnectionList);
/**
* Disconnect the Node associated with this Actor from the scene-graph.
void RebuildDepthTree();
protected:
-
/**
* Traverse the actor tree, inserting actors into the depth tree in sibling order.
* @param[in] sceneGraphNodeDepths A vector capturing the nodes and their depth index
* @param[in,out] depthIndex The current depth index (traversal index)
*/
- void DepthTraverseActorTree( OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex );
+ void DepthTraverseActorTree(OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex);
public:
-
// Default property extensions from Object
/**
* @copydoc Dali::Internal::Object::SetDefaultProperty()
*/
- virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue );
+ void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override;
/**
* @copydoc Dali::Internal::Object::SetSceneGraphProperty()
*/
- virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
+ void SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value) override;
/**
* @copydoc Dali::Internal::Object::GetDefaultProperty()
*/
- virtual Property::Value GetDefaultProperty( Property::Index index ) const;
+ Property::Value GetDefaultProperty(Property::Index index) const override;
/**
* @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
*/
- virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
+ Property::Value GetDefaultPropertyCurrentValue(Property::Index index) const override;
/**
* @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
*/
- virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType );
+ void OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) override;
/**
* @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
*/
- virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
+ const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty(Property::Index index) const override;
/**
* @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
*/
- virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
+ const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override;
/**
* @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
*/
- virtual int32_t GetPropertyComponentIndex( Property::Index index ) const;
+ int32_t GetPropertyComponentIndex(Property::Index index) const override;
/**
- * Retrieve the actor's node.
- * @return The node used by this actor
+ * @copydoc Dali::Internal::Object::IsAnimationPossible()
*/
- const SceneGraph::Node& GetNode() const
+ bool IsAnimationPossible() const override
{
- return *static_cast<const SceneGraph::Node*>( mUpdateObject );
+ return OnScene();
}
/**
+ * Retrieve the actor's node.
+ * @return The node used by this actor
+ */
+ const SceneGraph::Node& GetNode() const;
+
+ /**
* @copydoc Dali::DevelActor::Raise()
*/
void Raise();
/**
* @copydoc Dali::DevelActor::RaiseAbove()
*/
- void RaiseAbove( Internal::Actor& target );
+ void RaiseAbove(Internal::Actor& target);
/**
* @copydoc Dali::DevelActor::LowerBelow()
*/
- void LowerBelow( Internal::Actor& target );
+ void LowerBelow(Internal::Actor& target);
public:
-
/**
* Sets the scene which this actor is added to.
* @param[in] scene The scene
*/
- void SetScene( Scene& scene );
+ void SetScene(Scene& scene)
+ {
+ mScene = &scene;
+ }
/**
* Gets the scene which this actor is added to.
* @return The scene
*/
- Scene& GetScene() const;
+ Scene& GetScene() const
+ {
+ return *mScene;
+ }
-private:
+ LayoutDirection::Type GetLayoutDirection() const
+ {
+ return mLayoutDirection;
+ }
+private:
struct SendMessage
{
enum Type
};
};
+ struct Relayouter;
+
// Remove default constructor and copy constructor
- Actor() = delete;
- Actor( const Actor& ) = delete;
- Actor& operator=( const Actor& rhs ) = delete;
+ Actor() = delete;
+ Actor(const Actor&) = delete;
+ Actor& operator=(const Actor& rhs) = delete;
/**
- * Set the actors parent.
+ * 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( Actor* parent );
+ void SetParent(ActorParent* parent, bool keepOnScene = false);
/**
* For use in derived classes, called after Initialize()
* For use in external (CustomActor) derived classes.
* This is called after the atomic ConnectToScene() traversal has been completed.
*/
- virtual void OnSceneConnectionExternal( int depth )
+ virtual void OnSceneConnectionExternal(int depth)
{
}
* For use in derived classes; this is called after Add() has added a child.
* @param[in] child The child that was added.
*/
- virtual void OnChildAdd( Actor& child )
+ virtual void OnChildAdd(Actor& child)
{
}
* For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ).
* @param[in] child The child that was removed.
*/
- virtual void OnChildRemove( Actor& child )
+ virtual void OnChildRemove(Actor& child)
{
}
* For use in derived classes.
* This is called after SizeSet() has been called.
*/
- virtual void OnSizeSet( const Vector3& targetSize )
- {
- }
-
- /**
- * For use in derived classes.
- * This is only called if mDerivedRequiresHover is true, and the hover-signal was not consumed.
- * @param[in] event The hover event.
- * @return True if the event should be consumed.
- */
- virtual bool OnHoverEvent( const HoverEvent& event )
- {
- return false;
- }
-
- /**
- * For use in derived classes.
- * This is only called if the wheel signal was not consumed.
- * @param[in] event The wheel event.
- * @return True if the event should be consumed.
- */
- virtual bool OnWheelEvent( const WheelEvent& event )
+ virtual void OnSizeSet(const Vector3& targetSize)
{
- return false;
}
/**
* @param[out] value Is set with the cached value of the property if found.
* @return True if value set, false otherwise.
*/
- bool GetCachedPropertyValue( Property::Index index, Property::Value& value ) const;
+ bool GetCachedPropertyValue(Property::Index index, Property::Value& value) const;
/**
* @brief Retrieves the current value of a default property from the scene-graph.
* @param[out] value Is set with the current scene-graph value of the property
* @return True if value set, false otherwise.
*/
- bool GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const;
+ bool GetCurrentPropertyValue(Property::Index index, Property::Value& value) const;
/**
- * @brief Ensure the relayout data is allocated
+ * @brief Ensure the relayouter is allocated
*/
- void EnsureRelayoutData();
+ Relayouter& EnsureRelayouter();
/**
* @brief Apply the size set policy to the input size
* @param[in] size The size to apply the policy to
* @return Return the adjusted size
*/
- Vector2 ApplySizeSetPolicy( const Vector2& size );
+ Vector2 ApplySizeSetPolicy(const Vector2& size);
/**
* Retrieve the parent object of an Actor.
* @return The parent object, or NULL if the Actor does not have a parent.
*/
- virtual Object* GetParentObject() const;
+ Object* GetParentObject() const override
+ {
+ return static_cast<Actor*>(mParent);
+ }
/**
- * Set Sibling order
- * @param[in] order The sibling order this Actor should be. It will place
- * the actor at this index in it's parent's child array.
+ * @brief Get the current position of the actor in screen coordinates.
+ *
+ * @return Returns the screen position of actor
*/
- void SetSiblingOrder( uint32_t order);
+ const Vector2 GetCurrentScreenPosition() const;
/**
- * Get Sibling order
- * @return the order of this actor amongst it's siblings
+ * Sets the visibility flag of an actor.
+ * @param[in] visible The new visibility flag.
+ * @param[in] sendMessage Whether to send a message to the update thread or not.
*/
- uint32_t GetSiblingOrder() const;
+ void SetVisibleInternal(bool visible, SendMessage::Type sendMessage);
/**
- * Request that the stage rebuilds the actor depth indices.
+ * @copydoc ActorParent::SetSiblingOrderOfChild
*/
- void RequestRebuildDepthTree();
+ void SetSiblingOrderOfChild(Actor& child, uint32_t order) override;
/**
- * @brief Get the current position of the actor in screen coordinates.
- *
- * @return Returns the screen position of actor
+ * @copydoc ActorParent::GetSiblingOrderOfChild
*/
- const Vector2 GetCurrentScreenPosition() const;
+ uint32_t GetSiblingOrderOfChild(const Actor& child) const override;
/**
- * Sets the visibility flag of an actor.
- * @param[in] visible The new visibility flag.
- * @param[in] sendMessage Whether to send a message to the update thread or not.
+ * @copydoc ActorParent::RaiseChild
*/
- void SetVisibleInternal( bool visible, SendMessage::Type sendMessage );
+ void RaiseChild(Actor& child) override;
+
+ /**
+ * @copydoc ActorParent::LowerChild
+ */
+ void LowerChild(Actor& child) override;
+
+ /**
+ * @copydoc ActorParent::RaiseChildToTop
+ */
+ void RaiseChildToTop(Actor& child) override;
+
+ /**
+ * @copydoc ActorParent::LowerChildToBottom
+ */
+ void LowerChildToBottom(Actor& child) override;
+
+ /**
+ * @copydoc ActorParent::RaiseChildAbove
+ */
+ void RaiseChildAbove(Actor& child, Actor& target) override;
+
+ /**
+ * @copydoc ActorParent::LowerChildBelow()
+ */
+ void LowerChildBelow(Actor& child, Actor& target) override;
/**
* Set whether a child actor inherits it's parent's layout direction. Default is to inherit.
* @param[in] inherit - true if the actor should inherit layout direction, false otherwise.
*/
- void SetInheritLayoutDirection( bool inherit );
+ void SetInheritLayoutDirection(bool inherit);
/**
* Returns whether the actor inherits it's parent's layout direction.
* @return true if the actor inherits it's parent's layout direction, false otherwise.
*/
- bool IsLayoutDirectionInherited() const;
+ bool IsLayoutDirectionInherited() const
+ {
+ return mInheritLayoutDirection;
+ }
/**
* @brief Propagates layout direction recursively.
- * @param[in] actor The actor for seting layout direction.
* @param[in] direction New layout direction.
*/
- void InheritLayoutDirectionRecursively( ActorPtr actor, Dali::LayoutDirection::Type direction, bool set = false );
+ void InheritLayoutDirectionRecursively(Dali::LayoutDirection::Type direction, bool set = false);
/**
* @brief Sets the update size hint of an actor.
* @param [in] updateSizeHint The update size hint.
*/
- void SetUpdateSizeHint( const Vector2& updateSizeHint );
+ void SetUpdateSizeHint(const Vector2& updateSizeHint);
/**
- * @brief Return the update size hint of actor
- * @return Return the update size hint
+ * @brief Recursively emits the visibility-changed-signal on the actor tree.
+ *
+ * @param[in] visible The new visibility of the actor
+ * @param[in] type Whether the actor's visible property has changed or a parent's
*/
- Vector2 GetUpdateSizeHint() const;
+ void EmitVisibilityChangedSignalRecursively(bool visible,
+ DevelActor::VisibilityChange::Type type);
protected:
-
- Scene* mScene; ///< The scene the actor is added to
-
- Actor* mParent; ///< Each actor (except the root) can have one parent
- ActorContainer* mChildren; ///< Container of referenced actors, lazily initialized
- RendererContainer* mRenderers; ///< Renderer container
-
- Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
- Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
-
- struct RelayoutData;
- RelayoutData* mRelayoutData; ///< Struct to hold optional collection of relayout variables
-
- ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
+ ActorParentImpl mParentImpl; ///< Implementation of ActorParent;
+ ActorParent* mParent; ///< Each actor (except the root) can have one parent
+ Scene* mScene; ///< The scene the actor is added to
+ RendererContainer* mRenderers; ///< Renderer container
+ Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
+ Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
+ Relayouter* mRelayoutData; ///< Struct to hold optional collection of relayout variables
+ ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
// Signals
- Dali::Actor::TouchEventSignalType mTouchSignal;
- Dali::Actor::HoverSignalType mHoveredSignal;
- Dali::Actor::WheelEventSignalType mWheelEventSignal;
- Dali::Actor::OnSceneSignalType mOnSceneSignal;
- Dali::Actor::OffSceneSignalType mOffSceneSignal;
- Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
- DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
- Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal;
- DevelActor::ChildChangedSignalType mChildAddedSignal;
- DevelActor::ChildChangedSignalType mChildRemovedSignal;
- DevelActor::ChildOrderChangedSignalType mChildOrderChangedSignal;
-
- Quaternion mTargetOrientation; ///< Event-side storage for orientation
- Vector4 mTargetColor; ///< Event-side storage for color
- Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
- 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
-
- std::string 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.
-
- const bool mIsRoot : 1; ///< Flag to identify the root actor
- const bool mIsLayer : 1; ///< Flag to identify that this is a layer
- bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene
- bool mSensitive : 1; ///< Whether the actor emits touch event signals
- bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
- bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
- bool mDerivedRequiresTouch : 1; ///< Whether the derived actor type requires touch event signals
- bool mDerivedRequiresHover : 1; ///< Whether the derived actor type requires hover event signals
- bool mDerivedRequiresWheelEvent : 1; ///< Whether the derived actor type requires wheel event signals
- bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
- bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
- bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
- bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
- bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
- bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
- 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.
- 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.
+ Dali::Actor::TouchEventSignalType mInterceptTouchedSignal;
+ Dali::Actor::TouchEventSignalType mTouchedSignal;
+ Dali::Actor::HoverSignalType mHoveredSignal;
+ Dali::Actor::WheelEventSignalType mWheelEventSignal;
+ Dali::Actor::OnSceneSignalType mOnSceneSignal;
+ Dali::Actor::OffSceneSignalType mOffSceneSignal;
+ Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
+ DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
+ Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal;
+
+ Quaternion mTargetOrientation; ///< Event-side storage for orientation
+ Vector4 mTargetColor; ///< Event-side storage for color
+ Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
+ 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
+ Rect<int> mTouchAreaOffset; ///< touch area offset (left, right, bottom, top)
+
+ 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.
+
+ const bool mIsRoot : 1; ///< Flag to identify the root actor
+ const bool mIsLayer : 1; ///< Flag to identify that this is a layer
+ bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene
+ bool mSensitive : 1; ///< Whether the actor emits touch event signals
+ bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
+ bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
+ bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
+ bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
+ bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
+ bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
+ bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
+ bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
+ 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.
private:
+ static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
- static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
+ struct PropertyHandler;
+ struct SiblingHandler;
+ friend class ActorParentImpl; // Allow impl to call private methods on actor
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Internal::Actor& GetImplementation( Dali::Actor& actor )
+inline Internal::Actor& GetImplementation(Dali::Actor& actor)
{
- DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
+ DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
BaseObject& handle = actor.GetBaseObject();
- return static_cast< Internal::Actor& >( handle );
+ return static_cast<Internal::Actor&>(handle);
}
-inline const Internal::Actor& GetImplementation( const Dali::Actor& actor )
+inline const Internal::Actor& GetImplementation(const Dali::Actor& actor)
{
- DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
+ DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
const BaseObject& handle = actor.GetBaseObject();
- return static_cast< const Internal::Actor& >( handle );
+ return static_cast<const Internal::Actor&>(handle);
}
} // namespace Dali