1 #ifndef DALI_INTERNAL_ACTOR_H
2 #define DALI_INTERNAL_ACTOR_H
5 * Copyright (c) 2018 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/devel-api/actors/actor-devel.h>
27 #include <dali/public-api/common/vector-wrapper.h>
28 #include <dali/public-api/common/dali-common.h>
29 #include <dali/public-api/events/gesture.h>
30 #include <dali/public-api/math/viewport.h>
31 #include <dali/public-api/object/ref-object.h>
32 #include <dali/public-api/size-negotiation/relayout-container.h>
33 #include <dali/internal/common/memory-pool-object-allocator.h>
34 #include <dali/internal/event/actors/actor-declarations.h>
35 #include <dali/internal/event/common/object-impl.h>
36 #include <dali/internal/event/common/stage-def.h>
37 #include <dali/internal/event/rendering/renderer-impl.h>
38 #include <dali/internal/update/nodes/node-declarations.h>
39 #include <dali/internal/update/manager/update-manager.h>
53 class ActorGestureData;
58 typedef std::vector< ActorPtr > ActorContainer;
59 typedef ActorContainer::iterator ActorIter;
60 typedef ActorContainer::const_iterator ActorConstIter;
62 typedef std::vector< RendererPtr > RendererContainer;
63 typedef RendererContainer::iterator RendererIter;
65 class ActorDepthTreeNode;
66 typedef Dali::Internal::MemoryPoolObjectAllocator< ActorDepthTreeNode > DepthNodeMemoryPool;
69 * Actor is the primary object which Dali applications interact with.
70 * UI controls can be built by combining multiple actors.
71 * Multi-Touch events are received through signals emitted by the actor tree.
73 * An Actor is a proxy for a Node in the scene graph.
74 * When an Actor is added to the Stage, it creates a node and connects it to the scene graph.
75 * The scene-graph can be updated in a separate thread, so the connection is done using an asynchronous message.
76 * When a tree of Actors is detached from the Stage, a message is sent to destroy the associated nodes.
78 class Actor : public Object
83 * @brief Struct to hold an actor and a dimension
85 struct ActorDimensionPair
90 * @param[in] newActor The actor to assign
91 * @param[in] newDimension The dimension to assign
93 ActorDimensionPair( Actor* newActor, Dimension::Type newDimension )
95 dimension( newDimension )
100 * @brief Equality operator
102 * @param[in] lhs The left hand side argument
103 * @param[in] rhs The right hand side argument
105 bool operator== ( const ActorDimensionPair& rhs )
107 return ( actor == rhs.actor ) && ( dimension == rhs.dimension );
110 Actor* actor; ///< The actor to hold
111 Dimension::Type dimension; ///< The dimension to hold
114 typedef std::vector< ActorDimensionPair > ActorDimensionStack;
119 * Create a new actor.
120 * @return A smart-pointer to the newly allocated Actor.
122 static ActorPtr New();
125 * Helper to create node for derived classes who don't have their own node type
126 * @return pointer to newly created unique node
128 static const SceneGraph::Node* CreateNode();
131 * Retrieve the name of the actor.
134 const std::string& GetName() const;
137 * Set the name of the actor.
138 * @param[in] name The new name.
140 void SetName( const std::string& name );
143 * @copydoc Dali::Actor::GetId
145 uint32_t GetId() const;
150 * Query whether an actor is the root actor, which is owned by the Stage.
151 * @return True if the actor is a root actor.
159 * Query whether the actor is connected to the Stage.
161 bool OnStage() const;
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->empty();
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 * Adds a child Actor to this Actor.
191 * @pre The child actor is not the same as the parent actor.
192 * @pre The child actor does not already have a parent.
193 * @param [in] child The child.
194 * @post The child will be referenced by its parent.
196 void Add( Actor& child );
199 * Removes a child Actor from this Actor.
200 * @param [in] child The child.
201 * @post The child will be unreferenced.
203 void Remove( Actor& child );
206 * @copydoc Dali::Actor::Unparent
211 * Retrieve the number of children held by the actor.
212 * @return The number of children
214 uint32_t GetChildCount() const;
217 * @copydoc Dali::Actor::GetChildAt
219 ActorPtr GetChildAt( uint32_t index ) const;
222 * Retrieve a reference to Actor's children.
223 * @note Not for public use.
224 * @return A reference to the container of children.
225 * @note The internal container is lazily initialized so ensure you check the child count before using the value returned by this method.
227 ActorContainer& GetChildrenInternal()
233 * @copydoc Dali::Actor::FindChildByName
235 ActorPtr FindChildByName( const std::string& actorName );
238 * @copydoc Dali::Actor::FindChildById
240 ActorPtr FindChildById( const uint32_t id );
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
252 * Sets the size of an actor.
253 * This does not interfere with the actors scale factor.
254 * @param [in] width The new width.
255 * @param [in] height The new height.
257 void SetSize( float width, float height );
260 * Sets the size of an actor.
261 * This does not interfere with the actors scale factor.
262 * @param [in] width The size of the actor along the x-axis.
263 * @param [in] height The size of the actor along the y-axis.
264 * @param [in] depth The size of the actor along the z-axis.
266 void SetSize( float width, float height, float depth );
269 * Sets the size of an actor.
270 * This does not interfere with the actors scale factor.
271 * @param [in] size The new size.
273 void SetSize( const Vector2& size );
276 * Sets the update size for an actor.
278 * @param[in] size The size to set.
280 void SetSizeInternal( const Vector2& size );
283 * Sets the size of an actor.
284 * This does not interfere with the actors scale factor.
285 * @param [in] size The new size.
287 void SetSize( const Vector3& size );
290 * Sets the update size for an actor.
292 * @param[in] size The size to set.
294 void SetSizeInternal( const Vector3& size );
297 * Set the width component of the Actor's size.
298 * @param [in] width The new width component.
300 void SetWidth( float width );
303 * Set the height component of the Actor's size.
304 * @param [in] height The new height component.
306 void SetHeight( float height );
309 * Set the depth component of the Actor's size.
310 * @param [in] depth The new depth component.
312 void SetDepth( float depth );
315 * Retrieve the Actor's size from event side.
316 * This size will be the size set or if animating then the target size.
317 * @return The Actor's size.
319 Vector3 GetTargetSize() const;
322 * Retrieve the Actor's size from update side.
323 * This size will be the size set or animating but will be a frame behind.
324 * @return The Actor's size.
326 const Vector3& GetCurrentSize() const;
329 * Return the natural size of the actor
331 * @return The actor's natural size
333 virtual Vector3 GetNaturalSize() const;
336 * Set the origin of an actor, within its parent's area.
337 * This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
338 * and (1.0, 1.0, 0.5) is the bottom-right corner.
339 * The default parent-origin is top-left (0.0, 0.0, 0.5).
340 * An actor position is the distance between this origin, and the actors anchor-point.
341 * @param [in] origin The new parent-origin.
343 void SetParentOrigin( const Vector3& origin );
346 * Set the x component of the parent-origin
347 * @param [in] x The new x value.
349 void SetParentOriginX( float x );
352 * Set the y component of the parent-origin
353 * @param [in] y The new y value.
355 void SetParentOriginY( float y );
358 * Set the z component of the parent-origin
359 * @param [in] z The new z value.
361 void SetParentOriginZ( float z );
364 * Retrieve the parent-origin of an actor.
365 * @return The parent-origin.
367 const Vector3& GetCurrentParentOrigin() const;
370 * Set the anchor-point of an actor. This is expressed in 2D unit coordinates, such that
371 * (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.
372 * The default anchor point is top-left (0.0, 0.0, 0.5).
373 * An actor position is the distance between its parent-origin, and this anchor-point.
374 * An actor's rotation is centered around its anchor-point.
375 * @param [in] anchorPoint The new anchor-point.
377 void SetAnchorPoint( const Vector3& anchorPoint );
380 * Set the x component of the anchor-point.
381 * @param [in] x The new x value.
383 void SetAnchorPointX( float x );
386 * Set the y component of the anchor-point.
387 * @param [in] y The new y value.
389 void SetAnchorPointY( float y );
392 * Set the z component of the anchor-point.
393 * @param [in] z The new z value.
395 void SetAnchorPointZ( float z );
398 * Retrieve the anchor-point of an actor.
399 * @return The anchor-point.
401 const Vector3& GetCurrentAnchorPoint() const;
404 * Sets the position of the Actor.
405 * The coordinates are relative to the Actor's parent.
406 * The Actor's z position will be set to 0.0f.
407 * @param [in] x The new x position
408 * @param [in] y The new y position
410 void SetPosition( float x, float y );
413 * Sets the position of the Actor.
414 * The coordinates are relative to the Actor's parent.
415 * @param [in] x The new x position
416 * @param [in] y The new y position
417 * @param [in] z The new z position
419 void SetPosition( float x, float y, float z );
422 * Sets the position of the Actor.
423 * The coordinates are relative to the Actor's parent.
424 * @param [in] position The new position.
426 void SetPosition( const Vector3& position );
429 * Set the position of an actor along the X-axis.
430 * @param [in] x The new x position
432 void SetX( float x );
435 * Set the position of an actor along the Y-axis.
436 * @param [in] y The new y position.
438 void SetY( float y );
441 * Set the position of an actor along the Z-axis.
442 * @param [in] z The new z position
444 void SetZ( float z );
447 * Translate an actor relative to its existing position.
448 * @param[in] distance The actor will move by this distance.
450 void TranslateBy( const Vector3& distance );
453 * Retrieve the position of the Actor.
454 * The coordinates are relative to the Actor's parent.
455 * @return the Actor's position.
457 const Vector3& GetCurrentPosition() const;
460 * Retrieve the target position of the Actor.
461 * The coordinates are relative to the Actor's parent.
462 * @return the Actor's position.
464 const Vector3& GetTargetPosition() const;
467 * @copydoc Dali::Actor::GetCurrentWorldPosition()
469 const Vector3& GetCurrentWorldPosition() const;
472 * @copydoc Dali::Actor::SetPositionInheritanceMode()
474 void SetPositionInheritanceMode( PositionInheritanceMode mode );
477 * @copydoc Dali::Actor::GetPositionInheritanceMode()
479 PositionInheritanceMode GetPositionInheritanceMode() const;
482 * @copydoc Dali::Actor::SetInheritPosition()
484 void SetInheritPosition( bool inherit );
487 * @copydoc Dali::Actor::IsPositionInherited()
489 bool IsPositionInherited() const;
492 * Sets the orientation of the Actor.
493 * @param [in] angleRadians The new orientation angle in radians.
494 * @param [in] axis The new axis of orientation.
496 void SetOrientation( const Radian& angleRadians, const Vector3& axis );
499 * Sets the orientation of the Actor.
500 * @param [in] orientation The new orientation.
502 void SetOrientation( const Quaternion& orientation );
505 * Rotate an actor around its existing rotation axis.
506 * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
507 * @param[in] axis The axis of the rotation to combine with the existing rotation.
509 void RotateBy( const Radian& angleRadians, const Vector3& axis );
512 * Apply a relative rotation to an actor.
513 * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
515 void RotateBy( const Quaternion& relativeRotation );
518 * Retreive the Actor's orientation.
519 * @return the orientation.
521 const Quaternion& GetCurrentOrientation() const;
524 * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
525 * Switching this off means that using SetOrientation() sets the actor's world orientation.
526 * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
528 void SetInheritOrientation( bool inherit );
531 * Returns whether the actor inherit's it's parent's orientation.
532 * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
534 bool IsOrientationInherited() const;
537 * Sets the factor of the parents size used for the child actor.
538 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
539 * @param[in] factor The vector to multiply the parents size by to get the childs size.
541 void SetSizeModeFactor( const Vector3& factor );
544 * Gets the factor of the parents size used for the child actor.
545 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
546 * @return The vector being used to multiply the parents size by to get the childs size.
548 const Vector3& GetSizeModeFactor() const;
551 * @copydoc Dali::Actor::GetCurrentWorldOrientation()
553 const Quaternion& GetCurrentWorldOrientation() const;
556 * Sets a scale factor applied to an actor.
557 * @param [in] scale The scale factor applied on all axes.
559 void SetScale( float scale );
562 * Sets a scale factor applied to an actor.
563 * @param [in] scaleX The scale factor applied along the x-axis.
564 * @param [in] scaleY The scale factor applied along the y-axis.
565 * @param [in] scaleZ The scale factor applied along the z-axis.
567 void SetScale( float scaleX, float scaleY, float scaleZ );
570 * Sets a scale factor applied to an actor.
571 * @param [in] scale A vector representing the scale factor for each axis.
573 void SetScale( const Vector3& scale );
576 * Set the x component of the scale factor.
577 * @param [in] x The new x value.
579 void SetScaleX( float x );
582 * Set the y component of the scale factor.
583 * @param [in] y The new y value.
585 void SetScaleY( float y );
588 * Set the z component of the scale factor.
589 * @param [in] z The new z value.
591 void SetScaleZ( float z );
594 * Apply a relative scale to an actor.
595 * @param[in] relativeScale The scale to combine with the actors existing scale.
597 void ScaleBy( const Vector3& relativeScale );
600 * Retrieve the scale factor applied to an actor.
601 * @return A vector representing the scale factor for each axis.
603 const Vector3& GetCurrentScale() const;
606 * @copydoc Dali::Actor::GetCurrentWorldScale()
608 const Vector3& GetCurrentWorldScale() const;
611 * @copydoc Dali::Actor::SetInheritScale()
613 void SetInheritScale( bool inherit );
616 * @copydoc Dali::Actor::IsScaleInherited()
618 bool IsScaleInherited() const;
621 * @copydoc Dali::Actor::GetCurrentWorldMatrix()
623 Matrix GetCurrentWorldMatrix() const;
628 * Sets the visibility flag of an actor.
629 * @param[in] visible The new visibility flag.
631 void SetVisible( bool visible );
634 * Retrieve the visibility flag of an actor.
635 * @return The visibility flag.
637 bool IsVisible() const;
640 * Sets the opacity of an actor.
641 * @param [in] opacity The new opacity.
643 void SetOpacity( float opacity );
646 * Retrieve the actor's opacity.
647 * @return The actor's opacity.
649 float GetCurrentOpacity() const;
652 * Retrieve the actor's clipping mode.
653 * @return The actor's clipping mode (cached)
655 ClippingMode::Type GetClippingMode() const;
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;
703 * @copydoc Dali::Actor::IsOverlay
705 bool IsOverlay() const;
708 * Sets the actor's color. The final color of actor depends on its color mode.
709 * This final color is applied to the drawable elements of an actor.
710 * @param [in] color The new color.
712 void SetColor( const Vector4& color );
715 * Set the red component of the color.
716 * @param [in] red The new red component.
718 void SetColorRed( float red );
721 * Set the green component of the color.
722 * @param [in] green The new green component.
724 void SetColorGreen( float green );
727 * Set the blue component of the scale factor.
728 * @param [in] blue The new blue value.
730 void SetColorBlue( float blue );
733 * Retrieve the actor's color.
736 const Vector4& GetCurrentColor() const;
739 * Sets the actor's color mode.
740 * Color mode specifies whether Actor uses its own color or inherits its parent color
741 * @param [in] colorMode to use.
743 void SetColorMode( ColorMode colorMode );
746 * Returns the actor's color mode.
747 * @return currently used colorMode.
749 ColorMode GetColorMode() const;
752 * @copydoc Dali::Actor::GetCurrentWorldColor()
754 const Vector4& GetCurrentWorldColor() const;
757 * @copydoc Dali::Actor::GetHierarchyDepth()
759 inline int32_t GetHierarchyDepth() const
770 * Get the actor's sorting depth
772 * @return The depth used for hit-testing and renderer sorting
774 uint32_t GetSortingDepth();
778 // Size negotiation virtual functions
781 * @brief Called after the size negotiation has been finished for this control.
783 * The control is expected to assign this given size to itself/its children.
785 * Should be overridden by derived classes if they need to layout
786 * actors differently after certain operations like add or remove
787 * actors, resize or after changing specific properties.
789 * Note! As this function is called from inside the size negotiation algorithm, you cannot
790 * call RequestRelayout (the call would just be ignored)
792 * @param[in] size The allocated size.
793 * @param[in,out] container The control should add actors to this container that it is not able
794 * to allocate a size for.
796 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
801 * @brief Notification for deriving classes when the resize policy is set
803 * @param[in] policy The policy being set
804 * @param[in] dimension The dimension the policy is being set for
806 virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) {}
809 * @brief Virtual method to notify deriving classes that relayout dependencies have been
810 * met and the size for this object is about to be calculated for the given dimension
812 * @param dimension The dimension that is about to be calculated
814 virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
817 * @brief Virtual method to notify deriving classes that the size for a dimension
818 * has just been negotiated
820 * @param[in] size The new size for the given dimension
821 * @param[in] dimension The dimension that was just negotiated
823 virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
826 * @brief Determine if this actor is dependent on it's children for relayout
828 * @param dimension The dimension(s) to check for
829 * @return Return if the actor is dependent on it's children
831 virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
834 * @brief Determine if this actor is dependent on it's children for relayout.
836 * Called from deriving classes
838 * @param dimension The dimension(s) to check for
839 * @return Return if the actor is dependent on it's children
841 virtual bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
844 * @brief Calculate the size for a child
846 * @param[in] child The child actor to calculate the size for
847 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
848 * @return Return the calculated size for the given dimension
850 virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
853 * @brief This method is called during size negotiation when a height is required for a given width.
855 * Derived classes should override this if they wish to customize the height returned.
857 * @param width to use.
858 * @return the height based on the width.
860 virtual float GetHeightForWidth( float width );
863 * @brief This method is called during size negotiation when a width is required for a given height.
865 * Derived classes should override this if they wish to customize the width returned.
867 * @param height to use.
868 * @return the width based on the width.
870 virtual float GetWidthForHeight( float height );
877 * @brief Called by the RelayoutController to negotiate the size of an actor.
879 * The size allocated by the the algorithm is passed in which the
880 * actor must adhere to. A container is passed in as well which
881 * the actor should populate with actors it has not / or does not
882 * need to handle in its size negotiation.
884 * @param[in] size The allocated size.
885 * @param[in,out] container The container that holds actors that are fed back into the
886 * RelayoutController algorithm.
888 void NegotiateSize( const Vector2& size, RelayoutContainer& container );
891 * @brief Set whether size negotiation should use the assigned size of the actor
892 * during relayout for the given dimension(s)
894 * @param[in] use Whether the assigned size of the actor should be used
895 * @param[in] dimension The dimension(s) to set. Can be a bitfield of multiple dimensions
897 void SetUseAssignedSize( bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
900 * @brief Returns whether size negotiation should use the assigned size of the actor
901 * during relayout for a single dimension
903 * @param[in] dimension The dimension to get
904 * @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
906 bool GetUseAssignedSize( Dimension::Type dimension ) const;
909 * @copydoc Dali::Actor::SetResizePolicy()
911 void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
914 * @copydoc Dali::Actor::GetResizePolicy()
916 ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
919 * @copydoc Dali::Actor::SetSizeScalePolicy()
921 void SetSizeScalePolicy( SizeScalePolicy::Type policy );
924 * @copydoc Dali::Actor::GetSizeScalePolicy()
926 SizeScalePolicy::Type GetSizeScalePolicy() const;
929 * @copydoc Dali::Actor::SetDimensionDependency()
931 void SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency );
934 * @copydoc Dali::Actor::GetDimensionDependency()
936 Dimension::Type GetDimensionDependency( Dimension::Type dimension ) const;
939 * @brief Set the size negotiation relayout enabled on this actor
941 * @param[in] relayoutEnabled Boolean to enable or disable relayout
943 void SetRelayoutEnabled( bool relayoutEnabled );
946 * @brief Return if relayout is enabled
948 * @return Return if relayout is enabled or not for this actor
950 bool IsRelayoutEnabled() const;
953 * @brief Mark an actor as having it's layout dirty
955 * @param dirty Whether to mark actor as dirty or not
956 * @param dimension The dimension(s) to mark as dirty
958 void SetLayoutDirty( bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
961 * @brief Return if any of an actor's dimensions are marked as dirty
963 * @param dimension The dimension(s) to check
964 * @return Return if any of the requested dimensions are dirty
966 bool IsLayoutDirty( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
969 * @brief Returns if relayout is enabled and the actor is not dirty
971 * @return Return if it is possible to relayout the actor
973 bool RelayoutPossible( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
976 * @brief Returns if relayout is enabled and the actor is dirty
978 * @return Return if it is required to relayout the actor
980 bool RelayoutRequired( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
983 * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
985 * This method is automatically called from OnStageConnection(), OnChildAdd(),
986 * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
988 * This method can also be called from a derived class every time it needs a different size.
989 * At the end of event processing, the relayout process starts and
990 * all controls which requested Relayout will have their sizes (re)negotiated.
992 * @note RelayoutRequest() can be called multiple times; the size negotiation is still
993 * only performed once, i.e. there is no need to keep track of this in the calling side.
995 void RelayoutRequest( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
998 * @brief Determine if this actor is dependent on it's parent for relayout
1000 * @param dimension The dimension(s) to check for
1001 * @return Return if the actor is dependent on it's parent
1003 bool RelayoutDependentOnParent( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1006 * @brief Determine if this actor has another dimension depedent on the specified one
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 * Negotiate sizes for a control in all dimensions
1017 * @param[in] allocatedSize The size constraint that the control must respect
1019 void NegotiateDimensions( const Vector2& allocatedSize );
1022 * Negotiate size for a specific dimension
1024 * The algorithm adopts a recursive dependency checking approach. Meaning, that wherever dependencies
1025 * are found, e.g. an actor dependent on its parent, the dependency will be calculated first with NegotiatedDimension and
1026 * LayoutDimensionNegotiated flags being filled in on the actor.
1028 * @post All actors that exist in the dependency chain connected to the given actor will have had their NegotiatedDimensions
1029 * calculated and set as well as the LayoutDimensionNegotiated flags.
1031 * @param[in] dimension The dimension to negotiate on
1032 * @param[in] allocatedSize The size constraint that the actor must respect
1034 void NegotiateDimension( Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack );
1037 * @brief Calculate the size of a dimension
1039 * @param[in] dimension The dimension to calculate the size for
1040 * @param[in] maximumSize The upper bounds on the size
1041 * @return Return the calculated size for the dimension
1043 float CalculateSize( Dimension::Type dimension, const Vector2& maximumSize );
1046 * @brief Clamp a dimension given the relayout constraints on this actor
1048 * @param[in] size The size to constrain
1049 * @param[in] dimension The dimension the size exists in
1050 * @return Return the clamped size
1052 float ClampDimension( float size, Dimension::Type dimension );
1055 * Negotiate a dimension based on the size of the parent
1057 * @param[in] dimension The dimension to negotiate on
1058 * @return Return the negotiated size
1060 float NegotiateFromParent( Dimension::Type dimension );
1063 * Negotiate a dimension based on the size of the parent. Fitting inside.
1065 * @param[in] dimension The dimension to negotiate on
1066 * @return Return the negotiated size
1068 float NegotiateFromParentFit( Dimension::Type dimension );
1071 * Negotiate a dimension based on the size of the parent. Flooding the whole space.
1073 * @param[in] dimension The dimension to negotiate on
1074 * @return Return the negotiated size
1076 float NegotiateFromParentFlood( Dimension::Type dimension );
1079 * @brief Negotiate a dimension based on the size of the children
1081 * @param[in] dimension The dimension to negotiate on
1082 * @return Return the negotiated size
1084 float NegotiateFromChildren( Dimension::Type dimension );
1087 * Set the negotiated dimension value for the given dimension(s)
1089 * @param negotiatedDimension The value to set
1090 * @param dimension The dimension(s) to set the value for
1092 void SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1095 * Return the value of negotiated dimension for the given dimension
1097 * @param dimension The dimension to retrieve
1098 * @return Return the value of the negotiated dimension
1100 float GetNegotiatedDimension( Dimension::Type dimension ) const;
1103 * @brief Set the padding for a dimension
1105 * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
1106 * @param[in] dimension The dimension to set
1108 void SetPadding( const Vector2& padding, Dimension::Type dimension );
1111 * Return the value of padding for the given dimension
1113 * @param dimension The dimension to retrieve
1114 * @return Return the value of padding for the dimension
1116 Vector2 GetPadding( Dimension::Type dimension ) const;
1119 * Return the actor size for a given dimension
1121 * @param[in] dimension The dimension to retrieve the size for
1122 * @return Return the size for the given dimension
1124 float GetSize( Dimension::Type dimension ) const;
1127 * Return the natural size of the actor for a given dimension
1129 * @param[in] dimension The dimension to retrieve the size for
1130 * @return Return the natural size for the given dimension
1132 float GetNaturalSize( Dimension::Type dimension ) const;
1135 * @brief Return the amount of size allocated for relayout
1137 * May include padding
1139 * @param[in] dimension The dimension to retrieve
1140 * @return Return the size
1142 float GetRelayoutSize( Dimension::Type dimension ) const;
1145 * @brief If the size has been negotiated return that else return normal size
1147 * @param[in] dimension The dimension to retrieve
1148 * @return Return the size
1150 float GetLatestSize( Dimension::Type dimension ) const;
1153 * Apply the negotiated size to the actor
1155 * @param[in] container The container to fill with actors that require further relayout
1157 void SetNegotiatedSize( RelayoutContainer& container );
1160 * @brief Flag the actor as having it's layout dimension negotiated.
1162 * @param[in] negotiated The status of the flag to set.
1163 * @param[in] dimension The dimension to set the flag for
1165 void SetLayoutNegotiated( bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1168 * @brief Test whether the layout dimension for this actor has been negotiated or not.
1170 * @param[in] dimension The dimension to determine the value of the flag for
1171 * @return Return if the layout dimension is negotiated or not.
1173 bool IsLayoutNegotiated( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
1176 * @brief provides the Actor implementation of GetHeightForWidth
1177 * @param width to use.
1178 * @return the height based on the width.
1180 float GetHeightForWidthBase( float width );
1183 * @brief provides the Actor implementation of GetWidthForHeight
1184 * @param height to use.
1185 * @return the width based on the height.
1187 float GetWidthForHeightBase( float height );
1190 * @brief Calculate the size for a child
1192 * @param[in] child The child actor to calculate the size for
1193 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
1194 * @return Return the calculated size for the given dimension
1196 float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
1199 * @brief Set the preferred size for size negotiation
1201 * @param[in] size The preferred size to set
1203 void SetPreferredSize( const Vector2& size );
1206 * @brief Return the preferred size used for size negotiation
1208 * @return Return the preferred size
1210 Vector2 GetPreferredSize() const;
1213 * @copydoc Dali::Actor::SetMinimumSize
1215 void SetMinimumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1218 * @copydoc Dali::Actor::GetMinimumSize
1220 float GetMinimumSize( Dimension::Type dimension ) const;
1223 * @copydoc Dali::Actor::SetMaximumSize
1225 void SetMaximumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1228 * @copydoc Dali::Actor::GetMaximumSize
1230 float GetMaximumSize( Dimension::Type dimension ) const;
1233 * @copydoc Dali::Actor::AddRenderer()
1235 uint32_t AddRenderer( Renderer& renderer );
1238 * @copydoc Dali::Actor::GetRendererCount()
1240 uint32_t GetRendererCount() const;
1243 * @copydoc Dali::Actor::GetRendererAt()
1245 RendererPtr GetRendererAt( uint32_t index );
1248 * @copydoc Dali::Actor::RemoveRenderer()
1250 void RemoveRenderer( Renderer& renderer );
1253 * @copydoc Dali::Actor::RemoveRenderer()
1255 void RemoveRenderer( uint32_t index );
1260 * Converts screen coordinates into the actor's coordinate system.
1261 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1262 * @param[out] localX On return, the X-coordinate relative to the actor.
1263 * @param[out] localY On return, the Y-coordinate relative to the actor.
1264 * @param[in] screenX The screen X-coordinate.
1265 * @param[in] screenY The screen Y-coordinate.
1266 * @return True if the conversion succeeded.
1268 bool ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const;
1271 * Converts screen coordinates into the actor's coordinate system.
1272 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1273 * @param[in] renderTask The render-task used to display the actor.
1274 * @param[out] localX On return, the X-coordinate relative to the actor.
1275 * @param[out] localY On return, the Y-coordinate relative to the actor.
1276 * @param[in] screenX The screen X-coordinate.
1277 * @param[in] screenY The screen Y-coordinate.
1278 * @return True if the conversion succeeded.
1280 bool ScreenToLocal( const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const;
1283 * Converts from the actor's coordinate system to screen coordinates.
1284 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1285 * @param[in] viewMatrix The view-matrix
1286 * @param[in] projectionMatrix The projection-matrix
1287 * @param[in] viewport The view-port
1288 * @param[out] localX On return, the X-coordinate relative to the actor.
1289 * @param[out] localY On return, the Y-coordinate relative to the actor.
1290 * @param[in] screenX The screen X-coordinate.
1291 * @param[in] screenY The screen Y-coordinate.
1292 * @return True if the conversion succeeded.
1294 bool ScreenToLocal( const Matrix& viewMatrix,
1295 const Matrix& projectionMatrix,
1296 const Viewport& viewport,
1300 float screenY ) const;
1303 * Performs a ray-sphere test with the given pick-ray and the actor's bounding sphere.
1304 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1305 * @param[in] rayOrigin The ray origin in the world's reference system.
1306 * @param[in] rayDir The ray director vector in the world's reference system.
1307 * @return True if the ray intersects the actor's bounding sphere.
1309 bool RaySphereTest( const Vector4& rayOrigin, const Vector4& rayDir ) const;
1312 * Performs a ray-actor test with the given pick-ray and the actor's geometry.
1313 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1314 * @param[in] rayOrigin The ray origin in the world's reference system.
1315 * @param[in] rayDir The ray director vector in the world's reference system.
1316 * @param[out] hitPointLocal The hit point in the Actor's local reference system.
1317 * @param[out] distance The distance from the hit point to the camera.
1318 * @return True if the ray intersects the actor's geometry.
1320 bool RayActorTest( const Vector4& rayOrigin,
1321 const Vector4& rayDir,
1322 Vector2& hitPointLocal,
1323 float& distance ) const;
1326 * Sets whether the actor should receive a notification when touch or hover motion events leave
1327 * the boundary of the actor.
1329 * @note By default, this is set to false as most actors do not require this.
1330 * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
1332 * @param[in] required Should be set to true if a Leave event is required
1334 void SetLeaveRequired( bool required );
1337 * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1338 * the boundary of the actor.
1339 * @return true if a Leave event is required, false otherwise.
1341 bool GetLeaveRequired() const;
1344 * @copydoc Dali::Actor::SetKeyboardFocusable()
1346 void SetKeyboardFocusable( bool focusable );
1349 * @copydoc Dali::Actor::IsKeyboardFocusable()
1351 bool IsKeyboardFocusable() const;
1354 * Query whether the application or derived actor type requires touch events.
1355 * @return True if touch events are required.
1357 bool GetTouchRequired() const;
1360 * Query whether the application or derived actor type requires hover events.
1361 * @return True if hover events are required.
1363 bool GetHoverRequired() const;
1366 * Query whether the application or derived actor type requires wheel events.
1367 * @return True if wheel events are required.
1369 bool GetWheelEventRequired() const;
1372 * Query whether the actor is actually hittable. This method checks whether the actor is
1373 * sensitive, has the visibility flag set to true and is not fully transparent.
1374 * @return true, if it can be hit, false otherwise.
1376 bool IsHittable() const;
1381 * Retrieve the gesture data associated with this actor. The first call to this method will
1382 * allocate space for the ActorGestureData so this should only be called if an actor really does
1384 * @return Reference to the ActorGestureData for this actor.
1385 * @note Once the gesture-data is created for an actor it is likely that gestures are required
1386 * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
1388 ActorGestureData& GetGestureData();
1391 * Queries whether the actor requires the gesture type.
1392 * @param[in] type The gesture type.
1394 bool IsGestureRequred( Gesture::Type type ) const;
1399 * Used by the EventProcessor to emit touch event signals.
1400 * @param[in] event The touch event (Old API).
1401 * @param[in] touch The touch data.
1402 * @return True if the event was consumed.
1404 bool EmitTouchEventSignal( const TouchEvent& event, const Dali::TouchData& touch );
1407 * Used by the EventProcessor to emit hover event signals.
1408 * @param[in] event The hover event.
1409 * @return True if the event was consumed.
1411 bool EmitHoverEventSignal( const HoverEvent& event );
1414 * Used by the EventProcessor to emit wheel event signals.
1415 * @param[in] event The wheel event.
1416 * @return True if the event was consumed.
1418 bool EmitWheelEventSignal( const WheelEvent& event );
1421 * @brief Emits the visibility change signal for this actor and all its children.
1422 * @param[in] visible Whether the actor has become visible or not.
1423 * @param[in] type Whether the actor's visible property has changed or a parent's.
1425 void EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityChange::Type type );
1428 * @brief Emits the layout direction change signal for this actor and all its children.
1429 * @param[in] type Whether the actor's layout direction property has changed or a parent's.
1431 void EmitLayoutDirectionChangedSignal( LayoutDirection::Type type );
1434 * @brief Emits the ChildAdded signal for this actor
1435 * @param[in] child The child actor that has been added
1437 void EmitChildAddedSignal( Actor& child );
1440 * @brief Emits the ChildRemoved signal for this actor
1441 * @param[in] child The child actor that has been removed
1443 void EmitChildRemovedSignal( Actor& child );
1446 * @copydoc Dali::Actor::TouchedSignal()
1448 Dali::Actor::TouchSignalType& TouchedSignal();
1451 * @copydoc Dali::Actor::TouchEventSignal()
1453 Dali::Actor::TouchDataSignalType& TouchSignal();
1456 * @copydoc Dali::Actor::HoveredSignal()
1458 Dali::Actor::HoverSignalType& HoveredSignal();
1461 * @copydoc Dali::Actor::WheelEventSignal()
1463 Dali::Actor::WheelEventSignalType& WheelEventSignal();
1466 * @copydoc Dali::Actor::OnStageSignal()
1468 Dali::Actor::OnStageSignalType& OnStageSignal();
1471 * @copydoc Dali::Actor::OffStageSignal()
1473 Dali::Actor::OffStageSignalType& OffStageSignal();
1476 * @copydoc Dali::Actor::OnRelayoutSignal()
1478 Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal();
1481 * @copydoc DevelActor::VisibilityChangedSignal
1483 DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal();
1486 * @copydoc LayoutDirectionChangedSignal
1488 Dali::Actor::LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal();
1491 * @copydoc DevelActor::ChildAddedSignal
1493 DevelActor::ChildChangedSignalType& ChildAddedSignal();
1496 * @copydoc DevelActor::ChildRemovedSignal
1498 DevelActor::ChildChangedSignalType& ChildRemovedSignal();
1501 * @copydoc DevelActor::ChildOrderChangedSignal
1503 DevelActor::ChildOrderChangedSignalType& ChildOrderChangedSignal();
1506 * Connects a callback function with the object's signals.
1507 * @param[in] object The object providing the signal.
1508 * @param[in] tracker Used to disconnect the signal.
1509 * @param[in] signalName The signal to connect to.
1510 * @param[in] functor A newly allocated FunctorDelegate.
1511 * @return True if the signal was connected.
1512 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
1514 static bool DoConnectSignal( BaseObject* object,
1515 ConnectionTrackerInterface* tracker,
1516 const std::string& signalName,
1517 FunctorDelegate* functor );
1520 * Performs actions as requested using the action name.
1521 * @param[in] object The object on which to perform the action.
1522 * @param[in] actionName The action to perform.
1523 * @param[in] attributes The attributes with which to perfrom this action.
1524 * @return true if the action was done.
1526 static bool DoAction( BaseObject* object,
1527 const std::string& actionName,
1528 const Property::Map& attributes );
1534 * For use in derived classes.
1535 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1537 virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize )
1545 BASIC, LAYER, ROOT_LAYER
1549 * Protected Constructor. See Actor::New().
1550 * The second-phase construction Initialize() member should be called immediately after this.
1551 * @param[in] derivedType The derived type of actor (if any).
1552 * @param[in] reference to the node
1554 Actor( DerivedType derivedType, const SceneGraph::Node& node );
1557 * Second-phase constructor. Must be called immediately after creating a new Actor;
1559 void Initialize( void );
1562 * A reference counted object may only be deleted by calling Unreference()
1567 * Called on a child during Add() when the parent actor is connected to the Stage.
1568 * @param[in] parentDepth The depth of the parent in the hierarchy.
1570 void ConnectToStage( uint32_t parentDepth );
1573 * Helper for ConnectToStage, to recursively connect a tree of actors.
1574 * This is atomic i.e. not interrupted by user callbacks.
1575 * @param[in] depth The depth in the hierarchy of the actor
1576 * @param[out] connectionList On return, the list of connected actors which require notification.
1578 void RecursiveConnectToStage( ActorContainer& connectionList, uint32_t depth );
1581 * Connect the Node associated with this Actor to the scene-graph.
1583 void ConnectToSceneGraph();
1586 * Helper for ConnectToStage, to notify a connected actor through the public API.
1588 void NotifyStageConnection();
1591 * Called on a child during Remove() when the actor was previously on the Stage.
1593 void DisconnectFromStage();
1596 * Helper for DisconnectFromStage, to recursively disconnect a tree of actors.
1597 * This is atomic i.e. not interrupted by user callbacks.
1598 * @param[out] disconnectionList On return, the list of disconnected actors which require notification.
1600 void RecursiveDisconnectFromStage( ActorContainer& disconnectionList );
1603 * Disconnect the Node associated with this Actor from the scene-graph.
1605 void DisconnectFromSceneGraph();
1608 * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1610 void NotifyStageDisconnection();
1613 * When the Actor is OnStage, checks whether the corresponding Node is connected to the scene graph.
1614 * @return True if the Actor is OnStage & has a Node connected to the scene graph.
1616 bool IsNodeConnected() const;
1620 * Trigger a rebuild of the actor depth tree from this root
1621 * If a Layer3D is encountered, then this doesn't descend any further.
1622 * The mSortedDepth of each actor is set appropriately.
1624 void RebuildDepthTree();
1629 * Traverse the actor tree, inserting actors into the depth tree in sibling order.
1630 * @param[in] sceneGraphNodeDepths A vector capturing the nodes and their depth index
1631 * @param[in,out] depthIndex The current depth index (traversal index)
1633 void DepthTraverseActorTree( OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex );
1637 // Default property extensions from Object
1640 * @copydoc Dali::Internal::Object::SetDefaultProperty()
1642 virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue );
1645 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1647 virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
1650 * @copydoc Dali::Internal::Object::GetDefaultProperty()
1652 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
1655 * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
1657 virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
1660 * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
1662 virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType );
1665 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1667 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
1670 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1672 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
1675 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1677 virtual int32_t GetPropertyComponentIndex( Property::Index index ) const;
1680 * Retrieve the actor's node.
1681 * @return The node used by this actor
1683 const SceneGraph::Node& GetNode() const
1685 return *static_cast<const SceneGraph::Node*>( mUpdateObject );
1689 * @copydoc Dali::DevelActor::Raise()
1694 * @copydoc Dali::DevelActor::Lower()
1699 * @copydoc Dali::DevelActor::RaiseToTop()
1704 * @copydoc Dali::DevelActor::LowerToBottom()
1706 void LowerToBottom();
1709 * @copydoc Dali::DevelActor::RaiseAbove()
1711 void RaiseAbove( Internal::Actor& target );
1714 * @copydoc Dali::DevelActor::LowerBelow()
1716 void LowerBelow( Internal::Actor& target );
1729 // Remove default constructor and copy constructor
1731 Actor( const Actor& ) = delete;
1732 Actor& operator=( const Actor& rhs ) = delete;
1735 * Set the actors parent.
1736 * @param[in] parent The new parent.
1738 void SetParent( Actor* parent );
1741 * For use in derived classes, called after Initialize()
1743 virtual void OnInitialize()
1748 * For use in internal derived classes.
1749 * This is called during ConnectToStage(), after the actor has finished adding its node to the scene-graph.
1750 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1752 virtual void OnStageConnectionInternal()
1757 * For use in internal derived classes.
1758 * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1759 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1761 virtual void OnStageDisconnectionInternal()
1766 * For use in external (CustomActor) derived classes.
1767 * This is called after the atomic ConnectToStage() traversal has been completed.
1769 virtual void OnStageConnectionExternal( int depth )
1774 * For use in external (CustomActor) derived classes.
1775 * This is called after the atomic DisconnectFromStage() traversal has been completed.
1777 virtual void OnStageDisconnectionExternal()
1782 * For use in derived classes; this is called after Add() has added a child.
1783 * @param[in] child The child that was added.
1785 virtual void OnChildAdd( Actor& child )
1790 * For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ).
1791 * @param[in] child The child that was removed.
1793 virtual void OnChildRemove( Actor& child )
1798 * For use in derived classes.
1799 * This is called after SizeSet() has been called.
1801 virtual void OnSizeSet( const Vector3& targetSize )
1806 * For use in derived classes.
1807 * This is only called if mDerivedRequiresTouch is true, and the touch-signal was not consumed.
1808 * @param[in] event The touch event.
1809 * @return True if the event should be consumed.
1811 virtual bool OnTouchEvent( const TouchEvent& event )
1817 * For use in derived classes.
1818 * This is only called if mDerivedRequiresHover is true, and the hover-signal was not consumed.
1819 * @param[in] event The hover event.
1820 * @return True if the event should be consumed.
1822 virtual bool OnHoverEvent( const HoverEvent& event )
1828 * For use in derived classes.
1829 * This is only called if the wheel signal was not consumed.
1830 * @param[in] event The wheel event.
1831 * @return True if the event should be consumed.
1833 virtual bool OnWheelEvent( const WheelEvent& event )
1839 * @brief Retrieves the cached event side value of a default property.
1840 * @param[in] index The index of the property
1841 * @param[out] value Is set with the cached value of the property if found.
1842 * @return True if value set, false otherwise.
1844 bool GetCachedPropertyValue( Property::Index index, Property::Value& value ) const;
1847 * @brief Retrieves the current value of a default property from the scene-graph.
1848 * @param[in] index The index of the property
1849 * @param[out] value Is set with the current scene-graph value of the property
1850 * @return True if value set, false otherwise.
1852 bool GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const;
1855 * @brief Ensure the relayout data is allocated
1857 void EnsureRelayoutData();
1860 * @brief Apply the size set policy to the input size
1862 * @param[in] size The size to apply the policy to
1863 * @return Return the adjusted size
1865 Vector2 ApplySizeSetPolicy( const Vector2& size );
1868 * Retrieve the parent object of an Actor.
1869 * @return The parent object, or NULL if the Actor does not have a parent.
1871 virtual Object* GetParentObject() const;
1875 * @param[in] order The sibling order this Actor should be. It will place
1876 * the actor at this index in it's parent's child array.
1878 void SetSiblingOrder( uint32_t order);
1882 * @return the order of this actor amongst it's siblings
1884 uint32_t GetSiblingOrder() const;
1887 * Request that the stage rebuilds the actor depth indices.
1889 void RequestRebuildDepthTree();
1892 * @brief Get the current position of the actor in screen coordinates.
1894 * @return Returns the screen position of actor
1896 const Vector2 GetCurrentScreenPosition() const;
1899 * Sets the visibility flag of an actor.
1900 * @param[in] visible The new visibility flag.
1901 * @param[in] sendMessage Whether to send a message to the update thread or not.
1903 void SetVisibleInternal( bool visible, SendMessage::Type sendMessage );
1906 * Set whether a child actor inherits it's parent's layout direction. Default is to inherit.
1907 * @param[in] inherit - true if the actor should inherit layout direction, false otherwise.
1909 void SetInheritLayoutDirection( bool inherit );
1912 * Returns whether the actor inherits it's parent's layout direction.
1913 * @return true if the actor inherits it's parent's layout direction, false otherwise.
1915 bool IsLayoutDirectionInherited() const;
1918 * @brief Propagates layout direction recursively.
1919 * @param[in] actor The actor for seting layout direction.
1920 * @param[in] direction New layout direction.
1922 void InheritLayoutDirectionRecursively( ActorPtr actor, Dali::LayoutDirection::Type direction, bool set = false );
1926 Actor* mParent; ///< Each actor (except the root) can have one parent
1927 ActorContainer* mChildren; ///< Container of referenced actors, lazily initialized
1928 RendererContainer* mRenderers; ///< Renderer container
1930 Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
1931 Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
1933 struct RelayoutData;
1934 RelayoutData* mRelayoutData; ///< Struct to hold optional collection of relayout variables
1936 ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
1939 Dali::Actor::TouchSignalType mTouchedSignal;
1940 Dali::Actor::TouchDataSignalType mTouchSignal;
1941 Dali::Actor::HoverSignalType mHoveredSignal;
1942 Dali::Actor::WheelEventSignalType mWheelEventSignal;
1943 Dali::Actor::OnStageSignalType mOnStageSignal;
1944 Dali::Actor::OffStageSignalType mOffStageSignal;
1945 Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
1946 DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
1947 Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal;
1948 DevelActor::ChildChangedSignalType mChildAddedSignal;
1949 DevelActor::ChildChangedSignalType mChildRemovedSignal;
1950 DevelActor::ChildOrderChangedSignalType mChildOrderChangedSignal;
1952 Quaternion mTargetOrientation; ///< Event-side storage for orientation
1953 Vector4 mTargetColor; ///< Event-side storage for color
1954 Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
1955 Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
1956 Vector3 mTargetScale; ///< Event-side storage for scale
1958 std::string mName; ///< Name of the actor
1959 uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
1960 int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported
1962 const bool mIsRoot : 1; ///< Flag to identify the root actor
1963 const bool mIsLayer : 1; ///< Flag to identify that this is a layer
1964 bool mIsOnStage : 1; ///< Flag to identify whether the actor is on-stage
1965 bool mSensitive : 1; ///< Whether the actor emits touch event signals
1966 bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
1967 bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
1968 bool mDerivedRequiresTouch : 1; ///< Whether the derived actor type requires touch event signals
1969 bool mDerivedRequiresHover : 1; ///< Whether the derived actor type requires hover event signals
1970 bool mDerivedRequiresWheelEvent : 1; ///< Whether the derived actor type requires wheel event signals
1971 bool mOnStageSignalled : 1; ///< Set to true before OnStageConnection signal is emitted, and false before OnStageDisconnection
1972 bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
1973 bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
1974 bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
1975 bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
1976 bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
1977 bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
1978 bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent.
1979 LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left.
1980 DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
1981 PositionInheritanceMode mPositionInheritanceMode : 3; ///< Cached: Determines how position is inherited
1982 ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
1983 ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use.
1987 static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
1991 } // namespace Internal
1993 // Helpers for public-api forwarding methods
1995 inline Internal::Actor& GetImplementation( Dali::Actor& actor )
1997 DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
1999 BaseObject& handle = actor.GetBaseObject();
2001 return static_cast< Internal::Actor& >( handle );
2004 inline const Internal::Actor& GetImplementation( const Dali::Actor& actor )
2006 DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
2008 const BaseObject& handle = actor.GetBaseObject();
2010 return static_cast< const Internal::Actor& >( handle );
2015 #endif // DALI_INTERNAL_ACTOR_H