#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 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.
*
* <h3>Multi-Touch Events:</h3>
*
- * Touch or hover events are received via signals; see Actor::TouchSignal() and Actor::HoveredSignal() for more details.
+ * Touch or hover events are received via signals; see Actor::TouchedSignal() and Actor::HoveredSignal() for more details.
*
* <i>Hit Testing Rules Summary:</i>
*
* Signals
* | %Signal Name | Method |
* |-------------------|------------------------------|
- * | touch | @ref TouchSignal() |
+ * | touched | @ref TouchedSignal() |
* | hovered | @ref HoveredSignal() |
* | wheelEvent | @ref WheelEventSignal() |
* | onScene | @ref OnSceneSignal() |
class DALI_CORE_API Actor : public Handle
{
public:
-
/**
* @brief Enumeration for the instance of properties belonging to the Actor class.
* @SINCE_1_0.0
* @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&) > TouchEventSignalType; ///< 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) > OnSceneSignalType; ///< Scene connection signal type @SINCE_1_9.24
- typedef Signal< void (Actor) > OffSceneSignalType; ///< Scene disconnection signal type @SINCE_1_9.24
- 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.
* @SINCE_1_9.22
* @param[in] rhs A reference to the actor to move
*/
- Actor( Actor&& rhs );
+ Actor(Actor&& rhs) noexcept;
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the actor to move
* @return A reference to this
*/
- Actor& operator=( Actor&& rhs );
+ 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
-
/**
* @brief This signal is emitted when touch input is received.
*
* @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.
- * A true return will also cancel any ongoing gestures.
- * @SINCE_1_1.37
+ * @SINCE_1_9.28
* @return The signal to connect to
* @pre The Actor has been initialized.
*/
- TouchEventSignalType& TouchSignal();
+ TouchEventSignalType& TouchedSignal();
/**
* @brief This signal is emitted when hover input is received.
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();