1 #ifndef __DALI_INTERNAL_ACTOR_H__
2 #define __DALI_INTERNAL_ACTOR_H__
5 * Copyright (c) 2014 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/common/vector-wrapper.h>
26 #include <dali/public-api/object/ref-object.h>
27 #include <dali/public-api/actors/actor.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/internal/event/common/object-impl.h>
32 #include <dali/public-api/size-negotiation/relayout-container.h>
33 #include <dali/internal/event/common/stage-def.h>
34 #include <dali/internal/event/actors/actor-declarations.h>
35 #include <dali/internal/event/actors/renderer-impl.h>
36 #include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
37 #include <dali/internal/update/nodes/node-declarations.h>
39 #ifdef DYNAMICS_SUPPORT
40 #include <dali/internal/event/dynamics/dynamics-declarations.h>
49 struct MouseWheelEvent;
55 class ActorGestureData;
61 typedef IntrusivePtr< Actor > ActorPtr;
62 typedef Dali::ActorContainer ActorContainer; // Store handles to return via public-api
63 typedef ActorContainer::iterator ActorIter;
64 typedef ActorContainer::const_iterator ActorConstIter;
67 * Actor is the primary object which Dali applications interact with.
68 * UI controls can be built by combining multiple actors.
69 * Multi-Touch events are received through signals emitted by the actor tree.
71 * An Actor is a proxy for a Node in the scene graph.
72 * When an Actor is added to the Stage, it creates a node and attaches it to the scene graph.
73 * The scene-graph can be updated in a separate thread, so the attachment is done using an asynchronous message.
74 * When a tree of Actors is detached from the Stage, a message is sent to destroy the associated nodes.
76 class Actor : public Object
81 * @brief Struct to hold an actor and a dimension
83 struct ActorDimensionPair
88 * @param[in] newActor The actor to assign
89 * @param[in] newDimension The dimension to assign
91 ActorDimensionPair( Actor* newActor, Dimension newDimension )
93 dimension( newDimension )
98 * @brief Equality operator
100 * @param[in] lhs The left hand side argument
101 * @param[in] rhs The right hand side argument
103 bool operator== ( const ActorDimensionPair& rhs )
105 return ( actor == rhs.actor ) && ( dimension == rhs.dimension );
108 Actor* actor; ///< The actor to hold
109 Dimension dimension; ///< The dimension to hold
112 typedef std::vector< ActorDimensionPair > ActorDimensionStack;
117 * Create a new actor.
118 * @return A smart-pointer to the newly allocated Actor.
120 static ActorPtr New();
123 * Retrieve the name of the actor.
126 const std::string& GetName() const;
129 * Set the name of the actor.
130 * @param[in] name The new name.
132 void SetName( const std::string& name );
135 * @copydoc Dali::Actor::GetId
137 unsigned int GetId() const;
142 * Attach an object to an actor.
143 * @pre The actor does not already have an attachment.
144 * @param[in] attachment The object to attach.
146 void Attach( ActorAttachment& attachment );
149 * Retreive the object attached to an actor.
150 * @return The attachment.
152 ActorAttachmentPtr GetAttachment();
157 * Query whether an actor is the root actor, which is owned by the Stage.
158 * @return True if the actor is a root actor.
166 * Query whether the actor is connected to the Stage.
168 bool OnStage() const;
171 * Query whether the actor is a RenderableActor derived type.
172 * @return True if the actor is renderable.
174 bool IsRenderable() const
176 // inlined as this is called a lot in hit testing
177 return mIsRenderable;
181 * Query whether the actor is of class Dali::Layer
182 * @return True if the actor is a layer.
186 // inlined as this is called a lot in hit testing
191 * Gets the layer in which the actor is present
192 * @return The layer, which will be uninitialized if the actor is off-stage.
194 Dali::Layer GetLayer();
197 * Adds a child Actor to this Actor.
198 * @pre The child actor is not the same as the parent actor.
199 * @pre The child actor does not already have a parent.
200 * @param [in] child The child.
201 * @post The child will be referenced by its parent.
203 void Add( Actor& child );
206 * Inserts a child Actor to this Actor's child list
207 * @pre The child actor is not the same as the parent actor.
208 * @pre The child actor does not already have a parent.
209 * @param [in] index in childlist to insert child at
210 * @param [in] child The child.
211 * @post The child will be referenced by its parent.
213 void Insert( unsigned int index, Actor& child );
216 * Removes a child Actor from this Actor.
217 * @param [in] child The child.
218 * @post The child will be unreferenced.
220 void Remove( Actor& child );
223 * @copydoc Dali::Actor::Unparent
228 * Retrieve the number of children held by the actor.
229 * @return The number of children
231 unsigned int GetChildCount() const;
234 * @copydoc Dali::Actor::GetChildAt
236 Dali::Actor GetChildAt( unsigned int index ) const;
239 * Retrieve the Actor's children.
240 * @return A copy of the container of children.
242 ActorContainer GetChildren();
245 * Retrieve the Actor's children.
246 * @return A const reference to the container of children.
248 const ActorContainer& GetChildren() const;
251 * Retrieve a reference to Actor's children.
252 * @note Not for public use.
253 * @return A reference to the container of children.
255 ActorContainer& GetChildrenInternal()
261 * @copydoc Dali::Actor::FindChildByName
263 ActorPtr FindChildByName( const std::string& actorName );
266 * @copydoc Dali::Actor::FindChildById
268 ActorPtr FindChildById( const unsigned int id );
271 * Retrieve the parent of an Actor.
272 * @return The parent actor, or NULL if the Actor does not have a parent.
274 Actor* GetParent() const
280 * Sets the size of an actor.
281 * ActorAttachments attached to the actor, can be scaled to fit within this area.
282 * This does not interfere with the actors scale factor.
283 * @param [in] width The new width.
284 * @param [in] height The new height.
286 void SetSize( float width, float height );
289 * Sets the size of an actor.
290 * ActorAttachments attached to the actor, can be scaled to fit within this area.
291 * This does not interfere with the actors scale factor.
292 * @param [in] width The size of the actor along the x-axis.
293 * @param [in] height The size of the actor along the y-axis.
294 * @param [in] depth The size of the actor along the z-axis.
296 void SetSize( float width, float height, float depth );
299 * Sets the size of an actor.
300 * ActorAttachments attached to the actor, can be scaled to fit within this area.
301 * This does not interfere with the actors scale factor.
302 * @param [in] size The new size.
304 void SetSize( const Vector2& size );
307 * Sets the size of an actor.
308 * ActorAttachments attached to the actor, can be scaled to fit within this area.
309 * This does not interfere with the actors scale factor.
310 * @param [in] size The new size.
312 void SetSize( const Vector3& size );
315 * Set the width component of the Actor's size.
316 * @param [in] width The new width component.
318 void SetWidth( float width );
321 * Set the height component of the Actor's size.
322 * @param [in] height The new height component.
324 void SetHeight( float height );
327 * Set the depth component of the Actor's size.
328 * @param [in] depth The new depth component.
330 void SetDepth( float depth );
333 * Retrieve the Actor's size from event side.
334 * This size will be the size set or if animating then the target size.
335 * @return The Actor's size.
337 const Vector3& GetTargetSize() const;
340 * Retrieve the Actor's size from update side.
341 * This size will be the size set or animating but will be a frame behind.
342 * @return The Actor's size.
344 const Vector3& GetCurrentSize() const;
347 * Return the natural size of the actor
349 * @return The actor's natural size
351 virtual Vector3 GetNaturalSize() const;
354 * Set the origin of an actor, within its parent's area.
355 * This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
356 * and (1.0, 1.0, 0.5) is the bottom-right corner.
357 * The default parent-origin is top-left (0.0, 0.0, 0.5).
358 * An actor position is the distance between this origin, and the actors anchor-point.
359 * @param [in] origin The new parent-origin.
361 void SetParentOrigin( const Vector3& origin );
364 * Set the x component of the parent-origin
365 * @param [in] x The new x value.
367 void SetParentOriginX( float x );
370 * Set the y component of the parent-origin
371 * @param [in] y The new y value.
373 void SetParentOriginY( float y );
376 * Set the z component of the parent-origin
377 * @param [in] z The new z value.
379 void SetParentOriginZ( float z );
382 * Retrieve the parent-origin of an actor.
383 * @return The parent-origin.
385 const Vector3& GetCurrentParentOrigin() const;
388 * Set the anchor-point of an actor. This is expressed in 2D unit coordinates, such that
389 * (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.
390 * The default anchor point is top-left (0.0, 0.0, 0.5).
391 * An actor position is the distance between its parent-origin, and this anchor-point.
392 * An actor's rotation is centered around its anchor-point.
393 * @param [in] anchorPoint The new anchor-point.
395 void SetAnchorPoint( const Vector3& anchorPoint );
398 * Set the x component of the anchor-point.
399 * @param [in] x The new x value.
401 void SetAnchorPointX( float x );
404 * Set the y component of the anchor-point.
405 * @param [in] y The new y value.
407 void SetAnchorPointY( float y );
410 * Set the z component of the anchor-point.
411 * @param [in] z The new z value.
413 void SetAnchorPointZ( float z );
416 * Retrieve the anchor-point of an actor.
417 * @return The anchor-point.
419 const Vector3& GetCurrentAnchorPoint() const;
422 * Sets the position of the Actor.
423 * The coordinates are relative to the Actor's parent.
424 * The Actor's z position will be set to 0.0f.
425 * @param [in] x The new x position
426 * @param [in] y The new y position
428 void SetPosition( float x, float y );
431 * Sets the position of the Actor.
432 * The coordinates are relative to the Actor's parent.
433 * @param [in] x The new x position
434 * @param [in] y The new y position
435 * @param [in] z The new z position
437 void SetPosition( float x, float y, float z );
440 * Sets the position of the Actor.
441 * The coordinates are relative to the Actor's parent.
442 * @param [in] position The new position.
444 void SetPosition( const Vector3& position );
447 * Set the position of an actor along the X-axis.
448 * @param [in] x The new x position
450 void SetX( float x );
453 * Set the position of an actor along the Y-axis.
454 * @param [in] y The new y position.
456 void SetY( float y );
459 * Set the position of an actor along the Z-axis.
460 * @param [in] z The new z position
462 void SetZ( float z );
465 * Translate an actor relative to its existing position.
466 * @param[in] distance The actor will move by this distance.
468 void TranslateBy( const Vector3& distance );
471 * Retrieve the position of the Actor.
472 * The coordinates are relative to the Actor's parent.
473 * @return the Actor's position.
475 const Vector3& GetCurrentPosition() const;
478 * @copydoc Dali::Actor::GetCurrentWorldPosition()
480 const Vector3& GetCurrentWorldPosition() const;
483 * @copydoc Dali::Actor::SetPositionInheritanceMode()
485 void SetPositionInheritanceMode( PositionInheritanceMode mode );
488 * @copydoc Dali::Actor::GetPositionInheritanceMode()
490 PositionInheritanceMode GetPositionInheritanceMode() const;
493 * Sets the orientation of the Actor.
494 * @param [in] angleRadians The new orientation angle in radians.
495 * @param [in] axis The new axis of orientation.
497 void SetOrientation( const Radian& angleRadians, const Vector3& axis );
500 * Sets the orientation of the Actor.
501 * @param [in] orientation The new orientation.
503 void SetOrientation( const Quaternion& orientation );
506 * Rotate an actor around its existing rotation axis.
507 * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
508 * @param[in] axis The axis of the rotation to combine with the existing rotation.
510 void RotateBy( const Radian& angleRadians, const Vector3& axis );
513 * Apply a relative rotation to an actor.
514 * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
516 void RotateBy( const Quaternion& relativeRotation );
519 * Retreive the Actor's orientation.
520 * @return the orientation.
522 const Quaternion& GetCurrentOrientation() const;
525 * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
526 * Switching this off means that using SetOrientation() sets the actor's world orientation.
527 * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
529 void SetInheritOrientation( bool inherit );
532 * Returns whether the actor inherit's it's parent's orientation.
533 * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
535 bool IsOrientationInherited() const;
538 * @brief Defines how a child actors size is affected by its parents size.
539 * @param[in] mode The size relative to parent mode to use.
541 void SetSizeMode( SizeMode mode );
544 * Query how the child actors size is affected by its parents size.
545 * @return The size relative to parent mode in use.
547 SizeMode GetSizeMode() const;
550 * Sets the factor of the parents size used for the child actor.
551 * Note: Only used if SizeMode is SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT.
552 * @param[in] factor The vector to multiply the parents size by to get the childs size.
554 void SetSizeModeFactor( const Vector3& factor );
557 * Gets the factor of the parents size used for the child actor.
558 * Note: Only used if SizeMode is SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT.
559 * @return The vector being used to multiply the parents size by to get the childs size.
561 const Vector3& GetSizeModeFactor() const;
564 * @copydoc Dali::Actor::GetCurrentWorldOrientation()
566 const Quaternion& GetCurrentWorldOrientation() const;
569 * Sets a scale factor applied to an actor.
570 * @param [in] scale The scale factor applied on all axes.
572 void SetScale( float scale );
575 * Sets a scale factor applied to an actor.
576 * @param [in] scaleX The scale factor applied along the x-axis.
577 * @param [in] scaleY The scale factor applied along the y-axis.
578 * @param [in] scaleZ The scale factor applied along the z-axis.
580 void SetScale( float scaleX, float scaleY, float scaleZ );
583 * Sets a scale factor applied to an actor.
584 * @param [in] scale A vector representing the scale factor for each axis.
586 void SetScale( const Vector3& scale );
589 * Set the x component of the scale factor.
590 * @param [in] x The new x value.
592 void SetScaleX( float x );
595 * Set the y component of the scale factor.
596 * @param [in] y The new y value.
598 void SetScaleY( float y );
601 * Set the z component of the scale factor.
602 * @param [in] z The new z value.
604 void SetScaleZ( float z );
607 * Apply a relative scale to an actor.
608 * @param[in] relativeScale The scale to combine with the actors existing scale.
610 void ScaleBy( const Vector3& relativeScale );
613 * Retrieve the scale factor applied to an actor.
614 * @return A vector representing the scale factor for each axis.
616 const Vector3& GetCurrentScale() const;
619 * @copydoc Dali::Actor::GetCurrentWorldScale()
621 const Vector3& GetCurrentWorldScale() const;
624 * @copydoc Dali::Actor::SetInheritScale()
626 void SetInheritScale( bool inherit );
629 * @copydoc Dali::Actor::IsScaleInherited()
631 bool IsScaleInherited() const;
634 * @copydoc Dali::Actor::GetCurrentWorldMatrix()
636 Matrix GetCurrentWorldMatrix() const;
641 * Sets the visibility flag of an actor.
642 * @param [in] visible The new visibility flag.
644 void SetVisible( bool visible );
647 * Retrieve the visibility flag of an actor.
648 * @return The visibility flag.
650 bool IsVisible() const;
653 * Sets the opacity of an actor.
654 * @param [in] opacity The new opacity.
656 void SetOpacity( float opacity );
659 * Retrieve the actor's opacity.
660 * @return The actor's opacity.
662 float GetCurrentOpacity() const;
665 * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
666 * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
667 * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
668 * hover event signal will be emitted.
670 * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
672 * actor.SetSensitive(false);
675 * Then, to re-enable the touch or hover event signal emission, the application should call:
677 * actor.SetSensitive(true);
680 * @see SignalTouch() and SignalHover().
681 * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
682 * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
684 void SetSensitive( bool sensitive )
686 mSensitive = sensitive;
690 * Query whether an actor emits touch or hover event signals.
691 * @see SetSensitive(bool)
692 * @return true, if emission of touch or hover event signals is enabled, false otherwise.
694 bool IsSensitive() const
700 * @copydoc Dali::Actor::SetDrawMode
702 void SetDrawMode( DrawMode::Type drawMode );
705 * @copydoc Dali::Actor::GetDrawMode
707 DrawMode::Type GetDrawMode() const;
710 * @copydoc Dali::Actor::SetOverlay
712 void SetOverlay( bool enable );
715 * @copydoc Dali::Actor::IsOverlay
717 bool IsOverlay() const;
720 * Sets the actor's color. The final color of actor depends on its color mode.
721 * This final color is applied to the drawable elements of an actor.
722 * @param [in] color The new color.
724 void SetColor( const Vector4& color );
727 * Set the red component of the color.
728 * @param [in] red The new red component.
730 void SetColorRed( float red );
733 * Set the green component of the color.
734 * @param [in] green The new green component.
736 void SetColorGreen( float green );
739 * Set the blue component of the scale factor.
740 * @param [in] blue The new blue value.
742 void SetColorBlue( float blue );
745 * Retrieve the actor's color.
748 const Vector4& GetCurrentColor() const;
751 * Sets the actor's color mode.
752 * Color mode specifies whether Actor uses its own color or inherits its parent color
753 * @param [in] colorMode to use.
755 void SetColorMode( ColorMode colorMode );
758 * Returns the actor's color mode.
759 * @return currently used colorMode.
761 ColorMode GetColorMode() const;
764 * @copydoc Dali::Actor::GetCurrentWorldColor()
766 const Vector4& GetCurrentWorldColor() const;
770 // Size negotiation virtual functions
773 * @brief Called after the size negotiation has been finished for this control.
775 * The control is expected to assign this given size to itself/its children.
777 * Should be overridden by derived classes if they need to layout
778 * actors differently after certain operations like add or remove
779 * actors, resize or after changing specific properties.
781 * Note! As this function is called from inside the size negotiation algorithm, you cannot
782 * call RequestRelayout (the call would just be ignored)
784 * @param[in] size The allocated size.
785 * @param[in,out] container The control should add actors to this container that it is not able
786 * to allocate a size for.
788 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
793 * @brief Notification for deriving classes when the resize policy is set
795 * @param[in] policy The policy being set
796 * @param[in] dimension The dimension the policy is being set for
798 virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension ) {}
801 * @brief Virtual method to notify deriving classes that relayout dependencies have been
802 * met and the size for this object is about to be calculated for the given dimension
804 * @param dimension The dimension that is about to be calculated
806 virtual void OnCalculateRelayoutSize( Dimension dimension );
809 * @brief Virtual method to notify deriving classes that the size for a dimension
810 * has just been negotiated
812 * @param[in] size The new size for the given dimension
813 * @param[in] dimension The dimension that was just negotiated
815 virtual void OnLayoutNegotiated( float size, Dimension dimension );
818 * @brief Determine if this actor is dependent on it's children for relayout
820 * @param dimension The dimension(s) to check for
821 * @return Return if the actor is dependent on it's children
823 virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS );
826 * @brief Determine if this actor is dependent on it's children for relayout.
828 * Called from deriving classes
830 * @param dimension The dimension(s) to check for
831 * @return Return if the actor is dependent on it's children
833 virtual bool RelayoutDependentOnChildrenBase( Dimension dimension = ALL_DIMENSIONS );
836 * @brief Calculate the size for a child
838 * @param[in] child The child actor to calculate the size for
839 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
840 * @return Return the calculated size for the given dimension
842 virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension );
845 * @brief This method is called during size negotiation when a height is required for a given width.
847 * Derived classes should override this if they wish to customize the height returned.
849 * @param width to use.
850 * @return the height based on the width.
852 virtual float GetHeightForWidth( float width );
855 * @brief This method is called during size negotiation when a width is required for a given height.
857 * Derived classes should override this if they wish to customize the width returned.
859 * @param height to use.
860 * @return the width based on the width.
862 virtual float GetWidthForHeight( float height );
869 * @brief Called by the RelayoutController to negotiate the size of an actor.
871 * The size allocated by the the algorithm is passed in which the
872 * actor must adhere to. A container is passed in as well which
873 * the actor should populate with actors it has not / or does not
874 * need to handle in its size negotiation.
876 * @param[in] size The allocated size.
877 * @param[in,out] container The container that holds actors that are fed back into the
878 * RelayoutController algorithm.
880 void NegotiateSize( const Vector2& size, RelayoutContainer& container );
883 * @copydoc Dali::Actor::SetResizePolicy()
885 void SetResizePolicy( ResizePolicy policy, Dimension dimension = ALL_DIMENSIONS );
888 * @copydoc Dali::Actor::GetResizePolicy()
890 ResizePolicy GetResizePolicy( Dimension dimension ) const;
893 * @copydoc Dali::Actor::SetSizeScalePolicy()
895 void SetSizeScalePolicy( SizeScalePolicy policy );
898 * @copydoc Dali::Actor::GetSizeScalePolicy()
900 SizeScalePolicy GetSizeScalePolicy() const;
903 * @copydoc Dali::Actor::SetDimensionDependency()
905 void SetDimensionDependency( Dimension dimension, Dimension dependency );
908 * @copydoc Dali::Actor::GetDimensionDependency()
910 Dimension GetDimensionDependency( Dimension dimension ) const;
913 * @copydoc Dali::Actor::SetRelayoutEnabled()
915 void SetRelayoutEnabled( bool relayoutEnabled );
918 * @copydoc Dali::Actor::IsRelayoutEnabled()
920 bool IsRelayoutEnabled() const;
923 * @brief Mark an actor as having it's layout dirty
925 * @param dirty Whether to mark actor as dirty or not
926 * @param dimension The dimension(s) to mark as dirty
928 void SetLayoutDirty( bool dirty, Dimension dimension = ALL_DIMENSIONS );
931 * @brief Return if any of an actor's dimensions are marked as dirty
933 * @param dimension The dimension(s) to check
934 * @return Return if any of the requested dimensions are dirty
936 bool IsLayoutDirty( Dimension dimension = ALL_DIMENSIONS ) const;
939 * @brief Returns if relayout is enabled and the actor is not dirty
941 * @return Return if it is possible to relayout the actor
943 bool RelayoutPossible( Dimension dimension = ALL_DIMENSIONS ) const;
946 * @brief Returns if relayout is enabled and the actor is dirty
948 * @return Return if it is required to relayout the actor
950 bool RelayoutRequired( Dimension dimension = ALL_DIMENSIONS ) const;
953 * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
955 * This method is automatically called from OnStageConnection(), OnChildAdd(),
956 * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
958 * This method can also be called from a derived class every time it needs a different size.
959 * At the end of event processing, the relayout process starts and
960 * all controls which requested Relayout will have their sizes (re)negotiated.
962 * @note RelayoutRequest() can be called multiple times; the size negotiation is still
963 * only performed once, i.e. there is no need to keep track of this in the calling side.
965 void RelayoutRequest( Dimension dimension = ALL_DIMENSIONS );
968 * @brief Request to relayout of all actors in the sub-tree below the given actor.
970 * This flags the actor and all actors below it for relayout. The actual
971 * relayout is performed at the end of the frame. This means that multiple calls to relayout
972 * will not cause multiple relayouts to occur.
974 void RelayoutRequestTree();
977 * @copydoc Dali::Actor::PropagateRelayoutFlags
979 void PropagateRelayoutFlags();
982 * @brief Determine if this actor is dependent on it's parent for relayout
984 * @param dimension The dimension(s) to check for
985 * @return Return if the actor is dependent on it's parent
987 bool RelayoutDependentOnParent( Dimension dimension = ALL_DIMENSIONS );
990 * @brief Determine if this actor has another dimension depedent on the specified one
992 * @param dimension The dimension to check for
993 * @param dependentDimension The dimension to check for dependency with
994 * @return Return if the actor is dependent on this dimension
996 bool RelayoutDependentOnDimension( Dimension dimension, Dimension dependentDimension );
999 * Negotiate sizes for a control in all dimensions
1001 * @param[in] allocatedSize The size constraint that the control must respect
1003 void NegotiateDimensions( const Vector2& allocatedSize );
1006 * Negotiate size for a specific dimension
1008 * The algorithm adopts a recursive dependency checking approach. Meaning, that wherever dependencies
1009 * are found, e.g. an actor dependent on its parent, the dependency will be calculated first with NegotiatedDimension and
1010 * LayoutDimensionNegotiated flags being filled in on the actor.
1012 * @post All actors that exist in the dependency chain connected to the given actor will have had their NegotiatedDimensions
1013 * calculated and set as well as the LayoutDimensionNegotiated flags.
1015 * @param[in] dimension The dimension to negotiate on
1016 * @param[in] allocatedSize The size constraint that the actor must respect
1018 void NegotiateDimension( Dimension dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack );
1021 * @brief Calculate the size of a dimension
1023 * @param[in] dimension The dimension to calculate the size for
1024 * @param[in] maximumSize The upper bounds on the size
1025 * @return Return the calculated size for the dimension
1027 float CalculateSize( Dimension dimension, const Vector2& maximumSize );
1030 * @brief Constain a dimension given the relayout constraints on this actor
1032 * @param[in] size The size to constrain
1033 * @param[in] dimension The dimension the size exists in
1034 * @return Return the constrained size
1036 float ConstrainDimension( float size, Dimension dimension );
1039 * Negotiate a dimension based on the size of the parent
1041 * @param[in] dimension The dimension to negotiate on
1042 * @return Return the negotiated size
1044 float NegotiateFromParent( Dimension dimension );
1047 * Negotiate a dimension based on the size of the parent. Fitting inside.
1049 * @param[in] dimension The dimension to negotiate on
1050 * @return Return the negotiated size
1052 float NegotiateFromParentFit( Dimension dimension );
1055 * Negotiate a dimension based on the size of the parent. Flooding the whole space.
1057 * @param[in] dimension The dimension to negotiate on
1058 * @return Return the negotiated size
1060 float NegotiateFromParentFlood( Dimension dimension );
1063 * @brief Negotiate a dimension based on the size of the children
1065 * @param[in] dimension The dimension to negotiate on
1066 * @return Return the negotiated size
1068 float NegotiateFromChildren( Dimension dimension );
1071 * Set the negotiated dimension value for the given dimension(s)
1073 * @param negotiatedDimension The value to set
1074 * @param dimension The dimension(s) to set the value for
1076 void SetNegotiatedDimension( float negotiatedDimension, Dimension dimension = ALL_DIMENSIONS );
1079 * Return the value of negotiated dimension for the given dimension
1081 * @param dimension The dimension to retrieve
1082 * @return Return the value of the negotiated dimension
1084 float GetNegotiatedDimension( Dimension dimension ) const;
1087 * @brief Set the padding for a dimension
1089 * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
1090 * @param[in] dimension The dimension to set
1092 void SetPadding( const Vector2& padding, Dimension dimension );
1095 * Return the value of padding for the given dimension
1097 * @param dimension The dimension to retrieve
1098 * @return Return the value of padding for the dimension
1100 Vector2 GetPadding( Dimension dimension ) const;
1103 * Return the actor size for a given dimension
1105 * @param[in] dimension The dimension to retrieve the size for
1106 * @return Return the size for the given dimension
1108 float GetSize( Dimension dimension ) const;
1111 * Return the natural size of the actor for a given dimension
1113 * @param[in] dimension The dimension to retrieve the size for
1114 * @return Return the natural size for the given dimension
1116 float GetNaturalSize( Dimension dimension ) const;
1119 * @brief Return the amount of size allocated for relayout
1121 * May include padding
1123 * @param[in] dimension The dimension to retrieve
1124 * @return Return the size
1126 float GetRelayoutSize( Dimension dimension ) const;
1129 * @brief If the size has been negotiated return that else return normal size
1131 * @param[in] dimension The dimension to retrieve
1132 * @return Return the size
1134 float GetLatestSize( Dimension dimension ) const;
1137 * Apply the negotiated size to the actor
1139 * @param[in] container The container to fill with actors that require further relayout
1141 void SetNegotiatedSize( RelayoutContainer& container );
1144 * @brief Flag the actor as having it's layout dimension negotiated.
1146 * @param[in] negotiated The status of the flag to set.
1147 * @param[in] dimension The dimension to set the flag for
1149 void SetLayoutNegotiated( bool negotiated, Dimension dimension = ALL_DIMENSIONS );
1152 * @brief Test whether the layout dimension for this actor has been negotiated or not.
1154 * @param[in] dimension The dimension to determine the value of the flag for
1155 * @return Return if the layout dimension is negotiated or not.
1157 bool IsLayoutNegotiated( Dimension dimension = ALL_DIMENSIONS ) const;
1160 * @brief Calculate the size for a child
1162 * @param[in] child The child actor to calculate the size for
1163 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
1164 * @return Return the calculated size for the given dimension
1166 float CalculateChildSizeBase( const Dali::Actor& child, Dimension dimension );
1169 * @copydoc Dali::Actor::SetPreferredSize
1171 void SetPreferredSize( const Vector2& size );
1174 * @copydoc Dali::Actor::GetPreferredSize
1176 Vector2 GetPreferredSize() const;
1179 * @copydoc Dali::Actor::SetMinimumSize
1181 void SetMinimumSize( float size, Dimension dimension = ALL_DIMENSIONS );
1184 * @copydoc Dali::Actor::GetMinimumSize
1186 float GetMinimumSize( Dimension dimension ) const;
1189 * @copydoc Dali::Actor::SetMaximumSize
1191 void SetMaximumSize( float size, Dimension dimension = ALL_DIMENSIONS );
1194 * @copydoc Dali::Actor::GetMaximumSize
1196 float GetMaximumSize( Dimension dimension ) const;
1198 * @copydoc Dali::Actor::AddRenderer()
1200 unsigned int AddRenderer( Renderer& renderer );
1203 * @copydoc Dali::Actor::GetRendererCount()
1205 unsigned int GetRendererCount() const;
1208 * @copydoc Dali::Actor::GetRendererAt()
1210 Renderer& GetRendererAt( unsigned int index );
1213 * @copydoc Dali::Actor::RemoveRenderer()
1215 void RemoveRenderer( Renderer& renderer );
1218 * @copydoc Dali::Actor::RemoveRenderer()
1220 void RemoveRenderer( unsigned int index );
1222 #ifdef DYNAMICS_SUPPORT
1226 /// @copydoc Dali::Actor::DisableDynamics
1227 void DisableDynamics();
1229 /// @copydoc Dali::Actor::EnableDynamics(Dali::DynamicsBodyConfig)
1230 DynamicsBodyPtr EnableDynamics(DynamicsBodyConfigPtr bodyConfig);
1232 /// @copydoc Dali::Actor::GetDynamicsBody
1233 DynamicsBodyPtr GetDynamicsBody() const;
1235 /// @copydoc Dali::Actor::AddDynamicsJoint(Dali::Actor,const Vector3&)
1236 DynamicsJointPtr AddDynamicsJoint( ActorPtr attachedActor, const Vector3& offset );
1238 /// @copydoc Dali::Actor::AddDynamicsJoint(Dali::Actor,const Vector3&,const Vector3&)
1239 DynamicsJointPtr AddDynamicsJoint( ActorPtr attachedActor, const Vector3& offsetA, const Vector3& offsetB );
1241 /// @copydoc Dali::Actor::GetNumberOfJoints
1242 const int GetNumberOfJoints() const;
1244 /// @copydoc Dali::Actor::GetDynamicsJointByIndex
1245 DynamicsJointPtr GetDynamicsJointByIndex( const int index ) const;
1247 /// @copydoc Dali::Actor::GetDynamicsJoint
1248 DynamicsJointPtr GetDynamicsJoint( ActorPtr attachedActor ) const;
1250 /// @copydoc Dali::Actor::RemoveDynamicsJoint
1251 void RemoveDynamicsJoint( DynamicsJointPtr joint );
1254 * Hold a reference to a DynamicsJoint
1255 * @param[in] joint The joint
1257 void ReferenceJoint( DynamicsJointPtr joint );
1260 * Release a reference to a DynamicsJoint
1261 * @param[in] joint The joint
1263 void ReleaseJoint( DynamicsJointPtr joint );
1266 * Set this actor to be the root actor in the dynamics simulation
1267 * All children of the actor are added/removed from the simulation.
1268 * @param[in] flag When true sets this actor to be the simulation world root actor and
1269 * if OnStage() all dynamics enabled child actors are added to the simulation,
1270 * when false stops this actor being the simulation root and if OnStage() all
1271 * dynamics enabled child actors are removed from the simulation.
1273 void SetDynamicsRoot(bool flag);
1277 * Check if this actor is the root actor in the dynamics simulation
1278 * @return true if this is the dynamics root actor.
1280 bool IsDynamicsRoot() const;
1283 * Add actor to the dynamics simulation
1284 * Invoked when the actor is staged, or it's parent becomes the simulation root
1286 void ConnectDynamics();
1289 * Remove actor from the dynamics simulation
1290 * Invoked when the actor is unstaged, or it's parent stops being the the simulation root
1292 void DisconnectDynamics();
1295 * An actor in a DynamicsJoint relationship has been staged
1296 * @param[in] actor The actor passed into AddDynamicsJoint()
1298 void AttachedActorOnStage( Dali::Actor actor );
1301 * An actor in a DynamicsJoint relationship has been unstaged
1302 * @param[in] actor The actor passed into AddDynamicsJoint()
1304 void AttachedActorOffStage( Dali::Actor actor );
1306 #endif // DYNAMICS_SUPPORT
1310 * Converts screen coordinates into the actor's coordinate system.
1311 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1312 * @param[out] localX On return, the X-coordinate relative to the actor.
1313 * @param[out] localY On return, the Y-coordinate relative to the actor.
1314 * @param[in] screenX The screen X-coordinate.
1315 * @param[in] screenY The screen Y-coordinate.
1316 * @return True if the conversion succeeded.
1318 bool ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const;
1321 * Converts screen coordinates into the actor's coordinate system.
1322 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1323 * @param[in] renderTask The render-task used to display the actor.
1324 * @param[out] localX On return, the X-coordinate relative to the actor.
1325 * @param[out] localY On return, the Y-coordinate relative to the actor.
1326 * @param[in] screenX The screen X-coordinate.
1327 * @param[in] screenY The screen Y-coordinate.
1328 * @return True if the conversion succeeded.
1330 bool ScreenToLocal( RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const;
1333 * Converts from the actor's coordinate system to screen coordinates.
1334 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1335 * @param[in] viewMatrix The view-matrix
1336 * @param[in] projectionMatrix The projection-matrix
1337 * @param[in] viewport The view-port
1338 * @param[out] localX On return, the X-coordinate relative to the actor.
1339 * @param[out] localY On return, the Y-coordinate relative to the actor.
1340 * @param[in] screenX The screen X-coordinate.
1341 * @param[in] screenY The screen Y-coordinate.
1342 * @return True if the conversion succeeded.
1344 bool ScreenToLocal( const Matrix& viewMatrix,
1345 const Matrix& projectionMatrix,
1346 const Viewport& viewport,
1350 float screenY ) const;
1353 * Performs a ray-sphere test with the given pick-ray and the actor's bounding sphere.
1354 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1355 * @param[in] rayOrigin The ray origin in the world's reference system.
1356 * @param[in] rayDir The ray director vector in the world's reference system.
1357 * @return True if the ray intersects the actor's bounding sphere.
1359 bool RaySphereTest( const Vector4& rayOrigin, const Vector4& rayDir ) const;
1362 * Performs a ray-actor test with the given pick-ray and the actor's geometry.
1363 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1364 * @param[in] rayOrigin The ray origin in the world's reference system.
1365 * @param[in] rayDir The ray director vector in the world's reference system.
1366 * @param[out] hitPointLocal The hit point in the Actor's local reference system.
1367 * @param[out] distance The distance from the hit point to the camera.
1368 * @return True if the ray intersects the actor's geometry.
1370 bool RayActorTest( const Vector4& rayOrigin,
1371 const Vector4& rayDir,
1372 Vector4& hitPointLocal,
1373 float& distance ) const;
1376 * Sets whether the actor should receive a notification when touch or hover motion events leave
1377 * the boundary of the actor.
1379 * @note By default, this is set to false as most actors do not require this.
1380 * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
1382 * @param[in] required Should be set to true if a Leave event is required
1384 void SetLeaveRequired( bool required );
1387 * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1388 * the boundary of the actor.
1389 * @return true if a Leave event is required, false otherwise.
1391 bool GetLeaveRequired() const;
1394 * @copydoc Dali::Actor::SetKeyboardFocusable()
1396 void SetKeyboardFocusable( bool focusable );
1399 * @copydoc Dali::Actor::IsKeyboardFocusable()
1401 bool IsKeyboardFocusable() const;
1404 * Query whether the application or derived actor type requires touch events.
1405 * @return True if touch events are required.
1407 bool GetTouchRequired() const;
1410 * Query whether the application or derived actor type requires hover events.
1411 * @return True if hover events are required.
1413 bool GetHoverRequired() const;
1416 * Query whether the application or derived actor type requires mouse wheel events.
1417 * @return True if mouse wheel events are required.
1419 bool GetMouseWheelEventRequired() const;
1422 * Query whether the actor is actually hittable. This method checks whether the actor is
1423 * sensitive, has the visibility flag set to true and is not fully transparent.
1424 * @return true, if it can be hit, false otherwise.
1426 bool IsHittable() const;
1431 * Retrieve the gesture data associated with this actor. The first call to this method will
1432 * allocate space for the ActorGestureData so this should only be called if an actor really does
1434 * @return Reference to the ActorGestureData for this actor.
1435 * @note Once the gesture-data is created for an actor it is likely that gestures are required
1436 * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
1438 ActorGestureData& GetGestureData();
1441 * Queries whether the actor requires the gesture type.
1442 * @param[in] type The gesture type.
1444 bool IsGestureRequred( Gesture::Type type ) const;
1449 * Used by the EventProcessor to emit touch event signals.
1450 * @param[in] event The touch event.
1451 * @return True if the event was consumed.
1453 bool EmitTouchEventSignal( const TouchEvent& event );
1456 * Used by the EventProcessor to emit hover event signals.
1457 * @param[in] event The hover event.
1458 * @return True if the event was consumed.
1460 bool EmitHoverEventSignal( const HoverEvent& event );
1463 * Used by the EventProcessor to emit mouse wheel event signals.
1464 * @param[in] event The mouse wheel event.
1465 * @return True if the event was consumed.
1467 bool EmitMouseWheelEventSignal( const MouseWheelEvent& event );
1470 * @copydoc Dali::Actor::TouchedSignal()
1472 Dali::Actor::TouchSignalType& TouchedSignal();
1475 * @copydoc Dali::Actor::HoveredSignal()
1477 Dali::Actor::HoverSignalType& HoveredSignal();
1480 * @copydoc Dali::Actor::MouseWheelEventSignal()
1482 Dali::Actor::MouseWheelEventSignalType& MouseWheelEventSignal();
1485 * @copydoc Dali::Actor::OnStageSignal()
1487 Dali::Actor::OnStageSignalType& OnStageSignal();
1490 * @copydoc Dali::Actor::OffStageSignal()
1492 Dali::Actor::OffStageSignalType& OffStageSignal();
1495 * @copydoc Dali::Actor::OnRelayoutSignal()
1497 Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal();
1500 * Connects a callback function with the object's signals.
1501 * @param[in] object The object providing the signal.
1502 * @param[in] tracker Used to disconnect the signal.
1503 * @param[in] signalName The signal to connect to.
1504 * @param[in] functor A newly allocated FunctorDelegate.
1505 * @return True if the signal was connected.
1506 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
1508 static bool DoConnectSignal( BaseObject* object,
1509 ConnectionTrackerInterface* tracker,
1510 const std::string& signalName,
1511 FunctorDelegate* functor );
1514 * Performs actions as requested using the action name.
1515 * @param[in] object The object on which to perform the action.
1516 * @param[in] actionName The action to perform.
1517 * @param[in] attributes The attributes with which to perfrom this action.
1518 * @return true if the action was done.
1520 static bool DoAction( BaseObject* object,
1521 const std::string& actionName,
1522 const std::vector< Property::Value >& attributes );
1528 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1530 * @param[in] animation The animation that resized the actor
1531 * @param[in] targetSize The new target size of the actor
1533 void NotifySizeAnimation( Animation& animation, const Vector3& targetSize );
1536 * For use in derived classes.
1537 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1539 virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize )
1547 BASIC, RENDERABLE, LAYER, ROOT_LAYER
1551 * Protected Constructor. See Actor::New().
1552 * The second-phase construction Initialize() member should be called immediately after this.
1553 * @param[in] derivedType The derived type of actor (if any).
1555 Actor( DerivedType derivedType );
1558 * Second-phase constructor. Must be called immediately after creating a new Actor;
1560 void Initialize( void );
1563 * A reference counted object may only be deleted by calling Unreference()
1568 * Called on a child during Add() when the parent actor is connected to the Stage.
1569 * @param[in] stage The stage.
1570 * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1572 void ConnectToStage( int index = -1 );
1575 * Helper for ConnectToStage, to recursively connect a tree of actors.
1576 * This is atomic i.e. not interrupted by user callbacks.
1577 * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1578 * @param[out] connectionList On return, the list of connected actors which require notification.
1580 void RecursiveConnectToStage( ActorContainer& connectionList, int index = -1 );
1583 * Connect the Node associated with this Actor to the scene-graph.
1584 * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1586 void ConnectToSceneGraph( int index = -1 );
1589 * Helper for ConnectToStage, to notify a connected actor through the public API.
1591 void NotifyStageConnection();
1594 * Called on a child during Remove() when the actor was previously on the Stage.
1596 void DisconnectFromStage();
1599 * Helper for DisconnectFromStage, to recursively disconnect a tree of actors.
1600 * This is atomic i.e. not interrupted by user callbacks.
1601 * @param[out] disconnectionList On return, the list of disconnected actors which require notification.
1603 void RecursiveDisconnectFromStage( ActorContainer& disconnectionList );
1606 * Disconnect the Node associated with this Actor from the scene-graph.
1608 void DisconnectFromSceneGraph();
1611 * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1613 void NotifyStageDisconnection();
1616 * When the Actor is OnStage, checks whether the corresponding Node is connected to the scene graph.
1617 * @return True if the Actor is OnStage & has a Node connected to the scene graph.
1619 bool IsNodeConnected() const;
1622 * Calculate the size of the z dimension for a 2D size
1624 * @param[in] size The 2D size (X, Y) to calculate Z from
1626 * @return Return the Z dimension for this size
1628 float CalculateSizeZ( const Vector2& size ) const;
1631 // Default property extensions from Object
1634 * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
1636 virtual unsigned int GetDefaultPropertyCount() const;
1639 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
1641 virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
1644 * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
1646 virtual const char* GetDefaultPropertyName( Property::Index index ) const;
1649 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
1651 virtual Property::Index GetDefaultPropertyIndex( const std::string& name ) const;
1654 * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
1656 virtual bool IsDefaultPropertyWritable( Property::Index index ) const;
1659 * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
1661 virtual bool IsDefaultPropertyAnimatable( Property::Index index ) const;
1664 * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
1666 virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
1669 * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
1671 virtual Property::Type GetDefaultPropertyType( Property::Index index ) const;
1674 * @copydoc Dali::Internal::Object::SetDefaultProperty()
1676 virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue );
1679 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1681 virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
1684 * @copydoc Dali::Internal::Object::GetDefaultProperty()
1686 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
1689 * @copydoc Dali::Internal::Object::GetPropertyOwner()
1691 virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
1694 * @copydoc Dali::Internal::Object::GetSceneObject()
1696 virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
1699 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1701 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
1704 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1706 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
1709 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1711 virtual int GetPropertyComponentIndex( Property::Index index ) const;
1719 Actor( const Actor& );
1722 Actor& operator=( const Actor& rhs );
1725 * Set the actors parent.
1726 * @param[in] parent The new parent.
1727 * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1729 void SetParent( Actor* parent, int index = -1 );
1732 * Helper to create a Node for this Actor.
1733 * To be overriden in derived classes.
1734 * @return A newly allocated node.
1736 virtual SceneGraph::Node* CreateNode() const;
1739 * For use in derived classes, called after Initialize()
1741 virtual void OnInitialize()
1746 * For use in internal derived classes.
1747 * This is called during ConnectToStage(), after the actor has finished adding its node to the scene-graph.
1748 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1750 virtual void OnStageConnectionInternal()
1755 * For use in internal derived classes.
1756 * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1757 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1759 virtual void OnStageDisconnectionInternal()
1764 * For use in external (CustomActor) derived classes.
1765 * This is called after the atomic ConnectToStage() traversal has been completed.
1767 virtual void OnStageConnectionExternal()
1772 * For use in external (CustomActor) derived classes.
1773 * This is called after the atomic DisconnectFromStage() traversal has been completed.
1775 virtual void OnStageDisconnectionExternal()
1780 * For use in derived classes; this is called after Add() has added a child.
1781 * @param[in] child The child that was added.
1783 virtual void OnChildAdd( Actor& child )
1788 * For use in derived classes; this is called after Remove() has removed a child.
1789 * @param[in] child The child that was removed.
1791 virtual void OnChildRemove( Actor& child )
1796 * For use in derived classes.
1797 * This is called after SizeSet() has been called.
1799 virtual void OnSizeSet( const Vector3& targetSize )
1804 * For use in derived classes.
1805 * This is only called if mDerivedRequiresTouch is true, and the touch-signal was not consumed.
1806 * @param[in] event The touch event.
1807 * @return True if the event should be consumed.
1809 virtual bool OnTouchEvent( const TouchEvent& event )
1815 * For use in derived classes.
1816 * This is only called if mDerivedRequiresHover is true, and the hover-signal was not consumed.
1817 * @param[in] event The hover event.
1818 * @return True if the event should be consumed.
1820 virtual bool OnHoverEvent( const HoverEvent& event )
1826 * For use in derived classes.
1827 * This is only called if the mouse wheel signal was not consumed.
1828 * @param[in] event The mouse event.
1829 * @return True if the event should be consumed.
1831 virtual bool OnMouseWheelEvent( const MouseWheelEvent& event )
1837 * @brief Ensure the relayout data is allocated
1839 void EnsureRelayoutData() const;
1842 * @brief Apply the size set policy to the input size
1844 * @param[in] size The size to apply the policy to
1845 * @return Return the adjusted size
1847 Vector2 ApplySizeSetPolicy( const Vector2 size );
1851 StagePtr mStage; ///< Used to send messages to Node; valid until Core destruction
1852 Actor* mParent; ///< Each actor (except the root) can have one parent
1853 ActorContainer* mChildren; ///< Container of referenced actors
1854 const SceneGraph::Node* mNode; ///< Not owned
1855 Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
1856 Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
1858 struct RelayoutData;
1859 mutable RelayoutData* mRelayoutData; ///< Struct to hold optional collection of relayout variables
1861 #ifdef DYNAMICS_SUPPORT
1862 DynamicsData* mDynamicsData; ///< optional physics data
1865 ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
1867 ActorAttachmentPtr mAttachment; ///< Optional referenced attachment
1870 Dali::Actor::TouchSignalType mTouchedSignal;
1871 Dali::Actor::HoverSignalType mHoveredSignal;
1872 Dali::Actor::MouseWheelEventSignalType mMouseWheelEventSignal;
1873 Dali::Actor::OnStageSignalType mOnStageSignal;
1874 Dali::Actor::OffStageSignalType mOffStageSignal;
1875 Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
1877 Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
1879 std::string mName; ///< Name of the actor
1880 unsigned int mId; ///< A unique ID to identify the actor starting from 1, and 0 is reserved
1882 const bool mIsRoot : 1; ///< Flag to identify the root actor
1883 const bool mIsRenderable : 1; ///< Flag to identify that this is a renderable actor
1884 const bool mIsLayer : 1; ///< Flag to identify that this is a layer
1885 bool mIsOnStage : 1; ///< Flag to identify whether the actor is on-stage
1886 bool mIsDynamicsRoot : 1; ///< Flag to identify if this is the dynamics world root
1887 bool mSensitive : 1; ///< Whether the actor emits touch event signals
1888 bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
1889 bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
1890 bool mDerivedRequiresTouch : 1; ///< Whether the derived actor type requires touch event signals
1891 bool mDerivedRequiresHover : 1; ///< Whether the derived actor type requires hover event signals
1892 bool mDerivedRequiresMouseWheelEvent : 1; ///< Whether the derived actor type requires mouse wheel event signals
1893 bool mOnStageSignalled : 1; ///< Set to true before OnStageConnection signal is emitted, and false before OnStageDisconnection
1894 bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
1895 bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
1896 DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn
1897 PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited
1898 ColorMode mColorMode : 2; ///< Cached: Determines whether mWorldColor is inherited
1902 static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
1903 static unsigned int mActorCounter; ///< A counter to track the actor instance creation
1907 } // namespace Internal
1909 // Helpers for public-api forwarding methods
1911 inline Internal::Actor& GetImplementation( Dali::Actor& actor )
1913 DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
1915 BaseObject& handle = actor.GetBaseObject();
1917 return static_cast< Internal::Actor& >( handle );
1920 inline const Internal::Actor& GetImplementation( const Dali::Actor& actor )
1922 DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
1924 const BaseObject& handle = actor.GetBaseObject();
1926 return static_cast< const Internal::Actor& >( handle );
1931 #endif // __DALI_INTERNAL_ACTOR_H__