#define DALI_ACTOR_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <string>
#include <cstdint> // uint32_t
+#include <string>
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor-enumerations.h>
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.
* // 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
*
* - 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
* | 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
class DALI_CORE_API Actor : public Handle
{
public:
-
/**
* @brief Enumeration for the instance of properties belonging to the Actor class.
* @SINCE_1_0.0
* @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 Dali::Scene, and is always considered to be connected.
+ * @note The root Actor is provided automatically by the Scene, and is always considered to be connected.
* @SINCE_1_9.17
*/
CONNECTED_TO_SCENE,
* @SINCE_1_9.17
*/
KEYBOARD_FOCUSABLE,
+
+ /**
+ * @brief Sets the update area hint of the actor.
+ * @details Name "updateAreaHint", type Property::VECTOR4 (x, y, width, height).
+ * @note Overrides the area - the position and the size - used for the actor damaged area calculation. Affected by the actor model view matrix.
+ * The position is relative to the center of the actor and it is also the center of the damaged area.
+ * @SINCE_2_1.33
+ */
+ UPDATE_AREA_HINT
};
};
// 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
* @param[in] handle to An object
* @return handle to a Actor object or an uninitialized handle
*/
- static Actor DownCast( BaseHandle handle );
+ static Actor DownCast(BaseHandle handle);
/**
* @brief Dali::Actor is intended as a base class.
*/
Actor& operator=(const Actor& rhs);
+ /**
+ * @brief Move constructor.
+ *
+ * @SINCE_1_9.22
+ * @param[in] rhs A reference to the actor to move
+ */
+ Actor(Actor&& rhs) noexcept;
+
+ /**
+ * @brief Move assignment operator.
+ *
+ * @SINCE_1_9.22
+ * @param[in] rhs A reference to the actor to move
+ * @return A reference to this
+ */
+ Actor& operator=(Actor&& rhs) noexcept;
+
// Containment
/**
* @return The actor for the given index or empty handle if children not initialized
* @pre The Actor has been initialized.
*/
- Actor GetChildAt( uint32_t index ) const;
+ Actor GetChildAt(uint32_t index) const;
/**
* @brief Search through this actor's hierarchy for an actor with the given name.
*
* The actor itself is also considered in the search.
- * @SINCE_1_0.0
+ * @SINCE_2_0.9
* @param[in] actorName The name of the actor to find
* @return A handle to the actor if found, or an empty handle if not
* @pre The Actor has been initialized.
*/
- Actor FindChildByName(const std::string& actorName);
+ Actor FindChildByName(std::string_view actorName);
/**
* @brief Search through this actor's hierarchy for an actor with the given unique ID.
* @return A handle to the actor if found, or an empty handle if not
* @pre The Actor has been initialized.
*/
- Actor FindChildById( const uint32_t id );
+ Actor FindChildById(const uint32_t id);
/**
* @brief Retrieves the actor's parent.
* @param[in] axis The axis of the rotation to combine with the existing orientation
* @pre The actor has been initialized.
*/
- void RotateBy( const Degree& angle, const Vector3& axis )
+ void RotateBy(const Degree& angle, const Vector3& axis)
{
- RotateBy( Radian( angle ), axis );
+ RotateBy(Radian(angle), axis);
}
/**
* @pre The Actor has been parented.
* @pre The target actor is a sibling.
*/
- void RaiseAbove( Actor target );
+ void RaiseAbove(Actor target);
/**
* @brief Lower the actor to below the target actor.
* @pre The Actor has been parented.
* @pre The target actor is a sibling.
*/
- void LowerBelow( Actor target );
+ void LowerBelow(Actor target);
// SIZE NEGOTIATION
* @param[in] policy The resize policy to use
* @param[in] dimension The dimension(s) to set policy for. Can be a bitfield of multiple dimensions
*/
- void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
+ void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension);
/**
* @brief Returns the resize policy used for a single dimension.
* @param[in] dimension The dimension to get policy for
* @return Return the dimension resize policy. If more than one dimension is requested, just return the first one found
*/
- ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
+ ResizePolicy::Type GetResizePolicy(Dimension::Type dimension) const;
/**
* @brief Calculates the height of the actor given a width.
* @param[in] width Width to use
* @return Return the height based on the width
*/
- float GetHeightForWidth( float width );
+ float GetHeightForWidth(float width);
/**
* @brief Calculates the width of the actor given a height.
* @param[in] height Height to use
* @return Return the width based on the height
*/
- float GetWidthForHeight( float height );
+ float GetWidthForHeight(float height);
/**
* @brief Returns the value of negotiated dimension for the given dimension.
* @param[in] dimension The dimension to retrieve
* @return Return the value of the negotiated dimension. If more than one dimension is requested, just return the first one found
*/
- float GetRelayoutSize( Dimension::Type dimension ) const;
+ float GetRelayoutSize(Dimension::Type dimension) const;
public: // Renderer
-
/**
* @brief Adds a renderer to this actor.
*
* @pre The renderer must be initialized.
*
*/
- uint32_t AddRenderer( Renderer& renderer );
+ uint32_t AddRenderer(Renderer& renderer);
/**
* @brief Gets the number of renderers on this actor.
* @pre The index must be between 0 and GetRendererCount()-1
*
*/
- Renderer GetRendererAt( uint32_t index );
+ Renderer GetRendererAt(uint32_t index);
/**
* @brief Removes a renderer from the actor.
* @SINCE_1_0.0
* @param[in] renderer Handle to the renderer that is to be removed
*/
- void RemoveRenderer( Renderer& renderer );
+ void RemoveRenderer(Renderer& renderer);
/**
* @brief Removes a renderer from the actor by index.
* @pre The index must be between 0 and GetRendererCount()-1
*
*/
- void RemoveRenderer( uint32_t index );
+ void RemoveRenderer(uint32_t index);
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
+ * @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.
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.
*
* @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.
*
* @endcode
*
*/
- OffStageSignalType& OffStageSignal();
+ OffSceneSignalType& OffSceneSignal();
/**
* @brief This signal is emitted after the size has been set on the actor during relayout
LayoutDirectionChangedSignalType& LayoutDirectionChangedSignal();
public: // Not intended for application developers
-
/// @cond internal
/**
* @brief This constructor is used by Actor::New() methods.
* @SINCE_1_0.0
* @param[in,out] actor A handle to an actor, or an empty handle
*/
-inline void UnparentAndReset( Actor& actor )
+inline void UnparentAndReset(Actor& actor)
{
- if( actor )
+ if(actor)
{
actor.Unparent();
actor.Reset();