1 #ifndef DALI_INTERNAL_ACTOR_H
2 #define DALI_INTERNAL_ACTOR_H
5 * Copyright (c) 2023 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/public-api/actors/actor.h>
26 #include <dali/public-api/common/dali-common.h>
27 #include <dali/public-api/common/vector-wrapper.h>
28 #include <dali/public-api/events/gesture.h>
29 #include <dali/public-api/math/viewport.h>
30 #include <dali/public-api/object/ref-object.h>
31 #include <dali/public-api/size-negotiation/relayout-container.h>
33 #include <dali/devel-api/actors/actor-devel.h>
34 #include <dali/devel-api/rendering/renderer-devel.h>
36 #include <dali/integration-api/events/touch-event-integ.h>
38 #include <dali/internal/common/const-string.h>
39 #include <dali/internal/common/internal-constants.h>
40 #include <dali/internal/common/memory-pool-object-allocator.h>
41 #include <dali/internal/event/actors/actor-declarations.h>
42 #include <dali/internal/event/actors/actor-parent-impl.h>
43 #include <dali/internal/event/actors/actor-parent.h>
44 #include <dali/internal/event/actors/actor-renderer-container.h>
45 #include <dali/internal/event/actors/actor-sizer.h>
46 #include <dali/internal/event/common/object-impl.h>
47 #include <dali/internal/event/common/stage-def.h>
48 #include <dali/internal/update/nodes/node-declarations.h>
60 class ActorGestureData;
67 * Actor is the primary object with which Dali applications interact.
68 * UI controls can be built by combining multiple actors.
69 * Multi-Touch events are received through signals emitted by the actor tree.
71 * An Actor is a proxy for a Node in the scene graph.
72 * When an Actor is added to the Stage, it creates a node and connects it to the scene graph.
73 * The scene-graph can be updated in a separate thread, so the connection is done using an asynchronous message.
74 * When a tree of Actors is detached from the Stage, a message is sent to destroy the associated nodes.
76 class Actor : public Object, public ActorParent
81 * @return A smart-pointer to the newly allocated Actor.
83 static ActorPtr New();
86 * Helper to create node for derived classes who don't have their own node type
87 * @return pointer to newly created unique node
89 static const SceneGraph::Node* CreateNode();
92 * Retrieve the name of the actor.
95 std::string_view GetName() const
97 return mName.GetStringView();
101 * Set the name of the actor.
102 * @param[in] name The new name.
104 void SetName(std::string_view name);
107 * @copydoc Dali::Actor::GetId
109 uint32_t GetId() const;
114 * Query whether an actor is the root actor, which is owned by the Stage.
115 * @return True if the actor is a root actor.
123 * Query whether the actor is connected to the Scene.
131 * Query whether the actor has any renderers.
132 * @return True if the actor is renderable.
134 bool IsRenderable() const
136 // inlined as this is called a lot in hit testing
137 return mRenderers && !mRenderers->IsEmpty();
141 * Query whether the actor is of class Dali::Layer
142 * @return True if the actor is a layer.
146 // inlined as this is called a lot in hit testing
151 * Gets the layer in which the actor is present
152 * @return The layer, which will be uninitialized if the actor is off-stage.
154 Dali::Layer GetLayer();
157 * @copydoc Dali::Internal::ActorParent::Add()
159 void Add(Actor& child, bool notify = true) override;
162 * @copydoc Dali::Internal::ActorParent::Remove()
164 void Remove(Actor& child, bool notify = true) override;
167 * @copydoc Dali::DevelActor::SwitchParent()
169 void SwitchParent(Actor& newParent);
172 * @copydoc Dali::Actor::Unparent
177 * @copydoc Dali::Internal::ActorParent::GetChildCount()
179 uint32_t GetChildCount() const override;
182 * @copydoc Dali::Internal::ActorParent::GetChildAt
184 ActorPtr GetChildAt(uint32_t index) const override;
187 * Retrieve a reference to Actor's children.
188 * @note Not for public use.
189 * @return A reference to the container of children.
190 * @note The internal container is lazily initialized so ensure you check the child count before using the value returned by this method.
192 ActorContainer& GetChildrenInternal();
195 * @copydoc Dali::Internal::ActorParent::FindChildByName
197 ActorPtr FindChildByName(ConstString actorName) override;
200 * @copydoc Dali::Internal::ActorParent::FindChildById
202 ActorPtr FindChildById(const uint32_t id) override;
205 * @copydoc Dali::Internal::ActorParent::UnparentChildren
207 void UnparentChildren() override;
210 * Retrieve the parent of an Actor.
211 * @return The parent actor, or NULL if the Actor does not have a parent.
213 Actor* GetParent() const
215 return static_cast<Actor*>(mParent);
219 * @brief Calculate the current position of the actor in screen coordinates using event-side properties.
221 * @return Returns the screen position of actor
223 const Vector2 CalculateScreenPosition() const;
226 * Calculates screen position and size using event-side properties.
228 * @return pair of two values, position of top-left corner on screen and size respectively.
230 Rect<> CalculateScreenExtents() const;
233 * Calculates screen position and size from current values.
235 * @return pair of two values, position of top-left corner on screen and size respectively.
237 Rect<> CalculateCurrentScreenExtents() const;
240 * @copydoc DevelActor::SetNeedGesturePropagation.
242 void SetNeedGesturePropagation(bool propagation)
244 mNeedGesturePropagation = propagation;
248 * Retrieve need gesture propagation value
249 * @return The actor's need gesture propagation value.
251 bool NeedGesturePropagation() const
253 return mNeedGesturePropagation;
257 * Sets the size of an actor.
258 * This does not interfere with the actors scale factor.
259 * @param [in] width The new width.
260 * @param [in] height The new height.
262 void SetSize(float width, float height);
265 * Sets the size of an actor.
266 * This does not interfere with the actors scale factor.
267 * @param [in] width The size of the actor along the x-axis.
268 * @param [in] height The size of the actor along the y-axis.
269 * @param [in] depth The size of the actor along the z-axis.
271 void SetSize(float width, float height, float depth);
274 * Sets the size of an actor.
275 * This does not interfere with the actors scale factor.
276 * @param [in] size The new size.
278 void SetSize(const Vector2& size);
281 * Sets the size of an actor.
282 * This does not interfere with the actors scale factor.
283 * @param [in] size The new size.
285 void SetSize(const Vector3& size);
288 * Set the width component of the Actor's size.
289 * @param [in] width The new width component.
291 void SetWidth(float width);
294 * Set the height component of the Actor's size.
295 * @param [in] height The new height component.
297 void SetHeight(float height);
300 * Set the depth component of the Actor's size.
301 * @param [in] depth The new depth component.
303 void SetDepth(float depth);
306 * Retrieve the Actor's size from event side.
307 * This size will be the size set or if animating then the target size.
308 * @return The Actor's size.
310 Vector3 GetTargetSize() const;
313 * Retrieve the Actor's size from update side.
314 * This size will be the size set or animating but will be a frame behind.
315 * @return The Actor's size.
317 const Vector3& GetCurrentSize() const;
320 * Return the natural size of the actor
322 * @return The actor's natural size
324 virtual Vector3 GetNaturalSize() const;
327 * Set the origin of an actor, within its parent's area.
328 * This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
329 * and (1.0, 1.0, 0.5) is the bottom-right corner.
330 * The default parent-origin is top-left (0.0, 0.0, 0.5).
331 * An actor position is the distance between this origin, and the actors anchor-point.
332 * @param [in] origin The new parent-origin.
334 void SetParentOrigin(const Vector3& origin);
337 * Retrieve the parent-origin of an actor.
338 * @return The parent-origin.
340 const Vector3& GetCurrentParentOrigin() const;
343 * Set the anchor-point of an actor. This is expressed in 2D unit coordinates, such that
344 * (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.
345 * The default anchor point is top-left (0.0, 0.0, 0.5).
346 * An actor position is the distance between its parent-origin, and this anchor-point.
347 * An actor's rotation is centered around its anchor-point.
348 * @param [in] anchorPoint The new anchor-point.
350 void SetAnchorPoint(const Vector3& anchorPoint);
353 * Retrieve the anchor-point of an actor.
354 * @return The anchor-point.
356 const Vector3& GetCurrentAnchorPoint() const;
359 * If the position uses the anchor point, return the anchor point, otherwise
361 * @return The anchor point for positioning.
363 Vector3 GetAnchorPointForPosition() const;
366 * Sets the position of the Actor.
367 * The coordinates are relative to the Actor's parent.
368 * The Actor's z position will be set to 0.0f.
369 * @param [in] x The new x position
370 * @param [in] y The new y position
372 void SetPosition(float x, float y);
375 * Sets the position of the Actor.
376 * The coordinates are relative to the Actor's parent.
377 * @param [in] x The new x position
378 * @param [in] y The new y position
379 * @param [in] z The new z position
381 void SetPosition(float x, float y, float z);
384 * Sets the position of the Actor.
385 * The coordinates are relative to the Actor's parent.
386 * @param [in] position The new position.
388 void SetPosition(const Vector3& position);
391 * Set the position of an actor along the X-axis.
392 * @param [in] x The new x position
397 * Set the position of an actor along the Y-axis.
398 * @param [in] y The new y position.
403 * Set the position of an actor along the Z-axis.
404 * @param [in] z The new z position
409 * Translate an actor relative to its existing position.
410 * @param[in] distance The actor will move by this distance.
412 void TranslateBy(const Vector3& distance);
415 * Retrieve the position of the Actor.
416 * The coordinates are relative to the Actor's parent.
417 * @return the Actor's position.
419 const Vector3& GetCurrentPosition() const;
422 * Retrieve the target position of the Actor.
423 * The coordinates are relative to the Actor's parent.
424 * @return the Actor's position.
426 const Vector3& GetTargetPosition() const
428 return mTargetPosition;
432 * @copydoc Dali::Actor::GetCurrentWorldPosition()
434 const Vector3& GetCurrentWorldPosition() const;
437 * @copydoc Dali::Actor::SetInheritPosition()
439 void SetInheritPosition(bool inherit);
442 * @copydoc Dali::Actor::IsPositionInherited()
444 bool IsPositionInherited() const
446 return mInheritPosition;
450 * Sets the orientation of the Actor.
451 * @param [in] angleRadians The new orientation angle in radians.
452 * @param [in] axis The new axis of orientation.
454 void SetOrientation(const Radian& angleRadians, const Vector3& axis);
457 * Sets the orientation of the Actor.
458 * @param [in] orientation The new orientation.
460 void SetOrientation(const Quaternion& orientation);
463 * Rotate an actor around its existing rotation axis.
464 * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
465 * @param[in] axis The axis of the rotation to combine with the existing rotation.
467 void RotateBy(const Radian& angleRadians, const Vector3& axis);
470 * Apply a relative rotation to an actor.
471 * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
473 void RotateBy(const Quaternion& relativeRotation);
476 * Retreive the Actor's orientation.
477 * @return the orientation.
479 const Quaternion& GetCurrentOrientation() const;
482 * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
483 * Switching this off means that using SetOrientation() sets the actor's world orientation.
484 * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
486 void SetInheritOrientation(bool inherit);
489 * Returns whether the actor inherit's it's parent's orientation.
490 * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
492 bool IsOrientationInherited() const
494 return mInheritOrientation;
498 * Sets the factor of the parents size used for the child actor.
499 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
500 * @param[in] factor The vector to multiply the parents size by to get the childs size.
502 void SetSizeModeFactor(const Vector3& factor);
505 * Gets the factor of the parents size used for the child actor.
506 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
507 * @return The vector being used to multiply the parents size by to get the childs size.
509 const Vector3& GetSizeModeFactor() const;
512 * @copydoc Dali::Actor::GetCurrentWorldOrientation()
514 const Quaternion& GetCurrentWorldOrientation() const;
517 * Sets a scale factor applied to an actor.
518 * @param [in] scale The scale factor applied on all axes.
520 void SetScale(float scale);
523 * Sets a scale factor applied to an actor.
524 * @param [in] scaleX The scale factor applied along the x-axis.
525 * @param [in] scaleY The scale factor applied along the y-axis.
526 * @param [in] scaleZ The scale factor applied along the z-axis.
528 void SetScale(float scaleX, float scaleY, float scaleZ);
531 * Sets a scale factor applied to an actor.
532 * @param [in] scale A vector representing the scale factor for each axis.
534 void SetScale(const Vector3& scale);
537 * Set the x component of the scale factor.
538 * @param [in] x The new x value.
540 void SetScaleX(float x);
543 * Set the y component of the scale factor.
544 * @param [in] y The new y value.
546 void SetScaleY(float y);
549 * Set the z component of the scale factor.
550 * @param [in] z The new z value.
552 void SetScaleZ(float z);
555 * Apply a relative scale to an actor.
556 * @param[in] relativeScale The scale to combine with the actors existing scale.
558 void ScaleBy(const Vector3& relativeScale);
561 * Retrieve the scale factor applied to an actor.
562 * @return A vector representing the scale factor for each axis.
564 const Vector3& GetCurrentScale() const;
567 * @copydoc Dali::Actor::GetCurrentWorldScale()
569 const Vector3& GetCurrentWorldScale() const;
572 * @copydoc Dali::Actor::SetInheritScale()
574 void SetInheritScale(bool inherit);
577 * @copydoc Dali::Actor::IsScaleInherited()
579 bool IsScaleInherited() const
581 return mInheritScale;
585 * @copydoc Dali::Actor::GetCurrentWorldMatrix()
587 Matrix GetCurrentWorldMatrix() const;
592 * Sets the visibility flag of an actor.
593 * @param[in] visible The new visibility flag.
595 void SetVisible(bool visible);
598 * Retrieve the visibility flag of an actor.
599 * @return The visibility flag.
601 bool IsVisible() const;
604 * Sets the opacity of an actor.
605 * @param [in] opacity The new opacity.
607 void SetOpacity(float opacity);
610 * Retrieve the actor's opacity.
611 * @return The actor's opacity.
613 float GetCurrentOpacity() const;
616 * Retrieve the actor's clipping mode.
617 * @return The actor's clipping mode (cached)
619 ClippingMode::Type GetClippingMode() const
621 return mClippingMode;
625 * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
626 * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
627 * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
628 * hover event signal will be emitted.
630 * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
632 * actor.SetSensitive(false);
635 * Then, to re-enable the touch or hover event signal emission, the application should call:
637 * actor.SetSensitive(true);
640 * @see SignalTouch() and SignalHover().
641 * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
642 * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
644 void SetSensitive(bool sensitive)
646 mSensitive = sensitive;
650 * Query whether an actor emits touch or hover event signals.
651 * @see SetSensitive(bool)
652 * @return true, if emission of touch or hover event signals is enabled, false otherwise.
654 bool IsSensitive() const
660 * Sets whether an actor should be enabled all user interaction including touch, focus and activation.
661 * This value have higher priority over the sensitve and focusable in negative action,
662 * which means IsSensitive() or IsFocusable() and enable is false, actor will not emits touch or focus event.
663 * An actor is enabled by default.
665 * If the application wishes to temporarily disable user interaction:
667 * actor.SetUserInteractionEnabled(false);
670 * Then, to re-enable user interaction, the application should call:
672 * actor.SetUserInteractionEnabled(true);
675 * @see IsSensitive(), IsHittable(), IsKeyboardFocusable() and IsTouchFocusable().
676 * @note If an actor's disabled, child still can be enabled.
677 * @param[in] enabled true to enable user interaction, false otherwise.
679 void SetUserInteractionEnabled(bool enabled)
681 mUserInteractionEnabled = enabled;
685 * Query whether an actor is enabled user interaction.
686 * @see SetSensitive(bool)
687 * @return true, if user interaction is enabled, false otherwise.
689 bool IsUserInteractionEnabled() const
691 return mUserInteractionEnabled;
695 * @copydoc Dali::Actor::SetDrawMode
697 void SetDrawMode(DrawMode::Type drawMode);
700 * @copydoc Dali::Actor::GetDrawMode
702 DrawMode::Type GetDrawMode() const
708 * @copydoc Dali::Actor::IsOverlay
710 bool IsOverlay() const
712 return (DrawMode::OVERLAY_2D == mDrawMode);
716 * Sets the actor's color. The final color of actor depends on its color mode.
717 * This final color is applied to the drawable elements of an actor.
718 * @param [in] color The new color.
720 void SetColor(const Vector4& color);
723 * Set the red component of the color.
724 * @param [in] red The new red component.
726 void SetColorRed(float red);
729 * Set the green component of the color.
730 * @param [in] green The new green component.
732 void SetColorGreen(float green);
735 * Set the blue component of the scale factor.
736 * @param [in] blue The new blue value.
738 void SetColorBlue(float blue);
741 * Retrieve the actor's color.
744 const Vector4& GetCurrentColor() const;
747 * Sets the actor's color mode.
748 * Color mode specifies whether Actor uses its own color or inherits its parent color
749 * @param [in] colorMode to use.
751 void SetColorMode(ColorMode colorMode);
754 * Returns the actor's color mode.
755 * @return currently used colorMode.
757 ColorMode GetColorMode() const
763 * @copydoc Dali::Actor::GetCurrentWorldColor()
765 const Vector4& GetCurrentWorldColor() const;
768 * @copydoc Dali::Actor::GetHierarchyDepth()
770 inline int32_t GetHierarchyDepth() const
781 * @brief Get the number of layer with 3D behaviour in ancestors include this. It will be 0 if actor is not on scene.
783 * @return currently the number of layer with 3D behaviour in ancestors.
785 inline int32_t GetLayer3DParentCount() const
789 return mLayer3DParentsCount;
796 * Get the actor's sorting depth
798 * @return The depth used for hit-testing and renderer sorting
800 inline uint32_t GetSortingDepth()
806 * Set the actor's sorted depth. Used during recreation of depth tree
807 * @param[in] sortedDepth the new sorted depth
809 inline void SetSortingDepth(uint32_t sortedDepth)
811 mSortedDepth = sortedDepth;
815 // Size negotiation virtual functions
818 * @brief Called after the size negotiation has been finished for this control.
820 * The control is expected to assign this given size to itself/its children.
822 * Should be overridden by derived classes if they need to layout
823 * actors differently after certain operations like add or remove
824 * actors, resize or after changing specific properties.
826 * Note! As this function is called from inside the size negotiation algorithm, you cannot
827 * call RequestRelayout (the call would just be ignored)
829 * @param[in] size The allocated size.
830 * @param[in,out] container The control should add actors to this container that it is not able
831 * to allocate a size for.
833 virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
838 * @brief Notification for deriving classes when the resize policy is set
840 * @param[in] policy The policy being set
841 * @param[in] dimension The dimension the policy is being set for
843 virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
848 * @brief Virtual method to notify deriving classes that relayout dependencies have been
849 * met and the size for this object is about to be calculated for the given dimension
851 * @param dimension The dimension that is about to be calculated
853 virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
858 * @brief Virtual method to notify deriving classes that the size for a dimension
859 * has just been negotiated
861 * @param[in] size The new size for the given dimension
862 * @param[in] dimension The dimension that was just negotiated
864 virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
869 * @brief Determine if this actor is dependent on it's children for relayout
871 * @param dimension The dimension(s) to check for
872 * @return Return if the actor is dependent on it's children
874 virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
877 * @brief Calculate the size for a child
879 * @param[in] child The child actor to calculate the size for
880 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
881 * @return Return the calculated size for the given dimension
883 virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension);
886 * @brief This method is called during size negotiation when a height is required for a given width.
888 * Derived classes should override this if they wish to customize the height returned.
890 * @param width to use.
891 * @return the height based on the width.
893 virtual float GetHeightForWidth(float width);
896 * @brief This method is called during size negotiation when a width is required for a given height.
898 * Derived classes should override this if they wish to customize the width returned.
900 * @param height to use.
901 * @return the width based on the width.
903 virtual float GetWidthForHeight(float height);
909 * @brief Called by the RelayoutController to negotiate the size of an actor.
911 * The size allocated by the the algorithm is passed in which the
912 * actor must adhere to. A container is passed in as well which
913 * the actor should populate with actors it has not / or does not
914 * need to handle in its size negotiation.
916 * @param[in] size The allocated size.
917 * @param[in,out] container The container that holds actors that are fed back into the
918 * RelayoutController algorithm.
920 void NegotiateSize(const Vector2& size, RelayoutContainer& container);
923 * @copydoc Dali::Actor::SetResizePolicy()
925 void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
928 * @copydoc Dali::Actor::GetResizePolicy()
930 ResizePolicy::Type GetResizePolicy(Dimension::Type dimension) const;
933 * @brief Set the size negotiation relayout enabled on this actor
935 * @param[in] relayoutEnabled Boolean to enable or disable relayout
937 void SetRelayoutEnabled(bool relayoutEnabled);
940 * @brief Return if relayout is enabled
942 * @return Return if relayout is enabled or not for this actor
944 bool IsRelayoutEnabled() const;
947 * @brief Mark an actor as having it's layout dirty
948 * @note Only called from RelayoutController
950 * @param dirty Whether to mark actor as dirty or not
951 * @param dimension The dimension(s) to mark as dirty
953 void SetLayoutDirty(bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
956 * @brief Return if any of an actor's dimensions are marked as dirty
957 * @note Only called from RelayoutController
959 * @param dimension The dimension(s) to check
960 * @return Return if any of the requested dimensions are dirty
962 bool IsLayoutDirty(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
965 * @brief Returns if relayout is enabled and the actor is not dirty
966 * @note Only called from RelayoutController
968 * @return Return if it is possible to relayout the actor
970 bool RelayoutPossible(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
973 * @brief Returns if relayout is enabled and the actor is dirty
974 * @note Only called from RelayoutController
976 * @return Return if it is required to relayout the actor
978 bool RelayoutRequired(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
981 * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
983 * This method is automatically called from OnSceneConnection(), OnChildAdd(),
984 * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
986 * This method can also be called from a derived class every time it needs a different size.
987 * At the end of event processing, the relayout process starts and
988 * all controls which requested Relayout will have their sizes (re)negotiated.
990 * @note RelayoutRequest() can be called multiple times; the size negotiation is still
991 * only performed once, i.e. there is no need to keep track of this in the calling side.
993 void RelayoutRequest(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
996 * @brief Determine if this actor is dependent on it's parent for relayout
997 * @note Only called from RelayoutController
999 * @param dimension The dimension(s) to check for
1000 * @return Return if the actor is dependent on it's parent
1002 bool RelayoutDependentOnParent(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1005 * @brief Determine if this actor has another dimension depedent on the specified one
1006 * @note Only called from RelayoutController
1008 * @param dimension The dimension to check for
1009 * @param dependentDimension The dimension to check for dependency with
1010 * @return Return if the actor is dependent on this dimension
1012 bool RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension);
1015 * @brief Set the padding for a dimension
1017 * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
1018 * @param[in] dimension The dimension to set
1020 void SetPadding(const Vector2& padding, Dimension::Type dimension);
1023 * Return the value of padding for the given dimension
1025 * @param dimension The dimension to retrieve
1026 * @return Return the value of padding for the dimension
1028 Vector2 GetPadding(Dimension::Type dimension) const;
1031 * @brief Return the amount of size allocated for relayout
1033 * May include padding
1035 * @param[in] dimension The dimension to retrieve
1036 * @return Return the size
1038 float GetRelayoutSize(Dimension::Type dimension) const;
1041 * @brief Flag the actor as having it's layout dimension negotiated.
1043 * @param[in] negotiated The status of the flag to set.
1044 * @param[in] dimension The dimension to set the flag for
1046 void SetLayoutNegotiated(bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1049 * @brief Test whether the layout dimension for this actor has been negotiated or not.
1051 * @param[in] dimension The dimension to determine the value of the flag for
1052 * @return Return if the layout dimension is negotiated or not.
1054 bool IsLayoutNegotiated(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
1057 * @brief provides the Actor implementation of GetHeightForWidth
1058 * @param width to use.
1059 * @return the height based on the width.
1061 float GetHeightForWidthBase(float width);
1064 * @brief provides the Actor implementation of GetWidthForHeight
1065 * @param height to use.
1066 * @return the width based on the height.
1068 float GetWidthForHeightBase(float height);
1071 * @brief provides the Actor implementation of CalculateChildSize
1073 * @param[in] child The child actor to calculate the size for
1074 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
1075 * @return Return the calculated size for the given dimension
1077 float CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension);
1080 * @brief Determine if this actor is dependent on it's children for relayout.
1082 * @param dimension The dimension(s) to check for
1083 * @return Return if the actor is dependent on it's children
1085 bool RelayoutDependentOnChildrenBase(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1088 * @copydoc Dali::Actor::SetMinimumSize
1090 void SetMinimumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1093 * @copydoc Dali::Actor::GetMinimumSize
1095 float GetMinimumSize(Dimension::Type dimension) const;
1098 * @copydoc Dali::Actor::SetMaximumSize
1100 void SetMaximumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
1103 * @copydoc Dali::Actor::GetMaximumSize
1105 float GetMaximumSize(Dimension::Type dimension) const;
1108 * @copydoc Dali::Actor::AddRenderer()
1110 uint32_t AddRenderer(Renderer& renderer);
1113 * @copydoc Dali::Actor::GetRendererCount()
1115 uint32_t GetRendererCount() const;
1118 * @copydoc Dali::Actor::GetRendererAt()
1120 RendererPtr GetRendererAt(uint32_t index);
1123 * @copydoc Dali::Actor::RemoveRenderer()
1125 void RemoveRenderer(Renderer& renderer);
1128 * @copydoc Dali::Actor::RemoveRenderer()
1130 void RemoveRenderer(uint32_t index);
1133 * @brief Set BlendEquation at each renderer that added on this Actor.
1135 void SetBlendEquation(DevelBlendEquation::Type blendEquation);
1138 * @brief Get Blend Equation that applied to this Actor
1140 DevelBlendEquation::Type GetBlendEquation() const;
1143 * @brief Set this Actor is transparent or not without any affection on the child Actors.
1145 void SetTransparent(bool transparent);
1148 * @brief Get this Actor is transparent or not.
1150 bool IsTransparent() const;
1154 * Converts screen coordinates into the actor's coordinate system.
1155 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1156 * @param[out] localX On return, the X-coordinate relative to the actor.
1157 * @param[out] localY On return, the Y-coordinate relative to the actor.
1158 * @param[in] screenX The screen X-coordinate.
1159 * @param[in] screenY The screen Y-coordinate.
1160 * @return True if the conversion succeeded.
1162 bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const;
1165 * Converts screen coordinates into the actor's coordinate system.
1166 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1167 * @param[in] renderTask The render-task used to display the actor.
1168 * @param[out] localX On return, the X-coordinate relative to the actor.
1169 * @param[out] localY On return, the Y-coordinate relative to the actor.
1170 * @param[in] screenX The screen X-coordinate.
1171 * @param[in] screenY The screen Y-coordinate.
1172 * @return True if the conversion succeeded.
1174 bool ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const;
1177 * Converts from the actor's coordinate system to screen coordinates.
1178 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1179 * @param[in] viewMatrix The view-matrix
1180 * @param[in] projectionMatrix The projection-matrix
1181 * @param[in] viewport The view-port
1182 * @param[out] localX On return, the X-coordinate relative to the actor.
1183 * @param[out] localY On return, the Y-coordinate relative to the actor.
1184 * @param[in] screenX The screen X-coordinate.
1185 * @param[in] screenY The screen Y-coordinate.
1186 * @return True if the conversion succeeded.
1188 bool ScreenToLocal(const Matrix& viewMatrix,
1189 const Matrix& projectionMatrix,
1190 const Viewport& viewport,
1194 float screenY) const;
1197 * Sets whether the actor should receive a notification when touch or hover motion events leave
1198 * the boundary of the actor.
1200 * @note By default, this is set to false as most actors do not require this.
1201 * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
1203 * @param[in] required Should be set to true if a Leave event is required
1205 void SetLeaveRequired(bool required)
1207 mLeaveRequired = required;
1211 * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1212 * the boundary of the actor.
1213 * @return true if a Leave event is required, false otherwise.
1215 bool GetLeaveRequired() const
1217 return mLeaveRequired;
1221 * @copydoc Dali::Actor::SetKeyboardFocusable()
1223 void SetKeyboardFocusable(bool focusable)
1225 mKeyboardFocusable = focusable;
1229 * @copydoc Dali::Actor::IsKeyboardFocusable()
1231 bool IsKeyboardFocusable() const
1233 return mKeyboardFocusable;
1237 * @copydoc Dali::Actor::SetKeyboardFocusableChildren()
1239 void SetKeyboardFocusableChildren(bool focusable)
1241 mKeyboardFocusableChildren = focusable;
1245 * @copydoc Dali::Actor::AreChildrenKeyBoardFocusable()
1247 bool AreChildrenKeyBoardFocusable() const
1249 return mKeyboardFocusableChildren;
1253 * @copydoc Dali::DevelActor::IsHittable()
1255 bool IsHittable() const
1257 return (IsUserInteractionEnabled()) && IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
1261 * @copydoc Dali::DevelActor::GetTouchRequired()
1263 bool GetTouchRequired() const
1265 return !mTouchedSignal.Empty();
1269 * Set whether this view can focus by touch.
1270 * @param[in] focusable focuable by touch.
1272 void SetTouchFocusable(bool focusable)
1274 mTouchFocusable = focusable;
1278 * This returns whether this actor can focus by touch.
1279 * @return true if this actor can focus by touch.
1281 bool IsTouchFocusable() const
1283 return mTouchFocusable;
1287 * Query whether the application or derived actor type requires hit-test result events.
1288 * @return True if hit-test result events are required.
1290 bool IsHitTestResultRequired() const
1292 return !mHitTestResultSignal.Empty();
1296 * Query whether the application or derived actor type requires intercept touch events.
1297 * @return True if intercept touch events are required.
1299 bool GetInterceptTouchRequired() const
1301 return !mInterceptTouchedSignal.Empty();
1305 * Query whether the application or derived actor type requires hover events.
1306 * @return True if hover events are required.
1308 bool GetHoverRequired() const
1310 return !mHoveredSignal.Empty();
1314 * Query whether the application or derived actor type requires intercept wheel events.
1315 * @return True if intercept wheel events are required.
1317 bool GetInterceptWheelRequired() const
1319 return !mInterceptWheelSignal.Empty();
1323 * Query whether the application or derived actor type requires wheel events.
1324 * @return True if wheel events are required.
1326 bool GetWheelEventRequired() const
1328 return !mWheelEventSignal.Empty();
1332 * Query whether the actor captures all touch after it starts even if touch leaves its boundary.
1333 * @return true, if it captures all touch after start
1335 bool CapturesAllTouchAfterStart() const
1337 return mCaptureAllTouchAfterStart;
1341 * Sets the touch area offset of an actor.
1342 * @param [in] offset The new offset of area (left, right, bottom, top).
1344 void SetTouchAreaOffset(Rect<int> offset)
1346 mTouchAreaOffset = offset;
1350 * Retrieve the Actor's touch area offset.
1351 * @return The Actor's touch area offset.
1353 const Rect<int>& GetTouchAreaOffset() const
1355 return mTouchAreaOffset;
1359 * Query whether the actor will only receive own touch.
1360 * @return true, if it only receives touches that started from itself.
1362 bool IsAllowedOnlyOwnTouch() const
1364 return mAllowOnlyOwnTouch;
1368 * Query whether the actor send touch motion event.
1369 * @return true, it send touch motion event.
1371 bool IsDispatchTouchMotion() const
1373 return mDispatchTouchMotion;
1377 * Query whether the actor send hover motion event.
1378 * @return true, it send hover motion event.
1380 bool IsDispatchHoverMotion() const
1382 return mDispatchHoverMotion;
1388 * Retrieve the gesture data associated with this actor. The first call to this method will
1389 * allocate space for the ActorGestureData so this should only be called if an actor really does
1391 * @return Reference to the ActorGestureData for this actor.
1392 * @note Once the gesture-data is created for an actor it is likely that gestures are required
1393 * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
1395 ActorGestureData& GetGestureData();
1398 * Queries whether the actor requires the gesture type.
1399 * @param[in] type The gesture type.
1400 * @return True if the gesture is required, false otherwise.
1402 bool IsGestureRequired(GestureType::Value type) const;
1407 * Used by the EventProcessor to emit intercept touch event signals.
1408 * @param[in] touch The touch data.
1409 * @return True if the event was intercepted.
1411 bool EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch);
1414 * Used by the EventProcessor to emit touch event signals.
1415 * @param[in] touch The touch data.
1416 * @return True if the event was consumed.
1418 bool EmitTouchEventSignal(const Dali::TouchEvent& touch);
1421 * Used by the EventProcessor to emit hover event signals.
1422 * @param[in] event The hover event.
1423 * @return True if the event was consumed.
1425 bool EmitHoverEventSignal(const Dali::HoverEvent& event);
1428 * Used by the EventProcessor to emit intercept wheel event signals.
1429 * @param[in] event The wheel event.
1430 * @return True if the event was intercepted.
1432 bool EmitInterceptWheelEventSignal(const Dali::WheelEvent& event);
1435 * Used by the EventProcessor to emit wheel event signals.
1436 * @param[in] event The wheel event.
1437 * @return True if the event was consumed.
1439 bool EmitWheelEventSignal(const Dali::WheelEvent& event);
1442 * @brief Emits the visibility change signal for this actor and all its children.
1443 * @param[in] visible Whether the actor has become visible or not.
1444 * @param[in] type Whether the actor's visible property has changed or a parent's.
1446 void EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type);
1449 * @brief Emits the layout direction change signal for this actor and all its children.
1450 * @param[in] type Whether the actor's layout direction property has changed or a parent's.
1452 void EmitLayoutDirectionChangedSignal(LayoutDirection::Type type);
1455 * Used by the EventProcessor to emit hit-test result touch event signals.
1456 * @param[in] point The point of event touched.
1457 * @param[in] hitPointLocal The hit point in the Actor's local reference system.
1458 * @param[in] timeStamp The time the event occurred.
1459 * @return True if the event was consumed.
1461 bool EmitHitTestResultSignal(Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp);
1464 * @copydoc DevelActor::HitTestResultSignal()
1466 Dali::Actor::TouchEventSignalType& HitTestResultSignal()
1468 return mHitTestResultSignal;
1472 * @copydoc DevelActor::InterceptTouchedSignal()
1474 Dali::Actor::TouchEventSignalType& InterceptTouchedSignal()
1476 return mInterceptTouchedSignal;
1480 * @copydoc Dali::Actor::TouchedSignal()
1482 Dali::Actor::TouchEventSignalType& TouchedSignal()
1484 return mTouchedSignal;
1488 * @copydoc Dali::Actor::HoveredSignal()
1490 Dali::Actor::HoverSignalType& HoveredSignal()
1492 return mHoveredSignal;
1496 * @copydoc DevelActor::InterceptWheelSignal()
1498 Dali::Actor::WheelEventSignalType& InterceptWheelSignal()
1500 return mInterceptWheelSignal;
1504 * @copydoc Dali::Actor::WheelEventSignal()
1506 Dali::Actor::WheelEventSignalType& WheelEventSignal()
1508 return mWheelEventSignal;
1512 * @copydoc Dali::Actor::OnSceneSignal()
1514 Dali::Actor::OnSceneSignalType& OnSceneSignal()
1516 return mOnSceneSignal;
1520 * @copydoc Dali::Actor::OffSceneSignal()
1522 Dali::Actor::OffSceneSignalType& OffSceneSignal()
1524 return mOffSceneSignal;
1528 * @copydoc Dali::Actor::OnRelayoutSignal()
1530 Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal()
1532 return mOnRelayoutSignal;
1536 * @copydoc DevelActor::VisibilityChangedSignal
1538 DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal()
1540 return mVisibilityChangedSignal;
1544 * @copydoc LayoutDirectionChangedSignal
1546 Dali::Actor::LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal()
1548 return mLayoutDirectionChangedSignal;
1552 * @copydoc DevelActor::ChildAddedSignal
1554 DevelActor::ChildChangedSignalType& ChildAddedSignal();
1557 * @copydoc DevelActor::ChildRemovedSignal
1559 DevelActor::ChildChangedSignalType& ChildRemovedSignal();
1562 * @copydoc DevelActor::ChildOrderChangedSignal
1564 DevelActor::ChildOrderChangedSignalType& ChildOrderChangedSignal();
1570 * For use in derived classes.
1571 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1573 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
1586 * Protected Constructor. See Actor::New().
1587 * The second-phase construction Initialize() member should be called immediately after this.
1588 * @param[in] derivedType The derived type of actor (if any).
1589 * @param[in] reference to the node
1591 Actor(DerivedType derivedType, const SceneGraph::Node& node);
1594 * Second-phase constructor. Must be called immediately after creating a new Actor;
1596 void Initialize(void);
1599 * A reference counted object may only be deleted by calling Unreference()
1604 * Called on a child during Add() when the parent actor is connected to the Scene.
1605 * @param[in] parentDepth The depth of the parent in the hierarchy.
1606 * @param[in] layer3DParentsCount The number of 3d layers in the hierarchy.
1607 * @param[in] notify Emits notification if set to true.
1609 void ConnectToScene(uint32_t parentDepth, uint32_t layer3DParentsCount, bool notify);
1612 * Connect the Node associated with this Actor to the scene-graph.
1614 void ConnectToSceneGraph();
1617 * Helper for ConnectToScene, to notify a connected actor through the public API.
1618 * @param[in] notify Emits notification if set to true.
1620 void NotifyStageConnection(bool notify);
1623 * Called on a child during Remove() when the actor was previously on the Stage.
1624 * @param[in] notify Emits notification if set to true.
1626 void DisconnectFromStage(bool notify);
1629 * Disconnect the Node associated with this Actor from the scene-graph.
1631 void DisconnectFromSceneGraph();
1634 * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1635 * @param[in] notify Emits notification if set to true.
1637 void NotifyStageDisconnection(bool notify);
1640 * When the Actor is OnScene, checks whether the corresponding Node is connected to the scene graph.
1641 * @return True if the Actor is OnScene & has a Node connected to the scene graph.
1643 bool IsNodeConnected() const;
1647 * Trigger a rebuild of the actor depth tree from this root
1648 * If a Layer3D is encountered, then this doesn't descend any further.
1649 * The mSortedDepth of each actor is set appropriately.
1651 void RebuildDepthTree();
1654 // Default property extensions from Object
1657 * @copydoc Dali::Internal::Object::SetDefaultProperty()
1659 void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override;
1662 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1664 void SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value) override;
1667 * @copydoc Dali::Internal::Object::GetDefaultProperty()
1669 Property::Value GetDefaultProperty(Property::Index index) const override;
1672 * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
1674 Property::Value GetDefaultPropertyCurrentValue(Property::Index index) const override;
1677 * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
1679 void OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) override;
1682 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1684 const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty(Property::Index index) const override;
1687 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1689 const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override;
1692 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1694 int32_t GetPropertyComponentIndex(Property::Index index) const override;
1697 * @copydoc Dali::Internal::Object::IsAnimationPossible()
1699 bool IsAnimationPossible() const override
1705 * Retrieve the actor's node.
1706 * @return The node used by this actor
1708 const SceneGraph::Node& GetNode() const;
1711 * @copydoc Dali::DevelActor::Raise()
1716 * @copydoc Dali::DevelActor::Lower()
1721 * @copydoc Dali::DevelActor::RaiseToTop()
1726 * @copydoc Dali::DevelActor::LowerToBottom()
1728 void LowerToBottom();
1731 * @copydoc Dali::DevelActor::RaiseAbove()
1733 void RaiseAbove(Internal::Actor& target);
1736 * @copydoc Dali::DevelActor::LowerBelow()
1738 void LowerBelow(Internal::Actor& target);
1742 * Sets the scene which this actor is added to.
1743 * @param[in] scene The scene
1745 void SetScene(Scene& scene)
1751 * Gets the scene which this actor is added to.
1754 Scene& GetScene() const
1759 LayoutDirection::Type GetLayoutDirection() const
1761 return mLayoutDirection;
1774 // Remove default constructor and copy constructor
1776 Actor(const Actor&) = delete;
1777 Actor& operator=(const Actor& rhs) = delete;
1780 * Set the actor's parent.
1781 * @param[in] parent The new parent.
1782 * @param[in] notify Emits notification if set to true. Default is true.
1784 void SetParent(ActorParent* parent, bool notify = true);
1787 * For use in derived classes, called after Initialize()
1789 virtual void OnInitialize()
1794 * For use in internal derived classes.
1795 * This is called during ConnectToScene(), after the actor has finished adding its node to the scene-graph.
1796 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1798 virtual void OnSceneConnectionInternal()
1803 * For use in internal derived classes.
1804 * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1805 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1807 virtual void OnSceneDisconnectionInternal()
1812 * For use in external (CustomActor) derived classes.
1813 * This is called after the atomic ConnectToScene() traversal has been completed.
1815 virtual void OnSceneConnectionExternal(int depth)
1820 * For use in external (CustomActor) derived classes.
1821 * This is called after the atomic DisconnectFromStage() traversal has been completed.
1823 virtual void OnSceneDisconnectionExternal()
1828 * For use in derived classes; this is called after Add() has added a child.
1829 * @param[in] child The child that was added.
1831 virtual void OnChildAdd(Actor& child)
1836 * For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ).
1837 * @param[in] child The child that was removed.
1839 virtual void OnChildRemove(Actor& child)
1844 * For use in derived classes.
1845 * This is called after SizeSet() has been called.
1847 virtual void OnSizeSet(const Vector3& targetSize)
1852 * @brief Retrieves the cached event side value of a default property.
1853 * @param[in] index The index of the property
1854 * @param[out] value Is set with the cached value of the property if found.
1855 * @return True if value set, false otherwise.
1857 bool GetCachedPropertyValue(Property::Index index, Property::Value& value) const;
1860 * @brief Retrieves the current value of a default property from the scene-graph.
1861 * @param[in] index The index of the property
1862 * @param[out] value Is set with the current scene-graph value of the property
1863 * @return True if value set, false otherwise.
1865 bool GetCurrentPropertyValue(Property::Index index, Property::Value& value) const;
1868 * Retrieve the parent object of an Actor.
1869 * @return The parent object, or NULL if the Actor does not have a parent.
1871 Object* GetParentObject() const override
1873 return static_cast<Actor*>(mParent);
1877 * @brief Get the current position of the actor in screen coordinates.
1879 * @return Returns the screen position of actor
1881 const Vector2 GetCurrentScreenPosition() const;
1884 * Sets the visibility flag of an actor.
1885 * @param[in] visible The new visibility flag.
1886 * @param[in] sendMessage Whether to send a message to the update thread or not.
1888 void SetVisibleInternal(bool visible, SendMessage::Type sendMessage);
1891 * @copydoc ActorParent::SetSiblingOrderOfChild
1893 void SetSiblingOrderOfChild(Actor& child, uint32_t order) override;
1896 * @copydoc ActorParent::GetSiblingOrderOfChild
1898 uint32_t GetSiblingOrderOfChild(const Actor& child) const override;
1901 * @copydoc ActorParent::RaiseChild
1903 void RaiseChild(Actor& child) override;
1906 * @copydoc ActorParent::LowerChild
1908 void LowerChild(Actor& child) override;
1911 * @copydoc ActorParent::RaiseChildToTop
1913 void RaiseChildToTop(Actor& child) override;
1916 * @copydoc ActorParent::LowerChildToBottom
1918 void LowerChildToBottom(Actor& child) override;
1921 * @copydoc ActorParent::RaiseChildAbove
1923 void RaiseChildAbove(Actor& child, Actor& target) override;
1926 * @copydoc ActorParent::LowerChildBelow()
1928 void LowerChildBelow(Actor& child, Actor& target) override;
1931 * Set whether a child actor inherits it's parent's layout direction. Default is to inherit.
1932 * @param[in] inherit - true if the actor should inherit layout direction, false otherwise.
1934 void SetInheritLayoutDirection(bool inherit);
1937 * Returns whether the actor inherits it's parent's layout direction.
1938 * @return true if the actor inherits it's parent's layout direction, false otherwise.
1940 bool IsLayoutDirectionInherited() const
1942 return mInheritLayoutDirection;
1946 * @brief Sets the update area hint of an actor.
1947 * @param [in] updateAreaHint The update area hint.
1949 void SetUpdateAreaHint(const Vector4& updateAreaHint);
1952 ActorParentImpl mParentImpl; ///< Implementation of ActorParent;
1953 ActorSizer mSizer; ///< Implementation for managing actor size
1954 ActorParent* mParent; ///< Each actor (except the root) can have one parent
1955 Scene* mScene; ///< The scene the actor is added to
1956 RendererContainer* mRenderers; ///< Renderer container
1957 Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
1958 Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
1959 ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
1962 Dali::Actor::TouchEventSignalType mInterceptTouchedSignal;
1963 Dali::Actor::TouchEventSignalType mTouchedSignal;
1964 Dali::Actor::HoverSignalType mHoveredSignal;
1965 Dali::Actor::WheelEventSignalType mInterceptWheelSignal;
1966 Dali::Actor::WheelEventSignalType mWheelEventSignal;
1967 Dali::Actor::OnSceneSignalType mOnSceneSignal;
1968 Dali::Actor::OffSceneSignalType mOffSceneSignal;
1969 Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
1970 DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
1971 Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal;
1972 Dali::Actor::TouchEventSignalType mHitTestResultSignal;
1974 Quaternion mTargetOrientation; ///< Event-side storage for orientation
1975 Vector4 mTargetColor; ///< Event-side storage for color
1976 Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
1977 Vector3 mTargetScale; ///< Event-side storage for scale
1978 Rect<int> mTouchAreaOffset; ///< touch area offset (left, right, bottom, top)
1980 ConstString mName; ///< Name of the actor
1981 uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
1982 int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported
1984 int16_t mLayer3DParentsCount; ///< The number of layer with 3D behaviour in ancestors include this. It will be 0 if actor is not on scene.
1986 const bool mIsRoot : 1; ///< Flag to identify the root actor
1987 const bool mIsLayer : 1; ///< Flag to identify that this is a layer
1988 bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene
1989 bool mSensitive : 1; ///< Whether the actor emits touch event signals
1990 bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
1991 bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
1992 bool mKeyboardFocusableChildren : 1; ///< Whether the children of this actor can be focusable by keyboard navigation.
1993 bool mTouchFocusable : 1; ///< Whether the actor should be focusable by touch
1994 bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
1995 bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
1996 bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
1997 bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
1998 bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
1999 bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
2000 bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent.
2001 bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area.
2002 bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
2003 bool mNeedGesturePropagation : 1; ///< Whether the parent listens for gesture events or not
2004 bool mUserInteractionEnabled : 1; ///< Whether the actor should be enabled user interaction.
2005 bool mAllowOnlyOwnTouch : 1; ///< Whether the actor will only receive own touch. it only receives touches that started from itself.
2006 bool mUseTextureUpdateArea : 1; ///< Whether the actor uses the update area of the texture instead of its own.
2007 bool mDispatchTouchMotion : 1; ///< Whether to send touch motion events or not.
2008 bool mDispatchHoverMotion : 1; ///< Whether to send hover motion events or not.
2009 LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left.
2010 DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
2011 ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
2012 ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use.
2013 DevelBlendEquation::Type mBlendEquation : 16; ///< Cached: Determines which blend equation will be used to render renderers.
2016 static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
2018 struct PropertyHandler;
2019 struct SiblingHandler;
2021 friend class ActorParentImpl; // Allow impl to call private methods on actor
2022 friend class ActorSizer; // Allow sizer to call private methods on actor
2025 } // namespace Internal
2027 // Helpers for public-api forwarding methods
2029 inline Internal::Actor& GetImplementation(Dali::Actor& actor)
2031 DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
2033 BaseObject& handle = actor.GetBaseObject();
2035 return static_cast<Internal::Actor&>(handle);
2038 inline const Internal::Actor& GetImplementation(const Dali::Actor& actor)
2040 DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
2042 const BaseObject& handle = actor.GetBaseObject();
2044 return static_cast<const Internal::Actor&>(handle);
2049 #endif // DALI_INTERNAL_ACTOR_H