1 #ifndef DALI_INTERNAL_ACTOR_H
2 #define DALI_INTERNAL_ACTOR_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
25 #include <dali/devel-api/actors/actor-devel.h>
26 #include <dali/devel-api/rendering/renderer-devel.h>
27 #include <dali/internal/common/const-string.h>
28 #include <dali/internal/common/internal-constants.h>
29 #include <dali/internal/common/memory-pool-object-allocator.h>
30 #include <dali/internal/event/actors/actor-declarations.h>
31 #include <dali/internal/event/actors/actor-parent-impl.h>
32 #include <dali/internal/event/actors/actor-parent.h>
33 #include <dali/internal/event/common/object-impl.h>
34 #include <dali/internal/event/common/stage-def.h>
35 #include <dali/internal/update/nodes/node-declarations.h>
36 #include <dali/public-api/actors/actor.h>
37 #include <dali/public-api/common/dali-common.h>
38 #include <dali/public-api/common/vector-wrapper.h>
39 #include <dali/public-api/events/gesture.h>
40 #include <dali/public-api/math/viewport.h>
41 #include <dali/public-api/object/ref-object.h>
42 #include <dali/public-api/size-negotiation/relayout-container.h>
54 class ActorGestureData;
60 using RendererPtr = IntrusivePtr<Renderer>;
61 using RendererContainer = std::vector<RendererPtr>;
62 using RendererIter = RendererContainer::iterator;
64 class ActorDepthTreeNode;
65 using DepthNodeMemoryPool = Dali::Internal::MemoryPoolObjectAllocator<ActorDepthTreeNode>;
68 * Actor is the primary object with which Dali applications interact.
69 * UI controls can be built by combining multiple actors.
70 * Multi-Touch events are received through signals emitted by the actor tree.
72 * An Actor is a proxy for a Node in the scene graph.
73 * When an Actor is added to the Stage, it creates a node and connects it to the scene graph.
74 * The scene-graph can be updated in a separate thread, so the connection is done using an asynchronous message.
75 * When a tree of Actors is detached from the Stage, a message is sent to destroy the associated nodes.
77 class Actor : public Object, public ActorParent
81 * @brief Struct to hold an actor and a dimension
83 struct ActorDimensionPair
88 * @param[in] newActor The actor to assign
89 * @param[in] newDimension The dimension to assign
91 ActorDimensionPair(Actor* newActor, Dimension::Type newDimension)
93 dimension(newDimension)
98 * @brief Equality operator
100 * @param[in] lhs The left hand side argument
101 * @param[in] rhs The right hand side argument
103 bool operator==(const ActorDimensionPair& rhs)
105 return (actor == rhs.actor) && (dimension == rhs.dimension);
108 Actor* actor; ///< The actor to hold
109 Dimension::Type dimension; ///< The dimension to hold
112 using ActorDimensionStack = std::vector<ActorDimensionPair>;
116 * Create a new actor.
117 * @return A smart-pointer to the newly allocated Actor.
119 static ActorPtr New();
122 * Helper to create node for derived classes who don't have their own node type
123 * @return pointer to newly created unique node
125 static const SceneGraph::Node* CreateNode();
128 * Retrieve the name of the actor.
131 std::string_view GetName() const
133 return mName.GetStringView();
137 * Set the name of the actor.
138 * @param[in] name The new name.
140 void SetName(std::string_view name);
143 * @copydoc Dali::Actor::GetId
145 uint32_t GetId() const;
150 * Query whether an actor is the root actor, which is owned by the Stage.
151 * @return True if the actor is a root actor.
159 * Query whether the actor is connected to the Scene.
167 * Query whether the actor has any renderers.
168 * @return True if the actor is renderable.
170 bool IsRenderable() const
172 // inlined as this is called a lot in hit testing
173 return mRenderers && !mRenderers->empty();
177 * Query whether the actor is of class Dali::Layer
178 * @return True if the actor is a layer.
182 // inlined as this is called a lot in hit testing
187 * Gets the layer in which the actor is present
188 * @return The layer, which will be uninitialized if the actor is off-stage.
190 Dali::Layer GetLayer();
193 * @copydoc Dali::Internal::ActorParent::Add()
195 void Add(Actor& child) override;
198 * @copydoc Dali::Internal::ActorParent::Remove()
200 void Remove(Actor& child) override;
203 * @copydoc Dali::Actor::Unparent
208 * @copydoc Dali::Internal::ActorParent::GetChildCount()
210 uint32_t GetChildCount() const override;
213 * @copydoc Dali::Internal::ActorParent::GetChildAt
215 ActorPtr GetChildAt(uint32_t index) const override;
218 * Retrieve a reference to Actor's children.
219 * @note Not for public use.
220 * @return A reference to the container of children.
221 * @note The internal container is lazily initialized so ensure you check the child count before using the value returned by this method.
223 ActorContainer& GetChildrenInternal();
226 * @copydoc Dali::Internal::ActorParent::FindChildByName
228 ActorPtr FindChildByName(ConstString actorName) override;
231 * @copydoc Dali::Internal::ActorParent::FindChildById
233 ActorPtr FindChildById(const uint32_t id) override;
236 * @copydoc Dali::Internal::ActorParent::UnparentChildren
238 void UnparentChildren() override;
241 * Retrieve the parent of an Actor.
242 * @return The parent actor, or NULL if the Actor does not have a parent.
244 Actor* GetParent() const
246 return static_cast<Actor*>(mParent);
250 * Calculates screen position and size.
252 * @return pair of two values, position of top-left corner on screen and size respectively.
254 Rect<> CalculateScreenExtents() const;
257 * Sets the size of an actor.
258 * This does not interfere with the actors scale factor.
259 * @param [in] width The new width.
260 * @param [in] height The new height.
262 void SetSize(float width, float height);
265 * Sets the size of an actor.
266 * This does not interfere with the actors scale factor.
267 * @param [in] width The size of the actor along the x-axis.
268 * @param [in] height The size of the actor along the y-axis.
269 * @param [in] depth The size of the actor along the z-axis.
271 void SetSize(float width, float height, float depth);
274 * Sets the size of an actor.
275 * This does not interfere with the actors scale factor.
276 * @param [in] size The new size.
278 void SetSize(const Vector2& size);
281 * Sets the update size for an actor.
283 * @param[in] size The size to set.
285 void SetSizeInternal(const Vector2& size);
288 * Sets the size of an actor.
289 * This does not interfere with the actors scale factor.
290 * @param [in] size The new size.
292 void SetSize(const Vector3& size);
295 * Sets the update size for an actor.
297 * @param[in] size The size to set.
299 void SetSizeInternal(const Vector3& size);
302 * Set the width component of the Actor's size.
303 * @param [in] width The new width component.
305 void SetWidth(float width);
308 * Set the height component of the Actor's size.
309 * @param [in] height The new height component.
311 void SetHeight(float height);
314 * Set the depth component of the Actor's size.
315 * @param [in] depth The new depth component.
317 void SetDepth(float depth);
320 * Retrieve the Actor's size from event side.
321 * This size will be the size set or if animating then the target size.
322 * @return The Actor's size.
324 Vector3 GetTargetSize() const;
327 * Retrieve the Actor's size from update side.
328 * This size will be the size set or animating but will be a frame behind.
329 * @return The Actor's size.
331 const Vector3& GetCurrentSize() const;
334 * Return the natural size of the actor
336 * @return The actor's natural size
338 virtual Vector3 GetNaturalSize() const;
341 * Set the origin of an actor, within its parent's area.
342 * This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
343 * and (1.0, 1.0, 0.5) is the bottom-right corner.
344 * The default parent-origin is top-left (0.0, 0.0, 0.5).
345 * An actor position is the distance between this origin, and the actors anchor-point.
346 * @param [in] origin The new parent-origin.
348 void SetParentOrigin(const Vector3& origin);
351 * Retrieve the parent-origin of an actor.
352 * @return The parent-origin.
354 const Vector3& GetCurrentParentOrigin() const;
357 * Set the anchor-point of an actor. This is expressed in 2D unit coordinates, such that
358 * (0.0, 0.0, 0.5) is the top-left corner of the actor, and (1.0, 1.0, 0.5) is the bottom-right corner.
359 * The default anchor point is top-left (0.0, 0.0, 0.5).
360 * An actor position is the distance between its parent-origin, and this anchor-point.
361 * An actor's rotation is centered around its anchor-point.
362 * @param [in] anchorPoint The new anchor-point.
364 void SetAnchorPoint(const Vector3& anchorPoint);
367 * Retrieve the anchor-point of an actor.
368 * @return The anchor-point.
370 const Vector3& GetCurrentAnchorPoint() const;
373 * Sets the position of the Actor.
374 * The coordinates are relative to the Actor's parent.
375 * The Actor's z position will be set to 0.0f.
376 * @param [in] x The new x position
377 * @param [in] y The new y position
379 void SetPosition(float x, float y);
382 * Sets the position of the Actor.
383 * The coordinates are relative to the Actor's parent.
384 * @param [in] x The new x position
385 * @param [in] y The new y position
386 * @param [in] z The new z position
388 void SetPosition(float x, float y, float z);
391 * Sets the position of the Actor.
392 * The coordinates are relative to the Actor's parent.
393 * @param [in] position The new position.
395 void SetPosition(const Vector3& position);
398 * Set the position of an actor along the X-axis.
399 * @param [in] x The new x position
404 * Set the position of an actor along the Y-axis.
405 * @param [in] y The new y position.
410 * Set the position of an actor along the Z-axis.
411 * @param [in] z The new z position
416 * Translate an actor relative to its existing position.
417 * @param[in] distance The actor will move by this distance.
419 void TranslateBy(const Vector3& distance);
422 * Retrieve the position of the Actor.
423 * The coordinates are relative to the Actor's parent.
424 * @return the Actor's position.
426 const Vector3& GetCurrentPosition() const;
429 * Retrieve the target position of the Actor.
430 * The coordinates are relative to the Actor's parent.
431 * @return the Actor's position.
433 const Vector3& GetTargetPosition() const
435 return mTargetPosition;
439 * @copydoc Dali::Actor::GetCurrentWorldPosition()
441 const Vector3& GetCurrentWorldPosition() const;
444 * @copydoc Dali::Actor::SetInheritPosition()
446 void SetInheritPosition(bool inherit);
449 * @copydoc Dali::Actor::IsPositionInherited()
451 bool IsPositionInherited() const
453 return mInheritPosition;
457 * Sets the orientation of the Actor.
458 * @param [in] angleRadians The new orientation angle in radians.
459 * @param [in] axis The new axis of orientation.
461 void SetOrientation(const Radian& angleRadians, const Vector3& axis);
464 * Sets the orientation of the Actor.
465 * @param [in] orientation The new orientation.
467 void SetOrientation(const Quaternion& orientation);
470 * Rotate an actor around its existing rotation axis.
471 * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
472 * @param[in] axis The axis of the rotation to combine with the existing rotation.
474 void RotateBy(const Radian& angleRadians, const Vector3& axis);
477 * Apply a relative rotation to an actor.
478 * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
480 void RotateBy(const Quaternion& relativeRotation);
483 * Retreive the Actor's orientation.
484 * @return the orientation.
486 const Quaternion& GetCurrentOrientation() const;
489 * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
490 * Switching this off means that using SetOrientation() sets the actor's world orientation.
491 * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
493 void SetInheritOrientation(bool inherit);
496 * Returns whether the actor inherit's it's parent's orientation.
497 * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
499 bool IsOrientationInherited() const
501 return mInheritOrientation;
505 * Sets the factor of the parents size used for the child actor.
506 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
507 * @param[in] factor The vector to multiply the parents size by to get the childs size.
509 void SetSizeModeFactor(const Vector3& factor);
512 * Gets the factor of the parents size used for the child actor.
513 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
514 * @return The vector being used to multiply the parents size by to get the childs size.
516 const Vector3& GetSizeModeFactor() const;
519 * @copydoc Dali::Actor::GetCurrentWorldOrientation()
521 const Quaternion& GetCurrentWorldOrientation() const;
524 * Sets a scale factor applied to an actor.
525 * @param [in] scale The scale factor applied on all axes.
527 void SetScale(float scale);
530 * Sets a scale factor applied to an actor.
531 * @param [in] scaleX The scale factor applied along the x-axis.
532 * @param [in] scaleY The scale factor applied along the y-axis.
533 * @param [in] scaleZ The scale factor applied along the z-axis.
535 void SetScale(float scaleX, float scaleY, float scaleZ);
538 * Sets a scale factor applied to an actor.
539 * @param [in] scale A vector representing the scale factor for each axis.
541 void SetScale(const Vector3& scale);
544 * Set the x component of the scale factor.
545 * @param [in] x The new x value.
547 void SetScaleX(float x);
550 * Set the y component of the scale factor.
551 * @param [in] y The new y value.
553 void SetScaleY(float y);
556 * Set the z component of the scale factor.
557 * @param [in] z The new z value.
559 void SetScaleZ(float z);
562 * Apply a relative scale to an actor.
563 * @param[in] relativeScale The scale to combine with the actors existing scale.
565 void ScaleBy(const Vector3& relativeScale);
568 * Retrieve the scale factor applied to an actor.
569 * @return A vector representing the scale factor for each axis.
571 const Vector3& GetCurrentScale() const;
574 * @copydoc Dali::Actor::GetCurrentWorldScale()
576 const Vector3& GetCurrentWorldScale() const;
579 * @copydoc Dali::Actor::SetInheritScale()
581 void SetInheritScale(bool inherit);
584 * @copydoc Dali::Actor::IsScaleInherited()
586 bool IsScaleInherited() const
588 return mInheritScale;
592 * @copydoc Dali::Actor::GetCurrentWorldMatrix()
594 Matrix GetCurrentWorldMatrix() const;
599 * Sets the visibility flag of an actor.
600 * @param[in] visible The new visibility flag.
602 void SetVisible(bool visible);
605 * Retrieve the visibility flag of an actor.
606 * @return The visibility flag.
608 bool IsVisible() const;
611 * Sets the opacity of an actor.
612 * @param [in] opacity The new opacity.
614 void SetOpacity(float opacity);
617 * Retrieve the actor's opacity.
618 * @return The actor's opacity.
620 float GetCurrentOpacity() const;
623 * Retrieve the actor's clipping mode.
624 * @return The actor's clipping mode (cached)
626 ClippingMode::Type GetClippingMode() const
628 return mClippingMode;
632 * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
633 * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
634 * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
635 * hover event signal will be emitted.
637 * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
639 * actor.SetSensitive(false);
642 * Then, to re-enable the touch or hover event signal emission, the application should call:
644 * actor.SetSensitive(true);
647 * @see SignalTouch() and SignalHover().
648 * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
649 * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
651 void SetSensitive(bool sensitive)
653 mSensitive = sensitive;
657 * Query whether an actor emits touch or hover event signals.
658 * @see SetSensitive(bool)
659 * @return true, if emission of touch or hover event signals is enabled, false otherwise.
661 bool IsSensitive() const
667 * @copydoc Dali::Actor::SetDrawMode
669 void SetDrawMode(DrawMode::Type drawMode);
672 * @copydoc Dali::Actor::GetDrawMode
674 DrawMode::Type GetDrawMode() const
680 * @copydoc Dali::Actor::IsOverlay
682 bool IsOverlay() const
684 return (DrawMode::OVERLAY_2D == mDrawMode);
688 * Sets the actor's color. The final color of actor depends on its color mode.
689 * This final color is applied to the drawable elements of an actor.
690 * @param [in] color The new color.
692 void SetColor(const Vector4& color);
695 * Set the red component of the color.
696 * @param [in] red The new red component.
698 void SetColorRed(float red);
701 * Set the green component of the color.
702 * @param [in] green The new green component.
704 void SetColorGreen(float green);
707 * Set the blue component of the scale factor.
708 * @param [in] blue The new blue value.
710 void SetColorBlue(float blue);
713 * Retrieve the actor's color.
716 const Vector4& GetCurrentColor() const;
719 * Sets the actor's color mode.
720 * Color mode specifies whether Actor uses its own color or inherits its parent color
721 * @param [in] colorMode to use.
723 void SetColorMode(ColorMode colorMode);
726 * Returns the actor's color mode.
727 * @return currently used colorMode.
729 ColorMode GetColorMode() const
735 * @copydoc Dali::Actor::GetCurrentWorldColor()
737 const Vector4& GetCurrentWorldColor() const;
740 * @copydoc Dali::Actor::GetHierarchyDepth()
742 inline int32_t GetHierarchyDepth() const
753 * Get the actor's sorting depth
755 * @return The depth used for hit-testing and renderer sorting
757 uint32_t GetSortingDepth()
763 // Size negotiation virtual functions
766 * @brief Called after the size negotiation has been finished for this control.
768 * The control is expected to assign this given size to itself/its children.
770 * Should be overridden by derived classes if they need to layout
771 * actors differently after certain operations like add or remove
772 * actors, resize or after changing specific properties.
774 * Note! As this function is called from inside the size negotiation algorithm, you cannot
775 * call RequestRelayout (the call would just be ignored)
777 * @param[in] size The allocated size.
778 * @param[in,out] container The control should add actors to this container that it is not able
779 * to allocate a size for.
781 virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
786 * @brief Notification for deriving classes when the resize policy is set
788 * @param[in] policy The policy being set
789 * @param[in] dimension The dimension the policy is being set for
791 virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
796 * @brief Virtual method to notify deriving classes that relayout dependencies have been
797 * met and the size for this object is about to be calculated for the given dimension
799 * @param dimension The dimension that is about to be calculated
801 virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
806 * @brief Virtual method to notify deriving classes that the size for a dimension
807 * has just been negotiated
809 * @param[in] size The new size for the given dimension
810 * @param[in] dimension The dimension that was just negotiated
812 virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
817 * @brief Determine if this actor is dependent on it's children for relayout
819 * @param dimension The dimension(s) to check for
820 * @return Return if the actor is dependent on it's children
822 virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
825 * @brief Determine if this actor is dependent on it's children for relayout.
827 * Called from deriving classes
829 * @param dimension The dimension(s) to check for
830 * @return Return if the actor is dependent on it's children
832 virtual bool RelayoutDependentOnChildrenBase(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
835 * @brief Calculate the size for a child
837 * @param[in] child The child actor to calculate the size for
838 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
839 * @return Return the calculated size for the given dimension
841 virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension);
844 * @brief This method is called during size negotiation when a height is required for a given width.
846 * Derived classes should override this if they wish to customize the height returned.
848 * @param width to use.
849 * @return the height based on the width.
851 virtual float GetHeightForWidth(float width);
854 * @brief This method is called during size negotiation when a width is required for a given height.
856 * Derived classes should override this if they wish to customize the width returned.
858 * @param height to use.
859 * @return the width based on the width.
861 virtual float GetWidthForHeight(float height);
867 * @brief Called by the RelayoutController to negotiate the size of an actor.
869 * The size allocated by the the algorithm is passed in which the
870 * actor must adhere to. A container is passed in as well which
871 * the actor should populate with actors it has not / or does not
872 * need to handle in its size negotiation.
874 * @param[in] size The allocated size.
875 * @param[in,out] container The container that holds actors that are fed back into the
876 * RelayoutController algorithm.
878 void NegotiateSize(const Vector2& size, RelayoutContainer& container);
881 * @brief Set whether size negotiation should use the assigned size of the actor
882 * during relayout for the given dimension(s)
884 * @param[in] use Whether the assigned size of the actor should be used
885 * @param[in] dimension The dimension(s) to set. Can be a bitfield of multiple dimensions
887 void SetUseAssignedSize(bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
890 * @brief Returns whether size negotiation should use the assigned size of the actor
891 * during relayout for a single dimension
893 * @param[in] dimension The dimension to get
894 * @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
896 bool GetUseAssignedSize(Dimension::Type dimension) const;
899 * @copydoc Dali::Actor::SetResizePolicy()
901 void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
904 * @copydoc Dali::Actor::GetResizePolicy()
906 ResizePolicy::Type GetResizePolicy(Dimension::Type dimension) const;
909 * @copydoc Dali::Actor::SetSizeScalePolicy()
911 void SetSizeScalePolicy(SizeScalePolicy::Type policy);
914 * @copydoc Dali::Actor::GetSizeScalePolicy()
916 SizeScalePolicy::Type GetSizeScalePolicy() const;
919 * @copydoc Dali::Actor::SetDimensionDependency()
921 void SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency);
924 * @copydoc Dali::Actor::GetDimensionDependency()
926 Dimension::Type GetDimensionDependency(Dimension::Type dimension) const;
929 * @brief Set the size negotiation relayout enabled on this actor
931 * @param[in] relayoutEnabled Boolean to enable or disable relayout
933 void SetRelayoutEnabled(bool relayoutEnabled);
936 * @brief Return if relayout is enabled
938 * @return Return if relayout is enabled or not for this actor
940 bool IsRelayoutEnabled() const;
943 * @brief Mark an actor as having it's layout dirty
945 * @param dirty Whether to mark actor as dirty or not
946 * @param dimension The dimension(s) to mark as dirty
948 void SetLayoutDirty(bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
951 * @brief Return if any of an actor's dimensions are marked as dirty
953 * @param dimension The dimension(s) to check
954 * @return Return if any of the requested dimensions are dirty
956 bool IsLayoutDirty(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
959 * @brief Returns if relayout is enabled and the actor is not dirty
961 * @return Return if it is possible to relayout the actor
963 bool RelayoutPossible(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
966 * @brief Returns if relayout is enabled and the actor is dirty
968 * @return Return if it is required to relayout the actor
970 bool RelayoutRequired(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
973 * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
975 * This method is automatically called from OnSceneConnection(), OnChildAdd(),
976 * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
978 * This method can also be called from a derived class every time it needs a different size.
979 * At the end of event processing, the relayout process starts and
980 * all controls which requested Relayout will have their sizes (re)negotiated.
982 * @note RelayoutRequest() can be called multiple times; the size negotiation is still
983 * only performed once, i.e. there is no need to keep track of this in the calling side.
985 void RelayoutRequest(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
988 * @brief Determine if this actor is dependent on it's parent for relayout
990 * @param dimension The dimension(s) to check for
991 * @return Return if the actor is dependent on it's parent
993 bool RelayoutDependentOnParent(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
996 * @brief Determine if this actor has another dimension depedent on the specified one
998 * @param dimension The dimension to check for
999 * @param dependentDimension The dimension to check for dependency with
1000 * @return Return if the actor is dependent on this dimension
1002 bool RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension);
1005 * @brief Calculate the size of a dimension
1007 * @param[in] dimension The dimension to calculate the size for
1008 * @param[in] maximumSize The upper bounds on the size
1009 * @return Return the calculated size for the dimension
1011 float CalculateSize(Dimension::Type dimension, const Vector2& maximumSize);
1014 * Negotiate a dimension based on the size of the parent
1016 * @param[in] dimension The dimension to negotiate on
1017 * @return Return the negotiated size
1019 float NegotiateFromParent(Dimension::Type dimension);
1022 * Negotiate a dimension based on the size of the parent. Fitting inside.
1024 * @param[in] dimension The dimension to negotiate on
1025 * @return Return the negotiated size
1027 float NegotiateFromParentFit(Dimension::Type dimension);
1030 * Negotiate a dimension based on the size of the parent. Flooding the whole space.
1032 * @param[in] dimension The dimension to negotiate on
1033 * @return Return the negotiated size
1035 float NegotiateFromParentFlood(Dimension::Type dimension);
1038 * @brief Negotiate a dimension based on the size of the children
1040 * @param[in] dimension The dimension to negotiate on
1041 * @return Return the negotiated size
1043 float NegotiateFromChildren(Dimension::Type dimension);
1046 * Set the negotiated dimension value for the given dimension(s)
1048 * @param negotiatedDimension The value to set
1049 * @param dimension The dimension(s) to set the value for
1051 void SetNegotiatedDimension(float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1054 * Return the value of negotiated dimension for the given dimension
1056 * @param dimension The dimension to retrieve
1057 * @return Return the value of the negotiated dimension
1059 float GetNegotiatedDimension(Dimension::Type dimension) const;
1062 * @brief Set the padding for a dimension
1064 * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
1065 * @param[in] dimension The dimension to set
1067 void SetPadding(const Vector2& padding, Dimension::Type dimension);
1070 * Return the value of padding for the given dimension
1072 * @param dimension The dimension to retrieve
1073 * @return Return the value of padding for the dimension
1075 Vector2 GetPadding(Dimension::Type dimension) const;
1078 * Return the actor size for a given dimension
1080 * @param[in] dimension The dimension to retrieve the size for
1081 * @return Return the size for the given dimension
1083 float GetSize(Dimension::Type dimension) const;
1086 * Return the natural size of the actor for a given dimension
1088 * @param[in] dimension The dimension to retrieve the size for
1089 * @return Return the natural size for the given dimension
1091 float GetNaturalSize(Dimension::Type dimension) const;
1094 * @brief Return the amount of size allocated for relayout
1096 * May include padding
1098 * @param[in] dimension The dimension to retrieve
1099 * @return Return the size
1101 float GetRelayoutSize(Dimension::Type dimension) const;
1104 * @brief If the size has been negotiated return that else return normal size
1106 * @param[in] dimension The dimension to retrieve
1107 * @return Return the size
1109 float GetLatestSize(Dimension::Type dimension) const;
1112 * Apply the negotiated size to the actor
1114 * @param[in] container The container to fill with actors that require further relayout
1116 void SetNegotiatedSize(RelayoutContainer& container);
1119 * @brief Flag the actor as having it's layout dimension negotiated.
1121 * @param[in] negotiated The status of the flag to set.
1122 * @param[in] dimension The dimension to set the flag for
1124 void SetLayoutNegotiated(bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1127 * @brief Test whether the layout dimension for this actor has been negotiated or not.
1129 * @param[in] dimension The dimension to determine the value of the flag for
1130 * @return Return if the layout dimension is negotiated or not.
1132 bool IsLayoutNegotiated(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
1135 * @brief provides the Actor implementation of GetHeightForWidth
1136 * @param width to use.
1137 * @return the height based on the width.
1139 float GetHeightForWidthBase(float width);
1142 * @brief provides the Actor implementation of GetWidthForHeight
1143 * @param height to use.
1144 * @return the width based on the height.
1146 float GetWidthForHeightBase(float height);
1149 * @brief Calculate the size for a child
1151 * @param[in] child The child actor to calculate the size for
1152 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
1153 * @return Return the calculated size for the given dimension
1155 float CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension);
1158 * @brief Set the preferred size for size negotiation
1160 * @param[in] size The preferred size to set
1162 void SetPreferredSize(const Vector2& size);
1165 * @brief Return the preferred size used for size negotiation
1167 * @return Return the preferred size
1169 Vector2 GetPreferredSize() const;
1172 * @copydoc Dali::Actor::SetMinimumSize
1174 void SetMinimumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1177 * @copydoc Dali::Actor::GetMinimumSize
1179 float GetMinimumSize(Dimension::Type dimension) const;
1182 * @copydoc Dali::Actor::SetMaximumSize
1184 void SetMaximumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1187 * @copydoc Dali::Actor::GetMaximumSize
1189 float GetMaximumSize(Dimension::Type dimension) const;
1192 * @copydoc Dali::Actor::AddRenderer()
1194 uint32_t AddRenderer(Renderer& renderer);
1197 * @copydoc Dali::Actor::GetRendererCount()
1199 uint32_t GetRendererCount() const;
1202 * @copydoc Dali::Actor::GetRendererAt()
1204 RendererPtr GetRendererAt(uint32_t index);
1207 * @copydoc Dali::Actor::RemoveRenderer()
1209 void RemoveRenderer(Renderer& renderer);
1212 * @copydoc Dali::Actor::RemoveRenderer()
1214 void RemoveRenderer(uint32_t index);
1217 * Set BlendEquation at each renderer that added on this Actor.
1219 void SetBlendEquation(DevelBlendEquation::Type blendEquation);
1222 * @brief Get Blend Equation that applied to this Actor
1224 DevelBlendEquation::Type GetBlendEquation() const;
1228 * Converts screen coordinates into the actor's coordinate system.
1229 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1230 * @param[out] localX On return, the X-coordinate relative to the actor.
1231 * @param[out] localY On return, the Y-coordinate relative to the actor.
1232 * @param[in] screenX The screen X-coordinate.
1233 * @param[in] screenY The screen Y-coordinate.
1234 * @return True if the conversion succeeded.
1236 bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const;
1239 * Converts screen coordinates into the actor's coordinate system.
1240 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1241 * @param[in] renderTask The render-task used to display the actor.
1242 * @param[out] localX On return, the X-coordinate relative to the actor.
1243 * @param[out] localY On return, the Y-coordinate relative to the actor.
1244 * @param[in] screenX The screen X-coordinate.
1245 * @param[in] screenY The screen Y-coordinate.
1246 * @return True if the conversion succeeded.
1248 bool ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const;
1251 * Converts from the actor's coordinate system to screen coordinates.
1252 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1253 * @param[in] viewMatrix The view-matrix
1254 * @param[in] projectionMatrix The projection-matrix
1255 * @param[in] viewport The view-port
1256 * @param[out] localX On return, the X-coordinate relative to the actor.
1257 * @param[out] localY On return, the Y-coordinate relative to the actor.
1258 * @param[in] screenX The screen X-coordinate.
1259 * @param[in] screenY The screen Y-coordinate.
1260 * @return True if the conversion succeeded.
1262 bool ScreenToLocal(const Matrix& viewMatrix,
1263 const Matrix& projectionMatrix,
1264 const Viewport& viewport,
1268 float screenY) const;
1271 * Sets whether the actor should receive a notification when touch or hover motion events leave
1272 * the boundary of the actor.
1274 * @note By default, this is set to false as most actors do not require this.
1275 * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
1277 * @param[in] required Should be set to true if a Leave event is required
1279 void SetLeaveRequired(bool required)
1281 mLeaveRequired = required;
1285 * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1286 * the boundary of the actor.
1287 * @return true if a Leave event is required, false otherwise.
1289 bool GetLeaveRequired() const
1291 return mLeaveRequired;
1295 * @copydoc Dali::Actor::SetKeyboardFocusable()
1297 void SetKeyboardFocusable(bool focusable)
1299 mKeyboardFocusable = focusable;
1303 * @copydoc Dali::Actor::IsKeyboardFocusable()
1305 bool IsKeyboardFocusable() const
1307 return mKeyboardFocusable;
1311 * Query whether the application or derived actor type requires intercept touch events.
1312 * @return True if intercept touch events are required.
1314 bool GetInterceptTouchRequired() const
1316 return !mInterceptTouchedSignal.Empty();
1320 * Query whether the application or derived actor type requires touch events.
1321 * @return True if touch events are required.
1323 bool GetTouchRequired() const
1325 return !mTouchedSignal.Empty();
1329 * Query whether the application or derived actor type requires hover events.
1330 * @return True if hover events are required.
1332 bool GetHoverRequired() const
1334 return !mHoveredSignal.Empty();
1338 * Query whether the application or derived actor type requires wheel events.
1339 * @return True if wheel events are required.
1341 bool GetWheelEventRequired() const
1343 return !mWheelEventSignal.Empty();
1347 * Query whether the actor is actually hittable. This method checks whether the actor is
1348 * sensitive, has the visibility flag set to true and is not fully transparent.
1349 * @return true, if it can be hit, false otherwise.
1351 bool IsHittable() const
1353 return IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
1357 * Query whether the actor captures all touch after it starts even if touch leaves its boundary.
1358 * @return true, if it captures all touch after start
1360 bool CapturesAllTouchAfterStart() const
1362 return mCaptureAllTouchAfterStart;
1366 * Sets the touch area offset of an actor.
1367 * @param [in] offset The new offset of area (left, right, bottom, top).
1369 void SetTouchAreaOffset(Rect<int> offset)
1371 mTouchAreaOffset = offset;
1375 * Retrieve the Actor's touch area offset.
1376 * @return The Actor's touch area offset.
1378 const Rect<int>& GetTouchAreaOffset() const
1380 return mTouchAreaOffset;
1386 * Retrieve the gesture data associated with this actor. The first call to this method will
1387 * allocate space for the ActorGestureData so this should only be called if an actor really does
1389 * @return Reference to the ActorGestureData for this actor.
1390 * @note Once the gesture-data is created for an actor it is likely that gestures are required
1391 * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
1393 ActorGestureData& GetGestureData();
1396 * Queries whether the actor requires the gesture type.
1397 * @param[in] type The gesture type.
1398 * @return True if the gesture is required, false otherwise.
1400 bool IsGestureRequired(GestureType::Value type) const;
1405 * Used by the EventProcessor to emit intercept touch event signals.
1406 * @param[in] touch The touch data.
1407 * @return True if the event was intercepted.
1409 bool EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch);
1412 * Used by the EventProcessor to emit touch event signals.
1413 * @param[in] touch The touch data.
1414 * @return True if the event was consumed.
1416 bool EmitTouchEventSignal(const Dali::TouchEvent& touch);
1419 * Used by the EventProcessor to emit hover event signals.
1420 * @param[in] event The hover event.
1421 * @return True if the event was consumed.
1423 bool EmitHoverEventSignal(const Dali::HoverEvent& event);
1426 * Used by the EventProcessor to emit wheel event signals.
1427 * @param[in] event The wheel event.
1428 * @return True if the event was consumed.
1430 bool EmitWheelEventSignal(const Dali::WheelEvent& event);
1433 * @brief Emits the visibility change signal for this actor and all its children.
1434 * @param[in] visible Whether the actor has become visible or not.
1435 * @param[in] type Whether the actor's visible property has changed or a parent's.
1437 void EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type);
1440 * @brief Emits the layout direction change signal for this actor and all its children.
1441 * @param[in] type Whether the actor's layout direction property has changed or a parent's.
1443 void EmitLayoutDirectionChangedSignal(LayoutDirection::Type type);
1446 * @copydoc DevelActor::InterceptTouchedSignal()
1448 Dali::Actor::TouchEventSignalType& InterceptTouchedSignal()
1450 return mInterceptTouchedSignal;
1454 * @copydoc Dali::Actor::TouchedSignal()
1456 Dali::Actor::TouchEventSignalType& TouchedSignal()
1458 return mTouchedSignal;
1462 * @copydoc Dali::Actor::HoveredSignal()
1464 Dali::Actor::HoverSignalType& HoveredSignal()
1466 return mHoveredSignal;
1470 * @copydoc Dali::Actor::WheelEventSignal()
1472 Dali::Actor::WheelEventSignalType& WheelEventSignal()
1474 return mWheelEventSignal;
1478 * @copydoc Dali::Actor::OnSceneSignal()
1480 Dali::Actor::OnSceneSignalType& OnSceneSignal()
1482 return mOnSceneSignal;
1486 * @copydoc Dali::Actor::OffSceneSignal()
1488 Dali::Actor::OffSceneSignalType& OffSceneSignal()
1490 return mOffSceneSignal;
1494 * @copydoc Dali::Actor::OnRelayoutSignal()
1496 Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal()
1498 return mOnRelayoutSignal;
1502 * @copydoc DevelActor::VisibilityChangedSignal
1504 DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal()
1506 return mVisibilityChangedSignal;
1510 * @copydoc LayoutDirectionChangedSignal
1512 Dali::Actor::LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal()
1514 return mLayoutDirectionChangedSignal;
1518 * @copydoc DevelActor::ChildAddedSignal
1520 DevelActor::ChildChangedSignalType& ChildAddedSignal();
1523 * @copydoc DevelActor::ChildRemovedSignal
1525 DevelActor::ChildChangedSignalType& ChildRemovedSignal();
1528 * @copydoc DevelActor::ChildOrderChangedSignal
1530 DevelActor::ChildOrderChangedSignalType& ChildOrderChangedSignal();
1533 * Connects a callback function with the object's signals.
1534 * @param[in] object The object providing the signal.
1535 * @param[in] tracker Used to disconnect the signal.
1536 * @param[in] signalName The signal to connect to.
1537 * @param[in] functor A newly allocated FunctorDelegate.
1538 * @return True if the signal was connected.
1539 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
1541 static bool DoConnectSignal(BaseObject* object,
1542 ConnectionTrackerInterface* tracker,
1543 const std::string& signalName,
1544 FunctorDelegate* functor);
1547 * Performs actions as requested using the action name.
1548 * @param[in] object The object on which to perform the action.
1549 * @param[in] actionName The action to perform.
1550 * @param[in] attributes The attributes with which to perfrom this action.
1551 * @return true if the action was done.
1553 static bool DoAction(BaseObject* object,
1554 const std::string& actionName,
1555 const Property::Map& attributes);
1561 * For use in derived classes.
1562 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1564 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
1577 * Protected Constructor. See Actor::New().
1578 * The second-phase construction Initialize() member should be called immediately after this.
1579 * @param[in] derivedType The derived type of actor (if any).
1580 * @param[in] reference to the node
1582 Actor(DerivedType derivedType, const SceneGraph::Node& node);
1585 * Second-phase constructor. Must be called immediately after creating a new Actor;
1587 void Initialize(void);
1590 * A reference counted object may only be deleted by calling Unreference()
1595 * Called on a child during Add() when the parent actor is connected to the Scene.
1596 * @param[in] parentDepth The depth of the parent in the hierarchy.
1598 void ConnectToScene(uint32_t parentDepth);
1601 * Helper for ConnectToScene, to recursively connect a tree of actors.
1602 * This is atomic i.e. not interrupted by user callbacks.
1603 * @param[in] depth The depth in the hierarchy of the actor
1604 * @param[out] connectionList On return, the list of connected actors which require notification.
1606 void RecursiveConnectToScene(ActorContainer& connectionList, uint32_t depth);
1609 * Connect the Node associated with this Actor to the scene-graph.
1611 void ConnectToSceneGraph();
1614 * Helper for ConnectToScene, to notify a connected actor through the public API.
1616 void NotifyStageConnection();
1619 * Called on a child during Remove() when the actor was previously on the Stage.
1621 void DisconnectFromStage();
1624 * Helper for DisconnectFromStage, to recursively disconnect a tree of actors.
1625 * This is atomic i.e. not interrupted by user callbacks.
1626 * @param[out] disconnectionList On return, the list of disconnected actors which require notification.
1628 void RecursiveDisconnectFromStage(ActorContainer& disconnectionList);
1631 * Disconnect the Node associated with this Actor from the scene-graph.
1633 void DisconnectFromSceneGraph();
1636 * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1638 void NotifyStageDisconnection();
1641 * When the Actor is OnScene, checks whether the corresponding Node is connected to the scene graph.
1642 * @return True if the Actor is OnScene & has a Node connected to the scene graph.
1644 bool IsNodeConnected() const;
1648 * Trigger a rebuild of the actor depth tree from this root
1649 * If a Layer3D is encountered, then this doesn't descend any further.
1650 * The mSortedDepth of each actor is set appropriately.
1652 void RebuildDepthTree();
1656 * Traverse the actor tree, inserting actors into the depth tree in sibling order.
1657 * @param[in] sceneGraphNodeDepths A vector capturing the nodes and their depth index
1658 * @param[in,out] depthIndex The current depth index (traversal index)
1660 void DepthTraverseActorTree(OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex);
1663 // Default property extensions from Object
1666 * @copydoc Dali::Internal::Object::SetDefaultProperty()
1668 void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override;
1671 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1673 void SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value) override;
1676 * @copydoc Dali::Internal::Object::GetDefaultProperty()
1678 Property::Value GetDefaultProperty(Property::Index index) const override;
1681 * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
1683 Property::Value GetDefaultPropertyCurrentValue(Property::Index index) const override;
1686 * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
1688 void OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) override;
1691 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1693 const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty(Property::Index index) const override;
1696 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1698 const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override;
1701 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1703 int32_t GetPropertyComponentIndex(Property::Index index) const override;
1706 * @copydoc Dali::Internal::Object::IsAnimationPossible()
1708 bool IsAnimationPossible() const override
1714 * Retrieve the actor's node.
1715 * @return The node used by this actor
1717 const SceneGraph::Node& GetNode() const;
1720 * @copydoc Dali::DevelActor::Raise()
1725 * @copydoc Dali::DevelActor::Lower()
1730 * @copydoc Dali::DevelActor::RaiseToTop()
1735 * @copydoc Dali::DevelActor::LowerToBottom()
1737 void LowerToBottom();
1740 * @copydoc Dali::DevelActor::RaiseAbove()
1742 void RaiseAbove(Internal::Actor& target);
1745 * @copydoc Dali::DevelActor::LowerBelow()
1747 void LowerBelow(Internal::Actor& target);
1751 * Sets the scene which this actor is added to.
1752 * @param[in] scene The scene
1754 void SetScene(Scene& scene)
1760 * Gets the scene which this actor is added to.
1763 Scene& GetScene() const
1768 LayoutDirection::Type GetLayoutDirection() const
1770 return mLayoutDirection;
1783 struct AnimatedSizeFlag
1796 // Remove default constructor and copy constructor
1798 Actor(const Actor&) = delete;
1799 Actor& operator=(const Actor& rhs) = delete;
1802 * Set the actor's parent.
1803 * @param[in] parent The new parent.
1805 void SetParent(ActorParent* parent);
1808 * For use in derived classes, called after Initialize()
1810 virtual void OnInitialize()
1815 * For use in internal derived classes.
1816 * This is called during ConnectToScene(), after the actor has finished adding its node to the scene-graph.
1817 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1819 virtual void OnSceneConnectionInternal()
1824 * For use in internal derived classes.
1825 * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1826 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1828 virtual void OnSceneDisconnectionInternal()
1833 * For use in external (CustomActor) derived classes.
1834 * This is called after the atomic ConnectToScene() traversal has been completed.
1836 virtual void OnSceneConnectionExternal(int depth)
1841 * For use in external (CustomActor) derived classes.
1842 * This is called after the atomic DisconnectFromStage() traversal has been completed.
1844 virtual void OnSceneDisconnectionExternal()
1849 * For use in derived classes; this is called after Add() has added a child.
1850 * @param[in] child The child that was added.
1852 virtual void OnChildAdd(Actor& child)
1857 * For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ).
1858 * @param[in] child The child that was removed.
1860 virtual void OnChildRemove(Actor& child)
1865 * For use in derived classes.
1866 * This is called after SizeSet() has been called.
1868 virtual void OnSizeSet(const Vector3& targetSize)
1873 * @brief Retrieves the cached event side value of a default property.
1874 * @param[in] index The index of the property
1875 * @param[out] value Is set with the cached value of the property if found.
1876 * @return True if value set, false otherwise.
1878 bool GetCachedPropertyValue(Property::Index index, Property::Value& value) const;
1881 * @brief Retrieves the current value of a default property from the scene-graph.
1882 * @param[in] index The index of the property
1883 * @param[out] value Is set with the current scene-graph value of the property
1884 * @return True if value set, false otherwise.
1886 bool GetCurrentPropertyValue(Property::Index index, Property::Value& value) const;
1889 * @brief Ensure the relayouter is allocated
1891 Relayouter& EnsureRelayouter();
1894 * @brief Apply the size set policy to the input size
1896 * @param[in] size The size to apply the policy to
1897 * @return Return the adjusted size
1899 Vector2 ApplySizeSetPolicy(const Vector2& size);
1902 * Retrieve the parent object of an Actor.
1903 * @return The parent object, or NULL if the Actor does not have a parent.
1905 Object* GetParentObject() const override
1907 return static_cast<Actor*>(mParent);
1911 * @brief Get the current position of the actor in screen coordinates.
1913 * @return Returns the screen position of actor
1915 const Vector2 GetCurrentScreenPosition() const;
1918 * Sets the visibility flag of an actor.
1919 * @param[in] visible The new visibility flag.
1920 * @param[in] sendMessage Whether to send a message to the update thread or not.
1922 void SetVisibleInternal(bool visible, SendMessage::Type sendMessage);
1925 * @copydoc ActorParent::SetSiblingOrderOfChild
1927 void SetSiblingOrderOfChild(Actor& child, uint32_t order) override;
1930 * @copydoc ActorParent::GetSiblingOrderOfChild
1932 uint32_t GetSiblingOrderOfChild(const Actor& child) const override;
1935 * @copydoc ActorParent::RaiseChild
1937 void RaiseChild(Actor& child) override;
1940 * @copydoc ActorParent::LowerChild
1942 void LowerChild(Actor& child) override;
1945 * @copydoc ActorParent::RaiseChildToTop
1947 void RaiseChildToTop(Actor& child) override;
1950 * @copydoc ActorParent::LowerChildToBottom
1952 void LowerChildToBottom(Actor& child) override;
1955 * @copydoc ActorParent::RaiseChildAbove
1957 void RaiseChildAbove(Actor& child, Actor& target) override;
1960 * @copydoc ActorParent::LowerChildBelow()
1962 void LowerChildBelow(Actor& child, Actor& target) override;
1965 * Set whether a child actor inherits it's parent's layout direction. Default is to inherit.
1966 * @param[in] inherit - true if the actor should inherit layout direction, false otherwise.
1968 void SetInheritLayoutDirection(bool inherit);
1971 * Returns whether the actor inherits it's parent's layout direction.
1972 * @return true if the actor inherits it's parent's layout direction, false otherwise.
1974 bool IsLayoutDirectionInherited() const
1976 return mInheritLayoutDirection;
1980 * @brief Propagates layout direction recursively.
1981 * @param[in] direction New layout direction.
1983 void InheritLayoutDirectionRecursively(Dali::LayoutDirection::Type direction, bool set = false);
1986 * @brief Sets the update size hint of an actor.
1987 * @param [in] updateSizeHint The update size hint.
1989 void SetUpdateSizeHint(const Vector2& updateSizeHint);
1992 * @brief Recursively emits the visibility-changed-signal on the actor tree.
1994 * @param[in] visible The new visibility of the actor
1995 * @param[in] type Whether the actor's visible property has changed or a parent's
1997 void EmitVisibilityChangedSignalRecursively(bool visible,
1998 DevelActor::VisibilityChange::Type type);
2001 ActorParentImpl mParentImpl; ///< Implementation of ActorParent;
2002 ActorParent* mParent; ///< Each actor (except the root) can have one parent
2003 Scene* mScene; ///< The scene the actor is added to
2004 RendererContainer* mRenderers; ///< Renderer container
2005 Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
2006 Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
2007 Relayouter* mRelayoutData; ///< Struct to hold optional collection of relayout variables
2008 ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
2011 Dali::Actor::TouchEventSignalType mInterceptTouchedSignal;
2012 Dali::Actor::TouchEventSignalType mTouchedSignal;
2013 Dali::Actor::HoverSignalType mHoveredSignal;
2014 Dali::Actor::WheelEventSignalType mWheelEventSignal;
2015 Dali::Actor::OnSceneSignalType mOnSceneSignal;
2016 Dali::Actor::OffSceneSignalType mOffSceneSignal;
2017 Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
2018 DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
2019 Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal;
2021 Quaternion mTargetOrientation; ///< Event-side storage for orientation
2022 Vector4 mTargetColor; ///< Event-side storage for color
2023 Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
2024 Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
2025 Vector3 mTargetScale; ///< Event-side storage for scale
2026 Vector3 mAnimatedSize; ///< Event-side storage for size animation
2027 Rect<int> mTouchAreaOffset; ///< touch area offset (left, right, bottom, top)
2029 ConstString mName; ///< Name of the actor
2030 uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
2031 int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported
2032 uint16_t mUseAnimatedSize; ///< Whether the size is animated.
2034 const bool mIsRoot : 1; ///< Flag to identify the root actor
2035 const bool mIsLayer : 1; ///< Flag to identify that this is a layer
2036 bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene
2037 bool mSensitive : 1; ///< Whether the actor emits touch event signals
2038 bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
2039 bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
2040 bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
2041 bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
2042 bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
2043 bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
2044 bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
2045 bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
2046 bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
2047 bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent.
2048 bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area.
2049 LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left.
2050 DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
2051 ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
2052 ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use.
2053 DevelBlendEquation::Type mBlendEquation : 16; ///< Cached: Determines which blend equation will be used to render renderers.
2054 bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
2057 static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
2059 struct PropertyHandler;
2060 struct SiblingHandler;
2062 friend class ActorParentImpl; // Allow impl to call private methods on actor
2065 } // namespace Internal
2067 // Helpers for public-api forwarding methods
2069 inline Internal::Actor& GetImplementation(Dali::Actor& actor)
2071 DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
2073 BaseObject& handle = actor.GetBaseObject();
2075 return static_cast<Internal::Actor&>(handle);
2078 inline const Internal::Actor& GetImplementation(const Dali::Actor& actor)
2080 DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
2082 const BaseObject& handle = actor.GetBaseObject();
2084 return static_cast<const Internal::Actor&>(handle);
2089 #endif // DALI_INTERNAL_ACTOR_H