X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=optional%2Fdali-toolkit%2Finternal%2Fcontrols%2Fcluster%2Fcluster-impl.cpp;h=d94a94b737bb85446d0921e6c884b869dc315459;hp=56597887fd133dc9e8683a6831f17a33fe0b4c2e;hb=4c9e3c8180e813f24d7514b275abd0d79c155405;hpb=00ef589046a32c53d20de1c61af7cc69524e51dc diff --git a/optional/dali-toolkit/internal/controls/cluster/cluster-impl.cpp b/optional/dali-toolkit/internal/controls/cluster/cluster-impl.cpp index 5659788..d94a94b 100644 --- a/optional/dali-toolkit/internal/controls/cluster/cluster-impl.cpp +++ b/optional/dali-toolkit/internal/controls/cluster/cluster-impl.cpp @@ -1,30 +1,33 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// +/* + * Copyright (c) 2014 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 // EXTERNAL INCLUDES #include +#include +#include #include // INTERNAL INCLUDES #include +#include -using namespace std; using namespace Dali; namespace // unnamed namespace @@ -80,7 +83,7 @@ Dali::Toolkit::Cluster Cluster::New(Toolkit::ClusterStyle& style) } Cluster::Cluster(Toolkit::ClusterStyle& style) -: Control(true/*requires touch*/), +: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ), mClusterStyle(style), mExpandedCount(0) { @@ -90,6 +93,27 @@ void Cluster::OnInitialize() { } +void Cluster::OnControlSizeSet( const Vector3& targetSize ) +{ + mClusterSize = targetSize; + GetImpl(mClusterStyle).SetClusterSize(targetSize); + + for(ChildInfoIter iter = mChildren.begin(); iter != mChildren.end(); ++iter) + { + + if((*iter).mActor) + { + mClusterStyle.ApplyStyle( (*iter).mActor, + (*iter).mPositionIndex, + AlphaFunctions::EaseOut, + 0.f ); + } + } + + UpdateBackground(0.f); + UpdateTitle(0.f); +} + Cluster::~Cluster() { } @@ -138,7 +162,7 @@ void Cluster::AddChildInfoAt( ChildInfo childInfo, unsigned int index ) Property::Index depthProperty = child.GetPropertyIndex(Toolkit::Cluster::CLUSTER_ACTOR_DEPTH); if(depthProperty == Property::INVALID_INDEX) { - depthProperty = child.RegisterProperty(Toolkit::Cluster::CLUSTER_ACTOR_DEPTH, depth); + child.RegisterProperty(Toolkit::Cluster::CLUSTER_ACTOR_DEPTH, depth); } // not added prior @@ -387,6 +411,7 @@ void Cluster::SetStyle(Toolkit::ClusterStyle style) { unsigned int previousChildrenNum = mChildren.size(); mClusterStyle = style; + GetImpl(mClusterStyle).SetClusterSize(mClusterSize); unsigned int newChildrenNum = mClusterStyle.GetMaximumNumberOfChildren(); // New style supports less children (remove those that no longer belong) @@ -404,14 +429,12 @@ void Cluster::SetStyle(Toolkit::ClusterStyle style) mChildren.erase( removeStart, mChildren.end() ); } - // Remove constraints from previous style, and apply new style's constraints. for(ChildInfoIter iter = mChildren.begin(); iter != mChildren.end(); ++iter) { if((*iter).mActor) { - (*iter).mActor.RemoveConstraints(); - style.ApplyStyle( (*iter).mActor, + mClusterStyle.ApplyStyle( (*iter).mActor, (*iter).mPositionIndex, AlphaFunctions::EaseOut, CLUSTER_STYLE_CONSTRAINT_DURATION ); @@ -441,7 +464,6 @@ void Cluster::UpdateBackground(float duration) { if (mBackgroundImage) { - mBackgroundImage.RemoveConstraints(); mClusterStyle.ApplyStyleToBackground(mBackgroundImage, AlphaFunctions::EaseOut, duration); } } @@ -450,7 +472,6 @@ void Cluster::UpdateTitle(float duration) { if (mTitle) { - mTitle.RemoveConstraints(); mClusterStyle.ApplyStyleToTitle(mTitle, AlphaFunctions::EaseOut, duration); } } @@ -527,7 +548,7 @@ void Cluster::OnControlChildRemove(Actor& child) child.RemoveConstraints(); } -bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const std::vector& attributes) +bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes) { bool ret = false;