Merge "Follow the include-order coding conventions" into tizen
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-impl.h
1 #ifndef __DALI_INTERNAL_ACTOR_H__
2 #define __DALI_INTERNAL_ACTOR_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/common/vector-wrapper.h>
26 #include <dali/public-api/object/ref-object.h>
27 #include <dali/public-api/actors/actor.h>
28 #include <dali/public-api/common/dali-common.h>
29 #include <dali/public-api/events/gesture.h>
30 #include <dali/public-api/math/viewport.h>
31 #include <dali/internal/event/common/object-impl.h>
32 #include <dali/internal/event/common/stage-def.h>
33 #include <dali/internal/event/actors/actor-declarations.h>
34 #include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
35 #include <dali/internal/update/nodes/node-declarations.h>
36
37 #ifdef DYNAMICS_SUPPORT
38 #include <dali/internal/event/dynamics/dynamics-declarations.h>
39 #endif
40
41 namespace Dali
42 {
43
44 struct KeyEvent;
45 struct TouchEvent;
46 struct HoverEvent;
47 struct MouseWheelEvent;
48
49 namespace Internal
50 {
51
52 class Actor;
53 class ActorGestureData;
54 class Animation;
55 class RenderTask;
56 struct DynamicsData;
57
58 typedef IntrusivePtr<Actor>                   ActorPtr;
59 typedef Dali::ActorContainer                  ActorContainer; // Store handles to return via public-api
60 typedef ActorContainer::iterator              ActorIter;
61 typedef ActorContainer::const_iterator        ActorConstIter;
62
63 /**
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.
67  *
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 attaches it to the scene graph.
70  * The scene-graph can be updated in a separate thread, so the attachment 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.
72  */
73 class Actor : public Object
74 {
75 public:
76
77   /**
78    * Create a new actor.
79    * @return A smart-pointer to the newly allocated Actor.
80    */
81   static ActorPtr New();
82
83   /**
84    * Retrieve the name of the actor.
85    * @return The name.
86    */
87   const std::string& GetName() const;
88
89   /**
90    * Set the name of the actor.
91    * @param[in] name The new name.
92    */
93   void SetName(const std::string& name);
94
95   /**
96    * @copydoc Dali::Actor::GetId
97    */
98   unsigned int GetId() const;
99
100   // Attachments
101
102   /**
103    * Attach an object to an actor.
104    * @pre The actor does not already have an attachment.
105    * @param[in] attachment The object to attach.
106    */
107   void Attach(ActorAttachment& attachment);
108
109   /**
110    * Retreive the object attached to an actor.
111    * @return The attachment.
112    */
113   ActorAttachmentPtr GetAttachment();
114
115   // Containment
116
117   /**
118    * Query whether an actor is the root actor, which is owned by the Stage.
119    * @return True if the actor is a root actor.
120    */
121   bool IsRoot() const
122   {
123     return mIsRoot;
124   }
125
126   /**
127    * Query whether the actor is connected to the Stage.
128    */
129   bool OnStage() const;
130
131   /**
132    * Query whether the actor is a RenderableActor derived type.
133    * @return True if the actor is renderable.
134    */
135   bool IsRenderable() const
136   {
137     // inlined as this is called a lot in hit testing
138     return mIsRenderable;
139   }
140
141   /**
142    * Query whether the actor is of class Dali::Layer
143    * @return True if the actor is a layer.
144    */
145   bool IsLayer() const
146   {
147     // inlined as this is called a lot in hit testing
148     return mIsLayer;
149   }
150
151   /**
152    * Gets the layer in which the actor is present
153    * @return The layer, which will be uninitialized if the actor is off-stage.
154    */
155   Dali::Layer GetLayer();
156
157   /**
158    * Adds a child Actor to this Actor.
159    * @pre The child actor is not the same as the parent actor.
160    * @pre The child actor does not already have a parent.
161    * @param [in] child The child.
162    * @post The child will be referenced by its parent.
163    */
164   void Add(Actor& child);
165
166   /**
167    * Inserts a child Actor to this Actor's child list
168    * @pre The child actor is not the same as the parent actor.
169    * @pre The child actor does not already have a parent.
170    * @param [in] index in childlist to insert child at
171    * @param [in] child The child.
172    * @post The child will be referenced by its parent.
173    */
174   void Insert(unsigned int index, Actor& child);
175
176   /**
177    * Removes a child Actor from this Actor.
178    * @param [in] child The child.
179    * @post The child will be unreferenced.
180    */
181   void Remove(Actor& child);
182
183   /**
184    * @copydoc Dali::Actor::Unparent
185    */
186   void Unparent();
187
188   /**
189    * Retrieve the number of children held by the actor.
190    * @return The number of children
191    */
192   unsigned int GetChildCount() const;
193
194   /**
195    * @copydoc Dali::Actor::GetChildAt
196    */
197   Dali::Actor GetChildAt(unsigned int index) const;
198
199   /**
200    * Retrieve the Actor's children.
201    * @return A copy of the container of children.
202    */
203   ActorContainer GetChildren();
204
205   /**
206    * Retrieve the Actor's children.
207    * @return A const reference to the container of children.
208    */
209   const ActorContainer& GetChildren() const;
210
211   /**
212    * Retrieve a reference to Actor's children.
213    * @note Not for public use.
214    * @return A reference to the container of children.
215    */
216   ActorContainer& GetChildrenInternal()
217   {
218     return *mChildren;
219   }
220
221   /**
222    * @copydoc Dali::Actor::FindChildByName
223    */
224   ActorPtr FindChildByName(const std::string& actorName);
225
226   /**
227    * @copydoc Dali::Actor::FindChildByAlias
228    */
229   Dali::Actor FindChildByAlias(const std::string& actorAlias);
230
231   /**
232    * @copydoc Dali::Actor::FindChildById
233    */
234   ActorPtr FindChildById(const unsigned int id);
235
236   /**
237    * Retrieve the parent of an Actor.
238    * @return The parent actor, or NULL if the Actor does not have a parent.
239    */
240   Actor* GetParent() const
241   {
242     return mParent;
243   }
244
245   /**
246    * Sets the size of an actor.
247    * ActorAttachments attached to the actor, can be scaled to fit within this area.
248    * This does not interfere with the actors scale factor.
249    * @param [in] width  The new width.
250    * @param [in] height The new height.
251    */
252   void SetSize(float width, float height);
253
254   /**
255    * Sets the size of an actor.
256    * ActorAttachments attached to the actor, can be scaled to fit within this area.
257    * This does not interfere with the actors scale factor.
258    * @param [in] width The size of the actor along the x-axis.
259    * @param [in] height The size of the actor along the y-axis.
260    * @param [in] depth The size of the actor along the z-axis.
261    */
262   void SetSize(float width, float height, float depth);
263
264   /**
265    * Sets the size of an actor.
266    * ActorAttachments attached to the actor, can be scaled to fit within this area.
267    * This does not interfere with the actors scale factor.
268    * @param [in] size The new size.
269    */
270   void SetSize(const Vector2& size);
271
272   /**
273    * Sets the size of an actor.
274    * ActorAttachments attached to the actor, can be scaled to fit within this area.
275    * This does not interfere with the actors scale factor.
276    * @param [in] size The new size.
277    */
278   void SetSize(const Vector3& size);
279
280   /**
281    * Set the width component of the Actor's size.
282    * @param [in] width The new width component.
283    */
284   void SetWidth( float width );
285
286   /**
287    * Set the height component of the Actor's size.
288    * @param [in] height The new height component.
289    */
290   void SetHeight( float height );
291
292   /**
293    * Set the depth component of the Actor's size.
294    * @param [in] depth The new depth component.
295    */
296   void SetDepth( float depth );
297
298   /**
299    * Retrieve the Actor's size from event side.
300    * This size will be the size set or if animating then the target size.
301    * @return The Actor's size.
302    */
303   const Vector3& GetSize() const;
304
305   /**
306    * Retrieve the Actor's size from update side.
307    * This size will be the size set or animating but will be a frame behind.
308    * @return The Actor's size.
309    */
310   const Vector3& GetCurrentSize() const;
311
312   /**
313    * Return the natural size of the actor
314    *
315    * @return The actor's natural size
316    */
317   virtual Vector3 GetNaturalSize() const;
318
319   /**
320    * Set the origin of an actor, within its parent's area.
321    * This is expressed in 2D unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
322    * and (1.0, 1.0, 0.5) is the bottom-right corner.
323    * The default parent-origin is top-left (0.0, 0.0, 0.5).
324    * An actor position is the distance between this origin, and the actors anchor-point.
325    * @param [in] origin The new parent-origin.
326    */
327   void SetParentOrigin(const Vector3& origin);
328
329   /**
330    * Set the x component of the parent-origin
331    * @param [in] x The new x value.
332    */
333   void SetParentOriginX( float x );
334
335   /**
336    * Set the y component of the parent-origin
337    * @param [in] y The new y value.
338    */
339   void SetParentOriginY( float y );
340
341   /**
342    * Set the z component of the parent-origin
343    * @param [in] z The new z value.
344    */
345   void SetParentOriginZ( float z );
346
347   /**
348    * Retrieve the parent-origin of an actor.
349    * @return The parent-origin.
350    */
351   const Vector3& GetCurrentParentOrigin() const;
352
353   /**
354    * Set the anchor-point of an actor. This is expressed in 2D unit coordinates, such that
355    * (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.
356    * The default anchor point is top-left (0.0, 0.0, 0.5).
357    * An actor position is the distance between its parent-origin, and this anchor-point.
358    * An actor's rotation is centered around its anchor-point.
359    * @param [in] anchorPoint The new anchor-point.
360    */
361   void SetAnchorPoint(const Vector3& anchorPoint);
362
363   /**
364    * Set the x component of the anchor-point.
365    * @param [in] x The new x value.
366    */
367   void SetAnchorPointX( float x );
368
369   /**
370    * Set the y component of the anchor-point.
371    * @param [in] y The new y value.
372    */
373   void SetAnchorPointY( float y );
374
375   /**
376    * Set the z component of the anchor-point.
377    * @param [in] z The new z value.
378    */
379   void SetAnchorPointZ( float z );
380
381   /**
382    * Retrieve the anchor-point of an actor.
383    * @return The anchor-point.
384    */
385   const Vector3& GetCurrentAnchorPoint() const;
386
387   /**
388    * Sets the position of the Actor.
389    * The coordinates are relative to the Actor's parent.
390    * The Actor's z position will be set to 0.0f.
391    * @param [in] x The new x position
392    * @param [in] y The new y position
393    */
394   void SetPosition(float x, float y);
395
396   /**
397    * Sets the position of the Actor.
398    * The coordinates are relative to the Actor's parent.
399    * @param [in] x The new x position
400    * @param [in] y The new y position
401    * @param [in] z The new z position
402    */
403   void SetPosition(float x, float y, float z);
404
405   /**
406    * Sets the position of the Actor.
407    * The coordinates are relative to the Actor's parent.
408    * @param [in] position The new position.
409    */
410   void SetPosition(const Vector3& position);
411
412   /**
413    * Set the position of an actor along the X-axis.
414    * @param [in] x The new x position
415    */
416   void SetX(float x);
417
418   /**
419    * Set the position of an actor along the Y-axis.
420    * @param [in] y The new y position.
421    */
422   void SetY(float y);
423
424   /**
425    * Set the position of an actor along the Z-axis.
426    * @param [in] z The new z position
427    */
428   void SetZ(float z);
429
430   /**
431    * Move an actor relative to its existing position.
432    * @param[in] distance The actor will move by this distance.
433    */
434   void MoveBy(const Vector3& distance);
435
436   /**
437    * Retrieve the position of the Actor.
438    * The coordinates are relative to the Actor's parent.
439    * @return the Actor's position.
440    */
441   const Vector3& GetCurrentPosition() const;
442
443   /**
444    * @copydoc Dali::Actor::GetCurrentWorldPosition()
445    */
446   const Vector3& GetCurrentWorldPosition() const;
447
448   /**
449    * @copydoc Dali::Actor::SetPositionInheritanceMode()
450    */
451   void SetPositionInheritanceMode( PositionInheritanceMode mode );
452
453   /**
454    * @copydoc Dali::Actor::GetPositionInheritanceMode()
455    */
456   PositionInheritanceMode GetPositionInheritanceMode() const;
457
458   /**
459    * Sets the rotation of the Actor.
460    * @param [in] angleRadians The new rotation angle in radians.
461    * @param [in] axis The new axis of rotation.
462    */
463   void SetRotation(const Radian& angleRadians, const Vector3& axis);
464
465   /**
466    * Sets the rotation of the Actor.
467    * @param [in] rotation The new rotation.
468    */
469   void SetRotation(const Quaternion& rotation);
470
471   /**
472    * Rotate an actor around its existing rotation axis.
473    * @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
474    * @param[in] axis The axis of the rotation to combine with the existing rotation.
475    */
476   void RotateBy(const Radian& angleRadians, const Vector3& axis);
477
478   /**
479    * Apply a relative rotation to an actor.
480    * @param[in] relativeRotation The rotation to combine with the actors existing rotation.
481    */
482   void RotateBy(const Quaternion& relativeRotation);
483
484   /**
485    * Retreive the Actor's rotation.
486    * @return the rotation.
487    */
488   const Quaternion& GetCurrentRotation() const;
489
490   /**
491    * Set whether a child actor inherits it's parent's orientation. Default is to inherit.
492    * Switching this off means that using SetRotation() sets the actor's world orientation.
493    * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
494    */
495   void SetInheritRotation(bool inherit);
496
497   /**
498    * Returns whether the actor inherit's it's parent's orientation.
499    * @return true if the actor inherit's it's parent orientation, false if it uses world orientation.
500    */
501   bool IsRotationInherited() const;
502
503   /**
504    * @brief Defines how a child actors size is affected by its parents size.
505    * @param[in] mode The size relative to parent mode to use.
506    */
507   void SetSizeMode(SizeMode mode);
508
509   /**
510    * Query how the child actors size is affected by its parents size.
511    * @return The size relative to parent mode in use.
512    */
513   SizeMode GetSizeMode() const;
514
515   /**
516    * Sets the factor of the parents size used for the child actor.
517    * Note: Only used if SizeMode is SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT.
518    * @param[in] factor The vector to multiply the parents size by to get the childs size.
519    */
520   void SetSizeModeFactor(const Vector3& factor);
521
522   /**
523    * Gets the factor of the parents size used for the child actor.
524    * Note: Only used if SizeMode is SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT.
525    * @return The vector being used to multiply the parents size by to get the childs size.
526    */
527   const Vector3& GetSizeModeFactor() const;
528
529   /**
530    * @copydoc Dali::Actor::GetCurrentWorldRotation()
531    */
532   const Quaternion& GetCurrentWorldRotation() const;
533
534   /**
535    * Sets a scale factor applied to an actor.
536    * @param [in] scale The scale factor applied on all axes.
537    */
538   void SetScale(float scale);
539
540   /**
541    * Sets a scale factor applied to an actor.
542    * @param [in] scaleX The scale factor applied along the x-axis.
543    * @param [in] scaleY The scale factor applied along the y-axis.
544    * @param [in] scaleZ The scale factor applied along the z-axis.
545    */
546   void SetScale(float scaleX, float scaleY, float scaleZ);
547
548   /**
549    * Sets a scale factor applied to an actor.
550    * @param [in] scale A vector representing the scale factor for each axis.
551    */
552   void SetScale(const Vector3& scale);
553
554   /**
555    * Set the x component of the scale factor.
556    * @param [in] x The new x value.
557    */
558   void SetScaleX( float x );
559
560   /**
561    * Set the y component of the scale factor.
562    * @param [in] y The new y value.
563    */
564   void SetScaleY( float y );
565
566   /**
567    * Set the z component of the scale factor.
568    * @param [in] z The new z value.
569    */
570   void SetScaleZ( float z );
571
572   /**
573    * Apply a relative scale to an actor.
574    * @param[in] relativeScale The scale to combine with the actors existing scale.
575    */
576   void ScaleBy(const Vector3& relativeScale);
577
578   /**
579    * Retrieve the scale factor applied to an actor.
580    * @return A vector representing the scale factor for each axis.
581    */
582   const Vector3& GetCurrentScale() const;
583
584   /**
585    * @copydoc Dali::Actor::GetCurrentWorldScale()
586    */
587   const Vector3& GetCurrentWorldScale() const;
588
589   /**
590    * @copydoc Dali::Actor::SetInheritScale()
591    */
592   void SetInheritScale( bool inherit );
593
594   /**
595    * @copydoc Dali::Actor::IsScaleInherited()
596    */
597   bool IsScaleInherited() const;
598
599   /**
600    * @copydoc Dali::Actor::GetCurrentWorldMatrix()
601    */
602   Matrix GetCurrentWorldMatrix() const;
603
604   // Visibility
605
606   /**
607    * Sets the visibility flag of an actor.
608    * @param [in] visible The new visibility flag.
609    */
610   void SetVisible(bool visible);
611
612   /**
613    * Retrieve the visibility flag of an actor.
614    * @return The visibility flag.
615    */
616   bool IsVisible() const;
617
618   /**
619    * Sets the opacity of an actor.
620    * @param [in] opacity The new opacity.
621    */
622   void SetOpacity(float opacity);
623
624   /**
625    * Apply a relative opacity change to an actor.
626    * @param[in] relativeOpacity The opacity to combine with the actors existing opacity.
627    */
628   void OpacityBy(float relativeOpacity);
629
630   /**
631    * Retrieve the actor's opacity.
632    * @return The actor's opacity.
633    */
634   float GetCurrentOpacity() const;
635
636   /**
637    * Sets whether an actor should emit touch or hover signals; see SignalTouch() and SignalHover().
638    * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
639    * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
640    * hover event signal will be emitted.
641    *
642    * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
643    * @code
644    * actor.SetSensitive(false);
645    * @endcode
646    *
647    * Then, to re-enable the touch or hover event signal emission, the application should call:
648    * @code
649    * actor.SetSensitive(true);
650    * @endcode
651    *
652    * @see SignalTouch() and SignalHover().
653    * @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
654    * @param[in]  sensitive  true to enable emission of the touch or hover event signals, false otherwise.
655    */
656   void SetSensitive(bool sensitive)
657   {
658     mSensitive = sensitive;
659   }
660
661   /**
662    * Query whether an actor emits touch or hover event signals.
663    * @see SetSensitive(bool)
664    * @return true, if emission of touch or hover event signals is enabled, false otherwise.
665    */
666   bool IsSensitive() const
667   {
668     return mSensitive;
669   }
670
671   /**
672    * @copydoc Dali::Actor::SetDrawMode
673    */
674   void SetDrawMode( DrawMode::Type drawMode );
675
676   /**
677    * @copydoc Dali::Actor::GetDrawMode
678    */
679   DrawMode::Type GetDrawMode() const;
680
681   /**
682    * @copydoc Dali::Actor::SetOverlay
683    */
684   void SetOverlay(bool enable);
685
686   /**
687    * @copydoc Dali::Actor::IsOverlay
688    */
689   bool IsOverlay() const;
690
691   /**
692    * Sets whether an actor transmits geometry scaling to it's children.
693    * The default value is for it not to transmit scaling.
694    * @param[in] transmitGeometryScaling True to transmit scaling.
695    */
696   void SetTransmitGeometryScaling(bool transmitGeometryScaling);
697
698   /**
699    * Get the TransmitGeometryScaling property for this actor.
700    * @return True if geometry scaling is applied to the inherited scale.
701    */
702   bool GetTransmitGeometryScaling() const;
703
704   /**
705    * Sets the initial volume of the actor. Used for scaling the
706    * actor appropriately as the actor is sized when transmitGeometryScaling
707    * is set to true.
708    *
709    * @param[in] volume the volume of the model and it's children
710    */
711   void SetInitialVolume(const Vector3& volume);
712
713   /**
714    * Sets the actor's color.  The final color of actor depends on its color mode.
715    * This final color is applied to the drawable elements of an actor.
716    * @param [in] color The new color.
717    */
718   void SetColor(const Vector4& color);
719
720   /**
721    * Set the red component of the color.
722    * @param [in] red The new red component.
723    */
724   void SetColorRed( float red );
725
726   /**
727    * Set the green component of the color.
728    * @param [in] green The new green component.
729    */
730   void SetColorGreen( float green );
731
732   /**
733    * Set the blue component of the scale factor.
734    * @param [in] blue The new blue value.
735    */
736   void SetColorBlue( float blue );
737
738   /**
739    * Apply a relative color change to an actor.
740    * @param[in] relativeColor The color to combine with the actors existing color.
741    */
742   void ColorBy(const Vector4& relativeColor);
743
744   /**
745    * Retrieve the actor's color.
746    * @return The color.
747    */
748   const Vector4& GetCurrentColor() const;
749
750   /**
751    * Sets the actor's color mode.
752    * Color mode specifies whether Actor uses its own color or inherits its parent color
753    * @param [in] colorMode to use.
754    */
755   void SetColorMode(ColorMode colorMode);
756
757   /**
758    * Returns the actor's color mode.
759    * @return currently used colorMode.
760    */
761   ColorMode GetColorMode() const;
762
763   /**
764    * @copydoc Dali::Actor::GetCurrentWorldColor()
765    */
766   const Vector4& GetCurrentWorldColor() const;
767
768 #ifdef DYNAMICS_SUPPORT
769
770   // Dynamics
771
772   /// @copydoc Dali::Actor::DisableDynamics
773   void DisableDynamics();
774
775   /// @copydoc Dali::Actor::EnableDynamics(Dali::DynamicsBodyConfig)
776   DynamicsBodyPtr  EnableDynamics(DynamicsBodyConfigPtr bodyConfig);
777
778   /// @copydoc Dali::Actor::GetDynamicsBody
779   DynamicsBodyPtr GetDynamicsBody() const;
780
781   /// @copydoc Dali::Actor::AddDynamicsJoint(Dali::Actor,const Vector3&)
782   DynamicsJointPtr AddDynamicsJoint( ActorPtr attachedActor, const Vector3& offset );
783
784   /// @copydoc Dali::Actor::AddDynamicsJoint(Dali::Actor,const Vector3&,const Vector3&)
785   DynamicsJointPtr AddDynamicsJoint( ActorPtr attachedActor, const Vector3& offsetA, const Vector3& offsetB );
786
787   /// @copydoc Dali::Actor::GetNumberOfJoints
788   const int GetNumberOfJoints() const;
789
790   /// @copydoc Dali::Actor::GetDynamicsJointByIndex
791   DynamicsJointPtr GetDynamicsJointByIndex( const int index ) const;
792
793   /// @copydoc Dali::Actor::GetDynamicsJoint
794   DynamicsJointPtr GetDynamicsJoint( ActorPtr attachedActor ) const;
795
796   /// @copydoc Dali::Actor::RemoveDynamicsJoint
797   void RemoveDynamicsJoint( DynamicsJointPtr joint );
798
799   /**
800    * Hold a reference to a DynamicsJoint
801    * @param[in] joint The joint
802    */
803   void ReferenceJoint( DynamicsJointPtr joint );
804
805   /**
806    * Release a reference to a DynamicsJoint
807    * @param[in] joint The joint
808    */
809   void ReleaseJoint( DynamicsJointPtr joint );
810
811   /**
812    * Set this actor to be the root actor in the dynamics simulation
813    * All children of the actor are added/removed from the simulation.
814    * @param[in] flag  When true sets this actor to be the simulation world root actor and
815    *                  if OnStage() all dynamics enabled child actors are added to the simulation,
816    *                  when false stops this actor being the simulation root and if OnStage() all
817    *                  dynamics enabled child actors are removed from the simulation.
818    */
819   void SetDynamicsRoot(bool flag);
820
821 private:
822   /**
823    * Check if this actor is the root actor in the dynamics simulation
824    * @return true if this is the dynamics root actor.
825    */
826   bool IsDynamicsRoot() const;
827
828   /**
829    * Add actor to the dynamics simulation
830    * Invoked when the actor is staged, or it's parent becomes the simulation root
831    */
832   void ConnectDynamics();
833
834   /**
835    * Remove actor from the dynamics simulation
836    * Invoked when the actor is unstaged, or it's parent stops being the the simulation root
837    */
838   void DisconnectDynamics();
839
840   /**
841    * An actor in a DynamicsJoint relationship has been staged
842    * @param[in] actor The actor passed into AddDynamicsJoint()
843    */
844   void AttachedActorOnStage( Dali::Actor actor );
845
846   /**
847    * An actor in a DynamicsJoint relationship has been unstaged
848    * @param[in] actor The actor passed into AddDynamicsJoint()
849    */
850   void AttachedActorOffStage( Dali::Actor actor );
851
852 #endif // DYNAMICS_SUPPORT
853
854 public:
855   /**
856    * Converts screen coordinates into the actor's coordinate system.
857    * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
858    * @param[out] localX On return, the X-coordinate relative to the actor.
859    * @param[out] localY On return, the Y-coordinate relative to the actor.
860    * @param[in] screenX The screen X-coordinate.
861    * @param[in] screenY The screen Y-coordinate.
862    * @return True if the conversion succeeded.
863    */
864   bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const;
865
866   /**
867    * Converts screen coordinates into the actor's coordinate system.
868    * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
869    * @param[in] renderTask The render-task used to display the actor.
870    * @param[out] localX On return, the X-coordinate relative to the actor.
871    * @param[out] localY On return, the Y-coordinate relative to the actor.
872    * @param[in] screenX The screen X-coordinate.
873    * @param[in] screenY The screen Y-coordinate.
874    * @return True if the conversion succeeded.
875    */
876   bool ScreenToLocal(RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const;
877
878   /**
879    * Converts from the actor's coordinate system to screen coordinates.
880    * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
881    * @param[in] viewMatrix The view-matrix
882    * @param[in] projectionMatrix The projection-matrix
883    * @param[in] viewport The view-port
884    * @param[out] localX On return, the X-coordinate relative to the actor.
885    * @param[out] localY On return, the Y-coordinate relative to the actor.
886    * @param[in] screenX The screen X-coordinate.
887    * @param[in] screenY The screen Y-coordinate.
888    * @return True if the conversion succeeded.
889    */
890   bool ScreenToLocal( const Matrix& viewMatrix,
891                       const Matrix& projectionMatrix,
892                       const Viewport& viewport,
893                       float& localX,
894                       float& localY,
895                       float screenX,
896                       float screenY ) const;
897
898   /**
899    * Performs a ray-sphere test with the given pick-ray and the actor's bounding sphere.
900    * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
901    * @param[in] rayOrigin The ray origin in the world's reference system.
902    * @param[in] rayDir The ray director vector in the world's reference system.
903    * @return True if the ray intersects the actor's bounding sphere.
904    */
905   bool RaySphereTest( const Vector4& rayOrigin, const Vector4& rayDir ) const;
906
907   /**
908    * Performs a ray-actor test with the given pick-ray and the actor's geometry.
909    * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
910    * @param[in] rayOrigin The ray origin in the world's reference system.
911    * @param[in] rayDir The ray director vector in the world's reference system.
912    * @param[out] hitPointLocal The hit point in the Actor's local reference system.
913    * @param[out] distance The distance from the hit point to the camera.
914    * @return True if the ray intersects the actor's geometry.
915    */
916   bool RayActorTest( const Vector4& rayOrigin, const Vector4& rayDir, Vector4& hitPointLocal, float& distance ) const;
917
918   /**
919    * Sets whether the actor should receive a notification when touch or hover motion events leave
920    * the boundary of the actor.
921    *
922    * @note By default, this is set to false as most actors do not require this.
923    * @note Need to connect to the SignalTouch or SignalHover to actually receive this event.
924    *
925    * @param[in]  required  Should be set to true if a Leave event is required
926    */
927   void SetLeaveRequired(bool required);
928
929   /**
930    * This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
931    * the boundary of the actor.
932    * @return true if a Leave event is required, false otherwise.
933    */
934   bool GetLeaveRequired() const;
935
936   /**
937    * @copydoc Dali::Actor::SetKeyboardFocusable()
938    */
939   void SetKeyboardFocusable( bool focusable );
940
941   /**
942    * @copydoc Dali::Actor::IsKeyboardFocusable()
943    */
944   bool IsKeyboardFocusable() const;
945
946   /**
947    * Query whether the application or derived actor type requires touch events.
948    * @return True if touch events are required.
949    */
950   bool GetTouchRequired() const;
951
952   /**
953    * Query whether the application or derived actor type requires hover events.
954    * @return True if hover events are required.
955    */
956   bool GetHoverRequired() const;
957
958   /**
959    * Query whether the application or derived actor type requires mouse wheel events.
960    * @return True if mouse wheel events are required.
961    */
962   bool GetMouseWheelEventRequired() const;
963
964   /**
965    * Query whether the actor is actually hittable.  This method checks whether the actor is
966    * sensitive, has the visibility flag set to true and is not fully transparent.
967    * @return true, if it can be hit, false otherwise.
968    */
969   bool IsHittable() const;
970
971   // Gestures
972
973   /**
974    * Retrieve the gesture data associated with this actor. The first call to this method will
975    * allocate space for the ActorGestureData so this should only be called if an actor really does
976    * require gestures.
977    * @return Reference to the ActorGestureData for this actor.
978    * @note Once the gesture-data is created for an actor it is likely that gestures are required
979    * throughout the actor's lifetime so it will only be deleted when the actor is destroyed.
980    */
981   ActorGestureData& GetGestureData();
982
983   /**
984    * Queries whether the actor requires the gesture type.
985    * @param[in] type The gesture type.
986    */
987   bool IsGestureRequred( Gesture::Type type ) const;
988
989   // Signals
990
991   /**
992    * Used by the EventProcessor to emit touch event signals.
993    * @param[in] event The touch event.
994    * @return True if the event was consumed.
995    */
996   bool EmitTouchEventSignal(const TouchEvent& event);
997
998   /**
999    * Used by the EventProcessor to emit hover event signals.
1000    * @param[in] event The hover event.
1001    * @return True if the event was consumed.
1002    */
1003   bool EmitHoverEventSignal(const HoverEvent& event);
1004
1005   /**
1006    * Used by the EventProcessor to emit mouse wheel event signals.
1007    * @param[in] event The mouse wheel event.
1008    * @return True if the event was consumed.
1009    */
1010   bool EmitMouseWheelEventSignal(const MouseWheelEvent& event);
1011
1012   /**
1013    * @copydoc Dali::Actor::TouchedSignal()
1014    */
1015   Dali::Actor::TouchSignalType& TouchedSignal();
1016
1017   /**
1018    * @copydoc Dali::Actor::HoveredSignal()
1019    */
1020   Dali::Actor::HoverSignalType& HoveredSignal();
1021
1022   /**
1023    * @copydoc Dali::Actor::MouseWheelEventSignal()
1024    */
1025   Dali::Actor::MouseWheelEventSignalType& MouseWheelEventSignal();
1026
1027   /**
1028    * @copydoc Dali::Actor::OnStageSignal()
1029    */
1030   Dali::Actor::OnStageSignalType& OnStageSignal();
1031
1032   /**
1033    * @copydoc Dali::Actor::OffStageSignal()
1034    */
1035   Dali::Actor::OffStageSignalType& OffStageSignal();
1036
1037   /**
1038    * Connects a callback function with the object's signals.
1039    * @param[in] object The object providing the signal.
1040    * @param[in] tracker Used to disconnect the signal.
1041    * @param[in] signalName The signal to connect to.
1042    * @param[in] functor A newly allocated FunctorDelegate.
1043    * @return True if the signal was connected.
1044    * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
1045    */
1046   static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
1047
1048   /**
1049    * Performs actions as requested using the action name.
1050    * @param[in] object The object on which to perform the action.
1051    * @param[in] actionName The action to perform.
1052    * @param[in] attributes The attributes with which to perfrom this action.
1053    * @return true if the action was done.
1054    */
1055   static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
1056
1057 public:  // For Animation
1058
1059   /**
1060    * This should only be called by Animation, when the actor is resized using Animation::Resize().
1061    *
1062    * @param[in] animation The animation that resized the actor
1063    * @param[in] targetSize The new target size of the actor
1064    */
1065   void NotifySizeAnimation( Animation& animation, const Vector3& targetSize);
1066
1067   /**
1068    * For use in derived classes.
1069    * This should only be called by Animation, when the actor is resized using Animation::Resize().
1070    */
1071   virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize) {}
1072
1073 protected:
1074
1075   enum DerivedType
1076   {
1077     BASIC,
1078     RENDERABLE,
1079     LAYER,
1080     ROOT_LAYER
1081   };
1082
1083   /**
1084    * Protected Constructor.  See Actor::New().
1085    * The second-phase construction Initialize() member should be called immediately after this.
1086    * @param[in] derivedType The derived type of actor (if any).
1087    */
1088   Actor( DerivedType derivedType );
1089
1090   /**
1091    * Second-phase constructor. Must be called immediately after creating a new Actor;
1092    */
1093   void Initialize(void);
1094
1095   /**
1096    * A reference counted object may only be deleted by calling Unreference()
1097    */
1098   virtual ~Actor();
1099
1100   /**
1101    * Called on a child during Add() when the parent actor is connected to the Stage.
1102    * @param[in] stage The stage.
1103    * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1104    */
1105   void ConnectToStage( int index = -1 );
1106
1107   /**
1108    * Helper for ConnectToStage, to recursively connect a tree of actors.
1109    * This is atomic i.e. not interrupted by user callbacks.
1110    * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1111    * @param[out] connectionList On return, the list of connected actors which require notification.
1112    */
1113   void RecursiveConnectToStage( ActorContainer& connectionList, int index = -1 );
1114
1115   /**
1116    * Connect the Node associated with this Actor to the scene-graph.
1117    * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1118    */
1119   void ConnectToSceneGraph(int index = -1);
1120
1121   /**
1122    * Helper for ConnectToStage, to notify a connected actor through the public API.
1123    */
1124   void NotifyStageConnection();
1125
1126   /**
1127    * Called on a child during Remove() when the actor was previously on the Stage.
1128    */
1129   void DisconnectFromStage();
1130
1131   /**
1132    * Helper for DisconnectFromStage, to recursively disconnect a tree of actors.
1133    * This is atomic i.e. not interrupted by user callbacks.
1134    * @param[out] disconnectionList On return, the list of disconnected actors which require notification.
1135    */
1136   void RecursiveDisconnectFromStage( ActorContainer& disconnectionList );
1137
1138   /**
1139    * Disconnect the Node associated with this Actor from the scene-graph.
1140    */
1141   void DisconnectFromSceneGraph();
1142
1143   /**
1144    * Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
1145    */
1146   void NotifyStageDisconnection();
1147
1148   /**
1149    * When the Actor is OnStage, checks whether the corresponding Node is connected to the scene graph.
1150    * @return True if the Actor is OnStage & has a Node connected to the scene graph.
1151    */
1152   bool IsNodeConnected() const;
1153
1154   /**
1155    * Calculate the size of the z dimension for a 2D size
1156    *
1157    * @param[in] size The 2D size (X, Y) to calculate Z from
1158    *
1159    * @return Return the Z dimension for this size
1160    */
1161   float CalculateSizeZ( const Vector2& size ) const;
1162
1163 public: // Default property extensions from Object
1164
1165   /**
1166    * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
1167    */
1168   virtual unsigned int GetDefaultPropertyCount() const;
1169
1170   /**
1171    * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
1172    */
1173   virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
1174
1175   /**
1176    * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
1177    */
1178   virtual const char* GetDefaultPropertyName(Property::Index index) const;
1179
1180   /**
1181    * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
1182    */
1183   virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
1184
1185   /**
1186    * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
1187    */
1188   virtual bool IsDefaultPropertyWritable(Property::Index index) const;
1189
1190   /**
1191    * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
1192    */
1193   virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
1194
1195   /**
1196    * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
1197    */
1198   virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
1199
1200   /**
1201    * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
1202    */
1203   virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
1204
1205   /**
1206    * @copydoc Dali::Internal::Object::SetDefaultProperty()
1207    */
1208   virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
1209
1210   /**
1211    * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
1212    */
1213   virtual void SetSceneGraphProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value );
1214
1215   /**
1216    * @copydoc Dali::Internal::Object::GetDefaultProperty()
1217    */
1218   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
1219
1220   /**
1221    * @copydoc Dali::Internal::Object::GetPropertyOwner()
1222    */
1223   virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
1224
1225   /**
1226    * @copydoc Dali::Internal::Object::GetSceneObject()
1227    */
1228   virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
1229
1230   /**
1231    * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
1232    */
1233   virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
1234
1235   /**
1236    * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
1237    */
1238   virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
1239
1240   /**
1241    * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
1242    */
1243   virtual int GetPropertyComponentIndex( Property::Index index ) const;
1244
1245 private:
1246
1247   // Undefined
1248   Actor();
1249
1250   // Undefined
1251   Actor(const Actor&);
1252
1253   // Undefined
1254   Actor& operator=(const Actor& rhs);
1255
1256   /**
1257    * Set the actors parent.
1258    * @param[in] parent The new parent.
1259    * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
1260    */
1261   void SetParent(Actor* parent, int index = -1);
1262
1263   /**
1264    * Helper to create a Node for this Actor.
1265    * To be overriden in derived classes.
1266    * @return A newly allocated node.
1267    */
1268   virtual SceneGraph::Node* CreateNode() const;
1269
1270   /**
1271    * For use in derived classes, called after Initialize()
1272    */
1273   virtual void OnInitialize() {}
1274
1275   /**
1276    * For use in internal derived classes.
1277    * This is called during ConnectToStage(), after the actor has finished adding its node to the scene-graph.
1278    * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1279    */
1280   virtual void OnStageConnectionInternal() {}
1281
1282   /**
1283    * For use in internal derived classes.
1284    * This is called during DisconnectFromStage(), before the actor removes its node from the scene-graph.
1285    * The derived class must not modify the actor hierachy (Add/Remove children) during this callback.
1286    */
1287   virtual void OnStageDisconnectionInternal() {}
1288
1289   /**
1290    * For use in external (CustomActor) derived classes.
1291    * This is called after the atomic ConnectToStage() traversal has been completed.
1292    */
1293   virtual void OnStageConnectionExternal() {}
1294
1295   /**
1296    * For use in external (CustomActor) derived classes.
1297    * This is called after the atomic DisconnectFromStage() traversal has been completed.
1298    */
1299   virtual void OnStageDisconnectionExternal() {}
1300
1301   /**
1302    * For use in derived classes; this is called after Add() has added a child.
1303    * @param[in] child The child that was added.
1304    */
1305   virtual void OnChildAdd( Actor& child ) {}
1306
1307   /**
1308    * For use in derived classes; this is called after Remove() has removed a child.
1309    * @param[in] child The child that was removed.
1310    */
1311   virtual void OnChildRemove( Actor& child ) {}
1312
1313   /**
1314    * For use in derived classes.
1315    * This is called after SizeSet() has been called.
1316    */
1317   virtual void OnSizeSet(const Vector3& targetSize) {}
1318
1319   /**
1320    * For use in derived classes.
1321    * This is only called if mDerivedRequiresTouch is true, and the touch-signal was not consumed.
1322    * @param[in] event The touch event.
1323    * @return True if the event should be consumed.
1324    */
1325   virtual bool OnTouchEvent(const TouchEvent& event) { return false; }
1326
1327   /**
1328    * For use in derived classes.
1329    * This is only called if mDerivedRequiresHover is true, and the hover-signal was not consumed.
1330    * @param[in] event The hover event.
1331    * @return True if the event should be consumed.
1332    */
1333   virtual bool OnHoverEvent(const HoverEvent& event) { return false; }
1334
1335   /**
1336    * For use in derived classes.
1337    * This is only called if the mouse wheel signal was not consumed.
1338    * @param[in] event The mouse event.
1339    * @return True if the event should be consumed.
1340    */
1341   virtual bool OnMouseWheelEvent(const MouseWheelEvent& event) { return false; }
1342
1343   /**
1344    * For use in derived class
1345    * If an alias for a child exists, return the child otherwise return an empty handle.
1346    * For example 'previous' could return the last selected child.
1347    * @pre The Actor has been initialized.
1348    * @param[in] actorAlias the name of the actor to find
1349    * @return A handle to the actor if found, or an empty handle if not.
1350    */
1351   virtual Dali::Actor GetChildByAlias(const std::string& actorAlias) { return Dali::Actor(); }
1352
1353   /**
1354    * Support function for FindChildByAlias
1355    * @pre The Actor has been initialized.
1356    * @param[in] actorAlias the name of the aliased actor to find
1357    * @return A handle to the actor if found, or an empty handle if not.
1358    */
1359   Dali::Actor DoGetChildByAlias(const std::string& actorAlias);
1360
1361 protected:
1362
1363   StagePtr                mStage;        ///< Used to send messages to Node; valid until Core destruction
1364   Actor*                  mParent;       ///< Each actor (except the root) can have one parent
1365   ActorContainer*         mChildren;     ///< Container of referenced actors
1366   const SceneGraph::Node* mNode;         ///< Not owned
1367   Vector3*                mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
1368   Vector3*                mAnchorPoint;  ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
1369
1370 #ifdef DYNAMICS_SUPPORT
1371   DynamicsData*           mDynamicsData; ///< optional physics data
1372 #endif
1373
1374   ActorGestureData*       mGestureData;  ///< Optional Gesture data. Only created when actor requires gestures
1375
1376   ActorAttachmentPtr      mAttachment;   ///< Optional referenced attachment
1377
1378   // Signals
1379   Dali::Actor::TouchSignalType             mTouchedSignal;
1380   Dali::Actor::HoverSignalType             mHoveredSignal;
1381   Dali::Actor::MouseWheelEventSignalType   mMouseWheelEventSignal;
1382   Dali::Actor::OnStageSignalType           mOnStageSignal;
1383   Dali::Actor::OffStageSignalType          mOffStageSignal;
1384
1385   Vector3         mSize;      ///< Event-side storage for size (not a pointer as most actors will have a size)
1386   Vector3         mSizeModeFactor; ///< Factor of parent size used for certain SizeModes.
1387
1388   std::string     mName;      ///< Name of the actor
1389   unsigned int    mId;        ///< A unique ID to identify the actor starting from 1, and 0 is reserved
1390
1391   const bool mIsRoot                               : 1; ///< Flag to identify the root actor
1392   const bool mIsRenderable                         : 1; ///< Flag to identify that this is a renderable actor
1393   const bool mIsLayer                              : 1; ///< Flag to identify that this is a layer
1394   bool mIsOnStage                                  : 1; ///< Flag to identify whether the actor is on-stage
1395   bool mIsDynamicsRoot                             : 1; ///< Flag to identify if this is the dynamics world root
1396   bool mSensitive                                  : 1; ///< Whether the actor emits touch event signals
1397   bool mLeaveRequired                              : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
1398   bool mKeyboardFocusable                          : 1; ///< Whether the actor should be focusable by keyboard navigation
1399   bool mDerivedRequiresTouch                       : 1; ///< Whether the derived actor type requires touch event signals
1400   bool mDerivedRequiresHover                       : 1; ///< Whether the derived actor type requires hover event signals
1401   bool mDerivedRequiresMouseWheelEvent             : 1; ///< Whether the derived actor type requires mouse wheel event signals
1402   bool mOnStageSignalled                           : 1; ///< Set to true before OnStageConnection signal is emitted, and false before OnStageDisconnection
1403   bool mInheritRotation                            : 1; ///< Cached: Whether the parent's rotation should be inherited.
1404   bool mInheritScale                               : 1; ///< Cached: Whether the parent's scale should be inherited.
1405   DrawMode::Type mDrawMode                         : 2; ///< Cached: How the actor and its children should be drawn
1406   PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited
1407   ColorMode mColorMode                             : 2; ///< Cached: Determines whether mWorldColor is inherited
1408   SizeMode mSizeMode                               : 2; ///< Cached: Determines how the actors parent affects the actors size.
1409
1410 private:
1411
1412   static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
1413   static unsigned int   mActorCounter; ///< A counter to track the actor instance creation
1414
1415 };
1416
1417 } // namespace Internal
1418
1419 // Helpers for public-api forwarding methods
1420
1421 inline Internal::Actor& GetImplementation(Dali::Actor& actor)
1422 {
1423   DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
1424
1425   BaseObject& handle = actor.GetBaseObject();
1426
1427   return static_cast<Internal::Actor&>(handle);
1428 }
1429
1430 inline const Internal::Actor& GetImplementation(const Dali::Actor& actor)
1431 {
1432   DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
1433
1434   const BaseObject& handle = actor.GetBaseObject();
1435
1436   return static_cast<const Internal::Actor&>(handle);
1437 }
1438
1439 } // namespace Dali
1440
1441 #endif // __DALI_INTERNAL_ACTOR_H__