Update comment for SetParentOrigin & SetAnchorPoint
[platform/core/uifw/dali-core.git] / dali / public-api / actors / actor.h
1 #ifndef DALI_ACTOR_H
2 #define DALI_ACTOR_H
3
4 /*
5  * Copyright (c) 2016 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/actors/actor-enumerations.h>
26 #include <dali/public-api/actors/draw-mode.h>
27 #include <dali/public-api/math/radian.h>
28 #include <dali/public-api/object/handle.h>
29 #include <dali/public-api/object/property-index-ranges.h>
30 #include <dali/public-api/signals/dali-signal.h>
31
32 namespace Dali
33 {
34 /**
35  * @addtogroup dali_core_actors
36  * @{
37  */
38
39 namespace Internal DALI_INTERNAL
40 {
41 class Actor;
42 }
43
44 class Actor;
45 class Renderer;
46 struct Degree;
47 class Quaternion;
48 class Layer;
49 struct KeyEvent;
50 class TouchData;
51 struct TouchEvent;
52 struct HoverEvent;
53 struct WheelEvent;
54 struct Vector2;
55 struct Vector3;
56 struct Vector4;
57
58 typedef Rect<float> Padding;      ///< Padding definition @SINCE_1_0.0
59
60 /**
61  * @brief Actor is the primary object with which Dali applications interact.
62  *
63  * UI controls can be built by combining multiple actors.
64  *
65  * <h3>Multi-Touch Events:</h3>
66  *
67  * Touch or hover events are received via signals; see Actor::TouchedSignal() and Actor::HoveredSignal() for more details.
68  *
69  * <i>Hit Testing Rules Summary:</i>
70  *
71  * - An actor is only hittable if the actor's touch or hover signal has a connection.
72  * - An actor is only hittable when it is between the camera's near and far planes.
73  * - If an actor is made insensitive, then the actor and its children are not hittable; see IsSensitive()
74  * - If an actor's visibility flag is unset, then none of its children are hittable either; see IsVisible()
75  * - To be hittable, an actor must have a non-zero size.
76  * - If an actor's world color is fully transparent, then it is not hittable; see GetCurrentWorldColor()
77  *
78  * <i>Hit Test Algorithm:</i>
79  *
80  * - Stage
81  *   - Gets the first down and the last up touch events to the screen, regardless of actor touch event consumption.
82  *   - Stage's root layer can be used to catch unconsumed touch events.
83  *
84  * - RenderTasks
85  *   - Hit testing is dependent on the camera used, which is specific to each RenderTask.
86  *
87  * - Layers
88  *   - For each RenderTask, hit testing starts from the top-most layer and we go through all the
89  *     layers until we have a hit or there are none left.
90  *   - Before we perform a hit test within a layer, we check if all the layer's parents are visible
91  *     and sensitive.
92  *   - If they are not, we skip hit testing the actors in that layer altogether.
93  *   - If a layer is set to consume all touch, then we do not check any layers behind this layer.
94  *
95  * - Actors
96  *   - The final part of hit testing is performed by walking through the actor tree within a layer.
97  *   - The following pseudocode shows the algorithm used:
98  *     @code
99  *     HIT-TEST-WITHIN-LAYER( ACTOR )
100  *     {
101  *       // Only hit-test the actor and its children if it is sensitive and visible
102  *       IF ( ACTOR-IS-SENSITIVE &&
103  *            ACTOR-IS-VISIBLE &&
104  *            ACTOR-IS-ON-STAGE )
105  *       {
106  *         // Depth-first traversal within current layer, visiting parent first
107  *
108  *         // Check whether current actor should be hit-tested.
109  *         IF ( ( TOUCH-SIGNAL-NOT-EMPTY || HOVER-SIGNAL-NOT-EMPTY ) &&
110  *              ACTOR-HAS-NON-ZERO-SIZE &&
111  *              ACTOR-WORLD-COLOR-IS-NOT-TRANSPARENT )
112  *         {
113  *           // Hit-test current actor
114  *           IF ( ACTOR-HIT )
115  *           {
116  *             IF ( ACTOR-IS-OVERLAY || ( DISTANCE-TO-ACTOR < DISTANCE-TO-LAST-HIT-ACTOR ) )
117  *             {
118  *               // The current actor is the closest actor that was underneath the touch.
119  *               LAST-HIT-ACTOR = CURRENT-ACTOR
120  *             }
121  *           }
122  *         }
123  *
124  *         // Keep checking children, in case we hit something closer.
125  *         FOR-EACH CHILD (in order)
126  *         {
127  *           IF ( CHILD-IS-NOT-A-LAYER )
128  *           {
129  *             // Continue traversal for this child's sub-tree
130  *             HIT-TEST-WITHIN-LAYER ( CHILD )
131  *           }
132  *           // else we skip hit-testing the child's sub-tree altogether.
133  *         }
134  *       }
135  *     }
136  *     @endcode
137  *   - Overlays always take priority (i.e. they're considered closer) regardless of distance.
138  *     The overlay children take priority over their parents, and overlay siblings take priority
139  *     over their previous siblings (i.e. reverse of rendering order):
140  *     @code
141  *           1
142  *          / \
143  *         /   \
144  *        2     5
145  *       / \     \
146  *      /   \     \
147  *     3     4     6
148  *
149  *     Hit Priority of above Actor tree (all overlays): 1 - Lowest. 6 - Highest.
150  *     @endcode
151  *     For more information, see SetDrawMode().
152  *
153  * <i>Touch or hover Event Delivery:</i>
154  *
155  * - Delivery
156  *   - The hit actor's touch or hover signal is emitted first; if it is not consumed by any of the listeners,
157  *     the parent's touch or hover signal is emitted, and so on.
158  *   - The following pseudocode shows the delivery mechanism:
159  *     @code
160  *     EMIT-TOUCH-SIGNAL( ACTOR )
161  *     {
162  *       IF ( TOUCH-SIGNAL-NOT-EMPTY )
163  *       {
164  *         // Only do the emission if touch signal of actor has connections.
165  *         CONSUMED = TOUCHED-SIGNAL( TOUCH-EVENT )
166  *       }
167  *
168  *       IF ( NOT-CONSUMED )
169  *       {
170  *         // If event is not consumed then deliver it to the parent unless we reach the root actor
171  *         IF ( ACTOR-PARENT )
172  *         {
173  *           EMIT-TOUCH-SIGNAL( ACTOR-PARENT )
174  *         }
175  *       }
176  *     }
177  *
178  *     EMIT-HOVER-SIGNAL( ACTOR )
179  *     {
180  *       IF ( HOVER-SIGNAL-NOT-EMPTY )
181  *       {
182  *         // Only do the emission if hover signal of actor has connections.
183  *         CONSUMED = HOVERED-SIGNAL( HOVER-EVENT )
184  *       }
185  *
186  *       IF ( NOT-CONSUMED )
187  *       {
188  *         // If event is not consumed then deliver it to the parent unless we reach the root actor.
189  *         IF ( ACTOR-PARENT )
190  *         {
191  *           EMIT-HOVER-SIGNAL( ACTOR-PARENT )
192  *         }
193  *       }
194  *     }
195  *     @endcode
196  *   - If there are several touch points, then the delivery is only to the first touch point's hit
197  *     actor (and its parents).  There will be NO touch or hover signal delivery for the hit actors of the
198  *     other touch points.
199  *   - The local coordinates are from the top-left (0.0f, 0.0f, 0.5f) of the hit actor.
200  *
201  * - Leave State
202  *   - A "Leave" state is set when the first point exits the bounds of the previous first point's
203  *     hit actor (primary hit actor).
204  *   - When this happens, the last primary hit actor's touch or hover signal is emitted with a "Leave" state
205  *     (only if it requires leave signals); see SetLeaveRequired().
206  *
207  * - Interrupted State
208  *   - If a system event occurs which interrupts the touch or hover processing, then the last primary hit
209  *     actor's touch or hover signals are emitted with an "Interrupted" state.
210  *   - If the last primary hit actor, or one of its parents, is no longer touchable or hoverable, then its
211  *     touch or hover signals are also emitted with an "Interrupted" state.
212  *   - If the consumed actor on touch-down is not the same as the consumed actor on touch-up, then
213  *     touch signals are also emitted from the touch-down actor with an "Interrupted" state.
214  *   - If the consumed actor on hover-start is not the same as the consumed actor on hover-finished, then
215  *     hover signals are also emitted from the hover-started actor with an "Interrupted" state.
216  *
217  * <h3>Key Events:</h3>
218  *
219  * Key events are received by an actor once set to grab key events, only one actor can be set as focused.
220  *
221  * @nosubgrouping
222  *
223  * Signals
224  * | %Signal Name      | Method                       |
225  * |-------------------|------------------------------|
226  * | touched           | @ref TouchedSignal()         |
227  * | hovered           | @ref HoveredSignal()         |
228  * | wheelEvent        | @ref WheelEventSignal()      |
229  * | onStage           | @ref OnStageSignal()         |
230  * | offStage          | @ref OffStageSignal()        |
231  * | onRelayout        | @ref OnRelayoutSignal()      |
232  *
233  * Actions
234  * | %Action Name      | %Actor method called         |
235  * |-------------------|------------------------------|
236  * | show              | %SetVisible( true )          |
237  * | hide              | %SetVisible( false )         |
238  * @SINCE_1_0.0
239  */
240
241 class DALI_IMPORT_API Actor : public Handle
242 {
243 public:
244
245   /**
246    * @brief An enumeration of properties belonging to the Actor class.
247    * @SINCE_1_0.0
248    */
249   struct Property
250   {
251     enum
252     {
253       PARENT_ORIGIN = DEFAULT_ACTOR_PROPERTY_START_INDEX, ///< name "parentOrigin",          type Vector3     (constraint-input) @SINCE_1_0.0
254       PARENT_ORIGIN_X,                                    ///< name "parentOriginX",         type float       (constraint-input) @SINCE_1_0.0
255       PARENT_ORIGIN_Y,                                    ///< name "parentOriginY",         type float       (constraint-input) @SINCE_1_0.0
256       PARENT_ORIGIN_Z,                                    ///< name "parentOriginZ",         type float       (constraint-input) @SINCE_1_0.0
257       ANCHOR_POINT,                                       ///< name "anchorPoint",           type Vector3     (constraint-input) @SINCE_1_0.0
258       ANCHOR_POINT_X,                                     ///< name "anchorPointX",          type float       (constraint-input) @SINCE_1_0.0
259       ANCHOR_POINT_Y,                                     ///< name "anchorPointY",          type float       (constraint-input) @SINCE_1_0.0
260       ANCHOR_POINT_Z,                                     ///< name "anchorPointZ",          type float       (constraint-input) @SINCE_1_0.0
261       SIZE,                                               ///< name "size",                  type Vector3     (animatable / constraint-input) @SINCE_1_0.0
262       SIZE_WIDTH,                                         ///< name "sizeWidth",             type float       (animatable / constraint-input) @SINCE_1_0.0
263       SIZE_HEIGHT,                                        ///< name "sizeHeight",            type float       (animatable / constraint-input) @SINCE_1_0.0
264       SIZE_DEPTH,                                         ///< name "sizeDepth",             type float       (animatable / constraint-input) @SINCE_1_0.0
265       POSITION,                                           ///< name "position",              type Vector3     (animatable / constraint-input) @SINCE_1_0.0
266       POSITION_X,                                         ///< name "positionX",             type float       (animatable / constraint-input) @SINCE_1_0.0
267       POSITION_Y,                                         ///< name "positionY",             type float       (animatable / constraint-input) @SINCE_1_0.0
268       POSITION_Z,                                         ///< name "positionZ",             type float       (animatable / constraint-input) @SINCE_1_0.0
269       WORLD_POSITION,                                     ///< name "worldPosition",         type Vector3     (read-only / constraint-input) @SINCE_1_0.0
270       WORLD_POSITION_X,                                   ///< name "worldPositionX",        type float       (read-only / constraint-input) @SINCE_1_0.0
271       WORLD_POSITION_Y,                                   ///< name "worldPositionY",        type float       (read-only / constraint-input) @SINCE_1_0.0
272       WORLD_POSITION_Z,                                   ///< name "worldPositionZ",        type float       (read-only / constraint-input) @SINCE_1_0.0
273       ORIENTATION,                                        ///< name "orientation",           type Quaternion  (animatable / constraint-input) @SINCE_1_0.0
274       WORLD_ORIENTATION,                                  ///< name "worldOrientation",      type Quaternion  (read-only / constraint-input) @SINCE_1_0.0
275       SCALE,                                              ///< name "scale",                 type Vector3     (animatable / constraint-input) @SINCE_1_0.0
276       SCALE_X,                                            ///< name "scaleX",                type float       (animatable / constraint-input) @SINCE_1_0.0
277       SCALE_Y,                                            ///< name "scaleY",                type float       (animatable / constraint-input) @SINCE_1_0.0
278       SCALE_Z,                                            ///< name "scaleZ",                type float       (animatable / constraint-input) @SINCE_1_0.0
279       WORLD_SCALE,                                        ///< name "worldScale",            type Vector3     (read-only / constraint-input) @SINCE_1_0.0
280       VISIBLE,                                            ///< name "visible",               type bool        (animatable / constraint-input) @SINCE_1_0.0
281       COLOR,                                              ///< name "color",                 type Vector4     (animatable / constraint-input) @SINCE_1_0.0
282       COLOR_RED,                                          ///< name "colorRed",              type float       (animatable / constraint-input) @SINCE_1_0.0
283       COLOR_GREEN,                                        ///< name "colorGreen",            type float       (animatable / constraint-input) @SINCE_1_0.0
284       COLOR_BLUE,                                         ///< name "colorBlue",             type float       (animatable / constraint-input) @SINCE_1_0.0
285       COLOR_ALPHA,                                        ///< name "colorAlpha",            type float       (animatable / constraint-input) @SINCE_1_0.0
286       WORLD_COLOR,                                        ///< name "worldColor",            type Vector4     (read-only / constraint-input) @SINCE_1_0.0
287       WORLD_MATRIX,                                       ///< name "worldMatrix",           type Matrix      (read-only / constraint-input) @SINCE_1_0.0
288       NAME,                                               ///< name "name",                  type std::string @SINCE_1_0.0
289       SENSITIVE,                                          ///< name "sensitive",             type bool        @SINCE_1_0.0
290       LEAVE_REQUIRED,                                     ///< name "leaveRequired",         type bool        @SINCE_1_0.0
291       INHERIT_ORIENTATION,                                ///< name "inheritOrientation",    type bool        @SINCE_1_0.0
292       INHERIT_SCALE,                                      ///< name "inheritScale",          type bool        @SINCE_1_0.0
293       COLOR_MODE,                                         ///< name "colorMode",             type std::string @SINCE_1_0.0
294       POSITION_INHERITANCE,                               ///< name "positionInheritance",   type std::string @DEPRECATED_1_1.24 Use INHERIT_POSITION instead
295       DRAW_MODE,                                          ///< name "drawMode",              type std::string @SINCE_1_0.0
296       SIZE_MODE_FACTOR,                                   ///< name "sizeModeFactor",        type Vector3     @SINCE_1_0.0
297       WIDTH_RESIZE_POLICY,                                ///< name "widthResizePolicy",     type String      @SINCE_1_0.0
298       HEIGHT_RESIZE_POLICY,                               ///< name "heightResizePolicy",    type String      @SINCE_1_0.0
299       SIZE_SCALE_POLICY,                                  ///< name "sizeScalePolicy",       type String      @SINCE_1_0.0
300       WIDTH_FOR_HEIGHT,                                   ///< name "widthForHeight",        type bool        @SINCE_1_0.0
301       HEIGHT_FOR_WIDTH,                                   ///< name "heightForWidth",        type bool        @SINCE_1_0.0
302       PADDING,                                            ///< name "padding",               type Vector4     @SINCE_1_0.0
303       MINIMUM_SIZE,                                       ///< name "minimumSize",           type Vector2     @SINCE_1_0.0
304       MAXIMUM_SIZE,                                       ///< name "maximumSize",           type Vector2     @SINCE_1_0.0
305       INHERIT_POSITION,                                   ///< name "inheritPosition",       type bool        @SINCE_1_1.24
306       CLIPPING_MODE,                                      ///< name "clippingMode",          type String      @SINCE_1_2_5
307       BATCH_PARENT,                                       ///< name "batchParent",           type bool        @SINCE_1_2.0
308     };
309   };
310
311   // Typedefs
312
313   typedef Signal< bool (Actor, const TouchEvent&) > TouchSignalType;        ///< @DEPRECATED_1_1.37 @brief Touch signal type @SINCE_1_0.0
314   typedef Signal< bool (Actor, const TouchData&) >  TouchDataSignalType;    ///< Touch signal type @SINCE_1_1.37
315   typedef Signal< bool (Actor, const HoverEvent&) > HoverSignalType;        ///< Hover signal type @SINCE_1_0.0
316   typedef Signal< bool (Actor, const WheelEvent&) > WheelEventSignalType;   ///< Wheel signal type @SINCE_1_0.0
317   typedef Signal< void (Actor) > OnStageSignalType;                         ///< Stage connection signal type @SINCE_1_0.0
318   typedef Signal< void (Actor) > OffStageSignalType;                        ///< Stage disconnection signal type @SINCE_1_0.0
319   typedef Signal< void (Actor) > OnRelayoutSignalType;                      ///< Called when the actor is relaid out @SINCE_1_0.0
320
321   // Creation
322
323   /**
324    * @brief Create an uninitialized Actor; this can be initialized with Actor::New().
325    *
326    * Calling member functions with an uninitialized Actor handle is not allowed.
327    * @SINCE_1_0.0
328    */
329   Actor();
330
331   /**
332    * @brief Create an initialized Actor.
333    *
334    * @SINCE_1_0.0
335    * @return A handle to a newly allocated Dali resource.
336    */
337   static Actor New();
338
339   /**
340    * @brief Downcast a handle to Actor handle.
341    *
342    * If handle points to a Actor object the downcast produces valid
343    * handle. If not the returned handle is left uninitialized.
344    *
345    * @SINCE_1_0.0
346    * @param[in] handle to An object
347    * @return handle to a Actor object or an uninitialized handle
348    */
349   static Actor DownCast( BaseHandle handle );
350
351   /**
352    * @brief Dali::Actor is intended as a base class
353    *
354    * This is non-virtual since derived Handle types must not contain data or virtual methods.
355    * @SINCE_1_0.0
356    */
357   ~Actor();
358
359   /**
360    * @brief Copy constructor
361    *
362    * @SINCE_1_0.0
363    * @param [in] copy The actor to copy.
364    */
365   Actor(const Actor& copy);
366
367   /**
368    * @brief Assignment operator
369    *
370    * @SINCE_1_0.0
371    * @param [in] rhs The actor to copy.
372    * @return A reference to this
373    */
374   Actor& operator=(const Actor& rhs);
375
376   /**
377    * @brief Retrieve the Actor's name.
378    *
379    * @SINCE_1_0.0
380    * @return The Actor's name.
381    * @pre The Actor has been initialized.
382    */
383   const std::string& GetName() const;
384
385   /**
386    * @brief Sets the Actor's name.
387    *
388    * @SINCE_1_0.0
389    * @param [in] name The new name.
390    * @pre The Actor has been initialized.
391    */
392   void SetName(const std::string& name);
393
394   /**
395    * @brief Retrieve the unique ID of the actor.
396    *
397    * @SINCE_1_0.0
398    * @return The ID.
399    * @pre The Actor has been initialized.
400    */
401   unsigned int GetId() const;
402
403   // Containment
404
405   /**
406    * @brief Query whether an actor is the root actor, which is owned by the Stage.
407    *
408    * @SINCE_1_0.0
409    * @return True if the actor is the root actor.
410    * @pre The Actor has been initialized.
411    */
412   bool IsRoot() const;
413
414   /**
415    * @brief Query whether the actor is connected to the Stage.
416    *
417    * When an actor is connected, it will be directly or indirectly parented to the root Actor.
418    * @SINCE_1_0.0
419    * @return True if the actor is connected to the Stage.
420    * @pre The Actor has been initialized.
421    * @note The root Actor is provided automatically by Dali::Stage, and is always considered to be connected.
422    */
423   bool OnStage() const;
424
425   /**
426    * @brief Query whether the actor is of class Dali::Layer.
427    *
428    * @SINCE_1_0.0
429    * @return True if the actor is a layer.
430    * @pre The Actor has been initialized.
431    */
432   bool IsLayer() const;
433
434   /**
435    * @brief Gets the layer in which the actor is present.
436    *
437    * @SINCE_1_0.0
438    * @return The layer, which will be uninitialized if the actor is off-stage.
439    * @pre The Actor has been initialized.
440    */
441   Layer GetLayer();
442
443   /**
444    * @brief Adds a child Actor to this Actor.
445    *
446    * @SINCE_1_0.0
447    * @param [in] child The child.
448    * @pre This Actor (the parent) has been initialized.
449    * @pre The child actor has been initialized.
450    * @pre The child actor is not the same as the parent actor.
451    * @pre The actor is not the Root actor.
452    * @post The child will be referenced by its parent. This means that the child will be kept alive,
453    * even if the handle passed into this method is reset or destroyed.
454    * @note if the child already has a parent, it will be removed from old parent
455    * and reparented to this actor. This may change childs position, color,
456    * scale etc as it now inherits them from this actor.
457    */
458   void Add(Actor child);
459
460   /**
461    * @brief Removes a child Actor from this Actor.
462    *
463    * If the actor was not a child of this actor, this is a no-op.
464    * @SINCE_1_0.0
465    * @param [in] child The child.
466    * @pre This Actor (the parent) has been initialized.
467    * @pre The child actor is not the same as the parent actor.
468    */
469   void Remove(Actor child);
470
471   /**
472    * @brief Removes an actor from its parent.
473    *
474    * If the actor has no parent, this method does nothing.
475    * @SINCE_1_0.0
476    * @pre The (child) actor has been initialized.
477    */
478   void Unparent();
479
480   /**
481    * @brief Retrieve the number of children held by the actor.
482    *
483    * @SINCE_1_0.0
484    * @return The number of children
485    * @pre The Actor has been initialized.
486    */
487   unsigned int GetChildCount() const;
488
489   /**
490    * @brief Retrieve and child actor by index.
491    *
492    * @SINCE_1_0.0
493    * @param[in] index The index of the child to retrieve
494    * @return The actor for the given index or empty handle if children not initialised
495    * @pre The Actor has been initialized.
496    */
497   Actor GetChildAt(unsigned int index) const;
498
499   /**
500    * @brief Search through this actor's hierarchy for an actor with the given name.
501    *
502    * The actor itself is also considered in the search.
503    * @SINCE_1_0.0
504    * @param[in] actorName the name of the actor to find
505    * @return A handle to the actor if found, or an empty handle if not.
506    * @pre The Actor has been initialized.
507    */
508   Actor FindChildByName(const std::string& actorName);
509
510   /**
511    * @brief Search through this actor's hierarchy for an actor with the given unique ID.
512    *
513    * The actor itself is also considered in the search.
514    * @SINCE_1_0.0
515    * @param[in] id the ID of the actor to find
516    * @return A handle to the actor if found, or an empty handle if not.
517    * @pre The Actor has been initialized.
518    */
519   Actor FindChildById(const unsigned int id);
520
521   /**
522    * @brief Retrieve the actor's parent.
523    *
524    * @SINCE_1_0.0
525    * @return A handle to the actor's parent. If the actor has no parent, this handle will be invalid.
526    * @pre The actor has been initialized.
527    */
528   Actor GetParent() const;
529
530   // Positioning
531
532   /**
533    * @brief Set the origin of an actor, within its parent's area.
534    *
535    * This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent,
536    * and (1.0, 1.0, 0.5) is the bottom-right corner.
537    * The default parent-origin is Dali::ParentOrigin::TOP_LEFT (0.0, 0.0, 0.5).
538    * An actor position is the distance between this origin, and the actors anchor-point.
539    * @image html parent-origin.png
540    * @SINCE_1_0.0
541    * @param [in] origin The new parent-origin.
542    * @pre The Actor has been initialized.
543    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentParentOrigin().
544    * @see Dali::ParentOrigin for predefined parent origin values
545    */
546   void SetParentOrigin(const Vector3& origin);
547
548   /**
549    * @brief Retrieve the parent-origin of an actor.
550    *
551    * @SINCE_1_0.0
552    * @return The current parent-origin.
553    * @pre The Actor has been initialized.
554    * @note This property can be animated; the return value may not match the value written with SetParentOrigin().
555    */
556   Vector3 GetCurrentParentOrigin() const;
557
558   /**
559    * @brief Set the anchor-point of an actor.
560    *
561    * This is expressed in unit coordinates, such that (0.0, 0.0, 0.5)
562    * is the top-left corner of the actor, and (1.0, 1.0, 0.5) is the
563    * bottom-right corner.  The default anchor point is
564    * Dali::AnchorPoint::CENTER (0.5, 0.5, 0.5).
565    * An actor position is the distance between its parent-origin, and this anchor-point.
566    * An actor's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.
567    * @image html anchor-point.png
568    * @SINCE_1_0.0
569    * @param [in] anchorPoint The new anchor-point.
570    * @pre The Actor has been initialized.
571    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentAnchorPoint().
572    * @see Dali::AnchorPoint for predefined anchor point values
573    */
574   void SetAnchorPoint(const Vector3& anchorPoint);
575
576   /**
577    * @brief Retrieve the anchor-point of an actor.
578    *
579    * @SINCE_1_0.0
580    * @return The current anchor-point.
581    * @pre The Actor has been initialized.
582    * @note This property can be animated; the return value may not match the value written with SetAnchorPoint().
583    */
584   Vector3 GetCurrentAnchorPoint() const;
585
586   /**
587    * @brief Sets the size of an actor.
588    *
589    * Geometry can be scaled to fit within this area.
590    * This does not interfere with the actors scale factor.
591    * The actors default depth is the minimum of width & height.
592    * @SINCE_1_0.0
593    * @param [in] width  The new width.
594    * @param [in] height The new height.
595    * @pre The actor has been initialized.
596    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentSize().
597    */
598   void SetSize(float width, float height);
599
600   /**
601    * @brief Sets the size of an actor.
602    *
603    * Geometry can be scaled to fit within this area.
604    * This does not interfere with the actors scale factor.
605    * @SINCE_1_0.0
606    * @param [in] width  The size of the actor along the x-axis.
607    * @param [in] height The size of the actor along the y-axis.
608    * @param [in] depth The size of the actor along the z-axis.
609    * @pre The actor has been initialized.
610    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentSize().
611    */
612   void SetSize(float width, float height, float depth);
613
614   /**
615    * @brief Sets the size of an actor.
616    *
617    * Geometry can be scaled to fit within this area.
618    * This does not interfere with the actors scale factor.
619    * The actors default depth is the minimum of width & height.
620    * @SINCE_1_0.0
621    * @param [in] size The new size.
622    * @pre The actor has been initialized.
623    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentSize().
624    */
625   void SetSize(const Vector2& size);
626
627   /**
628    * @brief Sets the size of an actor.
629    *
630    * Geometry can be scaled to fit within this area.
631    * This does not interfere with the actors scale factor.
632    * @SINCE_1_0.0
633    * @param [in] size The new size.
634    * @pre The actor has been initialized.
635    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentSize().
636    */
637   void SetSize(const Vector3& size);
638
639   /**
640    * @brief Retrieve the actor's size.
641    *
642    * @SINCE_1_0.0
643    * @return The actor's target size.
644    * @pre The actor has been initialized.
645    * @note This return is the value that was set using SetSize or the target size of an animation.
646    */
647   Vector3 GetTargetSize() const;
648
649   /**
650    * @brief Retrieve the actor's size.
651    *
652    * @SINCE_1_0.0
653    * @return The actor's current size.
654    * @pre The actor has been initialized.
655    * @note This property can be animated; the return value may not match the value written with SetSize().
656    */
657   Vector3 GetCurrentSize() const;
658
659   /**
660    * @brief Return the natural size of the actor.
661    *
662    * Deriving classes stipulate the natural size and by default an actor has a ZERO natural size.
663    *
664    * @SINCE_1_0.0
665    * @return The actor's natural size
666    */
667   Vector3 GetNaturalSize() const;
668
669   /**
670    * @brief Sets the position of the actor.
671    *
672    * The Actor's z position will be set to 0.0f.
673    * @SINCE_1_0.0
674    * @param [in] x The new x position
675    * @param [in] y The new y position
676    * @pre The Actor has been initialized.
677    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentPosition().
678    */
679   void SetPosition(float x, float y);
680
681   /**
682    * @brief Sets the position of the Actor.
683    *
684    * @SINCE_1_0.0
685    * @param [in] x The new x position
686    * @param [in] y The new y position
687    * @param [in] z The new z position
688    * @pre The Actor has been initialized.
689    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentPosition().
690    */
691   void SetPosition(float x, float y, float z);
692
693   /**
694    * @brief Sets the position of the Actor.
695    *
696    * @SINCE_1_0.0
697    * @param [in] position The new position
698    * @pre The Actor has been initialized.
699    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentPosition().
700    */
701   void SetPosition(const Vector3& position);
702
703   /**
704    * @brief Set the position of an actor along the X-axis.
705    *
706    * @SINCE_1_0.0
707    * @param [in] x The new x position
708    * @pre The Actor has been initialized.
709    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentPosition().
710    */
711   void SetX(float x);
712
713   /**
714    * @brief Set the position of an actor along the Y-axis.
715    *
716    * @SINCE_1_0.0
717    * @param [in] y The new y position.
718    * @pre The Actor has been initialized.
719    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentPosition().
720    */
721   void SetY(float y);
722
723   /**
724    * @brief Set the position of an actor along the Z-axis.
725    *
726    * @SINCE_1_0.0
727    * @param [in] z The new z position
728    * @pre The Actor has been initialized.
729    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentPosition().
730    */
731   void SetZ(float z);
732
733   /**
734    * @brief Translate an actor relative to its existing position.
735    *
736    * @SINCE_1_0.0
737    * @param[in] distance The actor will move by this distance.
738    * @pre The actor has been initialized.
739    */
740   void TranslateBy(const Vector3& distance);
741
742   /**
743    * @brief Retrieve the position of the Actor.
744    *
745    * @SINCE_1_0.0
746    * @return the Actor's current position.
747    * @pre The Actor has been initialized.
748    * @note This property can be animated; the return value may not match the value written with SetPosition().
749    */
750   Vector3 GetCurrentPosition() const;
751
752   /**
753    * @brief Retrieve the world-position of the Actor.
754    *
755    * @SINCE_1_0.0
756    * @return The Actor's current position in world coordinates.
757    * @pre The Actor has been initialized.
758    * @note The actor will not have a world-position, unless it has previously been added to the stage.
759    */
760   Vector3 GetCurrentWorldPosition() const;
761
762   /**
763    * @DEPRECATED_1_1.24 Use SetInheritPosition instead
764    * @brief Set the actors position inheritance mode.
765    *
766    * The default is to inherit.
767    * Switching this off means that using SetPosition() sets the actor's world position.
768    * @SINCE_1_0.0
769    * @param[in] mode to use
770    * @pre The Actor has been initialized.
771    * @see PositionInheritanceMode
772    */
773   void SetPositionInheritanceMode( PositionInheritanceMode mode );
774
775   /**
776    * @brief Set whether a child actor inherits it's parent's position.
777    *
778    * Default is to inherit.
779    * Switching this off means that using SetPosition() sets the actor's world position3
780    * @SINCE_1_1.24
781    * @param[in] inherit - true if the actor should inherit position, false otherwise.
782    * @pre The Actor has been initialized.
783    */
784   inline void SetInheritPosition( bool inherit )
785   {
786     SetProperty(Property::INHERIT_POSITION, inherit );
787   }
788
789   /**
790    * @DEPRECATED_1_1.24 Use IsPositionInherited
791    * @brief Returns the actors position inheritance mode.
792    *
793    * @SINCE_1_0.0
794    * @return Return the position inheritance mode.
795    * @pre The Actor has been initialized.
796    */
797   PositionInheritanceMode GetPositionInheritanceMode() const;
798
799   /**
800    * @brief Returns whether the actor inherits its parent's position.
801    *
802    * @SINCE_1_1.24
803    * @return True if the actor inherits its parent position, false if it uses world position.
804    * @pre The Actor has been initialized.
805    */
806   inline bool IsPositionInherited() const
807   {
808     return GetProperty(Property::INHERIT_POSITION ).Get<bool>();
809   }
810
811   /**
812    * @brief Sets the orientation of the Actor.
813    *
814    * An actor's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.
815    * @SINCE_1_0.0
816    * @param [in] angle The new orientation angle in degrees.
817    * @param [in] axis The new axis of orientation.
818    * @pre The Actor has been initialized.
819    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentOrientation().
820    */
821   void SetOrientation( const Degree& angle, const Vector3& axis )
822   {
823     SetOrientation( Radian( angle ), axis );
824   }
825
826   /**
827    * @brief Sets the orientation of the Actor.
828    *
829    * An actor's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.
830    * @SINCE_1_0.0
831    * @param [in] angle The new orientation angle in radians.
832    * @param [in] axis The new axis of orientation.
833    * @pre The Actor has been initialized.
834    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentOrientation().
835    */
836   void SetOrientation(const Radian& angle, const Vector3& axis);
837
838   /**
839    * @brief Sets the orientation of the Actor.
840    *
841    * An actor's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.
842    * @SINCE_1_0.0
843    * @param [in] orientation The new orientation.
844    * @pre The Actor has been initialized.
845    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentOrientation().
846    */
847   void SetOrientation(const Quaternion& orientation);
848
849   /**
850    * @brief Apply a relative rotation to an actor.
851    *
852    * @SINCE_1_0.0
853    * @param[in] angle The angle to the rotation to combine with the existing orientation.
854    * @param[in] axis The axis of the rotation to combine with the existing orientation.
855    * @pre The actor has been initialized.
856    */
857   void RotateBy( const Degree& angle, const Vector3& axis )
858   {
859     RotateBy( Radian( angle ), axis );
860   }
861
862   /**
863    * @brief Apply a relative rotation to an actor.
864    *
865    * @SINCE_1_0.0
866    * @param[in] angle The angle to the rotation to combine with the existing orientation.
867    * @param[in] axis The axis of the rotation to combine with the existing orientation.
868    * @pre The actor has been initialized.
869    */
870   void RotateBy(const Radian& angle, const Vector3& axis);
871
872   /**
873    * @brief Apply a relative rotation to an actor.
874    *
875    * @SINCE_1_0.0
876    * @param[in] relativeRotation The rotation to combine with the existing orientation.
877    * @pre The actor has been initialized.
878    */
879   void RotateBy(const Quaternion& relativeRotation);
880
881   /**
882    * @brief Retreive the Actor's orientation.
883    *
884    * @SINCE_1_0.0
885    * @return The current orientation.
886    * @pre The Actor has been initialized.
887    * @note This property can be animated; the return value may not match the value written with SetOrientation().
888    */
889   Quaternion GetCurrentOrientation() const;
890
891   /**
892    * @brief Set whether a child actor inherits it's parent's orientation.
893    *
894    * Default is to inherit.
895    * Switching this off means that using SetOrientation() sets the actor's world orientation.
896    * @SINCE_1_0.0
897    * @param[in] inherit - true if the actor should inherit orientation, false otherwise.
898    * @pre The Actor has been initialized.
899    */
900   void SetInheritOrientation(bool inherit);
901
902   /**
903    * @brief Returns whether the actor inherits its parent's orientation.
904    *
905    * @SINCE_1_0.0
906    * @return True if the actor inherits its parent orientation, false if it uses world orientation.
907    * @pre The Actor has been initialized.
908    */
909   bool IsOrientationInherited() const;
910
911   /**
912    * @brief Retrieve the world-orientation of the Actor.
913    *
914    * @SINCE_1_0.0
915    * @return The Actor's current orientation in the world.
916    * @pre The Actor has been initialized.
917    * @note The actor will not have a world-orientation, unless it has previously been added to the stage.
918    */
919   Quaternion GetCurrentWorldOrientation() const;
920
921   /**
922    * @brief Set the scale factor applied to an actor.
923    *
924    * @SINCE_1_0.0
925    * @param [in] scale The scale factor applied on all axes.
926    * @pre The Actor has been initialized.
927    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentScale().
928    */
929   void SetScale(float scale);
930
931   /**
932    * @brief Set the scale factor applied to an actor.
933    *
934    * @SINCE_1_0.0
935    * @param [in] scaleX The scale factor applied along the x-axis.
936    * @param [in] scaleY The scale factor applied along the y-axis.
937    * @param [in] scaleZ The scale factor applied along the z-axis.
938    * @pre The Actor has been initialized.
939    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentScale().
940    */
941   void SetScale(float scaleX, float scaleY, float scaleZ);
942
943   /**
944    * @brief Set the scale factor applied to an actor.
945    *
946    * @SINCE_1_0.0
947    * @param [in] scale A vector representing the scale factor for each axis.
948    * @pre The Actor has been initialized.
949    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentScale().
950    */
951   void SetScale(const Vector3& scale);
952
953   /**
954    * @brief Apply a relative scale to an actor.
955    *
956    * @SINCE_1_0.0
957    * @param[in] relativeScale The scale to combine with the actor's existing scale.
958    * @pre The actor has been initialized.
959    */
960   void ScaleBy(const Vector3& relativeScale);
961
962   /**
963    * @brief Retrieve the scale factor applied to an actor.
964    *
965    * @SINCE_1_0.0
966    * @return A vector representing the scale factor for each axis.
967    * @pre The Actor has been initialized.
968    * @note This property can be animated; the return value may not match the value written with SetScale().
969    */
970   Vector3 GetCurrentScale() const;
971
972   /**
973    * @brief Retrieve the world-scale of the Actor.
974    *
975    * @SINCE_1_0.0
976    * @return The Actor's current scale in the world.
977    * @pre The Actor has been initialized.
978    * @note The actor will not have a world-scale, unless it has previously been added to the stage.
979    */
980   Vector3 GetCurrentWorldScale() const;
981
982   /**
983    * @brief Set whether a child actor inherits it's parent's scale.
984    *
985    * Default is to inherit.
986    * Switching this off means that using SetScale() sets the actor's world scale.
987    * @SINCE_1_0.0
988    * @param[in] inherit - true if the actor should inherit scale, false otherwise.
989    * @pre The Actor has been initialized.
990    */
991   void SetInheritScale( bool inherit );
992
993   /**
994    * @brief Returns whether the actor inherits its parent's scale.
995    *
996    * @SINCE_1_0.0
997    * @return True if the actor inherits its parent scale, false if it uses world scale.
998    * @pre The Actor has been initialized.
999    */
1000   bool IsScaleInherited() const;
1001
1002   /**
1003    * @brief Retrieves the world-matrix of the actor.
1004    *
1005    * @SINCE_1_0.0
1006    * @return The Actor's current world matrix
1007    * @pre The Actor has been initialized.
1008    * @note The actor will not have a world-matrix, unless it has previously been added to the stage.
1009    */
1010   Matrix GetCurrentWorldMatrix() const;
1011
1012   // Visibility & Color
1013
1014   /**
1015    * @brief Sets the visibility flag of an actor.
1016    *
1017    * @SINCE_1_0.0
1018    * @param [in] visible The new visibility flag.
1019    * @pre The actor has been initialized.
1020    * @note This is an asynchronous method; the value written may not match a value subsequently read with IsVisible().
1021    * @note If an actor's visibility flag is set to false, then the actor and its children will not be rendered.
1022    *       This is regardless of the individual visibility values of the children i.e. an actor will only be
1023    *       rendered if all of its parents have visibility set to true.
1024    */
1025   void SetVisible(bool visible);
1026
1027   /**
1028    * @brief Retrieve the visibility flag of an actor.
1029    *
1030    * @SINCE_1_0.0
1031    * @return The visibility flag.
1032    * @pre The actor has been initialized.
1033    * @note This property can be animated; the return value may not match the value written with SetVisible().
1034    * @note If an actor is not visible, then the actor and its children will not be rendered.
1035    *       This is regardless of the individual visibility values of the children i.e. an actor will only be
1036    *       rendered if all of its parents have visibility set to true.
1037    */
1038   bool IsVisible() const;
1039
1040   /**
1041    * @brief Sets the opacity of an actor.
1042    *
1043    * @SINCE_1_0.0
1044    * @param [in] opacity The new opacity.
1045    * @pre The actor has been initialized.
1046    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentOpacity().
1047    */
1048   void SetOpacity(float opacity);
1049
1050   /**
1051    * @brief Retrieve the actor's opacity.
1052    *
1053    * @SINCE_1_0.0
1054    * @return The actor's opacity.
1055    * @pre The actor has been initialized.
1056    * @note This property can be animated; the return value may not match the value written with SetOpacity().
1057    */
1058   float GetCurrentOpacity() const;
1059
1060   /**
1061    * @brief Sets the actor's color; this is an RGBA value.
1062    *
1063    * The final color of the actor depends on its color mode.
1064    * @SINCE_1_0.0
1065    * @param [in] color The new color.
1066    * @pre The Actor has been initialized.
1067    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentColor().
1068    */
1069   void SetColor(const Vector4& color);
1070
1071   /**
1072    * @brief Retrieve the actor's color.
1073    *
1074    * Actor's own color is not clamped.
1075    * @SINCE_1_0.0
1076    * @return The color.
1077    * @pre The Actor has been initialized.
1078    * @note This property can be animated; the return value may not match the value written with SetColor().
1079    */
1080   Vector4 GetCurrentColor() const;
1081
1082   /**
1083    * @brief Sets the actor's color mode.
1084    *
1085    * This specifies whether the Actor uses its own color, or inherits
1086    * its parent color. The default is USE_OWN_MULTIPLY_PARENT_ALPHA.
1087    * @SINCE_1_0.0
1088    * @param [in] colorMode to use.
1089    * @pre The Actor has been initialized.
1090    */
1091   void SetColorMode( ColorMode colorMode );
1092
1093   /**
1094    * @brief Returns the actor's color mode.
1095    *
1096    * @SINCE_1_0.0
1097    * @return currently used colorMode.
1098    * @pre The Actor has been initialized.
1099    */
1100   ColorMode GetColorMode() const;
1101
1102   /**
1103    * @brief Retrieve the world-color of the Actor, where each component is clamped within the 0->1 range.
1104    *
1105    * @SINCE_1_0.0
1106    * @return The Actor's current color in the world.
1107    * @pre The Actor has been initialized.
1108    * @note The actor will not have a world-color, unless it has previously been added to the stage.
1109    */
1110   Vector4 GetCurrentWorldColor() const;
1111
1112   /**
1113    * @brief Set how the actor and its children should be drawn.
1114    *
1115    * Not all actors are renderable, but DrawMode can be inherited from any actor.
1116    * If an object is in a 3D layer, it will be depth-tested against
1117    * other objects in the world i.e. it may be obscured if other objects are in front.
1118    *
1119    * If DrawMode::OVERLAY_2D is used, the actor and its children will be drawn as a 2D overlay.
1120    * Overlay actors are drawn in a separate pass, after all non-overlay actors within the Layer.
1121    * For overlay actors, the drawing order is with respect to tree levels of Actors,
1122    * and depth-testing will not be used.
1123
1124    * @SINCE_1_0.0
1125    * @param[in] drawMode The new draw-mode to use.
1126    * @note Layers do not inherit the DrawMode from their parents.
1127    */
1128   void SetDrawMode( DrawMode::Type drawMode );
1129
1130   /**
1131    * @brief Query how the actor and its children will be drawn.
1132    *
1133    * @SINCE_1_0.0
1134    * @return Return the draw mode type.
1135    */
1136   DrawMode::Type GetDrawMode() const;
1137
1138   // Input Handling
1139
1140   /**
1141    * @brief Sets whether an actor should emit touch or hover signals.
1142    *
1143    * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
1144    * the touch event signal will be emitted, and as soon as an application connects to the SignalHover(), the
1145    * hover event signal will be emitted.
1146    *
1147    * If the application wishes to temporarily disable the touch or hover event signal emission, then they can do so by calling:
1148    * @code
1149    * actor.SetSensitive(false);
1150    * @endcode
1151    *
1152    * Then, to re-enable the touch or hover event signal emission, the application should call:
1153    * @code
1154    * actor.SetSensitive(true);
1155    * @endcode
1156    *
1157    * @SINCE_1_0.0
1158    * @param[in]  sensitive  true to enable emission of the touch or hover event signals, false otherwise.
1159    * @pre The Actor has been initialized.
1160    * @note If an actor's sensitivity is set to false, then it's children will not be hittable either.
1161    *       This is regardless of the individual sensitivity values of the children i.e. an actor will only be
1162    *       hittable if all of its parents have sensitivity set to true.
1163    * @see @see TouchedSignal() and HoveredSignal().
1164    */
1165   void SetSensitive(bool sensitive);
1166
1167   /**
1168    * @brief Query whether an actor emits touch or hover event signals.
1169    *
1170    * @SINCE_1_0.0
1171    * @return True, if emission of touch or hover event signals is enabled, false otherwise.
1172    * @pre The Actor has been initialized.
1173    * @note If an actor is not sensitive, then it's children will not be hittable either.
1174    *       This is regardless of the individual sensitivity values of the children i.e. an actor will only be
1175    *       hittable if all of its parents have sensitivity set to true.
1176    */
1177   bool IsSensitive() const;
1178
1179   /**
1180    * @brief Converts screen coordinates into the actor's coordinate system using the default camera.
1181    *
1182    * @SINCE_1_0.0
1183    * @param[out] localX On return, the X-coordinate relative to the actor.
1184    * @param[out] localY On return, the Y-coordinate relative to the actor.
1185    * @param[in] screenX The screen X-coordinate.
1186    * @param[in] screenY The screen Y-coordinate.
1187    * @return True if the conversion succeeded.
1188    * @pre The Actor has been initialized.
1189    * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
1190    */
1191   bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const;
1192
1193   /**
1194    * @brief Sets whether the actor should receive a notification when touch or hover motion events leave
1195    * the boundary of the actor.
1196    *
1197    * @SINCE_1_0.0
1198    * @param[in]  required  Should be set to true if a Leave event is required
1199    * @pre The Actor has been initialized.
1200    * @note By default, this is set to false as most actors do not require this.
1201    * @note Need to connect to the TouchedSignal() or HoveredSignal() to actually receive this event.
1202    *
1203    */
1204   void SetLeaveRequired(bool required);
1205
1206   /**
1207    * @brief This returns whether the actor requires touch or hover events whenever touch or hover motion events leave
1208    * the boundary of the actor.
1209    *
1210    * @SINCE_1_0.0
1211    * @return True if a Leave event is required, false otherwise.
1212    * @pre The Actor has been initialized.
1213    */
1214   bool GetLeaveRequired() const;
1215
1216   /**
1217    * @brief Sets whether the actor should be focusable by keyboard navigation.
1218    *
1219    * The default is false.
1220    * @SINCE_1_0.0
1221    * @param[in] focusable - true if the actor should be focusable by keyboard navigation,
1222    * false otherwise.
1223    * @pre The Actor has been initialized.
1224    */
1225   void SetKeyboardFocusable( bool focusable );
1226
1227   /**
1228    * @brief Returns whether the actor is focusable by keyboard navigation.
1229    *
1230    * @SINCE_1_0.0
1231    * @return True if the actor is focusable by keyboard navigation, false if not.
1232    * @pre The Actor has been initialized.
1233    */
1234   bool IsKeyboardFocusable() const;
1235
1236   // SIZE NEGOTIATION
1237
1238   /**
1239    * @brief Set the resize policy to be used for the given dimension(s).
1240    *
1241    * @SINCE_1_0.0
1242    * @param[in] policy The resize policy to use
1243    * @param[in] dimension The dimension(s) to set policy for. Can be a bitfield of multiple dimensions.
1244    */
1245   void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
1246
1247   /**
1248    * @brief Return the resize policy used for a single dimension.
1249    *
1250    * @SINCE_1_0.0
1251    * @param[in] dimension The dimension to get policy for
1252    * @return Return the dimension resize policy. If more than one dimension is requested, just return the first one found.
1253    */
1254   ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
1255
1256   /**
1257    * @brief Set the policy to use when setting size with size negotiation. Defaults to SizeScalePolicy::USE_SIZE_SET.
1258    *
1259    * @SINCE_1_0.0
1260    * @param[in] policy The policy to use for when the size is set
1261    */
1262   void SetSizeScalePolicy( SizeScalePolicy::Type policy );
1263
1264   /**
1265    * @brief Return the size scale policy in use.
1266    *
1267    * @SINCE_1_0.0
1268    * @return Return the size scale policy.
1269    */
1270   SizeScalePolicy::Type GetSizeScalePolicy() const;
1271
1272   /**
1273    * @brief Sets the relative to parent size factor of the actor.
1274    *
1275    * This factor is only used when ResizePolicy is set to either:
1276    * ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
1277    * This actor's size is set to the actor's size multipled by or added to this factor,
1278    * depending on ResizePolicy ( See SetResizePolicy() ).
1279    *
1280    * @SINCE_1_0.0
1281    * @param [in] factor A Vector3 representing the relative factor to be applied to each axis.
1282    * @pre The Actor has been initialized.
1283    */
1284   void SetSizeModeFactor( const Vector3& factor );
1285
1286   /**
1287    * @brief Retrieve the relative to parent size factor of the actor.
1288    *
1289    * @SINCE_1_0.0
1290    * @return The Actor's current relative size factor.
1291    * @pre The Actor has been initialized.
1292    */
1293   Vector3 GetSizeModeFactor() const;
1294
1295   /**
1296    * @brief Calculate the height of the actor given a width.
1297    *
1298    * The natural size is used for default calculation.
1299    * size 0 is treated as aspect ratio 1:1.
1300    *
1301    * @SINCE_1_0.0
1302    * @param width Width to use
1303    * @return Return the height based on the width.
1304    */
1305   float GetHeightForWidth( float width );
1306
1307   /**
1308    * @brief Calculate the width of the actor given a height.
1309    *
1310    * The natural size is used for default calculation.
1311    * size 0 is treated as aspect ratio 1:1.
1312    *
1313    * @SINCE_1_0.0
1314    * @param height Height to use
1315    * @return Return the width based on the height.
1316    */
1317   float GetWidthForHeight( float height );
1318
1319   /**
1320    * @brief Return the value of negotiated dimension for the given dimension.
1321    *
1322    * @SINCE_1_0.0
1323    * @param dimension The dimension to retrieve
1324    * @return Return the value of the negotiated dimension. If more than one dimension is requested, just return the first one found.
1325    */
1326   float GetRelayoutSize( Dimension::Type dimension ) const;
1327
1328   /**
1329    * @brief Set the padding for use in layout.
1330    *
1331    * @SINCE_1_0.0
1332    * @param[in] padding Padding for the actor
1333    */
1334   void SetPadding( const Padding& padding );
1335
1336   /**
1337    * @brief Return the value of the padding.
1338    *
1339    * @SINCE_1_0.0
1340    * @param paddingOut The returned padding data
1341    */
1342   void GetPadding( Padding& paddingOut ) const;
1343
1344   /**
1345    * @brief Set the minimum size an actor can be assigned in size negotiation.
1346    *
1347    * @SINCE_1_0.0
1348    * @param[in] size The minimum size
1349    */
1350   void SetMinimumSize( const Vector2& size );
1351
1352   /**
1353    * @brief Return the minimum relayout size.
1354    *
1355    * @SINCE_1_0.0
1356    * @return Return the mininmum size.
1357    */
1358   Vector2 GetMinimumSize();
1359
1360   /**
1361    * @brief Set the maximum size an actor can be assigned in size negotiation.
1362    *
1363    * @SINCE_1_0.0
1364    * @param[in] size The maximum size
1365    */
1366   void SetMaximumSize( const Vector2& size );
1367
1368   /**
1369    * @brief Return the maximum relayout size.
1370    *
1371    * @SINCE_1_0.0
1372    * @return Return the maximum size.
1373    */
1374   Vector2 GetMaximumSize();
1375
1376   /**
1377    * @brief Get depth in the hierarchy for the actor.
1378    *
1379    * @SINCE_1_0.0
1380    * @return The current depth in the hierarchy of the actor, or -1 if actor is not in the hierarchy
1381    */
1382   int GetHierarchyDepth();
1383
1384 public: // Renderer
1385
1386   /**
1387    * @brief Add a renderer to this actor.
1388    *
1389    * @SINCE_1_0.0
1390    * @param[in] renderer Renderer to add to the actor
1391    * @return The index of the Renderer that was added
1392    * @pre The renderer must be initialized.
1393    *
1394    */
1395   unsigned int AddRenderer( Renderer& renderer );
1396
1397   /**
1398    * @brief Get the number of renderers on this actor.
1399    *
1400    * @SINCE_1_0.0
1401    * @return the number of renderers on this actor
1402    */
1403   unsigned int GetRendererCount() const;
1404
1405   /**
1406    * @brief Get a Renderer by index.
1407    *
1408    * @SINCE_1_0.0
1409    * @param[in] index The index of the renderer to fetch
1410    * @return The renderer at the specified index
1411    * @pre The index must be between 0 and GetRendererCount()-1
1412    *
1413    */
1414   Renderer GetRendererAt( unsigned int index );
1415
1416   /**
1417    * @brief Remove an renderer from the actor.
1418    *
1419    * @SINCE_1_0.0
1420    * @param[in] renderer Handle to the renderer that is to be removed
1421    */
1422   void RemoveRenderer( Renderer& renderer );
1423
1424   /**
1425    * @brief Remove an renderer from the actor by index.
1426    *
1427    * @SINCE_1_0.0
1428    * @param[in] index Index of the renderer that is to be removed
1429    * @pre The index must be between 0 and GetRendererCount()-1
1430    *
1431    */
1432   void RemoveRenderer( unsigned int index );
1433
1434 public: // Signals
1435
1436   /**
1437    * @DEPRECATED_1_1.37 Use TouchSignal() instead.
1438    * @brief This signal is emitted when touch input is received.
1439    *
1440    * A callback of the following type may be connected:
1441    * @code
1442    *   bool YourCallbackName(Actor actor, const TouchEvent& event);
1443    * @endcode
1444    * The return value of True, indicates that the touch event should be consumed.
1445    * Otherwise the signal will be emitted on the next sensitive parent of the actor.
1446    * @SINCE_1_0.0
1447    * @return The signal to connect to.
1448    * @pre The Actor has been initialized.
1449    */
1450   TouchSignalType& TouchedSignal();
1451
1452   /**
1453    * @brief This signal is emitted when touch input is received.
1454    *
1455    * A callback of the following type may be connected:
1456    * @code
1457    *   bool YourCallbackName( Actor actor, TouchData& touch );
1458    * @endcode
1459    * The return value of True, indicates that the touch event has been consumed.
1460    * Otherwise the signal will be emitted on the next sensitive parent of the actor.
1461    * @SINCE_1_1.37
1462    * @return The signal to connect to.
1463    * @pre The Actor has been initialized.
1464    */
1465   TouchDataSignalType& TouchSignal();
1466
1467   /**
1468    * @brief This signal is emitted when hover input is received.
1469    *
1470    * A callback of the following type may be connected:
1471    * @code
1472    *   bool YourCallbackName(Actor actor, const HoverEvent& event);
1473    * @endcode
1474    * The return value of True, indicates that the hover event should be consumed.
1475    * Otherwise the signal will be emitted on the next sensitive parent of the actor.
1476    * @SINCE_1_0.0
1477    * @return The signal to connect to.
1478    * @pre The Actor has been initialized.
1479    */
1480   HoverSignalType& HoveredSignal();
1481
1482   /**
1483    * @brief This signal is emitted when wheel event is received.
1484    *
1485    * A callback of the following type may be connected:
1486    * @code
1487    *   bool YourCallbackName(Actor actor, const WheelEvent& event);
1488    * @endcode
1489    * The return value of True, indicates that the wheel event should be consumed.
1490    * Otherwise the signal will be emitted on the next sensitive parent of the actor.
1491    * @SINCE_1_0.0
1492    * @return The signal to connect to.
1493    * @pre The Actor has been initialized.
1494    */
1495   WheelEventSignalType& WheelEventSignal();
1496
1497   /**
1498    * @brief This signal is emitted after the actor has been connected to the stage.
1499    *
1500    * When an actor is connected, it will be directly or indirectly parented to the root Actor.
1501    * @SINCE_1_0.0
1502    * @return The signal to connect to.
1503    * @note The root Actor is provided automatically by Dali::Stage, and is always considered to be connected.
1504    *
1505    * @note When the parent of a set of actors is connected to the stage, then all of the children
1506    * will received this callback.
1507    * For the following actor tree, the callback order will be A, B, D, E, C, and finally F.
1508    *
1509    * @code
1510    *
1511    *       A (parent)
1512    *      / \
1513    *     B   C
1514    *    / \   \
1515    *   D   E   F
1516    *
1517    * @endcode
1518    */
1519   OnStageSignalType& OnStageSignal();
1520
1521   /**
1522    * @brief This signal is emitted after the actor has been disconnected from the stage.
1523    *
1524    * If an actor is disconnected it either has no parent, or is parented to a disconnected actor.
1525    *
1526    * @SINCE_1_0.0
1527    * @return The signal to connect to.
1528    * @note When the parent of a set of actors is disconnected to the stage, then all of the children
1529    * will received this callback, starting with the leaf actors.
1530    * For the following actor tree, the callback order will be D, E, B, F, C, and finally A.
1531    *
1532    * @code
1533    *
1534    *       A (parent)
1535    *      / \
1536    *     B   C
1537    *    / \   \
1538    *   D   E   F
1539    *
1540    * @endcode
1541    *
1542    */
1543   OffStageSignalType& OffStageSignal();
1544
1545   /**
1546    * @brief This signal is emitted after the size has been set on the actor during relayout
1547    *
1548    * @SINCE_1_0.0
1549    * @return The signal
1550    */
1551   OnRelayoutSignalType& OnRelayoutSignal();
1552
1553 public: // Not intended for application developers
1554
1555   /// @cond internal
1556   /**
1557    * @brief This constructor is used by Actor::New() methods.
1558    *
1559    * @SINCE_1_0.0
1560    * @param [in] actor A pointer to a newly allocated Dali resource
1561    */
1562   explicit DALI_INTERNAL Actor(Internal::Actor* actor);
1563   /// @endcond
1564 };
1565
1566 /**
1567  * @brief Helper for discarding an actor handle.
1568  *
1569  * If the handle is empty, this method does nothing.  Otherwise
1570  * Actor::Unparent() will be called, followed by Actor::Reset().
1571  * @SINCE_1_0.0
1572  * @param[in,out] actor A handle to an actor, or an empty handle.
1573  */
1574 inline void UnparentAndReset( Actor& actor )
1575 {
1576   if( actor )
1577   {
1578     actor.Unparent();
1579     actor.Reset();
1580   }
1581 }
1582
1583 /**
1584  * @}
1585  */
1586 } // namespace Dali
1587
1588 #endif // DALI_ACTOR_H