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 * If the position uses the anchor point, return the anchor point, otherwise
394 * @return The anchor point for positioning.
396 Vector3 GetAnchorPointForPosition() const;
399 * Sets the position of the Actor.
400 * The coordinates are relative to the Actor's parent.
401 * The Actor's z position will be set to 0.0f.
402 * @param [in] x The new x position
403 * @param [in] y The new y position
405 void SetPosition(float x, float y);
408 * Sets the position of the Actor.
409 * The coordinates are relative to the Actor's parent.
410 * @param [in] x The new x position
411 * @param [in] y The new y position
412 * @param [in] z The new z position
414 void SetPosition(float x, float y, float z);
417 * Sets the position of the Actor.
418 * The coordinates are relative to the Actor's parent.
419 * @param [in] position The new position.
421 void SetPosition(const Vector3& position);
424 * Set the position of an actor along the X-axis.
425 * @param [in] x The new x position
430 * Set the position of an actor along the Y-axis.
431 * @param [in] y The new y position.
436 * Set the position of an actor along the Z-axis.
437 * @param [in] z The new z position
442 * Translate an actor relative to its existing position.
443 * @param[in] distance The actor will move by this distance.
445 void TranslateBy(const Vector3& distance);
448 * Retrieve the position of the Actor.
449 * The coordinates are relative to the Actor's parent.
450 * @return the Actor's position.
452 const Vector3& GetCurrentPosition() const;
455 * Retrieve the target position of the Actor.
456 * The coordinates are relative to the Actor's parent.
457 * @return the Actor's position.
459 const Vector3& GetTargetPosition() const
461 return mTargetPosition;
465 * @copydoc Dali::Actor::GetCurrentWorldPosition()
467 const Vector3& GetCurrentWorldPosition() const;
470 * @copydoc Dali::Actor::SetInheritPosition()
472 void SetInheritPosition(bool inherit);
475 * @copydoc Dali::Actor::IsPositionInherited()
477 bool IsPositionInherited() const
479 return mInheritPosition;
483 * Sets the orientation of the Actor.
484 * @param [in] angleRadians The new orientation angle in radians.
485 * @param [in] axis The new axis of orientation.
487 void SetOrientation(const Radian& angleRadians, const Vector3& axis);
490 * Sets the orientation of the Actor.
491 * @param [in] orientation The new orientation.
493 void SetOrientation(const Quaternion& orientation);
496 * Rotate an actor around its existing rotation axis.
497 * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
498 * @param[in] axis The axis of the rotation to combine with the existing rotation.
500 void RotateBy(const Radian& angleRadians, const Vector3& axis);
503 * Apply a relative rotation to an actor.
504 * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
506 void RotateBy(const Quaternion& relativeRotation);
509 * Retreive the Actor's orientation.
510 * @return the orientation.
512 const Quaternion& GetCurrentOrientation() const;
515 * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
516 * Switching this off means that using SetOrientation() sets the actor's world orientation.
517 * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
519 void SetInheritOrientation(bool inherit);
522 * Returns whether the actor inherit's it's parent's orientation.
523 * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
525 bool IsOrientationInherited() const
527 return mInheritOrientation;
531 * Sets 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 * @param[in] factor The vector to multiply the parents size by to get the childs size.
535 void SetSizeModeFactor(const Vector3& factor);
538 * Gets the factor of the parents size used for the child actor.
539 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
540 * @return The vector being used to multiply the parents size by to get the childs size.
542 const Vector3& GetSizeModeFactor() const;
545 * @copydoc Dali::Actor::GetCurrentWorldOrientation()
547 const Quaternion& GetCurrentWorldOrientation() const;
550 * Sets a scale factor applied to an actor.
551 * @param [in] scale The scale factor applied on all axes.
553 void SetScale(float scale);
556 * Sets a scale factor applied to an actor.
557 * @param [in] scaleX The scale factor applied along the x-axis.
558 * @param [in] scaleY The scale factor applied along the y-axis.
559 * @param [in] scaleZ The scale factor applied along the z-axis.
561 void SetScale(float scaleX, float scaleY, float scaleZ);
564 * Sets a scale factor applied to an actor.
565 * @param [in] scale A vector representing the scale factor for each axis.
567 void SetScale(const Vector3& scale);
570 * Set the x component of the scale factor.
571 * @param [in] x The new x value.
573 void SetScaleX(float x);
576 * Set the y component of the scale factor.
577 * @param [in] y The new y value.
579 void SetScaleY(float y);
582 * Set the z component of the scale factor.
583 * @param [in] z The new z value.
585 void SetScaleZ(float z);
588 * Apply a relative scale to an actor.
589 * @param[in] relativeScale The scale to combine with the actors existing scale.
591 void ScaleBy(const Vector3& relativeScale);
594 * Retrieve the scale factor applied to an actor.
595 * @return A vector representing the scale factor for each axis.
597 const Vector3& GetCurrentScale() const;
600 * @copydoc Dali::Actor::GetCurrentWorldScale()
602 const Vector3& GetCurrentWorldScale() const;
605 * @copydoc Dali::Actor::SetInheritScale()
607 void SetInheritScale(bool inherit);
610 * @copydoc Dali::Actor::IsScaleInherited()
612 bool IsScaleInherited() const
614 return mInheritScale;
618 * @copydoc Dali::Actor::GetCurrentWorldMatrix()
620 Matrix GetCurrentWorldMatrix() const;
625 * Sets the visibility flag of an actor.
626 * @param[in] visible The new visibility flag.
628 void SetVisible(bool visible);
631 * Retrieve the visibility flag of an actor.
632 * @return The visibility flag.
634 bool IsVisible() const;
637 * Sets the opacity of an actor.
638 * @param [in] opacity The new opacity.
640 void SetOpacity(float opacity);
643 * Retrieve the actor's opacity.
644 * @return The actor's opacity.
646 float GetCurrentOpacity() const;
649 * Retrieve the actor's clipping mode.
650 * @return The actor's clipping mode (cached)
652 ClippingMode::Type GetClippingMode() const
654 return mClippingMode;
658 * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
659 * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
660 * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
661 * hover event signal will be emitted.
663 * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
665 * actor.SetSensitive(false);
668 * Then, to re-enable the touch or hover event signal emission, the application should call:
670 * actor.SetSensitive(true);
673 * @see SignalTouch() and SignalHover().
674 * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
675 * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
677 void SetSensitive(bool sensitive)
679 mSensitive = sensitive;
683 * Query whether an actor emits touch or hover event signals.
684 * @see SetSensitive(bool)
685 * @return true, if emission of touch or hover event signals is enabled, false otherwise.
687 bool IsSensitive() const
693 * @copydoc Dali::Actor::SetDrawMode
695 void SetDrawMode(DrawMode::Type drawMode);
698 * @copydoc Dali::Actor::GetDrawMode
700 DrawMode::Type GetDrawMode() const
706 * @copydoc Dali::Actor::IsOverlay
708 bool IsOverlay() const
710 return (DrawMode::OVERLAY_2D == mDrawMode);
714 * Sets the actor's color. The final color of actor depends on its color mode.
715 * This final color is applied to the drawable elements of an actor.
716 * @param [in] color The new color.
718 void SetColor(const Vector4& color);
721 * Set the red component of the color.
722 * @param [in] red The new red component.
724 void SetColorRed(float red);
727 * Set the green component of the color.
728 * @param [in] green The new green component.
730 void SetColorGreen(float green);
733 * Set the blue component of the scale factor.
734 * @param [in] blue The new blue value.
736 void SetColorBlue(float blue);
739 * Retrieve the actor's color.
742 const Vector4& GetCurrentColor() const;
745 * Sets the actor's color mode.
746 * Color mode specifies whether Actor uses its own color or inherits its parent color
747 * @param [in] colorMode to use.
749 void SetColorMode(ColorMode colorMode);
752 * Returns the actor's color mode.
753 * @return currently used colorMode.
755 ColorMode GetColorMode() const
761 * @copydoc Dali::Actor::GetCurrentWorldColor()
763 const Vector4& GetCurrentWorldColor() const;
766 * @copydoc Dali::Actor::GetHierarchyDepth()
768 inline int32_t GetHierarchyDepth() const
779 * Get the actor's sorting depth
781 * @return The depth used for hit-testing and renderer sorting
783 inline uint32_t GetSortingDepth()
789 * Set the actor's sorted depth. Used during recreation of depth tree
790 * @param[in] sortedDepth the new sorted depth
792 inline void SetSortingDepth(uint32_t sortedDepth)
794 mSortedDepth = sortedDepth;
798 // Size negotiation virtual functions
801 * @brief Called after the size negotiation has been finished for this control.
803 * The control is expected to assign this given size to itself/its children.
805 * Should be overridden by derived classes if they need to layout
806 * actors differently after certain operations like add or remove
807 * actors, resize or after changing specific properties.
809 * Note! As this function is called from inside the size negotiation algorithm, you cannot
810 * call RequestRelayout (the call would just be ignored)
812 * @param[in] size The allocated size.
813 * @param[in,out] container The control should add actors to this container that it is not able
814 * to allocate a size for.
816 virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
821 * @brief Notification for deriving classes when the resize policy is set
823 * @param[in] policy The policy being set
824 * @param[in] dimension The dimension the policy is being set for
826 virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
831 * @brief Virtual method to notify deriving classes that relayout dependencies have been
832 * met and the size for this object is about to be calculated for the given dimension
834 * @param dimension The dimension that is about to be calculated
836 virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
841 * @brief Virtual method to notify deriving classes that the size for a dimension
842 * has just been negotiated
844 * @param[in] size The new size for the given dimension
845 * @param[in] dimension The dimension that was just negotiated
847 virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
852 * @brief Determine if this actor is dependent on it's children for relayout
854 * @param dimension The dimension(s) to check for
855 * @return Return if the actor is dependent on it's children
857 virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
860 * @brief Determine if this actor is dependent on it's children for relayout.
862 * Called from deriving classes
864 * @param dimension The dimension(s) to check for
865 * @return Return if the actor is dependent on it's children
867 virtual bool RelayoutDependentOnChildrenBase(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
870 * @brief Calculate the size for a child
872 * @param[in] child The child actor to calculate the size for
873 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
874 * @return Return the calculated size for the given dimension
876 virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension);
879 * @brief This method is called during size negotiation when a height is required for a given width.
881 * Derived classes should override this if they wish to customize the height returned.
883 * @param width to use.
884 * @return the height based on the width.
886 virtual float GetHeightForWidth(float width);
889 * @brief This method is called during size negotiation when a width is required for a given height.
891 * Derived classes should override this if they wish to customize the width returned.
893 * @param height to use.
894 * @return the width based on the width.
896 virtual float GetWidthForHeight(float height);
902 * @brief Called by the RelayoutController to negotiate the size of an actor.
904 * The size allocated by the the algorithm is passed in which the
905 * actor must adhere to. A container is passed in as well which
906 * the actor should populate with actors it has not / or does not
907 * need to handle in its size negotiation.
909 * @param[in] size The allocated size.
910 * @param[in,out] container The container that holds actors that are fed back into the
911 * RelayoutController algorithm.
913 void NegotiateSize(const Vector2& size, RelayoutContainer& container);
916 * @brief Set whether size negotiation should use the assigned size of the actor
917 * during relayout for the given dimension(s)
919 * @param[in] use Whether the assigned size of the actor should be used
920 * @param[in] dimension The dimension(s) to set. Can be a bitfield of multiple dimensions
922 void SetUseAssignedSize(bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
925 * @brief Returns whether size negotiation should use the assigned size of the actor
926 * during relayout for a single dimension
928 * @param[in] dimension The dimension to get
929 * @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
931 bool GetUseAssignedSize(Dimension::Type dimension) const;
934 * @copydoc Dali::Actor::SetResizePolicy()
936 void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
939 * @copydoc Dali::Actor::GetResizePolicy()
941 ResizePolicy::Type GetResizePolicy(Dimension::Type dimension) const;
944 * @copydoc Dali::Actor::SetSizeScalePolicy()
946 void SetSizeScalePolicy(SizeScalePolicy::Type policy);
949 * @copydoc Dali::Actor::GetSizeScalePolicy()
951 SizeScalePolicy::Type GetSizeScalePolicy() const;
954 * @copydoc Dali::Actor::SetDimensionDependency()
956 void SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency);
959 * @copydoc Dali::Actor::GetDimensionDependency()
961 Dimension::Type GetDimensionDependency(Dimension::Type dimension) const;
964 * @brief Set the size negotiation relayout enabled on this actor
966 * @param[in] relayoutEnabled Boolean to enable or disable relayout
968 void SetRelayoutEnabled(bool relayoutEnabled);
971 * @brief Return if relayout is enabled
973 * @return Return if relayout is enabled or not for this actor
975 bool IsRelayoutEnabled() const;
978 * @brief Mark an actor as having it's layout dirty
980 * @param dirty Whether to mark actor as dirty or not
981 * @param dimension The dimension(s) to mark as dirty
983 void SetLayoutDirty(bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
986 * @brief Return if any of an actor's dimensions are marked as dirty
988 * @param dimension The dimension(s) to check
989 * @return Return if any of the requested dimensions are dirty
991 bool IsLayoutDirty(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
994 * @brief Returns if relayout is enabled and the actor is not dirty
996 * @return Return if it is possible to relayout the actor
998 bool RelayoutPossible(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
1001 * @brief Returns if relayout is enabled and the actor is dirty
1003 * @return Return if it is required to relayout the actor
1005 bool RelayoutRequired(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
1008 * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
1010 * This method is automatically called from OnSceneConnection(), OnChildAdd(),
1011 * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
1013 * This method can also be called from a derived class every time it needs a different size.
1014 * At the end of event processing, the relayout process starts and
1015 * all controls which requested Relayout will have their sizes (re)negotiated.
1017 * @note RelayoutRequest() can be called multiple times; the size negotiation is still
1018 * only performed once, i.e. there is no need to keep track of this in the calling side.
1020 void RelayoutRequest(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1023 * @brief Determine if this actor is dependent on it's parent for relayout
1025 * @param dimension The dimension(s) to check for
1026 * @return Return if the actor is dependent on it's parent
1028 bool RelayoutDependentOnParent(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1031 * @brief Determine if this actor has another dimension depedent on the specified one
1033 * @param dimension The dimension to check for
1034 * @param dependentDimension The dimension to check for dependency with
1035 * @return Return if the actor is dependent on this dimension
1037 bool RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension);
1040 * @brief Calculate the size of a dimension
1042 * @param[in] dimension The dimension to calculate the size for
1043 * @param[in] maximumSize The upper bounds on the size
1044 * @return Return the calculated size for the dimension
1046 float CalculateSize(Dimension::Type dimension, const Vector2& maximumSize);
1049 * Negotiate a dimension based on the size of the parent
1051 * @param[in] dimension The dimension to negotiate on
1052 * @return Return the negotiated size
1054 float NegotiateFromParent(Dimension::Type dimension);
1057 * @brief Negotiate a dimension based on the size of the children
1059 * @param[in] dimension The dimension to negotiate on
1060 * @return Return the negotiated size
1062 float NegotiateFromChildren(Dimension::Type dimension);
1065 * Set the negotiated dimension value for the given dimension(s)
1067 * @param negotiatedDimension The value to set
1068 * @param dimension The dimension(s) to set the value for
1070 void SetNegotiatedDimension(float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1073 * Return the value of negotiated dimension for the given dimension
1075 * @param dimension The dimension to retrieve
1076 * @return Return the value of the negotiated dimension
1078 float GetNegotiatedDimension(Dimension::Type dimension) const;
1081 * @brief Set the padding for a dimension
1083 * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
1084 * @param[in] dimension The dimension to set
1086 void SetPadding(const Vector2& padding, Dimension::Type dimension);
1089 * Return the value of padding for the given dimension
1091 * @param dimension The dimension to retrieve
1092 * @return Return the value of padding for the dimension
1094 Vector2 GetPadding(Dimension::Type dimension) const;
1097 * Return the actor size for a given dimension
1099 * @param[in] dimension The dimension to retrieve the size for
1100 * @return Return the size for the given dimension
1102 float GetSize(Dimension::Type dimension) const;
1105 * Return the natural size of the actor for a given dimension
1107 * @param[in] dimension The dimension to retrieve the size for
1108 * @return Return the natural size for the given dimension
1110 float GetNaturalSize(Dimension::Type dimension) const;
1113 * @brief Return the amount of size allocated for relayout
1115 * May include padding
1117 * @param[in] dimension The dimension to retrieve
1118 * @return Return the size
1120 float GetRelayoutSize(Dimension::Type dimension) const;
1123 * @brief If the size has been negotiated return that else return normal size
1125 * @param[in] dimension The dimension to retrieve
1126 * @return Return the size
1128 float GetLatestSize(Dimension::Type dimension) const;
1131 * Apply the negotiated size to the actor
1133 * @param[in] container The container to fill with actors that require further relayout
1135 void SetNegotiatedSize(RelayoutContainer& container);
1138 * @brief Flag the actor as having it's layout dimension negotiated.
1140 * @param[in] negotiated The status of the flag to set.
1141 * @param[in] dimension The dimension to set the flag for
1143 void SetLayoutNegotiated(bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1146 * @brief Test whether the layout dimension for this actor has been negotiated or not.
1148 * @param[in] dimension The dimension to determine the value of the flag for
1149 * @return Return if the layout dimension is negotiated or not.
1151 bool IsLayoutNegotiated(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
1154 * @brief provides the Actor implementation of GetHeightForWidth
1155 * @param width to use.
1156 * @return the height based on the width.
1158 float GetHeightForWidthBase(float width);
1161 * @brief provides the Actor implementation of GetWidthForHeight
1162 * @param height to use.
1163 * @return the width based on the height.
1165 float GetWidthForHeightBase(float height);
1168 * @brief Calculate the size for a child
1170 * @param[in] child The child actor to calculate the size for
1171 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
1172 * @return Return the calculated size for the given dimension
1174 float CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension);
1177 * @brief Set the preferred size for size negotiation
1179 * @param[in] size The preferred size to set
1181 void SetPreferredSize(const Vector2& size);
1184 * @brief Return the preferred size used for size negotiation
1186 * @return Return the preferred size
1188 Vector2 GetPreferredSize() const;
1191 * @copydoc Dali::Actor::SetMinimumSize
1193 void SetMinimumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1196 * @copydoc Dali::Actor::GetMinimumSize
1198 float GetMinimumSize(Dimension::Type dimension) const;
1201 * @copydoc Dali::Actor::SetMaximumSize
1203 void SetMaximumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1206 * @copydoc Dali::Actor::GetMaximumSize
1208 float GetMaximumSize(Dimension::Type dimension) const;
1211 * @copydoc Dali::Actor::AddRenderer()
1213 uint32_t AddRenderer(Renderer& renderer);
1216 * @copydoc Dali::Actor::GetRendererCount()
1218 uint32_t GetRendererCount() const;
1221 * @copydoc Dali::Actor::GetRendererAt()
1223 RendererPtr GetRendererAt(uint32_t index);
1226 * @copydoc Dali::Actor::RemoveRenderer()
1228 void RemoveRenderer(Renderer& renderer);
1231 * @copydoc Dali::Actor::RemoveRenderer()
1233 void RemoveRenderer(uint32_t index);
1236 * @brief Set BlendEquation at each renderer that added on this Actor.
1238 void SetBlendEquation(DevelBlendEquation::Type blendEquation);
1241 * @brief Get Blend Equation that applied to this Actor
1243 DevelBlendEquation::Type GetBlendEquation() const;
1246 * @brief Set this Actor is transparent or not without any affection on the child Actors.
1248 void SetTransparent(bool transparent);
1251 * @brief Get this Actor is transparent or not.
1253 bool IsTransparent() const;
1257 * Converts screen coordinates into the actor's coordinate system.
1258 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1259 * @param[out] localX On return, the X-coordinate relative to the actor.
1260 * @param[out] localY On return, the Y-coordinate relative to the actor.
1261 * @param[in] screenX The screen X-coordinate.
1262 * @param[in] screenY The screen Y-coordinate.
1263 * @return True if the conversion succeeded.
1265 bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const;
1268 * Converts screen coordinates into the actor's coordinate system.
1269 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1270 * @param[in] renderTask The render-task used to display the actor.
1271 * @param[out] localX On return, the X-coordinate relative to the actor.
1272 * @param[out] localY On return, the Y-coordinate relative to the actor.
1273 * @param[in] screenX The screen X-coordinate.
1274 * @param[in] screenY The screen Y-coordinate.
1275 * @return True if the conversion succeeded.
1277 bool ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const;
1280 * Converts from the actor's coordinate system to screen coordinates.
1281 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1282 * @param[in] viewMatrix The view-matrix
1283 * @param[in] projectionMatrix The projection-matrix
1284 * @param[in] viewport The view-port
1285 * @param[out] localX On return, the X-coordinate relative to the actor.
1286 * @param[out] localY On return, the Y-coordinate relative to the actor.
1287 * @param[in] screenX The screen X-coordinate.
1288 * @param[in] screenY The screen Y-coordinate.
1289 * @return True if the conversion succeeded.
1291 bool ScreenToLocal(const Matrix& viewMatrix,
1292 const Matrix& projectionMatrix,
1293 const Viewport& viewport,
1297 float screenY) const;
1300 * Sets whether the actor should receive a notification when touch or hover motion events leave
1301 * the boundary of the actor.
1303 * @note By default, this is set to false as most actors do not require this.
1304 * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
1306 * @param[in] required Should be set to true if a Leave event is required
1308 void SetLeaveRequired(bool required)
1310 mLeaveRequired = required;
1314 * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1315 * the boundary of the actor.
1316 * @return true if a Leave event is required, false otherwise.
1318 bool GetLeaveRequired() const
1320 return mLeaveRequired;
1324 * @copydoc Dali::Actor::SetKeyboardFocusable()
1326 void SetKeyboardFocusable(bool focusable)
1328 mKeyboardFocusable = focusable;
1332 * @copydoc Dali::Actor::IsKeyboardFocusable()
1334 bool IsKeyboardFocusable() const
1336 return mKeyboardFocusable;
1340 * @copydoc Dali::Actor::SetKeyboardFocusableChildren()
1342 void SetKeyboardFocusableChildren(bool focusable)
1344 mKeyboardFocusableChildren = focusable;
1348 * @copydoc Dali::Actor::AreChildrenKeyBoardFocusable()
1350 bool AreChildrenKeyBoardFocusable() const
1352 return mKeyboardFocusableChildren;
1356 * Set whether this view can focus by touch.
1357 * @param[in] focusable focuable by touch.
1359 void SetTouchFocusable(bool focusable)
1361 mTouchFocusable = focusable;
1365 * This returns whether this actor can focus by touch.
1366 * @return true if this actor can focus by touch.
1368 bool IsTouchFocusable() const
1370 return mTouchFocusable;
1374 * Query whether the application or derived actor type requires intercept touch events.
1375 * @return True if intercept touch events are required.
1377 bool GetInterceptTouchRequired() const
1379 return !mInterceptTouchedSignal.Empty();
1383 * Query whether the application or derived actor type requires touch events.
1384 * @return True if touch events are required.
1386 bool GetTouchRequired() const
1388 return !mTouchedSignal.Empty();
1392 * Query whether the application or derived actor type requires hover events.
1393 * @return True if hover events are required.
1395 bool GetHoverRequired() const
1397 return !mHoveredSignal.Empty();
1401 * Query whether the application or derived actor type requires wheel events.
1402 * @return True if wheel events are required.
1404 bool GetWheelEventRequired() const
1406 return !mWheelEventSignal.Empty();
1410 * Query whether the actor is actually hittable. This method checks whether the actor is
1411 * sensitive, has the visibility flag set to true and is not fully transparent.
1412 * @return true, if it can be hit, false otherwise.
1414 bool IsHittable() const
1416 return IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
1420 * Query whether the actor captures all touch after it starts even if touch leaves its boundary.
1421 * @return true, if it captures all touch after start
1423 bool CapturesAllTouchAfterStart() const
1425 return mCaptureAllTouchAfterStart;
1429 * Sets the touch area offset of an actor.
1430 * @param [in] offset The new offset of area (left, right, bottom, top).
1432 void SetTouchAreaOffset(Rect<int> offset)
1434 mTouchAreaOffset = offset;
1438 * Retrieve the Actor's touch area offset.
1439 * @return The Actor's touch area offset.
1441 const Rect<int>& GetTouchAreaOffset() const
1443 return mTouchAreaOffset;
1449 * Retrieve the gesture data associated with this actor. The first call to this method will
1450 * allocate space for the ActorGestureData so this should only be called if an actor really does
1452 * @return Reference to the ActorGestureData for this actor.
1453 * @note Once the gesture-data is created for an actor it is likely that gestures are required
1454 * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
1456 ActorGestureData& GetGestureData();
1459 * Queries whether the actor requires the gesture type.
1460 * @param[in] type The gesture type.
1461 * @return True if the gesture is required, false otherwise.
1463 bool IsGestureRequired(GestureType::Value type) const;
1468 * Used by the EventProcessor to emit intercept touch event signals.
1469 * @param[in] touch The touch data.
1470 * @return True if the event was intercepted.
1472 bool EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch);
1475 * Used by the EventProcessor to emit touch event signals.
1476 * @param[in] touch The touch data.
1477 * @return True if the event was consumed.
1479 bool EmitTouchEventSignal(const Dali::TouchEvent& touch);
1482 * Used by the EventProcessor to emit hover event signals.
1483 * @param[in] event The hover event.
1484 * @return True if the event was consumed.
1486 bool EmitHoverEventSignal(const Dali::HoverEvent& event);
1489 * Used by the EventProcessor to emit wheel event signals.
1490 * @param[in] event The wheel event.
1491 * @return True if the event was consumed.
1493 bool EmitWheelEventSignal(const Dali::WheelEvent& event);
1496 * @brief Emits the visibility change signal for this actor and all its children.
1497 * @param[in] visible Whether the actor has become visible or not.
1498 * @param[in] type Whether the actor's visible property has changed or a parent's.
1500 void EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type);
1503 * @brief Emits the layout direction change signal for this actor and all its children.
1504 * @param[in] type Whether the actor's layout direction property has changed or a parent's.
1506 void EmitLayoutDirectionChangedSignal(LayoutDirection::Type type);
1509 * @copydoc DevelActor::InterceptTouchedSignal()
1511 Dali::Actor::TouchEventSignalType& InterceptTouchedSignal()
1513 return mInterceptTouchedSignal;
1517 * @copydoc Dali::Actor::TouchedSignal()
1519 Dali::Actor::TouchEventSignalType& TouchedSignal()
1521 return mTouchedSignal;
1525 * @copydoc Dali::Actor::HoveredSignal()
1527 Dali::Actor::HoverSignalType& HoveredSignal()
1529 return mHoveredSignal;
1533 * @copydoc Dali::Actor::WheelEventSignal()
1535 Dali::Actor::WheelEventSignalType& WheelEventSignal()
1537 return mWheelEventSignal;
1541 * @copydoc Dali::Actor::OnSceneSignal()
1543 Dali::Actor::OnSceneSignalType& OnSceneSignal()
1545 return mOnSceneSignal;
1549 * @copydoc Dali::Actor::OffSceneSignal()
1551 Dali::Actor::OffSceneSignalType& OffSceneSignal()
1553 return mOffSceneSignal;
1557 * @copydoc Dali::Actor::OnRelayoutSignal()
1559 Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal()
1561 return mOnRelayoutSignal;
1565 * @copydoc DevelActor::VisibilityChangedSignal
1567 DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal()
1569 return mVisibilityChangedSignal;
1573 * @copydoc LayoutDirectionChangedSignal
1575 Dali::Actor::LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal()
1577 return mLayoutDirectionChangedSignal;
1581 * @copydoc DevelActor::ChildAddedSignal
1583 DevelActor::ChildChangedSignalType& ChildAddedSignal();
1586 * @copydoc DevelActor::ChildRemovedSignal
1588 DevelActor::ChildChangedSignalType& ChildRemovedSignal();
1591 * @copydoc DevelActor::ChildOrderChangedSignal
1593 DevelActor::ChildOrderChangedSignalType& ChildOrderChangedSignal();
1599 * For use in derived classes.
1600 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1602 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
1615 * Protected Constructor. See Actor::New().
1616 * The second-phase construction Initialize() member should be called immediately after this.
1617 * @param[in] derivedType The derived type of actor (if any).
1618 * @param[in] reference to the node
1620 Actor(DerivedType derivedType, const SceneGraph::Node& node);
1623 * Second-phase constructor. Must be called immediately after creating a new Actor;
1625 void Initialize(void);
1628 * A reference counted object may only be deleted by calling Unreference()
1633 * Called on a child during Add() when the parent actor is connected to the Scene.
1634 * @param[in] parentDepth The depth of the parent in the hierarchy.
1635 * @param[in] notify Emits notification if set to true.
1637 void ConnectToScene(uint32_t parentDepth, bool notify);
1640 * Connect the Node associated with this Actor to the scene-graph.
1642 void ConnectToSceneGraph();
1645 * Helper for ConnectToScene, to notify a connected actor through the public API.
1646 * @param[in] notify Emits notification if set to true.
1648 void NotifyStageConnection(bool notify);
1651 * Called on a child during Remove() when the actor was previously on the Stage.
1652 * @param[in] notify Emits notification if set to true.
1654 void DisconnectFromStage(bool notify);
1657 * Disconnect the Node associated with this Actor from the scene-graph.
1659 void DisconnectFromSceneGraph();
1662 * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1663 * @param[in] notify Emits notification if set to true.
1665 void NotifyStageDisconnection(bool notify);
1668 * When the Actor is OnScene, checks whether the corresponding Node is connected to the scene graph.
1669 * @return True if the Actor is OnScene & has a Node connected to the scene graph.
1671 bool IsNodeConnected() const;
1675 * Trigger a rebuild of the actor depth tree from this root
1676 * If a Layer3D is encountered, then this doesn't descend any further.
1677 * The mSortedDepth of each actor is set appropriately.
1679 void RebuildDepthTree();
1682 // Default property extensions from Object
1685 * @copydoc Dali::Internal::Object::SetDefaultProperty()
1687 void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override;
1690 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1692 void SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value) override;
1695 * @copydoc Dali::Internal::Object::GetDefaultProperty()
1697 Property::Value GetDefaultProperty(Property::Index index) const override;
1700 * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
1702 Property::Value GetDefaultPropertyCurrentValue(Property::Index index) const override;
1705 * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
1707 void OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) override;
1710 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1712 const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty(Property::Index index) const override;
1715 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1717 const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override;
1720 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1722 int32_t GetPropertyComponentIndex(Property::Index index) const override;
1725 * @copydoc Dali::Internal::Object::IsAnimationPossible()
1727 bool IsAnimationPossible() const override
1733 * Retrieve the actor's node.
1734 * @return The node used by this actor
1736 const SceneGraph::Node& GetNode() const;
1739 * @copydoc Dali::DevelActor::Raise()
1744 * @copydoc Dali::DevelActor::Lower()
1749 * @copydoc Dali::DevelActor::RaiseToTop()
1754 * @copydoc Dali::DevelActor::LowerToBottom()
1756 void LowerToBottom();
1759 * @copydoc Dali::DevelActor::RaiseAbove()
1761 void RaiseAbove(Internal::Actor& target);
1764 * @copydoc Dali::DevelActor::LowerBelow()
1766 void LowerBelow(Internal::Actor& target);
1770 * Sets the scene which this actor is added to.
1771 * @param[in] scene The scene
1773 void SetScene(Scene& scene)
1779 * Gets the scene which this actor is added to.
1782 Scene& GetScene() const
1787 LayoutDirection::Type GetLayoutDirection() const
1789 return mLayoutDirection;
1802 struct AnimatedSizeFlag
1815 // Remove default constructor and copy constructor
1817 Actor(const Actor&) = delete;
1818 Actor& operator=(const Actor& rhs) = delete;
1821 * Set the actor's parent.
1822 * @param[in] parent The new parent.
1823 * @param[in] notify Emits notification if set to true. Default is true.
1825 void SetParent(ActorParent* parent, bool notify = true);
1828 * For use in derived classes, called after Initialize()
1830 virtual void OnInitialize()
1835 * For use in internal derived classes.
1836 * This is called during ConnectToScene(), after the actor has finished adding its node to the scene-graph.
1837 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1839 virtual void OnSceneConnectionInternal()
1844 * For use in internal derived classes.
1845 * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1846 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1848 virtual void OnSceneDisconnectionInternal()
1853 * For use in external (CustomActor) derived classes.
1854 * This is called after the atomic ConnectToScene() traversal has been completed.
1856 virtual void OnSceneConnectionExternal(int depth)
1861 * For use in external (CustomActor) derived classes.
1862 * This is called after the atomic DisconnectFromStage() traversal has been completed.
1864 virtual void OnSceneDisconnectionExternal()
1869 * For use in derived classes; this is called after Add() has added a child.
1870 * @param[in] child The child that was added.
1872 virtual void OnChildAdd(Actor& child)
1877 * For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ).
1878 * @param[in] child The child that was removed.
1880 virtual void OnChildRemove(Actor& child)
1885 * For use in derived classes.
1886 * This is called after SizeSet() has been called.
1888 virtual void OnSizeSet(const Vector3& targetSize)
1893 * @brief Retrieves the cached event side value of a default property.
1894 * @param[in] index The index of the property
1895 * @param[out] value Is set with the cached value of the property if found.
1896 * @return True if value set, false otherwise.
1898 bool GetCachedPropertyValue(Property::Index index, Property::Value& value) const;
1901 * @brief Retrieves the current value of a default property from the scene-graph.
1902 * @param[in] index The index of the property
1903 * @param[out] value Is set with the current scene-graph value of the property
1904 * @return True if value set, false otherwise.
1906 bool GetCurrentPropertyValue(Property::Index index, Property::Value& value) const;
1909 * @brief Ensure the relayouter is allocated
1911 Relayouter& EnsureRelayouter();
1914 * @brief Apply the size set policy to the input size
1916 * @param[in] size The size to apply the policy to
1917 * @return Return the adjusted size
1919 Vector2 ApplySizeSetPolicy(const Vector2& size);
1922 * Retrieve the parent object of an Actor.
1923 * @return The parent object, or NULL if the Actor does not have a parent.
1925 Object* GetParentObject() const override
1927 return static_cast<Actor*>(mParent);
1931 * @brief Get the current position of the actor in screen coordinates.
1933 * @return Returns the screen position of actor
1935 const Vector2 GetCurrentScreenPosition() const;
1938 * Sets the visibility flag of an actor.
1939 * @param[in] visible The new visibility flag.
1940 * @param[in] sendMessage Whether to send a message to the update thread or not.
1942 void SetVisibleInternal(bool visible, SendMessage::Type sendMessage);
1945 * @copydoc ActorParent::SetSiblingOrderOfChild
1947 void SetSiblingOrderOfChild(Actor& child, uint32_t order) override;
1950 * @copydoc ActorParent::GetSiblingOrderOfChild
1952 uint32_t GetSiblingOrderOfChild(const Actor& child) const override;
1955 * @copydoc ActorParent::RaiseChild
1957 void RaiseChild(Actor& child) override;
1960 * @copydoc ActorParent::LowerChild
1962 void LowerChild(Actor& child) override;
1965 * @copydoc ActorParent::RaiseChildToTop
1967 void RaiseChildToTop(Actor& child) override;
1970 * @copydoc ActorParent::LowerChildToBottom
1972 void LowerChildToBottom(Actor& child) override;
1975 * @copydoc ActorParent::RaiseChildAbove
1977 void RaiseChildAbove(Actor& child, Actor& target) override;
1980 * @copydoc ActorParent::LowerChildBelow()
1982 void LowerChildBelow(Actor& child, Actor& target) override;
1985 * Set whether a child actor inherits it's parent's layout direction. Default is to inherit.
1986 * @param[in] inherit - true if the actor should inherit layout direction, false otherwise.
1988 void SetInheritLayoutDirection(bool inherit);
1991 * Returns whether the actor inherits it's parent's layout direction.
1992 * @return true if the actor inherits it's parent's layout direction, false otherwise.
1994 bool IsLayoutDirectionInherited() const
1996 return mInheritLayoutDirection;
2000 * @brief Sets the update size hint of an actor.
2001 * @param [in] updateSizeHint The update size hint.
2003 void SetUpdateSizeHint(const Vector2& updateSizeHint);
2006 ActorParentImpl mParentImpl; ///< Implementation of ActorParent;
2007 ActorParent* mParent; ///< Each actor (except the root) can have one parent
2008 Scene* mScene; ///< The scene the actor is added to
2009 RendererContainer* mRenderers; ///< Renderer container
2010 Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
2011 Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
2012 Relayouter* mRelayoutData; ///< Struct to hold optional collection of relayout variables
2013 ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
2016 Dali::Actor::TouchEventSignalType mInterceptTouchedSignal;
2017 Dali::Actor::TouchEventSignalType mTouchedSignal;
2018 Dali::Actor::HoverSignalType mHoveredSignal;
2019 Dali::Actor::WheelEventSignalType mWheelEventSignal;
2020 Dali::Actor::OnSceneSignalType mOnSceneSignal;
2021 Dali::Actor::OffSceneSignalType mOffSceneSignal;
2022 Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
2023 DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
2024 Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal;
2026 Quaternion mTargetOrientation; ///< Event-side storage for orientation
2027 Vector4 mTargetColor; ///< Event-side storage for color
2028 Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
2029 Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
2030 Vector3 mTargetScale; ///< Event-side storage for scale
2031 Vector3 mAnimatedSize; ///< Event-side storage for size animation
2032 Rect<int> mTouchAreaOffset; ///< touch area offset (left, right, bottom, top)
2034 ConstString mName; ///< Name of the actor
2035 uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
2036 int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported
2037 uint16_t mUseAnimatedSize; ///< Whether the size is animated.
2039 const bool mIsRoot : 1; ///< Flag to identify the root actor
2040 const bool mIsLayer : 1; ///< Flag to identify that this is a layer
2041 bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene
2042 bool mSensitive : 1; ///< Whether the actor emits touch event signals
2043 bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
2044 bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
2045 bool mKeyboardFocusableChildren : 1; ///< Whether the children of this actor can be focusable by keyboard navigation.
2046 bool mTouchFocusable : 1; ///< Whether the actor should be focusable by touch
2047 bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
2048 bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
2049 bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
2050 bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
2051 bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
2052 bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
2053 bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
2054 bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent.
2055 bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area.
2056 bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
2057 bool mNeedGesturePropagation : 1; ///< Whether the parent listens for gesture events or not
2058 LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left.
2059 DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
2060 ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
2061 ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use.
2062 DevelBlendEquation::Type mBlendEquation : 16; ///< Cached: Determines which blend equation will be used to render renderers.
2065 static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
2067 struct PropertyHandler;
2068 struct SiblingHandler;
2070 friend class ActorParentImpl; // Allow impl to call private methods on actor
2073 } // namespace Internal
2075 // Helpers for public-api forwarding methods
2077 inline Internal::Actor& GetImplementation(Dali::Actor& actor)
2079 DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
2081 BaseObject& handle = actor.GetBaseObject();
2083 return static_cast<Internal::Actor&>(handle);
2086 inline const Internal::Actor& GetImplementation(const Dali::Actor& actor)
2088 DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
2090 const BaseObject& handle = actor.GetBaseObject();
2092 return static_cast<const Internal::Actor&>(handle);
2097 #endif // DALI_INTERNAL_ACTOR_H