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