/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::DevelActor::Property::OPACITY )
DALI_PROPERTY( "screenPosition", VECTOR2, false, false, false, Dali::DevelActor::Property::SCREEN_POSITION )
DALI_PROPERTY( "positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT )
+DALI_PROPERTY( "culled", BOOLEAN, false, false, true, Dali::DevelActor::Property::CULLED )
DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
// Signals
const char* const SIGNAL_OFF_STAGE = "offStage";
const char* const SIGNAL_ON_RELAYOUT = "onRelayout";
const char* const SIGNAL_TOUCH = "touch";
+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";
// Actions
SignalConnectorType signalConnector5( mType, SIGNAL_OFF_STAGE, &Actor::DoConnectSignal );
SignalConnectorType signalConnector6( mType, SIGNAL_ON_RELAYOUT, &Actor::DoConnectSignal );
SignalConnectorType signalConnector7( mType, SIGNAL_TOUCH, &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 );
TypeAction a1( mType, ACTION_SHOW, &Actor::DoAction );
TypeAction a2( mType, ACTION_HIDE, &Actor::DoAction );
// if we already have parent, unparent us first
if( oldParent )
{
- oldParent->Remove( child ); // This causes OnChildRemove callback
+ oldParent->Remove( child ); // This causes OnChildRemove callback & ChildRemoved signal
// Old parent may need to readjust to missing child
if( oldParent->RelayoutDependentOnChildren() )
// Notification for derived classes
OnChildAdd( child );
+ EmitChildAddedSignal( child );
InheritLayoutDirectionRecursively( ActorPtr( &child ), mLayoutDirection );
// Notification for derived classes
OnChildRemove( child );
+ EmitChildRemovedSignal( child );
}
void Actor::Unparent()
}
}
+void Actor::EmitChildAddedSignal( Actor& child )
+{
+ if( ! mChildAddedSignal.Empty() )
+ {
+ Dali::Actor handle( &child );
+ mChildAddedSignal.Emit( handle );
+ }
+}
+
+void Actor::EmitChildRemovedSignal( Actor& child )
+{
+ if( ! mChildRemovedSignal.Empty() )
+ {
+ Dali::Actor handle( &child );
+ mChildRemovedSignal.Emit( handle );
+ }
+}
+
Dali::Actor::TouchSignalType& Actor::TouchedSignal()
{
return mTouchedSignal;
return mLayoutDirectionChangedSignal;
}
+DevelActor::ChildChangedSignalType& Actor::ChildAddedSignal()
+{
+ return mChildAddedSignal;
+}
+
+DevelActor::ChildChangedSignalType& Actor::ChildRemovedSignal()
+{
+ return mChildRemovedSignal;
+}
+
+DevelActor::ChildOrderChangedSignalType& Actor::ChildOrderChangedSignal()
+{
+ return mChildOrderChangedSignal;
+}
+
bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
bool connected( true );
{
actor->TouchSignal().Connect( tracker, functor );
}
+ else if( 0 == signalName.compare( SIGNAL_VISIBILITY_CHANGED ) )
+ {
+ actor->VisibilityChangedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == signalName.compare( SIGNAL_LAYOUT_DIRECTION_CHANGED ) )
+ {
+ actor->LayoutDirectionChangedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == signalName.compare( SIGNAL_CHILD_ADDED ) )
+ {
+ actor->ChildAddedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == signalName.compare( SIGNAL_CHILD_REMOVED ) )
+ {
+ actor->ChildRemovedSignal().Connect( tracker, functor );
+ }
else
{
// signalName does not match any signal
mAnchorPoint( NULL ),
mRelayoutData( NULL ),
mGestureData( NULL ),
+ mTouchedSignal(),
+ mTouchSignal(),
+ mHoveredSignal(),
+ mWheelEventSignal(),
+ mOnStageSignal(),
+ mOffStageSignal(),
+ mOnRelayoutSignal(),
+ mVisibilityChangedSignal(),
+ mLayoutDirectionChangedSignal(),
+ mChildAddedSignal(),
+ mChildRemovedSignal(),
+ mChildOrderChangedSignal(),
mTargetOrientation( Quaternion::IDENTITY ),
mTargetColor( Color::WHITE ),
mTargetSize( Vector3::ZERO ),
property = &mNode->mWorldMatrix;
break;
+ case Dali::DevelActor::Property::CULLED:
+ property = &mNode->mCulled;
+ break;
+
default:
break;
}
SceneGraph::Node* Actor::CreateNode() const
{
- return Node::New();
+ return Node::New( mId );
}
bool Actor::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& /* attributes */ )
break;
}
+ case DevelActor::Property::CULLED:
+ {
+ value = mNode->IsCulled( GetEventThreadServices().GetEventBufferIndex() );
+ break;
+ }
+
default:
{
// Must be an event-side only property
}
}
}
+
+ Dali::Actor handle( this );
+ mParent->mChildOrderChangedSignal.Emit( handle );
+
RequestRebuildDepthTree();
}
else
}
}
}
+
+ Dali::Actor handle( this );
+ mParent->mChildOrderChangedSignal.Emit( handle );
+
RequestRebuildDepthTree();
}
else
siblings.push_back(ActorPtr(this));
}
}
+
+ Dali::Actor handle( this );
+ mParent->mChildOrderChangedSignal.Emit( handle );
+
RequestRebuildDepthTree();
}
else
siblings.insert(siblings.begin(), thisPtr);
}
}
+
+ Dali::Actor handle( this );
+ mParent->mChildOrderChangedSignal.Emit( handle );
+
RequestRebuildDepthTree();
}
else
++targetIter;
siblings.insert(targetIter, thisPtr);
}
+
+ Dali::Actor handle( this );
+ mParent->mChildOrderChangedSignal.Emit( handle );
+
RequestRebuildDepthTree();
}
}
siblings.erase(thisIter); // this only invalidates iterators at or after this point.
siblings.insert(targetIter, thisPtr);
}
+
+ Dali::Actor handle( this );
+ mParent->mChildOrderChangedSignal.Emit( handle );
+
RequestRebuildDepthTree();
}
}