#include <dali-test-suite-utils.h>
#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/devel-api/common/capabilities.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/devel-api/common/capabilities.h>
#include <dali/public-api/dali-core.h>
#include <mesh-builder.h>
catch(Dali::DaliException& e)
{
DALI_TEST_PRINT_ASSERT(e);
- DALI_TEST_ASSERT(e, "this != &child", TEST_LOCATION);
+ DALI_TEST_ASSERT(e, "&mOwner != &child", TEST_LOCATION);
DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
}
catch(...)
tet_printf("Raise actor B Above Actor C\n");
DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
- int newOrder = actorC[DevelActor::Property::SIBLING_ORDER];
+ int newOrder = actorC[DevelActor::Property::SIBLING_ORDER];
actorB[DevelActor::Property::SIBLING_ORDER] = newOrder;
DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
orderChangedSignal = false;
DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
- newOrder = actorB[DevelActor::Property::SIBLING_ORDER];
+ newOrder = actorB[DevelActor::Property::SIBLING_ORDER];
actorA[DevelActor::Property::SIBLING_ORDER] = newOrder;
DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliActorLowerBelow2(void)
{
tet_infoline("UtcDaliActor LowerBelow test using SIBLING_ORDER property\n");
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector2 touchArea = actor.GetProperty(DevelActor::Property::TOUCH_AREA).Get<Vector2>();
DALI_TEST_EQUALS(touchArea, Vector2::ZERO, TEST_LOCATION);
actor.SetProperty(DevelActor::Property::TOUCH_AREA, Vector2(10.f, 10.f));
tet_infoline("Test SetProperty AdvancedBlendEquation");
- Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer1 = Renderer::New( geometry, shader );
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = CreateShader();
+ Renderer renderer1 = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.SetProperty(Actor::Property::OPACITY, 0.1f);
actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
application.GetScene().Add(actor);
- if( !Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) )
+ if(!Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
{
- actor.SetProperty( Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN );
- int equation = actor.GetProperty<int>( Dali::DevelActor::Property::BLEND_EQUATION );
- DALI_TEST_EQUALS( ( Dali::DevelBlendEquation::SCREEN == equation ), false, TEST_LOCATION );
+ actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
+ int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
+ DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), false, TEST_LOCATION);
}
- if( Dali::Capabilities::IsBlendEquationSupported( DevelBlendEquation::SCREEN ) )
+ if(Dali::Capabilities::IsBlendEquationSupported(DevelBlendEquation::SCREEN))
{
- actor.SetProperty( Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN );
- int equation = actor.GetProperty<int>( Dali::DevelActor::Property::BLEND_EQUATION );
- DALI_TEST_EQUALS( ( Dali::DevelBlendEquation::SCREEN == equation ), true, TEST_LOCATION );
+ actor.SetProperty(Dali::DevelActor::Property::BLEND_EQUATION, Dali::DevelBlendEquation::SCREEN);
+ int equation = actor.GetProperty<int>(Dali::DevelActor::Property::BLEND_EQUATION);
+ DALI_TEST_EQUALS((Dali::DevelBlendEquation::SCREEN == equation), true, TEST_LOCATION);
}
- Renderer renderer2 = Renderer::New( geometry, shader );
+ Renderer renderer2 = Renderer::New(geometry, shader);
actor.AddRenderer(renderer2);
END_TEST;
#define DALI_INTERNAL_ACTOR_DECLARATIONS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// INTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/ref-object.h>
namespace Dali
{
-
namespace Internal
{
-
class Actor;
class CameraActor;
class CustomActor;
#include <dali/internal/event/actors/actor-impl.h>
// EXTERNAL INCLUDES
-#include <cmath>
#include <algorithm>
#include <cfloat>
+#include <cmath>
// INTERNAL INCLUDES
-#include <dali/devel-api/actors/layer-devel.h>
-#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/constants.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/radian.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector3.h>
-#include <dali/public-api/math/radian.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/devel-api/common/capabilities.h>
+
#include <dali/devel-api/actors/actor-devel.h>
-#include <dali/internal/event/events/actor-gesture-data.h>
+#include <dali/devel-api/actors/layer-devel.h>
+#include <dali/devel-api/common/capabilities.h>
+
+#include <dali/integration-api/debug.h>
+
+#include <dali/internal/event/actors/actor-parent.h>
#include <dali/internal/event/actors/actor-property-handler.h>
#include <dali/internal/event/actors/actor-relayouter.h>
-#include <dali/internal/event/actors/actor-siblings.h>
#include <dali/internal/event/actors/camera-actor-impl.h>
#include <dali/internal/event/common/event-thread-services.h>
#include <dali/internal/event/common/projection.h>
#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/common/type-info-impl.h>
+#include <dali/internal/event/events/actor-gesture-data.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/render-tasks/render-task-list-impl.h>
#include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
#include <dali/internal/update/nodes/node-messages.h>
-#include <dali/integration-api/debug.h>
-using Dali::Internal::SceneGraph::Node;
using Dali::Internal::SceneGraph::AnimatableProperty;
+using Dali::Internal::SceneGraph::Node;
using Dali::Internal::SceneGraph::PropertyBase;
#if defined(DEBUG_ENABLED)
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_DEPTH_TIMER" );
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_DEPTH_TIMER");
#endif
namespace Dali
{
-
namespace Internal
{
-
namespace // unnamed namespace
{
-
// Properties
/**
* Name Type writable animatable constraint-input enum for index-checking
*/
DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "parentOrigin", VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN )
-DALI_PROPERTY( "parentOriginX", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X )
-DALI_PROPERTY( "parentOriginY", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y )
-DALI_PROPERTY( "parentOriginZ", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z )
-DALI_PROPERTY( "anchorPoint", VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT )
-DALI_PROPERTY( "anchorPointX", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X )
-DALI_PROPERTY( "anchorPointY", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y )
-DALI_PROPERTY( "anchorPointZ", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z )
-DALI_PROPERTY( "size", VECTOR3, true, true, true, Dali::Actor::Property::SIZE )
-DALI_PROPERTY( "sizeWidth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH )
-DALI_PROPERTY( "sizeHeight", FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT )
-DALI_PROPERTY( "sizeDepth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH )
-DALI_PROPERTY( "position", VECTOR3, true, true, true, Dali::Actor::Property::POSITION )
-DALI_PROPERTY( "positionX", FLOAT, true, true, true, Dali::Actor::Property::POSITION_X )
-DALI_PROPERTY( "positionY", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y )
-DALI_PROPERTY( "positionZ", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z )
-DALI_PROPERTY( "worldPosition", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION )
-DALI_PROPERTY( "worldPositionX", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X )
-DALI_PROPERTY( "worldPositionY", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y )
-DALI_PROPERTY( "worldPositionZ", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z )
-DALI_PROPERTY( "orientation", ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION )
-DALI_PROPERTY( "worldOrientation", ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION )
-DALI_PROPERTY( "scale", VECTOR3, true, true, true, Dali::Actor::Property::SCALE )
-DALI_PROPERTY( "scaleX", FLOAT, true, true, true, Dali::Actor::Property::SCALE_X )
-DALI_PROPERTY( "scaleY", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y )
-DALI_PROPERTY( "scaleZ", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z )
-DALI_PROPERTY( "worldScale", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE )
-DALI_PROPERTY( "visible", BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE )
-DALI_PROPERTY( "color", VECTOR4, true, true, true, Dali::Actor::Property::COLOR )
-DALI_PROPERTY( "colorRed", FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED )
-DALI_PROPERTY( "colorGreen", FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN )
-DALI_PROPERTY( "colorBlue", FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE )
-DALI_PROPERTY( "colorAlpha", FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA )
-DALI_PROPERTY( "worldColor", VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR )
-DALI_PROPERTY( "worldMatrix", MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX )
-DALI_PROPERTY( "name", STRING, true, false, false, Dali::Actor::Property::NAME )
-DALI_PROPERTY( "sensitive", BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE )
-DALI_PROPERTY( "leaveRequired", BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED )
-DALI_PROPERTY( "inheritOrientation", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION )
-DALI_PROPERTY( "inheritScale", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE )
-DALI_PROPERTY( "colorMode", INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE )
-DALI_PROPERTY( "drawMode", INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE )
-DALI_PROPERTY( "sizeModeFactor", VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR )
-DALI_PROPERTY( "widthResizePolicy", STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY )
-DALI_PROPERTY( "heightResizePolicy", STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY )
-DALI_PROPERTY( "sizeScalePolicy", INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY )
-DALI_PROPERTY( "widthForHeight", BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT )
-DALI_PROPERTY( "heightForWidth", BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH )
-DALI_PROPERTY( "padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING )
-DALI_PROPERTY( "minimumSize", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE )
-DALI_PROPERTY( "maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE )
-DALI_PROPERTY( "inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION )
-DALI_PROPERTY( "clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE )
-DALI_PROPERTY( "layoutDirection", STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION )
-DALI_PROPERTY( "inheritLayoutDirection", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION )
-DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::Actor::Property::OPACITY )
-DALI_PROPERTY( "screenPosition", VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION )
-DALI_PROPERTY( "positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT )
-DALI_PROPERTY( "culled", BOOLEAN, false, false, true, Dali::Actor::Property::CULLED )
-DALI_PROPERTY( "id", INTEGER, false, false, false, Dali::Actor::Property::ID )
-DALI_PROPERTY( "hierarchyDepth", INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH )
-DALI_PROPERTY( "isRoot", BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT )
-DALI_PROPERTY( "isLayer", BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER )
-DALI_PROPERTY( "connectedToScene", BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE )
-DALI_PROPERTY( "keyboardFocusable", BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE )
-DALI_PROPERTY( "siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER )
-DALI_PROPERTY( "updateSizeHint", VECTOR2, true, false, false, Dali::DevelActor::Property::UPDATE_SIZE_HINT )
-DALI_PROPERTY( "captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START )
-DALI_PROPERTY( "touchArea", VECTOR2, true, false, false, Dali::DevelActor::Property::TOUCH_AREA )
-DALI_PROPERTY( "blendEquation", INTEGER, true, false, false, Dali::DevelActor::Property::BLEND_EQUATION )
-DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties )
+DALI_PROPERTY("parentOrigin", VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN)
+DALI_PROPERTY("parentOriginX", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X)
+DALI_PROPERTY("parentOriginY", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y)
+DALI_PROPERTY("parentOriginZ", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z)
+DALI_PROPERTY("anchorPoint", VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT)
+DALI_PROPERTY("anchorPointX", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X)
+DALI_PROPERTY("anchorPointY", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y)
+DALI_PROPERTY("anchorPointZ", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z)
+DALI_PROPERTY("size", VECTOR3, true, true, true, Dali::Actor::Property::SIZE)
+DALI_PROPERTY("sizeWidth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH)
+DALI_PROPERTY("sizeHeight", FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT)
+DALI_PROPERTY("sizeDepth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH)
+DALI_PROPERTY("position", VECTOR3, true, true, true, Dali::Actor::Property::POSITION)
+DALI_PROPERTY("positionX", FLOAT, true, true, true, Dali::Actor::Property::POSITION_X)
+DALI_PROPERTY("positionY", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y)
+DALI_PROPERTY("positionZ", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z)
+DALI_PROPERTY("worldPosition", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION)
+DALI_PROPERTY("worldPositionX", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X)
+DALI_PROPERTY("worldPositionY", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y)
+DALI_PROPERTY("worldPositionZ", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z)
+DALI_PROPERTY("orientation", ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION)
+DALI_PROPERTY("worldOrientation", ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION)
+DALI_PROPERTY("scale", VECTOR3, true, true, true, Dali::Actor::Property::SCALE)
+DALI_PROPERTY("scaleX", FLOAT, true, true, true, Dali::Actor::Property::SCALE_X)
+DALI_PROPERTY("scaleY", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y)
+DALI_PROPERTY("scaleZ", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z)
+DALI_PROPERTY("worldScale", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE)
+DALI_PROPERTY("visible", BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE)
+DALI_PROPERTY("color", VECTOR4, true, true, true, Dali::Actor::Property::COLOR)
+DALI_PROPERTY("colorRed", FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED)
+DALI_PROPERTY("colorGreen", FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN)
+DALI_PROPERTY("colorBlue", FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE)
+DALI_PROPERTY("colorAlpha", FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA)
+DALI_PROPERTY("worldColor", VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR)
+DALI_PROPERTY("worldMatrix", MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX)
+DALI_PROPERTY("name", STRING, true, false, false, Dali::Actor::Property::NAME)
+DALI_PROPERTY("sensitive", BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE)
+DALI_PROPERTY("leaveRequired", BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED)
+DALI_PROPERTY("inheritOrientation", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION)
+DALI_PROPERTY("inheritScale", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE)
+DALI_PROPERTY("colorMode", INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE)
+DALI_PROPERTY("drawMode", INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE)
+DALI_PROPERTY("sizeModeFactor", VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR)
+DALI_PROPERTY("widthResizePolicy", STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY)
+DALI_PROPERTY("heightResizePolicy", STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY)
+DALI_PROPERTY("sizeScalePolicy", INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY)
+DALI_PROPERTY("widthForHeight", BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT)
+DALI_PROPERTY("heightForWidth", BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH)
+DALI_PROPERTY("padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING)
+DALI_PROPERTY("minimumSize", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE)
+DALI_PROPERTY("maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE)
+DALI_PROPERTY("inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION)
+DALI_PROPERTY("clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE)
+DALI_PROPERTY("layoutDirection", STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION)
+DALI_PROPERTY("inheritLayoutDirection", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION)
+DALI_PROPERTY("opacity", FLOAT, true, true, true, Dali::Actor::Property::OPACITY)
+DALI_PROPERTY("screenPosition", VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION)
+DALI_PROPERTY("positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT)
+DALI_PROPERTY("culled", BOOLEAN, false, false, true, Dali::Actor::Property::CULLED)
+DALI_PROPERTY("id", INTEGER, false, false, false, Dali::Actor::Property::ID)
+DALI_PROPERTY("hierarchyDepth", INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH)
+DALI_PROPERTY("isRoot", BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT)
+DALI_PROPERTY("isLayer", BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER)
+DALI_PROPERTY("connectedToScene", BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE)
+DALI_PROPERTY("keyboardFocusable", BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE)
+DALI_PROPERTY("siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER)
+DALI_PROPERTY("updateSizeHint", VECTOR2, true, false, false, Dali::DevelActor::Property::UPDATE_SIZE_HINT)
+DALI_PROPERTY("captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START)
+DALI_PROPERTY("touchArea", VECTOR2, true, false, false, Dali::DevelActor::Property::TOUCH_AREA)
+DALI_PROPERTY("blendEquation", INTEGER, true, false, false, Dali::DevelActor::Property::BLEND_EQUATION)
+DALI_PROPERTY_TABLE_END(DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties)
// Signals
return Dali::Actor::New();
}
-TypeRegistration mType( typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties );
+TypeRegistration mType(typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties);
SignalConnectorType signalConnector2(mType, std::string(SIGNAL_HOVERED), &Actor::DoConnectSignal);
SignalConnectorType signalConnector3(mType, std::string(SIGNAL_WHEEL_EVENT), &Actor::DoConnectSignal);
* @param[in] dimension The dimension to extract
* @return Return the value for the dimension
*/
-constexpr float GetDimensionValue( const Vector2& values, Dimension::Type dimension )
+constexpr float GetDimensionValue(const Vector2& values, Dimension::Type dimension)
{
- switch( dimension )
+ switch(dimension)
{
case Dimension::WIDTH:
{
* @param[in] dimension The dimension to extract
* @return Return the value for the dimension
*/
-float GetDimensionValue( const Vector3& values, Dimension::Type dimension )
+float GetDimensionValue(const Vector3& values, Dimension::Type dimension)
{
- return GetDimensionValue( values.GetVectorXY(), dimension );
-}
-
-/**
- * @brief Recursively emits the visibility-changed-signal on the actor tree.
- * @param[in] actor The actor to emit the signal on
- * @param[in] visible The new visibility of the actor
- * @param[in] type Whether the actor's visible property has changed or a parent's
- */
-void EmitVisibilityChangedSignalRecursively( ActorPtr actor, bool visible, DevelActor::VisibilityChange::Type type )
-{
- if( actor )
- {
- actor->EmitVisibilityChangedSignal( visible, type );
-
- if( actor->GetChildCount() > 0 )
- {
- for( auto& child : actor->GetChildrenInternal() )
- {
- EmitVisibilityChangedSignalRecursively( child, visible, DevelActor::VisibilityChange::PARENT );
- }
- }
- }
+ return GetDimensionValue(values.GetVectorXY(), dimension);
}
/// Helper for emitting a signal
template<typename Signal, typename Event>
-bool EmitConsumingSignal( Actor& actor, Signal& signal, const Event& event )
+bool EmitConsumingSignal(Actor& actor, Signal& signal, const Event& event)
{
bool consumed = false;
- if( !signal.Empty() )
+ if(!signal.Empty())
{
- Dali::Actor handle( &actor );
- consumed = signal.Emit( handle, event );
+ Dali::Actor handle(&actor);
+ consumed = signal.Emit(handle, event);
}
return consumed;
/// Helper for emitting signals with multiple parameters
template<typename Signal, typename... Param>
-void EmitSignal( Actor& actor, Signal& signal, Param... params)
+void EmitSignal(Actor& actor, Signal& signal, Param... params)
{
- if( !signal.Empty() )
+ if(!signal.Empty())
{
- Dali::Actor handle( &actor );
- signal.Emit( handle, params... );
+ Dali::Actor handle(&actor);
+ signal.Emit(handle, params...);
}
}
bool ScreenToLocalInternal(
- const Matrix& viewMatrix,
- const Matrix& projectionMatrix,
- const Matrix& worldMatrix,
- const Viewport& viewport,
- const Vector3& currentSize,
- float& localX,
- float& localY,
- float screenX,
- float screenY )
+ const Matrix& viewMatrix,
+ const Matrix& projectionMatrix,
+ const Matrix& worldMatrix,
+ const Viewport& viewport,
+ const Vector3& currentSize,
+ float& localX,
+ float& localY,
+ float screenX,
+ float screenY)
{
// Get the ModelView matrix
Matrix modelView;
- Matrix::Multiply( modelView, worldMatrix, viewMatrix );
+ Matrix::Multiply(modelView, worldMatrix, viewMatrix);
// Calculate the inverted ModelViewProjection matrix; this will be used for 2 unprojects
- Matrix invertedMvp( false/*don't init*/);
- Matrix::Multiply( invertedMvp, modelView, projectionMatrix );
+ Matrix invertedMvp(false /*don't init*/);
+ Matrix::Multiply(invertedMvp, modelView, projectionMatrix);
bool success = invertedMvp.Invert();
// Convert to GL coordinates
- Vector4 screenPos( screenX - static_cast<float>( viewport.x ), static_cast<float>( viewport.height ) - screenY - static_cast<float>( viewport.y ), 0.f, 1.f );
+ Vector4 screenPos(screenX - static_cast<float>(viewport.x), static_cast<float>(viewport.height) - screenY - static_cast<float>(viewport.y), 0.f, 1.f);
Vector4 nearPos;
- if( success )
+ if(success)
{
- success = Unproject( screenPos, invertedMvp, static_cast<float>( viewport.width ), static_cast<float>( viewport.height ), nearPos );
+ success = Unproject(screenPos, invertedMvp, static_cast<float>(viewport.width), static_cast<float>(viewport.height), nearPos);
}
Vector4 farPos;
- if( success )
+ if(success)
{
screenPos.z = 1.0f;
- success = Unproject( screenPos, invertedMvp, static_cast<float>( viewport.width ), static_cast<float>( viewport.height ), farPos );
+ success = Unproject(screenPos, invertedMvp, static_cast<float>(viewport.width), static_cast<float>(viewport.height), farPos);
}
- if( success )
+ if(success)
{
Vector4 local;
- if( XyPlaneIntersect( nearPos, farPos, local ) )
+ if(XyPlaneIntersect(nearPos, farPos, local))
{
Vector3 size = currentSize;
- localX = local.x + size.x * 0.5f;
- localY = local.y + size.y * 0.5f;
+ localX = local.x + size.x * 0.5f;
+ localY = local.y + size.y * 0.5f;
}
else
{
ActorPtr Actor::New()
{
// pass a reference to actor, actor does not own its node
- ActorPtr actor( new Actor( BASIC, *CreateNode() ) );
+ ActorPtr actor(new Actor(BASIC, *CreateNode()));
// Second-phase construction
actor->Initialize();
const SceneGraph::Node* Actor::CreateNode()
{
// create node. Nodes are owned by the update manager
- SceneGraph::Node* node = SceneGraph::Node::New();
- OwnerPointer< SceneGraph::Node > transferOwnership( node );
- Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal();
+ SceneGraph::Node* node = SceneGraph::Node::New();
+ OwnerPointer<SceneGraph::Node> transferOwnership(node);
+ Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal();
- DALI_ASSERT_ALWAYS( tls && "ThreadLocalStorage is null" );
+ DALI_ASSERT_ALWAYS(tls && "ThreadLocalStorage is null");
- AddNodeMessage( tls->GetUpdateManager(), transferOwnership );
+ AddNodeMessage(tls->GetUpdateManager(), transferOwnership);
return node;
}
-void Actor::SetName( const std::string& name )
+void Actor::SetName(const std::string& name)
{
mName = name;
// ATTENTION: string for debug purposes is not thread safe.
- DALI_LOG_SET_OBJECT_STRING( const_cast< SceneGraph::Node* >( &GetNode() ), name );
+ DALI_LOG_SET_OBJECT_STRING(const_cast<SceneGraph::Node*>(&GetNode()), name);
}
uint32_t Actor::GetId() const
Dali::Layer layer;
// Short-circuit for Layer derived actors
- if( mIsLayer )
+ if(mIsLayer)
{
- layer = Dali::Layer( static_cast< Dali::Internal::Layer* >( this ) ); // static cast as we trust the flag
+ layer = Dali::Layer(static_cast<Dali::Internal::Layer*>(this)); // static cast as we trust the flag
}
// Find the immediate Layer parent
- for( Actor* parent = mParent; !layer && parent != nullptr; parent = parent->GetParent() )
+ for(Actor* parent = GetParent(); !layer && parent != nullptr; parent = parent->GetParent())
{
- if( parent->IsLayer() )
+ if(parent->IsLayer())
{
- layer = Dali::Layer( static_cast< Dali::Internal::Layer* >( parent ) ); // static cast as we trust the flag
+ layer = Dali::Layer(static_cast<Dali::Internal::Layer*>(parent)); // static cast as we trust the flag
}
}
return layer;
}
-void Actor::Add( Actor& child )
-{
- DALI_ASSERT_ALWAYS( this != &child && "Cannot add actor to itself" );
- DALI_ASSERT_ALWAYS( !child.IsRoot() && "Cannot add root actor" );
-
- if( !mChildren )
- {
- mChildren = new ActorContainer;
- }
-
- Actor* const oldParent( child.mParent );
-
- // child might already be ours
- if( this != oldParent )
- {
- // if we already have parent, unparent us first
- if( oldParent )
- {
- oldParent->Remove( child ); // This causes OnChildRemove callback & ChildRemoved signal
-
- // Old parent may need to readjust to missing child
- if( oldParent->RelayoutDependentOnChildren() )
- {
- oldParent->RelayoutRequest();
- }
- }
-
- // Guard against Add() during previous OnChildRemove callback
- if( !child.mParent )
- {
- // Do this first, since user callbacks from within SetParent() may need to remove child
- mChildren->push_back( ActorPtr( &child ) );
-
- // SetParent asserts that child can be added
- child.SetParent( this );
-
- // Notification for derived classes
- OnChildAdd( child );
- EmitChildAddedSignal( child );
-
- InheritLayoutDirectionRecursively( ActorPtr( &child ), mLayoutDirection );
-
- // Only put in a relayout request if there is a suitable dependency
- if( RelayoutDependentOnChildren() )
- {
- RelayoutRequest();
- }
- }
- }
-}
-
-void Actor::Remove( Actor& child )
-{
- if( (this == &child) || (!mChildren) )
- {
- // no children or removing itself
- return;
- }
-
- ActorPtr removed;
-
- // Find the child in mChildren, and unparent it
- ActorIter end = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != end; ++iter )
- {
- ActorPtr actor = (*iter);
-
- if( actor.Get() == &child )
- {
- // Keep handle for OnChildRemove notification
- removed = actor;
-
- // Do this first, since user callbacks from within SetParent() may need to add the child
- mChildren->erase( iter );
-
- DALI_ASSERT_DEBUG( actor->GetParent() == this );
- actor->SetParent( nullptr );
-
- break;
- }
- }
-
- if( removed )
- {
- // Only put in a relayout request if there is a suitable dependency
- if( RelayoutDependentOnChildren() )
- {
- RelayoutRequest();
- }
- }
-
- // Notification for derived classes
- OnChildRemove( child );
- EmitChildRemovedSignal( child );
-}
-
void Actor::Unparent()
{
- if( mParent )
+ if(mParent)
{
// Remove this actor from the parent. The remove will put a relayout request in for
// the parent if required
- mParent->Remove( *this );
+ mParent->Remove(*this);
// mParent is now NULL!
}
}
-uint32_t Actor::GetChildCount() const
-{
- return ( nullptr != mChildren ) ? static_cast<uint32_t>( mChildren->size() ) : 0; // only 4,294,967,295 children per actor
-}
-
-ActorPtr Actor::GetChildAt( uint32_t index ) const
-{
- DALI_ASSERT_ALWAYS( index < GetChildCount() );
-
- return ( ( mChildren ) ? ( *mChildren )[ index ] : ActorPtr() );
-}
-
-ActorPtr Actor::FindChildByName( const std::string& actorName )
-{
- ActorPtr child = nullptr;
- if( actorName == mName )
- {
- child = this;
- }
- else if( mChildren )
- {
- for( const auto& actor : *mChildren )
- {
- child = actor->FindChildByName( actorName );
-
- if( child )
- {
- break;
- }
- }
- }
- return child;
-}
-
-ActorPtr Actor::FindChildById( const uint32_t id )
-{
- ActorPtr child = nullptr;
- if( id == GetId() )
- {
- child = this;
- }
- else if( mChildren )
- {
- for( const auto& actor : *mChildren )
- {
- child = actor->FindChildById( id );
-
- if( child )
- {
- break;
- }
- }
- }
- return child;
-}
-
-void Actor::SetParentOrigin( const Vector3& origin )
+void Actor::SetParentOrigin(const Vector3& origin)
{
// node is being used in a separate thread; queue a message to set the value & base value
- SetParentOriginMessage( GetEventThreadServices(), GetNode(), origin );
+ SetParentOriginMessage(GetEventThreadServices(), GetNode(), origin);
// Cache for event-thread access
- if( !mParentOrigin )
+ if(!mParentOrigin)
{
// not allocated, check if different from default
- if( ParentOrigin::DEFAULT != origin )
+ if(ParentOrigin::DEFAULT != origin)
{
- mParentOrigin = new Vector3( origin );
+ mParentOrigin = new Vector3(origin);
}
}
else
const Vector3& Actor::GetCurrentParentOrigin() const
{
// Cached for event-thread access
- return ( mParentOrigin ) ? *mParentOrigin : ParentOrigin::DEFAULT;
+ return (mParentOrigin) ? *mParentOrigin : ParentOrigin::DEFAULT;
}
-void Actor::SetAnchorPoint( const Vector3& anchor )
+void Actor::SetAnchorPoint(const Vector3& anchor)
{
// node is being used in a separate thread; queue a message to set the value & base value
- SetAnchorPointMessage( GetEventThreadServices(), GetNode(), anchor );
+ SetAnchorPointMessage(GetEventThreadServices(), GetNode(), anchor);
// Cache for event-thread access
- if( !mAnchorPoint )
+ if(!mAnchorPoint)
{
// not allocated, check if different from default
- if( AnchorPoint::DEFAULT != anchor )
+ if(AnchorPoint::DEFAULT != anchor)
{
- mAnchorPoint = new Vector3( anchor );
+ mAnchorPoint = new Vector3(anchor);
}
}
else
const Vector3& Actor::GetCurrentAnchorPoint() const
{
// Cached for event-thread access
- return ( mAnchorPoint ) ? *mAnchorPoint : AnchorPoint::DEFAULT;
+ return (mAnchorPoint) ? *mAnchorPoint : AnchorPoint::DEFAULT;
}
-void Actor::SetPosition( float x, float y )
+void Actor::SetPosition(float x, float y)
{
- SetPosition( Vector3( x, y, 0.0f ) );
+ SetPosition(Vector3(x, y, 0.0f));
}
-void Actor::SetPosition( float x, float y, float z )
+void Actor::SetPosition(float x, float y, float z)
{
- SetPosition( Vector3( x, y, z ) );
+ SetPosition(Vector3(x, y, z));
}
-void Actor::SetPosition( const Vector3& position )
+void Actor::SetPosition(const Vector3& position)
{
mTargetPosition = position;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, position );
+ SceneGraph::NodeTransformPropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, position);
}
-void Actor::SetX( float x )
+void Actor::SetX(float x)
{
mTargetPosition.x = x;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, x );
+ SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, x);
}
-void Actor::SetY( float y )
+void Actor::SetY(float y)
{
mTargetPosition.y = y;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, y );
+ SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, y);
}
-void Actor::SetZ( float z )
+void Actor::SetZ(float z)
{
mTargetPosition.z = z;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, z );
+ SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, z);
}
-void Actor::TranslateBy( const Vector3& distance )
+void Actor::TranslateBy(const Vector3& distance)
{
mTargetPosition += distance;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeRelative, distance );
+ SceneGraph::NodeTransformPropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeRelative, distance);
}
const Vector3& Actor::GetCurrentPosition() const
const Vector3& Actor::GetCurrentWorldPosition() const
{
// node is being used in a separate thread; copy the value from the previous update
- return GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() );
+ return GetNode().GetWorldPosition(GetEventThreadServices().GetEventBufferIndex());
}
const Vector2 Actor::GetCurrentScreenPosition() const
{
- if( mScene && OnScene() )
+ if(mScene && OnScene())
{
- Vector3 worldPosition = GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() );
- Vector3 cameraPosition = mScene->GetDefaultCameraActor().GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() );
+ Vector3 worldPosition = GetNode().GetWorldPosition(GetEventThreadServices().GetEventBufferIndex());
+ Vector3 cameraPosition = mScene->GetDefaultCameraActor().GetNode().GetWorldPosition(GetEventThreadServices().GetEventBufferIndex());
worldPosition -= cameraPosition;
Vector3 actorSize = GetCurrentSize() * GetCurrentWorldScale();
- Vector2 halfSceneSize( mScene->GetSize() * 0.5f ); // World position origin is center of scene
- Vector3 halfActorSize( actorSize * 0.5f );
- Vector3 anchorPointOffSet = halfActorSize - actorSize * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT );
+ Vector2 halfSceneSize(mScene->GetSize() * 0.5f); // World position origin is center of scene
+ Vector3 halfActorSize(actorSize * 0.5f);
+ Vector3 anchorPointOffSet = halfActorSize - actorSize * (mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT);
- return Vector2( halfSceneSize.width + worldPosition.x - anchorPointOffSet.x,
- halfSceneSize.height + worldPosition.y - anchorPointOffSet.y );
+ return Vector2(halfSceneSize.width + worldPosition.x - anchorPointOffSet.x,
+ halfSceneSize.height + worldPosition.y - anchorPointOffSet.y);
}
return Vector2::ZERO;
}
-void Actor::SetInheritPosition( bool inherit )
+void Actor::SetInheritPosition(bool inherit)
{
- if( mInheritPosition != inherit )
+ if(mInheritPosition != inherit)
{
// non animatable so keep local copy
mInheritPosition = inherit;
- SetInheritPositionMessage( GetEventThreadServices(), GetNode(), inherit );
+ SetInheritPositionMessage(GetEventThreadServices(), GetNode(), inherit);
}
}
-void Actor::SetOrientation( const Radian& angle, const Vector3& axis )
+void Actor::SetOrientation(const Radian& angle, const Vector3& axis)
{
- Vector3 normalizedAxis( axis.x, axis.y, axis.z );
+ Vector3 normalizedAxis(axis.x, axis.y, axis.z);
normalizedAxis.Normalize();
- Quaternion orientation( angle, normalizedAxis );
+ Quaternion orientation(angle, normalizedAxis);
- SetOrientation( orientation );
+ SetOrientation(orientation);
}
-void Actor::SetOrientation( const Quaternion& orientation )
+void Actor::SetOrientation(const Quaternion& orientation)
{
mTargetOrientation = orientation;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformPropertyMessage<Quaternion>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler<Quaternion>::Bake, orientation );
+ SceneGraph::NodeTransformPropertyMessage<Quaternion>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler<Quaternion>::Bake, orientation);
}
-void Actor::RotateBy( const Radian& angle, const Vector3& axis )
+void Actor::RotateBy(const Radian& angle, const Vector3& axis)
{
- RotateBy( Quaternion(angle, axis) );
+ RotateBy(Quaternion(angle, axis));
}
-void Actor::RotateBy( const Quaternion& relativeRotation )
+void Actor::RotateBy(const Quaternion& relativeRotation)
{
- mTargetOrientation *= Quaternion( relativeRotation );
+ mTargetOrientation *= Quaternion(relativeRotation);
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformPropertyMessage<Quaternion>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler<Quaternion>::BakeRelative, relativeRotation );
+ SceneGraph::NodeTransformPropertyMessage<Quaternion>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler<Quaternion>::BakeRelative, relativeRotation);
}
const Quaternion& Actor::GetCurrentOrientation() const
const Quaternion& Actor::GetCurrentWorldOrientation() const
{
// node is being used in a separate thread; copy the value from the previous update
- return GetNode().GetWorldOrientation( GetEventThreadServices().GetEventBufferIndex() );
+ return GetNode().GetWorldOrientation(GetEventThreadServices().GetEventBufferIndex());
}
-void Actor::SetScale( float scale )
+void Actor::SetScale(float scale)
{
- SetScale( Vector3( scale, scale, scale ) );
+ SetScale(Vector3(scale, scale, scale));
}
-void Actor::SetScale( float x, float y, float z )
+void Actor::SetScale(float x, float y, float z)
{
- SetScale( Vector3( x, y, z ) );
+ SetScale(Vector3(x, y, z));
}
-void Actor::SetScale( const Vector3& scale )
+void Actor::SetScale(const Vector3& scale)
{
mTargetScale = scale;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, scale );
+ SceneGraph::NodeTransformPropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, scale);
}
-void Actor::SetScaleX( float x )
+void Actor::SetScaleX(float x)
{
mTargetScale.x = x;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, x );
+ SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, x);
}
-void Actor::SetScaleY( float y )
+void Actor::SetScaleY(float y)
{
mTargetScale.y = y;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, y );
+ SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, y);
}
-void Actor::SetScaleZ( float z )
+void Actor::SetScaleZ(float z)
{
mTargetScale.z = z;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, z );
+ SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, z);
}
void Actor::ScaleBy(const Vector3& relativeScale)
mTargetScale *= relativeScale;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeRelativeMultiply, relativeScale );
+ SceneGraph::NodeTransformPropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeRelativeMultiply, relativeScale);
}
const Vector3& Actor::GetCurrentScale() const
const Vector3& Actor::GetCurrentWorldScale() const
{
// node is being used in a separate thread; copy the value from the previous update
- return GetNode().GetWorldScale( GetEventThreadServices().GetEventBufferIndex() );
+ return GetNode().GetWorldScale(GetEventThreadServices().GetEventBufferIndex());
}
-void Actor::SetInheritScale( bool inherit )
+void Actor::SetInheritScale(bool inherit)
{
- if( mInheritScale != inherit )
+ if(mInheritScale != inherit)
{
// non animatable so keep local copy
mInheritScale = inherit;
// node is being used in a separate thread; queue a message to set the value
- SetInheritScaleMessage( GetEventThreadServices(), GetNode(), inherit );
+ SetInheritScaleMessage(GetEventThreadServices(), GetNode(), inherit);
}
}
return GetNode().GetWorldMatrix(0);
}
-void Actor::SetVisible( bool visible )
+void Actor::SetVisible(bool visible)
{
- SetVisibleInternal( visible, SendMessage::TRUE );
+ SetVisibleInternal(visible, SendMessage::TRUE);
}
bool Actor::IsVisible() const
{
// node is being used in a separate thread; copy the value from the previous update
- return GetNode().IsVisible( GetEventThreadServices().GetEventBufferIndex() );
+ return GetNode().IsVisible(GetEventThreadServices().GetEventBufferIndex());
}
-void Actor::SetOpacity( float opacity )
+void Actor::SetOpacity(float opacity)
{
mTargetColor.a = opacity;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeW, opacity );
+ SceneGraph::NodePropertyComponentMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeW, opacity);
- RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
+ RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
}
float Actor::GetCurrentOpacity() const
const Vector4& Actor::GetCurrentWorldColor() const
{
- return GetNode().GetWorldColor( GetEventThreadServices().GetEventBufferIndex() );
+ return GetNode().GetWorldColor(GetEventThreadServices().GetEventBufferIndex());
}
-void Actor::SetColor( const Vector4& color )
+void Actor::SetColor(const Vector4& color)
{
mTargetColor = color;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodePropertyMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::Bake, color );
+ SceneGraph::NodePropertyMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::Bake, color);
- RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
+ RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
}
-void Actor::SetColorRed( float red )
+void Actor::SetColorRed(float red)
{
mTargetColor.r = red;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeX, red );
+ SceneGraph::NodePropertyComponentMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeX, red);
- RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
+ RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
}
-void Actor::SetColorGreen( float green )
+void Actor::SetColorGreen(float green)
{
mTargetColor.g = green;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeY, green );
+ SceneGraph::NodePropertyComponentMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeY, green);
- RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
+ RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
}
-void Actor::SetColorBlue( float blue )
+void Actor::SetColorBlue(float blue)
{
mTargetColor.b = blue;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeZ, blue );
+ SceneGraph::NodePropertyComponentMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeZ, blue);
- RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
+ RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
}
const Vector4& Actor::GetCurrentColor() const
return GetNode().GetColor(GetEventThreadServices().GetEventBufferIndex());
}
-void Actor::SetInheritOrientation( bool inherit )
+void Actor::SetInheritOrientation(bool inherit)
{
- if( mInheritOrientation != inherit )
+ if(mInheritOrientation != inherit)
{
// non animatable so keep local copy
mInheritOrientation = inherit;
// node is being used in a separate thread; queue a message to set the value
- SetInheritOrientationMessage( GetEventThreadServices(), GetNode(), inherit );
+ SetInheritOrientationMessage(GetEventThreadServices(), GetNode(), inherit);
}
}
-void Actor::SetSizeModeFactor( const Vector3& factor )
+void Actor::SetSizeModeFactor(const Vector3& factor)
{
EnsureRelayouter();
const Vector3& Actor::GetSizeModeFactor() const
{
- if ( mRelayoutData )
+ if(mRelayoutData)
{
return mRelayoutData->sizeModeFactor;
}
return Relayouter::DEFAULT_SIZE_MODE_FACTOR;
}
-void Actor::SetColorMode( ColorMode colorMode )
+void Actor::SetColorMode(ColorMode colorMode)
{
// non animatable so keep local copy
mColorMode = colorMode;
// node is being used in a separate thread; queue a message to set the value
- SetColorModeMessage( GetEventThreadServices(), GetNode(), colorMode );
+ SetColorModeMessage(GetEventThreadServices(), GetNode(), colorMode);
}
-void Actor::SetSize( float width, float height )
+void Actor::SetSize(float width, float height)
{
- SetSize( Vector2( width, height ) );
+ SetSize(Vector2(width, height));
}
-void Actor::SetSize( float width, float height, float depth )
+void Actor::SetSize(float width, float height, float depth)
{
- SetSize( Vector3( width, height, depth ) );
+ SetSize(Vector3(width, height, depth));
}
-void Actor::SetSize( const Vector2& size )
+void Actor::SetSize(const Vector2& size)
{
- SetSize( Vector3( size.width, size.height, 0.f ) );
+ SetSize(Vector3(size.width, size.height, 0.f));
}
-void Actor::SetSizeInternal( const Vector2& size )
+void Actor::SetSizeInternal(const Vector2& size)
{
- SetSizeInternal( Vector3( size.width, size.height, 0.f ) );
+ SetSizeInternal(Vector3(size.width, size.height, 0.f));
}
-void Actor::SetSize( const Vector3& size )
+void Actor::SetSize(const Vector3& size)
{
- if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout )
+ if(IsRelayoutEnabled() && !mRelayoutData->insideRelayout)
{
// TODO we cannot just ignore the given Z but that means rewrite the size negotiation!!
- SetPreferredSize( size.GetVectorXY() );
+ SetPreferredSize(size.GetVectorXY());
}
else
{
- SetSizeInternal( size );
+ SetSizeInternal(size);
}
}
-void Actor::SetSizeInternal( const Vector3& size )
+void Actor::SetSizeInternal(const Vector3& size)
{
// dont allow recursive loop
- DALI_ASSERT_ALWAYS( !mInsideOnSizeSet && "Cannot call SetSize from OnSizeSet" );
+ DALI_ASSERT_ALWAYS(!mInsideOnSizeSet && "Cannot call SetSize from OnSizeSet");
// check that we have a node AND the new size width, height or depth is at least a little bit different from the old one
- if( ( fabsf( mTargetSize.width - size.width ) > Math::MACHINE_EPSILON_1 )||
- ( fabsf( mTargetSize.height- size.height ) > Math::MACHINE_EPSILON_1 )||
- ( fabsf( mTargetSize.depth - size.depth ) > Math::MACHINE_EPSILON_1 ) )
+ if((fabsf(mTargetSize.width - size.width) > Math::MACHINE_EPSILON_1) ||
+ (fabsf(mTargetSize.height - size.height) > Math::MACHINE_EPSILON_1) ||
+ (fabsf(mTargetSize.depth - size.depth) > Math::MACHINE_EPSILON_1))
{
mTargetSize = size;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, mTargetSize );
+ SceneGraph::NodeTransformPropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, mTargetSize);
// Notification for derived classes
mInsideOnSizeSet = true;
- OnSizeSet( mTargetSize );
+ OnSizeSet(mTargetSize);
mInsideOnSizeSet = false;
// Raise a relayout request if the flag is not locked
- if( mRelayoutData && !mRelayoutData->insideRelayout )
+ if(mRelayoutData && !mRelayoutData->insideRelayout)
{
RelayoutRequest();
}
}
}
-void Actor::SetWidth( float width )
+void Actor::SetWidth(float width)
{
- if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout )
+ if(IsRelayoutEnabled() && !mRelayoutData->insideRelayout)
{
- SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
+ SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
mRelayoutData->preferredSize.width = width;
}
else
mTargetSize.width = width;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, width );
+ SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, width);
}
mUseAnimatedSize &= ~AnimatedSizeFlag::WIDTH;
RelayoutRequest();
}
-void Actor::SetHeight( float height )
+void Actor::SetHeight(float height)
{
- if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout )
+ if(IsRelayoutEnabled() && !mRelayoutData->insideRelayout)
{
- SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
+ SetResizePolicy(ResizePolicy::FIXED, Dimension::HEIGHT);
mRelayoutData->preferredSize.height = height;
}
else
mTargetSize.height = height;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, height );
+ SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, height);
}
mUseAnimatedSize &= ~AnimatedSizeFlag::HEIGHT;
RelayoutRequest();
}
-void Actor::SetDepth( float depth )
+void Actor::SetDepth(float depth)
{
mTargetSize.depth = depth;
mUseAnimatedSize &= ~AnimatedSizeFlag::DEPTH;
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, depth );
+ SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, depth);
}
Vector3 Actor::GetTargetSize() const
{
Vector3 size = mTargetSize;
- if( mUseAnimatedSize & AnimatedSizeFlag::WIDTH )
+ if(mUseAnimatedSize & AnimatedSizeFlag::WIDTH)
{
// Should return animated size if size is animated
size.width = mAnimatedSize.width;
else
{
// Should return preferred size if size is fixed as set by SetSize
- if( GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::FIXED )
+ if(GetResizePolicy(Dimension::WIDTH) == ResizePolicy::FIXED)
{
size.width = GetPreferredSize().width;
}
}
- if( mUseAnimatedSize & AnimatedSizeFlag::HEIGHT )
+ if(mUseAnimatedSize & AnimatedSizeFlag::HEIGHT)
{
size.height = mAnimatedSize.height;
}
else
{
- if( GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::FIXED )
+ if(GetResizePolicy(Dimension::HEIGHT) == ResizePolicy::FIXED)
{
size.height = GetPreferredSize().height;
}
}
- if( mUseAnimatedSize & AnimatedSizeFlag::DEPTH )
+ if(mUseAnimatedSize & AnimatedSizeFlag::DEPTH)
{
size.depth = mAnimatedSize.depth;
}
const Vector3& Actor::GetCurrentSize() const
{
// node is being used in a separate thread; copy the value from the previous update
- return GetNode().GetSize( GetEventThreadServices().GetEventBufferIndex() );
+ return GetNode().GetSize(GetEventThreadServices().GetEventBufferIndex());
}
Vector3 Actor::GetNaturalSize() const
{
// It is up to deriving classes to return the appropriate natural size
- return Vector3( 0.0f, 0.0f, 0.0f );
+ return Vector3(0.0f, 0.0f, 0.0f);
}
-void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
+void Actor::SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
{
EnsureRelayouter().SetResizePolicy(policy, dimension, mTargetSize);
- OnSetResizePolicy( policy, dimension );
+ OnSetResizePolicy(policy, dimension);
// Trigger relayout on this control
RelayoutRequest();
}
-ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
+ResizePolicy::Type Actor::GetResizePolicy(Dimension::Type dimension) const
{
- if ( mRelayoutData )
+ if(mRelayoutData)
{
return mRelayoutData->GetResizePolicy(dimension);
}
return ResizePolicy::DEFAULT;
}
-void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy )
+void Actor::SetSizeScalePolicy(SizeScalePolicy::Type policy)
{
EnsureRelayouter();
SizeScalePolicy::Type Actor::GetSizeScalePolicy() const
{
- if ( mRelayoutData )
+ if(mRelayoutData)
{
return mRelayoutData->sizeSetPolicy;
}
return Relayouter::DEFAULT_SIZE_SCALE_POLICY;
}
-void Actor::SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency )
+void Actor::SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency)
{
EnsureRelayouter().SetDimensionDependency(dimension, dependency);
}
-Dimension::Type Actor::GetDimensionDependency( Dimension::Type dimension ) const
+Dimension::Type Actor::GetDimensionDependency(Dimension::Type dimension) const
{
- if ( mRelayoutData )
+ if(mRelayoutData)
{
return mRelayoutData->GetDimensionDependency(dimension);
}
- return Dimension::ALL_DIMENSIONS; // Default
+ return Dimension::ALL_DIMENSIONS; // Default
}
-void Actor::SetRelayoutEnabled( bool relayoutEnabled )
+void Actor::SetRelayoutEnabled(bool relayoutEnabled)
{
// If relayout data has not been allocated yet and the client is requesting
// to disable it, do nothing
- if( mRelayoutData || relayoutEnabled )
+ if(mRelayoutData || relayoutEnabled)
{
EnsureRelayouter();
- DALI_ASSERT_DEBUG( mRelayoutData && "mRelayoutData not created" );
+ DALI_ASSERT_DEBUG(mRelayoutData && "mRelayoutData not created");
mRelayoutData->relayoutEnabled = relayoutEnabled;
}
return mRelayoutData && mRelayoutData->relayoutEnabled;
}
-void Actor::SetLayoutDirty( bool dirty, Dimension::Type dimension )
+void Actor::SetLayoutDirty(bool dirty, Dimension::Type dimension)
{
EnsureRelayouter().SetLayoutDirty(dirty, dimension);
}
-bool Actor::IsLayoutDirty( Dimension::Type dimension ) const
+bool Actor::IsLayoutDirty(Dimension::Type dimension) const
{
return mRelayoutData && mRelayoutData->IsLayoutDirty(dimension);
}
-bool Actor::RelayoutPossible( Dimension::Type dimension ) const
+bool Actor::RelayoutPossible(Dimension::Type dimension) const
{
- return mRelayoutData && mRelayoutData->relayoutEnabled && !IsLayoutDirty( dimension );
+ return mRelayoutData && mRelayoutData->relayoutEnabled && !IsLayoutDirty(dimension);
}
-bool Actor::RelayoutRequired( Dimension::Type dimension ) const
+bool Actor::RelayoutRequired(Dimension::Type dimension) const
{
- return mRelayoutData && mRelayoutData->relayoutEnabled && IsLayoutDirty( dimension );
+ return mRelayoutData && mRelayoutData->relayoutEnabled && IsLayoutDirty(dimension);
}
-uint32_t Actor::AddRenderer( Renderer& renderer )
+uint32_t Actor::AddRenderer(Renderer& renderer)
{
- if( !mRenderers )
+ if(!mRenderers)
{
mRenderers = new RendererContainer;
}
renderer.SetBlendEquation(static_cast<DevelBlendEquation::Type>(mBlendEquation));
}
- uint32_t index = static_cast<uint32_t>( mRenderers->size() ); // 4,294,967,295 renderers per actor
- RendererPtr rendererPtr = RendererPtr( &renderer );
- mRenderers->push_back( rendererPtr );
- AttachRendererMessage( GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject() );
+ uint32_t index = static_cast<uint32_t>(mRenderers->size()); // 4,294,967,295 renderers per actor
+ RendererPtr rendererPtr = RendererPtr(&renderer);
+ mRenderers->push_back(rendererPtr);
+ AttachRendererMessage(GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject());
return index;
}
uint32_t Actor::GetRendererCount() const
{
uint32_t rendererCount(0);
- if( mRenderers )
+ if(mRenderers)
{
- rendererCount = static_cast<uint32_t>( mRenderers->size() ); // 4,294,967,295 renderers per actor
+ rendererCount = static_cast<uint32_t>(mRenderers->size()); // 4,294,967,295 renderers per actor
}
return rendererCount;
}
-RendererPtr Actor::GetRendererAt( uint32_t index )
+RendererPtr Actor::GetRendererAt(uint32_t index)
{
RendererPtr renderer;
- if( index < GetRendererCount() )
+ if(index < GetRendererCount())
{
- renderer = ( *mRenderers )[ index ];
+ renderer = (*mRenderers)[index];
}
return renderer;
}
-void Actor::RemoveRenderer( Renderer& renderer )
+void Actor::RemoveRenderer(Renderer& renderer)
{
- if( mRenderers )
+ if(mRenderers)
{
RendererIter end = mRenderers->end();
- for( RendererIter iter = mRenderers->begin(); iter != end; ++iter )
+ for(RendererIter iter = mRenderers->begin(); iter != end; ++iter)
{
- if( (*iter).Get() == &renderer )
+ if((*iter).Get() == &renderer)
{
- mRenderers->erase( iter );
- DetachRendererMessage( GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject() );
+ mRenderers->erase(iter);
+ DetachRendererMessage(GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject());
break;
}
}
}
}
-void Actor::RemoveRenderer( uint32_t index )
+void Actor::RemoveRenderer(uint32_t index)
{
- if( index < GetRendererCount() )
+ if(index < GetRendererCount())
{
- RendererPtr renderer = ( *mRenderers )[ index ];
- DetachRendererMessage( GetEventThreadServices(), GetNode(), renderer.Get()->GetRendererSceneObject() );
- mRenderers->erase( mRenderers->begin()+index );
+ RendererPtr renderer = (*mRenderers)[index];
+ DetachRendererMessage(GetEventThreadServices(), GetNode(), renderer.Get()->GetRendererSceneObject());
+ mRenderers->erase(mRenderers->begin() + index);
}
}
return mBlendEquation;
}
-void Actor::SetDrawMode( DrawMode::Type drawMode )
+void Actor::SetDrawMode(DrawMode::Type drawMode)
{
// this flag is not animatable so keep the value
mDrawMode = drawMode;
// node is being used in a separate thread; queue a message to set the value
- SetDrawModeMessage( GetEventThreadServices(), GetNode(), drawMode );
+ SetDrawModeMessage(GetEventThreadServices(), GetNode(), drawMode);
}
-bool Actor::ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const
+bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const
{
// only valid when on-stage
- if( mScene && OnScene() )
+ if(mScene && OnScene())
{
const RenderTaskList& taskList = mScene->GetRenderTaskList();
- Vector2 converted( screenX, screenY );
+ Vector2 converted(screenX, screenY);
// do a reverse traversal of all lists (as the default onscreen one is typically the last one)
uint32_t taskCount = taskList.GetTaskCount();
- for( uint32_t i = taskCount; i > 0; --i )
+ for(uint32_t i = taskCount; i > 0; --i)
{
- RenderTaskPtr task = taskList.GetTask( i - 1 );
- if( ScreenToLocal( *task, localX, localY, screenX, screenY ) )
+ RenderTaskPtr task = taskList.GetTask(i - 1);
+ if(ScreenToLocal(*task, localX, localY, screenX, screenY))
{
// found a task where this conversion was ok so return
return true;
return false;
}
-bool Actor::ScreenToLocal( const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const
+bool Actor::ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const
{
bool retval = false;
// only valid when on-stage
- if( OnScene() )
+ if(OnScene())
{
CameraActor* camera = renderTask.GetCameraActor();
- if( camera )
+ if(camera)
{
Viewport viewport;
- renderTask.GetViewport( viewport );
+ renderTask.GetViewport(viewport);
// need to translate coordinates to render tasks coordinate space
- Vector2 converted( screenX, screenY );
- if( renderTask.TranslateCoordinates( converted ) )
+ Vector2 converted(screenX, screenY);
+ if(renderTask.TranslateCoordinates(converted))
{
- retval = ScreenToLocal( camera->GetViewMatrix(), camera->GetProjectionMatrix(), viewport, localX, localY, converted.x, converted.y );
+ retval = ScreenToLocal(camera->GetViewMatrix(), camera->GetProjectionMatrix(), viewport, localX, localY, converted.x, converted.y);
}
}
}
return retval;
}
-bool Actor::ScreenToLocal( const Matrix& viewMatrix, const Matrix& projectionMatrix, const Viewport& viewport, float& localX, float& localY, float screenX, float screenY ) const
+bool Actor::ScreenToLocal(const Matrix& viewMatrix, const Matrix& projectionMatrix, const Viewport& viewport, float& localX, float& localY, float screenX, float screenY) const
{
return OnScene() && ScreenToLocalInternal(viewMatrix, projectionMatrix, GetNode().GetWorldMatrix(0), viewport, GetCurrentSize(), localX, localY, screenX, screenY);
}
{
// Likely scenario is that once gesture-data is created for this actor, the actor will require
// that gesture for its entire life-time so no need to destroy it until the actor is destroyed
- if( nullptr == mGestureData )
+ if(nullptr == mGestureData)
{
mGestureData = new ActorGestureData;
}
return *mGestureData;
}
-bool Actor::IsGestureRequired( GestureType::Value type ) const
+bool Actor::IsGestureRequired(GestureType::Value type) const
{
- return mGestureData && mGestureData->IsGestureRequired( type );
+ return mGestureData && mGestureData->IsGestureRequired(type);
}
-bool Actor::EmitInterceptTouchEventSignal( const Dali::TouchEvent& touch )
+bool Actor::EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch)
{
- return EmitConsumingSignal( *this, mInterceptTouchedSignal, touch );
+ return EmitConsumingSignal(*this, mInterceptTouchedSignal, touch);
}
-bool Actor::EmitTouchEventSignal( const Dali::TouchEvent& touch )
+bool Actor::EmitTouchEventSignal(const Dali::TouchEvent& touch)
{
- return EmitConsumingSignal( *this, mTouchedSignal, touch );
+ return EmitConsumingSignal(*this, mTouchedSignal, touch);
}
-bool Actor::EmitHoverEventSignal( const Dali::HoverEvent& event )
+bool Actor::EmitHoverEventSignal(const Dali::HoverEvent& event)
{
- return EmitConsumingSignal( *this, mHoveredSignal, event );
+ return EmitConsumingSignal(*this, mHoveredSignal, event);
}
-bool Actor::EmitWheelEventSignal( const Dali::WheelEvent& event )
+bool Actor::EmitWheelEventSignal(const Dali::WheelEvent& event)
{
- return EmitConsumingSignal( *this, mWheelEventSignal, event );
+ return EmitConsumingSignal(*this, mWheelEventSignal, event);
}
-void Actor::EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityChange::Type type )
+void Actor::EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type)
{
- EmitSignal( *this, mVisibilityChangedSignal, visible, type );
+ EmitSignal(*this, mVisibilityChangedSignal, visible, type);
}
-void Actor::EmitLayoutDirectionChangedSignal( LayoutDirection::Type type )
+void Actor::EmitLayoutDirectionChangedSignal(LayoutDirection::Type type)
{
- EmitSignal( *this, mLayoutDirectionChangedSignal, type );
+ EmitSignal(*this, mLayoutDirectionChangedSignal, type);
}
-void Actor::EmitChildAddedSignal( Actor& child )
+DevelActor::ChildChangedSignalType& Actor::ChildAddedSignal()
{
- EmitSignal( child, mChildAddedSignal );
+ return mParentImpl.ChildAddedSignal();
}
-void Actor::EmitChildRemovedSignal( Actor& child )
+DevelActor::ChildChangedSignalType& Actor::ChildRemovedSignal()
{
- EmitSignal( child, mChildRemovedSignal );
+ return mParentImpl.ChildRemovedSignal();
}
-bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+DevelActor::ChildOrderChangedSignalType& Actor::ChildOrderChangedSignal()
{
- bool connected( true );
- Actor* actor = static_cast< Actor* >( object ); // TypeRegistry guarantees that this is the correct type.
+ return mParentImpl.ChildOrderChangedSignal();
+}
+
+bool Actor::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
+{
+ bool connected(true);
+ Actor* actor = static_cast<Actor*>(object); // TypeRegistry guarantees that this is the correct type.
std::string_view name(signalName);
if(name == SIGNAL_HOVERED)
{
- actor->HoveredSignal().Connect( tracker, functor );
+ actor->HoveredSignal().Connect(tracker, functor);
}
else if(signalName == SIGNAL_WHEEL_EVENT)
{
- actor->WheelEventSignal().Connect( tracker, functor );
+ actor->WheelEventSignal().Connect(tracker, functor);
}
else if(name == SIGNAL_ON_SCENE)
{
- actor->OnSceneSignal().Connect( tracker, functor );
+ actor->OnSceneSignal().Connect(tracker, functor);
}
else if(name == SIGNAL_OFF_SCENE)
{
- actor->OffSceneSignal().Connect( tracker, functor );
+ actor->OffSceneSignal().Connect(tracker, functor);
}
else if(name == SIGNAL_ON_RELAYOUT)
{
- actor->OnRelayoutSignal().Connect( tracker, functor );
+ actor->OnRelayoutSignal().Connect(tracker, functor);
}
else if(name == SIGNAL_TOUCHED)
{
- actor->TouchedSignal().Connect( tracker, functor );
+ actor->TouchedSignal().Connect(tracker, functor);
}
else if(name == SIGNAL_VISIBILITY_CHANGED)
{
- actor->VisibilityChangedSignal().Connect( tracker, functor );
+ actor->VisibilityChangedSignal().Connect(tracker, functor);
}
else if(name == SIGNAL_LAYOUT_DIRECTION_CHANGED)
{
- actor->LayoutDirectionChangedSignal().Connect( tracker, functor );
+ actor->LayoutDirectionChangedSignal().Connect(tracker, functor);
}
else if(name == SIGNAL_CHILD_ADDED)
{
- actor->ChildAddedSignal().Connect( tracker, functor );
+ actor->ChildAddedSignal().Connect(tracker, functor);
}
else if(name == SIGNAL_CHILD_REMOVED)
{
- actor->ChildRemovedSignal().Connect( tracker, functor );
+ actor->ChildRemovedSignal().Connect(tracker, functor);
}
else
{
return connected;
}
-Actor::Actor( DerivedType derivedType, const SceneGraph::Node& node )
-: Object( &node ),
- mScene( nullptr ),
- mParent( nullptr ),
- mChildren( nullptr ),
- mRenderers( nullptr ),
- mParentOrigin( nullptr ),
- mAnchorPoint( nullptr ),
- mRelayoutData( nullptr ),
- mGestureData( nullptr ),
+Actor::Actor(DerivedType derivedType, const SceneGraph::Node& node)
+: Object(&node),
+ mParentImpl(*this),
+ mParent(nullptr),
+ mScene(nullptr),
+ mRenderers(nullptr),
+ mParentOrigin(nullptr),
+ mAnchorPoint(nullptr),
+ mRelayoutData(nullptr),
+ mGestureData(nullptr),
mInterceptTouchedSignal(),
mTouchedSignal(),
mHoveredSignal(),
mOnRelayoutSignal(),
mVisibilityChangedSignal(),
mLayoutDirectionChangedSignal(),
- mChildAddedSignal(),
- mChildRemovedSignal(),
- mChildOrderChangedSignal(),
- mTargetOrientation( Quaternion::IDENTITY ),
- mTargetColor( Color::WHITE ),
- mTargetSize( Vector3::ZERO ),
- mTargetPosition( Vector3::ZERO ),
- mTargetScale( Vector3::ONE ),
- mAnimatedSize( Vector3::ZERO ),
- mTouchArea( Vector2::ZERO ),
+ mTargetOrientation(Quaternion::IDENTITY),
+ mTargetColor(Color::WHITE),
+ mTargetSize(Vector3::ZERO),
+ mTargetPosition(Vector3::ZERO),
+ mTargetScale(Vector3::ONE),
+ mAnimatedSize(Vector3::ZERO),
+ mTouchArea(Vector2::ZERO),
mName(),
- mSortedDepth( 0u ),
- mDepth( 0u ),
- mUseAnimatedSize( AnimatedSizeFlag::CLEAR ),
- mIsRoot( ROOT_LAYER == derivedType ),
- mIsLayer( LAYER == derivedType || ROOT_LAYER == derivedType ),
- mIsOnScene( false ),
- mSensitive( true ),
- mLeaveRequired( false ),
- mKeyboardFocusable( false ),
- mOnSceneSignalled( false ),
- mInsideOnSizeSet( false ),
- mInheritPosition( true ),
- mInheritOrientation( true ),
- mInheritScale( true ),
- mPositionUsesAnchorPoint( true ),
- mVisible( true ),
- mInheritLayoutDirection( true ),
- mCaptureAllTouchAfterStart( false ),
- mLayoutDirection( LayoutDirection::LEFT_TO_RIGHT ),
- mDrawMode( DrawMode::NORMAL ),
- mColorMode( Node::DEFAULT_COLOR_MODE ),
- mClippingMode( ClippingMode::DISABLED ),
- mBlendEquation( DevelBlendEquation::ADD ),
- mIsBlendEquationSet( false )
+ mSortedDepth(0u),
+ mDepth(0u),
+ mUseAnimatedSize(AnimatedSizeFlag::CLEAR),
+ mIsRoot(ROOT_LAYER == derivedType),
+ mIsLayer(LAYER == derivedType || ROOT_LAYER == derivedType),
+ mIsOnScene(false),
+ mSensitive(true),
+ mLeaveRequired(false),
+ mKeyboardFocusable(false),
+ mOnSceneSignalled(false),
+ mInsideOnSizeSet(false),
+ mInheritPosition(true),
+ mInheritOrientation(true),
+ mInheritScale(true),
+ mPositionUsesAnchorPoint(true),
+ mVisible(true),
+ mInheritLayoutDirection(true),
+ mCaptureAllTouchAfterStart(false),
+ mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT),
+ mDrawMode(DrawMode::NORMAL),
+ mColorMode(Node::DEFAULT_COLOR_MODE),
+ mClippingMode(ClippingMode::DISABLED),
+ mBlendEquation(DevelBlendEquation::ADD),
+ mIsBlendEquationSet(false)
{
}
{
OnInitialize();
- GetEventThreadServices().RegisterObject( this );
+ GetEventThreadServices().RegisterObject(this);
}
Actor::~Actor()
{
// Remove mParent pointers from children even if we're destroying core,
// to guard against GetParent() & Unparent() calls from CustomActor destructors.
- if( mChildren )
- {
- for( const auto& actor : *mChildren )
- {
- actor->SetParent( nullptr );
- }
- }
- delete mChildren;
+ UnparentChildren();
delete mRenderers;
// Guard to allow handle destruction after Core has been destroyed
- if( EventThreadServices::IsCoreRunning() )
+ if(EventThreadServices::IsCoreRunning())
{
// Root layer will destroy its node in its own destructor
- if ( !mIsRoot )
+ if(!mIsRoot)
{
- DestroyNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() );
+ DestroyNodeMessage(GetEventThreadServices().GetUpdateManager(), GetNode());
- GetEventThreadServices().UnregisterObject( this );
+ GetEventThreadServices().UnregisterObject(this);
}
}
delete mRelayoutData;
}
-void Actor::ConnectToScene( uint32_t parentDepth )
+void Actor::Add(Actor& child)
+{
+ mParentImpl.Add(child);
+}
+
+void Actor::Remove(Actor& child)
+{
+ mParentImpl.Remove(child);
+}
+
+uint32_t Actor::GetChildCount() const
+{
+ return mParentImpl.GetChildCount();
+}
+
+ActorPtr Actor::GetChildAt(uint32_t index) const
+{
+ return mParentImpl.GetChildAt(index);
+}
+
+ActorContainer& Actor::GetChildrenInternal()
+{
+ return mParentImpl.GetChildrenInternal();
+}
+
+ActorPtr Actor::FindChildByName(const std::string& actorName)
+{
+ return mParentImpl.FindChildByName(actorName);
+}
+
+ActorPtr Actor::FindChildById(const uint32_t id)
+{
+ return mParentImpl.FindChildById(id);
+}
+
+void Actor::UnparentChildren()
+{
+ mParentImpl.UnparentChildren();
+}
+
+void Actor::ConnectToScene(uint32_t parentDepth)
{
// This container is used instead of walking the Actor hierarchy.
// It protects us when the Actor hierarchy is modified during OnSceneConnectionExternal callbacks.
ActorContainer connectionList;
- if( mScene )
+ if(mScene)
{
mScene->RequestRebuildDepthTree();
}
// This stage is atomic i.e. not interrupted by user callbacks.
- RecursiveConnectToScene( connectionList, parentDepth + 1 );
+ RecursiveConnectToScene(connectionList, parentDepth + 1);
// Notify applications about the newly connected actors.
- for( const auto& actor : connectionList )
+ for(const auto& actor : connectionList)
{
actor->NotifyStageConnection();
}
RelayoutRequest();
}
-void Actor::RecursiveConnectToScene( ActorContainer& connectionList, uint32_t depth )
+void Actor::RecursiveConnectToScene(ActorContainer& connectionList, uint32_t depth)
{
- DALI_ASSERT_ALWAYS( !OnScene() );
+ DALI_ASSERT_ALWAYS(!OnScene());
mIsOnScene = true;
- mDepth = static_cast< uint16_t >( depth ); // overflow ignored, not expected in practice
+ mDepth = static_cast<uint16_t>(depth); // overflow ignored, not expected in practice
ConnectToSceneGraph();
OnSceneConnectionInternal();
// This stage is atomic; avoid emitting callbacks until all Actors are connected
- connectionList.push_back( ActorPtr( this ) );
+ connectionList.push_back(ActorPtr(this));
// Recursively connect children
- if( mChildren )
+ if(GetChildCount() > 0)
{
- for( const auto& actor : *mChildren )
+ for(const auto& child : mParentImpl.GetChildrenInternal())
{
- actor->SetScene( *mScene );
- actor->RecursiveConnectToScene( connectionList, depth + 1 );
+ child->SetScene(*mScene);
+ child->RecursiveConnectToScene(connectionList, depth + 1);
}
}
}
*/
void Actor::ConnectToSceneGraph()
{
- DALI_ASSERT_DEBUG( mParent != NULL);
+ DALI_ASSERT_DEBUG(mParent != NULL);
// Reparent Node in next Update
- ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), mParent->GetNode(), GetNode() );
+ ConnectNodeMessage(GetEventThreadServices().GetUpdateManager(), GetParent()->GetNode(), GetNode());
// Request relayout on all actors that are added to the scenegraph
RelayoutRequest();
{
// Actors can be removed (in a callback), before the on-stage stage is reported.
// The actor may also have been reparented, in which case mOnSceneSignalled will be true.
- if( OnScene() && !mOnSceneSignalled )
+ if(OnScene() && !mOnSceneSignalled)
{
// Notification for external (CustomActor) derived classes
- OnSceneConnectionExternal( mDepth );
+ OnSceneConnectionExternal(mDepth);
- if( !mOnSceneSignal.Empty() )
+ if(!mOnSceneSignal.Empty())
{
- Dali::Actor handle( this );
- mOnSceneSignal.Emit( handle );
+ Dali::Actor handle(this);
+ mOnSceneSignal.Emit(handle);
}
// Guard against Remove during callbacks
- if( OnScene() )
+ if(OnScene())
{
mOnSceneSignalled = true; // signal required next time Actor is removed
}
// It protects us when the Actor hierachy is modified during OnSceneDisconnectionExternal callbacks.
ActorContainer disconnectionList;
- if( mScene )
+ if(mScene)
{
mScene->RequestRebuildDepthTree();
}
// This stage is atomic i.e. not interrupted by user callbacks
- RecursiveDisconnectFromStage( disconnectionList );
+ RecursiveDisconnectFromStage(disconnectionList);
// Notify applications about the newly disconnected actors.
- for( const auto& actor : disconnectionList )
+ for(const auto& actor : disconnectionList)
{
actor->NotifyStageDisconnection();
}
}
-void Actor::RecursiveDisconnectFromStage( ActorContainer& disconnectionList )
+void Actor::RecursiveDisconnectFromStage(ActorContainer& disconnectionList)
{
// need to change state first so that internals relying on IsOnScene() inside OnSceneDisconnectionInternal() get the correct value
mIsOnScene = false;
// Recursively disconnect children
- if( mChildren )
+ if(GetChildCount() > 0)
{
- for( const auto& child : *mChildren )
+ for(const auto& child : mParentImpl.GetChildrenInternal())
{
- child->RecursiveDisconnectFromStage( disconnectionList );
+ child->RecursiveDisconnectFromStage(disconnectionList);
}
}
// This stage is atomic; avoid emitting callbacks until all Actors are disconnected
- disconnectionList.push_back( ActorPtr( this ) );
+ disconnectionList.push_back(ActorPtr(this));
// Notification for internal derived classes
OnSceneDisconnectionInternal();
// Actors can be added (in a callback), before the off-stage state is reported.
// Also if the actor was added & removed before mOnSceneSignalled was set, then we don't notify here.
// only do this step if there is a stage, i.e. Core is not being shut down
- if ( EventThreadServices::IsCoreRunning() && !OnScene() && mOnSceneSignalled )
+ if(EventThreadServices::IsCoreRunning() && !OnScene() && mOnSceneSignalled)
{
// Notification for external (CustomeActor) derived classes
OnSceneDisconnectionExternal();
- if( !mOffSceneSignal.Empty() )
+ if(!mOffSceneSignal.Empty())
{
- Dali::Actor handle( this );
- mOffSceneSignal.Emit( handle );
+ Dali::Actor handle(this);
+ mOffSceneSignal.Emit(handle);
}
// Guard against Add during callbacks
- if( !OnScene() )
+ if(!OnScene())
{
mOnSceneSignalled = false; // signal required next time Actor is added
}
bool Actor::IsNodeConnected() const
{
- bool connected( false );
+ bool connected(false);
- if( OnScene() )
+ if(OnScene())
{
- if( IsRoot() || GetNode().GetParent() )
+ if(IsRoot() || GetNode().GetParent())
{
connected = true;
}
// Vector of scene-graph nodes and their depths to send to UpdateManager
// in a single message
- OwnerPointer<SceneGraph::NodeDepths> sceneGraphNodeDepths( new SceneGraph::NodeDepths() );
+ OwnerPointer<SceneGraph::NodeDepths> sceneGraphNodeDepths(new SceneGraph::NodeDepths());
int32_t depthIndex = 1;
- DepthTraverseActorTree( sceneGraphNodeDepths, depthIndex );
+ DepthTraverseActorTree(sceneGraphNodeDepths, depthIndex);
- SetDepthIndicesMessage( GetEventThreadServices().GetUpdateManager(), sceneGraphNodeDepths );
+ SetDepthIndicesMessage(GetEventThreadServices().GetUpdateManager(), sceneGraphNodeDepths);
DALI_LOG_TIMER_END(depthTimer, gLogFilter, Debug::Concise, "Depth tree traversal time: ");
}
-void Actor::DepthTraverseActorTree( OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex )
+void Actor::DepthTraverseActorTree(OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex)
{
mSortedDepth = depthIndex * DevelLayer::SIBLING_ORDER_MULTIPLIER;
- sceneGraphNodeDepths->Add( const_cast<SceneGraph::Node*>( &GetNode() ), mSortedDepth );
+ sceneGraphNodeDepths->Add(const_cast<SceneGraph::Node*>(&GetNode()), mSortedDepth);
// Create/add to children of this node
- if( mChildren )
+ if(GetChildCount() > 0)
{
- for( const auto& child : *mChildren )
+ for(const auto& child : mParentImpl.GetChildrenInternal())
{
Actor* childActor = child.Get();
++depthIndex;
- childActor->DepthTraverseActorTree( sceneGraphNodeDepths, depthIndex );
+ childActor->DepthTraverseActorTree(sceneGraphNodeDepths, depthIndex);
}
}
}
-void Actor::SetDefaultProperty( Property::Index index, const Property::Value& property )
+void Actor::SetDefaultProperty(Property::Index index, const Property::Value& property)
{
PropertyHandler::SetDefaultProperty(*this, index, property);
}
// TODO: This method needs to be removed
-void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value )
+void Actor::SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value)
{
PropertyHandler::SetSceneGraphProperty(index, entry, value, GetEventThreadServices(), GetNode());
}
-Property::Value Actor::GetDefaultProperty( Property::Index index ) const
+Property::Value Actor::GetDefaultProperty(Property::Index index) const
{
Property::Value value;
- if( ! GetCachedPropertyValue( index, value ) )
+ if(!GetCachedPropertyValue(index, value))
{
// If property value is not stored in the event-side, then it must be a scene-graph only property
- GetCurrentPropertyValue( index, value );
+ GetCurrentPropertyValue(index, value);
}
return value;
}
-Property::Value Actor::GetDefaultPropertyCurrentValue( Property::Index index ) const
+Property::Value Actor::GetDefaultPropertyCurrentValue(Property::Index index) const
{
Property::Value value;
- if( ! GetCurrentPropertyValue( index, value ) )
+ if(!GetCurrentPropertyValue(index, value))
{
// If unable to retrieve scene-graph property value, then it must be an event-side only property
- GetCachedPropertyValue( index, value );
+ GetCachedPropertyValue(index, value);
}
return value;
}
-void Actor::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType )
+void Actor::OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType)
{
PropertyHandler::OnNotifyDefaultPropertyAnimation(*this, animation, index, value, animationType);
}
-const PropertyBase* Actor::GetSceneObjectAnimatableProperty( Property::Index index ) const
+const PropertyBase* Actor::GetSceneObjectAnimatableProperty(Property::Index index) const
{
const PropertyBase* property = PropertyHandler::GetSceneObjectAnimatableProperty(index, GetNode());
- if( !property )
+ if(!property)
{
// not our property, ask base
- property = Object::GetSceneObjectAnimatableProperty( index );
+ property = Object::GetSceneObjectAnimatableProperty(index);
}
return property;
}
-const PropertyInputImpl* Actor::GetSceneObjectInputProperty( Property::Index index ) const
+const PropertyInputImpl* Actor::GetSceneObjectInputProperty(Property::Index index) const
{
const PropertyInputImpl* property = PropertyHandler::GetSceneObjectInputProperty(index, GetNode());
- if( !property )
+ if(!property)
{
// reuse animatable property getter as animatable properties are inputs as well
// animatable property chains back to Object::GetSceneObjectInputProperty() so all properties get covered
- property = GetSceneObjectAnimatableProperty( index );
+ property = GetSceneObjectAnimatableProperty(index);
}
return property;
}
-int32_t Actor::GetPropertyComponentIndex( Property::Index index ) const
+int32_t Actor::GetPropertyComponentIndex(Property::Index index) const
{
int32_t componentIndex = PropertyHandler::GetPropertyComponentIndex(index);
- if( Property::INVALID_COMPONENT_INDEX == componentIndex )
+ if(Property::INVALID_COMPONENT_INDEX == componentIndex)
{
// ask base
- componentIndex = Object::GetPropertyComponentIndex( index );
+ componentIndex = Object::GetPropertyComponentIndex(index);
}
return componentIndex;
}
-void Actor::SetParent( Actor* parent )
+void Actor::Raise()
{
- if( parent )
+ if(mParent)
+ {
+ mParent->RaiseChild(*this);
+ }
+ else
{
- DALI_ASSERT_ALWAYS( !mParent && "Actor cannot have 2 parents" );
+ DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
+ }
+}
- mParent = parent;
+void Actor::Lower()
+{
+ if(mParent)
+ {
+ mParent->LowerChild(*this);
+ }
+ else
+ {
+ DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
+ }
+}
- mScene = parent->mScene;
+void Actor::RaiseToTop()
+{
+ if(mParent)
+ {
+ mParent->RaiseChildToTop(*this);
+ }
+ else
+ {
+ DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
+ }
+}
- if ( EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
- parent->OnScene() )
+void Actor::LowerToBottom()
+{
+ if(mParent)
+ {
+ mParent->LowerChildToBottom(*this);
+ }
+ else
+ {
+ DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
+ }
+}
+
+void Actor::RaiseAbove(Internal::Actor& target)
+{
+ if(mParent)
+ {
+ mParent->RaiseChildAbove(*this, target);
+ }
+ else
+ {
+ DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
+ }
+}
+
+void Actor::LowerBelow(Internal::Actor& target)
+{
+ if(mParent)
+ {
+ mParent->LowerChildBelow(*this, target);
+ }
+ else
+ {
+ DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
+ }
+}
+
+void Actor::SetParent(ActorParent* parent)
+{
+ if(parent)
+ {
+ DALI_ASSERT_ALWAYS(!mParent && "Actor cannot have 2 parents");
+
+ mParent = parent;
+ Actor* parentActor = static_cast<Actor*>(parent);
+ mScene = parentActor->mScene;
+
+ if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ parentActor->OnScene())
{
// Instruct each actor to create a corresponding node in the scene graph
- ConnectToScene( parent->GetHierarchyDepth() );
+ ConnectToScene(parentActor->GetHierarchyDepth());
}
// Resolve the name and index for the child properties if any
}
else // parent being set to NULL
{
- DALI_ASSERT_ALWAYS( mParent != nullptr && "Actor should have a parent" );
+ DALI_ASSERT_ALWAYS(mParent != nullptr && "Actor should have a parent");
mParent = nullptr;
- if ( EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
- OnScene() )
+ if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ OnScene())
{
// Disconnect the Node & its children from the scene-graph.
- DisconnectNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() );
+ DisconnectNodeMessage(GetEventThreadServices().GetUpdateManager(), GetNode());
// Instruct each actor to discard pointers to the scene-graph
DisconnectFromStage();
}
}
-bool Actor::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& /* attributes */ )
+bool Actor::DoAction(BaseObject* object, const std::string& actionName, const Property::Map& /* attributes */)
{
- bool done = false;
- Actor* actor = dynamic_cast< Actor* >( object );
+ bool done = false;
+ Actor* actor = dynamic_cast<Actor*>(object);
- if( actor )
+ if(actor)
{
std::string_view name(actionName);
if(name == ACTION_SHOW)
{
- actor->SetVisible( true );
+ actor->SetVisible(true);
done = true;
}
else if(name == ACTION_HIDE)
{
- actor->SetVisible( false );
+ actor->SetVisible(false);
done = true;
}
}
return done;
}
-Rect<> Actor::CalculateScreenExtents( ) const
+Rect<> Actor::CalculateScreenExtents() const
{
- auto screenPosition = GetCurrentScreenPosition();
- Vector3 size = GetCurrentSize() * GetCurrentWorldScale();
- Vector3 anchorPointOffSet = size * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT );
- Vector2 position = Vector2( screenPosition.x - anchorPointOffSet.x, screenPosition.y - anchorPointOffSet.y );
- return { position.x, position.y, size.x, size.y };
+ auto screenPosition = GetCurrentScreenPosition();
+ Vector3 size = GetCurrentSize() * GetCurrentWorldScale();
+ Vector3 anchorPointOffSet = size * (mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT);
+ Vector2 position = Vector2(screenPosition.x - anchorPointOffSet.x, screenPosition.y - anchorPointOffSet.y);
+ return {position.x, position.y, size.x, size.y};
}
-bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& value ) const
+bool Actor::GetCachedPropertyValue(Property::Index index, Property::Value& value) const
{
return PropertyHandler::GetCachedPropertyValue(*this, index, value);
}
-bool Actor::GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const
+bool Actor::GetCurrentPropertyValue(Property::Index index, Property::Value& value) const
{
return PropertyHandler::GetCurrentPropertyValue(*this, index, value);
}
Actor::Relayouter& Actor::EnsureRelayouter()
{
// Assign relayouter
- if( !mRelayoutData )
+ if(!mRelayoutData)
{
mRelayoutData = new Relayouter();
}
return *mRelayoutData;
}
-bool Actor::RelayoutDependentOnParent( Dimension::Type dimension )
+bool Actor::RelayoutDependentOnParent(Dimension::Type dimension)
{
// Check if actor is dependent on parent
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( ( dimension & ( 1 << i ) ) )
+ if((dimension & (1 << i)))
{
- const ResizePolicy::Type resizePolicy = GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) );
- if( resizePolicy == ResizePolicy::FILL_TO_PARENT || resizePolicy == ResizePolicy::SIZE_RELATIVE_TO_PARENT || resizePolicy == ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT )
+ const ResizePolicy::Type resizePolicy = GetResizePolicy(static_cast<Dimension::Type>(1 << i));
+ if(resizePolicy == ResizePolicy::FILL_TO_PARENT || resizePolicy == ResizePolicy::SIZE_RELATIVE_TO_PARENT || resizePolicy == ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT)
{
return true;
}
return false;
}
-bool Actor::RelayoutDependentOnChildren( Dimension::Type dimension )
+bool Actor::RelayoutDependentOnChildren(Dimension::Type dimension)
{
// Check if actor is dependent on children
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( ( dimension & ( 1 << i ) ) )
+ if((dimension & (1 << i)))
{
- const ResizePolicy::Type resizePolicy = GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) );
- switch( resizePolicy )
+ const ResizePolicy::Type resizePolicy = GetResizePolicy(static_cast<Dimension::Type>(1 << i));
+ switch(resizePolicy)
{
case ResizePolicy::FIT_TO_CHILDREN:
- case ResizePolicy::USE_NATURAL_SIZE: // i.e. For things that calculate their size based on children
+ case ResizePolicy::USE_NATURAL_SIZE: // i.e. For things that calculate their size based on children
{
return true;
}
return false;
}
-bool Actor::RelayoutDependentOnChildrenBase( Dimension::Type dimension )
+bool Actor::RelayoutDependentOnChildrenBase(Dimension::Type dimension)
{
- return Actor::RelayoutDependentOnChildren( dimension );
+ return Actor::RelayoutDependentOnChildren(dimension);
}
-bool Actor::RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension )
+bool Actor::RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension)
{
// Check each possible dimension and see if it is dependent on the input one
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- return mRelayoutData->resizePolicies[ i ] == ResizePolicy::DIMENSION_DEPENDENCY && mRelayoutData->dimensionDependencies[ i ] == dependentDimension;
+ return mRelayoutData->resizePolicies[i] == ResizePolicy::DIMENSION_DEPENDENCY && mRelayoutData->dimensionDependencies[i] == dependentDimension;
}
}
return false;
}
-void Actor::SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension )
+void Actor::SetNegotiatedDimension(float negotiatedDimension, Dimension::Type dimension)
{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( dimension & ( 1 << i ) )
+ if(dimension & (1 << i))
{
- mRelayoutData->negotiatedDimensions[ i ] = negotiatedDimension;
+ mRelayoutData->negotiatedDimensions[i] = negotiatedDimension;
}
}
}
-float Actor::GetNegotiatedDimension( Dimension::Type dimension ) const
+float Actor::GetNegotiatedDimension(Dimension::Type dimension) const
{
// If more than one dimension is requested, just return the first one found
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( ( dimension & ( 1 << i ) ) )
+ if((dimension & (1 << i)))
{
- return mRelayoutData->negotiatedDimensions[ i ];
+ return mRelayoutData->negotiatedDimensions[i];
}
}
- return 0.0f; // Default
+ return 0.0f; // Default
}
-void Actor::SetPadding( const Vector2& padding, Dimension::Type dimension )
+void Actor::SetPadding(const Vector2& padding, Dimension::Type dimension)
{
- EnsureRelayouter().SetPadding( padding, dimension );
+ EnsureRelayouter().SetPadding(padding, dimension);
}
-Vector2 Actor::GetPadding( Dimension::Type dimension ) const
+Vector2 Actor::GetPadding(Dimension::Type dimension) const
{
- if ( mRelayoutData )
+ if(mRelayoutData)
{
// If more than one dimension is requested, just return the first one found
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- if( ( dimension & ( 1 << i ) ) )
+ if((dimension & (1 << i)))
{
- return mRelayoutData->dimensionPadding[ i ];
+ return mRelayoutData->dimensionPadding[i];
}
}
}
return Relayouter::DEFAULT_DIMENSION_PADDING;
}
-void Actor::SetLayoutNegotiated( bool negotiated, Dimension::Type dimension )
+void Actor::SetLayoutNegotiated(bool negotiated, Dimension::Type dimension)
{
EnsureRelayouter().SetLayoutNegotiated(negotiated, dimension);
}
-bool Actor::IsLayoutNegotiated( Dimension::Type dimension ) const
+bool Actor::IsLayoutNegotiated(Dimension::Type dimension) const
{
return mRelayoutData && mRelayoutData->IsLayoutNegotiated(dimension);
}
-float Actor::GetHeightForWidthBase( float width )
+float Actor::GetHeightForWidthBase(float width)
{
float height = 0.0f;
const Vector3 naturalSize = GetNaturalSize();
- if( naturalSize.width > 0.0f )
+ if(naturalSize.width > 0.0f)
{
height = naturalSize.height * width / naturalSize.width;
}
return height;
}
-float Actor::GetWidthForHeightBase( float height )
+float Actor::GetWidthForHeightBase(float height)
{
float width = 0.0f;
const Vector3 naturalSize = GetNaturalSize();
- if( naturalSize.height > 0.0f )
+ if(naturalSize.height > 0.0f)
{
width = naturalSize.width * height / naturalSize.height;
}
return width;
}
-float Actor::CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
+float Actor::CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension)
{
// Fill to parent, taking size mode factor into account
- switch( child.GetResizePolicy( dimension ) )
+ switch(child.GetResizePolicy(dimension))
{
case ResizePolicy::FILL_TO_PARENT:
{
- return GetLatestSize( dimension );
+ return GetLatestSize(dimension);
}
case ResizePolicy::SIZE_RELATIVE_TO_PARENT:
{
- return GetLatestSize( dimension ) * GetDimensionValue( child.GetProperty< Vector3 >( Dali::Actor::Property::SIZE_MODE_FACTOR ), dimension );
+ return GetLatestSize(dimension) * GetDimensionValue(child.GetProperty<Vector3>(Dali::Actor::Property::SIZE_MODE_FACTOR), dimension);
}
case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT:
{
- return GetLatestSize( dimension ) + GetDimensionValue( child.GetProperty< Vector3 >( Dali::Actor::Property::SIZE_MODE_FACTOR ), dimension );
+ return GetLatestSize(dimension) + GetDimensionValue(child.GetProperty<Vector3>(Dali::Actor::Property::SIZE_MODE_FACTOR), dimension);
}
default:
{
- return GetLatestSize( dimension );
+ return GetLatestSize(dimension);
}
}
}
-float Actor::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
+float Actor::CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension)
{
// Can be overridden in derived class
- return CalculateChildSizeBase( child, dimension );
+ return CalculateChildSizeBase(child, dimension);
}
-float Actor::GetHeightForWidth( float width )
+float Actor::GetHeightForWidth(float width)
{
// Can be overridden in derived class
- return GetHeightForWidthBase( width );
+ return GetHeightForWidthBase(width);
}
-float Actor::GetWidthForHeight( float height )
+float Actor::GetWidthForHeight(float height)
{
// Can be overridden in derived class
- return GetWidthForHeightBase( height );
+ return GetWidthForHeightBase(height);
}
-float Actor::GetLatestSize( Dimension::Type dimension ) const
+float Actor::GetLatestSize(Dimension::Type dimension) const
{
- return IsLayoutNegotiated( dimension ) ? GetNegotiatedDimension( dimension ) : GetSize( dimension );
+ return IsLayoutNegotiated(dimension) ? GetNegotiatedDimension(dimension) : GetSize(dimension);
}
-float Actor::GetRelayoutSize( Dimension::Type dimension ) const
+float Actor::GetRelayoutSize(Dimension::Type dimension) const
{
- Vector2 padding = GetPadding( dimension );
+ Vector2 padding = GetPadding(dimension);
- return GetLatestSize( dimension ) + padding.x + padding.y;
+ return GetLatestSize(dimension) + padding.x + padding.y;
}
-float Actor::NegotiateFromParent( Dimension::Type dimension )
+float Actor::NegotiateFromParent(Dimension::Type dimension)
{
Actor* parent = GetParent();
- if( parent )
+ if(parent)
{
- Vector2 padding( GetPadding( dimension ) );
- Vector2 parentPadding( parent->GetPadding( dimension ) );
- return parent->CalculateChildSize( Dali::Actor( this ), dimension ) - parentPadding.x - parentPadding.y - padding.x - padding.y;
+ Vector2 padding(GetPadding(dimension));
+ Vector2 parentPadding(parent->GetPadding(dimension));
+ return parent->CalculateChildSize(Dali::Actor(this), dimension) - parentPadding.x - parentPadding.y - padding.x - padding.y;
}
return 0.0f;
}
-float Actor::NegotiateFromChildren( Dimension::Type dimension )
+float Actor::NegotiateFromChildren(Dimension::Type dimension)
{
float maxDimensionPoint = 0.0f;
- for( uint32_t i = 0, count = GetChildCount(); i < count; ++i )
+ for(uint32_t i = 0, count = GetChildCount(); i < count; ++i)
{
- ActorPtr child = GetChildAt( i );
+ ActorPtr child = GetChildAt(i);
- if( !child->RelayoutDependentOnParent( dimension ) )
+ if(!child->RelayoutDependentOnParent(dimension))
{
// Calculate the min and max points that the children range across
- float childPosition = GetDimensionValue( child->GetTargetPosition(), dimension );
- float dimensionSize = child->GetRelayoutSize( dimension );
- maxDimensionPoint = std::max( maxDimensionPoint, childPosition + dimensionSize );
+ float childPosition = GetDimensionValue(child->GetTargetPosition(), dimension);
+ float dimensionSize = child->GetRelayoutSize(dimension);
+ maxDimensionPoint = std::max(maxDimensionPoint, childPosition + dimensionSize);
}
}
return maxDimensionPoint;
}
-float Actor::GetSize( Dimension::Type dimension ) const
+float Actor::GetSize(Dimension::Type dimension) const
{
- return GetDimensionValue( mTargetSize, dimension );
+ return GetDimensionValue(mTargetSize, dimension);
}
-float Actor::GetNaturalSize( Dimension::Type dimension ) const
+float Actor::GetNaturalSize(Dimension::Type dimension) const
{
- return GetDimensionValue( GetNaturalSize(), dimension );
+ return GetDimensionValue(GetNaturalSize(), dimension);
}
-float Actor::CalculateSize( Dimension::Type dimension, const Vector2& maximumSize )
+float Actor::CalculateSize(Dimension::Type dimension, const Vector2& maximumSize)
{
- switch( GetResizePolicy( dimension ) )
+ switch(GetResizePolicy(dimension))
{
case ResizePolicy::USE_NATURAL_SIZE:
{
- return GetNaturalSize( dimension );
+ return GetNaturalSize(dimension);
}
case ResizePolicy::FIXED:
{
- return GetDimensionValue( GetPreferredSize(), dimension );
+ return GetDimensionValue(GetPreferredSize(), dimension);
}
case ResizePolicy::USE_ASSIGNED_SIZE:
{
- return GetDimensionValue( maximumSize, dimension );
+ return GetDimensionValue(maximumSize, dimension);
}
case ResizePolicy::FILL_TO_PARENT:
case ResizePolicy::SIZE_RELATIVE_TO_PARENT:
case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT:
{
- return NegotiateFromParent( dimension );
+ return NegotiateFromParent(dimension);
}
case ResizePolicy::FIT_TO_CHILDREN:
{
- return NegotiateFromChildren( dimension );
+ return NegotiateFromChildren(dimension);
}
case ResizePolicy::DIMENSION_DEPENDENCY:
{
- const Dimension::Type dimensionDependency = GetDimensionDependency( dimension );
+ const Dimension::Type dimensionDependency = GetDimensionDependency(dimension);
// Custom rules
- if( dimension == Dimension::WIDTH && dimensionDependency == Dimension::HEIGHT )
+ if(dimension == Dimension::WIDTH && dimensionDependency == Dimension::HEIGHT)
{
- return GetWidthForHeight( GetNegotiatedDimension( Dimension::HEIGHT ) );
+ return GetWidthForHeight(GetNegotiatedDimension(Dimension::HEIGHT));
}
- if( dimension == Dimension::HEIGHT && dimensionDependency == Dimension::WIDTH )
+ if(dimension == Dimension::HEIGHT && dimensionDependency == Dimension::WIDTH)
{
- return GetHeightForWidth( GetNegotiatedDimension( Dimension::WIDTH ) );
+ return GetHeightForWidth(GetNegotiatedDimension(Dimension::WIDTH));
}
break;
}
}
- return 0.0f; // Default
+ return 0.0f; // Default
}
-Vector2 Actor::ApplySizeSetPolicy( const Vector2& size )
+Vector2 Actor::ApplySizeSetPolicy(const Vector2& size)
{
return mRelayoutData->ApplySizeSetPolicy(*this, size);
}
-void Actor::SetNegotiatedSize( RelayoutContainer& container )
+void Actor::SetNegotiatedSize(RelayoutContainer& container)
{
// Do the set actor size
- Vector2 negotiatedSize( GetLatestSize( Dimension::WIDTH ), GetLatestSize( Dimension::HEIGHT ) );
+ Vector2 negotiatedSize(GetLatestSize(Dimension::WIDTH), GetLatestSize(Dimension::HEIGHT));
// Adjust for size set policy
- negotiatedSize = ApplySizeSetPolicy( negotiatedSize );
+ negotiatedSize = ApplySizeSetPolicy(negotiatedSize);
// Lock the flag to stop recursive relayouts on set size
mRelayoutData->insideRelayout = true;
- SetSize( negotiatedSize );
+ SetSize(negotiatedSize);
mRelayoutData->insideRelayout = false;
// Clear flags for all dimensions
- SetLayoutDirty( false );
+ SetLayoutDirty(false);
// Give deriving classes a chance to respond
- OnRelayout( negotiatedSize, container );
+ OnRelayout(negotiatedSize, container);
- if( !mOnRelayoutSignal.Empty() )
+ if(!mOnRelayoutSignal.Empty())
{
- Dali::Actor handle( this );
- mOnRelayoutSignal.Emit( handle );
+ Dali::Actor handle(this);
+ mOnRelayoutSignal.Emit(handle);
}
}
-void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& container )
+void Actor::NegotiateSize(const Vector2& allocatedSize, RelayoutContainer& container)
{
Relayouter::NegotiateSize(*this, allocatedSize, container);
}
-void Actor::SetUseAssignedSize( bool use, Dimension::Type dimension )
+void Actor::SetUseAssignedSize(bool use, Dimension::Type dimension)
{
- if( mRelayoutData )
+ if(mRelayoutData)
{
mRelayoutData->SetUseAssignedSize(use, dimension);
}
}
-bool Actor::GetUseAssignedSize( Dimension::Type dimension ) const
+bool Actor::GetUseAssignedSize(Dimension::Type dimension) const
{
return mRelayoutData && mRelayoutData->GetUseAssignedSize(dimension);
}
-void Actor::RelayoutRequest( Dimension::Type dimension )
+void Actor::RelayoutRequest(Dimension::Type dimension)
{
Internal::RelayoutController* relayoutController = Internal::RelayoutController::Get();
- if( relayoutController )
+ if(relayoutController)
{
- Dali::Actor self( this );
- relayoutController->RequestRelayout( self, dimension );
+ Dali::Actor self(this);
+ relayoutController->RequestRelayout(self, dimension);
}
}
-void Actor::SetPreferredSize( const Vector2& size )
+void Actor::SetPreferredSize(const Vector2& size)
{
EnsureRelayouter().SetPreferredSize(*this, size);
}
Vector2 Actor::GetPreferredSize() const
{
- if ( mRelayoutData )
+ if(mRelayoutData)
{
- return Vector2( mRelayoutData->preferredSize );
+ return Vector2(mRelayoutData->preferredSize);
}
return Relayouter::DEFAULT_PREFERRED_SIZE;
}
-void Actor::SetMinimumSize( float size, Dimension::Type dimension )
+void Actor::SetMinimumSize(float size, Dimension::Type dimension)
{
EnsureRelayouter().SetMinimumSize(size, dimension);
RelayoutRequest();
}
-float Actor::GetMinimumSize( Dimension::Type dimension ) const
+float Actor::GetMinimumSize(Dimension::Type dimension) const
{
- if ( mRelayoutData )
+ if(mRelayoutData)
{
return mRelayoutData->GetMinimumSize(dimension);
}
- return 0.0f; // Default
+ return 0.0f; // Default
}
-void Actor::SetMaximumSize( float size, Dimension::Type dimension )
+void Actor::SetMaximumSize(float size, Dimension::Type dimension)
{
EnsureRelayouter().SetMaximumSize(size, dimension);
RelayoutRequest();
}
-float Actor::GetMaximumSize( Dimension::Type dimension ) const
+float Actor::GetMaximumSize(Dimension::Type dimension) const
{
- if ( mRelayoutData )
+ if(mRelayoutData)
{
return mRelayoutData->GetMaximumSize(dimension);
}
- return FLT_MAX; // Default
+ return FLT_MAX; // Default
}
-void Actor::SetVisibleInternal( bool visible, SendMessage::Type sendMessage )
+void Actor::SetVisibleInternal(bool visible, SendMessage::Type sendMessage)
{
- if( mVisible != visible )
+ if(mVisible != visible)
{
- if( sendMessage == SendMessage::TRUE )
+ if(sendMessage == SendMessage::TRUE)
{
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mVisible, &AnimatableProperty<bool>::Bake, visible );
+ SceneGraph::NodePropertyMessage<bool>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mVisible, &AnimatableProperty<bool>::Bake, visible);
- RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
+ RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
}
mVisible = visible;
// Emit the signal on this actor and all its children
- EmitVisibilityChangedSignalRecursively( this, visible, DevelActor::VisibilityChange::SELF );
+ EmitVisibilityChangedSignalRecursively(visible, DevelActor::VisibilityChange::SELF);
}
}
-void Actor::EmitOrderChangedAndRebuild()
+void Actor::SetSiblingOrderOfChild(Actor& child, uint32_t order)
{
- Dali::Actor handle( this );
- mParent->mChildOrderChangedSignal.Emit( handle );
- if( mIsOnScene && mScene )
- {
- mScene->RequestRebuildDepthTree();
- }
+ mParentImpl.SetSiblingOrderOfChild(child, order);
}
-void Actor::SetSiblingOrder( uint32_t order )
+uint32_t Actor::GetSiblingOrderOfChild(const Actor& child) const
{
- if( mParent && SiblingHandler::SetSiblingOrder(*(mParent->mChildren), *this, order))
- {
- EmitOrderChangedAndRebuild();
- }
+ return mParentImpl.GetSiblingOrderOfChild(child);
}
-uint32_t Actor::GetSiblingOrder() const
+void Actor::RaiseChild(Actor& child)
{
- uint32_t order = 0;
- if( mParent )
- {
- order = SiblingHandler::GetSiblingOrder(*(mParent->mChildren), *this);
- }
- return order;
+ mParentImpl.RaiseChild(child);
}
-void Actor::Raise()
+void Actor::LowerChild(Actor& child)
{
- if( mParent && SiblingHandler::Raise(*(mParent->mChildren), *this) )
- {
- EmitOrderChangedAndRebuild();
- }
- else
- {
- DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
- }
-}
-
-void Actor::Lower()
-{
- if( mParent && SiblingHandler::Lower(*(mParent->mChildren), *this) )
- {
- EmitOrderChangedAndRebuild();
- }
- else
- {
- DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
- }
+ mParentImpl.LowerChild(child);
}
-void Actor::RaiseToTop()
+void Actor::RaiseChildToTop(Actor& child)
{
- if( mParent && SiblingHandler::RaiseToTop(*(mParent->mChildren), *this) )
- {
- EmitOrderChangedAndRebuild();
- }
- else
- {
- DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
- }
+ mParentImpl.RaiseChildToTop(child);
}
-void Actor::LowerToBottom()
+void Actor::LowerChildToBottom(Actor& child)
{
- if( mParent && SiblingHandler::LowerToBottom(*(mParent->mChildren), *this) )
- {
- EmitOrderChangedAndRebuild();
- }
- else
- {
- DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
- }
+ mParentImpl.LowerChildToBottom(child);
}
-void Actor::RaiseAbove( Internal::Actor& target )
+void Actor::RaiseChildAbove(Actor& child, Actor& target)
{
- if( mParent && SiblingHandler::RaiseAbove( *(mParent->mChildren), *this, target ))
- {
- EmitOrderChangedAndRebuild();
- }
- else
- {
- DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
- }
+ mParentImpl.RaiseChildAbove(child, target);
}
-void Actor::LowerBelow( Internal::Actor& target )
+void Actor::LowerChildBelow(Actor& child, Actor& target)
{
- if( mParent && SiblingHandler::LowerBelow(*(mParent->mChildren), *this, target ) )
- {
- EmitOrderChangedAndRebuild();
- }
- else
- {
- DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" );
- }
+ mParentImpl.LowerChildBelow(child, target);
}
-void Actor::SetInheritLayoutDirection( bool inherit )
+void Actor::SetInheritLayoutDirection(bool inherit)
{
- if( mInheritLayoutDirection != inherit )
+ if(mInheritLayoutDirection != inherit)
{
mInheritLayoutDirection = inherit;
- if( inherit && mParent )
+ if(inherit && mParent)
{
- InheritLayoutDirectionRecursively( this, mParent->mLayoutDirection );
+ InheritLayoutDirectionRecursively(GetParent()->mLayoutDirection);
}
}
}
-void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::LayoutDirection::Type direction, bool set )
+void Actor::InheritLayoutDirectionRecursively(Dali::LayoutDirection::Type direction, bool set)
{
- if( actor && ( actor->mInheritLayoutDirection || set ) )
+ if(mInheritLayoutDirection || set)
{
- if( actor->mLayoutDirection != direction )
+ if(mLayoutDirection != direction)
{
- actor->mLayoutDirection = direction;
- actor->EmitLayoutDirectionChangedSignal( direction );
- actor->RelayoutRequest();
+ mLayoutDirection = direction;
+ EmitLayoutDirectionChangedSignal(direction);
+ RelayoutRequest();
}
- if( actor->GetChildCount() > 0 )
+ if(GetChildCount() > 0)
{
- for( const auto& child : actor->GetChildrenInternal() )
+ for(const auto& child : mParentImpl.GetChildrenInternal())
{
- InheritLayoutDirectionRecursively( child, direction );
+ child->InheritLayoutDirectionRecursively(direction);
}
}
}
}
-void Actor::SetUpdateSizeHint( const Vector2& updateSizeHint )
+void Actor::SetUpdateSizeHint(const Vector2& updateSizeHint)
{
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodePropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mUpdateSizeHint, &AnimatableProperty<Vector3>::Bake, Vector3(updateSizeHint.width, updateSizeHint.height, 0.f ) );
+ SceneGraph::NodePropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mUpdateSizeHint, &AnimatableProperty<Vector3>::Bake, Vector3(updateSizeHint.width, updateSizeHint.height, 0.f));
+}
+
+void Actor::EmitVisibilityChangedSignalRecursively(bool visible,
+ DevelActor::VisibilityChange::Type type)
+{
+ EmitVisibilityChangedSignal(visible, type);
+
+ if(GetChildCount() > 0)
+ {
+ for(auto& child : mParentImpl.GetChildrenInternal())
+ {
+ child->EmitVisibilityChangedSignalRecursively(visible, DevelActor::VisibilityChange::PARENT);
+ }
+ }
}
} // namespace Internal
#include <string>
// INTERNAL INCLUDES
-#include <dali/public-api/actors/actor.h>
#include <dali/devel-api/actors/actor-devel.h>
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/events/gesture.h>
-#include <dali/public-api/math/viewport.h>
-#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/size-negotiation/relayout-container.h>
#include <dali/internal/common/internal-constants.h>
#include <dali/internal/common/memory-pool-object-allocator.h>
#include <dali/internal/event/actors/actor-declarations.h>
+#include <dali/internal/event/actors/actor-parent-impl.h>
+#include <dali/internal/event/actors/actor-parent.h>
#include <dali/internal/event/common/object-impl.h>
#include <dali/internal/event/common/stage-def.h>
#include <dali/internal/event/rendering/renderer-impl.h>
-#include <dali/internal/update/nodes/node-declarations.h>
#include <dali/internal/update/manager/update-manager.h>
+#include <dali/internal/update/nodes/node-declarations.h>
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/events/gesture.h>
+#include <dali/public-api/math/viewport.h>
+#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/size-negotiation/relayout-container.h>
namespace Dali
{
-
class KeyEvent;
class TouchData;
class TouchEvent;
namespace Internal
{
-
class Actor;
class ActorGestureData;
class Animation;
using DepthNodeMemoryPool = Dali::Internal::MemoryPoolObjectAllocator<ActorDepthTreeNode>;
/**
- * Actor is the primary object which Dali applications interact with.
+ * Actor is the primary object with which Dali applications interact.
* UI controls can be built by combining multiple actors.
* Multi-Touch events are received through signals emitted by the actor tree.
*
* The scene-graph can be updated in a separate thread, so the connection is done using an asynchronous message.
* When a tree of Actors is detached from the Stage, a message is sent to destroy the associated nodes.
*/
-class Actor : public Object
+class Actor : public Object, public ActorParent
{
public:
-
/**
* @brief Struct to hold an actor and a dimension
*/
* @param[in] newActor The actor to assign
* @param[in] newDimension The dimension to assign
*/
- ActorDimensionPair( Actor* newActor, Dimension::Type newDimension )
- : actor( newActor ),
- dimension( newDimension )
+ ActorDimensionPair(Actor* newActor, Dimension::Type newDimension)
+ : actor(newActor),
+ dimension(newDimension)
{
}
* @param[in] lhs The left hand side argument
* @param[in] rhs The right hand side argument
*/
- bool operator== ( const ActorDimensionPair& rhs )
+ bool operator==(const ActorDimensionPair& rhs)
{
- return ( actor == rhs.actor ) && ( dimension == rhs.dimension );
+ return (actor == rhs.actor) && (dimension == rhs.dimension);
}
- Actor* actor; ///< The actor to hold
- Dimension::Type dimension; ///< The dimension to hold
+ Actor* actor; ///< The actor to hold
+ Dimension::Type dimension; ///< The dimension to hold
};
using ActorDimensionStack = std::vector<ActorDimensionPair>;
public:
-
/**
* Create a new actor.
* @return A smart-pointer to the newly allocated Actor.
* Set the name of the actor.
* @param[in] name The new name.
*/
- void SetName( const std::string& name );
+ void SetName(const std::string& name);
/**
* @copydoc Dali::Actor::GetId
Dali::Layer GetLayer();
/**
- * Adds a child Actor to this Actor.
- * @pre The child actor is not the same as the parent actor.
- * @pre The child actor does not already have a parent.
- * @param [in] child The child.
- * @post The child will be referenced by its parent.
+ * @copydoc Dali::Internal::ActorParent::Add()
*/
- void Add( Actor& child );
+ void Add(Actor& child) override;
/**
- * Removes a child Actor from this Actor.
- * @param [in] child The child.
- * @post The child will be unreferenced.
+ * @copydoc Dali::Internal::ActorParent::Remove()
*/
- void Remove( Actor& child );
+ void Remove(Actor& child) override;
/**
* @copydoc Dali::Actor::Unparent
void Unparent();
/**
- * Retrieve the number of children held by the actor.
- * @return The number of children
+ * @copydoc Dali::Internal::ActorParent::GetChildCount()
*/
- uint32_t GetChildCount() const;
+ uint32_t GetChildCount() const override;
/**
- * @copydoc Dali::Actor::GetChildAt
+ * @copydoc Dali::Internal::ActorParent::GetChildAt
*/
- ActorPtr GetChildAt( uint32_t index ) const;
+ ActorPtr GetChildAt(uint32_t index) const override;
/**
* Retrieve a reference to Actor's children.
* @return A reference to the container of children.
* @note The internal container is lazily initialized so ensure you check the child count before using the value returned by this method.
*/
- ActorContainer& GetChildrenInternal()
- {
- return *mChildren;
- }
+ ActorContainer& GetChildrenInternal();
+
+ /**
+ * @copydoc Dali::Internal::ActorParent::FindChildByName
+ */
+ ActorPtr FindChildByName(const std::string& actorName) override;
/**
- * @copydoc Dali::Actor::FindChildByName
+ * @copydoc Dali::Internal::ActorParent::FindChildById
*/
- ActorPtr FindChildByName( const std::string& actorName );
+ ActorPtr FindChildById(const uint32_t id) override;
/**
- * @copydoc Dali::Actor::FindChildById
+ * @copydoc Dali::Internal::ActorParent::UnparentChildren
*/
- ActorPtr FindChildById( const uint32_t id );
+ void UnparentChildren() override;
/**
* Retrieve the parent of an Actor.
*/
Actor* GetParent() const
{
- return mParent;
+ return static_cast<Actor*>(mParent);
}
/**
*
* @return pair of two values, position of top-left corner on screen and size respectively.
*/
- Rect<> CalculateScreenExtents( ) const;
+ Rect<> CalculateScreenExtents() const;
/**
* Sets the size of an actor.
* @param [in] width The new width.
* @param [in] height The new height.
*/
- void SetSize( float width, float height );
+ void SetSize(float width, float height);
/**
* Sets the size of an actor.
* @param [in] height The size of the actor along the y-axis.
* @param [in] depth The size of the actor along the z-axis.
*/
- void SetSize( float width, float height, float depth );
+ void SetSize(float width, float height, float depth);
/**
* Sets the size of an actor.
* This does not interfere with the actors scale factor.
* @param [in] size The new size.
*/
- void SetSize( const Vector2& size );
+ void SetSize(const Vector2& size);
/**
* Sets the update size for an actor.
*
* @param[in] size The size to set.
*/
- void SetSizeInternal( const Vector2& size );
+ void SetSizeInternal(const Vector2& size);
/**
* Sets the size of an actor.
* This does not interfere with the actors scale factor.
* @param [in] size The new size.
*/
- void SetSize( const Vector3& size );
+ void SetSize(const Vector3& size);
/**
* Sets the update size for an actor.
*
* @param[in] size The size to set.
*/
- void SetSizeInternal( const Vector3& size );
+ void SetSizeInternal(const Vector3& size);
/**
* Set the width component of the Actor's size.
* @param [in] width The new width component.
*/
- void SetWidth( float width );
+ void SetWidth(float width);
/**
* Set the height component of the Actor's size.
* @param [in] height The new height component.
*/
- void SetHeight( float height );
+ void SetHeight(float height);
/**
* Set the depth component of the Actor's size.
* @param [in] depth The new depth component.
*/
- void SetDepth( float depth );
+ void SetDepth(float depth);
/**
* Retrieve the Actor's size from event side.
* An actor position is the distance between this origin, and the actors anchor-point.
* @param [in] origin The new parent-origin.
*/
- void SetParentOrigin( const Vector3& origin );
+ void SetParentOrigin(const Vector3& origin);
/**
* Retrieve the parent-origin of an actor.
* An actor's rotation is centered around its anchor-point.
* @param [in] anchorPoint The new anchor-point.
*/
- void SetAnchorPoint( const Vector3& anchorPoint );
+ void SetAnchorPoint(const Vector3& anchorPoint);
/**
* Retrieve the anchor-point of an actor.
* @param [in] x The new x position
* @param [in] y The new y position
*/
- void SetPosition( float x, float y );
+ void SetPosition(float x, float y);
/**
* Sets the position of the Actor.
* @param [in] y The new y position
* @param [in] z The new z position
*/
- void SetPosition( float x, float y, float z );
+ void SetPosition(float x, float y, float z);
/**
* Sets the position of the Actor.
* The coordinates are relative to the Actor's parent.
* @param [in] position The new position.
*/
- void SetPosition( const Vector3& position );
+ void SetPosition(const Vector3& position);
/**
* Set the position of an actor along the X-axis.
* @param [in] x The new x position
*/
- void SetX( float x );
+ void SetX(float x);
/**
* Set the position of an actor along the Y-axis.
* @param [in] y The new y position.
*/
- void SetY( float y );
+ void SetY(float y);
/**
* Set the position of an actor along the Z-axis.
* @param [in] z The new z position
*/
- void SetZ( float z );
+ void SetZ(float z);
/**
* Translate an actor relative to its existing position.
* @param[in] distance The actor will move by this distance.
*/
- void TranslateBy( const Vector3& distance );
+ void TranslateBy(const Vector3& distance);
/**
* Retrieve the position of the Actor.
/**
* @copydoc Dali::Actor::SetInheritPosition()
*/
- void SetInheritPosition( bool inherit );
+ void SetInheritPosition(bool inherit);
/**
* @copydoc Dali::Actor::IsPositionInherited()
* @param [in] angleRadians The new orientation angle in radians.
* @param [in] axis The new axis of orientation.
*/
- void SetOrientation( const Radian& angleRadians, const Vector3& axis );
+ void SetOrientation(const Radian& angleRadians, const Vector3& axis);
/**
* Sets the orientation of the Actor.
* @param [in] orientation The new orientation.
*/
- void SetOrientation( const Quaternion& orientation );
+ void SetOrientation(const Quaternion& orientation);
/**
* Rotate an actor around its existing rotation axis.
* @param[in] angleRadians The angle to the rotation to combine with the existing rotation.
* @param[in] axis The axis of the rotation to combine with the existing rotation.
*/
- void RotateBy( const Radian& angleRadians, const Vector3& axis );
+ void RotateBy(const Radian& angleRadians, const Vector3& axis);
/**
* Apply a relative rotation to an actor.
* @param[in] relativeRotation The rotation to combine with the actors existing rotation.
*/
- void RotateBy( const Quaternion& relativeRotation );
+ void RotateBy(const Quaternion& relativeRotation);
/**
* Retreive the Actor's orientation.
* Switching this off means that using SetOrientation() sets the actor's world orientation.
* @param[in] inherit - true if the actor should inherit orientation, false otherwise.
*/
- void SetInheritOrientation( bool inherit );
+ void SetInheritOrientation(bool inherit);
/**
* Returns whether the actor inherit's it's parent's orientation.
* Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
* @param[in] factor The vector to multiply the parents size by to get the childs size.
*/
- void SetSizeModeFactor( const Vector3& factor );
+ void SetSizeModeFactor(const Vector3& factor);
/**
* Gets the factor of the parents size used for the child actor.
* Sets a scale factor applied to an actor.
* @param [in] scale The scale factor applied on all axes.
*/
- void SetScale( float scale );
+ void SetScale(float scale);
/**
* Sets a scale factor applied to an actor.
* @param [in] scaleY The scale factor applied along the y-axis.
* @param [in] scaleZ The scale factor applied along the z-axis.
*/
- void SetScale( float scaleX, float scaleY, float scaleZ );
+ void SetScale(float scaleX, float scaleY, float scaleZ);
/**
* Sets a scale factor applied to an actor.
* @param [in] scale A vector representing the scale factor for each axis.
*/
- void SetScale( const Vector3& scale );
+ void SetScale(const Vector3& scale);
/**
* Set the x component of the scale factor.
* @param [in] x The new x value.
*/
- void SetScaleX( float x );
+ void SetScaleX(float x);
/**
* Set the y component of the scale factor.
* @param [in] y The new y value.
*/
- void SetScaleY( float y );
+ void SetScaleY(float y);
/**
* Set the z component of the scale factor.
* @param [in] z The new z value.
*/
- void SetScaleZ( float z );
+ void SetScaleZ(float z);
/**
* Apply a relative scale to an actor.
* @param[in] relativeScale The scale to combine with the actors existing scale.
*/
- void ScaleBy( const Vector3& relativeScale );
+ void ScaleBy(const Vector3& relativeScale);
/**
* Retrieve the scale factor applied to an actor.
/**
* @copydoc Dali::Actor::SetInheritScale()
*/
- void SetInheritScale( bool inherit );
+ void SetInheritScale(bool inherit);
/**
* @copydoc Dali::Actor::IsScaleInherited()
* Sets the visibility flag of an actor.
* @param[in] visible The new visibility flag.
*/
- void SetVisible( bool visible );
+ void SetVisible(bool visible);
/**
* Retrieve the visibility flag of an actor.
* Sets the opacity of an actor.
* @param [in] opacity The new opacity.
*/
- void SetOpacity( float opacity );
+ void SetOpacity(float opacity);
/**
* Retrieve the actor's opacity.
* @note If an actor's sensitivity is set to false, then it's children will not emit a touch or hover event signal either.
* @param[in] sensitive true to enable emission of the touch or hover event signals, false otherwise.
*/
- void SetSensitive( bool sensitive )
+ void SetSensitive(bool sensitive)
{
mSensitive = sensitive;
}
/**
* @copydoc Dali::Actor::SetDrawMode
*/
- void SetDrawMode( DrawMode::Type drawMode );
+ void SetDrawMode(DrawMode::Type drawMode);
/**
* @copydoc Dali::Actor::GetDrawMode
*/
bool IsOverlay() const
{
- return ( DrawMode::OVERLAY_2D == mDrawMode );
+ return (DrawMode::OVERLAY_2D == mDrawMode);
}
/**
* This final color is applied to the drawable elements of an actor.
* @param [in] color The new color.
*/
- void SetColor( const Vector4& color );
+ void SetColor(const Vector4& color);
/**
* Set the red component of the color.
* @param [in] red The new red component.
*/
- void SetColorRed( float red );
+ void SetColorRed(float red);
/**
* Set the green component of the color.
* @param [in] green The new green component.
*/
- void SetColorGreen( float green );
+ void SetColorGreen(float green);
/**
* Set the blue component of the scale factor.
* @param [in] blue The new blue value.
*/
- void SetColorBlue( float blue );
+ void SetColorBlue(float blue);
/**
* Retrieve the actor's color.
* Color mode specifies whether Actor uses its own color or inherits its parent color
* @param [in] colorMode to use.
*/
- void SetColorMode( ColorMode colorMode );
+ void SetColorMode(ColorMode colorMode);
/**
* Returns the actor's color mode.
*/
inline int32_t GetHierarchyDepth() const
{
- if( mIsOnScene )
+ if(mIsOnScene)
{
return mDepth;
}
}
public:
-
// Size negotiation virtual functions
/**
* @param[in,out] container The control should add actors to this container that it is not able
* to allocate a size for.
*/
- virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
+ virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
{
}
* @param[in] policy The policy being set
* @param[in] dimension The dimension the policy is being set for
*/
- virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) {}
+ virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
+ {
+ }
/**
* @brief Virtual method to notify deriving classes that relayout dependencies have been
*
* @param dimension The dimension that is about to be calculated
*/
- virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) {}
+ virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
+ {
+ }
/**
* @brief Virtual method to notify deriving classes that the size for a dimension
* @param[in] size The new size for the given dimension
* @param[in] dimension The dimension that was just negotiated
*/
- virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) {}
+ virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
+ {
+ }
/**
* @brief Determine if this actor is dependent on it's children for relayout
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's children
*/
- virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Determine if this actor is dependent on it's children for relayout.
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's children
*/
- virtual bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ virtual bool RelayoutDependentOnChildrenBase(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Calculate the size for a child
* @param[in] dimension The dimension to calculate the size for. E.g. width or height.
* @return Return the calculated size for the given dimension
*/
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
+ virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension);
/**
* @brief This method is called during size negotiation when a height is required for a given width.
* @param width to use.
* @return the height based on the width.
*/
- virtual float GetHeightForWidth( float width );
+ virtual float GetHeightForWidth(float width);
/**
* @brief This method is called during size negotiation when a width is required for a given height.
* @param height to use.
* @return the width based on the width.
*/
- virtual float GetWidthForHeight( float height );
+ virtual float GetWidthForHeight(float height);
public:
-
// Size negotiation
/**
* @param[in,out] container The container that holds actors that are fed back into the
* RelayoutController algorithm.
*/
- void NegotiateSize( const Vector2& size, RelayoutContainer& container );
+ void NegotiateSize(const Vector2& size, RelayoutContainer& container);
/**
* @brief Set whether size negotiation should use the assigned size of the actor
* @param[in] use Whether the assigned size of the actor should be used
* @param[in] dimension The dimension(s) to set. Can be a bitfield of multiple dimensions
*/
- void SetUseAssignedSize( bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetUseAssignedSize(bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Returns whether size negotiation should use the assigned size of the actor
* @param[in] dimension The dimension to get
* @return Return whether the assigned size of the actor should be used. If more than one dimension is requested, just return the first one found
*/
- bool GetUseAssignedSize( Dimension::Type dimension ) const;
+ bool GetUseAssignedSize(Dimension::Type dimension) const;
/**
* @copydoc Dali::Actor::SetResizePolicy()
*/
- void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @copydoc Dali::Actor::GetResizePolicy()
*/
- ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
+ ResizePolicy::Type GetResizePolicy(Dimension::Type dimension) const;
/**
* @copydoc Dali::Actor::SetSizeScalePolicy()
*/
- void SetSizeScalePolicy( SizeScalePolicy::Type policy );
+ void SetSizeScalePolicy(SizeScalePolicy::Type policy);
/**
* @copydoc Dali::Actor::GetSizeScalePolicy()
/**
* @copydoc Dali::Actor::SetDimensionDependency()
*/
- void SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency );
+ void SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency);
/**
* @copydoc Dali::Actor::GetDimensionDependency()
*/
- Dimension::Type GetDimensionDependency( Dimension::Type dimension ) const;
+ Dimension::Type GetDimensionDependency(Dimension::Type dimension) const;
/**
* @brief Set the size negotiation relayout enabled on this actor
*
* @param[in] relayoutEnabled Boolean to enable or disable relayout
*/
- void SetRelayoutEnabled( bool relayoutEnabled );
+ void SetRelayoutEnabled(bool relayoutEnabled);
/**
* @brief Return if relayout is enabled
* @param dirty Whether to mark actor as dirty or not
* @param dimension The dimension(s) to mark as dirty
*/
- void SetLayoutDirty( bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetLayoutDirty(bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Return if any of an actor's dimensions are marked as dirty
* @param dimension The dimension(s) to check
* @return Return if any of the requested dimensions are dirty
*/
- bool IsLayoutDirty( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+ bool IsLayoutDirty(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
/**
* @brief Returns if relayout is enabled and the actor is not dirty
*
* @return Return if it is possible to relayout the actor
*/
- bool RelayoutPossible( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+ bool RelayoutPossible(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
/**
* @brief Returns if relayout is enabled and the actor is dirty
*
* @return Return if it is required to relayout the actor
*/
- bool RelayoutRequired( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+ bool RelayoutRequired(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
/**
* @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
* @note RelayoutRequest() can be called multiple times; the size negotiation is still
* only performed once, i.e. there is no need to keep track of this in the calling side.
*/
- void RelayoutRequest( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void RelayoutRequest(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Determine if this actor is dependent on it's parent for relayout
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's parent
*/
- bool RelayoutDependentOnParent( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ bool RelayoutDependentOnParent(Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Determine if this actor has another dimension depedent on the specified one
* @param dependentDimension The dimension to check for dependency with
* @return Return if the actor is dependent on this dimension
*/
- bool RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension );
+ bool RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension);
/**
* @brief Calculate the size of a dimension
* @param[in] maximumSize The upper bounds on the size
* @return Return the calculated size for the dimension
*/
- float CalculateSize( Dimension::Type dimension, const Vector2& maximumSize );
+ float CalculateSize(Dimension::Type dimension, const Vector2& maximumSize);
/**
* Negotiate a dimension based on the size of the parent
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromParent( Dimension::Type dimension );
+ float NegotiateFromParent(Dimension::Type dimension);
/**
* Negotiate a dimension based on the size of the parent. Fitting inside.
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromParentFit( Dimension::Type dimension );
+ float NegotiateFromParentFit(Dimension::Type dimension);
/**
* Negotiate a dimension based on the size of the parent. Flooding the whole space.
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromParentFlood( Dimension::Type dimension );
+ float NegotiateFromParentFlood(Dimension::Type dimension);
/**
* @brief Negotiate a dimension based on the size of the children
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromChildren( Dimension::Type dimension );
+ float NegotiateFromChildren(Dimension::Type dimension);
/**
* Set the negotiated dimension value for the given dimension(s)
* @param negotiatedDimension The value to set
* @param dimension The dimension(s) to set the value for
*/
- void SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetNegotiatedDimension(float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* Return the value of negotiated dimension for the given dimension
* @param dimension The dimension to retrieve
* @return Return the value of the negotiated dimension
*/
- float GetNegotiatedDimension( Dimension::Type dimension ) const;
+ float GetNegotiatedDimension(Dimension::Type dimension) const;
/**
* @brief Set the padding for a dimension
* @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
* @param[in] dimension The dimension to set
*/
- void SetPadding( const Vector2& padding, Dimension::Type dimension );
+ void SetPadding(const Vector2& padding, Dimension::Type dimension);
/**
* Return the value of padding for the given dimension
* @param dimension The dimension to retrieve
* @return Return the value of padding for the dimension
*/
- Vector2 GetPadding( Dimension::Type dimension ) const;
+ Vector2 GetPadding(Dimension::Type dimension) const;
/**
* Return the actor size for a given dimension
* @param[in] dimension The dimension to retrieve the size for
* @return Return the size for the given dimension
*/
- float GetSize( Dimension::Type dimension ) const;
+ float GetSize(Dimension::Type dimension) const;
/**
* Return the natural size of the actor for a given dimension
* @param[in] dimension The dimension to retrieve the size for
* @return Return the natural size for the given dimension
*/
- float GetNaturalSize( Dimension::Type dimension ) const;
+ float GetNaturalSize(Dimension::Type dimension) const;
/**
* @brief Return the amount of size allocated for relayout
* @param[in] dimension The dimension to retrieve
* @return Return the size
*/
- float GetRelayoutSize( Dimension::Type dimension ) const;
+ float GetRelayoutSize(Dimension::Type dimension) const;
/**
* @brief If the size has been negotiated return that else return normal size
* @param[in] dimension The dimension to retrieve
* @return Return the size
*/
- float GetLatestSize( Dimension::Type dimension ) const;
+ float GetLatestSize(Dimension::Type dimension) const;
/**
* Apply the negotiated size to the actor
*
* @param[in] container The container to fill with actors that require further relayout
*/
- void SetNegotiatedSize( RelayoutContainer& container );
+ void SetNegotiatedSize(RelayoutContainer& container);
/**
* @brief Flag the actor as having it's layout dimension negotiated.
* @param[in] negotiated The status of the flag to set.
* @param[in] dimension The dimension to set the flag for
*/
- void SetLayoutNegotiated( bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetLayoutNegotiated(bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @brief Test whether the layout dimension for this actor has been negotiated or not.
* @param[in] dimension The dimension to determine the value of the flag for
* @return Return if the layout dimension is negotiated or not.
*/
- bool IsLayoutNegotiated( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+ bool IsLayoutNegotiated(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) const;
/**
* @brief provides the Actor implementation of GetHeightForWidth
* @param width to use.
* @return the height based on the width.
*/
- float GetHeightForWidthBase( float width );
+ float GetHeightForWidthBase(float width);
/**
* @brief provides the Actor implementation of GetWidthForHeight
* @param height to use.
* @return the width based on the height.
*/
- float GetWidthForHeightBase( float height );
+ float GetWidthForHeightBase(float height);
/**
* @brief Calculate the size for a child
* @param[in] dimension The dimension to calculate the size for. E.g. width or height.
* @return Return the calculated size for the given dimension
*/
- float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
+ float CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension);
/**
* @brief Set the preferred size for size negotiation
*
* @param[in] size The preferred size to set
*/
- void SetPreferredSize( const Vector2& size );
+ void SetPreferredSize(const Vector2& size);
/**
* @brief Return the preferred size used for size negotiation
/**
* @copydoc Dali::Actor::SetMinimumSize
*/
- void SetMinimumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetMinimumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @copydoc Dali::Actor::GetMinimumSize
*/
- float GetMinimumSize( Dimension::Type dimension ) const;
+ float GetMinimumSize(Dimension::Type dimension) const;
/**
* @copydoc Dali::Actor::SetMaximumSize
*/
- void SetMaximumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ void SetMaximumSize(float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS);
/**
* @copydoc Dali::Actor::GetMaximumSize
*/
- float GetMaximumSize( Dimension::Type dimension ) const;
+ float GetMaximumSize(Dimension::Type dimension) const;
/**
* @copydoc Dali::Actor::AddRenderer()
*/
- uint32_t AddRenderer( Renderer& renderer );
+ uint32_t AddRenderer(Renderer& renderer);
/**
* @copydoc Dali::Actor::GetRendererCount()
/**
* @copydoc Dali::Actor::GetRendererAt()
*/
- RendererPtr GetRendererAt( uint32_t index );
+ RendererPtr GetRendererAt(uint32_t index);
/**
* @copydoc Dali::Actor::RemoveRenderer()
*/
- void RemoveRenderer( Renderer& renderer );
+ void RemoveRenderer(Renderer& renderer);
/**
* @copydoc Dali::Actor::RemoveRenderer()
*/
- void RemoveRenderer( uint32_t index );
+ void RemoveRenderer(uint32_t index);
/**
* Set BlendEquation at each renderer that added on this Actor.
*/
- void SetBlendEquation( DevelBlendEquation::Type blendEquation );
+ void SetBlendEquation(DevelBlendEquation::Type blendEquation);
/**
* @brief Get Blend Equation that applied to this Actor
DevelBlendEquation::Type GetBlendEquation() const;
public:
-
/**
* Converts screen coordinates into the actor's coordinate system.
* @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5)
* @param[in] screenY The screen Y-coordinate.
* @return True if the conversion succeeded.
*/
- bool ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const;
+ bool ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const;
/**
* Converts screen coordinates into the actor's coordinate system.
* @param[in] screenY The screen Y-coordinate.
* @return True if the conversion succeeded.
*/
- bool ScreenToLocal( const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const;
+ bool ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const;
/**
* Converts from the actor's coordinate system to screen coordinates.
* @param[in] screenY The screen Y-coordinate.
* @return True if the conversion succeeded.
*/
- bool ScreenToLocal( const Matrix& viewMatrix,
- const Matrix& projectionMatrix,
- const Viewport& viewport,
- float& localX,
- float& localY,
- float screenX,
- float screenY ) const;
+ bool ScreenToLocal(const Matrix& viewMatrix,
+ const Matrix& projectionMatrix,
+ const Viewport& viewport,
+ float& localX,
+ float& localY,
+ float screenX,
+ float screenY) const;
/**
* Sets whether the actor should receive a notification when touch or hover motion events leave
*
* @param[in] required Should be set to true if a Leave event is required
*/
- void SetLeaveRequired( bool required )
+ void SetLeaveRequired(bool required)
{
mLeaveRequired = required;
}
/**
* @copydoc Dali::Actor::SetKeyboardFocusable()
*/
- void SetKeyboardFocusable( bool focusable )
+ void SetKeyboardFocusable(bool focusable)
{
mKeyboardFocusable = focusable;
}
return mKeyboardFocusable;
}
-
/**
* Query whether the application or derived actor type requires intercept touch events.
* @return True if intercept touch events are required.
*/
bool IsHittable() const
{
- return IsSensitive() && IsVisible() && ( GetCurrentWorldColor().a > FULLY_TRANSPARENT ) && IsNodeConnected();
+ return IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
}
/**
return mTouchArea;
}
-
// Gestures
/**
* @param[in] type The gesture type.
* @return True if the gesture is required, false otherwise.
*/
- bool IsGestureRequired( GestureType::Value type ) const;
+ bool IsGestureRequired(GestureType::Value type) const;
// Signals
* @param[in] touch The touch data.
* @return True if the event was intercepted.
*/
- bool EmitInterceptTouchEventSignal( const Dali::TouchEvent& touch );
+ bool EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch);
/**
* Used by the EventProcessor to emit touch event signals.
* @param[in] touch The touch data.
* @return True if the event was consumed.
*/
- bool EmitTouchEventSignal( const Dali::TouchEvent& touch );
+ bool EmitTouchEventSignal(const Dali::TouchEvent& touch);
/**
* Used by the EventProcessor to emit hover event signals.
* @param[in] event The hover event.
* @return True if the event was consumed.
*/
- bool EmitHoverEventSignal( const Dali::HoverEvent& event );
+ bool EmitHoverEventSignal(const Dali::HoverEvent& event);
/**
* Used by the EventProcessor to emit wheel event signals.
* @param[in] event The wheel event.
* @return True if the event was consumed.
*/
- bool EmitWheelEventSignal( const Dali::WheelEvent& event );
+ bool EmitWheelEventSignal(const Dali::WheelEvent& event);
/**
* @brief Emits the visibility change signal for this actor and all its children.
* @param[in] visible Whether the actor has become visible or not.
* @param[in] type Whether the actor's visible property has changed or a parent's.
*/
- void EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityChange::Type type );
+ void EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type);
/**
* @brief Emits the layout direction change signal for this actor and all its children.
* @param[in] type Whether the actor's layout direction property has changed or a parent's.
*/
- void EmitLayoutDirectionChangedSignal( LayoutDirection::Type type );
-
- /**
- * @brief Emits the ChildAdded signal for this actor
- * @param[in] child The child actor that has been added
- */
- void EmitChildAddedSignal( Actor& child );
-
- /**
- * @brief Emits the ChildRemoved signal for this actor
- * @param[in] child The child actor that has been removed
- */
- void EmitChildRemovedSignal( Actor& child );
+ void EmitLayoutDirectionChangedSignal(LayoutDirection::Type type);
/**
* @copydoc DevelActor::InterceptTouchedSignal()
/**
* @copydoc DevelActor::ChildAddedSignal
*/
- DevelActor::ChildChangedSignalType& ChildAddedSignal()
- {
- return mChildAddedSignal;
- }
+ DevelActor::ChildChangedSignalType& ChildAddedSignal();
/**
* @copydoc DevelActor::ChildRemovedSignal
*/
- DevelActor::ChildChangedSignalType& ChildRemovedSignal()
- {
- return mChildRemovedSignal;
- }
+ DevelActor::ChildChangedSignalType& ChildRemovedSignal();
/**
* @copydoc DevelActor::ChildOrderChangedSignal
*/
- DevelActor::ChildOrderChangedSignalType& ChildOrderChangedSignal()
- {
- return mChildOrderChangedSignal;
- }
+ DevelActor::ChildOrderChangedSignalType& ChildOrderChangedSignal();
/**
* Connects a callback function with the object's signals.
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object,
- ConnectionTrackerInterface* tracker,
- const std::string& signalName,
- FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object,
+ ConnectionTrackerInterface* tracker,
+ const std::string& signalName,
+ FunctorDelegate* functor);
/**
* Performs actions as requested using the action name.
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if the action was done.
*/
- static bool DoAction( BaseObject* object,
- const std::string& actionName,
- const Property::Map& attributes );
+ static bool DoAction(BaseObject* object,
+ const std::string& actionName,
+ const Property::Map& attributes);
public:
// For Animation
* For use in derived classes.
* This should only be called by Animation, when the actor is resized using Animation::Resize().
*/
- virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize )
+ virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
{
}
protected:
-
enum DerivedType
{
- BASIC, LAYER, ROOT_LAYER
+ BASIC,
+ LAYER,
+ ROOT_LAYER
};
/**
* @param[in] derivedType The derived type of actor (if any).
* @param[in] reference to the node
*/
- Actor( DerivedType derivedType, const SceneGraph::Node& node );
+ Actor(DerivedType derivedType, const SceneGraph::Node& node);
/**
* Second-phase constructor. Must be called immediately after creating a new Actor;
*/
- void Initialize( void );
+ void Initialize(void);
/**
* A reference counted object may only be deleted by calling Unreference()
* Called on a child during Add() when the parent actor is connected to the Scene.
* @param[in] parentDepth The depth of the parent in the hierarchy.
*/
- void ConnectToScene( uint32_t parentDepth );
+ void ConnectToScene(uint32_t parentDepth);
/**
* Helper for ConnectToScene, to recursively connect a tree of actors.
* @param[in] depth The depth in the hierarchy of the actor
* @param[out] connectionList On return, the list of connected actors which require notification.
*/
- void RecursiveConnectToScene( ActorContainer& connectionList, uint32_t depth );
+ void RecursiveConnectToScene(ActorContainer& connectionList, uint32_t depth);
/**
* Connect the Node associated with this Actor to the scene-graph.
* This is atomic i.e. not interrupted by user callbacks.
* @param[out] disconnectionList On return, the list of disconnected actors which require notification.
*/
- void RecursiveDisconnectFromStage( ActorContainer& disconnectionList );
+ void RecursiveDisconnectFromStage(ActorContainer& disconnectionList);
/**
* Disconnect the Node associated with this Actor from the scene-graph.
void RebuildDepthTree();
protected:
-
/**
* Traverse the actor tree, inserting actors into the depth tree in sibling order.
* @param[in] sceneGraphNodeDepths A vector capturing the nodes and their depth index
* @param[in,out] depthIndex The current depth index (traversal index)
*/
- void DepthTraverseActorTree( OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex );
+ void DepthTraverseActorTree(OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex);
public:
-
// Default property extensions from Object
/**
* @copydoc Dali::Internal::Object::SetDefaultProperty()
*/
- void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue ) override;
+ void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override;
/**
* @copydoc Dali::Internal::Object::SetSceneGraphProperty()
*/
- void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value ) override;
+ void SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value) override;
/**
* @copydoc Dali::Internal::Object::GetDefaultProperty()
*/
- Property::Value GetDefaultProperty( Property::Index index ) const override;
+ Property::Value GetDefaultProperty(Property::Index index) const override;
/**
* @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
*/
- Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const override;
+ Property::Value GetDefaultPropertyCurrentValue(Property::Index index) const override;
/**
* @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
*/
- void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType ) override;
+ void OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) override;
/**
* @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
*/
- const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const override;
+ const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty(Property::Index index) const override;
/**
* @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
*/
- const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const override;
+ const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override;
/**
* @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
*/
- int32_t GetPropertyComponentIndex( Property::Index index ) const override;
+ int32_t GetPropertyComponentIndex(Property::Index index) const override;
/**
* @copydoc Dali::Internal::Object::IsAnimationPossible()
*/
const SceneGraph::Node& GetNode() const
{
- return *static_cast<const SceneGraph::Node*>( mUpdateObject );
+ return *static_cast<const SceneGraph::Node*>(mUpdateObject);
}
/**
/**
* @copydoc Dali::DevelActor::RaiseAbove()
*/
- void RaiseAbove( Internal::Actor& target );
+ void RaiseAbove(Internal::Actor& target);
/**
* @copydoc Dali::DevelActor::LowerBelow()
*/
- void LowerBelow( Internal::Actor& target );
+ void LowerBelow(Internal::Actor& target);
public:
-
/**
* Sets the scene which this actor is added to.
* @param[in] scene The scene
*/
- void SetScene( Scene& scene )
+ void SetScene(Scene& scene)
{
mScene = &scene;
}
return *mScene;
}
-private:
+ LayoutDirection::Type GetLayoutDirection() const
+ {
+ return mLayoutDirection;
+ }
+private:
struct SendMessage
{
enum Type
struct Relayouter;
// Remove default constructor and copy constructor
- Actor() = delete;
- Actor( const Actor& ) = delete;
- Actor& operator=( const Actor& rhs ) = delete;
+ Actor() = delete;
+ Actor(const Actor&) = delete;
+ Actor& operator=(const Actor& rhs) = delete;
/**
- * Set the actors parent.
+ * Set the actor's parent.
* @param[in] parent The new parent.
*/
- void SetParent( Actor* parent );
+ void SetParent(ActorParent* parent);
/**
* For use in derived classes, called after Initialize()
* For use in external (CustomActor) derived classes.
* This is called after the atomic ConnectToScene() traversal has been completed.
*/
- virtual void OnSceneConnectionExternal( int depth )
+ virtual void OnSceneConnectionExternal(int depth)
{
}
* For use in derived classes; this is called after Add() has added a child.
* @param[in] child The child that was added.
*/
- virtual void OnChildAdd( Actor& child )
+ virtual void OnChildAdd(Actor& child)
{
}
* For use in derived classes; this is called after Remove() has attempted to remove a child( regardless of whether it succeeded or not ).
* @param[in] child The child that was removed.
*/
- virtual void OnChildRemove( Actor& child )
+ virtual void OnChildRemove(Actor& child)
{
}
* For use in derived classes.
* This is called after SizeSet() has been called.
*/
- virtual void OnSizeSet( const Vector3& targetSize )
+ virtual void OnSizeSet(const Vector3& targetSize)
{
}
* @param[out] value Is set with the cached value of the property if found.
* @return True if value set, false otherwise.
*/
- bool GetCachedPropertyValue( Property::Index index, Property::Value& value ) const;
+ bool GetCachedPropertyValue(Property::Index index, Property::Value& value) const;
/**
* @brief Retrieves the current value of a default property from the scene-graph.
* @param[out] value Is set with the current scene-graph value of the property
* @return True if value set, false otherwise.
*/
- bool GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const;
+ bool GetCurrentPropertyValue(Property::Index index, Property::Value& value) const;
/**
* @brief Ensure the relayouter is allocated
* @param[in] size The size to apply the policy to
* @return Return the adjusted size
*/
- Vector2 ApplySizeSetPolicy( const Vector2& size );
+ Vector2 ApplySizeSetPolicy(const Vector2& size);
/**
* Retrieve the parent object of an Actor.
*/
Object* GetParentObject() const override
{
- return mParent;
+ return static_cast<Actor*>(mParent);
}
/**
- * Set Sibling order
- * @param[in] order The sibling order this Actor should be. It will place
- * the actor at this index in it's parent's child array.
+ * @brief Get the current position of the actor in screen coordinates.
+ *
+ * @return Returns the screen position of actor
*/
- void SetSiblingOrder( uint32_t order);
+ const Vector2 GetCurrentScreenPosition() const;
/**
- * Get Sibling order
- * @return the order of this actor amongst it's siblings
+ * Sets the visibility flag of an actor.
+ * @param[in] visible The new visibility flag.
+ * @param[in] sendMessage Whether to send a message to the update thread or not.
*/
- uint32_t GetSiblingOrder() const;
+ void SetVisibleInternal(bool visible, SendMessage::Type sendMessage);
/**
- * Emit ChildOrderChanged signal, and request that the scene
- * rebuilds the actor depth indices.
+ * @copydoc ActorParent::SetSiblingOrderOfChild
*/
- void EmitOrderChangedAndRebuild();
+ void SetSiblingOrderOfChild(Actor& child, uint32_t order) override;
/**
- * @brief Get the current position of the actor in screen coordinates.
- *
- * @return Returns the screen position of actor
+ * @copydoc ActorParent::GetSiblingOrderOfChild
*/
- const Vector2 GetCurrentScreenPosition() const;
+ uint32_t GetSiblingOrderOfChild(const Actor& child) const override;
/**
- * Sets the visibility flag of an actor.
- * @param[in] visible The new visibility flag.
- * @param[in] sendMessage Whether to send a message to the update thread or not.
+ * @copydoc ActorParent::RaiseChild
+ */
+ void RaiseChild(Actor& child) override;
+
+ /**
+ * @copydoc ActorParent::LowerChild
+ */
+ void LowerChild(Actor& child) override;
+
+ /**
+ * @copydoc ActorParent::RaiseChildToTop
+ */
+ void RaiseChildToTop(Actor& child) override;
+
+ /**
+ * @copydoc ActorParent::LowerChildToBottom
+ */
+ void LowerChildToBottom(Actor& child) override;
+
+ /**
+ * @copydoc ActorParent::RaiseChildAbove
+ */
+ void RaiseChildAbove(Actor& child, Actor& target) override;
+
+ /**
+ * @copydoc ActorParent::LowerChildBelow()
*/
- void SetVisibleInternal( bool visible, SendMessage::Type sendMessage );
+ void LowerChildBelow(Actor& child, Actor& target) override;
/**
* Set whether a child actor inherits it's parent's layout direction. Default is to inherit.
* @param[in] inherit - true if the actor should inherit layout direction, false otherwise.
*/
- void SetInheritLayoutDirection( bool inherit );
+ void SetInheritLayoutDirection(bool inherit);
/**
* Returns whether the actor inherits it's parent's layout direction.
/**
* @brief Propagates layout direction recursively.
- * @param[in] actor The actor for seting layout direction.
* @param[in] direction New layout direction.
*/
- void InheritLayoutDirectionRecursively( ActorPtr actor, Dali::LayoutDirection::Type direction, bool set = false );
+ void InheritLayoutDirectionRecursively(Dali::LayoutDirection::Type direction, bool set = false);
/**
* @brief Sets the update size hint of an actor.
* @param [in] updateSizeHint The update size hint.
*/
- void SetUpdateSizeHint( const Vector2& updateSizeHint );
-
-protected:
-
- Scene* mScene; ///< The scene the actor is added to
-
- Actor* mParent; ///< Each actor (except the root) can have one parent
- ActorContainer* mChildren; ///< Container of referenced actors, lazily initialized
- RendererContainer* mRenderers; ///< Renderer container
-
- Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
- Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
+ void SetUpdateSizeHint(const Vector2& updateSizeHint);
- Relayouter* mRelayoutData; ///< Struct to hold optional collection of relayout variables
+ /**
+ * @brief Recursively emits the visibility-changed-signal on the actor tree.
+ *
+ * @param[in] visible The new visibility of the actor
+ * @param[in] type Whether the actor's visible property has changed or a parent's
+ */
+ void EmitVisibilityChangedSignalRecursively(bool visible,
+ DevelActor::VisibilityChange::Type type);
- ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
+protected:
+ ActorParentImpl mParentImpl; ///< Implementation of ActorParent;
+ ActorParent* mParent; ///< Each actor (except the root) can have one parent
+ Scene* mScene; ///< The scene the actor is added to
+ RendererContainer* mRenderers; ///< Renderer container
+ Vector3* mParentOrigin; ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
+ Vector3* mAnchorPoint; ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
+ Relayouter* mRelayoutData; ///< Struct to hold optional collection of relayout variables
+ ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
// Signals
- Dali::Actor::TouchEventSignalType mInterceptTouchedSignal;
- Dali::Actor::TouchEventSignalType mTouchedSignal;
- Dali::Actor::HoverSignalType mHoveredSignal;
- Dali::Actor::WheelEventSignalType mWheelEventSignal;
- Dali::Actor::OnSceneSignalType mOnSceneSignal;
- Dali::Actor::OffSceneSignalType mOffSceneSignal;
- Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
- DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
- Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal;
- DevelActor::ChildChangedSignalType mChildAddedSignal;
- DevelActor::ChildChangedSignalType mChildRemovedSignal;
- DevelActor::ChildOrderChangedSignalType mChildOrderChangedSignal;
-
- Quaternion mTargetOrientation; ///< Event-side storage for orientation
- Vector4 mTargetColor; ///< Event-side storage for color
- Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
- Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
- Vector3 mTargetScale; ///< Event-side storage for scale
- Vector3 mAnimatedSize; ///< Event-side storage for size animation
- Vector2 mTouchArea; ///< touch area
-
- std::string mName; ///< Name of the actor
- uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
- int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported
- uint16_t mUseAnimatedSize; ///< Whether the size is animated.
-
- const bool mIsRoot : 1; ///< Flag to identify the root actor
- const bool mIsLayer : 1; ///< Flag to identify that this is a layer
- bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene
- bool mSensitive : 1; ///< Whether the actor emits touch event signals
- bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
- bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
- bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
- bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
- bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
- bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
- bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
- bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
- bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
- bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent.
- bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area.
- LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left.
- DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
- ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
- ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use.
- DevelBlendEquation::Type mBlendEquation : 16;///< Cached: Determines which blend equation will be used to render renderers.
- bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
+ Dali::Actor::TouchEventSignalType mInterceptTouchedSignal;
+ Dali::Actor::TouchEventSignalType mTouchedSignal;
+ Dali::Actor::HoverSignalType mHoveredSignal;
+ Dali::Actor::WheelEventSignalType mWheelEventSignal;
+ Dali::Actor::OnSceneSignalType mOnSceneSignal;
+ Dali::Actor::OffSceneSignalType mOffSceneSignal;
+ Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
+ DevelActor::VisibilityChangedSignalType mVisibilityChangedSignal;
+ Dali::Actor::LayoutDirectionChangedSignalType mLayoutDirectionChangedSignal;
+
+ Quaternion mTargetOrientation; ///< Event-side storage for orientation
+ Vector4 mTargetColor; ///< Event-side storage for color
+ Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
+ Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
+ Vector3 mTargetScale; ///< Event-side storage for scale
+ Vector3 mAnimatedSize; ///< Event-side storage for size animation
+ Vector2 mTouchArea; ///< touch area
+
+ std::string mName; ///< Name of the actor
+ uint32_t mSortedDepth; ///< The sorted depth index. A combination of tree traversal and sibling order.
+ int16_t mDepth; ///< The depth in the hierarchy of the actor. Only 32,767 levels of depth are supported
+ uint16_t mUseAnimatedSize; ///< Whether the size is animated.
+
+ const bool mIsRoot : 1; ///< Flag to identify the root actor
+ const bool mIsLayer : 1; ///< Flag to identify that this is a layer
+ bool mIsOnScene : 1; ///< Flag to identify whether the actor is on-scene
+ bool mSensitive : 1; ///< Whether the actor emits touch event signals
+ bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
+ bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
+ bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
+ bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
+ bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
+ bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
+ bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
+ bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
+ bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
+ bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent.
+ bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area.
+ LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left.
+ DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
+ ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
+ ClippingMode::Type mClippingMode : 3; ///< Cached: Determines which clipping mode (if any) to use.
+ DevelBlendEquation::Type mBlendEquation : 16; ///< Cached: Determines which blend equation will be used to render renderers.
+ bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
private:
-
- static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
+ static ActorContainer mNullChildren; ///< Empty container (shared by all actors, returned by GetChildren() const)
struct PropertyHandler;
struct SiblingHandler;
+
+ friend class ActorParentImpl; // Allow impl to call private methods on actor
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Internal::Actor& GetImplementation( Dali::Actor& actor )
+inline Internal::Actor& GetImplementation(Dali::Actor& actor)
{
- DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
+ DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
BaseObject& handle = actor.GetBaseObject();
- return static_cast< Internal::Actor& >( handle );
+ return static_cast<Internal::Actor&>(handle);
}
-inline const Internal::Actor& GetImplementation( const Dali::Actor& actor )
+inline const Internal::Actor& GetImplementation(const Dali::Actor& actor)
{
- DALI_ASSERT_ALWAYS( actor && "Actor handle is empty" );
+ DALI_ASSERT_ALWAYS(actor && "Actor handle is empty");
const BaseObject& handle = actor.GetBaseObject();
- return static_cast< const Internal::Actor& >( handle );
+ return static_cast<const Internal::Actor&>(handle);
}
} // namespace Dali
--- /dev/null
+/*
+ * Copyright (c) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali/internal/event/actors/actor-parent.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/actors/actor-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
+#include <dali/public-api/common/vector-wrapper.h>
+
+// EXTERNAL INCLUDES
+#include <algorithm>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace
+{
+/// Helper for emitting signals with multiple parameters
+template<typename Signal, typename... Param>
+void EmitSignal(Actor& actor, Signal& signal, Param... params)
+{
+ if(!signal.Empty())
+ {
+ Dali::Actor handle(&actor);
+ signal.Emit(handle, params...);
+ }
+}
+
+} //anonymous namespace
+
+ActorParentImpl::ActorParentImpl(Actor& owner)
+: mOwner(owner),
+ mChildAddedSignal(),
+ mChildRemovedSignal(),
+ mChildOrderChangedSignal()
+{
+}
+
+ActorParentImpl::~ActorParentImpl()
+{
+ delete mChildren;
+}
+
+void ActorParentImpl::Add(Actor& child)
+{
+ DALI_ASSERT_ALWAYS(&mOwner != &child && "Cannot add actor to itself");
+ DALI_ASSERT_ALWAYS(!child.IsRoot() && "Cannot add root actor");
+
+ if(!mChildren)
+ {
+ mChildren = new ActorContainer;
+ }
+
+ Actor* oldParent = child.GetParent();
+
+ // child might already be ours
+ if(&mOwner != oldParent)
+ {
+ // if we already have parent, unparent us first
+ if(oldParent)
+ {
+ oldParent->Remove(child); // This causes OnChildRemove callback & ChildRemoved signal
+
+ // Old parent may need to readjust to missing child
+ if(oldParent->RelayoutDependentOnChildren())
+ {
+ oldParent->RelayoutRequest();
+ }
+ }
+
+ // Guard against Add() during previous OnChildRemove callback
+ if(!child.GetParent())
+ {
+ // Do this first, since user callbacks from within SetParent() may need to remove child
+ mChildren->push_back(ActorPtr(&child));
+
+ // SetParent asserts that child can be added
+ child.SetParent(&mOwner);
+
+ // Notification for derived classes
+ mOwner.OnChildAdd(child);
+ EmitChildAddedSignal(child);
+
+ child.InheritLayoutDirectionRecursively(mOwner.GetLayoutDirection());
+
+ // Only put in a relayout request if there is a suitable dependency
+ if(mOwner.RelayoutDependentOnChildren())
+ {
+ mOwner.RelayoutRequest();
+ }
+ }
+ }
+}
+
+void ActorParentImpl::Remove(Actor& child)
+{
+ if((&mOwner == &child) || (!mChildren))
+ {
+ // no children or removing itself
+ return;
+ }
+
+ ActorPtr removed;
+
+ // Find the child in mChildren, and unparent it
+ ActorIter end = mChildren->end();
+ for(ActorIter iter = mChildren->begin(); iter != end; ++iter)
+ {
+ ActorPtr actor = (*iter);
+
+ if(actor.Get() == &child)
+ {
+ // Keep handle for OnChildRemove notification
+ removed = actor;
+
+ // Do this first, since user callbacks from within SetParent() may need to add the child
+ mChildren->erase(iter);
+
+ DALI_ASSERT_DEBUG(actor->GetParent() == &mOwner);
+ actor->SetParent(nullptr);
+
+ break;
+ }
+ }
+
+ if(removed)
+ {
+ // Only put in a relayout request if there is a suitable dependency
+ if(mOwner.RelayoutDependentOnChildren())
+ {
+ mOwner.RelayoutRequest();
+ }
+ }
+
+ // Notification for derived classes
+ mOwner.OnChildRemove(child);
+ EmitChildRemovedSignal(child);
+}
+
+uint32_t ActorParentImpl::GetChildCount() const
+{
+ return (nullptr != mChildren) ? static_cast<uint32_t>(mChildren->size()) : 0; // only 4,294,967,295 children per actor
+}
+
+ActorPtr ActorParentImpl::GetChildAt(uint32_t index) const
+{
+ DALI_ASSERT_ALWAYS(index < GetChildCount());
+
+ return ((mChildren) ? (*mChildren)[index] : ActorPtr());
+}
+
+ActorPtr ActorParentImpl::FindChildByName(const std::string& actorName)
+{
+ ActorPtr child = nullptr;
+ if(actorName == mOwner.GetName())
+ {
+ child = &mOwner;
+ }
+ else if(mChildren)
+ {
+ for(const auto& actor : *mChildren)
+ {
+ child = actor->FindChildByName(actorName);
+
+ if(child)
+ {
+ break;
+ }
+ }
+ }
+ return child;
+}
+
+ActorPtr ActorParentImpl::FindChildById(const uint32_t id)
+{
+ ActorPtr child = nullptr;
+ if(id == mOwner.GetId())
+ {
+ child = &mOwner;
+ }
+ else if(mChildren)
+ {
+ for(const auto& actor : *mChildren)
+ {
+ child = actor->FindChildById(id);
+
+ if(child)
+ {
+ break;
+ }
+ }
+ }
+ return child;
+}
+
+void ActorParentImpl::UnparentChildren()
+{
+ if(mChildren)
+ {
+ for(const auto& child : *mChildren)
+ {
+ child->SetParent(nullptr);
+ }
+ }
+}
+
+void ActorParentImpl::SetSiblingOrderOfChild(
+ Actor& child,
+ uint32_t order)
+{
+ if(mChildren)
+ {
+ uint32_t currentOrder = GetSiblingOrderOfChild(child);
+ if(order != currentOrder)
+ {
+ if(order == 0)
+ {
+ LowerChildToBottom(child);
+ }
+ else if(order < mChildren->size() - 1)
+ {
+ if(order > currentOrder)
+ {
+ RaiseChildAbove(child, *((*mChildren)[order]));
+ }
+ else
+ {
+ LowerChildBelow(child, *((*mChildren)[order]));
+ }
+ }
+ else
+ {
+ RaiseChildToTop(child);
+ }
+ }
+ }
+}
+
+uint32_t ActorParentImpl::GetSiblingOrderOfChild(const Actor& child) const
+{
+ uint32_t order = 0;
+ if(mChildren)
+ {
+ for(std::size_t i = 0; i < mChildren->size(); ++i)
+ {
+ if((*mChildren)[i] == &child)
+ {
+ order = static_cast<uint32_t>(i);
+ break;
+ }
+ }
+ }
+ return order;
+}
+
+void ActorParentImpl::RaiseChild(Actor& child)
+{
+ bool changed = false;
+ if(mChildren && mChildren && mChildren->back() != &child) // If not already at end
+ {
+ for(std::size_t i = 0; i < mChildren->size(); ++i)
+ {
+ if((*mChildren)[i] == &child)
+ {
+ // Swap with next
+ ActorPtr next = (*mChildren)[i + 1];
+ (*mChildren)[i + 1] = &child;
+ (*mChildren)[i] = next;
+ changed = true;
+ break;
+ }
+ }
+ }
+ if(changed)
+ {
+ EmitOrderChangedAndRebuild(child);
+ }
+}
+
+void ActorParentImpl::LowerChild(Actor& child)
+{
+ bool changed = false;
+ if(mChildren && mChildren->front() != &child) // If not already at beginning
+ {
+ for(std::size_t i = 1; i < mChildren->size(); ++i)
+ {
+ if((*mChildren)[i] == &child)
+ {
+ // Swap with previous
+ ActorPtr previous = (*mChildren)[i - 1];
+ (*mChildren)[i - 1] = &child;
+ (*mChildren)[i] = previous;
+ changed = true;
+ break;
+ }
+ }
+ }
+ if(changed)
+ {
+ EmitOrderChangedAndRebuild(child);
+ }
+}
+
+void ActorParentImpl::RaiseChildToTop(Actor& child)
+{
+ bool changed = false;
+ if(mChildren && mChildren->back() != &child) // If not already at end
+ {
+ auto iter = std::find(mChildren->begin(), mChildren->end(), &child);
+ if(iter != mChildren->end())
+ {
+ mChildren->erase(iter);
+ mChildren->push_back(ActorPtr(&child));
+ changed = true;
+ }
+ }
+ if(changed)
+ {
+ EmitOrderChangedAndRebuild(child);
+ }
+}
+
+void ActorParentImpl::LowerChildToBottom(Actor& child)
+{
+ bool changed = false;
+ if(mChildren && mChildren->front() != &child) // If not already at bottom,
+ {
+ ActorPtr childPtr(&child); // ensure actor remains referenced.
+
+ auto iter = std::find(mChildren->begin(), mChildren->end(), &child);
+ if(iter != mChildren->end())
+ {
+ mChildren->erase(iter);
+ mChildren->insert(mChildren->begin(), childPtr);
+ changed = true;
+ }
+ }
+ if(changed)
+ {
+ EmitOrderChangedAndRebuild(child);
+ }
+}
+
+void ActorParentImpl::RaiseChildAbove(Actor& child, Actor& target)
+{
+ bool raised = false;
+ if(mChildren && mChildren->back() != &child && target.GetParent() == child.GetParent()) // If not already at top
+ {
+ ActorPtr childPtr(&child); // ensure actor actor remains referenced.
+
+ auto targetIter = std::find(mChildren->begin(), mChildren->end(), &target);
+ auto childIter = std::find(mChildren->begin(), mChildren->end(), &child);
+ if(childIter < targetIter)
+ {
+ mChildren->erase(childIter);
+ // Erasing early invalidates the targetIter. (Conversely, inserting first may also
+ // invalidate actorIter)
+ targetIter = std::find(mChildren->begin(), mChildren->end(), &target);
+ ++targetIter;
+ mChildren->insert(targetIter, childPtr);
+ }
+ raised = true;
+ }
+ if(raised)
+ {
+ EmitOrderChangedAndRebuild(child);
+ }
+}
+
+void ActorParentImpl::LowerChildBelow(Actor& child, Actor& target)
+{
+ bool lowered = false;
+
+ // If not already at bottom
+ if(mChildren && mChildren->front() != &child && target.GetParent() == child.GetParent())
+ {
+ ActorPtr childPtr(&child); // ensure actor actor remains referenced.
+
+ auto targetIter = std::find(mChildren->begin(), mChildren->end(), &target);
+ auto childIter = std::find(mChildren->begin(), mChildren->end(), &child);
+
+ if(childIter > targetIter)
+ {
+ mChildren->erase(childIter); // actor only invalidates iterators at or after actor point.
+ mChildren->insert(targetIter, childPtr);
+ }
+ lowered = true;
+ }
+ if(lowered)
+ {
+ EmitOrderChangedAndRebuild(child);
+ }
+}
+
+void ActorParentImpl::EmitChildAddedSignal(Actor& child)
+{
+ EmitSignal(child, mChildAddedSignal);
+}
+
+void ActorParentImpl::EmitChildRemovedSignal(Actor& child)
+{
+ EmitSignal(child, mChildRemovedSignal);
+}
+
+void ActorParentImpl::EmitOrderChangedAndRebuild(Actor& child)
+{
+ EmitSignal(child, mChildOrderChangedSignal);
+
+ if(mOwner.OnScene())
+ {
+ mOwner.GetScene().RequestRebuildDepthTree();
+ }
+}
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_INTERNAL_ACTOR_PARENT_IMPL_H
+#define DALI_INTERNAL_ACTOR_PARENT_IMPL_H
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use actor file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/internal/event/actors/actor-declarations.h>
+#include <dali/internal/event/actors/actor-parent.h>
+
+// EXTERNAL INCLUDES
+#include <string>
+
+namespace Dali
+{
+namespace Internal
+{
+class Actor;
+
+class ActorParentImpl : public ActorParent
+{
+public:
+ /**
+ * constructor
+ * @param[in] owner The owning actor
+ */
+ ActorParentImpl(Actor& owner);
+
+ /**
+ * destructor
+ */
+ virtual ~ActorParentImpl();
+
+ /**
+ * Adds a child Actor to this ActorParent.
+ * @pre The child actor is not the same as the parent actor.
+ * @pre The child actor does not already have a parent.
+ * @param [in] child The child.
+ * @post The child will be referenced by its parent.
+ */
+ void Add(Actor& child);
+
+ /**
+ * Removes a child Actor from this ActorParent.
+ * @param [in] child The child.
+ * @post The child will be unreferenced.
+ */
+ void Remove(Actor& child);
+
+ /**
+ * Retrieve the number of children held by the actor.
+ * @return The number of children
+ */
+ uint32_t GetChildCount() const;
+
+ /**
+ * @copydoc Dali::Actor::GetChildAt
+ */
+ ActorPtr GetChildAt(uint32_t index) const;
+
+ /**
+ * @copydoc Dali::Actor::FindChildByName
+ */
+ ActorPtr FindChildByName(const std::string& actorName);
+
+ /**
+ * @copydoc Dali::Actor::FindChildById
+ */
+ ActorPtr FindChildById(const uint32_t id);
+
+ /**
+ * Retrieve a reference to children.
+ * @note Not for public use.
+ * @return A reference to the container of children.
+ * @note The internal container is lazily initialized so ensure you check the child count before using this method.
+ */
+ ActorContainer& GetChildrenInternal()
+ {
+ return *mChildren;
+ }
+
+ /**
+ * @brief Unparent all the children
+ */
+ void UnparentChildren();
+
+ /**
+ * @brief Change the sibling order of the given child.
+ *
+ * @param[in] child The actor to change
+ * @param[in] order The new order for the actor
+ * @return true if order has been modified
+ */
+ void SetSiblingOrderOfChild(Actor& child, uint32_t order) override;
+
+ /**
+ * @brief Get the sibling order of the given actor.
+ *
+ * @param[in] child The actor to query
+ * @return the order in the sibling array of the actor
+ */
+ uint32_t GetSiblingOrderOfChild(const Actor& child) const override;
+
+ /**
+ * @brief Raise the actor within the siblings list by one
+
+ * @param[in] child The actor to move
+ * @return true if order has been modified
+ */
+ void RaiseChild(Actor& child) override;
+
+ /**
+ * @brief Lower the actor within the siblings list by one
+
+ * @param[in] child The actor to move
+ * @return true if order has been modified
+ */
+ void LowerChild(Actor& child) override;
+
+ /**
+ * @brief Raise the actor to the top of the siblings list.
+ *
+ * @param[in] child The actor to move
+ * @return true if order has been modified
+ */
+ void RaiseChildToTop(Actor& child) override;
+
+ /**
+ * @brief Lower the actor to the bottom of the siblings list.
+ *
+ * @param[in] child The actor to move
+ * @return true if order has been modified
+ */
+ void LowerChildToBottom(Actor& child) override;
+
+ /**
+ * @brief Raise the actor above the target actor within the siblings list.
+ *
+ * @param[in] child The actor to move
+ * @param[in] target The target actor
+ * @return true if order has been modified
+ */
+ void RaiseChildAbove(Actor& child, Actor& target) override;
+
+ /**
+ * @brief Lower the actor below the target actor within the siblings list.
+ *
+ * @param[in] child The actor to move
+ * @param[in] target The target actor
+ * @return true if order has been modified
+ */
+ void LowerChildBelow(Actor& child, Actor& target) override;
+
+ /**
+ * @copydoc DevelActor::ChildAddedSignal
+ */
+ DevelActor::ChildChangedSignalType& ChildAddedSignal()
+ {
+ return mChildAddedSignal;
+ }
+
+ /**
+ * @copydoc DevelActor::ChildRemovedSignal
+ */
+ DevelActor::ChildChangedSignalType& ChildRemovedSignal()
+ {
+ return mChildRemovedSignal;
+ }
+
+ /**
+ * @copydoc DevelActor::ChildOrderChangedSignal
+ */
+ DevelActor::ChildOrderChangedSignalType& ChildOrderChangedSignal()
+ {
+ return mChildOrderChangedSignal;
+ }
+
+private:
+ /**
+ * @brief Emits the ChildAdded signal for this actor
+ * @param[in] child The child actor that has been added
+ */
+ void EmitChildAddedSignal(Actor& child);
+
+ /**
+ * @brief Emits the ChildRemoved signal for this actor
+ * @param[in] child The child actor that has been removed
+ */
+ void EmitChildRemovedSignal(Actor& child);
+
+ /**
+ * @brief Emit the child order changed signal, and rebuild the depth tree
+ *
+ * @param[in] child The child actor that changed order
+ */
+ void EmitOrderChangedAndRebuild(Actor& child);
+
+private:
+ Dali::Internal::Actor& mOwner; ///* Owning actor
+ DevelActor::ChildChangedSignalType mChildAddedSignal;
+ DevelActor::ChildChangedSignalType mChildRemovedSignal;
+ DevelActor::ChildOrderChangedSignalType mChildOrderChangedSignal;
+ ActorContainer* mChildren{nullptr}; ///< Container of referenced actors, lazily initialized
+};
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif
--- /dev/null
+#ifndef DALI_INTERNAL_ACTOR_PARENT_H
+#define DALI_INTERNAL_ACTOR_PARENT_H
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use actor file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/internal/event/actors/actor-declarations.h>
+
+// EXTERNAL INCLUDES
+#include <string>
+
+namespace Dali
+{
+namespace Internal
+{
+/**
+ * Interface that enables parenting of actors and managing child sibling order.
+ */
+class ActorParent
+{
+protected:
+ /**
+ * Constructor, not to be directly instantiated
+ */
+ ActorParent() = default;
+
+ /**
+ * Virtual destructor. No deletion through this interface.
+ */
+ virtual ~ActorParent() = default;
+
+public:
+ /**
+ * Adds a child Actor to this Actor.
+ * @pre The child actor is not the same as the parent actor.
+ * @pre The child actor does not already have a parent.
+ * @param [in] child The child.
+ * @post The child will be referenced by its parent.
+ */
+ virtual void Add(Actor& child) = 0;
+
+ /**
+ * Removes a child Actor from this Actor.
+ * @param [in] child The child.
+ * @post The child will be unreferenced.
+ */
+ virtual void Remove(Actor& child) = 0;
+
+ /**
+ * Retrieve the number of children held by the actor.
+ * @return The number of children
+ */
+ virtual uint32_t GetChildCount() const = 0;
+
+ /**
+ * @copydoc Dali::Actor::GetChildAt
+ */
+ virtual ActorPtr GetChildAt(uint32_t index) const = 0;
+
+ /**
+ * @copydoc Dali::Actor::FindChildByName
+ */
+ virtual ActorPtr FindChildByName(const std::string& actorName) = 0;
+
+ /**
+ * @copydoc Dali::Actor::FindChildById
+ */
+ virtual ActorPtr FindChildById(const uint32_t id) = 0;
+
+ /**
+ * @brief Unparent all the children
+ */
+ virtual void UnparentChildren() = 0;
+
+ /**
+ * @brief Change the sibling order of the given child.
+ *
+ * @param[in] child The actor to change
+ * @param[in] order The new order for the actor
+ * @return true if order has been modified
+ */
+ virtual void SetSiblingOrderOfChild(Actor& child, uint32_t order) = 0;
+
+ /**
+ * @brief Get the sibling order of the given actor.
+ *
+ * @param[in] child The actor to query
+ * @return the order in the sibling array of the actor
+ */
+ virtual uint32_t GetSiblingOrderOfChild(const Actor& child) const = 0;
+
+ /**
+ * @brief Raise the actor within the siblings list by one
+
+ * @param[in] child The actor to move
+ * @return true if order has been modified
+ */
+ virtual void RaiseChild(Actor& child) = 0;
+
+ /**
+ * @brief Lower the actor within the siblings list by one
+
+ * @param[in] child The actor to move
+ * @return true if order has been modified
+ */
+ virtual void LowerChild(Actor& child) = 0;
+
+ /**
+ * @brief Raise the actor to the top of the siblings list.
+ *
+ * @param[in] child The actor to move
+ * @return true if order has been modified
+ */
+ virtual void RaiseChildToTop(Actor& child) = 0;
+
+ /**
+ * @brief Lower the actor to the bottom of the siblings list.
+ *
+ * @param[in] child The actor to move
+ * @return true if order has been modified
+ */
+ virtual void LowerChildToBottom(Actor& child) = 0;
+
+ /**
+ * @brief Raise the actor above the target actor within the siblings list.
+ *
+ * @param[in] child The actor to move
+ * @param[in] target The target actor
+ * @return true if order has been modified
+ */
+ virtual void RaiseChildAbove(Actor& child, Actor& target) = 0;
+
+ /**
+ * @brief Lower the actor below the target actor within the siblings list.
+ *
+ * @param[in] child The actor to move
+ * @param[in] target The target actor
+ * @return true if order has been modified
+ */
+ virtual void LowerChildBelow(Actor& child, Actor& target) = 0;
+};
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif
// INTERNAL INCLUDES
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector3.h>
+
#include <dali/devel-api/actors/actor-devel.h>
+
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/common/property-helper.h>
-#include <dali/internal/update/nodes/node-messages.h>
#include <dali/internal/update/nodes/node-declarations.h>
+#include <dali/internal/update/nodes/node-messages.h>
-using Dali::Internal::SceneGraph::Node;
using Dali::Internal::SceneGraph::AnimatableProperty;
+using Dali::Internal::SceneGraph::Node;
using Dali::Internal::SceneGraph::PropertyBase;
namespace Dali
{
-
namespace Internal
{
-
namespace // unnamed namespace
{
-
struct AnchorValue
{
- const char* name;
+ const char* name;
const Vector3& value;
};
-DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE( AnchorValue, ANCHOR_CONSTANT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, TOP_LEFT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, TOP_CENTER )
-DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, TOP_RIGHT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, CENTER_LEFT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, CENTER )
-DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, CENTER_RIGHT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, BOTTOM_LEFT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, BOTTOM_CENTER )
-DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, BOTTOM_RIGHT )
-DALI_ENUM_TO_STRING_TABLE_END( ANCHOR_CONSTANT )
-
-DALI_ENUM_TO_STRING_TABLE_BEGIN( COLOR_MODE )
-DALI_ENUM_TO_STRING( USE_OWN_COLOR )
-DALI_ENUM_TO_STRING( USE_PARENT_COLOR )
-DALI_ENUM_TO_STRING( USE_OWN_MULTIPLY_PARENT_COLOR )
-DALI_ENUM_TO_STRING( USE_OWN_MULTIPLY_PARENT_ALPHA )
-DALI_ENUM_TO_STRING_TABLE_END( COLOR_MODE )
-
-DALI_ENUM_TO_STRING_TABLE_BEGIN( DRAW_MODE )
-DALI_ENUM_TO_STRING_WITH_SCOPE( DrawMode, NORMAL )
-DALI_ENUM_TO_STRING_WITH_SCOPE( DrawMode, OVERLAY_2D )
-DALI_ENUM_TO_STRING_TABLE_END( DRAW_MODE )
-
-DALI_ENUM_TO_STRING_TABLE_BEGIN( RESIZE_POLICY )
-DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, FIXED )
-DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, USE_NATURAL_SIZE )
-DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, FILL_TO_PARENT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, SIZE_RELATIVE_TO_PARENT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, SIZE_FIXED_OFFSET_FROM_PARENT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, FIT_TO_CHILDREN )
-DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, DIMENSION_DEPENDENCY )
-DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, USE_ASSIGNED_SIZE )
-DALI_ENUM_TO_STRING_TABLE_END( RESIZE_POLICY )
-
-DALI_ENUM_TO_STRING_TABLE_BEGIN( SIZE_SCALE_POLICY )
-DALI_ENUM_TO_STRING_WITH_SCOPE( SizeScalePolicy, USE_SIZE_SET )
-DALI_ENUM_TO_STRING_WITH_SCOPE( SizeScalePolicy, FIT_WITH_ASPECT_RATIO )
-DALI_ENUM_TO_STRING_WITH_SCOPE( SizeScalePolicy, FILL_WITH_ASPECT_RATIO )
-DALI_ENUM_TO_STRING_TABLE_END( SIZE_SCALE_POLICY )
-
-DALI_ENUM_TO_STRING_TABLE_BEGIN( CLIPPING_MODE )
-DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, DISABLED )
-DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, CLIP_CHILDREN )
-DALI_ENUM_TO_STRING_TABLE_END( CLIPPING_MODE )
-
-DALI_ENUM_TO_STRING_TABLE_BEGIN( LAYOUT_DIRECTION )
-DALI_ENUM_TO_STRING_WITH_SCOPE( LayoutDirection, LEFT_TO_RIGHT )
-DALI_ENUM_TO_STRING_WITH_SCOPE( LayoutDirection, RIGHT_TO_LEFT )
-DALI_ENUM_TO_STRING_TABLE_END( LAYOUT_DIRECTION )
-
-bool GetAnchorPointConstant( const std::string& value, Vector3& anchor )
+DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE(AnchorValue, ANCHOR_CONSTANT)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, TOP_LEFT)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, TOP_CENTER)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, TOP_RIGHT)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, CENTER_LEFT)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, CENTER)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, CENTER_RIGHT)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, BOTTOM_LEFT)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, BOTTOM_CENTER)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(AnchorPoint, BOTTOM_RIGHT)
+DALI_ENUM_TO_STRING_TABLE_END(ANCHOR_CONSTANT)
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN(COLOR_MODE)
+ DALI_ENUM_TO_STRING(USE_OWN_COLOR)
+ DALI_ENUM_TO_STRING(USE_PARENT_COLOR)
+ DALI_ENUM_TO_STRING(USE_OWN_MULTIPLY_PARENT_COLOR)
+ DALI_ENUM_TO_STRING(USE_OWN_MULTIPLY_PARENT_ALPHA)
+DALI_ENUM_TO_STRING_TABLE_END(COLOR_MODE)
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN(DRAW_MODE)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(DrawMode, NORMAL)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(DrawMode, OVERLAY_2D)
+DALI_ENUM_TO_STRING_TABLE_END(DRAW_MODE)
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN(RESIZE_POLICY)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, FIXED)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, USE_NATURAL_SIZE)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, FILL_TO_PARENT)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, SIZE_RELATIVE_TO_PARENT)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, SIZE_FIXED_OFFSET_FROM_PARENT)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, FIT_TO_CHILDREN)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, DIMENSION_DEPENDENCY)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(ResizePolicy, USE_ASSIGNED_SIZE)
+DALI_ENUM_TO_STRING_TABLE_END(RESIZE_POLICY)
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN(SIZE_SCALE_POLICY)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(SizeScalePolicy, USE_SIZE_SET)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(SizeScalePolicy, FIT_WITH_ASPECT_RATIO)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(SizeScalePolicy, FILL_WITH_ASPECT_RATIO)
+DALI_ENUM_TO_STRING_TABLE_END(SIZE_SCALE_POLICY)
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN(CLIPPING_MODE)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(ClippingMode, DISABLED)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(ClippingMode, CLIP_CHILDREN)
+DALI_ENUM_TO_STRING_TABLE_END(CLIPPING_MODE)
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN(LAYOUT_DIRECTION)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(LayoutDirection, LEFT_TO_RIGHT)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(LayoutDirection, RIGHT_TO_LEFT)
+DALI_ENUM_TO_STRING_TABLE_END(LAYOUT_DIRECTION)
+
+bool GetAnchorPointConstant(const std::string& value, Vector3& anchor)
{
- for( uint32_t i = 0; i < ANCHOR_CONSTANT_TABLE_COUNT; ++i )
+ for(uint32_t i = 0; i < ANCHOR_CONSTANT_TABLE_COUNT; ++i)
{
uint32_t sizeIgnored = 0;
- if( CompareTokens( value.c_str(), ANCHOR_CONSTANT_TABLE[ i ].name, sizeIgnored ) )
+ if(CompareTokens(value.c_str(), ANCHOR_CONSTANT_TABLE[i].name, sizeIgnored))
{
- anchor = ANCHOR_CONSTANT_TABLE[ i ].value;
+ anchor = ANCHOR_CONSTANT_TABLE[i].value;
return true;
}
}
return false;
}
-inline bool GetParentOriginConstant( const std::string& value, Vector3& parentOrigin )
+inline bool GetParentOriginConstant(const std::string& value, Vector3& parentOrigin)
{
// Values are the same so just use the same table as anchor-point
- return GetAnchorPointConstant( value, parentOrigin );
+ return GetAnchorPointConstant(value, parentOrigin);
}
} // unnamed namespace
-void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Property::Index index, const Property::Value& property )
+void Actor::PropertyHandler::SetDefaultProperty(Internal::Actor& actor, Property::Index index, const Property::Value& property)
{
- switch( index )
+ switch(index)
{
case Dali::Actor::Property::PARENT_ORIGIN:
{
Property::Type type = property.GetType();
- if( type == Property::VECTOR3 )
+ if(type == Property::VECTOR3)
{
- actor.SetParentOrigin( property.Get< Vector3 >() );
+ actor.SetParentOrigin(property.Get<Vector3>());
}
- else if ( type == Property::STRING )
+ else if(type == Property::STRING)
{
std::string parentOriginString;
- property.Get( parentOriginString );
+ property.Get(parentOriginString);
Vector3 parentOrigin;
- if( GetParentOriginConstant( parentOriginString, parentOrigin ) )
+ if(GetParentOriginConstant(parentOriginString, parentOrigin))
{
- actor.SetParentOrigin( parentOrigin );
+ actor.SetParentOrigin(parentOrigin);
}
}
break;
case Dali::Actor::Property::PARENT_ORIGIN_X:
{
const Vector3& current = actor.GetCurrentParentOrigin();
- actor.SetParentOrigin( Vector3( property.Get< float >(), current.y, current.z ) );
+ actor.SetParentOrigin(Vector3(property.Get<float>(), current.y, current.z));
break;
}
case Dali::Actor::Property::PARENT_ORIGIN_Y:
{
const Vector3& current = actor.GetCurrentParentOrigin();
- actor.SetParentOrigin( Vector3( current.x, property.Get< float >(), current.z ) );
+ actor.SetParentOrigin(Vector3(current.x, property.Get<float>(), current.z));
break;
}
case Dali::Actor::Property::PARENT_ORIGIN_Z:
{
const Vector3& current = actor.GetCurrentParentOrigin();
- actor.SetParentOrigin( Vector3( current.x, current.y, property.Get< float >() ) );
+ actor.SetParentOrigin(Vector3(current.x, current.y, property.Get<float>()));
break;
}
case Dali::Actor::Property::ANCHOR_POINT:
{
Property::Type type = property.GetType();
- if( type == Property::VECTOR3 )
+ if(type == Property::VECTOR3)
{
- actor.SetAnchorPoint( property.Get< Vector3 >() );
+ actor.SetAnchorPoint(property.Get<Vector3>());
}
- else if ( type == Property::STRING )
+ else if(type == Property::STRING)
{
std::string anchorPointString;
- property.Get( anchorPointString );
+ property.Get(anchorPointString);
Vector3 anchor;
- if( GetAnchorPointConstant( anchorPointString, anchor ) )
+ if(GetAnchorPointConstant(anchorPointString, anchor))
{
- actor.SetAnchorPoint( anchor );
+ actor.SetAnchorPoint(anchor);
}
}
break;
case Dali::Actor::Property::ANCHOR_POINT_X:
{
const Vector3& current = actor.GetCurrentAnchorPoint();
- actor.SetAnchorPoint( Vector3( property.Get< float >(), current.y, current.z ) );
+ actor.SetAnchorPoint(Vector3(property.Get<float>(), current.y, current.z));
break;
}
case Dali::Actor::Property::ANCHOR_POINT_Y:
{
const Vector3& current = actor.GetCurrentAnchorPoint();
- actor.SetAnchorPoint( Vector3( current.x, property.Get< float >(), current.z ) );
+ actor.SetAnchorPoint(Vector3(current.x, property.Get<float>(), current.z));
break;
}
case Dali::Actor::Property::ANCHOR_POINT_Z:
{
const Vector3& current = actor.GetCurrentAnchorPoint();
- actor.SetAnchorPoint( Vector3( current.x, current.y, property.Get< float >() ) );
+ actor.SetAnchorPoint(Vector3(current.x, current.y, property.Get<float>()));
break;
}
case Dali::Actor::Property::SIZE:
{
Property::Type type = property.GetType();
- if( type == Property::VECTOR2 )
+ if(type == Property::VECTOR2)
{
- actor.SetSize( property.Get< Vector2 >() );
+ actor.SetSize(property.Get<Vector2>());
}
- else if ( type == Property::VECTOR3 )
+ else if(type == Property::VECTOR3)
{
- actor.SetSize( property.Get< Vector3 >() );
+ actor.SetSize(property.Get<Vector3>());
}
break;
}
case Dali::Actor::Property::SIZE_WIDTH:
{
- actor.SetWidth( property.Get< float >() );
+ actor.SetWidth(property.Get<float>());
break;
}
case Dali::Actor::Property::SIZE_HEIGHT:
{
- actor.SetHeight( property.Get< float >() );
+ actor.SetHeight(property.Get<float>());
break;
}
case Dali::Actor::Property::SIZE_DEPTH:
{
- actor.SetDepth( property.Get< float >() );
+ actor.SetDepth(property.Get<float>());
break;
}
case Dali::Actor::Property::POSITION:
{
Property::Type type = property.GetType();
- if( type == Property::VECTOR2 )
+ if(type == Property::VECTOR2)
{
- Vector2 position = property.Get< Vector2 >();
- actor.SetPosition( Vector3( position.x, position.y, 0.0f ) );
+ Vector2 position = property.Get<Vector2>();
+ actor.SetPosition(Vector3(position.x, position.y, 0.0f));
}
- else if ( type == Property::VECTOR3 )
+ else if(type == Property::VECTOR3)
{
- actor.SetPosition( property.Get< Vector3 >() );
+ actor.SetPosition(property.Get<Vector3>());
}
break;
}
case Dali::Actor::Property::POSITION_X:
{
- actor.SetX( property.Get< float >() );
+ actor.SetX(property.Get<float>());
break;
}
case Dali::Actor::Property::POSITION_Y:
{
- actor.SetY( property.Get< float >() );
+ actor.SetY(property.Get<float>());
break;
}
case Dali::Actor::Property::POSITION_Z:
{
- actor.SetZ( property.Get< float >() );
+ actor.SetZ(property.Get<float>());
break;
}
case Dali::Actor::Property::ORIENTATION:
{
- actor.SetOrientation( property.Get< Quaternion >() );
+ actor.SetOrientation(property.Get<Quaternion>());
break;
}
case Dali::Actor::Property::SCALE:
{
Property::Type type = property.GetType();
- if( type == Property::FLOAT )
+ if(type == Property::FLOAT)
{
- float scale = property.Get< float >();
- actor.SetScale( scale, scale, scale );
+ float scale = property.Get<float>();
+ actor.SetScale(scale, scale, scale);
}
- else if ( type == Property::VECTOR3 )
+ else if(type == Property::VECTOR3)
{
- actor.SetScale( property.Get< Vector3 >() );
+ actor.SetScale(property.Get<Vector3>());
}
break;
}
case Dali::Actor::Property::SCALE_X:
{
- actor.SetScaleX( property.Get< float >() );
+ actor.SetScaleX(property.Get<float>());
break;
}
case Dali::Actor::Property::SCALE_Y:
{
- actor.SetScaleY( property.Get< float >() );
+ actor.SetScaleY(property.Get<float>());
break;
}
case Dali::Actor::Property::SCALE_Z:
{
- actor.SetScaleZ( property.Get< float >() );
+ actor.SetScaleZ(property.Get<float>());
break;
}
case Dali::Actor::Property::VISIBLE:
{
- actor.SetVisible( property.Get< bool >() );
+ actor.SetVisible(property.Get<bool>());
break;
}
case Dali::Actor::Property::COLOR:
{
Property::Type type = property.GetType();
- if( type == Property::VECTOR3 )
+ if(type == Property::VECTOR3)
{
- Vector3 color = property.Get< Vector3 >();
- actor.SetColor( Vector4( color.r, color.g, color.b, 1.0f ) );
+ Vector3 color = property.Get<Vector3>();
+ actor.SetColor(Vector4(color.r, color.g, color.b, 1.0f));
}
- else if( type == Property::VECTOR4 )
+ else if(type == Property::VECTOR4)
{
- actor.SetColor( property.Get< Vector4 >() );
+ actor.SetColor(property.Get<Vector4>());
}
break;
}
case Dali::Actor::Property::COLOR_RED:
{
- actor.SetColorRed( property.Get< float >() );
+ actor.SetColorRed(property.Get<float>());
break;
}
case Dali::Actor::Property::COLOR_GREEN:
{
- actor.SetColorGreen( property.Get< float >() );
+ actor.SetColorGreen(property.Get<float>());
break;
}
case Dali::Actor::Property::COLOR_BLUE:
{
- actor.SetColorBlue( property.Get< float >() );
+ actor.SetColorBlue(property.Get<float>());
break;
}
case Dali::Actor::Property::OPACITY:
{
float value;
- if( property.Get( value ) )
+ if(property.Get(value))
{
- actor.SetOpacity( value );
+ actor.SetOpacity(value);
}
break;
}
case Dali::Actor::Property::NAME:
{
- actor.SetName( property.Get< std::string >() );
+ actor.SetName(property.Get<std::string>());
break;
}
case Dali::Actor::Property::SENSITIVE:
{
- actor.SetSensitive( property.Get< bool >() );
+ actor.SetSensitive(property.Get<bool>());
break;
}
case Dali::Actor::Property::LEAVE_REQUIRED:
{
- actor.SetLeaveRequired( property.Get< bool >() );
+ actor.SetLeaveRequired(property.Get<bool>());
break;
}
case Dali::Actor::Property::INHERIT_POSITION:
{
- actor.SetInheritPosition( property.Get< bool >() );
+ actor.SetInheritPosition(property.Get<bool>());
break;
}
case Dali::Actor::Property::INHERIT_ORIENTATION:
{
- actor.SetInheritOrientation( property.Get< bool >() );
+ actor.SetInheritOrientation(property.Get<bool>());
break;
}
case Dali::Actor::Property::INHERIT_SCALE:
{
- actor.SetInheritScale( property.Get< bool >() );
+ actor.SetInheritScale(property.Get<bool>());
break;
}
case Dali::Actor::Property::COLOR_MODE:
{
ColorMode mode = actor.mColorMode;
- if ( Scripting::GetEnumerationProperty< ColorMode >( property, COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT, mode ) )
+ if(Scripting::GetEnumerationProperty<ColorMode>(property, COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT, mode))
{
- actor.SetColorMode( mode );
+ actor.SetColorMode(mode);
}
break;
}
case Dali::Actor::Property::DRAW_MODE:
{
DrawMode::Type mode = actor.mDrawMode;
- if( Scripting::GetEnumerationProperty< DrawMode::Type >( property, DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT, mode ) )
+ if(Scripting::GetEnumerationProperty<DrawMode::Type>(property, DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT, mode))
{
- actor.SetDrawMode( mode );
+ actor.SetDrawMode(mode);
}
break;
}
case Dali::Actor::Property::SIZE_MODE_FACTOR:
{
- actor.SetSizeModeFactor( property.Get< Vector3 >() );
+ actor.SetSizeModeFactor(property.Get<Vector3>());
break;
}
case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
{
- ResizePolicy::Type type = actor.GetResizePolicy( Dimension::WIDTH );
- if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
+ ResizePolicy::Type type = actor.GetResizePolicy(Dimension::WIDTH);
+ if(Scripting::GetEnumerationProperty<ResizePolicy::Type>(property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type))
{
- actor.SetResizePolicy( type, Dimension::WIDTH );
+ actor.SetResizePolicy(type, Dimension::WIDTH);
}
break;
}
case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
{
- ResizePolicy::Type type = actor.GetResizePolicy( Dimension::HEIGHT );
- if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
+ ResizePolicy::Type type = actor.GetResizePolicy(Dimension::HEIGHT);
+ if(Scripting::GetEnumerationProperty<ResizePolicy::Type>(property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type))
{
- actor.SetResizePolicy( type, Dimension::HEIGHT );
+ actor.SetResizePolicy(type, Dimension::HEIGHT);
}
break;
}
case Dali::Actor::Property::SIZE_SCALE_POLICY:
{
SizeScalePolicy::Type type = actor.GetSizeScalePolicy();
- if( Scripting::GetEnumerationProperty< SizeScalePolicy::Type >( property, SIZE_SCALE_POLICY_TABLE, SIZE_SCALE_POLICY_TABLE_COUNT, type ) )
+ if(Scripting::GetEnumerationProperty<SizeScalePolicy::Type>(property, SIZE_SCALE_POLICY_TABLE, SIZE_SCALE_POLICY_TABLE_COUNT, type))
{
- actor.SetSizeScalePolicy( type );
+ actor.SetSizeScalePolicy(type);
}
break;
}
case Dali::Actor::Property::WIDTH_FOR_HEIGHT:
{
- if( property.Get< bool >() )
+ if(property.Get<bool>())
{
- actor.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::WIDTH );
+ actor.SetResizePolicy(ResizePolicy::DIMENSION_DEPENDENCY, Dimension::WIDTH);
}
break;
}
case Dali::Actor::Property::HEIGHT_FOR_WIDTH:
{
- if( property.Get< bool >() )
+ if(property.Get<bool>())
{
- actor.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
+ actor.SetResizePolicy(ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT);
}
break;
}
case Dali::Actor::Property::PADDING:
{
- Vector4 padding = property.Get< Vector4 >();
- actor.SetPadding( Vector2( padding.x, padding.y ), Dimension::WIDTH );
- actor.SetPadding( Vector2( padding.z, padding.w ), Dimension::HEIGHT );
+ Vector4 padding = property.Get<Vector4>();
+ actor.SetPadding(Vector2(padding.x, padding.y), Dimension::WIDTH);
+ actor.SetPadding(Vector2(padding.z, padding.w), Dimension::HEIGHT);
break;
}
case Dali::Actor::Property::MINIMUM_SIZE:
{
- Vector2 size = property.Get< Vector2 >();
- actor.SetMinimumSize( size.x, Dimension::WIDTH );
- actor.SetMinimumSize( size.y, Dimension::HEIGHT );
+ Vector2 size = property.Get<Vector2>();
+ actor.SetMinimumSize(size.x, Dimension::WIDTH);
+ actor.SetMinimumSize(size.y, Dimension::HEIGHT);
break;
}
case Dali::Actor::Property::MAXIMUM_SIZE:
{
- Vector2 size = property.Get< Vector2 >();
- actor.SetMaximumSize( size.x, Dimension::WIDTH );
- actor.SetMaximumSize( size.y, Dimension::HEIGHT );
+ Vector2 size = property.Get<Vector2>();
+ actor.SetMaximumSize(size.x, Dimension::WIDTH);
+ actor.SetMaximumSize(size.y, Dimension::HEIGHT);
break;
}
{
int value;
- if( property.Get( value ) )
+ if(property.Get(value))
{
- actor.SetSiblingOrder( value );
+ Actor* parent = actor.GetParent();
+ if(parent)
+ {
+ parent->SetSiblingOrderOfChild(actor, value);
+ }
}
break;
}
case Dali::Actor::Property::CLIPPING_MODE:
{
ClippingMode::Type convertedValue = actor.mClippingMode;
- if( Scripting::GetEnumerationProperty< ClippingMode::Type >( property, CLIPPING_MODE_TABLE, CLIPPING_MODE_TABLE_COUNT, convertedValue ) )
+ if(Scripting::GetEnumerationProperty<ClippingMode::Type>(property, CLIPPING_MODE_TABLE, CLIPPING_MODE_TABLE_COUNT, convertedValue))
{
actor.mClippingMode = convertedValue;
- SetClippingModeMessage( actor.GetEventThreadServices(), actor.GetNode(), actor.mClippingMode );
+ SetClippingModeMessage(actor.GetEventThreadServices(), actor.GetNode(), actor.mClippingMode);
}
break;
}
case Dali::Actor::Property::POSITION_USES_ANCHOR_POINT:
{
bool value = false;
- if( property.Get( value ) && value != actor.mPositionUsesAnchorPoint )
+ if(property.Get(value) && value != actor.mPositionUsesAnchorPoint)
{
actor.mPositionUsesAnchorPoint = value;
- SetPositionUsesAnchorPointMessage( actor.GetEventThreadServices(), actor.GetNode(), actor.mPositionUsesAnchorPoint );
+ SetPositionUsesAnchorPointMessage(actor.GetEventThreadServices(), actor.GetNode(), actor.mPositionUsesAnchorPoint);
}
break;
}
case Dali::Actor::Property::LAYOUT_DIRECTION:
{
Dali::LayoutDirection::Type direction = actor.mLayoutDirection;
- actor.mInheritLayoutDirection = false;
+ actor.mInheritLayoutDirection = false;
- if( Scripting::GetEnumerationProperty< LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) )
+ if(Scripting::GetEnumerationProperty<LayoutDirection::Type>(property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction))
{
- actor.InheritLayoutDirectionRecursively( &actor, direction, true );
+ actor.InheritLayoutDirectionRecursively(direction, true);
}
break;
}
case Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION:
{
bool value = false;
- if( property.Get( value ) )
+ if(property.Get(value))
{
- actor.SetInheritLayoutDirection( value );
+ actor.SetInheritLayoutDirection(value);
}
break;
}
case Dali::Actor::Property::KEYBOARD_FOCUSABLE:
{
bool value = false;
- if( property.Get( value ) )
+ if(property.Get(value))
{
- actor.SetKeyboardFocusable( value );
+ actor.SetKeyboardFocusable(value);
}
break;
}
case Dali::DevelActor::Property::UPDATE_SIZE_HINT:
{
- actor.SetUpdateSizeHint( property.Get< Vector2 >() );
+ actor.SetUpdateSizeHint(property.Get<Vector2>());
break;
}
case Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START:
{
bool boolValue = false;
- if ( property.Get( boolValue ) )
+ if(property.Get(boolValue))
{
actor.mCaptureAllTouchAfterStart = boolValue;
}
case Dali::DevelActor::Property::TOUCH_AREA:
{
Vector2 vec2Value;
- if( property.Get( vec2Value ) )
+ if(property.Get(vec2Value))
{
- actor.SetTouchArea( vec2Value );
+ actor.SetTouchArea(vec2Value);
}
break;
}
case Dali::DevelActor::Property::BLEND_EQUATION:
{
int value;
- if( property.Get( value ) )
+ if(property.Get(value))
{
- actor.SetBlendEquation( static_cast<DevelBlendEquation::Type>( value ) );
+ actor.SetBlendEquation(static_cast<DevelBlendEquation::Type>(value));
}
break;
}
}
void Actor::PropertyHandler::SetSceneGraphProperty(
- Property::Index index,
- const PropertyMetadata& entry,
- const Property::Value& value,
- EventThreadServices& eventThreadServices,
- const SceneGraph::Node& node)
+ Property::Index index,
+ const PropertyMetadata& entry,
+ const Property::Value& value,
+ EventThreadServices& eventThreadServices,
+ const SceneGraph::Node& node)
{
- switch( entry.GetType() )
+ switch(entry.GetType())
{
case Property::BOOLEAN:
{
- const AnimatableProperty< bool >* property = dynamic_cast< const AnimatableProperty< bool >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
+ const AnimatableProperty<bool>* property = dynamic_cast<const AnimatableProperty<bool>*>(entry.GetSceneGraphProperty());
+ DALI_ASSERT_DEBUG(NULL != property);
// property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<bool>::Send( eventThreadServices, &node, property, &AnimatableProperty<bool>::Bake, value.Get<bool>() );
+ SceneGraph::NodePropertyMessage<bool>::Send(eventThreadServices, &node, property, &AnimatableProperty<bool>::Bake, value.Get<bool>());
break;
}
case Property::INTEGER:
{
- const AnimatableProperty< int >* property = dynamic_cast< const AnimatableProperty< int >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
+ const AnimatableProperty<int>* property = dynamic_cast<const AnimatableProperty<int>*>(entry.GetSceneGraphProperty());
+ DALI_ASSERT_DEBUG(NULL != property);
// property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<int>::Send( eventThreadServices, &node, property, &AnimatableProperty<int>::Bake, value.Get<int>() );
+ SceneGraph::NodePropertyMessage<int>::Send(eventThreadServices, &node, property, &AnimatableProperty<int>::Bake, value.Get<int>());
break;
}
case Property::FLOAT:
{
- const AnimatableProperty< float >* property = dynamic_cast< const AnimatableProperty< float >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
+ const AnimatableProperty<float>* property = dynamic_cast<const AnimatableProperty<float>*>(entry.GetSceneGraphProperty());
+ DALI_ASSERT_DEBUG(NULL != property);
// property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<float>::Send( eventThreadServices, &node, property, &AnimatableProperty<float>::Bake, value.Get<float>() );
+ SceneGraph::NodePropertyMessage<float>::Send(eventThreadServices, &node, property, &AnimatableProperty<float>::Bake, value.Get<float>());
break;
}
case Property::VECTOR2:
{
- const AnimatableProperty< Vector2 >* property = dynamic_cast< const AnimatableProperty< Vector2 >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
+ const AnimatableProperty<Vector2>* property = dynamic_cast<const AnimatableProperty<Vector2>*>(entry.GetSceneGraphProperty());
+ DALI_ASSERT_DEBUG(NULL != property);
// property is being used in a separate thread; queue a message to set the property
if(entry.componentIndex == 0)
{
- SceneGraph::NodePropertyComponentMessage<Vector2>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector2>::BakeX, value.Get<float>() );
+ SceneGraph::NodePropertyComponentMessage<Vector2>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector2>::BakeX, value.Get<float>());
}
else if(entry.componentIndex == 1)
{
- SceneGraph::NodePropertyComponentMessage<Vector2>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector2>::BakeY, value.Get<float>() );
+ SceneGraph::NodePropertyComponentMessage<Vector2>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector2>::BakeY, value.Get<float>());
}
else
{
- SceneGraph::NodePropertyMessage<Vector2>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
+ SceneGraph::NodePropertyMessage<Vector2>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector2>::Bake, value.Get<Vector2>());
}
break;
case Property::VECTOR3:
{
- const AnimatableProperty< Vector3 >* property = dynamic_cast< const AnimatableProperty< Vector3 >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
+ const AnimatableProperty<Vector3>* property = dynamic_cast<const AnimatableProperty<Vector3>*>(entry.GetSceneGraphProperty());
+ DALI_ASSERT_DEBUG(NULL != property);
// property is being used in a separate thread; queue a message to set the property
if(entry.componentIndex == 0)
{
- SceneGraph::NodePropertyComponentMessage<Vector3>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector3>::BakeX, value.Get<float>() );
+ SceneGraph::NodePropertyComponentMessage<Vector3>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector3>::BakeX, value.Get<float>());
}
else if(entry.componentIndex == 1)
{
- SceneGraph::NodePropertyComponentMessage<Vector3>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector3>::BakeY, value.Get<float>() );
+ SceneGraph::NodePropertyComponentMessage<Vector3>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector3>::BakeY, value.Get<float>());
}
else if(entry.componentIndex == 2)
{
- SceneGraph::NodePropertyComponentMessage<Vector3>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector3>::BakeZ, value.Get<float>() );
+ SceneGraph::NodePropertyComponentMessage<Vector3>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector3>::BakeZ, value.Get<float>());
}
else
{
- SceneGraph::NodePropertyMessage<Vector3>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
+ SceneGraph::NodePropertyMessage<Vector3>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector3>::Bake, value.Get<Vector3>());
}
break;
case Property::VECTOR4:
{
- const AnimatableProperty< Vector4 >* property = dynamic_cast< const AnimatableProperty< Vector4 >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
+ const AnimatableProperty<Vector4>* property = dynamic_cast<const AnimatableProperty<Vector4>*>(entry.GetSceneGraphProperty());
+ DALI_ASSERT_DEBUG(NULL != property);
// property is being used in a separate thread; queue a message to set the property
if(entry.componentIndex == 0)
{
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeX, value.Get<float>() );
+ SceneGraph::NodePropertyComponentMessage<Vector4>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeX, value.Get<float>());
}
else if(entry.componentIndex == 1)
{
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeY, value.Get<float>() );
+ SceneGraph::NodePropertyComponentMessage<Vector4>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeY, value.Get<float>());
}
else if(entry.componentIndex == 2)
{
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeZ, value.Get<float>() );
+ SceneGraph::NodePropertyComponentMessage<Vector4>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeZ, value.Get<float>());
}
else if(entry.componentIndex == 3)
{
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeW, value.Get<float>() );
+ SceneGraph::NodePropertyComponentMessage<Vector4>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeW, value.Get<float>());
}
else
{
- SceneGraph::NodePropertyMessage<Vector4>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
+ SceneGraph::NodePropertyMessage<Vector4>::Send(eventThreadServices, &node, property, &AnimatableProperty<Vector4>::Bake, value.Get<Vector4>());
}
break;
case Property::ROTATION:
{
- const AnimatableProperty< Quaternion >* property = dynamic_cast< const AnimatableProperty< Quaternion >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
+ const AnimatableProperty<Quaternion>* property = dynamic_cast<const AnimatableProperty<Quaternion>*>(entry.GetSceneGraphProperty());
+ DALI_ASSERT_DEBUG(NULL != property);
// property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<Quaternion>::Send( eventThreadServices, &node, property,&AnimatableProperty<Quaternion>::Bake, value.Get<Quaternion>() );
+ SceneGraph::NodePropertyMessage<Quaternion>::Send(eventThreadServices, &node, property, &AnimatableProperty<Quaternion>::Bake, value.Get<Quaternion>());
break;
}
case Property::MATRIX:
{
- const AnimatableProperty< Matrix >* property = dynamic_cast< const AnimatableProperty< Matrix >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
+ const AnimatableProperty<Matrix>* property = dynamic_cast<const AnimatableProperty<Matrix>*>(entry.GetSceneGraphProperty());
+ DALI_ASSERT_DEBUG(NULL != property);
// property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<Matrix>::Send( eventThreadServices, &node, property,&AnimatableProperty<Matrix>::Bake, value.Get<Matrix>() );
+ SceneGraph::NodePropertyMessage<Matrix>::Send(eventThreadServices, &node, property, &AnimatableProperty<Matrix>::Bake, value.Get<Matrix>());
break;
}
case Property::MATRIX3:
{
- const AnimatableProperty< Matrix3 >* property = dynamic_cast< const AnimatableProperty< Matrix3 >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
+ const AnimatableProperty<Matrix3>* property = dynamic_cast<const AnimatableProperty<Matrix3>*>(entry.GetSceneGraphProperty());
+ DALI_ASSERT_DEBUG(NULL != property);
// property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<Matrix3>::Send( eventThreadServices, &node, property,&AnimatableProperty<Matrix3>::Bake, value.Get<Matrix3>() );
+ SceneGraph::NodePropertyMessage<Matrix3>::Send(eventThreadServices, &node, property, &AnimatableProperty<Matrix3>::Bake, value.Get<Matrix3>());
break;
}
void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& actor, Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType)
{
- switch( animationType )
+ switch(animationType)
{
case Animation::TO:
case Animation::BETWEEN:
{
- switch( index )
+ switch(index)
{
case Dali::Actor::Property::SIZE:
{
- if( value.Get( actor.mTargetSize ) )
+ if(value.Get(actor.mTargetSize))
{
- actor.mAnimatedSize = actor.mTargetSize;
+ actor.mAnimatedSize = actor.mTargetSize;
actor.mUseAnimatedSize = AnimatedSizeFlag::WIDTH | AnimatedSizeFlag::HEIGHT | AnimatedSizeFlag::DEPTH;
// Notify deriving classes
- actor.OnSizeAnimation( animation, actor.mTargetSize );
+ actor.OnSizeAnimation(animation, actor.mTargetSize);
}
break;
}
case Dali::Actor::Property::SIZE_WIDTH:
{
- if( value.Get( actor.mTargetSize.width ) )
+ if(value.Get(actor.mTargetSize.width))
{
actor.mAnimatedSize.width = actor.mTargetSize.width;
actor.mUseAnimatedSize |= AnimatedSizeFlag::WIDTH;
// Notify deriving classes
- actor.OnSizeAnimation( animation, actor.mTargetSize );
+ actor.OnSizeAnimation(animation, actor.mTargetSize);
}
break;
}
case Dali::Actor::Property::SIZE_HEIGHT:
{
- if( value.Get( actor.mTargetSize.height ) )
+ if(value.Get(actor.mTargetSize.height))
{
actor.mAnimatedSize.height = actor.mTargetSize.height;
actor.mUseAnimatedSize |= AnimatedSizeFlag::HEIGHT;
// Notify deriving classes
- actor.OnSizeAnimation( animation, actor.mTargetSize );
+ actor.OnSizeAnimation(animation, actor.mTargetSize);
}
break;
}
case Dali::Actor::Property::SIZE_DEPTH:
{
- if( value.Get( actor.mTargetSize.depth ) )
+ if(value.Get(actor.mTargetSize.depth))
{
actor.mAnimatedSize.depth = actor.mTargetSize.depth;
actor.mUseAnimatedSize |= AnimatedSizeFlag::DEPTH;
// Notify deriving classes
- actor.OnSizeAnimation( animation, actor.mTargetSize );
+ actor.OnSizeAnimation(animation, actor.mTargetSize);
}
break;
}
case Dali::Actor::Property::POSITION:
{
- value.Get( actor.mTargetPosition );
+ value.Get(actor.mTargetPosition);
break;
}
case Dali::Actor::Property::POSITION_X:
{
- value.Get( actor.mTargetPosition.x );
+ value.Get(actor.mTargetPosition.x);
break;
}
case Dali::Actor::Property::POSITION_Y:
{
- value.Get( actor.mTargetPosition.y );
+ value.Get(actor.mTargetPosition.y);
break;
}
case Dali::Actor::Property::POSITION_Z:
{
- value.Get( actor.mTargetPosition.z );
+ value.Get(actor.mTargetPosition.z);
break;
}
case Dali::Actor::Property::ORIENTATION:
{
- value.Get( actor.mTargetOrientation );
+ value.Get(actor.mTargetOrientation);
break;
}
case Dali::Actor::Property::SCALE:
{
- value.Get( actor.mTargetScale );
+ value.Get(actor.mTargetScale);
break;
}
case Dali::Actor::Property::SCALE_X:
{
- value.Get( actor.mTargetScale.x );
+ value.Get(actor.mTargetScale.x);
break;
}
case Dali::Actor::Property::SCALE_Y:
{
- value.Get( actor.mTargetScale.y );
+ value.Get(actor.mTargetScale.y);
break;
}
case Dali::Actor::Property::SCALE_Z:
{
- value.Get( actor.mTargetScale.z );
+ value.Get(actor.mTargetScale.z);
break;
}
case Dali::Actor::Property::VISIBLE:
{
- actor.SetVisibleInternal( value.Get< bool >(), SendMessage::FALSE );
+ actor.SetVisibleInternal(value.Get<bool>(), SendMessage::FALSE);
break;
}
case Dali::Actor::Property::COLOR:
{
- value.Get( actor.mTargetColor );
+ value.Get(actor.mTargetColor);
break;
}
case Dali::Actor::Property::COLOR_RED:
{
- value.Get( actor.mTargetColor.r );
+ value.Get(actor.mTargetColor.r);
break;
}
case Dali::Actor::Property::COLOR_GREEN:
{
- value.Get( actor.mTargetColor.g );
+ value.Get(actor.mTargetColor.g);
break;
}
case Dali::Actor::Property::COLOR_BLUE:
{
- value.Get( actor.mTargetColor.b );
+ value.Get(actor.mTargetColor.b);
break;
}
case Dali::Actor::Property::COLOR_ALPHA:
case Dali::Actor::Property::OPACITY:
{
- value.Get( actor.mTargetColor.a );
+ value.Get(actor.mTargetColor.a);
break;
}
case Animation::BY:
{
- switch( index )
+ switch(index)
{
case Dali::Actor::Property::SIZE:
{
- if( AdjustValue< Vector3 >( actor.mTargetSize, value ) )
+ if(AdjustValue<Vector3>(actor.mTargetSize, value))
{
- actor.mAnimatedSize = actor.mTargetSize;
+ actor.mAnimatedSize = actor.mTargetSize;
actor.mUseAnimatedSize = AnimatedSizeFlag::WIDTH | AnimatedSizeFlag::HEIGHT | AnimatedSizeFlag::DEPTH;
// Notify deriving classes
- actor.OnSizeAnimation( animation, actor.mTargetSize );
+ actor.OnSizeAnimation(animation, actor.mTargetSize);
}
break;
}
case Dali::Actor::Property::SIZE_WIDTH:
{
- if( AdjustValue< float >( actor.mTargetSize.width, value ) )
+ if(AdjustValue<float>(actor.mTargetSize.width, value))
{
actor.mAnimatedSize.width = actor.mTargetSize.width;
actor.mUseAnimatedSize |= AnimatedSizeFlag::WIDTH;
// Notify deriving classes
- actor.OnSizeAnimation( animation, actor.mTargetSize );
+ actor.OnSizeAnimation(animation, actor.mTargetSize);
}
break;
}
case Dali::Actor::Property::SIZE_HEIGHT:
{
- if( AdjustValue< float >( actor.mTargetSize.height, value ) )
+ if(AdjustValue<float>(actor.mTargetSize.height, value))
{
actor.mAnimatedSize.height = actor.mTargetSize.height;
actor.mUseAnimatedSize |= AnimatedSizeFlag::HEIGHT;
// Notify deriving classes
- actor.OnSizeAnimation( animation, actor.mTargetSize );
+ actor.OnSizeAnimation(animation, actor.mTargetSize);
}
break;
}
case Dali::Actor::Property::SIZE_DEPTH:
{
- if( AdjustValue< float >( actor.mTargetSize.depth, value ) )
+ if(AdjustValue<float>(actor.mTargetSize.depth, value))
{
actor.mAnimatedSize.depth = actor.mTargetSize.depth;
actor.mUseAnimatedSize |= AnimatedSizeFlag::DEPTH;
// Notify deriving classes
- actor.OnSizeAnimation( animation, actor.mTargetSize );
+ actor.OnSizeAnimation(animation, actor.mTargetSize);
}
break;
}
case Dali::Actor::Property::POSITION:
{
- AdjustValue< Vector3 >( actor.mTargetPosition, value );
+ AdjustValue<Vector3>(actor.mTargetPosition, value);
break;
}
case Dali::Actor::Property::POSITION_X:
{
- AdjustValue< float >( actor.mTargetPosition.x, value );
+ AdjustValue<float>(actor.mTargetPosition.x, value);
break;
}
case Dali::Actor::Property::POSITION_Y:
{
- AdjustValue< float >( actor.mTargetPosition.y, value );
+ AdjustValue<float>(actor.mTargetPosition.y, value);
break;
}
case Dali::Actor::Property::POSITION_Z:
{
- AdjustValue< float >( actor.mTargetPosition.z, value );
+ AdjustValue<float>(actor.mTargetPosition.z, value);
break;
}
case Dali::Actor::Property::ORIENTATION:
{
Quaternion relativeValue;
- if( value.Get( relativeValue ) )
+ if(value.Get(relativeValue))
{
actor.mTargetOrientation *= relativeValue;
}
case Dali::Actor::Property::SCALE:
{
- AdjustValue< Vector3 >( actor.mTargetScale, value );
+ AdjustValue<Vector3>(actor.mTargetScale, value);
break;
}
case Dali::Actor::Property::SCALE_X:
{
- AdjustValue< float >( actor.mTargetScale.x, value );
+ AdjustValue<float>(actor.mTargetScale.x, value);
break;
}
case Dali::Actor::Property::SCALE_Y:
{
- AdjustValue< float >( actor.mTargetScale.y, value );
+ AdjustValue<float>(actor.mTargetScale.y, value);
break;
}
case Dali::Actor::Property::SCALE_Z:
{
- AdjustValue< float >( actor.mTargetScale.z, value );
+ AdjustValue<float>(actor.mTargetScale.z, value);
break;
}
case Dali::Actor::Property::VISIBLE:
{
bool relativeValue = false;
- if( value.Get( relativeValue ) )
+ if(value.Get(relativeValue))
{
bool visible = actor.mVisible || relativeValue;
- actor.SetVisibleInternal( visible, SendMessage::FALSE );
+ actor.SetVisibleInternal(visible, SendMessage::FALSE);
}
break;
}
case Dali::Actor::Property::COLOR:
{
- AdjustValue< Vector4 >( actor.mTargetColor, value );
+ AdjustValue<Vector4>(actor.mTargetColor, value);
break;
}
case Dali::Actor::Property::COLOR_RED:
{
- AdjustValue< float >( actor.mTargetColor.r, value );
+ AdjustValue<float>(actor.mTargetColor.r, value);
break;
}
case Dali::Actor::Property::COLOR_GREEN:
{
- AdjustValue< float >( actor.mTargetColor.g, value );
+ AdjustValue<float>(actor.mTargetColor.g, value);
break;
}
case Dali::Actor::Property::COLOR_BLUE:
{
- AdjustValue< float >( actor.mTargetColor.b, value );
+ AdjustValue<float>(actor.mTargetColor.b, value);
break;
}
case Dali::Actor::Property::COLOR_ALPHA:
case Dali::Actor::Property::OPACITY:
{
- AdjustValue< float >( actor.mTargetColor.a, value );
+ AdjustValue<float>(actor.mTargetColor.a, value);
break;
}
const PropertyBase* Actor::PropertyHandler::GetSceneObjectAnimatableProperty(Property::Index index, const SceneGraph::Node& node)
{
- const PropertyBase* property( nullptr );
+ const PropertyBase* property(nullptr);
- switch( index )
+ switch(index)
{
case Dali::Actor::Property::SIZE: // FALLTHROUGH
case Dali::Actor::Property::SIZE_WIDTH: // FALLTHROUGH
const PropertyInputImpl* Actor::PropertyHandler::GetSceneObjectInputProperty(Property::Index index, const SceneGraph::Node& node)
{
- const PropertyInputImpl* property( nullptr );
+ const PropertyInputImpl* property(nullptr);
- switch( index )
+ switch(index)
{
case Dali::Actor::Property::PARENT_ORIGIN: // FALLTHROUGH
case Dali::Actor::Property::PARENT_ORIGIN_X: // FALLTHROUGH
{
int32_t componentIndex = Property::INVALID_COMPONENT_INDEX;
- switch( index )
+ switch(index)
{
case Dali::Actor::Property::PARENT_ORIGIN_X:
case Dali::Actor::Property::ANCHOR_POINT_X:
{
bool valueSet = true;
- switch( index )
+ switch(index)
{
case Dali::Actor::Property::PARENT_ORIGIN:
{
case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
{
- value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( actor.GetResizePolicy( Dimension::WIDTH ), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT );
+ value = Scripting::GetLinearEnumerationName<ResizePolicy::Type>(actor.GetResizePolicy(Dimension::WIDTH), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT);
break;
}
case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
{
- value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( actor.GetResizePolicy( Dimension::HEIGHT ), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT );
+ value = Scripting::GetLinearEnumerationName<ResizePolicy::Type>(actor.GetResizePolicy(Dimension::HEIGHT), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT);
break;
}
case Dali::Actor::Property::WIDTH_FOR_HEIGHT:
{
- value = ( actor.GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( actor.GetDimensionDependency( Dimension::WIDTH ) == Dimension::HEIGHT );
+ value = (actor.GetResizePolicy(Dimension::WIDTH) == ResizePolicy::DIMENSION_DEPENDENCY) && (actor.GetDimensionDependency(Dimension::WIDTH) == Dimension::HEIGHT);
break;
}
case Dali::Actor::Property::HEIGHT_FOR_WIDTH:
{
- value = ( actor.GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( actor.GetDimensionDependency( Dimension::HEIGHT ) == Dimension::WIDTH );
+ value = (actor.GetResizePolicy(Dimension::HEIGHT) == ResizePolicy::DIMENSION_DEPENDENCY) && (actor.GetDimensionDependency(Dimension::HEIGHT) == Dimension::WIDTH);
break;
}
case Dali::Actor::Property::PADDING:
{
- Vector2 widthPadding = actor.GetPadding( Dimension::WIDTH );
- Vector2 heightPadding = actor.GetPadding( Dimension::HEIGHT );
- value = Vector4( widthPadding.x, widthPadding.y, heightPadding.x, heightPadding.y );
+ Vector2 widthPadding = actor.GetPadding(Dimension::WIDTH);
+ Vector2 heightPadding = actor.GetPadding(Dimension::HEIGHT);
+ value = Vector4(widthPadding.x, widthPadding.y, heightPadding.x, heightPadding.y);
break;
}
case Dali::Actor::Property::MINIMUM_SIZE:
{
- value = Vector2( actor.GetMinimumSize( Dimension::WIDTH ), actor.GetMinimumSize( Dimension::HEIGHT ) );
+ value = Vector2(actor.GetMinimumSize(Dimension::WIDTH), actor.GetMinimumSize(Dimension::HEIGHT));
break;
}
case Dali::Actor::Property::MAXIMUM_SIZE:
{
- value = Vector2( actor.GetMaximumSize( Dimension::WIDTH ), actor.GetMaximumSize( Dimension::HEIGHT ) );
+ value = Vector2(actor.GetMaximumSize(Dimension::WIDTH), actor.GetMaximumSize(Dimension::HEIGHT));
break;
}
case Dali::DevelActor::Property::SIBLING_ORDER:
{
- value = static_cast<int>( actor.GetSiblingOrder() );
+ Actor* parent = actor.GetParent();
+ if(parent)
+ {
+ value = static_cast<int>(parent->GetSiblingOrderOfChild(actor));
+ }
+ else
+ {
+ value = 0;
+ }
break;
}
case Dali::Actor::Property::ID:
{
- value = static_cast<int>( actor.GetId() );
+ value = static_cast<int>(actor.GetId());
break;
}
{
bool valueSet = true;
- switch( index )
+ switch(index)
{
case Dali::Actor::Property::SIZE:
{
case Dali::Actor::Property::CULLED:
{
- value = actor.GetNode().IsCulled( actor.GetEventThreadServices().GetEventBufferIndex() );
+ value = actor.GetNode().IsCulled(actor.GetEventThreadServices().GetEventBufferIndex());
break;
}
case Dali::DevelActor::Property::UPDATE_SIZE_HINT:
{
// node is being used in a separate thread, the value from the previous update is the same, set by user
- value = Vector2( actor.GetNode().GetUpdateSizeHint() );
+ value = Vector2(actor.GetNode().GetUpdateSizeHint());
break;
}
+++ /dev/null
-/*
- * Copyright (c) 2020 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/actors/actor-impl.h>
-#include <dali/internal/event/actors/actor-siblings.h>
-
-// EXTERNAL INCLUDES
-#include <algorithm>
-
-namespace Dali
-{
-namespace Internal
-{
-
-bool Actor::SiblingHandler::SetSiblingOrder(
- ActorContainer& siblings,
- Actor& actor,
- uint32_t order )
-{
- bool changed = false;
-
- uint32_t currentOrder = GetSiblingOrder(siblings, actor);
- if( order != currentOrder )
- {
- if( order == 0 )
- {
- changed = LowerToBottom(siblings, actor);
- }
- else if( order < siblings.size() -1 )
- {
- if( order > currentOrder )
- {
- changed = RaiseAbove( siblings, actor, *siblings[order] );
- }
- else
- {
- changed = LowerBelow( siblings, actor, *siblings[order] );
- }
- }
- else
- {
- changed = RaiseToTop(siblings, actor);
- }
- }
- return changed;
-}
-
-uint32_t Actor::SiblingHandler::GetSiblingOrder(const ActorContainer& siblings, const Actor& actor)
-{
- uint32_t order=0;
- for( std::size_t i = 0; i < siblings.size(); ++i )
- {
- if( siblings[i] == &actor )
- {
- order = static_cast<uint32_t>( i );
- break;
- }
- }
- return order;
-}
-
-bool Actor::SiblingHandler::Raise(ActorContainer& siblings, Actor& actor)
-{
- bool changed = false;
- if( siblings.back() != &actor ) // If not already at end
- {
- for( std::size_t i=0; i<siblings.size(); ++i )
- {
- if( siblings[i] == &actor )
- {
- // Swap with next
- ActorPtr next = siblings[i+1];
- siblings[i+1] = &actor;
- siblings[i] = next;
- changed = true;
- break;
- }
- }
- }
- return changed;
-}
-
-bool Actor::SiblingHandler::Lower(ActorContainer& siblings, Actor& actor)
-{
- bool changed = false;
- if( siblings.front() != &actor ) // If not already at beginning
- {
- for( std::size_t i=1; i<siblings.size(); ++i )
- {
- if( siblings[i] == &actor )
- {
- // Swap with previous
- ActorPtr previous = siblings[i-1];
- siblings[i-1] = &actor;
- siblings[i] = previous;
- changed = true;
- break;
- }
- }
- }
- return changed;
-}
-
-bool Actor::SiblingHandler::RaiseToTop(ActorContainer& siblings, Actor& actor)
-{
- bool changed = false;
- if( siblings.back() != &actor ) // If not already at end
- {
- auto iter = std::find( siblings.begin(), siblings.end(), &actor );
- if( iter != siblings.end() )
- {
- siblings.erase(iter);
- siblings.push_back(ActorPtr(&actor));
- changed = true;
- }
- }
- return changed;
-}
-
-bool Actor::SiblingHandler::LowerToBottom(ActorContainer& siblings, Actor& actor)
-{
- bool changed = false;
- if( siblings.front() != &actor ) // If not already at bottom,
- {
- ActorPtr actorPtr(&actor); // ensure actor actor remains referenced.
-
- auto iter = std::find( siblings.begin(), siblings.end(), &actor );
- if( iter != siblings.end() )
- {
- siblings.erase(iter);
- siblings.insert(siblings.begin(), actorPtr);
- changed = true;
- }
- }
- return changed;
-}
-
-bool Actor::SiblingHandler::RaiseAbove(ActorContainer& siblings, Actor& actor, Actor& target)
-{
- bool raised = false;
- if( siblings.back() != &actor && target.GetParent() == actor.GetParent() ) // If not already at top
- {
- ActorPtr actorPtr(&actor); // ensure actor actor remains referenced.
-
- auto targetIter = std::find( siblings.begin(), siblings.end(), &target );
- auto actorIter = std::find( siblings.begin(), siblings.end(), &actor );
- if( actorIter < targetIter )
- {
- siblings.erase(actorIter);
- // Erasing early invalidates the targetIter. (Conversely, inserting first may also
- // invalidate actorIter)
- targetIter = std::find( siblings.begin(), siblings.end(), &target );
- ++targetIter;
- siblings.insert(targetIter, actorPtr);
- }
- raised = true;
- }
- return raised;
-}
-
-bool Actor::SiblingHandler::LowerBelow(ActorContainer& siblings, Actor& actor, Actor& target)
-{
- bool lowered = false;
-
- // If not already at bottom
- if( siblings.front() != &actor && target.GetParent() == actor.GetParent() )
- {
- ActorPtr actorPtr(&actor); // ensure actor actor remains referenced.
-
- auto targetIter = std::find( siblings.begin(), siblings.end(), &target );
- auto actorIter = std::find( siblings.begin(), siblings.end(), &actor );
-
- if( actorIter > targetIter )
- {
- siblings.erase(actorIter); // actor only invalidates iterators at or after actor point.
- siblings.insert(targetIter, actorPtr);
- }
- lowered = true;
- }
- return lowered;
-}
-
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_INTERNAL_ACTOR_SIBLINGS_H
-#define DALI_INTERNAL_ACTOR_SIBLINGS_H
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use actor file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/actors/actor-impl.h>
-
-namespace Dali
-{
-namespace Internal
-{
-
-struct Actor::SiblingHandler
-{
- /**
- * @brief Change the sibling order of the given actor.
- *
- * @param[in,out] siblings The container of siblings
- * @param[in] actor The actor to change
- * @param[in] order The new order for the actor
- * @return true if order has been modified
- */
- static bool SetSiblingOrder( ActorContainer& siblings, Actor& actor, uint32_t order );
-
- /**
- * @brief Get the sibling order of the given actor.
- *
- * @param[in] siblings The container of siblings
- * @param[in] actor The actor to query
- * @return the order in the sibling array of the actor
- */
- static uint32_t GetSiblingOrder(const ActorContainer& siblings, const Actor& actor);
-
- /**
- * @brief Raise the actor within the siblings list by one
- * @param[in,out] siblings The container of siblings
- * @param[in] actor The actor to move
- * @return true if order has been modified
- */
- static bool Raise(ActorContainer& siblings, Actor& actor);
-
- /**
- * @brief Lower the actor within the siblings list by one
- * @param[in,out] siblings The container of siblings
- * @param[in] actor The actor to move
- * @return true if order has been modified
- */
- static bool Lower(ActorContainer& siblings, Actor& actor);
-
- /**
- * @brief Raise the actor to the top of the siblings list.
- *
- * @param[in,out] siblings The container of siblings
- * @param[in] actor The actor to move
- * @return true if order has been modified
- */
- static bool RaiseToTop(ActorContainer& siblings, Actor& actor);
-
- /**
- * @brief Lower the actor to the bottom of the siblings list.
- *
- * @param[in,out] siblings The container of siblings
- * @param[in] actor The actor to move
- * @return true if order has been modified
- */
- static bool LowerToBottom(ActorContainer& siblings, Actor& actor);
-
- /**
- * @brief Raise the actor above the target actor within the siblings list.
- *
- * @param[in,out] siblings The container of siblings
- * @param[in] actor The actor to move
- * @param[in] target The target actor
- * @return true if order has been modified
- */
- static bool RaiseAbove(ActorContainer& siblings, Actor& actor, Actor& target);
-
- /**
- * @brief Lower the actor below the target actor within the siblings list.
- *
- * @param[in,out] siblings The container of siblings
- * @param[in] actor The actor to move
- * @param[in] target The target actor
- * @return true if order has been modified
- */
- static bool LowerBelow(ActorContainer& siblings, Actor& actor, Actor& target);
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-
-#endif
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/object/type-registry.h>
+
#include <dali/internal/event/actors/layer-list.h>
+#include <dali/internal/event/common/event-thread-services.h>
#include <dali/internal/event/common/property-helper.h>
#include <dali/internal/event/common/scene-impl.h>
-#include <dali/internal/event/common/event-thread-services.h>
using Dali::Internal::SceneGraph::UpdateManager;
namespace Dali
{
-
namespace
{
-
typedef Layer::Behavior Behavior;
-DALI_ENUM_TO_STRING_TABLE_BEGIN( BEHAVIOR )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Layer, LAYER_UI )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Layer, LAYER_3D )
-DALI_ENUM_TO_STRING_TABLE_END( BEHAVIOR )
+DALI_ENUM_TO_STRING_TABLE_BEGIN(BEHAVIOR)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(Layer, LAYER_UI)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(Layer, LAYER_3D)
+DALI_ENUM_TO_STRING_TABLE_END(BEHAVIOR)
} // namespace
namespace Internal
{
-
namespace
{
-
// Properties
// Name Type writable animatable constraint-input enum for index-checking
DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "clippingEnable", BOOLEAN, true, false, true, Dali::Layer::Property::CLIPPING_ENABLE )
-DALI_PROPERTY( "clippingBox", RECTANGLE, true, false, true, Dali::Layer::Property::CLIPPING_BOX )
-DALI_PROPERTY( "behavior", INTEGER, true, false, false, Dali::Layer::Property::BEHAVIOR )
-DALI_PROPERTY( "depth", INTEGER, false, false, false, Dali::Layer::Property::DEPTH )
-DALI_PROPERTY( "depthTest", BOOLEAN, true, false, false, Dali::Layer::Property::DEPTH_TEST )
-DALI_PROPERTY( "consumesTouch", BOOLEAN, true, false, false, Dali::Layer::Property::CONSUMES_TOUCH )
-DALI_PROPERTY( "consumesHover", BOOLEAN, true, false, false, Dali::Layer::Property::CONSUMES_HOVER )
-DALI_PROPERTY_TABLE_END( DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, LayerDefaultProperties )
+DALI_PROPERTY("clippingEnable", BOOLEAN, true, false, true, Dali::Layer::Property::CLIPPING_ENABLE)
+DALI_PROPERTY("clippingBox", RECTANGLE, true, false, true, Dali::Layer::Property::CLIPPING_BOX)
+DALI_PROPERTY("behavior", INTEGER, true, false, false, Dali::Layer::Property::BEHAVIOR)
+DALI_PROPERTY("depth", INTEGER, false, false, false, Dali::Layer::Property::DEPTH)
+DALI_PROPERTY("depthTest", BOOLEAN, true, false, false, Dali::Layer::Property::DEPTH_TEST)
+DALI_PROPERTY("consumesTouch", BOOLEAN, true, false, false, Dali::Layer::Property::CONSUMES_TOUCH)
+DALI_PROPERTY("consumesHover", BOOLEAN, true, false, false, Dali::Layer::Property::CONSUMES_HOVER)
+DALI_PROPERTY_TABLE_END(DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, LayerDefaultProperties)
// Actions
return Dali::Layer::New();
}
-TypeRegistration mType( typeid( Dali::Layer ), typeid( Dali::Actor ), Create, LayerDefaultProperties );
+TypeRegistration mType(typeid(Dali::Layer), typeid(Dali::Actor), Create, LayerDefaultProperties);
TypeAction a1(mType, std::string(ACTION_RAISE), &Layer::DoAction);
TypeAction a2(mType, std::string(ACTION_LOWER), &Layer::DoAction);
} // unnamed namespace
-
LayerPtr Layer::New()
{
// create node, nodes are owned by UpdateManager
- SceneGraph::Layer* layerNode = SceneGraph::Layer::New();
- OwnerPointer< SceneGraph::Node > transferOwnership( layerNode );
- AddNodeMessage( EventThreadServices::Get().GetUpdateManager(), transferOwnership );
- LayerPtr layer( new Layer( Actor::LAYER, *layerNode ) );
+ SceneGraph::Layer* layerNode = SceneGraph::Layer::New();
+ OwnerPointer<SceneGraph::Node> transferOwnership(layerNode);
+ AddNodeMessage(EventThreadServices::Get().GetUpdateManager(), transferOwnership);
+ LayerPtr layer(new Layer(Actor::LAYER, *layerNode));
// Second-phase construction
layer->Initialize();
return layer;
}
-LayerPtr Layer::NewRoot( LayerList& layerList )
+LayerPtr Layer::NewRoot(LayerList& layerList)
{
// create node, nodes are owned by UpdateManager
- SceneGraph::Layer* rootLayer = SceneGraph::Layer::New();
- OwnerPointer< SceneGraph::Layer > transferOwnership( rootLayer );
- InstallRootMessage( EventThreadServices::Get().GetUpdateManager(), transferOwnership );
+ SceneGraph::Layer* rootLayer = SceneGraph::Layer::New();
+ OwnerPointer<SceneGraph::Layer> transferOwnership(rootLayer);
+ InstallRootMessage(EventThreadServices::Get().GetUpdateManager(), transferOwnership);
- LayerPtr root( new Layer( Actor::ROOT_LAYER, *rootLayer ) );
+ LayerPtr root(new Layer(Actor::ROOT_LAYER, *rootLayer));
// root actor is immediately considered to be on-stage
root->mIsOnScene = true;
// layer-list must be set for the root layer
root->mLayerList = &layerList;
- layerList.SetRootLayer( &(*root) );
- layerList.RegisterLayer( *root );
+ layerList.SetRootLayer(&(*root));
+ layerList.RegisterLayer(*root);
return root;
}
-Layer::Layer( Actor::DerivedType type, const SceneGraph::Layer& layer )
-: Actor( type, layer ),
- mLayerList( nullptr ),
- mClippingBox( 0, 0, 0, 0 ),
- mSortFunction( Layer::ZValue ),
- mBehavior( Dali::Layer::LAYER_UI ),
- mIsClipping( false ),
- mDepthTestDisabled( true ),
- mTouchConsumed( false ),
- mHoverConsumed( false )
+Layer::Layer(Actor::DerivedType type, const SceneGraph::Layer& layer)
+: Actor(type, layer),
+ mLayerList(nullptr),
+ mClippingBox(0, 0, 0, 0),
+ mSortFunction(Layer::ZValue),
+ mBehavior(Dali::Layer::LAYER_UI),
+ mIsClipping(false),
+ mDepthTestDisabled(true),
+ mTouchConsumed(false),
+ mHoverConsumed(false)
{
}
Layer::~Layer()
{
- if ( mIsRoot )
+ if(mIsRoot)
{
// Guard to allow handle destruction after Core has been destroyed
- if( EventThreadServices::IsCoreRunning() )
+ if(EventThreadServices::IsCoreRunning())
{
- UninstallRootMessage( GetEventThreadServices().GetUpdateManager(), &GetSceneGraphLayer() );
+ UninstallRootMessage(GetEventThreadServices().GetUpdateManager(), &GetSceneGraphLayer());
- GetEventThreadServices().UnregisterObject( this );
+ GetEventThreadServices().UnregisterObject(this);
}
}
}
unsigned int Layer::GetDepth() const
{
- return mLayerList ? mLayerList->GetDepth( this ) : 0u;
+ return mLayerList ? mLayerList->GetDepth(this) : 0u;
}
void Layer::Raise()
{
- if ( mLayerList )
+ if(mLayerList)
{
mLayerList->RaiseLayer(*this);
}
void Layer::Lower()
{
- if ( mLayerList )
+ if(mLayerList)
{
mLayerList->LowerLayer(*this);
}
}
-void Layer::RaiseAbove( const Internal::Layer& target )
+void Layer::RaiseAbove(const Internal::Layer& target)
{
// cannot raise above ourself, both have to be on the scene
- if( ( this != &target ) && OnScene() && target.OnScene() )
+ if((this != &target) && OnScene() && target.OnScene())
{
// get parameters depth
const uint32_t targetDepth = target.GetDepth();
- if( GetDepth() < targetDepth )
+ if(GetDepth() < targetDepth)
{
- MoveAbove( target );
+ MoveAbove(target);
}
}
}
-void Layer::LowerBelow( const Internal::Layer& target )
+void Layer::LowerBelow(const Internal::Layer& target)
{
// cannot lower below ourself, both have to be on the scene
- if( ( this != &target ) && OnScene() && target.OnScene() )
+ if((this != &target) && OnScene() && target.OnScene())
{
// get parameters depth
const uint32_t targetDepth = target.GetDepth();
- if( GetDepth() > targetDepth )
+ if(GetDepth() > targetDepth)
{
- MoveBelow( target );
+ MoveBelow(target);
}
}
}
void Layer::RaiseToTop()
{
- if ( mLayerList )
+ if(mLayerList)
{
mLayerList->RaiseLayerToTop(*this);
}
void Layer::LowerToBottom()
{
- if ( mLayerList )
+ if(mLayerList)
{
mLayerList->LowerLayerToBottom(*this);
}
}
-void Layer::MoveAbove( const Internal::Layer& target )
+void Layer::MoveAbove(const Internal::Layer& target)
{
// cannot raise above ourself, both have to be on the scene
- if( ( this != &target ) && mLayerList && target.OnScene() )
+ if((this != &target) && mLayerList && target.OnScene())
{
- mLayerList->MoveLayerAbove(*this, target );
+ mLayerList->MoveLayerAbove(*this, target);
}
}
-void Layer::MoveBelow( const Internal::Layer& target )
+void Layer::MoveBelow(const Internal::Layer& target)
{
// cannot lower below ourself, both have to be on the scene
- if( ( this != &target ) && mLayerList && target.OnScene() )
+ if((this != &target) && mLayerList && target.OnScene())
{
- mLayerList->MoveLayerBelow(*this, target );
+ mLayerList->MoveLayerBelow(*this, target);
}
}
-void Layer::SetBehavior( Dali::Layer::Behavior behavior )
+void Layer::SetBehavior(Dali::Layer::Behavior behavior)
{
mBehavior = behavior;
// Notify update side object.
- SetBehaviorMessage( GetEventThreadServices(), GetSceneGraphLayer(), behavior );
+ SetBehaviorMessage(GetEventThreadServices(), GetSceneGraphLayer(), behavior);
// By default, disable depth test for LAYER_UI, and enable for LAYER_3D.
- SetDepthTestDisabled( mBehavior == Dali::Layer::LAYER_UI );
+ SetDepthTestDisabled(mBehavior == Dali::Layer::LAYER_UI);
}
void Layer::SetClipping(bool enabled)
{
- if (enabled != mIsClipping)
+ if(enabled != mIsClipping)
{
mIsClipping = enabled;
// layerNode is being used in a separate thread; queue a message to set the value
- SetClippingMessage( GetEventThreadServices(), GetSceneGraphLayer(), mIsClipping );
+ SetClippingMessage(GetEventThreadServices(), GetSceneGraphLayer(), mIsClipping);
}
}
void Layer::SetClippingBox(int x, int y, int width, int height)
{
- if( ( x != mClippingBox.x ) ||
- ( y != mClippingBox.y ) ||
- ( width != mClippingBox.width ) ||
- ( height != mClippingBox.height ) )
+ if((x != mClippingBox.x) ||
+ (y != mClippingBox.y) ||
+ (width != mClippingBox.width) ||
+ (height != mClippingBox.height))
{
// Clipping box is not animatable; this is the most up-to-date value
mClippingBox.Set(x, y, width, height);
// Convert mClippingBox to GL based coordinates (from bottom-left)
- ClippingBox clippingBox( mClippingBox );
+ ClippingBox clippingBox(mClippingBox);
- if( mScene )
+ if(mScene)
{
- clippingBox.y = static_cast<int32_t>( mScene->GetSize().height ) - clippingBox.y - clippingBox.height;
+ clippingBox.y = static_cast<int32_t>(mScene->GetSize().height) - clippingBox.y - clippingBox.height;
// layerNode is being used in a separate thread; queue a message to set the value
- SetClippingBoxMessage( GetEventThreadServices(), GetSceneGraphLayer(), clippingBox );
+ SetClippingBoxMessage(GetEventThreadServices(), GetSceneGraphLayer(), clippingBox);
}
}
}
-void Layer::SetDepthTestDisabled( bool disable )
+void Layer::SetDepthTestDisabled(bool disable)
{
- if( disable != mDepthTestDisabled )
+ if(disable != mDepthTestDisabled)
{
mDepthTestDisabled = disable;
// Send message.
// layerNode is being used in a separate thread; queue a message to set the value
- SetDepthTestDisabledMessage( GetEventThreadServices(), GetSceneGraphLayer(), mDepthTestDisabled );
+ SetDepthTestDisabledMessage(GetEventThreadServices(), GetSceneGraphLayer(), mDepthTestDisabled);
}
}
void Layer::SetSortFunction(Dali::Layer::SortFunctionType function)
{
- if( function != mSortFunction )
+ if(function != mSortFunction)
{
mSortFunction = function;
// layerNode is being used in a separate thread; queue a message to set the value
- SetSortFunctionMessage( GetEventThreadServices(), GetSceneGraphLayer(), mSortFunction );
+ SetSortFunctionMessage(GetEventThreadServices(), GetSceneGraphLayer(), mSortFunction);
}
}
-void Layer::SetTouchConsumed( bool consume )
+void Layer::SetTouchConsumed(bool consume)
{
mTouchConsumed = consume;
}
return mTouchConsumed;
}
-void Layer::SetHoverConsumed( bool consume )
+void Layer::SetHoverConsumed(bool consume)
{
mHoverConsumed = consume;
}
void Layer::OnSceneConnectionInternal()
{
- if ( !mIsRoot )
+ if(!mIsRoot)
{
- DALI_ASSERT_DEBUG( NULL == mLayerList );
+ DALI_ASSERT_DEBUG(NULL == mLayerList);
// Find the ordered layer-list
- for ( Actor* parent = mParent; parent != nullptr; parent = parent->GetParent() )
+ for(Actor* parent = GetParent(); parent != nullptr; parent = parent->GetParent())
{
- if( parent->IsLayer() )
+ if(parent->IsLayer())
{
- Layer* parentLayer = static_cast< Layer* >( parent ); // cheaper than dynamic_cast
- mLayerList = parentLayer->mLayerList;
+ Layer* parentLayer = static_cast<Layer*>(parent); // cheaper than dynamic_cast
+ mLayerList = parentLayer->mLayerList;
}
}
}
- DALI_ASSERT_DEBUG( NULL != mLayerList );
- mLayerList->RegisterLayer( *this );
+ DALI_ASSERT_DEBUG(NULL != mLayerList);
+ mLayerList->RegisterLayer(*this);
}
void Layer::OnSceneDisconnectionInternal()
const SceneGraph::Layer& Layer::GetSceneGraphLayer() const
{
- return static_cast< const SceneGraph::Layer& >( GetNode() ); // we know our node is a layer node
+ return static_cast<const SceneGraph::Layer&>(GetNode()); // we know our node is a layer node
}
-void Layer::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
+void Layer::SetDefaultProperty(Property::Index index, const Property::Value& propertyValue)
{
- if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
+ if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
{
- Actor::SetDefaultProperty( index, propertyValue );
+ Actor::SetDefaultProperty(index, propertyValue);
}
else
{
- switch( index )
+ switch(index)
{
case Dali::Layer::Property::CLIPPING_ENABLE:
{
- SetClipping( propertyValue.Get<bool>() );
+ SetClipping(propertyValue.Get<bool>());
break;
}
case Dali::Layer::Property::CLIPPING_BOX:
{
- Rect<int32_t> clippingBox( propertyValue.Get<Rect<int32_t> >() );
- SetClippingBox( clippingBox.x, clippingBox.y, clippingBox.width, clippingBox.height );
+ Rect<int32_t> clippingBox(propertyValue.Get<Rect<int32_t> >());
+ SetClippingBox(clippingBox.x, clippingBox.y, clippingBox.width, clippingBox.height);
break;
}
case Dali::Layer::Property::BEHAVIOR:
Behavior behavior = mBehavior;
Property::Type type = propertyValue.GetType();
- if( type == Property::STRING )
+ if(type == Property::STRING)
{
- if( Scripting::GetEnumeration< Behavior >( propertyValue.Get< std::string >().c_str(), BEHAVIOR_TABLE, BEHAVIOR_TABLE_COUNT, behavior ) )
+ if(Scripting::GetEnumeration<Behavior>(propertyValue.Get<std::string>().c_str(), BEHAVIOR_TABLE, BEHAVIOR_TABLE_COUNT, behavior))
{
- SetBehavior( behavior );
+ SetBehavior(behavior);
}
}
- else if ( type == Property::INTEGER )
+ else if(type == Property::INTEGER)
{
- SetBehavior( propertyValue.Get< Dali::Layer::Behavior >() );
+ SetBehavior(propertyValue.Get<Dali::Layer::Behavior>());
}
break;
}
case Dali::Layer::Property::DEPTH_TEST:
{
- SetDepthTestDisabled( !propertyValue.Get<bool>() );
+ SetDepthTestDisabled(!propertyValue.Get<bool>());
break;
}
case Dali::Layer::Property::CONSUMES_TOUCH:
{
- SetTouchConsumed( propertyValue.Get<bool>() );
+ SetTouchConsumed(propertyValue.Get<bool>());
break;
}
case Dali::Layer::Property::CONSUMES_HOVER:
{
- SetHoverConsumed( propertyValue.Get<bool>() );
+ SetHoverConsumed(propertyValue.Get<bool>());
break;
}
default:
{
- DALI_LOG_WARNING( "Unknown property (%d)\n", index );
+ DALI_LOG_WARNING("Unknown property (%d)\n", index);
break;
}
} // switch(index)
} // else
}
-Property::Value Layer::GetDefaultProperty( Property::Index index ) const
+Property::Value Layer::GetDefaultProperty(Property::Index index) const
{
Property::Value ret;
- if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
+ if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
{
- ret = Actor::GetDefaultProperty( index );
+ ret = Actor::GetDefaultProperty(index);
}
else
{
- switch( index )
+ switch(index)
{
case Dali::Layer::Property::CLIPPING_ENABLE:
{
}
case Dali::Layer::Property::DEPTH:
{
- ret = static_cast<int>( GetDepth() );
+ ret = static_cast<int>(GetDepth());
break;
}
case Dali::Layer::Property::DEPTH_TEST:
}
default:
{
- DALI_LOG_WARNING( "Unknown property (%d)\n", index );
+ DALI_LOG_WARNING("Unknown property (%d)\n", index);
break;
}
} // switch(index)
return ret;
}
-Property::Value Layer::GetDefaultPropertyCurrentValue( Property::Index index ) const
+Property::Value Layer::GetDefaultPropertyCurrentValue(Property::Index index) const
{
Property::Value ret;
- if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
+ if(index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
{
- ret = Actor::GetDefaultPropertyCurrentValue( index );
+ ret = Actor::GetDefaultPropertyCurrentValue(index);
}
else
{
- ret = GetDefaultProperty( index ); // Layer only has event-side properties
+ ret = GetDefaultProperty(index); // Layer only has event-side properties
}
return ret;
}
-bool Layer::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/ )
+bool Layer::DoAction(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/)
{
- bool done = false;
- Layer* layer = dynamic_cast<Layer*>( object );
+ bool done = false;
+ Layer* layer = dynamic_cast<Layer*>(object);
- if( layer )
+ if(layer)
{
std::string_view name(actionName);
${internal_src_dir}/event/actors/actor-impl.cpp
${internal_src_dir}/event/actors/actor-property-handler.cpp
${internal_src_dir}/event/actors/actor-relayouter.cpp
- ${internal_src_dir}/event/actors/actor-siblings.cpp
+ ${internal_src_dir}/event/actors/actor-parent-impl.cpp
${internal_src_dir}/event/actors/custom-actor-internal.cpp
${internal_src_dir}/event/actors/layer-impl.cpp
${internal_src_dir}/event/actors/layer-list.cpp