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/actors/actor.h>
26 #include <dali/public-api/common/vector-wrapper.h>
27 #include <dali/public-api/common/dali-common.h>
28 #include <dali/public-api/events/gesture.h>
29 #include <dali/public-api/math/viewport.h>
30 #include <dali/public-api/object/ref-object.h>
31 #include <dali/public-api/size-negotiation/relayout-container.h>
32 #include <dali/internal/event/actors/actor-declarations.h>
33 #include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
34 #include <dali/internal/event/common/object-impl.h>
35 #include <dali/internal/event/common/stage-def.h>
36 #include <dali/internal/event/rendering/renderer-impl.h>
37 #include <dali/internal/update/nodes/node-declarations.h>
51 class ActorGestureData;
56 typedef std::vector< ActorPtr > ActorContainer;
57 typedef ActorContainer::iterator ActorIter;
58 typedef ActorContainer::const_iterator ActorConstIter;
61 * Actor is the primary object which Dali applications interact with.
62 * UI controls can be built by combining multiple actors.
63 * Multi-Touch events are received through signals emitted by the actor tree.
65 * An Actor is a proxy for a Node in the scene graph.
66 * When an Actor is added to the Stage, it creates a node and attaches it to the scene graph.
67 * The scene-graph can be updated in a separate thread, so the attachment is done using an asynchronous message.
68 * When a tree of Actors is detached from the Stage, a message is sent to destroy the associated nodes.
70 class Actor : public Object
75 * @brief Struct to hold an actor and a dimension
77 struct ActorDimensionPair
82 * @param[in] newActor The actor to assign
83 * @param[in] newDimension The dimension to assign
85 ActorDimensionPair( Actor* newActor, Dimension::Type newDimension )
87 dimension( newDimension )
92 * @brief Equality operator
94 * @param[in] lhs The left hand side argument
95 * @param[in] rhs The right hand side argument
97 bool operator== ( const ActorDimensionPair& rhs )
99 return ( actor == rhs.actor ) && ( dimension == rhs.dimension );
102 Actor* actor; ///< The actor to hold
103 Dimension::Type dimension; ///< The dimension to hold
106 typedef std::vector< ActorDimensionPair > ActorDimensionStack;
111 * Create a new actor.
112 * @return A smart-pointer to the newly allocated Actor.
114 static ActorPtr New();
117 * Retrieve the name of the actor.
120 const std::string& GetName() const;
123 * Set the name of the actor.
124 * @param[in] name The new name.
126 void SetName( const std::string& name );
129 * @copydoc Dali::Actor::GetId
131 unsigned int GetId() const;
136 * Attach an object to an actor.
137 * @pre The actor does not already have an attachment.
138 * @param[in] attachment The object to attach.
140 void Attach( ActorAttachment& attachment );
143 * Retreive the object attached to an actor.
144 * @return The attachment.
146 ActorAttachmentPtr GetAttachment();
151 * Query whether an actor is the root actor, which is owned by the Stage.
152 * @return True if the actor is a root actor.
160 * Query whether the actor is connected to the Stage.
162 bool OnStage() const;
165 * Query whether the actor is a RenderableActor derived type.
166 * @return True if the actor is renderable.
168 bool IsRenderable() const
170 // inlined as this is called a lot in hit testing
171 return mIsRenderable;
175 * Query whether the actor is of class Dali::Layer
176 * @return True if the actor is a layer.
180 // inlined as this is called a lot in hit testing
185 * Gets the layer in which the actor is present
186 * @return The layer, which will be uninitialized if the actor is off-stage.
188 Dali::Layer GetLayer();
191 * Adds a child Actor to this Actor.
192 * @pre The child actor is not the same as the parent actor.
193 * @pre The child actor does not already have a parent.
194 * @param [in] child The child.
195 * @post The child will be referenced by its parent.
197 void Add( Actor& child );
200 * Inserts a child Actor to this Actor's child list
201 * @pre The child actor is not the same as the parent actor.
202 * @pre The child actor does not already have a parent.
203 * @param [in] index in childlist to insert child at
204 * @param [in] child The child.
205 * @post The child will be referenced by its parent.
207 void Insert( unsigned int index, Actor& child );
210 * Removes a child Actor from this Actor.
211 * @param [in] child The child.
212 * @post The child will be unreferenced.
214 void Remove( Actor& child );
217 * @copydoc Dali::Actor::Unparent
222 * Retrieve the number of children held by the actor.
223 * @return The number of children
225 unsigned int GetChildCount() const;
228 * @copydoc Dali::Actor::GetChildAt
230 ActorPtr GetChildAt( unsigned int index ) const;
233 * Retrieve a reference to Actor's children.
234 * @note Not for public use.
235 * @return A reference to the container of children.
237 ActorContainer& GetChildrenInternal()
243 * @copydoc Dali::Actor::FindChildByName
245 ActorPtr FindChildByName( const std::string& actorName );
248 * @copydoc Dali::Actor::FindChildById
250 ActorPtr FindChildById( const unsigned int id );
253 * Retrieve the parent of an Actor.
254 * @return The parent actor, or NULL if the Actor does not have a parent.
256 Actor* GetParent() const
262 * Sets the size of an actor.
263 * ActorAttachments attached to the actor, can be scaled to fit within this area.
264 * This does not interfere with the actors scale factor.
265 * @param [in] width The new width.
266 * @param [in] height The new height.
268 void SetSize( float width, float height );
271 * Sets the size of an actor.
272 * ActorAttachments attached to the actor, can be scaled to fit within this area.
273 * This does not interfere with the actors scale factor.
274 * @param [in] width The size of the actor along the x-axis.
275 * @param [in] height The size of the actor along the y-axis.
276 * @param [in] depth The size of the actor along the z-axis.
278 void SetSize( float width, float height, float depth );
281 * Sets the size of an actor.
282 * ActorAttachments attached to the actor, can be scaled to fit within this area.
283 * This does not interfere with the actors scale factor.
284 * @param [in] size The new size.
286 void SetSize( const Vector2& size );
289 * Sets the update size for an actor.
291 * @param[in] size The size to set.
293 void SetSizeInternal( const Vector2& size );
296 * Sets the size of an actor.
297 * ActorAttachments attached to the actor, can be scaled to fit within this area.
298 * This does not interfere with the actors scale factor.
299 * @param [in] size The new size.
301 void SetSize( const Vector3& size );
304 * Sets the update size for an actor.
306 * @param[in] size The size to set.
308 void SetSizeInternal( const Vector3& size );
311 * Set the width component of the Actor's size.
312 * @param [in] width The new width component.
314 void SetWidth( float width );
317 * Set the height component of the Actor's size.
318 * @param [in] height The new height component.
320 void SetHeight( float height );
323 * Set the depth component of the Actor's size.
324 * @param [in] depth The new depth component.
326 void SetDepth( float depth );
329 * Retrieve the Actor's size from event side.
330 * This size will be the size set or if animating then the target size.
331 * @return The Actor's size.
333 const Vector3& GetTargetSize() const;
336 * Retrieve the Actor's size from update side.
337 * This size will be the size set or animating but will be a frame behind.
338 * @return The Actor's size.
340 const Vector3& GetCurrentSize() const;
343 * Return the natural size of the actor
345 * @return The actor's natural size
347 virtual Vector3 GetNaturalSize() const;
350 * Set the origin of an actor, within its parent's area.
351 * This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
352 * and (1.0, 1.0, 0.5) is the bottom-right corner.
353 * The default parent-origin is top-left (0.0, 0.0, 0.5).
354 * An actor position is the distance between this origin, and the actors anchor-point.
355 * @param [in] origin The new parent-origin.
357 void SetParentOrigin( const Vector3& origin );
360 * Set the x component of the parent-origin
361 * @param [in] x The new x value.
363 void SetParentOriginX( float x );
366 * Set the y component of the parent-origin
367 * @param [in] y The new y value.
369 void SetParentOriginY( float y );
372 * Set the z component of the parent-origin
373 * @param [in] z The new z value.
375 void SetParentOriginZ( float z );
378 * Retrieve the parent-origin of an actor.
379 * @return The parent-origin.
381 const Vector3& GetCurrentParentOrigin() const;
384 * Set the anchor-point of an actor. This is expressed in 2D unit coordinates, such that
385 * (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.
386 * The default anchor point is top-left (0.0, 0.0, 0.5).
387 * An actor position is the distance between its parent-origin, and this anchor-point.
388 * An actor's rotation is centered around its anchor-point.
389 * @param [in] anchorPoint The new anchor-point.
391 void SetAnchorPoint( const Vector3& anchorPoint );
394 * Set the x component of the anchor-point.
395 * @param [in] x The new x value.
397 void SetAnchorPointX( float x );
400 * Set the y component of the anchor-point.
401 * @param [in] y The new y value.
403 void SetAnchorPointY( float y );
406 * Set the z component of the anchor-point.
407 * @param [in] z The new z value.
409 void SetAnchorPointZ( float z );
412 * Retrieve the anchor-point of an actor.
413 * @return The anchor-point.
415 const Vector3& GetCurrentAnchorPoint() const;
418 * Sets the position of the Actor.
419 * The coordinates are relative to the Actor's parent.
420 * The Actor's z position will be set to 0.0f.
421 * @param [in] x The new x position
422 * @param [in] y The new y position
424 void SetPosition( float x, float y );
427 * Sets the position of the Actor.
428 * The coordinates are relative to the Actor's parent.
429 * @param [in] x The new x position
430 * @param [in] y The new y position
431 * @param [in] z The new z position
433 void SetPosition( float x, float y, float z );
436 * Sets the position of the Actor.
437 * The coordinates are relative to the Actor's parent.
438 * @param [in] position The new position.
440 void SetPosition( const Vector3& position );
443 * Set the position of an actor along the X-axis.
444 * @param [in] x The new x position
446 void SetX( float x );
449 * Set the position of an actor along the Y-axis.
450 * @param [in] y The new y position.
452 void SetY( float y );
455 * Set the position of an actor along the Z-axis.
456 * @param [in] z The new z position
458 void SetZ( float z );
461 * Translate an actor relative to its existing position.
462 * @param[in] distance The actor will move by this distance.
464 void TranslateBy( const Vector3& distance );
467 * Retrieve the position of the Actor.
468 * The coordinates are relative to the Actor's parent.
469 * @return the Actor's position.
471 const Vector3& GetCurrentPosition() const;
474 * Retrieve the target position of the Actor.
475 * The coordinates are relative to the Actor's parent.
476 * @return the Actor's position.
478 const Vector3& GetTargetPosition() const;
481 * @copydoc Dali::Actor::GetCurrentWorldPosition()
483 const Vector3& GetCurrentWorldPosition() const;
486 * @copydoc Dali::Actor::SetPositionInheritanceMode()
488 void SetPositionInheritanceMode( PositionInheritanceMode mode );
491 * @copydoc Dali::Actor::GetPositionInheritanceMode()
493 PositionInheritanceMode GetPositionInheritanceMode() const;
496 * Sets the orientation of the Actor.
497 * @param [in] angleRadians The new orientation angle in radians.
498 * @param [in] axis The new axis of orientation.
500 void SetOrientation( const Radian& angleRadians, const Vector3& axis );
503 * Sets the orientation of the Actor.
504 * @param [in] orientation The new orientation.
506 void SetOrientation( const Quaternion& orientation );
509 * Rotate an actor around its existing rotation axis.
510 * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
511 * @param[in] axis The axis of the rotation to combine with the existing rotation.
513 void RotateBy( const Radian& angleRadians, const Vector3& axis );
516 * Apply a relative rotation to an actor.
517 * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
519 void RotateBy( const Quaternion& relativeRotation );
522 * Retreive the Actor's orientation.
523 * @return the orientation.
525 const Quaternion& GetCurrentOrientation() const;
528 * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
529 * Switching this off means that using SetOrientation() sets the actor's world orientation.
530 * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
532 void SetInheritOrientation( bool inherit );
535 * Returns whether the actor inherit's it's parent's orientation.
536 * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
538 bool IsOrientationInherited() const;
541 * Sets the factor of the parents size used for the child actor.
542 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
543 * @param[in] factor The vector to multiply the parents size by to get the childs size.
545 void SetSizeModeFactor( const Vector3& factor );
548 * Gets the factor of the parents size used for the child actor.
549 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
550 * @return The vector being used to multiply the parents size by to get the childs size.
552 const Vector3& GetSizeModeFactor() const;
555 * @copydoc Dali::Actor::GetCurrentWorldOrientation()
557 const Quaternion& GetCurrentWorldOrientation() const;
560 * Sets a scale factor applied to an actor.
561 * @param [in] scale The scale factor applied on all axes.
563 void SetScale( float scale );
566 * Sets a scale factor applied to an actor.
567 * @param [in] scaleX The scale factor applied along the x-axis.
568 * @param [in] scaleY The scale factor applied along the y-axis.
569 * @param [in] scaleZ The scale factor applied along the z-axis.
571 void SetScale( float scaleX, float scaleY, float scaleZ );
574 * Sets a scale factor applied to an actor.
575 * @param [in] scale A vector representing the scale factor for each axis.
577 void SetScale( const Vector3& scale );
580 * Set the x component of the scale factor.
581 * @param [in] x The new x value.
583 void SetScaleX( float x );
586 * Set the y component of the scale factor.
587 * @param [in] y The new y value.
589 void SetScaleY( float y );
592 * Set the z component of the scale factor.
593 * @param [in] z The new z value.
595 void SetScaleZ( float z );
598 * Apply a relative scale to an actor.
599 * @param[in] relativeScale The scale to combine with the actors existing scale.
601 void ScaleBy( const Vector3& relativeScale );
604 * Retrieve the scale factor applied to an actor.
605 * @return A vector representing the scale factor for each axis.
607 const Vector3& GetCurrentScale() const;
610 * @copydoc Dali::Actor::GetCurrentWorldScale()
612 const Vector3& GetCurrentWorldScale() const;
615 * @copydoc Dali::Actor::SetInheritScale()
617 void SetInheritScale( bool inherit );
620 * @copydoc Dali::Actor::IsScaleInherited()
622 bool IsScaleInherited() const;
625 * @copydoc Dali::Actor::GetCurrentWorldMatrix()
627 Matrix GetCurrentWorldMatrix() const;
632 * Sets the visibility flag of an actor.
633 * @param [in] visible The new visibility flag.
635 void SetVisible( bool visible );
638 * Retrieve the visibility flag of an actor.
639 * @return The visibility flag.
641 bool IsVisible() const;
644 * Sets the opacity of an actor.
645 * @param [in] opacity The new opacity.
647 void SetOpacity( float opacity );
650 * Retrieve the actor's opacity.
651 * @return The actor's opacity.
653 float GetCurrentOpacity() const;
656 * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
657 * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
658 * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
659 * hover event signal will be emitted.
661 * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
663 * actor.SetSensitive(false);
666 * Then, to re-enable the touch or hover event signal emission, the application should call:
668 * actor.SetSensitive(true);
671 * @see SignalTouch() and SignalHover().
672 * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
673 * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
675 void SetSensitive( bool sensitive )
677 mSensitive = sensitive;
681 * Query whether an actor emits touch or hover event signals.
682 * @see SetSensitive(bool)
683 * @return true, if emission of touch or hover event signals is enabled, false otherwise.
685 bool IsSensitive() const
691 * @copydoc Dali::Actor::SetDrawMode
693 void SetDrawMode( DrawMode::Type drawMode );
696 * @copydoc Dali::Actor::GetDrawMode
698 DrawMode::Type GetDrawMode() const;
701 * @copydoc Dali::Actor::SetOverlay
703 void SetOverlay( bool enable );
706 * @copydoc Dali::Actor::IsOverlay
708 bool IsOverlay() const;
711 * Sets the actor's color. The final color of actor depends on its color mode.
712 * This final color is applied to the drawable elements of an actor.
713 * @param [in] color The new color.
715 void SetColor( const Vector4& color );
718 * Set the red component of the color.
719 * @param [in] red The new red component.
721 void SetColorRed( float red );
724 * Set the green component of the color.
725 * @param [in] green The new green component.
727 void SetColorGreen( float green );
730 * Set the blue component of the scale factor.
731 * @param [in] blue The new blue value.
733 void SetColorBlue( float blue );
736 * Retrieve the actor's color.
739 const Vector4& GetCurrentColor() const;
742 * Sets the actor's color mode.
743 * Color mode specifies whether Actor uses its own color or inherits its parent color
744 * @param [in] colorMode to use.
746 void SetColorMode( ColorMode colorMode );
749 * Returns the actor's color mode.
750 * @return currently used colorMode.
752 ColorMode GetColorMode() const;
755 * @copydoc Dali::Actor::GetCurrentWorldColor()
757 const Vector4& GetCurrentWorldColor() const;
760 * @copydoc Dali::Actor::GetHierarchyDepth()
762 int GetHierarchyDepth() const
766 return static_cast<int>(mDepth);
774 // Size negotiation virtual functions
777 * @brief Called after the size negotiation has been finished for this control.
779 * The control is expected to assign this given size to itself/its children.
781 * Should be overridden by derived classes if they need to layout
782 * actors differently after certain operations like add or remove
783 * actors, resize or after changing specific properties.
785 * Note! As this function is called from inside the size negotiation algorithm, you cannot
786 * call RequestRelayout (the call would just be ignored)
788 * @param[in] size The allocated size.
789 * @param[in,out] container The control should add actors to this container that it is not able
790 * to allocate a size for.
792 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
797 * @brief Notification for deriving classes when the resize policy is set
799 * @param[in] policy The policy being set
800 * @param[in] dimension The dimension the policy is being set for
802 virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) {}
805 * @brief Virtual method to notify deriving classes that relayout dependencies have been
806 * met and the size for this object is about to be calculated for the given dimension
808 * @param dimension The dimension that is about to be calculated
810 virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
813 * @brief Virtual method to notify deriving classes that the size for a dimension
814 * has just been negotiated
816 * @param[in] size The new size for the given dimension
817 * @param[in] dimension The dimension that was just negotiated
819 virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
822 * @brief Determine if this actor is dependent on it's children for relayout
824 * @param dimension The dimension(s) to check for
825 * @return Return if the actor is dependent on it's children
827 virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
830 * @brief Determine if this actor is dependent on it's children for relayout.
832 * Called from deriving classes
834 * @param dimension The dimension(s) to check for
835 * @return Return if the actor is dependent on it's children
837 virtual bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
840 * @brief Calculate the size for a child
842 * @param[in] child The child actor to calculate the size for
843 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
844 * @return Return the calculated size for the given dimension
846 virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
849 * @brief This method is called during size negotiation when a height is required for a given width.
851 * Derived classes should override this if they wish to customize the height returned.
853 * @param width to use.
854 * @return the height based on the width.
856 virtual float GetHeightForWidth( float width );
859 * @brief This method is called during size negotiation when a width is required for a given height.
861 * Derived classes should override this if they wish to customize the width returned.
863 * @param height to use.
864 * @return the width based on the width.
866 virtual float GetWidthForHeight( float height );
873 * @brief Called by the RelayoutController to negotiate the size of an actor.
875 * The size allocated by the the algorithm is passed in which the
876 * actor must adhere to. A container is passed in as well which
877 * the actor should populate with actors it has not / or does not
878 * need to handle in its size negotiation.
880 * @param[in] size The allocated size.
881 * @param[in,out] container The container that holds actors that are fed back into the
882 * RelayoutController algorithm.
884 void NegotiateSize( const Vector2& size, RelayoutContainer& container );
887 * @copydoc Dali::Actor::SetResizePolicy()
889 void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
892 * @copydoc Dali::Actor::GetResizePolicy()
894 ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
897 * @copydoc Dali::Actor::SetSizeScalePolicy()
899 void SetSizeScalePolicy( SizeScalePolicy::Type policy );
902 * @copydoc Dali::Actor::GetSizeScalePolicy()
904 SizeScalePolicy::Type GetSizeScalePolicy() const;
907 * @copydoc Dali::Actor::SetDimensionDependency()
909 void SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency );
912 * @copydoc Dali::Actor::GetDimensionDependency()
914 Dimension::Type GetDimensionDependency( Dimension::Type dimension ) const;
917 * @brief Set the size negotiation relayout enabled on this actor
919 * @param[in] relayoutEnabled Boolean to enable or disable relayout
921 void SetRelayoutEnabled( bool relayoutEnabled );
924 * @brief Return if relayout is enabled
926 * @return Return if relayout is enabled or not for this actor
928 bool IsRelayoutEnabled() const;
931 * @brief Mark an actor as having it's layout dirty
933 * @param dirty Whether to mark actor as dirty or not
934 * @param dimension The dimension(s) to mark as dirty
936 void SetLayoutDirty( bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
939 * @brief Return if any of an actor's dimensions are marked as dirty
941 * @param dimension The dimension(s) to check
942 * @return Return if any of the requested dimensions are dirty
944 bool IsLayoutDirty( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
947 * @brief Returns if relayout is enabled and the actor is not dirty
949 * @return Return if it is possible to relayout the actor
951 bool RelayoutPossible( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
954 * @brief Returns if relayout is enabled and the actor is dirty
956 * @return Return if it is required to relayout the actor
958 bool RelayoutRequired( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
961 * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
963 * This method is automatically called from OnStageConnection(), OnChildAdd(),
964 * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
966 * This method can also be called from a derived class every time it needs a different size.
967 * At the end of event processing, the relayout process starts and
968 * all controls which requested Relayout will have their sizes (re)negotiated.
970 * @note RelayoutRequest() can be called multiple times; the size negotiation is still
971 * only performed once, i.e. there is no need to keep track of this in the calling side.
973 void RelayoutRequest( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
976 * @brief Determine if this actor is dependent on it's parent for relayout
978 * @param dimension The dimension(s) to check for
979 * @return Return if the actor is dependent on it's parent
981 bool RelayoutDependentOnParent( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
984 * @brief Determine if this actor has another dimension depedent on the specified one
986 * @param dimension The dimension to check for
987 * @param dependentDimension The dimension to check for dependency with
988 * @return Return if the actor is dependent on this dimension
990 bool RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension );
993 * Negotiate sizes for a control in all dimensions
995 * @param[in] allocatedSize The size constraint that the control must respect
997 void NegotiateDimensions( const Vector2& allocatedSize );
1000 * Negotiate size for a specific dimension
1002 * The algorithm adopts a recursive dependency checking approach. Meaning, that wherever dependencies
1003 * are found, e.g. an actor dependent on its parent, the dependency will be calculated first with NegotiatedDimension and
1004 * LayoutDimensionNegotiated flags being filled in on the actor.
1006 * @post All actors that exist in the dependency chain connected to the given actor will have had their NegotiatedDimensions
1007 * calculated and set as well as the LayoutDimensionNegotiated flags.
1009 * @param[in] dimension The dimension to negotiate on
1010 * @param[in] allocatedSize The size constraint that the actor must respect
1012 void NegotiateDimension( Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack );
1015 * @brief Calculate the size of a dimension
1017 * @param[in] dimension The dimension to calculate the size for
1018 * @param[in] maximumSize The upper bounds on the size
1019 * @return Return the calculated size for the dimension
1021 float CalculateSize( Dimension::Type dimension, const Vector2& maximumSize );
1024 * @brief Clamp a dimension given the relayout constraints on this actor
1026 * @param[in] size The size to constrain
1027 * @param[in] dimension The dimension the size exists in
1028 * @return Return the clamped size
1030 float ClampDimension( float size, Dimension::Type dimension );
1033 * Negotiate a dimension based on the size of the parent
1035 * @param[in] dimension The dimension to negotiate on
1036 * @return Return the negotiated size
1038 float NegotiateFromParent( Dimension::Type dimension );
1041 * Negotiate a dimension based on the size of the parent. Fitting inside.
1043 * @param[in] dimension The dimension to negotiate on
1044 * @return Return the negotiated size
1046 float NegotiateFromParentFit( Dimension::Type dimension );
1049 * Negotiate a dimension based on the size of the parent. Flooding the whole space.
1051 * @param[in] dimension The dimension to negotiate on
1052 * @return Return the negotiated size
1054 float NegotiateFromParentFlood( Dimension::Type dimension );
1057 * @brief Negotiate a dimension based on the size of the children
1059 * @param[in] dimension The dimension to negotiate on
1060 * @return Return the negotiated size
1062 float NegotiateFromChildren( Dimension::Type dimension );
1065 * Set the negotiated dimension value for the given dimension(s)
1067 * @param negotiatedDimension The value to set
1068 * @param dimension The dimension(s) to set the value for
1070 void SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1073 * Return the value of negotiated dimension for the given dimension
1075 * @param dimension The dimension to retrieve
1076 * @return Return the value of the negotiated dimension
1078 float GetNegotiatedDimension( Dimension::Type dimension ) const;
1081 * @brief Set the padding for a dimension
1083 * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
1084 * @param[in] dimension The dimension to set
1086 void SetPadding( const Vector2& padding, Dimension::Type dimension );
1089 * Return the value of padding for the given dimension
1091 * @param dimension The dimension to retrieve
1092 * @return Return the value of padding for the dimension
1094 Vector2 GetPadding( Dimension::Type dimension ) const;
1097 * Return the actor size for a given dimension
1099 * @param[in] dimension The dimension to retrieve the size for
1100 * @return Return the size for the given dimension
1102 float GetSize( Dimension::Type dimension ) const;
1105 * Return the natural size of the actor for a given dimension
1107 * @param[in] dimension The dimension to retrieve the size for
1108 * @return Return the natural size for the given dimension
1110 float GetNaturalSize( Dimension::Type dimension ) const;
1113 * @brief Return the amount of size allocated for relayout
1115 * May include padding
1117 * @param[in] dimension The dimension to retrieve
1118 * @return Return the size
1120 float GetRelayoutSize( Dimension::Type dimension ) const;
1123 * @brief If the size has been negotiated return that else return normal size
1125 * @param[in] dimension The dimension to retrieve
1126 * @return Return the size
1128 float GetLatestSize( Dimension::Type dimension ) const;
1131 * Apply the negotiated size to the actor
1133 * @param[in] container The container to fill with actors that require further relayout
1135 void SetNegotiatedSize( RelayoutContainer& container );
1138 * @brief Flag the actor as having it's layout dimension negotiated.
1140 * @param[in] negotiated The status of the flag to set.
1141 * @param[in] dimension The dimension to set the flag for
1143 void SetLayoutNegotiated( bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1146 * @brief Test whether the layout dimension for this actor has been negotiated or not.
1148 * @param[in] dimension The dimension to determine the value of the flag for
1149 * @return Return if the layout dimension is negotiated or not.
1151 bool IsLayoutNegotiated( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
1154 * @brief provides the Actor implementation of GetHeightForWidth
1155 * @param width to use.
1156 * @return the height based on the width.
1158 float GetHeightForWidthBase( float width );
1161 * @brief provides the Actor implementation of GetWidthForHeight
1162 * @param height to use.
1163 * @return the width based on the height.
1165 float GetWidthForHeightBase( float height );
1168 * @brief Calculate the size for a child
1170 * @param[in] child The child actor to calculate the size for
1171 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
1172 * @return Return the calculated size for the given dimension
1174 float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
1177 * @brief Set the preferred size for size negotiation
1179 * @param[in] size The preferred size to set
1181 void SetPreferredSize( const Vector2& size );
1184 * @brief Return the preferred size used for size negotiation
1186 * @return Return the preferred size
1188 Vector2 GetPreferredSize() const;
1191 * @copydoc Dali::Actor::SetMinimumSize
1193 void SetMinimumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1196 * @copydoc Dali::Actor::GetMinimumSize
1198 float GetMinimumSize( Dimension::Type dimension ) const;
1201 * @copydoc Dali::Actor::SetMaximumSize
1203 void SetMaximumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1206 * @copydoc Dali::Actor::GetMaximumSize
1208 float GetMaximumSize( Dimension::Type dimension ) const;
1211 * @copydoc Dali::Actor::AddRenderer()
1213 unsigned int AddRenderer( Renderer& renderer );
1216 * @copydoc Dali::Actor::GetRendererCount()
1218 unsigned int GetRendererCount() const;
1221 * @copydoc Dali::Actor::GetRendererAt()
1223 Renderer& GetRendererAt( unsigned int index );
1226 * @copydoc Dali::Actor::RemoveRenderer()
1228 void RemoveRenderer( Renderer& renderer );
1231 * @copydoc Dali::Actor::RemoveRenderer()
1233 void RemoveRenderer( unsigned int index );
1238 * Converts screen coordinates into the actor's coordinate system.
1239 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1240 * @param[out] localX On return, the X-coordinate relative to the actor.
1241 * @param[out] localY On return, the Y-coordinate relative to the actor.
1242 * @param[in] screenX The screen X-coordinate.
1243 * @param[in] screenY The screen Y-coordinate.
1244 * @return True if the conversion succeeded.
1246 bool ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const;
1249 * Converts screen coordinates into the actor's coordinate system.
1250 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1251 * @param[in] renderTask The render-task used to display the actor.
1252 * @param[out] localX On return, the X-coordinate relative to the actor.
1253 * @param[out] localY On return, the Y-coordinate relative to the actor.
1254 * @param[in] screenX The screen X-coordinate.
1255 * @param[in] screenY The screen Y-coordinate.
1256 * @return True if the conversion succeeded.
1258 bool ScreenToLocal( RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const;
1261 * Converts from the actor's coordinate system to screen coordinates.
1262 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1263 * @param[in] viewMatrix The view-matrix
1264 * @param[in] projectionMatrix The projection-matrix
1265 * @param[in] viewport The view-port
1266 * @param[out] localX On return, the X-coordinate relative to the actor.
1267 * @param[out] localY On return, the Y-coordinate relative to the actor.
1268 * @param[in] screenX The screen X-coordinate.
1269 * @param[in] screenY The screen Y-coordinate.
1270 * @return True if the conversion succeeded.
1272 bool ScreenToLocal( const Matrix& viewMatrix,
1273 const Matrix& projectionMatrix,
1274 const Viewport& viewport,
1278 float screenY ) const;
1281 * Performs a ray-sphere test with the given pick-ray and the actor's bounding sphere.
1282 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1283 * @param[in] rayOrigin The ray origin in the world's reference system.
1284 * @param[in] rayDir The ray director vector in the world's reference system.
1285 * @return True if the ray intersects the actor's bounding sphere.
1287 bool RaySphereTest( const Vector4& rayOrigin, const Vector4& rayDir ) const;
1290 * Performs a ray-actor test with the given pick-ray and the actor's geometry.
1291 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1292 * @param[in] rayOrigin The ray origin in the world's reference system.
1293 * @param[in] rayDir The ray director vector in the world's reference system.
1294 * @param[out] hitPointLocal The hit point in the Actor's local reference system.
1295 * @param[out] distance The distance from the hit point to the camera.
1296 * @return True if the ray intersects the actor's geometry.
1298 bool RayActorTest( const Vector4& rayOrigin,
1299 const Vector4& rayDir,
1300 Vector4& hitPointLocal,
1301 float& distance ) const;
1304 * Sets whether the actor should receive a notification when touch or hover motion events leave
1305 * the boundary of the actor.
1307 * @note By default, this is set to false as most actors do not require this.
1308 * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
1310 * @param[in] required Should be set to true if a Leave event is required
1312 void SetLeaveRequired( bool required );
1315 * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1316 * the boundary of the actor.
1317 * @return true if a Leave event is required, false otherwise.
1319 bool GetLeaveRequired() const;
1322 * @copydoc Dali::Actor::SetKeyboardFocusable()
1324 void SetKeyboardFocusable( bool focusable );
1327 * @copydoc Dali::Actor::IsKeyboardFocusable()
1329 bool IsKeyboardFocusable() const;
1332 * Query whether the application or derived actor type requires touch events.
1333 * @return True if touch events are required.
1335 bool GetTouchRequired() const;
1338 * Query whether the application or derived actor type requires hover events.
1339 * @return True if hover events are required.
1341 bool GetHoverRequired() const;
1344 * Query whether the application or derived actor type requires wheel events.
1345 * @return True if wheel events are required.
1347 bool GetWheelEventRequired() const;
1350 * Query whether the actor is actually hittable. This method checks whether the actor is
1351 * sensitive, has the visibility flag set to true and is not fully transparent.
1352 * @return true, if it can be hit, false otherwise.
1354 bool IsHittable() const;
1359 * Retrieve the gesture data associated with this actor. The first call to this method will
1360 * allocate space for the ActorGestureData so this should only be called if an actor really does
1362 * @return Reference to the ActorGestureData for this actor.
1363 * @note Once the gesture-data is created for an actor it is likely that gestures are required
1364 * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
1366 ActorGestureData& GetGestureData();
1369 * Queries whether the actor requires the gesture type.
1370 * @param[in] type The gesture type.
1372 bool IsGestureRequred( Gesture::Type type ) const;
1377 * Used by the EventProcessor to emit touch event signals.
1378 * @param[in] event The touch event.
1379 * @return True if the event was consumed.
1381 bool EmitTouchEventSignal( const TouchEvent& event );
1384 * Used by the EventProcessor to emit hover event signals.
1385 * @param[in] event The hover event.
1386 * @return True if the event was consumed.
1388 bool EmitHoverEventSignal( const HoverEvent& event );
1391 * Used by the EventProcessor to emit wheel event signals.
1392 * @param[in] event The wheel event.
1393 * @return True if the event was consumed.
1395 bool EmitWheelEventSignal( const WheelEvent& event );
1398 * @copydoc Dali::Actor::TouchedSignal()
1400 Dali::Actor::TouchSignalType& TouchedSignal();
1403 * @copydoc Dali::Actor::HoveredSignal()
1405 Dali::Actor::HoverSignalType& HoveredSignal();
1408 * @copydoc Dali::Actor::WheelEventSignal()
1410 Dali::Actor::WheelEventSignalType& WheelEventSignal();
1413 * @copydoc Dali::Actor::OnStageSignal()
1415 Dali::Actor::OnStageSignalType& OnStageSignal();
1418 * @copydoc Dali::Actor::OffStageSignal()
1420 Dali::Actor::OffStageSignalType& OffStageSignal();
1423 * @copydoc Dali::Actor::OnRelayoutSignal()
1425 Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal();
1428 * Connects a callback function with the object's signals.
1429 * @param[in] object The object providing the signal.
1430 * @param[in] tracker Used to disconnect the signal.
1431 * @param[in] signalName The signal to connect to.
1432 * @param[in] functor A newly allocated FunctorDelegate.
1433 * @return True if the signal was connected.
1434 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
1436 static bool DoConnectSignal( BaseObject* object,
1437 ConnectionTrackerInterface* tracker,
1438 const std::string& signalName,
1439 FunctorDelegate* functor );
1442 * Performs actions as requested using the action name.
1443 * @param[in] object The object on which to perform the action.
1444 * @param[in] actionName The action to perform.
1445 * @param[in] attributes The attributes with which to perfrom this action.
1446 * @return true if the action was done.
1448 static bool DoAction( BaseObject* object,
1449 const std::string& actionName,
1450 const Property::Map& attributes );
1456 * This should only be called by Animation, when the actors SIZE property is animated.
1458 * @param[in] animation The animation that resized the actor
1459 * @param[in] targetSize The new target size of the actor
1461 void NotifySizeAnimation( Animation& animation, const Vector3& targetSize );
1464 * This should only be called by Animation, when the actors SIZE_WIDTH or SIZE_HEIGHT property is animated.
1466 * @param[in] animation The animation that resized the actor
1467 * @param[in] targetSize The new target size of the actor
1469 void NotifySizeAnimation( Animation& animation, float targetSize, Property::Index property );
1472 * For use in derived classes.
1473 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1475 virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize )
1483 BASIC, RENDERABLE, LAYER, ROOT_LAYER
1487 * Protected Constructor. See Actor::New().
1488 * The second-phase construction Initialize() member should be called immediately after this.
1489 * @param[in] derivedType The derived type of actor (if any).
1491 Actor( DerivedType derivedType );
1494 * Second-phase constructor. Must be called immediately after creating a new Actor;
1496 void Initialize( void );
1499 * A reference counted object may only be deleted by calling Unreference()
1504 * Called on a child during Add() when the parent actor is connected to the Stage.
1505 * @param[in] stage The stage.
1506 * @param[in] parentDepth The depth of the parent in the hierarchy
1507 * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1509 void ConnectToStage( unsigned int parentDepth, int index = -1 );
1512 * Helper for ConnectToStage, to recursively connect a tree of actors.
1513 * This is atomic i.e. not interrupted by user callbacks.
1514 * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1515 * @param[in] depth The depth in the hierarchy of the actor
1516 * @param[out] connectionList On return, the list of connected actors which require notification.
1518 void RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth, int index = -1 );
1521 * Connect the Node associated with this Actor to the scene-graph.
1522 * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1524 void ConnectToSceneGraph( int index = -1 );
1527 * Helper for ConnectToStage, to notify a connected actor through the public API.
1529 void NotifyStageConnection();
1532 * Called on a child during Remove() when the actor was previously on the Stage.
1534 void DisconnectFromStage();
1537 * Helper for DisconnectFromStage, to recursively disconnect a tree of actors.
1538 * This is atomic i.e. not interrupted by user callbacks.
1539 * @param[out] disconnectionList On return, the list of disconnected actors which require notification.
1541 void RecursiveDisconnectFromStage( ActorContainer& disconnectionList );
1544 * Disconnect the Node associated with this Actor from the scene-graph.
1546 void DisconnectFromSceneGraph();
1549 * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1551 void NotifyStageDisconnection();
1554 * When the Actor is OnStage, checks whether the corresponding Node is connected to the scene graph.
1555 * @return True if the Actor is OnStage & has a Node connected to the scene graph.
1557 bool IsNodeConnected() const;
1560 * Calculate the size of the z dimension for a 2D size
1562 * @param[in] size The 2D size (X, Y) to calculate Z from
1564 * @return Return the Z dimension for this size
1566 float CalculateSizeZ( const Vector2& size ) const;
1569 // Default property extensions from Object
1572 * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
1574 virtual unsigned int GetDefaultPropertyCount() const;
1577 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
1579 virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
1582 * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
1584 virtual const char* GetDefaultPropertyName( Property::Index index ) const;
1587 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
1589 virtual Property::Index GetDefaultPropertyIndex( const std::string& name ) const;
1592 * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
1594 virtual bool IsDefaultPropertyWritable( Property::Index index ) const;
1597 * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
1599 virtual bool IsDefaultPropertyAnimatable( Property::Index index ) const;
1602 * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
1604 virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
1607 * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
1609 virtual Property::Type GetDefaultPropertyType( Property::Index index ) const;
1612 * @copydoc Dali::Internal::Object::SetDefaultProperty()
1614 virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue );
1617 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1619 virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
1622 * @copydoc Dali::Internal::Object::GetDefaultProperty()
1624 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
1627 * @copydoc Dali::Internal::Object::GetPropertyOwner()
1629 virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
1632 * @copydoc Dali::Internal::Object::GetSceneObject()
1634 virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
1637 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1639 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
1642 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1644 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
1647 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1649 virtual int GetPropertyComponentIndex( Property::Index index ) const;
1657 Actor( const Actor& );
1660 Actor& operator=( const Actor& rhs );
1663 * Set the actors parent.
1664 * @param[in] parent The new parent.
1665 * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1667 void SetParent( Actor* parent, int index = -1 );
1670 * Helper to create a Node for this Actor.
1671 * To be overriden in derived classes.
1672 * @return A newly allocated node.
1674 virtual SceneGraph::Node* CreateNode() const;
1677 * For use in derived classes, called after Initialize()
1679 virtual void OnInitialize()
1684 * For use in internal derived classes.
1685 * This is called during ConnectToStage(), after the actor has finished adding its node to the scene-graph.
1686 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1688 virtual void OnStageConnectionInternal()
1693 * For use in internal derived classes.
1694 * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1695 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1697 virtual void OnStageDisconnectionInternal()
1702 * For use in external (CustomActor) derived classes.
1703 * This is called after the atomic ConnectToStage() traversal has been completed.
1705 virtual void OnStageConnectionExternal( int depth )
1710 * For use in external (CustomActor) derived classes.
1711 * This is called after the atomic DisconnectFromStage() traversal has been completed.
1713 virtual void OnStageDisconnectionExternal()
1718 * For use in derived classes; this is called after Add() has added a child.
1719 * @param[in] child The child that was added.
1721 virtual void OnChildAdd( Actor& child )
1726 * For use in derived classes; this is called after Remove() has removed a child.
1727 * @param[in] child The child that was removed.
1729 virtual void OnChildRemove( Actor& child )
1734 * For use in derived classes.
1735 * This is called after SizeSet() has been called.
1737 virtual void OnSizeSet( const Vector3& targetSize )
1742 * For use in derived classes.
1743 * This is only called if mDerivedRequiresTouch is true, and the touch-signal was not consumed.
1744 * @param[in] event The touch event.
1745 * @return True if the event should be consumed.
1747 virtual bool OnTouchEvent( const TouchEvent& event )
1753 * For use in derived classes.
1754 * This is only called if mDerivedRequiresHover is true, and the hover-signal was not consumed.
1755 * @param[in] event The hover event.
1756 * @return True if the event should be consumed.
1758 virtual bool OnHoverEvent( const HoverEvent& event )
1764 * For use in derived classes.
1765 * This is only called if the wheel signal was not consumed.
1766 * @param[in] event The wheel event.
1767 * @return True if the event should be consumed.
1769 virtual bool OnWheelEvent( const WheelEvent& event )
1775 * @brief Ensure the relayout data is allocated
1777 void EnsureRelayoutData();
1780 * @brief Apply the size set policy to the input size
1782 * @param[in] size The size to apply the policy to
1783 * @return Return the adjusted size
1785 Vector2 ApplySizeSetPolicy( const Vector2 size );
1789 Actor* mParent; ///< Each actor (except the root) can have one parent
1790 ActorContainer* mChildren; ///< Container of referenced actors
1791 const SceneGraph::Node* mNode; ///< Not owned
1792 Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
1793 Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
1795 struct RelayoutData;
1796 RelayoutData* mRelayoutData; ///< Struct to hold optional collection of relayout variables
1798 ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
1800 ActorAttachmentPtr mAttachment; ///< Optional referenced attachment
1803 Dali::Actor::TouchSignalType mTouchedSignal;
1804 Dali::Actor::HoverSignalType mHoveredSignal;
1805 Dali::Actor::WheelEventSignalType mWheelEventSignal;
1806 Dali::Actor::OnStageSignalType mOnStageSignal;
1807 Dali::Actor::OffStageSignalType mOffStageSignal;
1808 Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
1810 Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
1811 Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
1813 std::string mName; ///< Name of the actor
1814 unsigned int mId; ///< A unique ID to identify the actor starting from 1, and 0 is reserved
1816 unsigned short mDepth :12; ///< Cached: The depth in the hierarchy of the actor. Only 4096 levels of depth are supported
1817 const bool mIsRoot : 1; ///< Flag to identify the root actor
1818 const bool mIsRenderable : 1; ///< Flag to identify that this is a renderable actor
1819 const bool mIsLayer : 1; ///< Flag to identify that this is a layer
1820 bool mIsOnStage : 1; ///< Flag to identify whether the actor is on-stage
1821 bool mSensitive : 1; ///< Whether the actor emits touch event signals
1822 bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
1823 bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
1824 bool mDerivedRequiresTouch : 1; ///< Whether the derived actor type requires touch event signals
1825 bool mDerivedRequiresHover : 1; ///< Whether the derived actor type requires hover event signals
1826 bool mDerivedRequiresWheelEvent : 1; ///< Whether the derived actor type requires wheel event signals
1827 bool mOnStageSignalled : 1; ///< Set to true before OnStageConnection signal is emitted, and false before OnStageDisconnection
1828 bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
1829 bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
1830 bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
1831 DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn
1832 PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited
1833 ColorMode mColorMode : 2; ///< Cached: Determines whether mWorldColor is inherited
1837 static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
1838 static unsigned int mActorCounter; ///< A counter to track the actor instance creation
1842 } // namespace Internal
1844 // Helpers for public-api forwarding methods
1846 inline Internal::Actor& GetImplementation( Dali::Actor& actor )
1848 DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
1850 BaseObject& handle = actor.GetBaseObject();
1852 return static_cast< Internal::Actor& >( handle );
1855 inline const Internal::Actor& GetImplementation( const Dali::Actor& actor )
1857 DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
1859 const BaseObject& handle = actor.GetBaseObject();
1861 return static_cast< const Internal::Actor& >( handle );
1866 #endif // __DALI_INTERNAL_ACTOR_H__