Use modern construct 'using' instead of typedef.
[platform/core/uifw/dali-core.git] / dali / public-api / actors / actor.h
index 7b3cb73..da72ad2 100644 (file)
@@ -49,16 +49,14 @@ class Renderer;
 struct Degree;
 class Quaternion;
 class Layer;
-struct KeyEvent;
-class TouchData;
-struct TouchEvent;
-struct HoverEvent;
-struct WheelEvent;
+class TouchEvent;
+class HoverEvent;
+class WheelEvent;
 struct Vector2;
 struct Vector3;
 struct Vector4;
 
-typedef Rect<float> Padding;      ///< Padding definition @SINCE_1_0.0
+using Padding = Rect<float>; ///< Padding definition @SINCE_1_0.0
 
 /**
  * @brief Actor is the primary object with which Dali applications interact.
@@ -104,7 +102,7 @@ typedef Rect<float> Padding;      ///< Padding definition @SINCE_1_0.0
  *       // Only hit-test the actor and its children if it is sensitive and visible
  *       IF ( ACTOR-IS-SENSITIVE &&
  *            ACTOR-IS-VISIBLE &&
- *            ACTOR-IS-ON-STAGE )
+ *            ACTOR-IS-ON-SCENE )
  *       {
  *         // Depth-first traversal within current layer, visiting parent first
  *
@@ -217,10 +215,6 @@ typedef Rect<float> Padding;      ///< Padding definition @SINCE_1_0.0
  *   - If the consumed actor on hover-start is not the same as the consumed actor on hover-finished, then
  *     hover signals are also emitted from the hover-started actor with an "Interrupted" state.
  *
- * <h3>Key Events:</h3>
- *
- * Key events are received by an actor once set to grab key events, only one actor can be set as focused.
- *
  * @nosubgrouping
  *
  * Signals
@@ -229,8 +223,8 @@ typedef Rect<float> Padding;      ///< Padding definition @SINCE_1_0.0
  * | touched           | @ref TouchedSignal()         |
  * | hovered           | @ref HoveredSignal()         |
  * | wheelEvent        | @ref WheelEventSignal()      |
- * | onStage           | @ref OnStageSignal()         |
- * | offStage          | @ref OffStageSignal()        |
+ * | onScene           | @ref OnSceneSignal()         |
+ * | offScene          | @ref OffSceneSignal()        |
  * | onRelayout        | @ref OnRelayoutSignal()      |
  *
  * Actions
@@ -549,11 +543,6 @@ public:
       COLOR_MODE,
 
       /**
-       * @brief This property is removed because it's deprecated.
-       */
-      RESERVED_PROPERTY_01,
-
-      /**
        * @brief The draw mode of an actor.
        * @details Name "drawMode", type DrawMode::Type (Property::INTEGER) or Property::STRING.
        * @SINCE_1_0.0
@@ -657,19 +646,97 @@ public:
        * @SINCE_1_2.60
        */
       INHERIT_LAYOUT_DIRECTION,
+
+      /**
+       * @brief The opacity of the actor.
+       * @details Name "opacity", type Property::FLOAT.
+       * @SINCE_1_9.17
+       */
+      OPACITY,
+
+      /**
+       * @brief Returns the screen position of the Actor
+       * @details Name "screenPosition", type Property::VECTOR2. Read-only
+       * @note This assumes default camera and default render-task and the Z position is ZERO.
+       * @note The last known frame is used for the calculation. May not match a position value just set.
+       * @SINCE_1_9.17
+       */
+      SCREEN_POSITION,
+
+      /**
+       * @brief Determines whether the anchor point should be used to determine the position of the actor.
+       * @details Name "positionUsesAnchorPoint", type Property::BOOLEAN.
+       * @note This is true by default.
+       * @note If false, then the top-left of the actor is used for the position.
+       * @note Setting this to false will allow scaling or rotation around the anchor-point without affecting the actor's position.
+       * @SINCE_1_9.17
+       */
+      POSITION_USES_ANCHOR_POINT,
+
+      /**
+       * @brief Returns whether the actor is culled or not.
+       * @details Name "culled", type Property::BOOLEAN. Read-only
+       * @note True means that the actor is out of the view frustum.
+       * @SINCE_1_9.17
+       */
+      CULLED,
+
+      /**
+       * @brief The unique ID of the actor.
+       * @details Name "id", type Property::INTEGER. Read-only
+       * @SINCE_1_9.17
+       */
+      ID,
+
+      /**
+       * @brief The current depth in the hierarchy of the actor.
+       * @details Name "hierarchyDepth", type Property::INTEGER. Read-only
+       * @note The value is -1 if actor is not in the hierarchy.
+       * @SINCE_1_9.17
+       */
+      HIERARCHY_DEPTH,
+
+      /**
+       * @brief The flag whether an actor is the root actor, which is owned by the Scene.
+       * @details Name "isRoot", type Property::BOOLEAN. Read-only
+       * @SINCE_1_9.17
+       */
+      IS_ROOT,
+
+      /**
+       * @brief The flag whether the actor is of class Dali::Layer.
+       * @details Name "isLayer", type Property::BOOLEAN. Read-only
+       * @SINCE_1_9.17
+       */
+      IS_LAYER,
+
+      /**
+       * @brief The flag whether the actor is connected to the Scene.
+       * When an actor is connected, it will be directly or indirectly parented to the root Actor.
+       * @details Name "connectedToScene", type Property::BOOLEAN. Read-only
+       * @note The root Actor is provided automatically by the Scene, and is always considered to be connected.
+       * @SINCE_1_9.17
+       */
+      CONNECTED_TO_SCENE,
+
+      /**
+       * @brief The flag whether the actor should be focusable by keyboard navigation.
+       * @details Name "keyboardFocusable", type Property::BOOLEAN.
+       * @SINCE_1_9.17
+       */
+      KEYBOARD_FOCUSABLE,
     };
   };
 
   // Typedefs
 
-  typedef Signal< bool (Actor, const TouchEvent&) > TouchSignalType;        ///< @DEPRECATED_1_1.37 @brief Touch signal type @SINCE_1_0.0
-  typedef Signal< bool (Actor, const TouchData&) >  TouchDataSignalType;    ///< Touch signal type @SINCE_1_1.37
-  typedef Signal< bool (Actor, const HoverEvent&) > HoverSignalType;        ///< Hover signal type @SINCE_1_0.0
-  typedef Signal< bool (Actor, const WheelEvent&) > WheelEventSignalType;   ///< Wheel signal type @SINCE_1_0.0
-  typedef Signal< void (Actor) > OnStageSignalType;                         ///< Stage connection signal type @SINCE_1_0.0
-  typedef Signal< void (Actor) > OffStageSignalType;                        ///< Stage disconnection signal type @SINCE_1_0.0
-  typedef Signal< void (Actor) > OnRelayoutSignalType;                      ///< Called when the actor is relaid out @SINCE_1_0.0
-  typedef Signal< void ( Actor, LayoutDirection::Type ) > LayoutDirectionChangedSignalType; ///< Layout direction changes signal type. @SINCE_1_2.60
+  using TouchEventSignalType             = Signal<bool( Actor, const TouchEvent& )>;     ///< Touch signal type @SINCE_1_1.37
+  using HoverSignalType                  = Signal<bool( Actor, const HoverEvent& )>;     ///< Hover signal type @SINCE_1_0.0
+  using WheelEventSignalType             = Signal<bool( Actor, const WheelEvent& )>;     ///< Wheel signal type @SINCE_1_0.0
+  using OnSceneSignalType                = Signal<void( Actor )>;                        ///< Scene connection signal type @SINCE_1_9.24
+  using OffSceneSignalType               = Signal<void( Actor )>;                        ///< Scene disconnection signal type @SINCE_1_9.24
+  using OnRelayoutSignalType             = Signal<void( Actor )>;                        ///< Called when the actor is relaid out @SINCE_1_0.0
+  using LayoutDirectionChangedSignalType = Signal<void( Actor, LayoutDirection::Type )>; ///< Layout direction changes signal type. @SINCE_1_2.60
 
   // Creation
 
@@ -727,44 +794,23 @@ public:
   Actor& operator=(const Actor& rhs);
 
   /**
-   * @brief Retrieves the unique ID of the actor.
-   *
-   * @SINCE_1_0.0
-   * @return The ID
-   * @pre The Actor has been initialized.
-   */
-  uint32_t GetId() const;
-
-  // Containment
-
-  /**
-   * @brief Queries whether an actor is the root actor, which is owned by the Stage.
+   * @brief Move constructor.
    *
-   * @SINCE_1_0.0
-   * @return True if the actor is the root actor
-   * @pre The Actor has been initialized.
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the actor to move
    */
-  bool IsRoot() const;
+  Actor( Actor&& rhs );
 
   /**
-   * @brief Queries whether the actor is connected to the Stage.
+   * @brief Move assignment operator.
    *
-   * When an actor is connected, it will be directly or indirectly parented to the root Actor.
-   * @SINCE_1_0.0
-   * @return True if the actor is connected to the Stage
-   * @pre The Actor has been initialized.
-   * @note The root Actor is provided automatically by Dali::Stage, and is always considered to be connected.
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the actor to move
+   * @return A reference to this
    */
-  bool OnStage() const;
+  Actor& operator=( Actor&& rhs );
 
-  /**
-   * @brief Queries whether the actor is of class Dali::Layer.
-   *
-   * @SINCE_1_0.0
-   * @return True if the actor is a layer
-   * @pre The Actor has been initialized.
-   */
-  bool IsLayer() const;
+  // Containment
 
   /**
    * @brief Gets the layer in which the actor is present.
@@ -952,26 +998,6 @@ public:
   bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const;
 
   /**
-   * @brief Sets whether the actor should be focusable by keyboard navigation.
-   *
-   * The default is false.
-   * @SINCE_1_0.0
-   * @param[in] focusable - true if the actor should be focusable by keyboard navigation,
-   * false otherwise
-   * @pre The Actor has been initialized.
-   */
-  void SetKeyboardFocusable( bool focusable );
-
-  /**
-   * @brief Returns whether the actor is focusable by keyboard navigation.
-   *
-   * @SINCE_1_0.0
-   * @return @c true if the actor is focusable by keyboard navigation, @c false if not
-   * @pre The Actor has been initialized.
-   */
-  bool IsKeyboardFocusable() const;
-
-  /**
    * @brief Raise actor above the next sibling actor.
    *
    * @SINCE_1_2.60
@@ -1082,14 +1108,6 @@ public:
    */
   float GetRelayoutSize( Dimension::Type dimension ) const;
 
-  /**
-   * @brief Gets depth in the hierarchy for the actor.
-   *
-   * @SINCE_1_0.0
-   * @return The current depth in the hierarchy of the actor, or @c -1 if actor is not in the hierarchy
-   */
-  int32_t GetHierarchyDepth();
-
 public: // Renderer
 
   /**
@@ -1143,35 +1161,20 @@ public: // Renderer
 public: // Signals
 
   /**
-   * @DEPRECATED_1_1.37 Use TouchSignal() instead.
    * @brief This signal is emitted when touch input is received.
    *
    * A callback of the following type may be connected:
    * @code
-   *   bool YourCallbackName(Actor actor, const TouchEvent& event);
-   * @endcode
-   * The return value of True, indicates that the touch event should be consumed.
-   * Otherwise the signal will be emitted on the next sensitive parent of the actor.
-   * @SINCE_1_0.0
-   * @return The signal to connect to
-   * @pre The Actor has been initialized.
-   */
-  TouchSignalType& TouchedSignal() DALI_DEPRECATED_API;
-
-  /**
-   * @brief This signal is emitted when touch input is received.
-   *
-   * A callback of the following type may be connected:
-   * @code
-   *   bool YourCallbackName( Actor actor, TouchData& touch );
+   *   bool YourCallbackName( Actor actor, TouchEvent& touch );
    * @endcode
    * The return value of True, indicates that the touch event has been consumed.
    * Otherwise the signal will be emitted on the next sensitive parent of the actor.
-   * @SINCE_1_1.37
+   * A true return will also cancel any ongoing gestures.
+   * @SINCE_1_9.28
    * @return The signal to connect to
    * @pre The Actor has been initialized.
    */
-  TouchDataSignalType& TouchSignal();
+  TouchEventSignalType& TouchedSignal();
 
   /**
    * @brief This signal is emitted when hover input is received.
@@ -1204,12 +1207,12 @@ public: // Signals
   WheelEventSignalType& WheelEventSignal();
 
   /**
-   * @brief This signal is emitted after the actor has been connected to the stage.
+   * @brief This signal is emitted after the actor has been connected to the scene.
    *
    * When an actor is connected, it will be directly or indirectly parented to the root Actor.
-   * @SINCE_1_0.0
+   * @SINCE_1_9.24
    * @return The signal to connect to
-   * @note The root Actor is provided automatically by Dali::Stage, and is always considered to be connected.
+   * @note The root Actor is provided automatically by the Scene, and is always considered to be connected.
    *
    * @note When the parent of a set of actors is connected to the stage, then all of the children
    * will received this callback.
@@ -1225,16 +1228,16 @@ public: // Signals
    *
    * @endcode
    */
-  OnStageSignalType& OnStageSignal();
+  OnSceneSignalType& OnSceneSignal();
 
   /**
-   * @brief This signal is emitted after the actor has been disconnected from the stage.
+   * @brief This signal is emitted after the actor has been disconnected from the scene.
    *
    * If an actor is disconnected it either has no parent, or is parented to a disconnected actor.
    *
-   * @SINCE_1_0.0
+   * @SINCE_1_9.24
    * @return The signal to connect to
-   * @note When the parent of a set of actors is disconnected to the stage, then all of the children
+   * @note When the parent of a set of actors is disconnected to the scene, then all of the children
    * will received this callback, starting with the leaf actors.
    * For the following actor tree, the callback order will be D, E, B, F, C, and finally A.
    *
@@ -1249,7 +1252,7 @@ public: // Signals
    * @endcode
    *
    */
-  OffStageSignalType& OffStageSignal();
+  OffSceneSignalType& OffSceneSignal();
 
   /**
    * @brief This signal is emitted after the size has been set on the actor during relayout