X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fcluster%2Fcluster-impl.cpp;h=73d13c8960c6f19621bddba9961a76c70de7bbe0;hb=153aabfe7332ee884fddf1ab9cb310af77c747d0;hp=d94a94b737bb85446d0921e6c884b869dc315459;hpb=2ddfbb9e23a7c3fc30e604236c41e0ef6d2ed6a2;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/cluster/cluster-impl.cpp b/dali-toolkit/internal/controls/cluster/cluster-impl.cpp index d94a94b..73d13c8 100644 --- a/dali-toolkit/internal/controls/cluster/cluster-impl.cpp +++ b/dali-toolkit/internal/controls/cluster/cluster-impl.cpp @@ -20,8 +20,10 @@ // EXTERNAL INCLUDES #include +#include // for strcmp #include #include +#include #include // INTERNAL INCLUDES @@ -30,13 +32,6 @@ using namespace Dali; -namespace // unnamed namespace -{ - -const float CLUSTER_STYLE_CONSTRAINT_DURATION = 1.0f; - -} - namespace Dali { @@ -51,15 +46,19 @@ namespace BaseHandle Create() { - Toolkit::ClusterStyleStandard s = Toolkit::ClusterStyleStandard::New(Toolkit::ClusterStyleStandard::ClusterStyle1); + Toolkit::ClusterStyleStandard s = Toolkit::ClusterStyleStandard::New( Toolkit::ClusterStyleStandard::ClusterStyle1 ); return Toolkit::Cluster::New( s ); } -TypeRegistration mType( typeid(Toolkit::Cluster), typeid(Toolkit::Control), Create ); +DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Cluster, Toolkit::Control, Create ) + +DALI_ACTION_REGISTRATION( Toolkit, Cluster, "expand", ACTION_EXPAND ) +DALI_ACTION_REGISTRATION( Toolkit, Cluster, "collapse", ACTION_COLLAPSE ) +DALI_ACTION_REGISTRATION( Toolkit, Cluster, "transform", ACTION_TRANSFORM ) -TypeAction a1(mType, Toolkit::Cluster::ACTION_EXPAND , &Cluster::DoAction); -TypeAction a2(mType, Toolkit::Cluster::ACTION_COLLAPSE , &Cluster::DoAction); -TypeAction a3(mType, Toolkit::Cluster::ACTION_TRANSFORM, &Cluster::DoAction); +DALI_TYPE_REGISTRATION_END() + +const float CLUSTER_STYLE_CONSTRAINT_DURATION = 1.0f; } @@ -83,7 +82,7 @@ Dali::Toolkit::Cluster Cluster::New(Toolkit::ClusterStyle& style) } Cluster::Cluster(Toolkit::ClusterStyle& style) -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ), +: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | DISABLE_SIZE_NEGOTIATION ) ), mClusterStyle(style), mExpandedCount(0) { @@ -286,7 +285,7 @@ void Cluster::ExpandChild( unsigned int index ) const float angle = (rand()%360) * Math::PI / 180.0f; Vector3 position(sin(angle) * length, -cos(angle) * length, zOffset); const float scale(1.2f); - const float rotate = ((rand()%30) - 15) * Math::PI / 180.0f; + const Radian rotate( Degree( (rand()%30) - 15 ) ); position += childInfo.mActor.GetCurrentPosition(); @@ -345,9 +344,9 @@ void Cluster::TransformChild( unsigned int index, const Vector3& position, const child.RemoveConstraints(); Animation animation = Animation::New(period.delaySeconds + period.durationSeconds); - animation.AnimateTo( Property(child, Actor::POSITION), position, AlphaFunctions::EaseOut, period); - animation.AnimateTo( Property(child, Actor::SCALE), scale, AlphaFunctions::EaseOut, period); - animation.AnimateTo( Property(child, Actor::ROTATION), rotation, AlphaFunctions::EaseOut, period); + animation.AnimateTo( Property(child, Actor::Property::POSITION), position, AlphaFunctions::EaseOut, period); + animation.AnimateTo( Property(child, Actor::Property::SCALE), scale, AlphaFunctions::EaseOut, period); + animation.AnimateTo( Property(child, Actor::Property::ORIENTATION), rotation, AlphaFunctions::EaseOut, period); animation.Play(); } } @@ -522,7 +521,7 @@ void Cluster::DoTransformAction(const PropertyValueContainer& attributes) unsigned int index = attributes[0].Get(); Vector3 position; Vector3 scale(Vector3::ONE); - Quaternion rotation(0.0f, Vector3::ZAXIS); + Quaternion rotation( Dali::ANGLE_0, Vector3::ZAXIS ); DALI_ASSERT_ALWAYS(attributes[1].GetType() == Property::VECTOR3); attributes[1].Get(position); @@ -552,25 +551,25 @@ bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const { bool ret = false; - Dali::BaseHandle handle(object); + Dali::BaseHandle handle( object ); - Toolkit::Cluster cluster = Toolkit::Cluster::DownCast(handle); + Toolkit::Cluster cluster = Toolkit::Cluster::DownCast( handle ); - DALI_ASSERT_ALWAYS(cluster); + DALI_ASSERT_ALWAYS( cluster ); - if(Toolkit::Cluster::ACTION_EXPAND == actionName) + if( 0 == strcmp( actionName.c_str(), ACTION_EXPAND ) ) { - GetImpl(cluster).DoExpandAction(attributes); + GetImpl( cluster ).DoExpandAction( attributes ); ret = true; } - else if(Toolkit::Cluster::ACTION_COLLAPSE == actionName) + else if( 0 == strcmp( actionName.c_str(), ACTION_COLLAPSE ) ) { - GetImpl(cluster).DoCollapseAction(attributes); + GetImpl( cluster ).DoCollapseAction( attributes ); ret = true; } - else if(Toolkit::Cluster::ACTION_TRANSFORM == actionName) + else if( 0 == strcmp( actionName.c_str(), ACTION_TRANSFORM ) ) { - GetImpl(cluster).DoTransformAction(attributes); + GetImpl( cluster ).DoTransformAction( attributes ); ret = true; }