1 #ifndef DALI_INTERNAL_ACTOR_H
2 #define DALI_INTERNAL_ACTOR_H
5 * Copyright (c) 2017 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 * Retrieve the name of the actor.
128 const std::string& GetName() const;
131 * Set the name of the actor.
132 * @param[in] name The new name.
134 void SetName( const std::string& name );
137 * @copydoc Dali::Actor::GetId
139 unsigned int GetId() const;
144 * Query whether an actor is the root actor, which is owned by the Stage.
145 * @return True if the actor is a root actor.
153 * Query whether the actor is connected to the Stage.
155 bool OnStage() const;
158 * Query whether the actor has any renderers.
159 * @return True if the actor is renderable.
161 bool IsRenderable() const
163 // inlined as this is called a lot in hit testing
164 return mRenderers && !mRenderers->empty();
168 * Query whether the actor is of class Dali::Layer
169 * @return True if the actor is a layer.
173 // inlined as this is called a lot in hit testing
178 * Gets the layer in which the actor is present
179 * @return The layer, which will be uninitialized if the actor is off-stage.
181 Dali::Layer GetLayer();
184 * Adds a child Actor to this Actor.
185 * @pre The child actor is not the same as the parent actor.
186 * @pre The child actor does not already have a parent.
187 * @param [in] child The child.
188 * @post The child will be referenced by its parent.
190 void Add( Actor& child );
193 * Removes a child Actor from this Actor.
194 * @param [in] child The child.
195 * @post The child will be unreferenced.
197 void Remove( Actor& child );
200 * @copydoc Dali::Actor::Unparent
205 * Retrieve the number of children held by the actor.
206 * @return The number of children
208 unsigned int GetChildCount() const;
211 * @copydoc Dali::Actor::GetChildAt
213 ActorPtr GetChildAt( unsigned int index ) const;
216 * Retrieve a reference to Actor's children.
217 * @note Not for public use.
218 * @return A reference to the container of children.
219 * @note The internal container is lazily initialized so ensure you check the child count before using the value returned by this method.
221 ActorContainer& GetChildrenInternal()
227 * @copydoc Dali::Actor::FindChildByName
229 ActorPtr FindChildByName( const std::string& actorName );
232 * @copydoc Dali::Actor::FindChildById
234 ActorPtr FindChildById( const unsigned int id );
237 * Retrieve the parent of an Actor.
238 * @return The parent actor, or NULL if the Actor does not have a parent.
240 Actor* GetParent() const
246 * Sets the size of an actor.
247 * This does not interfere with the actors scale factor.
248 * @param [in] width The new width.
249 * @param [in] height The new height.
251 void SetSize( float width, float height );
254 * Sets the size of an actor.
255 * This does not interfere with the actors scale factor.
256 * @param [in] width The size of the actor along the x-axis.
257 * @param [in] height The size of the actor along the y-axis.
258 * @param [in] depth The size of the actor along the z-axis.
260 void SetSize( float width, float height, float depth );
263 * Sets the size of an actor.
264 * This does not interfere with the actors scale factor.
265 * @param [in] size The new size.
267 void SetSize( const Vector2& size );
270 * Sets the update size for an actor.
272 * @param[in] size The size to set.
274 void SetSizeInternal( const Vector2& size );
277 * Sets the size of an actor.
278 * This does not interfere with the actors scale factor.
279 * @param [in] size The new size.
281 void SetSize( const Vector3& size );
284 * Sets the update size for an actor.
286 * @param[in] size The size to set.
288 void SetSizeInternal( const Vector3& size );
291 * Set the width component of the Actor's size.
292 * @param [in] width The new width component.
294 void SetWidth( float width );
297 * Set the height component of the Actor's size.
298 * @param [in] height The new height component.
300 void SetHeight( float height );
303 * Set the depth component of the Actor's size.
304 * @param [in] depth The new depth component.
306 void SetDepth( float depth );
309 * Retrieve the Actor's size from event side.
310 * This size will be the size set or if animating then the target size.
311 * @return The Actor's size.
313 Vector3 GetTargetSize() const;
316 * Retrieve the Actor's size from update side.
317 * This size will be the size set or animating but will be a frame behind.
318 * @return The Actor's size.
320 const Vector3& GetCurrentSize() const;
323 * Return the natural size of the actor
325 * @return The actor's natural size
327 virtual Vector3 GetNaturalSize() const;
330 * Set the origin of an actor, within its parent's area.
331 * This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
332 * and (1.0, 1.0, 0.5) is the bottom-right corner.
333 * The default parent-origin is top-left (0.0, 0.0, 0.5).
334 * An actor position is the distance between this origin, and the actors anchor-point.
335 * @param [in] origin The new parent-origin.
337 void SetParentOrigin( const Vector3& origin );
340 * Set the x component of the parent-origin
341 * @param [in] x The new x value.
343 void SetParentOriginX( float x );
346 * Set the y component of the parent-origin
347 * @param [in] y The new y value.
349 void SetParentOriginY( float y );
352 * Set the z component of the parent-origin
353 * @param [in] z The new z value.
355 void SetParentOriginZ( float z );
358 * Retrieve the parent-origin of an actor.
359 * @return The parent-origin.
361 const Vector3& GetCurrentParentOrigin() const;
364 * Set the anchor-point of an actor. This is expressed in 2D unit coordinates, such that
365 * (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.
366 * The default anchor point is top-left (0.0, 0.0, 0.5).
367 * An actor position is the distance between its parent-origin, and this anchor-point.
368 * An actor's rotation is centered around its anchor-point.
369 * @param [in] anchorPoint The new anchor-point.
371 void SetAnchorPoint( const Vector3& anchorPoint );
374 * Set the x component of the anchor-point.
375 * @param [in] x The new x value.
377 void SetAnchorPointX( float x );
380 * Set the y component of the anchor-point.
381 * @param [in] y The new y value.
383 void SetAnchorPointY( float y );
386 * Set the z component of the anchor-point.
387 * @param [in] z The new z value.
389 void SetAnchorPointZ( float z );
392 * Retrieve the anchor-point of an actor.
393 * @return The anchor-point.
395 const Vector3& GetCurrentAnchorPoint() const;
398 * Sets the position of the Actor.
399 * The coordinates are relative to the Actor's parent.
400 * The Actor's z position will be set to 0.0f.
401 * @param [in] x The new x position
402 * @param [in] y The new y position
404 void SetPosition( float x, float y );
407 * Sets the position of the Actor.
408 * The coordinates are relative to the Actor's parent.
409 * @param [in] x The new x position
410 * @param [in] y The new y position
411 * @param [in] z The new z position
413 void SetPosition( float x, float y, float z );
416 * Sets the position of the Actor.
417 * The coordinates are relative to the Actor's parent.
418 * @param [in] position The new position.
420 void SetPosition( const Vector3& position );
423 * Set the position of an actor along the X-axis.
424 * @param [in] x The new x position
426 void SetX( float x );
429 * Set the position of an actor along the Y-axis.
430 * @param [in] y The new y position.
432 void SetY( float y );
435 * Set the position of an actor along the Z-axis.
436 * @param [in] z The new z position
438 void SetZ( float z );
441 * Translate an actor relative to its existing position.
442 * @param[in] distance The actor will move by this distance.
444 void TranslateBy( const Vector3& distance );
447 * Retrieve the position of the Actor.
448 * The coordinates are relative to the Actor's parent.
449 * @return the Actor's position.
451 const Vector3& GetCurrentPosition() const;
454 * Retrieve the target position of the Actor.
455 * The coordinates are relative to the Actor's parent.
456 * @return the Actor's position.
458 const Vector3& GetTargetPosition() const;
461 * @copydoc Dali::Actor::GetCurrentWorldPosition()
463 const Vector3& GetCurrentWorldPosition() const;
466 * @copydoc Dali::Actor::SetPositionInheritanceMode()
468 void SetPositionInheritanceMode( PositionInheritanceMode mode );
471 * @copydoc Dali::Actor::GetPositionInheritanceMode()
473 PositionInheritanceMode GetPositionInheritanceMode() const;
476 * @copydoc Dali::Actor::SetInheritPosition()
478 void SetInheritPosition( bool inherit );
481 * @copydoc Dali::Actor::IsPositionInherited()
483 bool IsPositionInherited() const;
486 * Sets the orientation of the Actor.
487 * @param [in] angleRadians The new orientation angle in radians.
488 * @param [in] axis The new axis of orientation.
490 void SetOrientation( const Radian& angleRadians, const Vector3& axis );
493 * Sets the orientation of the Actor.
494 * @param [in] orientation The new orientation.
496 void SetOrientation( const Quaternion& orientation );
499 * Rotate an actor around its existing rotation axis.
500 * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
501 * @param[in] axis The axis of the rotation to combine with the existing rotation.
503 void RotateBy( const Radian& angleRadians, const Vector3& axis );
506 * Apply a relative rotation to an actor.
507 * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
509 void RotateBy( const Quaternion& relativeRotation );
512 * Retreive the Actor's orientation.
513 * @return the orientation.
515 const Quaternion& GetCurrentOrientation() const;
518 * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
519 * Switching this off means that using SetOrientation() sets the actor's world orientation.
520 * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
522 void SetInheritOrientation( bool inherit );
525 * Returns whether the actor inherit's it's parent's orientation.
526 * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
528 bool IsOrientationInherited() const;
531 * Sets the factor of the parents size used for the child actor.
532 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
533 * @param[in] factor The vector to multiply the parents size by to get the childs size.
535 void SetSizeModeFactor( const Vector3& factor );
538 * Gets the factor of the parents size used for the child actor.
539 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
540 * @return The vector being used to multiply the parents size by to get the childs size.
542 const Vector3& GetSizeModeFactor() const;
545 * @copydoc Dali::Actor::GetCurrentWorldOrientation()
547 const Quaternion& GetCurrentWorldOrientation() const;
550 * Sets a scale factor applied to an actor.
551 * @param [in] scale The scale factor applied on all axes.
553 void SetScale( float scale );
556 * Sets a scale factor applied to an actor.
557 * @param [in] scaleX The scale factor applied along the x-axis.
558 * @param [in] scaleY The scale factor applied along the y-axis.
559 * @param [in] scaleZ The scale factor applied along the z-axis.
561 void SetScale( float scaleX, float scaleY, float scaleZ );
564 * Sets a scale factor applied to an actor.
565 * @param [in] scale A vector representing the scale factor for each axis.
567 void SetScale( const Vector3& scale );
570 * Set the x component of the scale factor.
571 * @param [in] x The new x value.
573 void SetScaleX( float x );
576 * Set the y component of the scale factor.
577 * @param [in] y The new y value.
579 void SetScaleY( float y );
582 * Set the z component of the scale factor.
583 * @param [in] z The new z value.
585 void SetScaleZ( float z );
588 * Apply a relative scale to an actor.
589 * @param[in] relativeScale The scale to combine with the actors existing scale.
591 void ScaleBy( const Vector3& relativeScale );
594 * Retrieve the scale factor applied to an actor.
595 * @return A vector representing the scale factor for each axis.
597 const Vector3& GetCurrentScale() const;
600 * @copydoc Dali::Actor::GetCurrentWorldScale()
602 const Vector3& GetCurrentWorldScale() const;
605 * @copydoc Dali::Actor::SetInheritScale()
607 void SetInheritScale( bool inherit );
610 * @copydoc Dali::Actor::IsScaleInherited()
612 bool IsScaleInherited() const;
615 * @copydoc Dali::Actor::GetCurrentWorldMatrix()
617 Matrix GetCurrentWorldMatrix() const;
622 * Sets the visibility flag of an actor.
623 * @param[in] visible The new visibility flag.
625 void SetVisible( bool visible );
628 * Retrieve the visibility flag of an actor.
629 * @return The visibility flag.
631 bool IsVisible() const;
634 * Sets the opacity of an actor.
635 * @param [in] opacity The new opacity.
637 void SetOpacity( float opacity );
640 * Retrieve the actor's opacity.
641 * @return The actor's opacity.
643 float GetCurrentOpacity() const;
646 * Retrieve the actor's clipping mode.
647 * @return The actor's clipping mode (cached)
649 ClippingMode::Type GetClippingMode() const;
652 * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
653 * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
654 * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
655 * hover event signal will be emitted.
657 * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
659 * actor.SetSensitive(false);
662 * Then, to re-enable the touch or hover event signal emission, the application should call:
664 * actor.SetSensitive(true);
667 * @see SignalTouch() and SignalHover().
668 * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
669 * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
671 void SetSensitive( bool sensitive )
673 mSensitive = sensitive;
677 * Query whether an actor emits touch or hover event signals.
678 * @see SetSensitive(bool)
679 * @return true, if emission of touch or hover event signals is enabled, false otherwise.
681 bool IsSensitive() const
687 * @copydoc Dali::Actor::SetDrawMode
689 void SetDrawMode( DrawMode::Type drawMode );
692 * @copydoc Dali::Actor::GetDrawMode
694 DrawMode::Type GetDrawMode() const;
697 * @copydoc Dali::Actor::IsOverlay
699 bool IsOverlay() const;
702 * Sets the actor's color. The final color of actor depends on its color mode.
703 * This final color is applied to the drawable elements of an actor.
704 * @param [in] color The new color.
706 void SetColor( const Vector4& color );
709 * Set the red component of the color.
710 * @param [in] red The new red component.
712 void SetColorRed( float red );
715 * Set the green component of the color.
716 * @param [in] green The new green component.
718 void SetColorGreen( float green );
721 * Set the blue component of the scale factor.
722 * @param [in] blue The new blue value.
724 void SetColorBlue( float blue );
727 * Retrieve the actor's color.
730 const Vector4& GetCurrentColor() const;
733 * Sets the actor's color mode.
734 * Color mode specifies whether Actor uses its own color or inherits its parent color
735 * @param [in] colorMode to use.
737 void SetColorMode( ColorMode colorMode );
740 * Returns the actor's color mode.
741 * @return currently used colorMode.
743 ColorMode GetColorMode() const;
746 * @copydoc Dali::Actor::GetCurrentWorldColor()
748 const Vector4& GetCurrentWorldColor() const;
751 * @copydoc Dali::Actor::GetHierarchyDepth()
753 inline int GetHierarchyDepth() const
757 return static_cast<int>(mDepth);
764 * Get the actor's sorting depth
766 * @return The depth used for hit-testing and renderer sorting
768 unsigned int GetSortingDepth();
772 // Size negotiation virtual functions
775 * @brief Called after the size negotiation has been finished for this control.
777 * The control is expected to assign this given size to itself/its children.
779 * Should be overridden by derived classes if they need to layout
780 * actors differently after certain operations like add or remove
781 * actors, resize or after changing specific properties.
783 * Note! As this function is called from inside the size negotiation algorithm, you cannot
784 * call RequestRelayout (the call would just be ignored)
786 * @param[in] size The allocated size.
787 * @param[in,out] container The control should add actors to this container that it is not able
788 * to allocate a size for.
790 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
795 * @brief Notification for deriving classes when the resize policy is set
797 * @param[in] policy The policy being set
798 * @param[in] dimension The dimension the policy is being set for
800 virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) {}
803 * @brief Virtual method to notify deriving classes that relayout dependencies have been
804 * met and the size for this object is about to be calculated for the given dimension
806 * @param dimension The dimension that is about to be calculated
808 virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
811 * @brief Virtual method to notify deriving classes that the size for a dimension
812 * has just been negotiated
814 * @param[in] size The new size for the given dimension
815 * @param[in] dimension The dimension that was just negotiated
817 virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
820 * @brief Determine if this actor is dependent on it's children for relayout
822 * @param dimension The dimension(s) to check for
823 * @return Return if the actor is dependent on it's children
825 virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
828 * @brief Determine if this actor is dependent on it's children for relayout.
830 * Called from deriving classes
832 * @param dimension The dimension(s) to check for
833 * @return Return if the actor is dependent on it's children
835 virtual bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
838 * @brief Calculate the size for a child
840 * @param[in] child The child actor to calculate the size for
841 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
842 * @return Return the calculated size for the given dimension
844 virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
847 * @brief This method is called during size negotiation when a height is required for a given width.
849 * Derived classes should override this if they wish to customize the height returned.
851 * @param width to use.
852 * @return the height based on the width.
854 virtual float GetHeightForWidth( float width );
857 * @brief This method is called during size negotiation when a width is required for a given height.
859 * Derived classes should override this if they wish to customize the width returned.
861 * @param height to use.
862 * @return the width based on the width.
864 virtual float GetWidthForHeight( float height );
871 * @brief Called by the RelayoutController to negotiate the size of an actor.
873 * The size allocated by the the algorithm is passed in which the
874 * actor must adhere to. A container is passed in as well which
875 * the actor should populate with actors it has not / or does not
876 * need to handle in its size negotiation.
878 * @param[in] size The allocated size.
879 * @param[in,out] container The container that holds actors that are fed back into the
880 * RelayoutController algorithm.
882 void NegotiateSize( const Vector2& size, RelayoutContainer& container );
885 * @brief Set whether size negotiation should use the assigned size of the actor
886 * during relayout for the given dimension(s)
888 * @param[in] use Whether the assigned size of the actor should be used
889 * @param[in] dimension The dimension(s) to set. Can be a bitfield of multiple dimensions
891 void SetUseAssignedSize( bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
894 * @brief Returns whether size negotiation should use the assigned size of the actor
895 * during relayout for a single dimension
897 * @param[in] dimension The dimension to get
898 * @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
900 bool GetUseAssignedSize( Dimension::Type dimension ) const;
903 * @copydoc Dali::Actor::SetResizePolicy()
905 void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
908 * @copydoc Dali::Actor::GetResizePolicy()
910 ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
913 * @copydoc Dali::Actor::SetSizeScalePolicy()
915 void SetSizeScalePolicy( SizeScalePolicy::Type policy );
918 * @copydoc Dali::Actor::GetSizeScalePolicy()
920 SizeScalePolicy::Type GetSizeScalePolicy() const;
923 * @copydoc Dali::Actor::SetDimensionDependency()
925 void SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency );
928 * @copydoc Dali::Actor::GetDimensionDependency()
930 Dimension::Type GetDimensionDependency( 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
949 * @param dirty Whether to mark actor as dirty or not
950 * @param dimension The dimension(s) to mark as dirty
952 void SetLayoutDirty( bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
955 * @brief Return if any of an actor's dimensions are marked as dirty
957 * @param dimension The dimension(s) to check
958 * @return Return if any of the requested dimensions are dirty
960 bool IsLayoutDirty( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
963 * @brief Returns if relayout is enabled and the actor is not dirty
965 * @return Return if it is possible to relayout the actor
967 bool RelayoutPossible( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
970 * @brief Returns if relayout is enabled and the actor is dirty
972 * @return Return if it is required to relayout the actor
974 bool RelayoutRequired( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
977 * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
979 * This method is automatically called from OnStageConnection(), OnChildAdd(),
980 * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
982 * This method can also be called from a derived class every time it needs a different size.
983 * At the end of event processing, the relayout process starts and
984 * all controls which requested Relayout will have their sizes (re)negotiated.
986 * @note RelayoutRequest() can be called multiple times; the size negotiation is still
987 * only performed once, i.e. there is no need to keep track of this in the calling side.
989 void RelayoutRequest( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
992 * @brief Determine if this actor is dependent on it's parent for relayout
994 * @param dimension The dimension(s) to check for
995 * @return Return if the actor is dependent on it's parent
997 bool RelayoutDependentOnParent( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1000 * @brief Determine if this actor has another dimension depedent on the specified one
1002 * @param dimension The dimension to check for
1003 * @param dependentDimension The dimension to check for dependency with
1004 * @return Return if the actor is dependent on this dimension
1006 bool RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension );
1009 * Negotiate sizes for a control in all dimensions
1011 * @param[in] allocatedSize The size constraint that the control must respect
1013 void NegotiateDimensions( const Vector2& allocatedSize );
1016 * Negotiate size for a specific dimension
1018 * The algorithm adopts a recursive dependency checking approach. Meaning, that wherever dependencies
1019 * are found, e.g. an actor dependent on its parent, the dependency will be calculated first with NegotiatedDimension and
1020 * LayoutDimensionNegotiated flags being filled in on the actor.
1022 * @post All actors that exist in the dependency chain connected to the given actor will have had their NegotiatedDimensions
1023 * calculated and set as well as the LayoutDimensionNegotiated flags.
1025 * @param[in] dimension The dimension to negotiate on
1026 * @param[in] allocatedSize The size constraint that the actor must respect
1028 void NegotiateDimension( Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack );
1031 * @brief Calculate the size of a dimension
1033 * @param[in] dimension The dimension to calculate the size for
1034 * @param[in] maximumSize The upper bounds on the size
1035 * @return Return the calculated size for the dimension
1037 float CalculateSize( Dimension::Type dimension, const Vector2& maximumSize );
1040 * @brief Clamp a dimension given the relayout constraints on this actor
1042 * @param[in] size The size to constrain
1043 * @param[in] dimension The dimension the size exists in
1044 * @return Return the clamped size
1046 float ClampDimension( float size, Dimension::Type dimension );
1049 * Negotiate a dimension based on the size of the parent
1051 * @param[in] dimension The dimension to negotiate on
1052 * @return Return the negotiated size
1054 float NegotiateFromParent( Dimension::Type dimension );
1057 * Negotiate a dimension based on the size of the parent. Fitting inside.
1059 * @param[in] dimension The dimension to negotiate on
1060 * @return Return the negotiated size
1062 float NegotiateFromParentFit( Dimension::Type dimension );
1065 * Negotiate a dimension based on the size of the parent. Flooding the whole space.
1067 * @param[in] dimension The dimension to negotiate on
1068 * @return Return the negotiated size
1070 float NegotiateFromParentFlood( Dimension::Type dimension );
1073 * @brief Negotiate a dimension based on the size of the children
1075 * @param[in] dimension The dimension to negotiate on
1076 * @return Return the negotiated size
1078 float NegotiateFromChildren( Dimension::Type dimension );
1081 * Set the negotiated dimension value for the given dimension(s)
1083 * @param negotiatedDimension The value to set
1084 * @param dimension The dimension(s) to set the value for
1086 void SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1089 * Return the value of negotiated dimension for the given dimension
1091 * @param dimension The dimension to retrieve
1092 * @return Return the value of the negotiated dimension
1094 float GetNegotiatedDimension( Dimension::Type dimension ) const;
1097 * @brief Set the padding for a dimension
1099 * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
1100 * @param[in] dimension The dimension to set
1102 void SetPadding( const Vector2& padding, Dimension::Type dimension );
1105 * Return the value of padding for the given dimension
1107 * @param dimension The dimension to retrieve
1108 * @return Return the value of padding for the dimension
1110 Vector2 GetPadding( Dimension::Type dimension ) const;
1113 * Return the actor size for a given dimension
1115 * @param[in] dimension The dimension to retrieve the size for
1116 * @return Return the size for the given dimension
1118 float GetSize( Dimension::Type dimension ) const;
1121 * Return the natural size of the actor for a given dimension
1123 * @param[in] dimension The dimension to retrieve the size for
1124 * @return Return the natural size for the given dimension
1126 float GetNaturalSize( Dimension::Type dimension ) const;
1129 * @brief Return the amount of size allocated for relayout
1131 * May include padding
1133 * @param[in] dimension The dimension to retrieve
1134 * @return Return the size
1136 float GetRelayoutSize( Dimension::Type dimension ) const;
1139 * @brief If the size has been negotiated return that else return normal size
1141 * @param[in] dimension The dimension to retrieve
1142 * @return Return the size
1144 float GetLatestSize( Dimension::Type dimension ) const;
1147 * Apply the negotiated size to the actor
1149 * @param[in] container The container to fill with actors that require further relayout
1151 void SetNegotiatedSize( RelayoutContainer& container );
1154 * @brief Flag the actor as having it's layout dimension negotiated.
1156 * @param[in] negotiated The status of the flag to set.
1157 * @param[in] dimension The dimension to set the flag for
1159 void SetLayoutNegotiated( bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1162 * @brief Test whether the layout dimension for this actor has been negotiated or not.
1164 * @param[in] dimension The dimension to determine the value of the flag for
1165 * @return Return if the layout dimension is negotiated or not.
1167 bool IsLayoutNegotiated( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
1170 * @brief provides the Actor implementation of GetHeightForWidth
1171 * @param width to use.
1172 * @return the height based on the width.
1174 float GetHeightForWidthBase( float width );
1177 * @brief provides the Actor implementation of GetWidthForHeight
1178 * @param height to use.
1179 * @return the width based on the height.
1181 float GetWidthForHeightBase( float height );
1184 * @brief Calculate the size for a child
1186 * @param[in] child The child actor to calculate the size for
1187 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
1188 * @return Return the calculated size for the given dimension
1190 float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
1193 * @brief Set the preferred size for size negotiation
1195 * @param[in] size The preferred size to set
1197 void SetPreferredSize( const Vector2& size );
1200 * @brief Return the preferred size used for size negotiation
1202 * @return Return the preferred size
1204 Vector2 GetPreferredSize() const;
1207 * @copydoc Dali::Actor::SetMinimumSize
1209 void SetMinimumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1212 * @copydoc Dali::Actor::GetMinimumSize
1214 float GetMinimumSize( Dimension::Type dimension ) const;
1217 * @copydoc Dali::Actor::SetMaximumSize
1219 void SetMaximumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1222 * @copydoc Dali::Actor::GetMaximumSize
1224 float GetMaximumSize( Dimension::Type dimension ) const;
1227 * @copydoc Dali::Actor::AddRenderer()
1229 unsigned int AddRenderer( Renderer& renderer );
1232 * @copydoc Dali::Actor::GetRendererCount()
1234 unsigned int GetRendererCount() const;
1237 * @copydoc Dali::Actor::GetRendererAt()
1239 RendererPtr GetRendererAt( unsigned int index );
1242 * @copydoc Dali::Actor::RemoveRenderer()
1244 void RemoveRenderer( Renderer& renderer );
1247 * @copydoc Dali::Actor::RemoveRenderer()
1249 void RemoveRenderer( unsigned int index );
1254 * Converts screen coordinates into the actor's coordinate system.
1255 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1256 * @param[out] localX On return, the X-coordinate relative to the actor.
1257 * @param[out] localY On return, the Y-coordinate relative to the actor.
1258 * @param[in] screenX The screen X-coordinate.
1259 * @param[in] screenY The screen Y-coordinate.
1260 * @return True if the conversion succeeded.
1262 bool ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const;
1265 * Converts screen coordinates into the actor's coordinate system.
1266 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1267 * @param[in] renderTask The render-task used to display the actor.
1268 * @param[out] localX On return, the X-coordinate relative to the actor.
1269 * @param[out] localY On return, the Y-coordinate relative to the actor.
1270 * @param[in] screenX The screen X-coordinate.
1271 * @param[in] screenY The screen Y-coordinate.
1272 * @return True if the conversion succeeded.
1274 bool ScreenToLocal( const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const;
1277 * Converts from the actor's coordinate system to screen coordinates.
1278 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1279 * @param[in] viewMatrix The view-matrix
1280 * @param[in] projectionMatrix The projection-matrix
1281 * @param[in] viewport The view-port
1282 * @param[out] localX On return, the X-coordinate relative to the actor.
1283 * @param[out] localY On return, the Y-coordinate relative to the actor.
1284 * @param[in] screenX The screen X-coordinate.
1285 * @param[in] screenY The screen Y-coordinate.
1286 * @return True if the conversion succeeded.
1288 bool ScreenToLocal( const Matrix& viewMatrix,
1289 const Matrix& projectionMatrix,
1290 const Viewport& viewport,
1294 float screenY ) const;
1297 * Performs a ray-sphere test with the given pick-ray and the actor's bounding sphere.
1298 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1299 * @param[in] rayOrigin The ray origin in the world's reference system.
1300 * @param[in] rayDir The ray director vector in the world's reference system.
1301 * @return True if the ray intersects the actor's bounding sphere.
1303 bool RaySphereTest( const Vector4& rayOrigin, const Vector4& rayDir ) const;
1306 * Performs a ray-actor test with the given pick-ray and the actor's geometry.
1307 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1308 * @param[in] rayOrigin The ray origin in the world's reference system.
1309 * @param[in] rayDir The ray director vector in the world's reference system.
1310 * @param[out] hitPointLocal The hit point in the Actor's local reference system.
1311 * @param[out] distance The distance from the hit point to the camera.
1312 * @return True if the ray intersects the actor's geometry.
1314 bool RayActorTest( const Vector4& rayOrigin,
1315 const Vector4& rayDir,
1316 Vector2& hitPointLocal,
1317 float& distance ) const;
1320 * Sets whether the actor should receive a notification when touch or hover motion events leave
1321 * the boundary of the actor.
1323 * @note By default, this is set to false as most actors do not require this.
1324 * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
1326 * @param[in] required Should be set to true if a Leave event is required
1328 void SetLeaveRequired( bool required );
1331 * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1332 * the boundary of the actor.
1333 * @return true if a Leave event is required, false otherwise.
1335 bool GetLeaveRequired() const;
1338 * @copydoc Dali::Actor::SetKeyboardFocusable()
1340 void SetKeyboardFocusable( bool focusable );
1343 * @copydoc Dali::Actor::IsKeyboardFocusable()
1345 bool IsKeyboardFocusable() const;
1348 * Query whether the application or derived actor type requires touch events.
1349 * @return True if touch events are required.
1351 bool GetTouchRequired() const;
1354 * Query whether the application or derived actor type requires hover events.
1355 * @return True if hover events are required.
1357 bool GetHoverRequired() const;
1360 * Query whether the application or derived actor type requires wheel events.
1361 * @return True if wheel events are required.
1363 bool GetWheelEventRequired() const;
1366 * Query whether the actor is actually hittable. This method checks whether the actor is
1367 * sensitive, has the visibility flag set to true and is not fully transparent.
1368 * @return true, if it can be hit, false otherwise.
1370 bool IsHittable() const;
1375 * Retrieve the gesture data associated with this actor. The first call to this method will
1376 * allocate space for the ActorGestureData so this should only be called if an actor really does
1378 * @return Reference to the ActorGestureData for this actor.
1379 * @note Once the gesture-data is created for an actor it is likely that gestures are required
1380 * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
1382 ActorGestureData& GetGestureData();
1385 * Queries whether the actor requires the gesture type.
1386 * @param[in] type The gesture type.
1388 bool IsGestureRequred( Gesture::Type type ) const;
1393 * Used by the EventProcessor to emit touch event signals.
1394 * @param[in] event The touch event (Old API).
1395 * @param[in] touch The touch data.
1396 * @return True if the event was consumed.
1398 bool EmitTouchEventSignal( const TouchEvent& event, const Dali::TouchData& touch );
1401 * Used by the EventProcessor to emit hover event signals.
1402 * @param[in] event The hover event.
1403 * @return True if the event was consumed.
1405 bool EmitHoverEventSignal( const HoverEvent& event );
1408 * Used by the EventProcessor to emit wheel event signals.
1409 * @param[in] event The wheel event.
1410 * @return True if the event was consumed.
1412 bool EmitWheelEventSignal( const WheelEvent& event );
1415 * @brief Emits the visibility change signal for this actor and all its children.
1416 * @param[in] visible Whether the actor has become visible or not.
1417 * @param[in] type Whether the actor's visible property has changed or a parent's.
1419 void EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityChange::Type type );
1422 * @copydoc Dali::Actor::TouchedSignal()
1424 Dali::Actor::TouchSignalType& TouchedSignal();
1427 * @copydoc Dali::Actor::TouchEventSignal()
1429 Dali::Actor::TouchDataSignalType& TouchSignal();
1432 * @copydoc Dali::Actor::HoveredSignal()
1434 Dali::Actor::HoverSignalType& HoveredSignal();
1437 * @copydoc Dali::Actor::WheelEventSignal()
1439 Dali::Actor::WheelEventSignalType& WheelEventSignal();
1442 * @copydoc Dali::Actor::OnStageSignal()
1444 Dali::Actor::OnStageSignalType& OnStageSignal();
1447 * @copydoc Dali::Actor::OffStageSignal()
1449 Dali::Actor::OffStageSignalType& OffStageSignal();
1452 * @copydoc Dali::Actor::OnRelayoutSignal()
1454 Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal();
1457 * @copydoc DevelActor::VisibilityChangedSignal
1459 DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal();
1462 * Connects a callback function with the object's signals.
1463 * @param[in] object The object providing the signal.
1464 * @param[in] tracker Used to disconnect the signal.
1465 * @param[in] signalName The signal to connect to.
1466 * @param[in] functor A newly allocated FunctorDelegate.
1467 * @return True if the signal was connected.
1468 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
1470 static bool DoConnectSignal( BaseObject* object,
1471 ConnectionTrackerInterface* tracker,
1472 const std::string& signalName,
1473 FunctorDelegate* functor );
1476 * Performs actions as requested using the action name.
1477 * @param[in] object The object on which to perform the action.
1478 * @param[in] actionName The action to perform.
1479 * @param[in] attributes The attributes with which to perfrom this action.
1480 * @return true if the action was done.
1482 static bool DoAction( BaseObject* object,
1483 const std::string& actionName,
1484 const Property::Map& attributes );
1490 * For use in derived classes.
1491 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1493 virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize )
1501 BASIC, LAYER, ROOT_LAYER
1505 * Protected Constructor. See Actor::New().
1506 * The second-phase construction Initialize() member should be called immediately after this.
1507 * @param[in] derivedType The derived type of actor (if any).
1509 Actor( DerivedType derivedType );
1512 * Second-phase constructor. Must be called immediately after creating a new Actor;
1514 void Initialize( void );
1517 * A reference counted object may only be deleted by calling Unreference()
1522 * Called on a child during Add() when the parent actor is connected to the Stage.
1523 * @param[in] parentDepth The depth of the parent in the hierarchy.
1525 void ConnectToStage( unsigned int parentDepth );
1528 * Helper for ConnectToStage, to recursively connect a tree of actors.
1529 * This is atomic i.e. not interrupted by user callbacks.
1530 * @param[in] depth The depth in the hierarchy of the actor
1531 * @param[out] connectionList On return, the list of connected actors which require notification.
1533 void RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth );
1536 * Connect the Node associated with this Actor to the scene-graph.
1538 void ConnectToSceneGraph();
1541 * Helper for ConnectToStage, to notify a connected actor through the public API.
1543 void NotifyStageConnection();
1546 * Called on a child during Remove() when the actor was previously on the Stage.
1548 void DisconnectFromStage();
1551 * Helper for DisconnectFromStage, to recursively disconnect a tree of actors.
1552 * This is atomic i.e. not interrupted by user callbacks.
1553 * @param[out] disconnectionList On return, the list of disconnected actors which require notification.
1555 void RecursiveDisconnectFromStage( ActorContainer& disconnectionList );
1558 * Disconnect the Node associated with this Actor from the scene-graph.
1560 void DisconnectFromSceneGraph();
1563 * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1565 void NotifyStageDisconnection();
1568 * When the Actor is OnStage, checks whether the corresponding Node is connected to the scene graph.
1569 * @return True if the Actor is OnStage & has a Node connected to the scene graph.
1571 bool IsNodeConnected() const;
1575 * Trigger a rebuild of the actor depth tree from this root
1576 * If a Layer3D is encountered, then this doesn't descend any further.
1577 * The mSortedDepth of each actor is set appropriately.
1579 void RebuildDepthTree();
1584 * Traverse the actor tree, inserting actors into the depth tree in sibling order.
1585 * @param[in] sceneGraphNodeDepths A vector capturing the nodes and their depth index
1586 * @param[in,out] depthIndex The current depth index (traversal index)
1588 void DepthTraverseActorTree( OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int& depthIndex );
1592 // Default property extensions from Object
1595 * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
1597 virtual unsigned int GetDefaultPropertyCount() const;
1600 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
1602 virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
1605 * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
1607 virtual const char* GetDefaultPropertyName( Property::Index index ) const;
1610 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
1612 virtual Property::Index GetDefaultPropertyIndex( const std::string& name ) const;
1615 * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
1617 virtual bool IsDefaultPropertyWritable( Property::Index index ) const;
1620 * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
1622 virtual bool IsDefaultPropertyAnimatable( Property::Index index ) const;
1625 * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
1627 virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
1630 * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
1632 virtual Property::Type GetDefaultPropertyType( Property::Index index ) const;
1635 * @copydoc Dali::Internal::Object::SetDefaultProperty()
1637 virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue );
1640 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1642 virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
1645 * @copydoc Dali::Internal::Object::GetDefaultProperty()
1647 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
1650 * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
1652 virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
1655 * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
1657 virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType );
1660 * @copydoc Dali::Internal::Object::GetPropertyOwner()
1662 virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
1665 * @copydoc Dali::Internal::Object::GetSceneObject()
1667 virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
1670 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1672 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
1675 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1677 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
1680 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1682 virtual int GetPropertyComponentIndex( Property::Index index ) const;
1685 * @copydoc Dali::DevelActor::Raise()
1690 * @copydoc Dali::DevelActor::Lower()
1695 * @copydoc Dali::DevelActor::RaiseToTop()
1700 * @copydoc Dali::DevelActor::LowerToBottom()
1702 void LowerToBottom();
1705 * @copydoc Dali::DevelActor::RaiseAbove()
1707 void RaiseAbove( Internal::Actor& target );
1710 * @copydoc Dali::DevelActor::LowerBelow()
1712 void LowerBelow( Internal::Actor& target );
1729 Actor( const Actor& );
1732 Actor& operator=( const Actor& rhs );
1735 * Set the actors parent.
1736 * @param[in] parent The new parent.
1738 void SetParent( Actor* parent );
1741 * Helper to create a Node for this Actor.
1742 * To be overriden in derived classes.
1743 * @return A newly allocated node.
1745 virtual SceneGraph::Node* CreateNode() const;
1748 * For use in derived classes, called after Initialize()
1750 virtual void OnInitialize()
1755 * For use in internal derived classes.
1756 * This is called during ConnectToStage(), after the actor has finished adding its node to the scene-graph.
1757 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1759 virtual void OnStageConnectionInternal()
1764 * For use in internal derived classes.
1765 * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1766 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1768 virtual void OnStageDisconnectionInternal()
1773 * For use in external (CustomActor) derived classes.
1774 * This is called after the atomic ConnectToStage() traversal has been completed.
1776 virtual void OnStageConnectionExternal( int depth )
1781 * For use in external (CustomActor) derived classes.
1782 * This is called after the atomic DisconnectFromStage() traversal has been completed.
1784 virtual void OnStageDisconnectionExternal()
1789 * For use in derived classes; this is called after Add() has added a child.
1790 * @param[in] child The child that was added.
1792 virtual void OnChildAdd( Actor& child )
1797 * For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ).
1798 * @param[in] child The child that was removed.
1800 virtual void OnChildRemove( Actor& child )
1805 * For use in derived classes.
1806 * This is called after SizeSet() has been called.
1808 virtual void OnSizeSet( const Vector3& targetSize )
1813 * For use in derived classes.
1814 * This is only called if mDerivedRequiresTouch is true, and the touch-signal was not consumed.
1815 * @param[in] event The touch event.
1816 * @return True if the event should be consumed.
1818 virtual bool OnTouchEvent( const TouchEvent& event )
1824 * For use in derived classes.
1825 * This is only called if mDerivedRequiresHover is true, and the hover-signal was not consumed.
1826 * @param[in] event The hover event.
1827 * @return True if the event should be consumed.
1829 virtual bool OnHoverEvent( const HoverEvent& event )
1835 * For use in derived classes.
1836 * This is only called if the wheel signal was not consumed.
1837 * @param[in] event The wheel event.
1838 * @return True if the event should be consumed.
1840 virtual bool OnWheelEvent( const WheelEvent& event )
1846 * @brief Retrieves the cached event side value of a default property.
1847 * @param[in] index The index of the property
1848 * @param[out] value Is set with the cached value of the property if found.
1849 * @return True if value set, false otherwise.
1851 bool GetCachedPropertyValue( Property::Index index, Property::Value& value ) const;
1854 * @brief Retrieves the current value of a default property from the scene-graph.
1855 * @param[in] index The index of the property
1856 * @param[out] value Is set with the current scene-graph value of the property
1857 * @return True if value set, false otherwise.
1859 bool GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const;
1862 * @brief Ensure the relayout data is allocated
1864 void EnsureRelayoutData();
1867 * @brief Apply the size set policy to the input size
1869 * @param[in] size The size to apply the policy to
1870 * @return Return the adjusted size
1872 Vector2 ApplySizeSetPolicy( const Vector2& size );
1875 * Retrieve the parent object of an Actor.
1876 * @return The parent object, or NULL if the Actor does not have a parent.
1878 virtual Object* GetParentObject() const;
1882 * @param[in] order The sibling order this Actor should be. It will place
1883 * the actor at this index in it's parent's child array.
1885 void SetSiblingOrder( unsigned int order);
1889 * @return the order of this actor amongst it's siblings
1891 unsigned int GetSiblingOrder() const;
1894 * Request that the stage rebuilds the actor depth indices.
1896 void RequestRebuildDepthTree();
1899 * @brief Get the current position of the actor in screen coordinates.
1901 * @return Returns the screen position of actor
1903 const Vector2 GetCurrentScreenPosition() const;
1906 * Sets the visibility flag of an actor.
1907 * @param[in] visible The new visibility flag.
1908 * @param[in] sendMessage Whether to send a message to the update thread or not.
1910 void SetVisibleInternal( bool visible, SendMessage::Type sendMessage );
1914 Actor* mParent; ///< Each actor (except the root) can have one parent
1915 ActorContainer* mChildren; ///< Container of referenced actors, lazily initialized
1916 RendererContainer* mRenderers; ///< Renderer container
1918 const SceneGraph::Node* mNode; ///< Not owned
1919 Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
1920 Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
1922 struct RelayoutData;
1923 RelayoutData* mRelayoutData; ///< Struct to hold optional collection of relayout variables
1925 ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
1928 Dali::Actor::TouchSignalType mTouchedSignal;
1929 Dali::Actor::TouchDataSignalType mTouchSignal;
1930 Dali::Actor::HoverSignalType mHoveredSignal;
1931 Dali::Actor::WheelEventSignalType mWheelEventSignal;
1932 Dali::Actor::OnStageSignalType mOnStageSignal;
1933 Dali::Actor::OffStageSignalType mOffStageSignal;
1934 Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
1935 DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
1937 Quaternion mTargetOrientation; ///< Event-side storage for orientation
1938 Vector4 mTargetColor; ///< Event-side storage for color
1939 Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
1940 Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
1941 Vector3 mTargetScale; ///< Event-side storage for scale
1943 std::string mName; ///< Name of the actor
1944 unsigned int mId; ///< A unique ID to identify the actor starting from 1, and 0 is reserved
1946 uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
1947 uint16_t mDepth; ///< The depth in the hierarchy of the actor. Only 4096 levels of depth are supported
1950 const bool mIsRoot : 1; ///< Flag to identify the root actor
1951 const bool mIsLayer : 1; ///< Flag to identify that this is a layer
1952 bool mIsOnStage : 1; ///< Flag to identify whether the actor is on-stage
1953 bool mSensitive : 1; ///< Whether the actor emits touch event signals
1954 bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
1955 bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
1956 bool mDerivedRequiresTouch : 1; ///< Whether the derived actor type requires touch event signals
1957 bool mDerivedRequiresHover : 1; ///< Whether the derived actor type requires hover event signals
1958 bool mDerivedRequiresWheelEvent : 1; ///< Whether the derived actor type requires wheel event signals
1959 bool mOnStageSignalled : 1; ///< Set to true before OnStageConnection signal is emitted, and false before OnStageDisconnection
1960 bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
1961 bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
1962 bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
1963 bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
1964 bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
1965 bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
1966 DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn
1967 PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited
1968 ColorMode mColorMode : 2; ///< Cached: Determines whether mWorldColor is inherited
1969 ClippingMode::Type mClippingMode : 2; ///< Cached: Determines which clipping mode (if any) to use.
1973 static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
1974 static unsigned int mActorCounter; ///< A counter to track the actor instance creation
1977 } // namespace Internal
1979 // Helpers for public-api forwarding methods
1981 inline Internal::Actor& GetImplementation( Dali::Actor& actor )
1983 DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
1985 BaseObject& handle = actor.GetBaseObject();
1987 return static_cast< Internal::Actor& >( handle );
1990 inline const Internal::Actor& GetImplementation( const Dali::Actor& actor )
1992 DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
1994 const BaseObject& handle = actor.GetBaseObject();
1996 return static_cast< const Internal::Actor& >( handle );
2001 #endif // DALI_INTERNAL_ACTOR_H