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/actors/actor-renderer-container.h>
34 #include <dali/internal/event/common/object-impl.h>
35 #include <dali/internal/event/common/stage-def.h>
36 #include <dali/internal/update/nodes/node-declarations.h>
37 #include <dali/public-api/actors/actor.h>
38 #include <dali/public-api/common/dali-common.h>
39 #include <dali/public-api/common/vector-wrapper.h>
40 #include <dali/public-api/events/gesture.h>
41 #include <dali/public-api/math/viewport.h>
42 #include <dali/public-api/object/ref-object.h>
43 #include <dali/public-api/size-negotiation/relayout-container.h>
55 class ActorGestureData;
61 class ActorDepthTreeNode;
62 using DepthNodeMemoryPool = Dali::Internal::MemoryPoolObjectAllocator<ActorDepthTreeNode>;
65 * Actor is the primary object with which Dali applications interact.
66 * UI controls can be built by combining multiple actors.
67 * Multi-Touch events are received through signals emitted by the actor tree.
69 * An Actor is a proxy for a Node in the scene graph.
70 * When an Actor is added to the Stage, it creates a node and connects it to the scene graph.
71 * The scene-graph can be updated in a separate thread, so the connection is done using an asynchronous message.
72 * When a tree of Actors is detached from the Stage, a message is sent to destroy the associated nodes.
74 class Actor : public Object, public ActorParent
78 * @brief Struct to hold an actor and a dimension
80 struct ActorDimensionPair
85 * @param[in] newActor The actor to assign
86 * @param[in] newDimension The dimension to assign
88 ActorDimensionPair(Actor* newActor, Dimension::Type newDimension)
90 dimension(newDimension)
95 * @brief Equality operator
97 * @param[in] lhs The left hand side argument
98 * @param[in] rhs The right hand side argument
100 bool operator==(const ActorDimensionPair& rhs)
102 return (actor == rhs.actor) && (dimension == rhs.dimension);
105 Actor* actor; ///< The actor to hold
106 Dimension::Type dimension; ///< The dimension to hold
109 using ActorDimensionStack = std::vector<ActorDimensionPair>;
113 * Create a new actor.
114 * @return A smart-pointer to the newly allocated Actor.
116 static ActorPtr New();
119 * Helper to create node for derived classes who don't have their own node type
120 * @return pointer to newly created unique node
122 static const SceneGraph::Node* CreateNode();
125 * Retrieve the name of the actor.
128 std::string_view GetName() const
130 return mName.GetStringView();
134 * Set the name of the actor.
135 * @param[in] name The new name.
137 void SetName(std::string_view name);
140 * @copydoc Dali::Actor::GetId
142 uint32_t GetId() const;
147 * Query whether an actor is the root actor, which is owned by the Stage.
148 * @return True if the actor is a root actor.
156 * Query whether the actor is connected to the Scene.
164 * Query whether the actor has any renderers.
165 * @return True if the actor is renderable.
167 bool IsRenderable() const
169 // inlined as this is called a lot in hit testing
170 return mRenderers && !mRenderers->IsEmpty();
174 * Query whether the actor is of class Dali::Layer
175 * @return True if the actor is a layer.
179 // inlined as this is called a lot in hit testing
184 * Gets the layer in which the actor is present
185 * @return The layer, which will be uninitialized if the actor is off-stage.
187 Dali::Layer GetLayer();
190 * @copydoc Dali::Internal::ActorParent::Add()
192 void Add(Actor& child, bool notify = true) override;
195 * @copydoc Dali::Internal::ActorParent::Remove()
197 void Remove(Actor& child, bool notify = true) override;
200 * @copydoc Dali::DevelActor::SwitchParent()
202 void SwitchParent(Actor& newParent);
205 * @copydoc Dali::Actor::Unparent
210 * @copydoc Dali::Internal::ActorParent::GetChildCount()
212 uint32_t GetChildCount() const override;
215 * @copydoc Dali::Internal::ActorParent::GetChildAt
217 ActorPtr GetChildAt(uint32_t index) const override;
220 * Retrieve a reference to Actor's children.
221 * @note Not for public use.
222 * @return A reference to the container of children.
223 * @note The internal container is lazily initialized so ensure you check the child count before using the value returned by this method.
225 ActorContainer& GetChildrenInternal();
228 * @copydoc Dali::Internal::ActorParent::FindChildByName
230 ActorPtr FindChildByName(ConstString actorName) override;
233 * @copydoc Dali::Internal::ActorParent::FindChildById
235 ActorPtr FindChildById(const uint32_t id) override;
238 * @copydoc Dali::Internal::ActorParent::UnparentChildren
240 void UnparentChildren() override;
243 * Retrieve the parent of an Actor.
244 * @return The parent actor, or NULL if the Actor does not have a parent.
246 Actor* GetParent() const
248 return static_cast<Actor*>(mParent);
252 * Calculates screen position and size.
254 * @return pair of two values, position of top-left corner on screen and size respectively.
256 Rect<> CalculateScreenExtents() const;
259 * @copydoc DevelActor::SetNeedGesturePropagation.
261 void SetNeedGesturePropagation(bool propagation)
263 mNeedGesturePropagation = propagation;
267 * Retrieve need gesture propagation value
268 * @return The actor's need gesture propagation value.
270 bool NeedGesturePropagation() const
272 return mNeedGesturePropagation;
276 * Sets the size of an actor.
277 * This does not interfere with the actors scale factor.
278 * @param [in] width The new width.
279 * @param [in] height The new height.
281 void SetSize(float width, float height);
284 * Sets the size of an actor.
285 * This does not interfere with the actors scale factor.
286 * @param [in] width The size of the actor along the x-axis.
287 * @param [in] height The size of the actor along the y-axis.
288 * @param [in] depth The size of the actor along the z-axis.
290 void SetSize(float width, float height, float depth);
293 * Sets the size of an actor.
294 * This does not interfere with the actors scale factor.
295 * @param [in] size The new size.
297 void SetSize(const Vector2& size);
300 * Sets the update size for an actor.
302 * @param[in] size The size to set.
304 void SetSizeInternal(const Vector2& size);
307 * Sets the size of an actor.
308 * This does not interfere with the actors scale factor.
309 * @param [in] size The new size.
311 void SetSize(const Vector3& size);
314 * Sets the update size for an actor.
316 * @param[in] size The size to set.
318 void SetSizeInternal(const Vector3& size);
321 * Set the width component of the Actor's size.
322 * @param [in] width The new width component.
324 void SetWidth(float width);
327 * Set the height component of the Actor's size.
328 * @param [in] height The new height component.
330 void SetHeight(float height);
333 * Set the depth component of the Actor's size.
334 * @param [in] depth The new depth component.
336 void SetDepth(float depth);
339 * Retrieve the Actor's size from event side.
340 * This size will be the size set or if animating then the target size.
341 * @return The Actor's size.
343 Vector3 GetTargetSize() const;
346 * Retrieve the Actor's size from update side.
347 * This size will be the size set or animating but will be a frame behind.
348 * @return The Actor's size.
350 const Vector3& GetCurrentSize() const;
353 * Return the natural size of the actor
355 * @return The actor's natural size
357 virtual Vector3 GetNaturalSize() const;
360 * Set the origin of an actor, within its parent's area.
361 * This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
362 * and (1.0, 1.0, 0.5) is the bottom-right corner.
363 * The default parent-origin is top-left (0.0, 0.0, 0.5).
364 * An actor position is the distance between this origin, and the actors anchor-point.
365 * @param [in] origin The new parent-origin.
367 void SetParentOrigin(const Vector3& origin);
370 * Retrieve the parent-origin of an actor.
371 * @return The parent-origin.
373 const Vector3& GetCurrentParentOrigin() const;
376 * Set the anchor-point of an actor. This is expressed in 2D unit coordinates, such that
377 * (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.
378 * The default anchor point is top-left (0.0, 0.0, 0.5).
379 * An actor position is the distance between its parent-origin, and this anchor-point.
380 * An actor's rotation is centered around its anchor-point.
381 * @param [in] anchorPoint The new anchor-point.
383 void SetAnchorPoint(const Vector3& anchorPoint);
386 * Retrieve the anchor-point of an actor.
387 * @return The anchor-point.
389 const Vector3& GetCurrentAnchorPoint() const;
392 * Sets the position of the Actor.
393 * The coordinates are relative to the Actor's parent.
394 * The Actor's z position will be set to 0.0f.
395 * @param [in] x The new x position
396 * @param [in] y The new y position
398 void SetPosition(float x, float y);
401 * Sets the position of the Actor.
402 * The coordinates are relative to the Actor's parent.
403 * @param [in] x The new x position
404 * @param [in] y The new y position
405 * @param [in] z The new z position
407 void SetPosition(float x, float y, float z);
410 * Sets the position of the Actor.
411 * The coordinates are relative to the Actor's parent.
412 * @param [in] position The new position.
414 void SetPosition(const Vector3& position);
417 * Set the position of an actor along the X-axis.
418 * @param [in] x The new x position
423 * Set the position of an actor along the Y-axis.
424 * @param [in] y The new y position.
429 * Set the position of an actor along the Z-axis.
430 * @param [in] z The new z position
435 * Translate an actor relative to its existing position.
436 * @param[in] distance The actor will move by this distance.
438 void TranslateBy(const Vector3& distance);
441 * Retrieve the position of the Actor.
442 * The coordinates are relative to the Actor's parent.
443 * @return the Actor's position.
445 const Vector3& GetCurrentPosition() const;
448 * Retrieve the target position of the Actor.
449 * The coordinates are relative to the Actor's parent.
450 * @return the Actor's position.
452 const Vector3& GetTargetPosition() const
454 return mTargetPosition;
458 * @copydoc Dali::Actor::GetCurrentWorldPosition()
460 const Vector3& GetCurrentWorldPosition() const;
463 * @copydoc Dali::Actor::SetInheritPosition()
465 void SetInheritPosition(bool inherit);
468 * @copydoc Dali::Actor::IsPositionInherited()
470 bool IsPositionInherited() const
472 return mInheritPosition;
476 * Sets the orientation of the Actor.
477 * @param [in] angleRadians The new orientation angle in radians.
478 * @param [in] axis The new axis of orientation.
480 void SetOrientation(const Radian& angleRadians, const Vector3& axis);
483 * Sets the orientation of the Actor.
484 * @param [in] orientation The new orientation.
486 void SetOrientation(const Quaternion& orientation);
489 * Rotate an actor around its existing rotation axis.
490 * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
491 * @param[in] axis The axis of the rotation to combine with the existing rotation.
493 void RotateBy(const Radian& angleRadians, const Vector3& axis);
496 * Apply a relative rotation to an actor.
497 * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
499 void RotateBy(const Quaternion& relativeRotation);
502 * Retreive the Actor's orientation.
503 * @return the orientation.
505 const Quaternion& GetCurrentOrientation() const;
508 * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
509 * Switching this off means that using SetOrientation() sets the actor's world orientation.
510 * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
512 void SetInheritOrientation(bool inherit);
515 * Returns whether the actor inherit's it's parent's orientation.
516 * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
518 bool IsOrientationInherited() const
520 return mInheritOrientation;
524 * Sets the factor of the parents size used for the child actor.
525 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
526 * @param[in] factor The vector to multiply the parents size by to get the childs size.
528 void SetSizeModeFactor(const Vector3& factor);
531 * Gets the factor of the parents size used for the child actor.
532 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
533 * @return The vector being used to multiply the parents size by to get the childs size.
535 const Vector3& GetSizeModeFactor() const;
538 * @copydoc Dali::Actor::GetCurrentWorldOrientation()
540 const Quaternion& GetCurrentWorldOrientation() const;
543 * Sets a scale factor applied to an actor.
544 * @param [in] scale The scale factor applied on all axes.
546 void SetScale(float scale);
549 * Sets a scale factor applied to an actor.
550 * @param [in] scaleX The scale factor applied along the x-axis.
551 * @param [in] scaleY The scale factor applied along the y-axis.
552 * @param [in] scaleZ The scale factor applied along the z-axis.
554 void SetScale(float scaleX, float scaleY, float scaleZ);
557 * Sets a scale factor applied to an actor.
558 * @param [in] scale A vector representing the scale factor for each axis.
560 void SetScale(const Vector3& scale);
563 * Set the x component of the scale factor.
564 * @param [in] x The new x value.
566 void SetScaleX(float x);
569 * Set the y component of the scale factor.
570 * @param [in] y The new y value.
572 void SetScaleY(float y);
575 * Set the z component of the scale factor.
576 * @param [in] z The new z value.
578 void SetScaleZ(float z);
581 * Apply a relative scale to an actor.
582 * @param[in] relativeScale The scale to combine with the actors existing scale.
584 void ScaleBy(const Vector3& relativeScale);
587 * Retrieve the scale factor applied to an actor.
588 * @return A vector representing the scale factor for each axis.
590 const Vector3& GetCurrentScale() const;
593 * @copydoc Dali::Actor::GetCurrentWorldScale()
595 const Vector3& GetCurrentWorldScale() const;
598 * @copydoc Dali::Actor::SetInheritScale()
600 void SetInheritScale(bool inherit);
603 * @copydoc Dali::Actor::IsScaleInherited()
605 bool IsScaleInherited() const
607 return mInheritScale;
611 * @copydoc Dali::Actor::GetCurrentWorldMatrix()
613 Matrix GetCurrentWorldMatrix() const;
618 * Sets the visibility flag of an actor.
619 * @param[in] visible The new visibility flag.
621 void SetVisible(bool visible);
624 * Retrieve the visibility flag of an actor.
625 * @return The visibility flag.
627 bool IsVisible() const;
630 * Sets the opacity of an actor.
631 * @param [in] opacity The new opacity.
633 void SetOpacity(float opacity);
636 * Retrieve the actor's opacity.
637 * @return The actor's opacity.
639 float GetCurrentOpacity() const;
642 * Retrieve the actor's clipping mode.
643 * @return The actor's clipping mode (cached)
645 ClippingMode::Type GetClippingMode() const
647 return mClippingMode;
651 * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
652 * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
653 * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
654 * hover event signal will be emitted.
656 * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
658 * actor.SetSensitive(false);
661 * Then, to re-enable the touch or hover event signal emission, the application should call:
663 * actor.SetSensitive(true);
666 * @see SignalTouch() and SignalHover().
667 * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
668 * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
670 void SetSensitive(bool sensitive)
672 mSensitive = sensitive;
676 * Query whether an actor emits touch or hover event signals.
677 * @see SetSensitive(bool)
678 * @return true, if emission of touch or hover event signals is enabled, false otherwise.
680 bool IsSensitive() const
686 * @copydoc Dali::Actor::SetDrawMode
688 void SetDrawMode(DrawMode::Type drawMode);
691 * @copydoc Dali::Actor::GetDrawMode
693 DrawMode::Type GetDrawMode() const
699 * @copydoc Dali::Actor::IsOverlay
701 bool IsOverlay() const
703 return (DrawMode::OVERLAY_2D == mDrawMode);
707 * Sets the actor's color. The final color of actor depends on its color mode.
708 * This final color is applied to the drawable elements of an actor.
709 * @param [in] color The new color.
711 void SetColor(const Vector4& color);
714 * Set the red component of the color.
715 * @param [in] red The new red component.
717 void SetColorRed(float red);
720 * Set the green component of the color.
721 * @param [in] green The new green component.
723 void SetColorGreen(float green);
726 * Set the blue component of the scale factor.
727 * @param [in] blue The new blue value.
729 void SetColorBlue(float blue);
732 * Retrieve the actor's color.
735 const Vector4& GetCurrentColor() const;
738 * Sets the actor's color mode.
739 * Color mode specifies whether Actor uses its own color or inherits its parent color
740 * @param [in] colorMode to use.
742 void SetColorMode(ColorMode colorMode);
745 * Returns the actor's color mode.
746 * @return currently used colorMode.
748 ColorMode GetColorMode() const
754 * @copydoc Dali::Actor::GetCurrentWorldColor()
756 const Vector4& GetCurrentWorldColor() const;
759 * @copydoc Dali::Actor::GetHierarchyDepth()
761 inline int32_t GetHierarchyDepth() const
772 * Get the actor's sorting depth
774 * @return The depth used for hit-testing and renderer sorting
776 inline uint32_t GetSortingDepth()
782 * Set the actor's sorted depth. Used during recreation of depth tree
783 * @param[in] sortedDepth the new sorted depth
785 inline void SetSortingDepth(uint32_t sortedDepth)
787 mSortedDepth = sortedDepth;
791 // Size negotiation virtual functions
794 * @brief Called after the size negotiation has been finished for this control.
796 * The control is expected to assign this given size to itself/its children.
798 * Should be overridden by derived classes if they need to layout
799 * actors differently after certain operations like add or remove
800 * actors, resize or after changing specific properties.
802 * Note! As this function is called from inside the size negotiation algorithm, you cannot
803 * call RequestRelayout (the call would just be ignored)
805 * @param[in] size The allocated size.
806 * @param[in,out] container The control should add actors to this container that it is not able
807 * to allocate a size for.
809 virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
814 * @brief Notification for deriving classes when the resize policy is set
816 * @param[in] policy The policy being set
817 * @param[in] dimension The dimension the policy is being set for
819 virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
824 * @brief Virtual method to notify deriving classes that relayout dependencies have been
825 * met and the size for this object is about to be calculated for the given dimension
827 * @param dimension The dimension that is about to be calculated
829 virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
834 * @brief Virtual method to notify deriving classes that the size for a dimension
835 * has just been negotiated
837 * @param[in] size The new size for the given dimension
838 * @param[in] dimension The dimension that was just negotiated
840 virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
845 * @brief Determine if this actor is dependent on it's children for relayout
847 * @param dimension The dimension(s) to check for
848 * @return Return if the actor is dependent on it's children
850 virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
853 * @brief Determine if this actor is dependent on it's children for relayout.
855 * Called from deriving classes
857 * @param dimension The dimension(s) to check for
858 * @return Return if the actor is dependent on it's children
860 virtual bool RelayoutDependentOnChildrenBase(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
863 * @brief Calculate the size for a child
865 * @param[in] child The child actor to calculate the size for
866 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
867 * @return Return the calculated size for the given dimension
869 virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension);
872 * @brief This method is called during size negotiation when a height is required for a given width.
874 * Derived classes should override this if they wish to customize the height returned.
876 * @param width to use.
877 * @return the height based on the width.
879 virtual float GetHeightForWidth(float width);
882 * @brief This method is called during size negotiation when a width is required for a given height.
884 * Derived classes should override this if they wish to customize the width returned.
886 * @param height to use.
887 * @return the width based on the width.
889 virtual float GetWidthForHeight(float height);
895 * @brief Called by the RelayoutController to negotiate the size of an actor.
897 * The size allocated by the the algorithm is passed in which the
898 * actor must adhere to. A container is passed in as well which
899 * the actor should populate with actors it has not / or does not
900 * need to handle in its size negotiation.
902 * @param[in] size The allocated size.
903 * @param[in,out] container The container that holds actors that are fed back into the
904 * RelayoutController algorithm.
906 void NegotiateSize(const Vector2& size, RelayoutContainer& container);
909 * @brief Set whether size negotiation should use the assigned size of the actor
910 * during relayout for the given dimension(s)
912 * @param[in] use Whether the assigned size of the actor should be used
913 * @param[in] dimension The dimension(s) to set. Can be a bitfield of multiple dimensions
915 void SetUseAssignedSize(bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
918 * @brief Returns whether size negotiation should use the assigned size of the actor
919 * during relayout for a single dimension
921 * @param[in] dimension The dimension to get
922 * @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
924 bool GetUseAssignedSize(Dimension::Type dimension) const;
927 * @copydoc Dali::Actor::SetResizePolicy()
929 void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
932 * @copydoc Dali::Actor::GetResizePolicy()
934 ResizePolicy::Type GetResizePolicy(Dimension::Type dimension) const;
937 * @copydoc Dali::Actor::SetSizeScalePolicy()
939 void SetSizeScalePolicy(SizeScalePolicy::Type policy);
942 * @copydoc Dali::Actor::GetSizeScalePolicy()
944 SizeScalePolicy::Type GetSizeScalePolicy() const;
947 * @copydoc Dali::Actor::SetDimensionDependency()
949 void SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency);
952 * @copydoc Dali::Actor::GetDimensionDependency()
954 Dimension::Type GetDimensionDependency(Dimension::Type dimension) const;
957 * @brief Set the size negotiation relayout enabled on this actor
959 * @param[in] relayoutEnabled Boolean to enable or disable relayout
961 void SetRelayoutEnabled(bool relayoutEnabled);
964 * @brief Return if relayout is enabled
966 * @return Return if relayout is enabled or not for this actor
968 bool IsRelayoutEnabled() const;
971 * @brief Mark an actor as having it's layout dirty
973 * @param dirty Whether to mark actor as dirty or not
974 * @param dimension The dimension(s) to mark as dirty
976 void SetLayoutDirty(bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
979 * @brief Return if any of an actor's dimensions are marked as dirty
981 * @param dimension The dimension(s) to check
982 * @return Return if any of the requested dimensions are dirty
984 bool IsLayoutDirty(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
987 * @brief Returns if relayout is enabled and the actor is not dirty
989 * @return Return if it is possible to relayout the actor
991 bool RelayoutPossible(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
994 * @brief Returns if relayout is enabled and the actor is dirty
996 * @return Return if it is required to relayout the actor
998 bool RelayoutRequired(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
1001 * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
1003 * This method is automatically called from OnSceneConnection(), OnChildAdd(),
1004 * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
1006 * This method can also be called from a derived class every time it needs a different size.
1007 * At the end of event processing, the relayout process starts and
1008 * all controls which requested Relayout will have their sizes (re)negotiated.
1010 * @note RelayoutRequest() can be called multiple times; the size negotiation is still
1011 * only performed once, i.e. there is no need to keep track of this in the calling side.
1013 void RelayoutRequest(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1016 * @brief Determine if this actor is dependent on it's parent for relayout
1018 * @param dimension The dimension(s) to check for
1019 * @return Return if the actor is dependent on it's parent
1021 bool RelayoutDependentOnParent(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1024 * @brief Determine if this actor has another dimension depedent on the specified one
1026 * @param dimension The dimension to check for
1027 * @param dependentDimension The dimension to check for dependency with
1028 * @return Return if the actor is dependent on this dimension
1030 bool RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension);
1033 * @brief Calculate the size of a dimension
1035 * @param[in] dimension The dimension to calculate the size for
1036 * @param[in] maximumSize The upper bounds on the size
1037 * @return Return the calculated size for the dimension
1039 float CalculateSize(Dimension::Type dimension, const Vector2& maximumSize);
1042 * Negotiate a dimension based on the size of the parent
1044 * @param[in] dimension The dimension to negotiate on
1045 * @return Return the negotiated size
1047 float NegotiateFromParent(Dimension::Type dimension);
1050 * Negotiate a dimension based on the size of the parent. Fitting inside.
1052 * @param[in] dimension The dimension to negotiate on
1053 * @return Return the negotiated size
1055 float NegotiateFromParentFit(Dimension::Type dimension);
1058 * Negotiate a dimension based on the size of the parent. Flooding the whole space.
1060 * @param[in] dimension The dimension to negotiate on
1061 * @return Return the negotiated size
1063 float NegotiateFromParentFlood(Dimension::Type dimension);
1066 * @brief Negotiate a dimension based on the size of the children
1068 * @param[in] dimension The dimension to negotiate on
1069 * @return Return the negotiated size
1071 float NegotiateFromChildren(Dimension::Type dimension);
1074 * Set the negotiated dimension value for the given dimension(s)
1076 * @param negotiatedDimension The value to set
1077 * @param dimension The dimension(s) to set the value for
1079 void SetNegotiatedDimension(float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1082 * Return the value of negotiated dimension for the given dimension
1084 * @param dimension The dimension to retrieve
1085 * @return Return the value of the negotiated dimension
1087 float GetNegotiatedDimension(Dimension::Type dimension) const;
1090 * @brief Set the padding for a dimension
1092 * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
1093 * @param[in] dimension The dimension to set
1095 void SetPadding(const Vector2& padding, Dimension::Type dimension);
1098 * Return the value of padding for the given dimension
1100 * @param dimension The dimension to retrieve
1101 * @return Return the value of padding for the dimension
1103 Vector2 GetPadding(Dimension::Type dimension) const;
1106 * Return the actor size for a given dimension
1108 * @param[in] dimension The dimension to retrieve the size for
1109 * @return Return the size for the given dimension
1111 float GetSize(Dimension::Type dimension) const;
1114 * Return the natural size of the actor for a given dimension
1116 * @param[in] dimension The dimension to retrieve the size for
1117 * @return Return the natural size for the given dimension
1119 float GetNaturalSize(Dimension::Type dimension) const;
1122 * @brief Return the amount of size allocated for relayout
1124 * May include padding
1126 * @param[in] dimension The dimension to retrieve
1127 * @return Return the size
1129 float GetRelayoutSize(Dimension::Type dimension) const;
1132 * @brief If the size has been negotiated return that else return normal size
1134 * @param[in] dimension The dimension to retrieve
1135 * @return Return the size
1137 float GetLatestSize(Dimension::Type dimension) const;
1140 * Apply the negotiated size to the actor
1142 * @param[in] container The container to fill with actors that require further relayout
1144 void SetNegotiatedSize(RelayoutContainer& container);
1147 * @brief Flag the actor as having it's layout dimension negotiated.
1149 * @param[in] negotiated The status of the flag to set.
1150 * @param[in] dimension The dimension to set the flag for
1152 void SetLayoutNegotiated(bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1155 * @brief Test whether the layout dimension for this actor has been negotiated or not.
1157 * @param[in] dimension The dimension to determine the value of the flag for
1158 * @return Return if the layout dimension is negotiated or not.
1160 bool IsLayoutNegotiated(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
1163 * @brief provides the Actor implementation of GetHeightForWidth
1164 * @param width to use.
1165 * @return the height based on the width.
1167 float GetHeightForWidthBase(float width);
1170 * @brief provides the Actor implementation of GetWidthForHeight
1171 * @param height to use.
1172 * @return the width based on the height.
1174 float GetWidthForHeightBase(float height);
1177 * @brief Calculate the size for a child
1179 * @param[in] child The child actor to calculate the size for
1180 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
1181 * @return Return the calculated size for the given dimension
1183 float CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension);
1186 * @brief Set the preferred size for size negotiation
1188 * @param[in] size The preferred size to set
1190 void SetPreferredSize(const Vector2& size);
1193 * @brief Return the preferred size used for size negotiation
1195 * @return Return the preferred size
1197 Vector2 GetPreferredSize() const;
1200 * @copydoc Dali::Actor::SetMinimumSize
1202 void SetMinimumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1205 * @copydoc Dali::Actor::GetMinimumSize
1207 float GetMinimumSize(Dimension::Type dimension) const;
1210 * @copydoc Dali::Actor::SetMaximumSize
1212 void SetMaximumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1215 * @copydoc Dali::Actor::GetMaximumSize
1217 float GetMaximumSize(Dimension::Type dimension) const;
1220 * @copydoc Dali::Actor::AddRenderer()
1222 uint32_t AddRenderer(Renderer& renderer);
1225 * @copydoc Dali::Actor::GetRendererCount()
1227 uint32_t GetRendererCount() const;
1230 * @copydoc Dali::Actor::GetRendererAt()
1232 RendererPtr GetRendererAt(uint32_t index);
1235 * @copydoc Dali::Actor::RemoveRenderer()
1237 void RemoveRenderer(Renderer& renderer);
1240 * @copydoc Dali::Actor::RemoveRenderer()
1242 void RemoveRenderer(uint32_t index);
1245 * @brief Set BlendEquation at each renderer that added on this Actor.
1247 void SetBlendEquation(DevelBlendEquation::Type blendEquation);
1250 * @brief Get Blend Equation that applied to this Actor
1252 DevelBlendEquation::Type GetBlendEquation() const;
1255 * @brief Set this Actor is transparent or not without any affection on the child Actors.
1257 void SetTransparent(bool transparent);
1260 * @brief Get this Actor is transparent or not.
1262 bool IsTransparent() const;
1266 * Converts screen coordinates into the actor's coordinate system.
1267 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1268 * @param[out] localX On return, the X-coordinate relative to the actor.
1269 * @param[out] localY On return, the Y-coordinate relative to the actor.
1270 * @param[in] screenX The screen X-coordinate.
1271 * @param[in] screenY The screen Y-coordinate.
1272 * @return True if the conversion succeeded.
1274 bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const;
1277 * Converts screen coordinates into the actor's coordinate system.
1278 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1279 * @param[in] renderTask The render-task used to display the actor.
1280 * @param[out] localX On return, the X-coordinate relative to the actor.
1281 * @param[out] localY On return, the Y-coordinate relative to the actor.
1282 * @param[in] screenX The screen X-coordinate.
1283 * @param[in] screenY The screen Y-coordinate.
1284 * @return True if the conversion succeeded.
1286 bool ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const;
1289 * Converts from the actor's coordinate system to screen coordinates.
1290 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1291 * @param[in] viewMatrix The view-matrix
1292 * @param[in] projectionMatrix The projection-matrix
1293 * @param[in] viewport The view-port
1294 * @param[out] localX On return, the X-coordinate relative to the actor.
1295 * @param[out] localY On return, the Y-coordinate relative to the actor.
1296 * @param[in] screenX The screen X-coordinate.
1297 * @param[in] screenY The screen Y-coordinate.
1298 * @return True if the conversion succeeded.
1300 bool ScreenToLocal(const Matrix& viewMatrix,
1301 const Matrix& projectionMatrix,
1302 const Viewport& viewport,
1306 float screenY) const;
1309 * Sets whether the actor should receive a notification when touch or hover motion events leave
1310 * the boundary of the actor.
1312 * @note By default, this is set to false as most actors do not require this.
1313 * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
1315 * @param[in] required Should be set to true if a Leave event is required
1317 void SetLeaveRequired(bool required)
1319 mLeaveRequired = required;
1323 * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1324 * the boundary of the actor.
1325 * @return true if a Leave event is required, false otherwise.
1327 bool GetLeaveRequired() const
1329 return mLeaveRequired;
1333 * @copydoc Dali::Actor::SetKeyboardFocusable()
1335 void SetKeyboardFocusable(bool focusable)
1337 mKeyboardFocusable = focusable;
1341 * @copydoc Dali::Actor::IsKeyboardFocusable()
1343 bool IsKeyboardFocusable() const
1345 return mKeyboardFocusable;
1349 * @copydoc Dali::Actor::SetKeyboardFocusableChildren()
1351 void SetKeyboardFocusableChildren(bool focusable)
1353 mKeyboardFocusableChildren = focusable;
1357 * @copydoc Dali::Actor::AreChildrenKeyBoardFocusable()
1359 bool AreChildrenKeyBoardFocusable() const
1361 return mKeyboardFocusableChildren;
1365 * Set whether this view can focus by touch.
1366 * @param[in] focusable focuable by touch.
1368 void SetTouchFocusable(bool focusable)
1370 mTouchFocusable = focusable;
1374 * This returns whether this actor can focus by touch.
1375 * @return true if this actor can focus by touch.
1377 bool IsTouchFocusable() const
1379 return mTouchFocusable;
1383 * Query whether the application or derived actor type requires intercept touch events.
1384 * @return True if intercept touch events are required.
1386 bool GetInterceptTouchRequired() const
1388 return !mInterceptTouchedSignal.Empty();
1392 * Query whether the application or derived actor type requires touch events.
1393 * @return True if touch events are required.
1395 bool GetTouchRequired() const
1397 return !mTouchedSignal.Empty();
1401 * Query whether the application or derived actor type requires hover events.
1402 * @return True if hover events are required.
1404 bool GetHoverRequired() const
1406 return !mHoveredSignal.Empty();
1410 * Query whether the application or derived actor type requires wheel events.
1411 * @return True if wheel events are required.
1413 bool GetWheelEventRequired() const
1415 return !mWheelEventSignal.Empty();
1419 * Query whether the actor is actually hittable. This method checks whether the actor is
1420 * sensitive, has the visibility flag set to true and is not fully transparent.
1421 * @return true, if it can be hit, false otherwise.
1423 bool IsHittable() const
1425 return IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
1429 * Query whether the actor captures all touch after it starts even if touch leaves its boundary.
1430 * @return true, if it captures all touch after start
1432 bool CapturesAllTouchAfterStart() const
1434 return mCaptureAllTouchAfterStart;
1438 * Sets the touch area offset of an actor.
1439 * @param [in] offset The new offset of area (left, right, bottom, top).
1441 void SetTouchAreaOffset(Rect<int> offset)
1443 mTouchAreaOffset = offset;
1447 * Retrieve the Actor's touch area offset.
1448 * @return The Actor's touch area offset.
1450 const Rect<int>& GetTouchAreaOffset() const
1452 return mTouchAreaOffset;
1458 * Retrieve the gesture data associated with this actor. The first call to this method will
1459 * allocate space for the ActorGestureData so this should only be called if an actor really does
1461 * @return Reference to the ActorGestureData for this actor.
1462 * @note Once the gesture-data is created for an actor it is likely that gestures are required
1463 * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
1465 ActorGestureData& GetGestureData();
1468 * Queries whether the actor requires the gesture type.
1469 * @param[in] type The gesture type.
1470 * @return True if the gesture is required, false otherwise.
1472 bool IsGestureRequired(GestureType::Value type) const;
1477 * Used by the EventProcessor to emit intercept touch event signals.
1478 * @param[in] touch The touch data.
1479 * @return True if the event was intercepted.
1481 bool EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch);
1484 * Used by the EventProcessor to emit touch event signals.
1485 * @param[in] touch The touch data.
1486 * @return True if the event was consumed.
1488 bool EmitTouchEventSignal(const Dali::TouchEvent& touch);
1491 * Used by the EventProcessor to emit hover event signals.
1492 * @param[in] event The hover event.
1493 * @return True if the event was consumed.
1495 bool EmitHoverEventSignal(const Dali::HoverEvent& event);
1498 * Used by the EventProcessor to emit wheel event signals.
1499 * @param[in] event The wheel event.
1500 * @return True if the event was consumed.
1502 bool EmitWheelEventSignal(const Dali::WheelEvent& event);
1505 * @brief Emits the visibility change signal for this actor and all its children.
1506 * @param[in] visible Whether the actor has become visible or not.
1507 * @param[in] type Whether the actor's visible property has changed or a parent's.
1509 void EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type);
1512 * @brief Emits the layout direction change signal for this actor and all its children.
1513 * @param[in] type Whether the actor's layout direction property has changed or a parent's.
1515 void EmitLayoutDirectionChangedSignal(LayoutDirection::Type type);
1518 * @copydoc DevelActor::InterceptTouchedSignal()
1520 Dali::Actor::TouchEventSignalType& InterceptTouchedSignal()
1522 return mInterceptTouchedSignal;
1526 * @copydoc Dali::Actor::TouchedSignal()
1528 Dali::Actor::TouchEventSignalType& TouchedSignal()
1530 return mTouchedSignal;
1534 * @copydoc Dali::Actor::HoveredSignal()
1536 Dali::Actor::HoverSignalType& HoveredSignal()
1538 return mHoveredSignal;
1542 * @copydoc Dali::Actor::WheelEventSignal()
1544 Dali::Actor::WheelEventSignalType& WheelEventSignal()
1546 return mWheelEventSignal;
1550 * @copydoc Dali::Actor::OnSceneSignal()
1552 Dali::Actor::OnSceneSignalType& OnSceneSignal()
1554 return mOnSceneSignal;
1558 * @copydoc Dali::Actor::OffSceneSignal()
1560 Dali::Actor::OffSceneSignalType& OffSceneSignal()
1562 return mOffSceneSignal;
1566 * @copydoc Dali::Actor::OnRelayoutSignal()
1568 Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal()
1570 return mOnRelayoutSignal;
1574 * @copydoc DevelActor::VisibilityChangedSignal
1576 DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal()
1578 return mVisibilityChangedSignal;
1582 * @copydoc LayoutDirectionChangedSignal
1584 Dali::Actor::LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal()
1586 return mLayoutDirectionChangedSignal;
1590 * @copydoc DevelActor::ChildAddedSignal
1592 DevelActor::ChildChangedSignalType& ChildAddedSignal();
1595 * @copydoc DevelActor::ChildRemovedSignal
1597 DevelActor::ChildChangedSignalType& ChildRemovedSignal();
1600 * @copydoc DevelActor::ChildOrderChangedSignal
1602 DevelActor::ChildOrderChangedSignalType& ChildOrderChangedSignal();
1608 * For use in derived classes.
1609 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1611 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
1624 * Protected Constructor. See Actor::New().
1625 * The second-phase construction Initialize() member should be called immediately after this.
1626 * @param[in] derivedType The derived type of actor (if any).
1627 * @param[in] reference to the node
1629 Actor(DerivedType derivedType, const SceneGraph::Node& node);
1632 * Second-phase constructor. Must be called immediately after creating a new Actor;
1634 void Initialize(void);
1637 * A reference counted object may only be deleted by calling Unreference()
1642 * Called on a child during Add() when the parent actor is connected to the Scene.
1643 * @param[in] parentDepth The depth of the parent in the hierarchy.
1644 * @param[in] notify Emits notification if set to true.
1646 void ConnectToScene(uint32_t parentDepth, bool notify);
1649 * Connect the Node associated with this Actor to the scene-graph.
1651 void ConnectToSceneGraph();
1654 * Helper for ConnectToScene, to notify a connected actor through the public API.
1655 * @param[in] notify Emits notification if set to true.
1657 void NotifyStageConnection(bool notify);
1660 * Called on a child during Remove() when the actor was previously on the Stage.
1661 * @param[in] notify Emits notification if set to true.
1663 void DisconnectFromStage(bool notify);
1666 * Disconnect the Node associated with this Actor from the scene-graph.
1668 void DisconnectFromSceneGraph();
1671 * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1672 * @param[in] notify Emits notification if set to true.
1674 void NotifyStageDisconnection(bool notify);
1677 * When the Actor is OnScene, checks whether the corresponding Node is connected to the scene graph.
1678 * @return True if the Actor is OnScene & has a Node connected to the scene graph.
1680 bool IsNodeConnected() const;
1684 * Trigger a rebuild of the actor depth tree from this root
1685 * If a Layer3D is encountered, then this doesn't descend any further.
1686 * The mSortedDepth of each actor is set appropriately.
1688 void RebuildDepthTree();
1691 // Default property extensions from Object
1694 * @copydoc Dali::Internal::Object::SetDefaultProperty()
1696 void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override;
1699 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1701 void SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value) override;
1704 * @copydoc Dali::Internal::Object::GetDefaultProperty()
1706 Property::Value GetDefaultProperty(Property::Index index) const override;
1709 * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
1711 Property::Value GetDefaultPropertyCurrentValue(Property::Index index) const override;
1714 * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
1716 void OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) override;
1719 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1721 const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty(Property::Index index) const override;
1724 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1726 const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override;
1729 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1731 int32_t GetPropertyComponentIndex(Property::Index index) const override;
1734 * @copydoc Dali::Internal::Object::IsAnimationPossible()
1736 bool IsAnimationPossible() const override
1742 * Retrieve the actor's node.
1743 * @return The node used by this actor
1745 const SceneGraph::Node& GetNode() const;
1748 * @copydoc Dali::DevelActor::Raise()
1753 * @copydoc Dali::DevelActor::Lower()
1758 * @copydoc Dali::DevelActor::RaiseToTop()
1763 * @copydoc Dali::DevelActor::LowerToBottom()
1765 void LowerToBottom();
1768 * @copydoc Dali::DevelActor::RaiseAbove()
1770 void RaiseAbove(Internal::Actor& target);
1773 * @copydoc Dali::DevelActor::LowerBelow()
1775 void LowerBelow(Internal::Actor& target);
1779 * Sets the scene which this actor is added to.
1780 * @param[in] scene The scene
1782 void SetScene(Scene& scene)
1788 * Gets the scene which this actor is added to.
1791 Scene& GetScene() const
1796 LayoutDirection::Type GetLayoutDirection() const
1798 return mLayoutDirection;
1811 struct AnimatedSizeFlag
1824 // Remove default constructor and copy constructor
1826 Actor(const Actor&) = delete;
1827 Actor& operator=(const Actor& rhs) = delete;
1830 * Set the actor's parent.
1831 * @param[in] parent The new parent.
1832 * @param[in] notify Emits notification if set to true. Default is true.
1834 void SetParent(ActorParent* parent, bool notify = true);
1837 * For use in derived classes, called after Initialize()
1839 virtual void OnInitialize()
1844 * For use in internal derived classes.
1845 * This is called during ConnectToScene(), after the actor has finished adding its node to the scene-graph.
1846 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1848 virtual void OnSceneConnectionInternal()
1853 * For use in internal derived classes.
1854 * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1855 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1857 virtual void OnSceneDisconnectionInternal()
1862 * For use in external (CustomActor) derived classes.
1863 * This is called after the atomic ConnectToScene() traversal has been completed.
1865 virtual void OnSceneConnectionExternal(int depth)
1870 * For use in external (CustomActor) derived classes.
1871 * This is called after the atomic DisconnectFromStage() traversal has been completed.
1873 virtual void OnSceneDisconnectionExternal()
1878 * For use in derived classes; this is called after Add() has added a child.
1879 * @param[in] child The child that was added.
1881 virtual void OnChildAdd(Actor& child)
1886 * For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ).
1887 * @param[in] child The child that was removed.
1889 virtual void OnChildRemove(Actor& child)
1894 * For use in derived classes.
1895 * This is called after SizeSet() has been called.
1897 virtual void OnSizeSet(const Vector3& targetSize)
1902 * @brief Retrieves the cached event side value of a default property.
1903 * @param[in] index The index of the property
1904 * @param[out] value Is set with the cached value of the property if found.
1905 * @return True if value set, false otherwise.
1907 bool GetCachedPropertyValue(Property::Index index, Property::Value& value) const;
1910 * @brief Retrieves the current value of a default property from the scene-graph.
1911 * @param[in] index The index of the property
1912 * @param[out] value Is set with the current scene-graph value of the property
1913 * @return True if value set, false otherwise.
1915 bool GetCurrentPropertyValue(Property::Index index, Property::Value& value) const;
1918 * @brief Ensure the relayouter is allocated
1920 Relayouter& EnsureRelayouter();
1923 * @brief Apply the size set policy to the input size
1925 * @param[in] size The size to apply the policy to
1926 * @return Return the adjusted size
1928 Vector2 ApplySizeSetPolicy(const Vector2& size);
1931 * Retrieve the parent object of an Actor.
1932 * @return The parent object, or NULL if the Actor does not have a parent.
1934 Object* GetParentObject() const override
1936 return static_cast<Actor*>(mParent);
1940 * @brief Get the current position of the actor in screen coordinates.
1942 * @return Returns the screen position of actor
1944 const Vector2 GetCurrentScreenPosition() const;
1947 * Sets the visibility flag of an actor.
1948 * @param[in] visible The new visibility flag.
1949 * @param[in] sendMessage Whether to send a message to the update thread or not.
1951 void SetVisibleInternal(bool visible, SendMessage::Type sendMessage);
1954 * @copydoc ActorParent::SetSiblingOrderOfChild
1956 void SetSiblingOrderOfChild(Actor& child, uint32_t order) override;
1959 * @copydoc ActorParent::GetSiblingOrderOfChild
1961 uint32_t GetSiblingOrderOfChild(const Actor& child) const override;
1964 * @copydoc ActorParent::RaiseChild
1966 void RaiseChild(Actor& child) override;
1969 * @copydoc ActorParent::LowerChild
1971 void LowerChild(Actor& child) override;
1974 * @copydoc ActorParent::RaiseChildToTop
1976 void RaiseChildToTop(Actor& child) override;
1979 * @copydoc ActorParent::LowerChildToBottom
1981 void LowerChildToBottom(Actor& child) override;
1984 * @copydoc ActorParent::RaiseChildAbove
1986 void RaiseChildAbove(Actor& child, Actor& target) override;
1989 * @copydoc ActorParent::LowerChildBelow()
1991 void LowerChildBelow(Actor& child, Actor& target) override;
1994 * Set whether a child actor inherits it's parent's layout direction. Default is to inherit.
1995 * @param[in] inherit - true if the actor should inherit layout direction, false otherwise.
1997 void SetInheritLayoutDirection(bool inherit);
2000 * Returns whether the actor inherits it's parent's layout direction.
2001 * @return true if the actor inherits it's parent's layout direction, false otherwise.
2003 bool IsLayoutDirectionInherited() const
2005 return mInheritLayoutDirection;
2009 * @brief Sets the update size hint of an actor.
2010 * @param [in] updateSizeHint The update size hint.
2012 void SetUpdateSizeHint(const Vector2& updateSizeHint);
2015 ActorParentImpl mParentImpl; ///< Implementation of ActorParent;
2016 ActorParent* mParent; ///< Each actor (except the root) can have one parent
2017 Scene* mScene; ///< The scene the actor is added to
2018 RendererContainer* mRenderers; ///< Renderer container
2019 Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
2020 Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
2021 Relayouter* mRelayoutData; ///< Struct to hold optional collection of relayout variables
2022 ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
2025 Dali::Actor::TouchEventSignalType mInterceptTouchedSignal;
2026 Dali::Actor::TouchEventSignalType mTouchedSignal;
2027 Dali::Actor::HoverSignalType mHoveredSignal;
2028 Dali::Actor::WheelEventSignalType mWheelEventSignal;
2029 Dali::Actor::OnSceneSignalType mOnSceneSignal;
2030 Dali::Actor::OffSceneSignalType mOffSceneSignal;
2031 Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
2032 DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
2033 Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal;
2035 Quaternion mTargetOrientation; ///< Event-side storage for orientation
2036 Vector4 mTargetColor; ///< Event-side storage for color
2037 Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
2038 Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
2039 Vector3 mTargetScale; ///< Event-side storage for scale
2040 Vector3 mAnimatedSize; ///< Event-side storage for size animation
2041 Rect<int> mTouchAreaOffset; ///< touch area offset (left, right, bottom, top)
2043 ConstString mName; ///< Name of the actor
2044 uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
2045 int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported
2046 uint16_t mUseAnimatedSize; ///< Whether the size is animated.
2048 const bool mIsRoot : 1; ///< Flag to identify the root actor
2049 const bool mIsLayer : 1; ///< Flag to identify that this is a layer
2050 bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene
2051 bool mSensitive : 1; ///< Whether the actor emits touch event signals
2052 bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
2053 bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
2054 bool mKeyboardFocusableChildren : 1; ///< Whether the children of this actor can be focusable by keyboard navigation.
2055 bool mTouchFocusable : 1; ///< Whether the actor should be focusable by touch
2056 bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
2057 bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
2058 bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
2059 bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
2060 bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
2061 bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
2062 bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
2063 bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent.
2064 bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area.
2065 bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
2066 bool mNeedGesturePropagation : 1; ///< Whether the parent listens for gesture events or not
2067 LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left.
2068 DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
2069 ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
2070 ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use.
2071 DevelBlendEquation::Type mBlendEquation : 16; ///< Cached: Determines which blend equation will be used to render renderers.
2074 static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
2076 struct PropertyHandler;
2077 struct SiblingHandler;
2079 friend class ActorParentImpl; // Allow impl to call private methods on actor
2082 } // namespace Internal
2084 // Helpers for public-api forwarding methods
2086 inline Internal::Actor& GetImplementation(Dali::Actor& actor)
2088 DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
2090 BaseObject& handle = actor.GetBaseObject();
2092 return static_cast<Internal::Actor&>(handle);
2095 inline const Internal::Actor& GetImplementation(const Dali::Actor& actor)
2097 DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
2099 const BaseObject& handle = actor.GetBaseObject();
2101 return static_cast<const Internal::Actor&>(handle);
2106 #endif // DALI_INTERNAL_ACTOR_H