1 #ifndef DALI_INTERNAL_ACTOR_H
2 #define DALI_INTERNAL_ACTOR_H
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
25 #include <dali/public-api/actors/actor.h>
26 #include <dali/devel-api/actors/actor-devel.h>
27 #include <dali/public-api/common/vector-wrapper.h>
28 #include <dali/public-api/common/dali-common.h>
29 #include <dali/public-api/events/gesture.h>
30 #include <dali/public-api/math/viewport.h>
31 #include <dali/public-api/object/ref-object.h>
32 #include <dali/public-api/size-negotiation/relayout-container.h>
33 #include <dali/internal/event/actors/actor-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;
60 typedef std::vector< RendererPtr > RendererContainer;
61 typedef RendererContainer::iterator RendererIter;
64 * Actor is the primary object which Dali applications interact with.
65 * UI controls can be built by combining multiple actors.
66 * Multi-Touch events are received through signals emitted by the actor tree.
68 * An Actor is a proxy for a Node in the scene graph.
69 * When an Actor is added to the Stage, it creates a node and connects it to the scene graph.
70 * The scene-graph can be updated in a separate thread, so the connection is done using an asynchronous message.
71 * When a tree of Actors is detached from the Stage, a message is sent to destroy the associated nodes.
73 class Actor : public Object
78 * @brief Struct to hold an actor and a dimension
80 struct ActorDimensionPair
85 * @param[in] newActor The actor to assign
86 * @param[in] newDimension The dimension to assign
88 ActorDimensionPair( Actor* newActor, Dimension::Type newDimension )
90 dimension( newDimension )
95 * @brief Equality operator
97 * @param[in] lhs The left hand side argument
98 * @param[in] rhs The right hand side argument
100 bool operator== ( const ActorDimensionPair& rhs )
102 return ( actor == rhs.actor ) && ( dimension == rhs.dimension );
105 Actor* actor; ///< The actor to hold
106 Dimension::Type dimension; ///< The dimension to hold
109 typedef std::vector< ActorDimensionPair > ActorDimensionStack;
114 * Create a new actor.
115 * @return A smart-pointer to the newly allocated Actor.
117 static ActorPtr New();
120 * Retrieve the name of the actor.
123 const std::string& GetName() const;
126 * Set the name of the actor.
127 * @param[in] name The new name.
129 void SetName( const std::string& name );
132 * @copydoc Dali::Actor::GetId
134 unsigned int GetId() const;
139 * Query whether an actor is the root actor, which is owned by the Stage.
140 * @return True if the actor is a root actor.
148 * Query whether the actor is connected to the Stage.
150 bool OnStage() const;
153 * Query whether the actor has any renderers.
154 * @return True if the actor is renderable.
156 bool IsRenderable() const
158 // inlined as this is called a lot in hit testing
159 return mRenderers && !mRenderers->empty();
163 * Query whether the actor is of class Dali::Layer
164 * @return True if the actor is a layer.
168 // inlined as this is called a lot in hit testing
173 * Gets the layer in which the actor is present
174 * @return The layer, which will be uninitialized if the actor is off-stage.
176 Dali::Layer GetLayer();
179 * Adds a child Actor to this Actor.
180 * @pre The child actor is not the same as the parent actor.
181 * @pre The child actor does not already have a parent.
182 * @param [in] child The child.
183 * @post The child will be referenced by its parent.
185 void Add( Actor& child );
188 * Removes a child Actor from this Actor.
189 * @param [in] child The child.
190 * @post The child will be unreferenced.
192 void Remove( Actor& child );
195 * @copydoc Dali::Actor::Unparent
200 * Retrieve the number of children held by the actor.
201 * @return The number of children
203 unsigned int GetChildCount() const;
206 * @copydoc Dali::Actor::GetChildAt
208 ActorPtr GetChildAt( unsigned int index ) const;
211 * Retrieve a reference to Actor's children.
212 * @note Not for public use.
213 * @return A reference to the container of children.
214 * @note The internal container is lazily initialized so ensure you check the child count before using the value returned by this method.
216 ActorContainer& GetChildrenInternal()
222 * @copydoc Dali::Actor::FindChildByName
224 ActorPtr FindChildByName( const std::string& actorName );
227 * @copydoc Dali::Actor::FindChildById
229 ActorPtr FindChildById( const unsigned int id );
232 * Retrieve the parent of an Actor.
233 * @return The parent actor, or NULL if the Actor does not have a parent.
235 Actor* GetParent() const
241 * Sets the size of an actor.
242 * This does not interfere with the actors scale factor.
243 * @param [in] width The new width.
244 * @param [in] height The new height.
246 void SetSize( float width, float height );
249 * Sets the size of an actor.
250 * This does not interfere with the actors scale factor.
251 * @param [in] width The size of the actor along the x-axis.
252 * @param [in] height The size of the actor along the y-axis.
253 * @param [in] depth The size of the actor along the z-axis.
255 void SetSize( float width, float height, float depth );
258 * Sets the size of an actor.
259 * This does not interfere with the actors scale factor.
260 * @param [in] size The new size.
262 void SetSize( const Vector2& size );
265 * Sets the update size for an actor.
267 * @param[in] size The size to set.
269 void SetSizeInternal( const Vector2& size );
272 * Sets the size of an actor.
273 * This does not interfere with the actors scale factor.
274 * @param [in] size The new size.
276 void SetSize( const Vector3& size );
279 * Sets the update size for an actor.
281 * @param[in] size The size to set.
283 void SetSizeInternal( const Vector3& size );
286 * Set the width component of the Actor's size.
287 * @param [in] width The new width component.
289 void SetWidth( float width );
292 * Set the height component of the Actor's size.
293 * @param [in] height The new height component.
295 void SetHeight( float height );
298 * Set the depth component of the Actor's size.
299 * @param [in] depth The new depth component.
301 void SetDepth( float depth );
304 * Retrieve the Actor's size from event side.
305 * This size will be the size set or if animating then the target size.
306 * @return The Actor's size.
308 const Vector3& GetTargetSize() const;
311 * Retrieve the Actor's size from update side.
312 * This size will be the size set or animating but will be a frame behind.
313 * @return The Actor's size.
315 const Vector3& GetCurrentSize() const;
318 * Return the natural size of the actor
320 * @return The actor's natural size
322 virtual Vector3 GetNaturalSize() const;
325 * Set the origin of an actor, within its parent's area.
326 * This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
327 * and (1.0, 1.0, 0.5) is the bottom-right corner.
328 * The default parent-origin is top-left (0.0, 0.0, 0.5).
329 * An actor position is the distance between this origin, and the actors anchor-point.
330 * @param [in] origin The new parent-origin.
332 void SetParentOrigin( const Vector3& origin );
335 * Set the x component of the parent-origin
336 * @param [in] x The new x value.
338 void SetParentOriginX( float x );
341 * Set the y component of the parent-origin
342 * @param [in] y The new y value.
344 void SetParentOriginY( float y );
347 * Set the z component of the parent-origin
348 * @param [in] z The new z value.
350 void SetParentOriginZ( float z );
353 * Retrieve the parent-origin of an actor.
354 * @return The parent-origin.
356 const Vector3& GetCurrentParentOrigin() const;
359 * Set the anchor-point of an actor. This is expressed in 2D unit coordinates, such that
360 * (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.
361 * The default anchor point is top-left (0.0, 0.0, 0.5).
362 * An actor position is the distance between its parent-origin, and this anchor-point.
363 * An actor's rotation is centered around its anchor-point.
364 * @param [in] anchorPoint The new anchor-point.
366 void SetAnchorPoint( const Vector3& anchorPoint );
369 * Set the x component of the anchor-point.
370 * @param [in] x The new x value.
372 void SetAnchorPointX( float x );
375 * Set the y component of the anchor-point.
376 * @param [in] y The new y value.
378 void SetAnchorPointY( float y );
381 * Set the z component of the anchor-point.
382 * @param [in] z The new z value.
384 void SetAnchorPointZ( float z );
387 * Retrieve the anchor-point of an actor.
388 * @return The anchor-point.
390 const Vector3& GetCurrentAnchorPoint() const;
393 * Sets the position of the Actor.
394 * The coordinates are relative to the Actor's parent.
395 * The Actor's z position will be set to 0.0f.
396 * @param [in] x The new x position
397 * @param [in] y The new y position
399 void SetPosition( float x, float y );
402 * Sets the position of the Actor.
403 * The coordinates are relative to the Actor's parent.
404 * @param [in] x The new x position
405 * @param [in] y The new y position
406 * @param [in] z The new z position
408 void SetPosition( float x, float y, float z );
411 * Sets the position of the Actor.
412 * The coordinates are relative to the Actor's parent.
413 * @param [in] position The new position.
415 void SetPosition( const Vector3& position );
418 * Set the position of an actor along the X-axis.
419 * @param [in] x The new x position
421 void SetX( float x );
424 * Set the position of an actor along the Y-axis.
425 * @param [in] y The new y position.
427 void SetY( float y );
430 * Set the position of an actor along the Z-axis.
431 * @param [in] z The new z position
433 void SetZ( float z );
436 * Translate an actor relative to its existing position.
437 * @param[in] distance The actor will move by this distance.
439 void TranslateBy( const Vector3& distance );
442 * Retrieve the position of the Actor.
443 * The coordinates are relative to the Actor's parent.
444 * @return the Actor's position.
446 const Vector3& GetCurrentPosition() const;
449 * Retrieve the target position of the Actor.
450 * The coordinates are relative to the Actor's parent.
451 * @return the Actor's position.
453 const Vector3& GetTargetPosition() const;
456 * @copydoc Dali::Actor::GetCurrentWorldPosition()
458 const Vector3& GetCurrentWorldPosition() const;
461 * @copydoc Dali::Actor::SetPositionInheritanceMode()
463 void SetPositionInheritanceMode( PositionInheritanceMode mode );
466 * @copydoc Dali::Actor::GetPositionInheritanceMode()
468 PositionInheritanceMode GetPositionInheritanceMode() const;
471 * @copydoc Dali::Actor::SetInheritPosition()
473 void SetInheritPosition( bool inherit );
476 * @copydoc Dali::Actor::IsPositionInherited()
478 bool IsPositionInherited() const;
481 * Sets the orientation of the Actor.
482 * @param [in] angleRadians The new orientation angle in radians.
483 * @param [in] axis The new axis of orientation.
485 void SetOrientation( const Radian& angleRadians, const Vector3& axis );
488 * Sets the orientation of the Actor.
489 * @param [in] orientation The new orientation.
491 void SetOrientation( const Quaternion& orientation );
494 * Rotate an actor around its existing rotation axis.
495 * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
496 * @param[in] axis The axis of the rotation to combine with the existing rotation.
498 void RotateBy( const Radian& angleRadians, const Vector3& axis );
501 * Apply a relative rotation to an actor.
502 * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
504 void RotateBy( const Quaternion& relativeRotation );
507 * Retreive the Actor's orientation.
508 * @return the orientation.
510 const Quaternion& GetCurrentOrientation() const;
513 * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
514 * Switching this off means that using SetOrientation() sets the actor's world orientation.
515 * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
517 void SetInheritOrientation( bool inherit );
520 * Returns whether the actor inherit's it's parent's orientation.
521 * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
523 bool IsOrientationInherited() const;
526 * Sets the factor of the parents size used for the child actor.
527 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
528 * @param[in] factor The vector to multiply the parents size by to get the childs size.
530 void SetSizeModeFactor( const Vector3& factor );
533 * Gets the factor of the parents size used for the child actor.
534 * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
535 * @return The vector being used to multiply the parents size by to get the childs size.
537 const Vector3& GetSizeModeFactor() const;
540 * @copydoc Dali::Actor::GetCurrentWorldOrientation()
542 const Quaternion& GetCurrentWorldOrientation() const;
545 * Sets a scale factor applied to an actor.
546 * @param [in] scale The scale factor applied on all axes.
548 void SetScale( float scale );
551 * Sets a scale factor applied to an actor.
552 * @param [in] scaleX The scale factor applied along the x-axis.
553 * @param [in] scaleY The scale factor applied along the y-axis.
554 * @param [in] scaleZ The scale factor applied along the z-axis.
556 void SetScale( float scaleX, float scaleY, float scaleZ );
559 * Sets a scale factor applied to an actor.
560 * @param [in] scale A vector representing the scale factor for each axis.
562 void SetScale( const Vector3& scale );
565 * Set the x component of the scale factor.
566 * @param [in] x The new x value.
568 void SetScaleX( float x );
571 * Set the y component of the scale factor.
572 * @param [in] y The new y value.
574 void SetScaleY( float y );
577 * Set the z component of the scale factor.
578 * @param [in] z The new z value.
580 void SetScaleZ( float z );
583 * Apply a relative scale to an actor.
584 * @param[in] relativeScale The scale to combine with the actors existing scale.
586 void ScaleBy( const Vector3& relativeScale );
589 * Retrieve the scale factor applied to an actor.
590 * @return A vector representing the scale factor for each axis.
592 const Vector3& GetCurrentScale() const;
595 * @copydoc Dali::Actor::GetCurrentWorldScale()
597 const Vector3& GetCurrentWorldScale() const;
600 * @copydoc Dali::Actor::SetInheritScale()
602 void SetInheritScale( bool inherit );
605 * @copydoc Dali::Actor::IsScaleInherited()
607 bool IsScaleInherited() const;
610 * @copydoc Dali::Actor::GetCurrentWorldMatrix()
612 Matrix GetCurrentWorldMatrix() const;
617 * Sets the visibility flag of an actor.
618 * @param [in] visible The new visibility flag.
620 void SetVisible( bool visible );
623 * Retrieve the visibility flag of an actor.
624 * @return The visibility flag.
626 bool IsVisible() const;
629 * Sets the opacity of an actor.
630 * @param [in] opacity The new opacity.
632 void SetOpacity( float opacity );
635 * Retrieve the actor's opacity.
636 * @return The actor's opacity.
638 float GetCurrentOpacity() const;
641 * Retrieve the actor's clipping mode.
642 * @return The actor's clipping mode (cached)
644 ClippingMode::Type GetClippingMode() const;
647 * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
648 * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
649 * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
650 * hover event signal will be emitted.
652 * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
654 * actor.SetSensitive(false);
657 * Then, to re-enable the touch or hover event signal emission, the application should call:
659 * actor.SetSensitive(true);
662 * @see SignalTouch() and SignalHover().
663 * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
664 * @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
666 void SetSensitive( bool sensitive )
668 mSensitive = sensitive;
672 * Query whether an actor emits touch or hover event signals.
673 * @see SetSensitive(bool)
674 * @return true, if emission of touch or hover event signals is enabled, false otherwise.
676 bool IsSensitive() const
682 * @copydoc Dali::Actor::SetDrawMode
684 void SetDrawMode( DrawMode::Type drawMode );
687 * @copydoc Dali::Actor::GetDrawMode
689 DrawMode::Type GetDrawMode() const;
692 * @copydoc Dali::Actor::IsOverlay
694 bool IsOverlay() const;
697 * Sets the actor's color. The final color of actor depends on its color mode.
698 * This final color is applied to the drawable elements of an actor.
699 * @param [in] color The new color.
701 void SetColor( const Vector4& color );
704 * Set the red component of the color.
705 * @param [in] red The new red component.
707 void SetColorRed( float red );
710 * Set the green component of the color.
711 * @param [in] green The new green component.
713 void SetColorGreen( float green );
716 * Set the blue component of the scale factor.
717 * @param [in] blue The new blue value.
719 void SetColorBlue( float blue );
722 * Retrieve the actor's color.
725 const Vector4& GetCurrentColor() const;
728 * Sets the actor's color mode.
729 * Color mode specifies whether Actor uses its own color or inherits its parent color
730 * @param [in] colorMode to use.
732 void SetColorMode( ColorMode colorMode );
735 * Returns the actor's color mode.
736 * @return currently used colorMode.
738 ColorMode GetColorMode() const;
741 * @copydoc Dali::Actor::GetCurrentWorldColor()
743 const Vector4& GetCurrentWorldColor() const;
746 * @copydoc Dali::Actor::GetHierarchyDepth()
748 inline int GetHierarchyDepth() const
752 return static_cast<int>(mDepth);
759 * Get the actor's sorting depth (The hierarchy depth combined with
762 * @return The depth used for hit-testing and renderer sorting
764 unsigned int GetSortingDepth();
768 // Size negotiation virtual functions
771 * @brief Called after the size negotiation has been finished for this control.
773 * The control is expected to assign this given size to itself/its children.
775 * Should be overridden by derived classes if they need to layout
776 * actors differently after certain operations like add or remove
777 * actors, resize or after changing specific properties.
779 * Note! As this function is called from inside the size negotiation algorithm, you cannot
780 * call RequestRelayout (the call would just be ignored)
782 * @param[in] size The allocated size.
783 * @param[in,out] container The control should add actors to this container that it is not able
784 * to allocate a size for.
786 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
791 * @brief Notification for deriving classes when the resize policy is set
793 * @param[in] policy The policy being set
794 * @param[in] dimension The dimension the policy is being set for
796 virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) {}
799 * @brief Virtual method to notify deriving classes that relayout dependencies have been
800 * met and the size for this object is about to be calculated for the given dimension
802 * @param dimension The dimension that is about to be calculated
804 virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
807 * @brief Virtual method to notify deriving classes that the size for a dimension
808 * has just been negotiated
810 * @param[in] size The new size for the given dimension
811 * @param[in] dimension The dimension that was just negotiated
813 virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
816 * @brief Determine if this actor is dependent on it's children for relayout
818 * @param dimension The dimension(s) to check for
819 * @return Return if the actor is dependent on it's children
821 virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
824 * @brief Determine if this actor is dependent on it's children for relayout.
826 * Called from deriving classes
828 * @param dimension The dimension(s) to check for
829 * @return Return if the actor is dependent on it's children
831 virtual bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
834 * @brief Calculate the size for a child
836 * @param[in] child The child actor to calculate the size for
837 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
838 * @return Return the calculated size for the given dimension
840 virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
843 * @brief This method is called during size negotiation when a height is required for a given width.
845 * Derived classes should override this if they wish to customize the height returned.
847 * @param width to use.
848 * @return the height based on the width.
850 virtual float GetHeightForWidth( float width );
853 * @brief This method is called during size negotiation when a width is required for a given height.
855 * Derived classes should override this if they wish to customize the width returned.
857 * @param height to use.
858 * @return the width based on the width.
860 virtual float GetWidthForHeight( float height );
867 * @brief Called by the RelayoutController to negotiate the size of an actor.
869 * The size allocated by the the algorithm is passed in which the
870 * actor must adhere to. A container is passed in as well which
871 * the actor should populate with actors it has not / or does not
872 * need to handle in its size negotiation.
874 * @param[in] size The allocated size.
875 * @param[in,out] container The container that holds actors that are fed back into the
876 * RelayoutController algorithm.
878 void NegotiateSize( const Vector2& size, RelayoutContainer& container );
881 * @copydoc Dali::Actor::SetResizePolicy()
883 void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
886 * @copydoc Dali::Actor::GetResizePolicy()
888 ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
891 * @copydoc Dali::Actor::SetSizeScalePolicy()
893 void SetSizeScalePolicy( SizeScalePolicy::Type policy );
896 * @copydoc Dali::Actor::GetSizeScalePolicy()
898 SizeScalePolicy::Type GetSizeScalePolicy() const;
901 * @copydoc Dali::Actor::SetDimensionDependency()
903 void SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency );
906 * @copydoc Dali::Actor::GetDimensionDependency()
908 Dimension::Type GetDimensionDependency( Dimension::Type dimension ) const;
911 * @brief Set the size negotiation relayout enabled on this actor
913 * @param[in] relayoutEnabled Boolean to enable or disable relayout
915 void SetRelayoutEnabled( bool relayoutEnabled );
918 * @brief Return if relayout is enabled
920 * @return Return if relayout is enabled or not for this actor
922 bool IsRelayoutEnabled() const;
925 * @brief Mark an actor as having it's layout dirty
927 * @param dirty Whether to mark actor as dirty or not
928 * @param dimension The dimension(s) to mark as dirty
930 void SetLayoutDirty( bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
933 * @brief Return if any of an actor's dimensions are marked as dirty
935 * @param dimension The dimension(s) to check
936 * @return Return if any of the requested dimensions are dirty
938 bool IsLayoutDirty( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
941 * @brief Returns if relayout is enabled and the actor is not dirty
943 * @return Return if it is possible to relayout the actor
945 bool RelayoutPossible( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
948 * @brief Returns if relayout is enabled and the actor is dirty
950 * @return Return if it is required to relayout the actor
952 bool RelayoutRequired( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
955 * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
957 * This method is automatically called from OnStageConnection(), OnChildAdd(),
958 * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
960 * This method can also be called from a derived class every time it needs a different size.
961 * At the end of event processing, the relayout process starts and
962 * all controls which requested Relayout will have their sizes (re)negotiated.
964 * @note RelayoutRequest() can be called multiple times; the size negotiation is still
965 * only performed once, i.e. there is no need to keep track of this in the calling side.
967 void RelayoutRequest( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
970 * @brief Determine if this actor is dependent on it's parent for relayout
972 * @param dimension The dimension(s) to check for
973 * @return Return if the actor is dependent on it's parent
975 bool RelayoutDependentOnParent( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
978 * @brief Determine if this actor has another dimension depedent on the specified one
980 * @param dimension The dimension to check for
981 * @param dependentDimension The dimension to check for dependency with
982 * @return Return if the actor is dependent on this dimension
984 bool RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension );
987 * Negotiate sizes for a control in all dimensions
989 * @param[in] allocatedSize The size constraint that the control must respect
991 void NegotiateDimensions( const Vector2& allocatedSize );
994 * Negotiate size for a specific dimension
996 * The algorithm adopts a recursive dependency checking approach. Meaning, that wherever dependencies
997 * are found, e.g. an actor dependent on its parent, the dependency will be calculated first with NegotiatedDimension and
998 * LayoutDimensionNegotiated flags being filled in on the actor.
1000 * @post All actors that exist in the dependency chain connected to the given actor will have had their NegotiatedDimensions
1001 * calculated and set as well as the LayoutDimensionNegotiated flags.
1003 * @param[in] dimension The dimension to negotiate on
1004 * @param[in] allocatedSize The size constraint that the actor must respect
1006 void NegotiateDimension( Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack );
1009 * @brief Calculate the size of a dimension
1011 * @param[in] dimension The dimension to calculate the size for
1012 * @param[in] maximumSize The upper bounds on the size
1013 * @return Return the calculated size for the dimension
1015 float CalculateSize( Dimension::Type dimension, const Vector2& maximumSize );
1018 * @brief Clamp a dimension given the relayout constraints on this actor
1020 * @param[in] size The size to constrain
1021 * @param[in] dimension The dimension the size exists in
1022 * @return Return the clamped size
1024 float ClampDimension( float size, Dimension::Type dimension );
1027 * Negotiate a dimension based on the size of the parent
1029 * @param[in] dimension The dimension to negotiate on
1030 * @return Return the negotiated size
1032 float NegotiateFromParent( Dimension::Type dimension );
1035 * Negotiate a dimension based on the size of the parent. Fitting inside.
1037 * @param[in] dimension The dimension to negotiate on
1038 * @return Return the negotiated size
1040 float NegotiateFromParentFit( Dimension::Type dimension );
1043 * Negotiate a dimension based on the size of the parent. Flooding the whole space.
1045 * @param[in] dimension The dimension to negotiate on
1046 * @return Return the negotiated size
1048 float NegotiateFromParentFlood( Dimension::Type dimension );
1051 * @brief Negotiate a dimension based on the size of the children
1053 * @param[in] dimension The dimension to negotiate on
1054 * @return Return the negotiated size
1056 float NegotiateFromChildren( Dimension::Type dimension );
1059 * Set the negotiated dimension value for the given dimension(s)
1061 * @param negotiatedDimension The value to set
1062 * @param dimension The dimension(s) to set the value for
1064 void SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1067 * Return the value of negotiated dimension for the given dimension
1069 * @param dimension The dimension to retrieve
1070 * @return Return the value of the negotiated dimension
1072 float GetNegotiatedDimension( Dimension::Type dimension ) const;
1075 * @brief Set the padding for a dimension
1077 * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
1078 * @param[in] dimension The dimension to set
1080 void SetPadding( const Vector2& padding, Dimension::Type dimension );
1083 * Return the value of padding for the given dimension
1085 * @param dimension The dimension to retrieve
1086 * @return Return the value of padding for the dimension
1088 Vector2 GetPadding( Dimension::Type dimension ) const;
1091 * Return the actor size for a given dimension
1093 * @param[in] dimension The dimension to retrieve the size for
1094 * @return Return the size for the given dimension
1096 float GetSize( Dimension::Type dimension ) const;
1099 * Return the natural size of the actor for a given dimension
1101 * @param[in] dimension The dimension to retrieve the size for
1102 * @return Return the natural size for the given dimension
1104 float GetNaturalSize( Dimension::Type dimension ) const;
1107 * @brief Return the amount of size allocated for relayout
1109 * May include padding
1111 * @param[in] dimension The dimension to retrieve
1112 * @return Return the size
1114 float GetRelayoutSize( Dimension::Type dimension ) const;
1117 * @brief If the size has been negotiated return that else return normal size
1119 * @param[in] dimension The dimension to retrieve
1120 * @return Return the size
1122 float GetLatestSize( Dimension::Type dimension ) const;
1125 * Apply the negotiated size to the actor
1127 * @param[in] container The container to fill with actors that require further relayout
1129 void SetNegotiatedSize( RelayoutContainer& container );
1132 * @brief Flag the actor as having it's layout dimension negotiated.
1134 * @param[in] negotiated The status of the flag to set.
1135 * @param[in] dimension The dimension to set the flag for
1137 void SetLayoutNegotiated( bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1140 * @brief Test whether the layout dimension for this actor has been negotiated or not.
1142 * @param[in] dimension The dimension to determine the value of the flag for
1143 * @return Return if the layout dimension is negotiated or not.
1145 bool IsLayoutNegotiated( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
1148 * @brief provides the Actor implementation of GetHeightForWidth
1149 * @param width to use.
1150 * @return the height based on the width.
1152 float GetHeightForWidthBase( float width );
1155 * @brief provides the Actor implementation of GetWidthForHeight
1156 * @param height to use.
1157 * @return the width based on the height.
1159 float GetWidthForHeightBase( float height );
1162 * @brief Calculate the size for a child
1164 * @param[in] child The child actor to calculate the size for
1165 * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
1166 * @return Return the calculated size for the given dimension
1168 float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
1171 * @brief Set the preferred size for size negotiation
1173 * @param[in] size The preferred size to set
1175 void SetPreferredSize( const Vector2& size );
1178 * @brief Return the preferred size used for size negotiation
1180 * @return Return the preferred size
1182 Vector2 GetPreferredSize() const;
1185 * @copydoc Dali::Actor::SetMinimumSize
1187 void SetMinimumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1190 * @copydoc Dali::Actor::GetMinimumSize
1192 float GetMinimumSize( Dimension::Type dimension ) const;
1195 * @copydoc Dali::Actor::SetMaximumSize
1197 void SetMaximumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
1200 * @copydoc Dali::Actor::GetMaximumSize
1202 float GetMaximumSize( Dimension::Type dimension ) const;
1205 * @copydoc Dali::Actor::AddRenderer()
1207 unsigned int AddRenderer( Renderer& renderer );
1210 * @copydoc Dali::Actor::GetRendererCount()
1212 unsigned int GetRendererCount() const;
1215 * @copydoc Dali::Actor::GetRendererAt()
1217 RendererPtr GetRendererAt( unsigned int index );
1220 * @copydoc Dali::Actor::RemoveRenderer()
1222 void RemoveRenderer( Renderer& renderer );
1225 * @copydoc Dali::Actor::RemoveRenderer()
1227 void RemoveRenderer( unsigned int index );
1232 * Converts screen coordinates into the actor's coordinate system.
1233 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1234 * @param[out] localX On return, the X-coordinate relative to the actor.
1235 * @param[out] localY On return, the Y-coordinate relative to the actor.
1236 * @param[in] screenX The screen X-coordinate.
1237 * @param[in] screenY The screen Y-coordinate.
1238 * @return True if the conversion succeeded.
1240 bool ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const;
1243 * Converts screen coordinates into the actor's coordinate system.
1244 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1245 * @param[in] renderTask The render-task used to display the actor.
1246 * @param[out] localX On return, the X-coordinate relative to the actor.
1247 * @param[out] localY On return, the Y-coordinate relative to the actor.
1248 * @param[in] screenX The screen X-coordinate.
1249 * @param[in] screenY The screen Y-coordinate.
1250 * @return True if the conversion succeeded.
1252 bool ScreenToLocal( const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const;
1255 * Converts from the actor's coordinate system to screen coordinates.
1256 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1257 * @param[in] viewMatrix The view-matrix
1258 * @param[in] projectionMatrix The projection-matrix
1259 * @param[in] viewport The view-port
1260 * @param[out] localX On return, the X-coordinate relative to the actor.
1261 * @param[out] localY On return, the Y-coordinate relative to the actor.
1262 * @param[in] screenX The screen X-coordinate.
1263 * @param[in] screenY The screen Y-coordinate.
1264 * @return True if the conversion succeeded.
1266 bool ScreenToLocal( const Matrix& viewMatrix,
1267 const Matrix& projectionMatrix,
1268 const Viewport& viewport,
1272 float screenY ) const;
1275 * Performs a ray-sphere test with the given pick-ray and the actor's bounding sphere.
1276 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1277 * @param[in] rayOrigin The ray origin in the world's reference system.
1278 * @param[in] rayDir The ray director vector in the world's reference system.
1279 * @return True if the ray intersects the actor's bounding sphere.
1281 bool RaySphereTest( const Vector4& rayOrigin, const Vector4& rayDir ) const;
1284 * Performs a ray-actor test with the given pick-ray and the actor's geometry.
1285 * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1286 * @param[in] rayOrigin The ray origin in the world's reference system.
1287 * @param[in] rayDir The ray director vector in the world's reference system.
1288 * @param[out] hitPointLocal The hit point in the Actor's local reference system.
1289 * @param[out] distance The distance from the hit point to the camera.
1290 * @return True if the ray intersects the actor's geometry.
1292 bool RayActorTest( const Vector4& rayOrigin,
1293 const Vector4& rayDir,
1294 Vector2& hitPointLocal,
1295 float& distance ) const;
1298 * Sets whether the actor should receive a notification when touch or hover motion events leave
1299 * the boundary of the actor.
1301 * @note By default, this is set to false as most actors do not require this.
1302 * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
1304 * @param[in] required Should be set to true if a Leave event is required
1306 void SetLeaveRequired( bool required );
1309 * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1310 * the boundary of the actor.
1311 * @return true if a Leave event is required, false otherwise.
1313 bool GetLeaveRequired() const;
1316 * @copydoc Dali::Actor::SetKeyboardFocusable()
1318 void SetKeyboardFocusable( bool focusable );
1321 * @copydoc Dali::Actor::IsKeyboardFocusable()
1323 bool IsKeyboardFocusable() const;
1326 * Query whether the application or derived actor type requires touch events.
1327 * @return True if touch events are required.
1329 bool GetTouchRequired() const;
1332 * Query whether the application or derived actor type requires hover events.
1333 * @return True if hover events are required.
1335 bool GetHoverRequired() const;
1338 * Query whether the application or derived actor type requires wheel events.
1339 * @return True if wheel events are required.
1341 bool GetWheelEventRequired() const;
1344 * Query whether the actor is actually hittable. This method checks whether the actor is
1345 * sensitive, has the visibility flag set to true and is not fully transparent.
1346 * @return true, if it can be hit, false otherwise.
1348 bool IsHittable() const;
1353 * Retrieve the gesture data associated with this actor. The first call to this method will
1354 * allocate space for the ActorGestureData so this should only be called if an actor really does
1356 * @return Reference to the ActorGestureData for this actor.
1357 * @note Once the gesture-data is created for an actor it is likely that gestures are required
1358 * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
1360 ActorGestureData& GetGestureData();
1363 * Queries whether the actor requires the gesture type.
1364 * @param[in] type The gesture type.
1366 bool IsGestureRequred( Gesture::Type type ) const;
1371 * Used by the EventProcessor to emit touch event signals.
1372 * @param[in] event The touch event (Old API).
1373 * @param[in] touch The touch data.
1374 * @return True if the event was consumed.
1376 bool EmitTouchEventSignal( const TouchEvent& event, const Dali::TouchData& touch );
1379 * Used by the EventProcessor to emit hover event signals.
1380 * @param[in] event The hover event.
1381 * @return True if the event was consumed.
1383 bool EmitHoverEventSignal( const HoverEvent& event );
1386 * Used by the EventProcessor to emit wheel event signals.
1387 * @param[in] event The wheel event.
1388 * @return True if the event was consumed.
1390 bool EmitWheelEventSignal( const WheelEvent& event );
1393 * @brief Emits the visibility change signal for this actor and all its children.
1394 * @param[in] visible Whether the actor has become visible or not.
1395 * @param[in] type Whether the actor's visible property has changed or a parent's.
1397 void EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityChange::Type type );
1400 * @copydoc Dali::Actor::TouchedSignal()
1402 Dali::Actor::TouchSignalType& TouchedSignal();
1405 * @copydoc Dali::Actor::TouchEventSignal()
1407 Dali::Actor::TouchDataSignalType& TouchSignal();
1410 * @copydoc Dali::Actor::HoveredSignal()
1412 Dali::Actor::HoverSignalType& HoveredSignal();
1415 * @copydoc Dali::Actor::WheelEventSignal()
1417 Dali::Actor::WheelEventSignalType& WheelEventSignal();
1420 * @copydoc Dali::Actor::OnStageSignal()
1422 Dali::Actor::OnStageSignalType& OnStageSignal();
1425 * @copydoc Dali::Actor::OffStageSignal()
1427 Dali::Actor::OffStageSignalType& OffStageSignal();
1430 * @copydoc Dali::Actor::OnRelayoutSignal()
1432 Dali::Actor::OnRelayoutSignalType& OnRelayoutSignal();
1435 * @copydoc DevelActor::VisibilityChangedSignal
1437 DevelActor::VisibilityChangedSignalType& VisibilityChangedSignal();
1440 * Connects a callback function with the object's signals.
1441 * @param[in] object The object providing the signal.
1442 * @param[in] tracker Used to disconnect the signal.
1443 * @param[in] signalName The signal to connect to.
1444 * @param[in] functor A newly allocated FunctorDelegate.
1445 * @return True if the signal was connected.
1446 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
1448 static bool DoConnectSignal( BaseObject* object,
1449 ConnectionTrackerInterface* tracker,
1450 const std::string& signalName,
1451 FunctorDelegate* functor );
1454 * Performs actions as requested using the action name.
1455 * @param[in] object The object on which to perform the action.
1456 * @param[in] actionName The action to perform.
1457 * @param[in] attributes The attributes with which to perfrom this action.
1458 * @return true if the action was done.
1460 static bool DoAction( BaseObject* object,
1461 const std::string& actionName,
1462 const Property::Map& attributes );
1468 * This should only be called by Animation, when the actors SIZE property is animated.
1470 * @param[in] animation The animation that resized the actor
1471 * @param[in] targetSize The new target size of the actor
1473 void NotifySizeAnimation( Animation& animation, const Vector3& targetSize );
1476 * This should only be called by Animation, when the actors SIZE_WIDTH or SIZE_HEIGHT or SIZE_DEPTH property is animated.
1478 * @param[in] animation The animation that resized the actor
1479 * @param[in] targetSize The new target size of the actor
1480 * @param[in] property The index of the property being animated
1482 void NotifySizeAnimation( Animation& animation, float targetSize, Property::Index property );
1485 * For use in derived classes.
1486 * This should only be called by Animation, when the actor is resized using Animation::Resize().
1488 virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize )
1493 * This should only be called by Animation, when the actors POSITION property is animated.
1495 * @param[in] animation The animation that repositioned the actor
1496 * @param[in] targetPosition The new target position of the actor
1498 void NotifyPositionAnimation( Animation& animation, const Vector3& targetPosition );
1501 * This should only be called by Animation, when the actors POSITION_X or POSITION_Y or POSITION_Z property is animated.
1503 * @param[in] animation The animation that repositioned the actor
1504 * @param[in] targetPosition The new target position of the actor
1505 * @param[in] property The index of the property being animated
1507 void NotifyPositionAnimation( Animation& animation, float targetPosition, Property::Index property );
1513 BASIC, LAYER, ROOT_LAYER
1517 * Protected Constructor. See Actor::New().
1518 * The second-phase construction Initialize() member should be called immediately after this.
1519 * @param[in] derivedType The derived type of actor (if any).
1521 Actor( DerivedType derivedType );
1524 * Second-phase constructor. Must be called immediately after creating a new Actor;
1526 void Initialize( void );
1529 * A reference counted object may only be deleted by calling Unreference()
1534 * Called on a child during Add() when the parent actor is connected to the Stage.
1535 * @param[in] parentDepth The depth of the parent in the hierarchy.
1537 void ConnectToStage( unsigned int parentDepth );
1540 * Helper for ConnectToStage, to recursively connect a tree of actors.
1541 * This is atomic i.e. not interrupted by user callbacks.
1542 * @param[in] depth The depth in the hierarchy of the actor
1543 * @param[out] connectionList On return, the list of connected actors which require notification.
1545 void RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth );
1548 * Connect the Node associated with this Actor to the scene-graph.
1550 void ConnectToSceneGraph();
1553 * Helper for ConnectToStage, to notify a connected actor through the public API.
1555 void NotifyStageConnection();
1558 * Called on a child during Remove() when the actor was previously on the Stage.
1560 void DisconnectFromStage();
1563 * Helper for DisconnectFromStage, to recursively disconnect a tree of actors.
1564 * This is atomic i.e. not interrupted by user callbacks.
1565 * @param[out] disconnectionList On return, the list of disconnected actors which require notification.
1567 void RecursiveDisconnectFromStage( ActorContainer& disconnectionList );
1570 * Disconnect the Node associated with this Actor from the scene-graph.
1572 void DisconnectFromSceneGraph();
1575 * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1577 void NotifyStageDisconnection();
1580 * When the Actor is OnStage, checks whether the corresponding Node is connected to the scene graph.
1581 * @return True if the Actor is OnStage & has a Node connected to the scene graph.
1583 bool IsNodeConnected() const;
1587 // Default property extensions from Object
1590 * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
1592 virtual unsigned int GetDefaultPropertyCount() const;
1595 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
1597 virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
1600 * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
1602 virtual const char* GetDefaultPropertyName( Property::Index index ) const;
1605 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
1607 virtual Property::Index GetDefaultPropertyIndex( const std::string& name ) const;
1610 * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
1612 virtual bool IsDefaultPropertyWritable( Property::Index index ) const;
1615 * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
1617 virtual bool IsDefaultPropertyAnimatable( Property::Index index ) const;
1620 * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
1622 virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
1625 * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
1627 virtual Property::Type GetDefaultPropertyType( Property::Index index ) const;
1630 * @copydoc Dali::Internal::Object::SetDefaultProperty()
1632 virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue );
1635 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1637 virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
1640 * @copydoc Dali::Internal::Object::GetDefaultProperty()
1642 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
1645 * @copydoc Dali::Internal::Object::GetPropertyOwner()
1647 virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
1650 * @copydoc Dali::Internal::Object::GetSceneObject()
1652 virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
1655 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1657 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
1660 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1662 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
1665 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1667 virtual int GetPropertyComponentIndex( Property::Index index ) const;
1670 * @copydoc Dali::DevelActor::Raise()
1675 * @copydoc Dali::DevelActor::Lower()
1680 * @copydoc Dali::DevelActor::RaiseToTop()
1685 * @copydoc Dali::DevelActor::LowerToBottom()
1687 void LowerToBottom();
1690 * @copydoc Dali::DevelActor::RaiseAbove()
1692 void RaiseAbove( Internal::Actor& target );
1695 * @copydoc Dali::DevelActor::LowerBelow()
1697 void LowerBelow( Internal::Actor& target );
1705 Actor( const Actor& );
1708 Actor& operator=( const Actor& rhs );
1711 * Set the actors parent.
1712 * @param[in] parent The new parent.
1714 void SetParent( Actor* parent );
1717 * Helper to create a Node for this Actor.
1718 * To be overriden in derived classes.
1719 * @return A newly allocated node.
1721 virtual SceneGraph::Node* CreateNode() const;
1724 * For use in derived classes, called after Initialize()
1726 virtual void OnInitialize()
1731 * For use in internal derived classes.
1732 * This is called during ConnectToStage(), after the actor has finished adding its node to the scene-graph.
1733 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1735 virtual void OnStageConnectionInternal()
1740 * For use in internal derived classes.
1741 * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1742 * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1744 virtual void OnStageDisconnectionInternal()
1749 * For use in external (CustomActor) derived classes.
1750 * This is called after the atomic ConnectToStage() traversal has been completed.
1752 virtual void OnStageConnectionExternal( int depth )
1757 * For use in external (CustomActor) derived classes.
1758 * This is called after the atomic DisconnectFromStage() traversal has been completed.
1760 virtual void OnStageDisconnectionExternal()
1765 * For use in derived classes; this is called after Add() has added a child.
1766 * @param[in] child The child that was added.
1768 virtual void OnChildAdd( Actor& child )
1773 * For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ).
1774 * @param[in] child The child that was removed.
1776 virtual void OnChildRemove( Actor& child )
1781 * For use in derived classes.
1782 * This is called after SizeSet() has been called.
1784 virtual void OnSizeSet( const Vector3& targetSize )
1789 * For use in derived classes.
1790 * This is only called if mDerivedRequiresTouch is true, and the touch-signal was not consumed.
1791 * @param[in] event The touch event.
1792 * @return True if the event should be consumed.
1794 virtual bool OnTouchEvent( const TouchEvent& event )
1800 * For use in derived classes.
1801 * This is only called if mDerivedRequiresHover is true, and the hover-signal was not consumed.
1802 * @param[in] event The hover event.
1803 * @return True if the event should be consumed.
1805 virtual bool OnHoverEvent( const HoverEvent& event )
1811 * For use in derived classes.
1812 * This is only called if the wheel signal was not consumed.
1813 * @param[in] event The wheel event.
1814 * @return True if the event should be consumed.
1816 virtual bool OnWheelEvent( const WheelEvent& event )
1822 * @brief Ensure the relayout data is allocated
1824 void EnsureRelayoutData();
1827 * @brief Apply the size set policy to the input size
1829 * @param[in] size The size to apply the policy to
1830 * @return Return the adjusted size
1832 Vector2 ApplySizeSetPolicy( const Vector2 size );
1835 * Retrieve the parent object of an Actor.
1836 * @return The parent object, or NULL if the Actor does not have a parent.
1838 virtual Object* GetParentObject() const;
1842 * @param[in] order The sibling order this Actor should be
1844 void SetSiblingOrder( unsigned int order);
1847 * @brief Re-orders the sibling order when any actor raised to the max level
1848 * @param[in] siblings the container of sibling actors
1850 void DefragmentSiblingIndexes( ActorContainer& siblings );
1853 * @brief Shifts all siblings levels from the target level up by 1 to make space for a newly insert sibling
1854 * at an exclusive level.
1856 * @note Used with Raise and Lower API
1858 * @param[in] siblings the actor container of the siblings
1859 * @param[in] targetLevelToShiftFrom the sibling level to start shifting from
1861 bool ShiftSiblingsLevels( ActorContainer& siblings, int targetLevelToShiftFrom );
1865 * @brief Get the current position of the actor in screen coordinates.
1867 * @return Returns the screen position of actor
1869 const Vector2 GetCurrentScreenPosition() const;
1873 Actor* mParent; ///< Each actor (except the root) can have one parent
1874 ActorContainer* mChildren; ///< Container of referenced actors, lazily initialized
1875 RendererContainer* mRenderers; ///< Renderer container
1877 const SceneGraph::Node* mNode; ///< Not owned
1878 Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
1879 Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
1881 struct RelayoutData;
1882 RelayoutData* mRelayoutData; ///< Struct to hold optional collection of relayout variables
1884 ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
1887 Dali::Actor::TouchSignalType mTouchedSignal;
1888 Dali::Actor::TouchDataSignalType mTouchSignal;
1889 Dali::Actor::HoverSignalType mHoveredSignal;
1890 Dali::Actor::WheelEventSignalType mWheelEventSignal;
1891 Dali::Actor::OnStageSignalType mOnStageSignal;
1892 Dali::Actor::OffStageSignalType mOffStageSignal;
1893 Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
1894 DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
1896 Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
1897 Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
1899 std::string mName; ///< Name of the actor
1900 unsigned int mId; ///< A unique ID to identify the actor starting from 1, and 0 is reserved
1902 uint16_t mDepth; ///< The depth in the hierarchy of the actor. Only 4096 levels of depth are supported
1903 uint16_t mSiblingOrder; ///< The sibling order of the actor
1905 const bool mIsRoot : 1; ///< Flag to identify the root actor
1906 const bool mIsLayer : 1; ///< Flag to identify that this is a layer
1907 bool mIsOnStage : 1; ///< Flag to identify whether the actor is on-stage
1908 bool mSensitive : 1; ///< Whether the actor emits touch event signals
1909 bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
1910 bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
1911 bool mDerivedRequiresTouch : 1; ///< Whether the derived actor type requires touch event signals
1912 bool mDerivedRequiresHover : 1; ///< Whether the derived actor type requires hover event signals
1913 bool mDerivedRequiresWheelEvent : 1; ///< Whether the derived actor type requires wheel event signals
1914 bool mOnStageSignalled : 1; ///< Set to true before OnStageConnection signal is emitted, and false before OnStageDisconnection
1915 bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
1916 bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
1917 bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
1918 bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
1919 bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
1920 bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
1921 DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn
1922 PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited
1923 ColorMode mColorMode : 2; ///< Cached: Determines whether mWorldColor is inherited
1924 ClippingMode::Type mClippingMode : 2; ///< Cached: Determines which clipping mode (if any) to use.
1928 static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
1929 static unsigned int mActorCounter; ///< A counter to track the actor instance creation
1932 } // namespace Internal
1934 // Helpers for public-api forwarding methods
1936 inline Internal::Actor& GetImplementation( Dali::Actor& actor )
1938 DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
1940 BaseObject& handle = actor.GetBaseObject();
1942 return static_cast< Internal::Actor& >( handle );
1945 inline const Internal::Actor& GetImplementation( const Dali::Actor& actor )
1947 DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
1949 const BaseObject& handle = actor.GetBaseObject();
1951 return static_cast< const Internal::Actor& >( handle );
1956 #endif // DALI_INTERNAL_ACTOR_H