#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/actors/actor-property-handler.h>
#include <dali/internal/event/actors/actor-relayouter.h>
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
-const char* const SIGNAL_HOVERED = "hovered";
-const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
-const char* const SIGNAL_ON_SCENE = "onScene";
-const char* const SIGNAL_OFF_SCENE = "offScene";
-const char* const SIGNAL_ON_RELAYOUT = "onRelayout";
-const char* const SIGNAL_TOUCHED = "touched";
-const char* const SIGNAL_VISIBILITY_CHANGED = "visibilityChanged";
-const char* const SIGNAL_LAYOUT_DIRECTION_CHANGED = "layoutDirectionChanged";
-const char* const SIGNAL_CHILD_ADDED = "childAdded";
-const char* const SIGNAL_CHILD_REMOVED = "childRemoved";
+static constexpr std::string_view SIGNAL_HOVERED = "hovered";
+static constexpr std::string_view SIGNAL_WHEEL_EVENT = "wheelEvent";
+static constexpr std::string_view SIGNAL_ON_SCENE = "onScene";
+static constexpr std::string_view SIGNAL_OFF_SCENE = "offScene";
+static constexpr std::string_view SIGNAL_ON_RELAYOUT = "onRelayout";
+static constexpr std::string_view SIGNAL_TOUCHED = "touched";
+static constexpr std::string_view SIGNAL_VISIBILITY_CHANGED = "visibilityChanged";
+static constexpr std::string_view SIGNAL_LAYOUT_DIRECTION_CHANGED = "layoutDirectionChanged";
+static constexpr std::string_view SIGNAL_CHILD_ADDED = "childAdded";
+static constexpr std::string_view SIGNAL_CHILD_REMOVED = "childRemoved";
// Actions
-const char* const ACTION_SHOW = "show";
-const char* const ACTION_HIDE = "hide";
+static constexpr std::string_view ACTION_SHOW = "show";
+static constexpr std::string_view ACTION_HIDE = "hide";
BaseHandle CreateActor()
{
TypeRegistration mType( typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties );
-SignalConnectorType signalConnector2( mType, SIGNAL_HOVERED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector3( mType, SIGNAL_WHEEL_EVENT, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector4( mType, SIGNAL_ON_SCENE, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector5( mType, SIGNAL_OFF_SCENE, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector6( mType, SIGNAL_ON_RELAYOUT, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector7( mType, SIGNAL_TOUCHED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector8( mType, SIGNAL_VISIBILITY_CHANGED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector9( mType, SIGNAL_LAYOUT_DIRECTION_CHANGED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector10( mType, SIGNAL_CHILD_ADDED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector11( mType, SIGNAL_CHILD_REMOVED, &Actor::DoConnectSignal );
+SignalConnectorType signalConnector2(mType, std::string(SIGNAL_HOVERED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector3(mType, std::string(SIGNAL_WHEEL_EVENT), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector4(mType, std::string(SIGNAL_ON_SCENE), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector5(mType, std::string(SIGNAL_OFF_SCENE), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector6(mType, std::string(SIGNAL_ON_RELAYOUT), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector7(mType, std::string(SIGNAL_TOUCHED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector8(mType, std::string(SIGNAL_VISIBILITY_CHANGED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector9(mType, std::string(SIGNAL_LAYOUT_DIRECTION_CHANGED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector10(mType, std::string(SIGNAL_CHILD_ADDED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector11(mType, std::string(SIGNAL_CHILD_REMOVED), &Actor::DoConnectSignal);
-TypeAction a1( mType, ACTION_SHOW, &Actor::DoAction );
-TypeAction a2( mType, ACTION_HIDE, &Actor::DoAction );
+TypeAction a1(mType, std::string(ACTION_SHOW), &Actor::DoAction);
+TypeAction a2(mType, std::string(ACTION_HIDE), &Actor::DoAction);
/**
* @brief Extract a given dimension from a Vector2
if( actor->GetChildCount() > 0 )
{
- for( ActorPtr& child : actor->GetChildrenInternal() )
+ for( auto& child : actor->GetChildrenInternal() )
{
EmitVisibilityChangedSignalRecursively( child, visible, DevelActor::VisibilityChange::PARENT );
}
}
else if( mChildren )
{
- ActorIter end = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != end; ++iter )
+ for( const auto& actor : *mChildren )
{
- child = (*iter)->FindChildByName( actorName );
+ child = actor->FindChildByName( actorName );
if( child )
{
}
else if( mChildren )
{
- ActorIter end = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != end; ++iter )
+ for( const auto& actor : *mChildren )
{
- child = (*iter)->FindChildById( id );
+ child = actor->FindChildById( id );
if( child )
{
// 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 );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
float Actor::GetCurrentOpacity() const
// 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 );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
void Actor::SetColorRed( float 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 );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
void Actor::SetColorGreen( float 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 );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
void Actor::SetColorBlue( float 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 );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
const Vector4& Actor::GetCurrentColor() const
mRenderers = new RendererContainer;
}
+ if(mIsBlendEquationSet)
+ {
+ renderer.SetBlendMode(Dali::BlendMode::ON);
+ 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 );
}
}
+void Actor::SetBlendEquation(DevelBlendEquation::Type blendEquation)
+{
+ if(Dali::Capabilities::IsBlendEquationSupported(blendEquation))
+ {
+ if(mBlendEquation != blendEquation)
+ {
+ mBlendEquation = blendEquation;
+ uint32_t rendererCount = GetRendererCount();
+ for(uint32_t i = 0; i < rendererCount; ++i)
+ {
+ RendererPtr renderer = GetRendererAt(i);
+ renderer->SetBlendMode(Dali::BlendMode::ON);
+ renderer->SetBlendEquation(static_cast<DevelBlendEquation::Type>(blendEquation));
+ }
+ }
+ mIsBlendEquationSet = true;
+ }
+ else
+ {
+ DALI_LOG_ERROR("Invalid blend equation is entered.\n");
+ }
+}
+
+DevelBlendEquation::Type Actor::GetBlendEquation() const
+{
+ return mBlendEquation;
+}
+
void Actor::SetDrawMode( DrawMode::Type drawMode )
{
// this flag is not animatable so keep the value
return mGestureData && mGestureData->IsGestureRequired( type );
}
+bool Actor::EmitInterceptTouchEventSignal( const Dali::TouchEvent& touch )
+{
+ return EmitConsumingSignal( *this, mInterceptTouchedSignal, touch );
+}
+
bool Actor::EmitTouchEventSignal( const Dali::TouchEvent& touch )
{
return EmitConsumingSignal( *this, mTouchedSignal, touch );
bool connected( true );
Actor* actor = static_cast< Actor* >( object ); // TypeRegistry guarantees that this is the correct type.
- if( 0 == signalName.compare( SIGNAL_HOVERED ) )
+ std::string_view name(signalName);
+
+ if(name == SIGNAL_HOVERED)
{
actor->HoveredSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_WHEEL_EVENT ) )
+ else if(signalName == SIGNAL_WHEEL_EVENT)
{
actor->WheelEventSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_ON_SCENE ) )
+ else if(name == SIGNAL_ON_SCENE)
{
actor->OnSceneSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_OFF_SCENE ) )
+ else if(name == SIGNAL_OFF_SCENE)
{
actor->OffSceneSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_ON_RELAYOUT ) )
+ else if(name == SIGNAL_ON_RELAYOUT)
{
actor->OnRelayoutSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_TOUCHED ) )
+ else if(name == SIGNAL_TOUCHED)
{
actor->TouchedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_VISIBILITY_CHANGED ) )
+ else if(name == SIGNAL_VISIBILITY_CHANGED)
{
actor->VisibilityChangedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_LAYOUT_DIRECTION_CHANGED ) )
+ else if(name == SIGNAL_LAYOUT_DIRECTION_CHANGED)
{
actor->LayoutDirectionChangedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_CHILD_ADDED ) )
+ else if(name == SIGNAL_CHILD_ADDED)
{
actor->ChildAddedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_CHILD_REMOVED ) )
+ else if(name == SIGNAL_CHILD_REMOVED)
{
actor->ChildRemovedSignal().Connect( tracker, functor );
}
mAnchorPoint( nullptr ),
mRelayoutData( nullptr ),
mGestureData( nullptr ),
+ mInterceptTouchedSignal(),
mTouchedSignal(),
mHoveredSignal(),
mWheelEventSignal(),
mTargetPosition( Vector3::ZERO ),
mTargetScale( Vector3::ONE ),
mAnimatedSize( Vector3::ZERO ),
+ mTouchArea( Vector2::ZERO ),
mName(),
mSortedDepth( 0u ),
mDepth( 0u ),
mLayoutDirection( LayoutDirection::LEFT_TO_RIGHT ),
mDrawMode( DrawMode::NORMAL ),
mColorMode( Node::DEFAULT_COLOR_MODE ),
- mClippingMode( ClippingMode::DISABLED )
+ mClippingMode( ClippingMode::DISABLED ),
+ mBlendEquation( DevelBlendEquation::ADD ),
+ mIsBlendEquationSet( false )
{
}
// to guard against GetParent() & Unparent() calls from CustomActor destructors.
if( mChildren )
{
- ActorConstIter endIter = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
+ for( const auto& actor : *mChildren )
{
- (*iter)->SetParent( nullptr );
+ actor->SetParent( nullptr );
}
}
delete mChildren;
RecursiveConnectToScene( connectionList, parentDepth + 1 );
// Notify applications about the newly connected actors.
- const ActorIter endIter = connectionList.end();
- for( ActorIter iter = connectionList.begin(); iter != endIter; ++iter )
+ for( const auto& actor : connectionList )
{
- (*iter)->NotifyStageConnection();
+ actor->NotifyStageConnection();
}
RelayoutRequest();
// Recursively connect children
if( mChildren )
{
- ActorConstIter endIter = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
+ for( const auto& actor : *mChildren )
{
- (*iter)->SetScene( *mScene );
- (*iter)->RecursiveConnectToScene( connectionList, depth + 1 );
+ actor->SetScene( *mScene );
+ actor->RecursiveConnectToScene( connectionList, depth + 1 );
}
}
}
RecursiveDisconnectFromStage( disconnectionList );
// Notify applications about the newly disconnected actors.
- const ActorIter endIter = disconnectionList.end();
- for( ActorIter iter = disconnectionList.begin(); iter != endIter; ++iter )
+ for( const auto& actor : disconnectionList )
{
- (*iter)->NotifyStageDisconnection();
+ actor->NotifyStageDisconnection();
}
}
// Recursively disconnect children
if( mChildren )
{
- ActorConstIter endIter = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
+ for( const auto& child : *mChildren )
{
- (*iter)->RecursiveDisconnectFromStage( disconnectionList );
+ child->RecursiveDisconnectFromStage( disconnectionList );
}
}
// Create/add to children of this node
if( mChildren )
{
- for( ActorContainer::iterator it = mChildren->begin(); it != mChildren->end(); ++it )
+ for( const auto& child : *mChildren )
{
- Actor* childActor = (*it).Get();
+ Actor* childActor = child.Get();
++depthIndex;
childActor->DepthTraverseActorTree( sceneGraphNodeDepths, depthIndex );
}
if( actor )
{
- if( 0 == actionName.compare( ACTION_SHOW ) )
+ std::string_view name(actionName);
+ if(name == ACTION_SHOW)
{
actor->SetVisible( true );
done = true;
}
- else if( 0 == actionName.compare( ACTION_HIDE ) )
+ else if(name == ACTION_HIDE)
{
actor->SetVisible( false );
done = true;
// Check that we havn't gotten into an infinite loop
ActorDimensionPair searchActor = ActorDimensionPair( this, dimension );
bool recursionFound = false;
- for( ActorDimensionStack::iterator it = recursionStack.begin(), itEnd = recursionStack.end(); it != itEnd; ++it )
+ for( auto& element : recursionStack )
{
- if( *it == searchActor )
+ if( element == searchActor )
{
recursionFound = true;
break;
{
// 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 );
+
+ RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() );
}
mVisible = visible;
ActorContainer& siblings = *(mParent->mChildren);
if( siblings.back() != this ) // If not already at end
{
- ActorContainer::iterator iter = std::find( siblings.begin(), siblings.end(), this );
+ auto iter = std::find( siblings.begin(), siblings.end(), this );
if( iter != siblings.end() )
{
siblings.erase(iter);
{
ActorPtr thisPtr(this); // ensure this actor remains referenced.
- ActorContainer::iterator iter = std::find( siblings.begin(), siblings.end(), this );
+ auto iter = std::find( siblings.begin(), siblings.end(), this );
if( iter != siblings.end() )
{
siblings.erase(iter);
{
ActorPtr thisPtr(this); // ensure this actor remains referenced.
- ActorContainer::iterator targetIter = std::find( siblings.begin(), siblings.end(), &target );
- ActorContainer::iterator thisIter = std::find( siblings.begin(), siblings.end(), this );
+ auto targetIter = std::find( siblings.begin(), siblings.end(), &target );
+ auto thisIter = std::find( siblings.begin(), siblings.end(), this );
if( thisIter < targetIter )
{
siblings.erase(thisIter);
{
ActorPtr thisPtr(this); // ensure this actor remains referenced.
- ActorContainer::iterator targetIter = std::find( siblings.begin(), siblings.end(), &target );
- ActorContainer::iterator thisIter = std::find( siblings.begin(), siblings.end(), this );
+ auto targetIter = std::find( siblings.begin(), siblings.end(), &target );
+ auto thisIter = std::find( siblings.begin(), siblings.end(), this );
if( thisIter > targetIter )
{
if( actor->GetChildCount() > 0 )
{
- for( ActorPtr& child : actor->GetChildrenInternal() )
+ for( const auto& child : actor->GetChildrenInternal() )
{
InheritLayoutDirectionRecursively( child, direction );
}