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 * @copydoc DevelActor::SetNeedGesturePropagation.
259 void SetNeedGesturePropagation(bool propagation);
262 * Retrieve need gesture propagation value
263 * @return The actor's need gesture propagation value.
265 bool NeedGesturePropagation();
268 * Sets the size of an actor.
269 * This does not interfere with the actors scale factor.
270 * @param [in] width The new width.
271 * @param [in] height The new height.
273 void SetSize(float width, float height);
276 * Sets the size of an actor.
277 * This does not interfere with the actors scale factor.
278 * @param [in] width The size of the actor along the x-axis.
279 * @param [in] height The size of the actor along the y-axis.
280 * @param [in] depth The size of the actor along the z-axis.
282 void SetSize(float width, float height, float depth);
285 * Sets the size of an actor.
286 * This does not interfere with the actors scale factor.
287 * @param [in] size The new size.
289 void SetSize(const Vector2& size);
292 * Sets the update size for an actor.
294 * @param[in] size The size to set.
296 void SetSizeInternal(const Vector2& size);
299 * Sets the size of an actor.
300 * This does not interfere with the actors scale factor.
301 * @param [in] size The new size.
303 void SetSize(const Vector3& size);
306 * Sets the update size for an actor.
308 * @param[in] size The size to set.
310 void SetSizeInternal(const Vector3& size);
313 * Set the width component of the Actor's size.
314 * @param [in] width The new width component.
316 void SetWidth(float width);
319 * Set the height component of the Actor's size.
320 * @param [in] height The new height component.
322 void SetHeight(float height);
325 * Set the depth component of the Actor's size.
326 * @param [in] depth The new depth component.
328 void SetDepth(float depth);
331 * Retrieve the Actor's size from event side.
332 * This size will be the size set or if animating then the target size.
333 * @return The Actor's size.
335 Vector3 GetTargetSize() const;
338 * Retrieve the Actor's size from update side.
339 * This size will be the size set or animating but will be a frame behind.
340 * @return The Actor's size.
342 const Vector3& GetCurrentSize() const;
345 * Return the natural size of the actor
347 * @return The actor's natural size
349 virtual Vector3 GetNaturalSize() const;
352 * Set the origin of an actor, within its parent's area.
353 * This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
354 * and (1.0, 1.0, 0.5) is the bottom-right corner.
355 * The default parent-origin is top-left (0.0, 0.0, 0.5).
356 * An actor position is the distance between this origin, and the actors anchor-point.
357 * @param [in] origin The new parent-origin.
359 void SetParentOrigin(const Vector3& origin);
362 * Retrieve the parent-origin of an actor.
363 * @return The parent-origin.
365 const Vector3& GetCurrentParentOrigin() const;
368 * Set the anchor-point of an actor. This is expressed in 2D unit coordinates, such that
369 * (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.
370 * The default anchor point is top-left (0.0, 0.0, 0.5).
371 * An actor position is the distance between its parent-origin, and this anchor-point.
372 * An actor's rotation is centered around its anchor-point.
373 * @param [in] anchorPoint The new anchor-point.
375 void SetAnchorPoint(const Vector3& anchorPoint);
378 * Retrieve the anchor-point of an actor.
379 * @return The anchor-point.
381 const Vector3& GetCurrentAnchorPoint() const;
384 * Sets the position of the Actor.
385 * The coordinates are relative to the Actor's parent.
386 * The Actor's z position will be set to 0.0f.
387 * @param [in] x The new x position
388 * @param [in] y The new y position
390 void SetPosition(float x, float y);
393 * Sets the position of the Actor.
394 * The coordinates are relative to the Actor's parent.
395 * @param [in] x The new x position
396 * @param [in] y The new y position
397 * @param [in] z The new z position
399 void SetPosition(float x, float y, float z);
402 * Sets the position of the Actor.
403 * The coordinates are relative to the Actor's parent.
404 * @param [in] position The new position.
406 void SetPosition(const Vector3& position);
409 * Set the position of an actor along the X-axis.
410 * @param [in] x The new x position
415 * Set the position of an actor along the Y-axis.
416 * @param [in] y The new y position.
421 * Set the position of an actor along the Z-axis.
422 * @param [in] z The new z position
427 * Translate an actor relative to its existing position.
428 * @param[in] distance The actor will move by this distance.
430 void TranslateBy(const Vector3& distance);
433 * Retrieve the position of the Actor.
434 * The coordinates are relative to the Actor's parent.
435 * @return the Actor's position.
437 const Vector3& GetCurrentPosition() const;
440 * Retrieve the target position of the Actor.
441 * The coordinates are relative to the Actor's parent.
442 * @return the Actor's position.
444 const Vector3& GetTargetPosition() const
446 return mTargetPosition;
450 * @copydoc Dali::Actor::GetCurrentWorldPosition()
452 const Vector3& GetCurrentWorldPosition() const;
455 * @copydoc Dali::Actor::SetInheritPosition()
457 void SetInheritPosition(bool inherit);
460 * @copydoc Dali::Actor::IsPositionInherited()
462 bool IsPositionInherited() const
464 return mInheritPosition;
468 * Sets the orientation of the Actor.
469 * @param [in] angleRadians The new orientation angle in radians.
470 * @param [in] axis The new axis of orientation.
472 void SetOrientation(const Radian& angleRadians, const Vector3& axis);
475 * Sets the orientation of the Actor.
476 * @param [in] orientation The new orientation.
478 void SetOrientation(const Quaternion& orientation);
481 * Rotate an actor around its existing rotation axis.
482 * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
483 * @param[in] axis The axis of the rotation to combine with the existing rotation.
485 void RotateBy(const Radian& angleRadians, const Vector3& axis);
488 * Apply a relative rotation to an actor.
489 * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
491 void RotateBy(const Quaternion& relativeRotation);
494 * Retreive the Actor's orientation.
495 * @return the orientation.
497 const Quaternion& GetCurrentOrientation() const;
500 * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
501 * Switching this off means that using SetOrientation() sets the actor's world orientation.
502 * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
504 void SetInheritOrientation(bool inherit);
507 * Returns whether the actor inherit's it's parent's orientation.
508 * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
510 bool IsOrientationInherited() const
512 return mInheritOrientation;
516 * Sets the factor of the parents size used for the child actor.
517 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
518 * @param[in] factor The vector to multiply the parents size by to get the childs size.
520 void SetSizeModeFactor(const Vector3& factor);
523 * Gets the factor of the parents size used for the child actor.
524 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
525 * @return The vector being used to multiply the parents size by to get the childs size.
527 const Vector3& GetSizeModeFactor() const;
530 * @copydoc Dali::Actor::GetCurrentWorldOrientation()
532 const Quaternion& GetCurrentWorldOrientation() const;
535 * Sets a scale factor applied to an actor.
536 * @param [in] scale The scale factor applied on all axes.
538 void SetScale(float scale);
541 * Sets a scale factor applied to an actor.
542 * @param [in] scaleX The scale factor applied along the x-axis.
543 * @param [in] scaleY The scale factor applied along the y-axis.
544 * @param [in] scaleZ The scale factor applied along the z-axis.
546 void SetScale(float scaleX, float scaleY, float scaleZ);
549 * Sets a scale factor applied to an actor.
550 * @param [in] scale A vector representing the scale factor for each axis.
552 void SetScale(const Vector3& scale);
555 * Set the x component of the scale factor.
556 * @param [in] x The new x value.
558 void SetScaleX(float x);
561 * Set the y component of the scale factor.
562 * @param [in] y The new y value.
564 void SetScaleY(float y);
567 * Set the z component of the scale factor.
568 * @param [in] z The new z value.
570 void SetScaleZ(float z);
573 * Apply a relative scale to an actor.
574 * @param[in] relativeScale The scale to combine with the actors existing scale.
576 void ScaleBy(const Vector3& relativeScale);
579 * Retrieve the scale factor applied to an actor.
580 * @return A vector representing the scale factor for each axis.
582 const Vector3& GetCurrentScale() const;
585 * @copydoc Dali::Actor::GetCurrentWorldScale()
587 const Vector3& GetCurrentWorldScale() const;
590 * @copydoc Dali::Actor::SetInheritScale()
592 void SetInheritScale(bool inherit);
595 * @copydoc Dali::Actor::IsScaleInherited()
597 bool IsScaleInherited() const
599 return mInheritScale;
603 * @copydoc Dali::Actor::GetCurrentWorldMatrix()
605 Matrix GetCurrentWorldMatrix() const;
610 * Sets the visibility flag of an actor.
611 * @param[in] visible The new visibility flag.
613 void SetVisible(bool visible);
616 * Retrieve the visibility flag of an actor.
617 * @return The visibility flag.
619 bool IsVisible() const;
622 * Sets the opacity of an actor.
623 * @param [in] opacity The new opacity.
625 void SetOpacity(float opacity);
628 * Retrieve the actor's opacity.
629 * @return The actor's opacity.
631 float GetCurrentOpacity() const;
634 * Retrieve the actor's clipping mode.
635 * @return The actor's clipping mode (cached)
637 ClippingMode::Type GetClippingMode() const
639 return mClippingMode;
643 * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
644 * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
645 * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
646 * hover event signal will be emitted.
648 * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
650 * actor.SetSensitive(false);
653 * Then, to re-enable the touch or hover event signal emission, the application should call:
655 * actor.SetSensitive(true);
658 * @see SignalTouch() and SignalHover().
659 * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
660 * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
662 void SetSensitive(bool sensitive)
664 mSensitive = sensitive;
668 * Query whether an actor emits touch or hover event signals.
669 * @see SetSensitive(bool)
670 * @return true, if emission of touch or hover event signals is enabled, false otherwise.
672 bool IsSensitive() const
678 * @copydoc Dali::Actor::SetDrawMode
680 void SetDrawMode(DrawMode::Type drawMode);
683 * @copydoc Dali::Actor::GetDrawMode
685 DrawMode::Type GetDrawMode() const
691 * @copydoc Dali::Actor::IsOverlay
693 bool IsOverlay() const
695 return (DrawMode::OVERLAY_2D == mDrawMode);
699 * Sets the actor's color. The final color of actor depends on its color mode.
700 * This final color is applied to the drawable elements of an actor.
701 * @param [in] color The new color.
703 void SetColor(const Vector4& color);
706 * Set the red component of the color.
707 * @param [in] red The new red component.
709 void SetColorRed(float red);
712 * Set the green component of the color.
713 * @param [in] green The new green component.
715 void SetColorGreen(float green);
718 * Set the blue component of the scale factor.
719 * @param [in] blue The new blue value.
721 void SetColorBlue(float blue);
724 * Retrieve the actor's color.
727 const Vector4& GetCurrentColor() const;
730 * Sets the actor's color mode.
731 * Color mode specifies whether Actor uses its own color or inherits its parent color
732 * @param [in] colorMode to use.
734 void SetColorMode(ColorMode colorMode);
737 * Returns the actor's color mode.
738 * @return currently used colorMode.
740 ColorMode GetColorMode() const
746 * @copydoc Dali::Actor::GetCurrentWorldColor()
748 const Vector4& GetCurrentWorldColor() const;
751 * @copydoc Dali::Actor::GetHierarchyDepth()
753 inline int32_t GetHierarchyDepth() const
764 * Get the actor's sorting depth
766 * @return The depth used for hit-testing and renderer sorting
768 uint32_t GetSortingDepth()
774 // Size negotiation virtual functions
777 * @brief Called after the size negotiation has been finished for this control.
779 * The control is expected to assign this given size to itself/its children.
781 * Should be overridden by derived classes if they need to layout
782 * actors differently after certain operations like add or remove
783 * actors, resize or after changing specific properties.
785 * Note! As this function is called from inside the size negotiation algorithm, you cannot
786 * call RequestRelayout (the call would just be ignored)
788 * @param[in] size The allocated size.
789 * @param[in,out] container The control should add actors to this container that it is not able
790 * to allocate a size for.
792 virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
797 * @brief Notification for deriving classes when the resize policy is set
799 * @param[in] policy The policy being set
800 * @param[in] dimension The dimension the policy is being set for
802 virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
807 * @brief Virtual method to notify deriving classes that relayout dependencies have been
808 * met and the size for this object is about to be calculated for the given dimension
810 * @param dimension The dimension that is about to be calculated
812 virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
817 * @brief Virtual method to notify deriving classes that the size for a dimension
818 * has just been negotiated
820 * @param[in] size The new size for the given dimension
821 * @param[in] dimension The dimension that was just negotiated
823 virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
828 * @brief Determine if this actor is dependent on it's children for relayout
830 * @param dimension The dimension(s) to check for
831 * @return Return if the actor is dependent on it's children
833 virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
836 * @brief Determine if this actor is dependent on it's children for relayout.
838 * Called from deriving classes
840 * @param dimension The dimension(s) to check for
841 * @return Return if the actor is dependent on it's children
843 virtual bool RelayoutDependentOnChildrenBase(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
846 * @brief Calculate the size for a child
848 * @param[in] child The child actor to calculate the size for
849 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
850 * @return Return the calculated size for the given dimension
852 virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension);
855 * @brief This method is called during size negotiation when a height is required for a given width.
857 * Derived classes should override this if they wish to customize the height returned.
859 * @param width to use.
860 * @return the height based on the width.
862 virtual float GetHeightForWidth(float width);
865 * @brief This method is called during size negotiation when a width is required for a given height.
867 * Derived classes should override this if they wish to customize the width returned.
869 * @param height to use.
870 * @return the width based on the width.
872 virtual float GetWidthForHeight(float height);
878 * @brief Called by the RelayoutController to negotiate the size of an actor.
880 * The size allocated by the the algorithm is passed in which the
881 * actor must adhere to. A container is passed in as well which
882 * the actor should populate with actors it has not / or does not
883 * need to handle in its size negotiation.
885 * @param[in] size The allocated size.
886 * @param[in,out] container The container that holds actors that are fed back into the
887 * RelayoutController algorithm.
889 void NegotiateSize(const Vector2& size, RelayoutContainer& container);
892 * @brief Set whether size negotiation should use the assigned size of the actor
893 * during relayout for the given dimension(s)
895 * @param[in] use Whether the assigned size of the actor should be used
896 * @param[in] dimension The dimension(s) to set. Can be a bitfield of multiple dimensions
898 void SetUseAssignedSize(bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
901 * @brief Returns whether size negotiation should use the assigned size of the actor
902 * during relayout for a single dimension
904 * @param[in] dimension The dimension to get
905 * @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
907 bool GetUseAssignedSize(Dimension::Type dimension) const;
910 * @copydoc Dali::Actor::SetResizePolicy()
912 void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
915 * @copydoc Dali::Actor::GetResizePolicy()
917 ResizePolicy::Type GetResizePolicy(Dimension::Type dimension) const;
920 * @copydoc Dali::Actor::SetSizeScalePolicy()
922 void SetSizeScalePolicy(SizeScalePolicy::Type policy);
925 * @copydoc Dali::Actor::GetSizeScalePolicy()
927 SizeScalePolicy::Type GetSizeScalePolicy() const;
930 * @copydoc Dali::Actor::SetDimensionDependency()
932 void SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency);
935 * @copydoc Dali::Actor::GetDimensionDependency()
937 Dimension::Type GetDimensionDependency(Dimension::Type dimension) const;
940 * @brief Set the size negotiation relayout enabled on this actor
942 * @param[in] relayoutEnabled Boolean to enable or disable relayout
944 void SetRelayoutEnabled(bool relayoutEnabled);
947 * @brief Return if relayout is enabled
949 * @return Return if relayout is enabled or not for this actor
951 bool IsRelayoutEnabled() const;
954 * @brief Mark an actor as having it's layout dirty
956 * @param dirty Whether to mark actor as dirty or not
957 * @param dimension The dimension(s) to mark as dirty
959 void SetLayoutDirty(bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
962 * @brief Return if any of an actor's dimensions are marked as dirty
964 * @param dimension The dimension(s) to check
965 * @return Return if any of the requested dimensions are dirty
967 bool IsLayoutDirty(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
970 * @brief Returns if relayout is enabled and the actor is not dirty
972 * @return Return if it is possible to relayout the actor
974 bool RelayoutPossible(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
977 * @brief Returns if relayout is enabled and the actor is dirty
979 * @return Return if it is required to relayout the actor
981 bool RelayoutRequired(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
984 * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
986 * This method is automatically called from OnSceneConnection(), OnChildAdd(),
987 * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
989 * This method can also be called from a derived class every time it needs a different size.
990 * At the end of event processing, the relayout process starts and
991 * all controls which requested Relayout will have their sizes (re)negotiated.
993 * @note RelayoutRequest() can be called multiple times; the size negotiation is still
994 * only performed once, i.e. there is no need to keep track of this in the calling side.
996 void RelayoutRequest(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
999 * @brief Determine if this actor is dependent on it's parent for relayout
1001 * @param dimension The dimension(s) to check for
1002 * @return Return if the actor is dependent on it's parent
1004 bool RelayoutDependentOnParent(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1007 * @brief Determine if this actor has another dimension depedent on the specified one
1009 * @param dimension The dimension to check for
1010 * @param dependentDimension The dimension to check for dependency with
1011 * @return Return if the actor is dependent on this dimension
1013 bool RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension);
1016 * @brief Calculate the size of a dimension
1018 * @param[in] dimension The dimension to calculate the size for
1019 * @param[in] maximumSize The upper bounds on the size
1020 * @return Return the calculated size for the dimension
1022 float CalculateSize(Dimension::Type dimension, const Vector2& maximumSize);
1025 * Negotiate a dimension based on the size of the parent
1027 * @param[in] dimension The dimension to negotiate on
1028 * @return Return the negotiated size
1030 float NegotiateFromParent(Dimension::Type dimension);
1033 * Negotiate a dimension based on the size of the parent. Fitting inside.
1035 * @param[in] dimension The dimension to negotiate on
1036 * @return Return the negotiated size
1038 float NegotiateFromParentFit(Dimension::Type dimension);
1041 * Negotiate a dimension based on the size of the parent. Flooding the whole space.
1043 * @param[in] dimension The dimension to negotiate on
1044 * @return Return the negotiated size
1046 float NegotiateFromParentFlood(Dimension::Type dimension);
1049 * @brief Negotiate a dimension based on the size of the children
1051 * @param[in] dimension The dimension to negotiate on
1052 * @return Return the negotiated size
1054 float NegotiateFromChildren(Dimension::Type dimension);
1057 * Set the negotiated dimension value for the given dimension(s)
1059 * @param negotiatedDimension The value to set
1060 * @param dimension The dimension(s) to set the value for
1062 void SetNegotiatedDimension(float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1065 * Return the value of negotiated dimension for the given dimension
1067 * @param dimension The dimension to retrieve
1068 * @return Return the value of the negotiated dimension
1070 float GetNegotiatedDimension(Dimension::Type dimension) const;
1073 * @brief Set the padding for a dimension
1075 * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
1076 * @param[in] dimension The dimension to set
1078 void SetPadding(const Vector2& padding, Dimension::Type dimension);
1081 * Return the value of padding for the given dimension
1083 * @param dimension The dimension to retrieve
1084 * @return Return the value of padding for the dimension
1086 Vector2 GetPadding(Dimension::Type dimension) const;
1089 * Return the actor size for a given dimension
1091 * @param[in] dimension The dimension to retrieve the size for
1092 * @return Return the size for the given dimension
1094 float GetSize(Dimension::Type dimension) const;
1097 * Return the natural size of the actor for a given dimension
1099 * @param[in] dimension The dimension to retrieve the size for
1100 * @return Return the natural size for the given dimension
1102 float GetNaturalSize(Dimension::Type dimension) const;
1105 * @brief Return the amount of size allocated for relayout
1107 * May include padding
1109 * @param[in] dimension The dimension to retrieve
1110 * @return Return the size
1112 float GetRelayoutSize(Dimension::Type dimension) const;
1115 * @brief If the size has been negotiated return that else return normal size
1117 * @param[in] dimension The dimension to retrieve
1118 * @return Return the size
1120 float GetLatestSize(Dimension::Type dimension) const;
1123 * Apply the negotiated size to the actor
1125 * @param[in] container The container to fill with actors that require further relayout
1127 void SetNegotiatedSize(RelayoutContainer& container);
1130 * @brief Flag the actor as having it's layout dimension negotiated.
1132 * @param[in] negotiated The status of the flag to set.
1133 * @param[in] dimension The dimension to set the flag for
1135 void SetLayoutNegotiated(bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1138 * @brief Test whether the layout dimension for this actor has been negotiated or not.
1140 * @param[in] dimension The dimension to determine the value of the flag for
1141 * @return Return if the layout dimension is negotiated or not.
1143 bool IsLayoutNegotiated(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
1146 * @brief provides the Actor implementation of GetHeightForWidth
1147 * @param width to use.
1148 * @return the height based on the width.
1150 float GetHeightForWidthBase(float width);
1153 * @brief provides the Actor implementation of GetWidthForHeight
1154 * @param height to use.
1155 * @return the width based on the height.
1157 float GetWidthForHeightBase(float height);
1160 * @brief Calculate the size for a child
1162 * @param[in] child The child actor to calculate the size for
1163 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
1164 * @return Return the calculated size for the given dimension
1166 float CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension);
1169 * @brief Set the preferred size for size negotiation
1171 * @param[in] size The preferred size to set
1173 void SetPreferredSize(const Vector2& size);
1176 * @brief Return the preferred size used for size negotiation
1178 * @return Return the preferred size
1180 Vector2 GetPreferredSize() const;
1183 * @copydoc Dali::Actor::SetMinimumSize
1185 void SetMinimumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1188 * @copydoc Dali::Actor::GetMinimumSize
1190 float GetMinimumSize(Dimension::Type dimension) const;
1193 * @copydoc Dali::Actor::SetMaximumSize
1195 void SetMaximumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1198 * @copydoc Dali::Actor::GetMaximumSize
1200 float GetMaximumSize(Dimension::Type dimension) const;
1203 * @copydoc Dali::Actor::AddRenderer()
1205 uint32_t AddRenderer(Renderer& renderer);
1208 * @copydoc Dali::Actor::GetRendererCount()
1210 uint32_t GetRendererCount() const;
1213 * @copydoc Dali::Actor::GetRendererAt()
1215 RendererPtr GetRendererAt(uint32_t index);
1218 * @copydoc Dali::Actor::RemoveRenderer()
1220 void RemoveRenderer(Renderer& renderer);
1223 * @copydoc Dali::Actor::RemoveRenderer()
1225 void RemoveRenderer(uint32_t index);
1228 * Set BlendEquation at each renderer that added on this Actor.
1230 void SetBlendEquation(DevelBlendEquation::Type blendEquation);
1233 * @brief Get Blend Equation that applied to this Actor
1235 DevelBlendEquation::Type GetBlendEquation() 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[out] localX On return, the X-coordinate relative to the actor.
1242 * @param[out] localY On return, the Y-coordinate relative to the actor.
1243 * @param[in] screenX The screen X-coordinate.
1244 * @param[in] screenY The screen Y-coordinate.
1245 * @return True if the conversion succeeded.
1247 bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const;
1250 * Converts screen coordinates into the actor's coordinate system.
1251 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1252 * @param[in] renderTask The render-task used to display the actor.
1253 * @param[out] localX On return, the X-coordinate relative to the actor.
1254 * @param[out] localY On return, the Y-coordinate relative to the actor.
1255 * @param[in] screenX The screen X-coordinate.
1256 * @param[in] screenY The screen Y-coordinate.
1257 * @return True if the conversion succeeded.
1259 bool ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const;
1262 * Converts from the actor's coordinate system to screen coordinates.
1263 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1264 * @param[in] viewMatrix The view-matrix
1265 * @param[in] projectionMatrix The projection-matrix
1266 * @param[in] viewport The view-port
1267 * @param[out] localX On return, the X-coordinate relative to the actor.
1268 * @param[out] localY On return, the Y-coordinate relative to the actor.
1269 * @param[in] screenX The screen X-coordinate.
1270 * @param[in] screenY The screen Y-coordinate.
1271 * @return True if the conversion succeeded.
1273 bool ScreenToLocal(const Matrix& viewMatrix,
1274 const Matrix& projectionMatrix,
1275 const Viewport& viewport,
1279 float screenY) const;
1282 * Sets whether the actor should receive a notification when touch or hover motion events leave
1283 * the boundary of the actor.
1285 * @note By default, this is set to false as most actors do not require this.
1286 * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
1288 * @param[in] required Should be set to true if a Leave event is required
1290 void SetLeaveRequired(bool required)
1292 mLeaveRequired = required;
1296 * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1297 * the boundary of the actor.
1298 * @return true if a Leave event is required, false otherwise.
1300 bool GetLeaveRequired() const
1302 return mLeaveRequired;
1306 * @copydoc Dali::Actor::SetKeyboardFocusable()
1308 void SetKeyboardFocusable(bool focusable)
1310 mKeyboardFocusable = focusable;
1314 * @copydoc Dali::Actor::IsKeyboardFocusable()
1316 bool IsKeyboardFocusable() const
1318 return mKeyboardFocusable;
1322 * Query whether the application or derived actor type requires intercept touch events.
1323 * @return True if intercept touch events are required.
1325 bool GetInterceptTouchRequired() const
1327 return !mInterceptTouchedSignal.Empty();
1331 * Query whether the application or derived actor type requires touch events.
1332 * @return True if touch events are required.
1334 bool GetTouchRequired() const
1336 return !mTouchedSignal.Empty();
1340 * Query whether the application or derived actor type requires hover events.
1341 * @return True if hover events are required.
1343 bool GetHoverRequired() const
1345 return !mHoveredSignal.Empty();
1349 * Query whether the application or derived actor type requires wheel events.
1350 * @return True if wheel events are required.
1352 bool GetWheelEventRequired() const
1354 return !mWheelEventSignal.Empty();
1358 * Query whether the actor is actually hittable. This method checks whether the actor is
1359 * sensitive, has the visibility flag set to true and is not fully transparent.
1360 * @return true, if it can be hit, false otherwise.
1362 bool IsHittable() const
1364 return IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
1368 * Query whether the actor captures all touch after it starts even if touch leaves its boundary.
1369 * @return true, if it captures all touch after start
1371 bool CapturesAllTouchAfterStart() const
1373 return mCaptureAllTouchAfterStart;
1377 * Sets the touch area offset of an actor.
1378 * @param [in] offset The new offset of area (left, right, bottom, top).
1380 void SetTouchAreaOffset(Rect<int> offset)
1382 mTouchAreaOffset = offset;
1386 * Retrieve the Actor's touch area offset.
1387 * @return The Actor's touch area offset.
1389 const Rect<int>& GetTouchAreaOffset() const
1391 return mTouchAreaOffset;
1397 * Retrieve the gesture data associated with this actor. The first call to this method will
1398 * allocate space for the ActorGestureData so this should only be called if an actor really does
1400 * @return Reference to the ActorGestureData for this actor.
1401 * @note Once the gesture-data is created for an actor it is likely that gestures are required
1402 * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
1404 ActorGestureData& GetGestureData();
1407 * Queries whether the actor requires the gesture type.
1408 * @param[in] type The gesture type.
1409 * @return True if the gesture is required, false otherwise.
1411 bool IsGestureRequired(GestureType::Value type) const;
1416 * Used by the EventProcessor to emit intercept touch event signals.
1417 * @param[in] touch The touch data.
1418 * @return True if the event was intercepted.
1420 bool EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch);
1423 * Used by the EventProcessor to emit touch event signals.
1424 * @param[in] touch The touch data.
1425 * @return True if the event was consumed.
1427 bool EmitTouchEventSignal(const Dali::TouchEvent& touch);
1430 * Used by the EventProcessor to emit hover event signals.
1431 * @param[in] event The hover event.
1432 * @return True if the event was consumed.
1434 bool EmitHoverEventSignal(const Dali::HoverEvent& event);
1437 * Used by the EventProcessor to emit wheel event signals.
1438 * @param[in] event The wheel event.
1439 * @return True if the event was consumed.
1441 bool EmitWheelEventSignal(const Dali::WheelEvent& event);
1444 * @brief Emits the visibility change signal for this actor and all its children.
1445 * @param[in] visible Whether the actor has become visible or not.
1446 * @param[in] type Whether the actor's visible property has changed or a parent's.
1448 void EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type);
1451 * @brief Emits the layout direction change signal for this actor and all its children.
1452 * @param[in] type Whether the actor's layout direction property has changed or a parent's.
1454 void EmitLayoutDirectionChangedSignal(LayoutDirection::Type type);
1457 * @copydoc DevelActor::InterceptTouchedSignal()
1459 Dali::Actor::TouchEventSignalType& InterceptTouchedSignal()
1461 return mInterceptTouchedSignal;
1465 * @copydoc Dali::Actor::TouchedSignal()
1467 Dali::Actor::TouchEventSignalType& TouchedSignal()
1469 return mTouchedSignal;
1473 * @copydoc Dali::Actor::HoveredSignal()
1475 Dali::Actor::HoverSignalType& HoveredSignal()
1477 return mHoveredSignal;
1481 * @copydoc Dali::Actor::WheelEventSignal()
1483 Dali::Actor::WheelEventSignalType& WheelEventSignal()
1485 return mWheelEventSignal;
1489 * @copydoc Dali::Actor::OnSceneSignal()
1491 Dali::Actor::OnSceneSignalType& OnSceneSignal()
1493 return mOnSceneSignal;
1497 * @copydoc Dali::Actor::OffSceneSignal()
1499 Dali::Actor::OffSceneSignalType& OffSceneSignal()
1501 return mOffSceneSignal;
1505 * @copydoc Dali::Actor::OnRelayoutSignal()
1507 Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal()
1509 return mOnRelayoutSignal;
1513 * @copydoc DevelActor::VisibilityChangedSignal
1515 DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal()
1517 return mVisibilityChangedSignal;
1521 * @copydoc LayoutDirectionChangedSignal
1523 Dali::Actor::LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal()
1525 return mLayoutDirectionChangedSignal;
1529 * @copydoc DevelActor::ChildAddedSignal
1531 DevelActor::ChildChangedSignalType& ChildAddedSignal();
1534 * @copydoc DevelActor::ChildRemovedSignal
1536 DevelActor::ChildChangedSignalType& ChildRemovedSignal();
1539 * @copydoc DevelActor::ChildOrderChangedSignal
1541 DevelActor::ChildOrderChangedSignalType& ChildOrderChangedSignal();
1544 * Connects a callback function with the object's signals.
1545 * @param[in] object The object providing the signal.
1546 * @param[in] tracker Used to disconnect the signal.
1547 * @param[in] signalName The signal to connect to.
1548 * @param[in] functor A newly allocated FunctorDelegate.
1549 * @return True if the signal was connected.
1550 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
1552 static bool DoConnectSignal(BaseObject* object,
1553 ConnectionTrackerInterface* tracker,
1554 const std::string& signalName,
1555 FunctorDelegate* functor);
1558 * Performs actions as requested using the action name.
1559 * @param[in] object The object on which to perform the action.
1560 * @param[in] actionName The action to perform.
1561 * @param[in] attributes The attributes with which to perfrom this action.
1562 * @return true if the action was done.
1564 static bool DoAction(BaseObject* object,
1565 const std::string& actionName,
1566 const Property::Map& attributes);
1572 * For use in derived classes.
1573 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1575 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
1588 * Protected Constructor. See Actor::New().
1589 * The second-phase construction Initialize() member should be called immediately after this.
1590 * @param[in] derivedType The derived type of actor (if any).
1591 * @param[in] reference to the node
1593 Actor(DerivedType derivedType, const SceneGraph::Node& node);
1596 * Second-phase constructor. Must be called immediately after creating a new Actor;
1598 void Initialize(void);
1601 * A reference counted object may only be deleted by calling Unreference()
1606 * Called on a child during Add() when the parent actor is connected to the Scene.
1607 * @param[in] parentDepth The depth of the parent in the hierarchy.
1609 void ConnectToScene(uint32_t parentDepth);
1612 * Helper for ConnectToScene, to recursively connect a tree of actors.
1613 * This is atomic i.e. not interrupted by user callbacks.
1614 * @param[in] depth The depth in the hierarchy of the actor
1615 * @param[out] connectionList On return, the list of connected actors which require notification.
1617 void RecursiveConnectToScene(ActorContainer& connectionList, uint32_t depth);
1620 * Connect the Node associated with this Actor to the scene-graph.
1622 void ConnectToSceneGraph();
1625 * Helper for ConnectToScene, to notify a connected actor through the public API.
1627 void NotifyStageConnection();
1630 * Called on a child during Remove() when the actor was previously on the Stage.
1632 void DisconnectFromStage();
1635 * Helper for DisconnectFromStage, to recursively disconnect a tree of actors.
1636 * This is atomic i.e. not interrupted by user callbacks.
1637 * @param[out] disconnectionList On return, the list of disconnected actors which require notification.
1639 void RecursiveDisconnectFromStage(ActorContainer& disconnectionList);
1642 * Disconnect the Node associated with this Actor from the scene-graph.
1644 void DisconnectFromSceneGraph();
1647 * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1649 void NotifyStageDisconnection();
1652 * When the Actor is OnScene, checks whether the corresponding Node is connected to the scene graph.
1653 * @return True if the Actor is OnScene & has a Node connected to the scene graph.
1655 bool IsNodeConnected() const;
1659 * Trigger a rebuild of the actor depth tree from this root
1660 * If a Layer3D is encountered, then this doesn't descend any further.
1661 * The mSortedDepth of each actor is set appropriately.
1663 void RebuildDepthTree();
1667 * Traverse the actor tree, inserting actors into the depth tree in sibling order.
1668 * @param[in] sceneGraphNodeDepths A vector capturing the nodes and their depth index
1669 * @param[in,out] depthIndex The current depth index (traversal index)
1671 void DepthTraverseActorTree(OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex);
1674 // Default property extensions from Object
1677 * @copydoc Dali::Internal::Object::SetDefaultProperty()
1679 void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override;
1682 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1684 void SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value) override;
1687 * @copydoc Dali::Internal::Object::GetDefaultProperty()
1689 Property::Value GetDefaultProperty(Property::Index index) const override;
1692 * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
1694 Property::Value GetDefaultPropertyCurrentValue(Property::Index index) const override;
1697 * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
1699 void OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) override;
1702 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1704 const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty(Property::Index index) const override;
1707 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1709 const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override;
1712 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1714 int32_t GetPropertyComponentIndex(Property::Index index) const override;
1717 * @copydoc Dali::Internal::Object::IsAnimationPossible()
1719 bool IsAnimationPossible() const override
1725 * Retrieve the actor's node.
1726 * @return The node used by this actor
1728 const SceneGraph::Node& GetNode() const;
1731 * @copydoc Dali::DevelActor::Raise()
1736 * @copydoc Dali::DevelActor::Lower()
1741 * @copydoc Dali::DevelActor::RaiseToTop()
1746 * @copydoc Dali::DevelActor::LowerToBottom()
1748 void LowerToBottom();
1751 * @copydoc Dali::DevelActor::RaiseAbove()
1753 void RaiseAbove(Internal::Actor& target);
1756 * @copydoc Dali::DevelActor::LowerBelow()
1758 void LowerBelow(Internal::Actor& target);
1762 * Sets the scene which this actor is added to.
1763 * @param[in] scene The scene
1765 void SetScene(Scene& scene)
1771 * Gets the scene which this actor is added to.
1774 Scene& GetScene() const
1779 LayoutDirection::Type GetLayoutDirection() const
1781 return mLayoutDirection;
1794 struct AnimatedSizeFlag
1807 // Remove default constructor and copy constructor
1809 Actor(const Actor&) = delete;
1810 Actor& operator=(const Actor& rhs) = delete;
1813 * Set the actor's parent.
1814 * @param[in] parent The new parent.
1816 void SetParent(ActorParent* parent);
1819 * For use in derived classes, called after Initialize()
1821 virtual void OnInitialize()
1826 * For use in internal derived classes.
1827 * This is called during ConnectToScene(), after the actor has finished adding its node to the scene-graph.
1828 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1830 virtual void OnSceneConnectionInternal()
1835 * For use in internal derived classes.
1836 * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1837 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1839 virtual void OnSceneDisconnectionInternal()
1844 * For use in external (CustomActor) derived classes.
1845 * This is called after the atomic ConnectToScene() traversal has been completed.
1847 virtual void OnSceneConnectionExternal(int depth)
1852 * For use in external (CustomActor) derived classes.
1853 * This is called after the atomic DisconnectFromStage() traversal has been completed.
1855 virtual void OnSceneDisconnectionExternal()
1860 * For use in derived classes; this is called after Add() has added a child.
1861 * @param[in] child The child that was added.
1863 virtual void OnChildAdd(Actor& child)
1868 * For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ).
1869 * @param[in] child The child that was removed.
1871 virtual void OnChildRemove(Actor& child)
1876 * For use in derived classes.
1877 * This is called after SizeSet() has been called.
1879 virtual void OnSizeSet(const Vector3& targetSize)
1884 * @brief Retrieves the cached event side value of a default property.
1885 * @param[in] index The index of the property
1886 * @param[out] value Is set with the cached value of the property if found.
1887 * @return True if value set, false otherwise.
1889 bool GetCachedPropertyValue(Property::Index index, Property::Value& value) const;
1892 * @brief Retrieves the current value of a default property from the scene-graph.
1893 * @param[in] index The index of the property
1894 * @param[out] value Is set with the current scene-graph value of the property
1895 * @return True if value set, false otherwise.
1897 bool GetCurrentPropertyValue(Property::Index index, Property::Value& value) const;
1900 * @brief Ensure the relayouter is allocated
1902 Relayouter& EnsureRelayouter();
1905 * @brief Apply the size set policy to the input size
1907 * @param[in] size The size to apply the policy to
1908 * @return Return the adjusted size
1910 Vector2 ApplySizeSetPolicy(const Vector2& size);
1913 * Retrieve the parent object of an Actor.
1914 * @return The parent object, or NULL if the Actor does not have a parent.
1916 Object* GetParentObject() const override
1918 return static_cast<Actor*>(mParent);
1922 * @brief Get the current position of the actor in screen coordinates.
1924 * @return Returns the screen position of actor
1926 const Vector2 GetCurrentScreenPosition() const;
1929 * Sets the visibility flag of an actor.
1930 * @param[in] visible The new visibility flag.
1931 * @param[in] sendMessage Whether to send a message to the update thread or not.
1933 void SetVisibleInternal(bool visible, SendMessage::Type sendMessage);
1936 * @copydoc ActorParent::SetSiblingOrderOfChild
1938 void SetSiblingOrderOfChild(Actor& child, uint32_t order) override;
1941 * @copydoc ActorParent::GetSiblingOrderOfChild
1943 uint32_t GetSiblingOrderOfChild(const Actor& child) const override;
1946 * @copydoc ActorParent::RaiseChild
1948 void RaiseChild(Actor& child) override;
1951 * @copydoc ActorParent::LowerChild
1953 void LowerChild(Actor& child) override;
1956 * @copydoc ActorParent::RaiseChildToTop
1958 void RaiseChildToTop(Actor& child) override;
1961 * @copydoc ActorParent::LowerChildToBottom
1963 void LowerChildToBottom(Actor& child) override;
1966 * @copydoc ActorParent::RaiseChildAbove
1968 void RaiseChildAbove(Actor& child, Actor& target) override;
1971 * @copydoc ActorParent::LowerChildBelow()
1973 void LowerChildBelow(Actor& child, Actor& target) override;
1976 * Set whether a child actor inherits it's parent's layout direction. Default is to inherit.
1977 * @param[in] inherit - true if the actor should inherit layout direction, false otherwise.
1979 void SetInheritLayoutDirection(bool inherit);
1982 * Returns whether the actor inherits it's parent's layout direction.
1983 * @return true if the actor inherits it's parent's layout direction, false otherwise.
1985 bool IsLayoutDirectionInherited() const
1987 return mInheritLayoutDirection;
1991 * @brief Propagates layout direction recursively.
1992 * @param[in] direction New layout direction.
1994 void InheritLayoutDirectionRecursively(Dali::LayoutDirection::Type direction, bool set = false);
1997 * @brief Sets the update size hint of an actor.
1998 * @param [in] updateSizeHint The update size hint.
2000 void SetUpdateSizeHint(const Vector2& updateSizeHint);
2003 * @brief Recursively emits the visibility-changed-signal on the actor tree.
2005 * @param[in] visible The new visibility of the actor
2006 * @param[in] type Whether the actor's visible property has changed or a parent's
2008 void EmitVisibilityChangedSignalRecursively(bool visible,
2009 DevelActor::VisibilityChange::Type type);
2012 ActorParentImpl mParentImpl; ///< Implementation of ActorParent;
2013 ActorParent* mParent; ///< Each actor (except the root) can have one parent
2014 Scene* mScene; ///< The scene the actor is added to
2015 RendererContainer* mRenderers; ///< Renderer container
2016 Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
2017 Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
2018 Relayouter* mRelayoutData; ///< Struct to hold optional collection of relayout variables
2019 ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
2022 Dali::Actor::TouchEventSignalType mInterceptTouchedSignal;
2023 Dali::Actor::TouchEventSignalType mTouchedSignal;
2024 Dali::Actor::HoverSignalType mHoveredSignal;
2025 Dali::Actor::WheelEventSignalType mWheelEventSignal;
2026 Dali::Actor::OnSceneSignalType mOnSceneSignal;
2027 Dali::Actor::OffSceneSignalType mOffSceneSignal;
2028 Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
2029 DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
2030 Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal;
2032 Quaternion mTargetOrientation; ///< Event-side storage for orientation
2033 Vector4 mTargetColor; ///< Event-side storage for color
2034 Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
2035 Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
2036 Vector3 mTargetScale; ///< Event-side storage for scale
2037 Vector3 mAnimatedSize; ///< Event-side storage for size animation
2038 Rect<int> mTouchAreaOffset; ///< touch area offset (left, right, bottom, top)
2040 ConstString mName; ///< Name of the actor
2041 uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
2042 int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported
2043 uint16_t mUseAnimatedSize; ///< Whether the size is animated.
2045 const bool mIsRoot : 1; ///< Flag to identify the root actor
2046 const bool mIsLayer : 1; ///< Flag to identify that this is a layer
2047 bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene
2048 bool mSensitive : 1; ///< Whether the actor emits touch event signals
2049 bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
2050 bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
2051 bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
2052 bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
2053 bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
2054 bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
2055 bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
2056 bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
2057 bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
2058 bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent.
2059 bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area.
2060 bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
2061 bool mNeedGesturePropagation : 1; ///< Whether the parent listens for gesture events or not
2062 LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left.
2063 DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
2064 ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
2065 ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use.
2066 DevelBlendEquation::Type mBlendEquation : 16; ///< Cached: Determines which blend equation will be used to render renderers.
2069 static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
2071 struct PropertyHandler;
2072 struct SiblingHandler;
2074 friend class ActorParentImpl; // Allow impl to call private methods on actor
2077 } // namespace Internal
2079 // Helpers for public-api forwarding methods
2081 inline Internal::Actor& GetImplementation(Dali::Actor& actor)
2083 DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
2085 BaseObject& handle = actor.GetBaseObject();
2087 return static_cast<Internal::Actor&>(handle);
2090 inline const Internal::Actor& GetImplementation(const Dali::Actor& actor)
2092 DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
2094 const BaseObject& handle = actor.GetBaseObject();
2096 return static_cast<const Internal::Actor&>(handle);
2101 #endif // DALI_INTERNAL_ACTOR_H