Delete view from toolkit and move cluster into demo 80/38680/2
authorKingsley Stephens <k.stephens@samsung.com>
Fri, 17 Apr 2015 12:15:46 +0000 (13:15 +0100)
committerKingsley Stephens <k.stephens@samsung.com>
Fri, 24 Apr 2015 13:29:43 +0000 (14:29 +0100)
Change-Id: I54fd5e2f166a4f487a6b1e7e5193ad25f5411bd6

32 files changed:
examples/animated-shapes/animated-shapes-example.cpp
examples/atlas/atlas-example.cpp
examples/blocks/blocks-example.cpp
examples/bubble-effect/bubble-effect-example.cpp
examples/builder/examples.cpp
examples/buttons/buttons-example.cpp
examples/cluster/cluster-example.cpp
examples/cluster/cluster-impl.cpp [new file with mode: 0644]
examples/cluster/cluster-impl.h [new file with mode: 0644]
examples/cluster/cluster-style-impl.cpp [new file with mode: 0644]
examples/cluster/cluster-style-impl.h [new file with mode: 0644]
examples/cluster/cluster-style.cpp [new file with mode: 0644]
examples/cluster/cluster-style.h [new file with mode: 0644]
examples/cluster/cluster.cpp [new file with mode: 0644]
examples/cluster/cluster.h [new file with mode: 0644]
examples/cube-transition-effect/cube-transition-effect-example.cpp
examples/dissolve-effect/dissolve-effect-example.cpp
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
examples/item-view/item-view-example.cpp
examples/logging/logging-example.cpp
examples/magnifier/magnifier-example.cpp
examples/motion-blur/motion-blur-example.cpp
examples/motion-stretch/motion-stretch-example.cpp
examples/new-window/new-window-example.cpp
examples/page-turn-view/page-turn-view-example.cpp
examples/path-animation/path-animation.cpp
examples/radial-menu/radial-menu-example.cpp
examples/refraction-effect/refraction-effect-example.cpp
examples/scroll-view/scroll-view-example.cpp
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
examples/size-negotiation/size-negotiation-example.cpp
shared/view.h

index 262f0b5..e36d9e5 100644 (file)
@@ -55,16 +55,14 @@ public:
     Stage stage = Stage::GetCurrent();
 
     //Create a view
-    mView = Dali::Toolkit::View::New();
+    mView = Dali::Toolkit::Control::New();
+    mView.SetAnchorPoint( Dali::AnchorPoint::CENTER );
+    mView.SetParentOrigin( Dali::ParentOrigin::CENTER );
     mView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     stage.Add( mView );
 
     //Set background image for the view
-    Image image = ResourceImage::New( BACKGROUND_IMAGE );
-
-
-    Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( image );
-    mView.SetBackground( backgroundImageActor );
+    mView.SetBackgroundImage( ResourceImage::New( BACKGROUND_IMAGE ) );
 
     CreateTriangleMorph(Vector3( stage.GetSize().x*0.5f,stage.GetSize().y*0.15f,0.0f), 100.0f );
     CreateCircleMorph( Vector3( stage.GetSize().x*0.5f,stage.GetSize().y*0.85f,0.0f), 60.0f );
@@ -364,7 +362,7 @@ public:
 
 private:
   Application&                mApplication;
-  Toolkit::View               mView;
+  Toolkit::Control            mView;
 };
 
 void RunTest( Application& application )
index c126da9..6d45fd8 100644 (file)
@@ -207,7 +207,7 @@ private:
   Application&  mApplication;
   PanGestureDetector mPanGestureDetector;
 
-  Toolkit::View              mView;                              ///< The View instance.
+  Toolkit::Control           mView;                              ///< The View instance.
   Toolkit::ToolBar           mToolBar;                           ///< The View's Toolbar.
   Layer                      mContentLayer;                      ///< Content layer (scrolling cluster content)
   Toolkit::PushButton        mLoseContextButton;
index 3d96204..35315df 100644 (file)
@@ -806,7 +806,7 @@ private:
 private:
 
   Application& mApplication;                            ///< Application instance
-  Toolkit::View mView;                                  ///< The View instance.
+  Toolkit::Control mView;                               ///< The View instance.
   Layer mContentLayer;                                  ///< The content layer (contains game actors)
   ImageActor mBall;                                     ///< The Moving ball image.
   Vector3 mBallStartPosition;                           ///< Ball Start position
index 5f06194..4575ee2 100644 (file)
@@ -101,7 +101,7 @@ private:
     // Creates a default view with a default tool bar.
     // The view is added to the stage.
     Toolkit::ToolBar toolBar;
-    Toolkit::View    view;
+    Toolkit::Control    view;
     Layer content = DemoHelper::CreateView( app,
                                             view,
                                             toolBar,
@@ -141,8 +141,8 @@ private:
     content.Add( bubbleRoot );
 
     // Add the background image actor to stage
-    mBackgroundActor = ImageActor::New( mBackgroundImage );
-    view.SetBackground( mBackgroundActor );
+    view.SetBackgroundImage( mBackgroundImage );
+    mBackgroundActor = ImageActor::DownCast( view.GetBackgroundActor() );
 
     // Set up the timer to emit bubble regularly when the finger is touched down but not moved
     mTimerForBubbleEmission = Timer::New( mTimerInterval );
index f43ba1e..2dad74c 100644 (file)
@@ -587,7 +587,7 @@ private:
   GridLayoutPtr mGridLayout;
   ItemView mItemView;
 
-  Toolkit::View mView;
+  Toolkit::Control mView;
   unsigned int mOrientation;
 
   Toolkit::ToolBar mToolBar;
index f5c035a..7395653 100644 (file)
@@ -497,7 +497,7 @@ class ButtonsController: public ConnectionTracker
  private:
 
   Application&      mApplication;
-  Toolkit::View     mView;                              ///< The View instance.
+  Toolkit::Control  mView;                              ///< The View instance.
   Toolkit::ToolBar  mToolBar;                           ///< The View's Toolbar.
   Layer             mContentLayer;                      ///< Content layer
 
index c0f92b1..7dd8673 100644 (file)
 #include <dali/dali.h>
 #include <dali-toolkit/dali-toolkit.h>
 
+#include "cluster.h"
+#include "cluster-style.h"
+
+
 using namespace Dali;
+using namespace Dali::Demo;
 using namespace Dali::Toolkit;
 using namespace DemoHelper;
 
@@ -449,8 +454,6 @@ public:
 
     Stage::GetCurrent().KeyEventSignal().Connect(this, &ClusterController::OnKeyEvent);
 
-    Vector2 stageSize = Stage::GetCurrent().GetSize();
-
     // The Init signal is received once (only) during the Application lifetime
 
     // Hide the indicator bar
@@ -477,7 +480,7 @@ public:
 
     // create and setup the scroll view...
     mScrollView = ScrollView::New();
-    mScrollView.SetSize(stageSize);
+    mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
     // attach Wobble Effect to ScrollView
     mScrollViewEffect = ScrollViewWobbleEffect::New();
@@ -842,9 +845,9 @@ public:
 private:
 
   Application&               mApplication;                       ///< Application instance
-  Toolkit::View              mView;                              ///< The View instance.
+  Toolkit::Control           mView;                              ///< The View instance.
   Toolkit::ToolBar           mToolBar;                           ///< The View's Toolbar.
-  TextLabel                   mTitleActor;                        ///< The Toolbar's Title.
+  TextLabel                  mTitleActor;                        ///< The Toolbar's Title.
 
   Layer                      mContentLayer;                      ///< Content layer (scrolling cluster content)
 
diff --git a/examples/cluster/cluster-impl.cpp b/examples/cluster/cluster-impl.cpp
new file mode 100644 (file)
index 0000000..2768d03
--- /dev/null
@@ -0,0 +1,583 @@
+/*
+ * 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 "cluster-impl.h"
+
+// EXTERNAL INCLUDES
+#include <algorithm>
+#include <cstring> // for strcmp
+#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include "cluster-style.h"
+#include "cluster-style-impl.h"
+
+using namespace Dali;
+
+namespace Dali
+{
+
+namespace Demo
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+BaseHandle Create()
+{
+  Demo::ClusterStyleStandard s = Demo::ClusterStyleStandard::New( Demo::ClusterStyleStandard::ClusterStyle1 );
+  return Demo::Cluster::New( s );
+}
+
+DALI_TYPE_REGISTRATION_BEGIN( Demo::Cluster, Toolkit::Control, Create )
+
+DALI_ACTION_REGISTRATION( Demo, Cluster, "expand",    ACTION_EXPAND    )
+DALI_ACTION_REGISTRATION( Demo, Cluster, "collapse",  ACTION_COLLAPSE  )
+DALI_ACTION_REGISTRATION( Demo, Cluster, "transform", ACTION_TRANSFORM )
+
+DALI_TYPE_REGISTRATION_END()
+
+const float CLUSTER_STYLE_CONSTRAINT_DURATION = 1.0f;
+
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Cluster
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+Dali::Demo::Cluster Cluster::New(Demo::ClusterStyle& style)
+{
+  // Create the implementation
+  ClusterPtr cluster(new Cluster(style));
+
+  // Pass ownership to CustomActor via derived handle
+  Dali::Demo::Cluster handle(*cluster);
+
+  // Second-phase init of the implementation
+  // This can only be done after the CustomActor connection has been made...
+  cluster->Initialize();
+
+  return handle;
+}
+
+Cluster::Cluster(Demo::ClusterStyle& style)
+: Toolkit::Internal::Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | DISABLE_SIZE_NEGOTIATION ) ),
+  mClusterStyle(style),
+  mExpandedCount(0)
+{
+}
+
+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()
+{
+}
+
+void Cluster::AddChild( Actor child )
+{
+  // automatically add child with a position at end.
+  AddChild( child, mChildren.size() );
+}
+
+void Cluster::AddChild( Actor child, unsigned int positionIndex )
+{
+  AddChildInfo( ChildInfo(child, positionIndex) );
+}
+
+void Cluster::AddChildAt( Actor child, unsigned int index )
+{
+  // automatically add child with a position at end.
+  AddChild( child, mChildren.size() );
+}
+
+void Cluster::AddChildAt( Actor child, unsigned int positionIndex, unsigned int index )
+{
+  AddChildInfoAt( ChildInfo(child, positionIndex), index );
+}
+
+void Cluster::AddChildInfo( ChildInfo childInfo )
+{
+  AddChildInfoAt(childInfo, mChildren.size());
+}
+
+void Cluster::AddChildInfoAt( ChildInfo childInfo, unsigned int index )
+{
+  // check that the child is valid
+  DALI_ASSERT_ALWAYS( childInfo.mActor );
+
+  ChildInfoIter offset = index < mChildren.size() ? (mChildren.begin() + index) : mChildren.end();
+  // now perform customization on this child.
+
+  // adopt the child
+  if(childInfo.mActor.GetParent() != Self())
+  {
+    Actor& child = childInfo.mActor;
+    const float depth = std::distance(mChildren.begin(), offset);
+
+    Property::Index depthProperty = child.GetPropertyIndex(Demo::Cluster::CLUSTER_ACTOR_DEPTH);
+    if(depthProperty == Property::INVALID_INDEX)
+    {
+      child.RegisterProperty(Demo::Cluster::CLUSTER_ACTOR_DEPTH, depth);
+    }
+
+    // not added prior
+    Self().Add( childInfo.mActor );
+    mChildren.insert( offset, childInfo );
+
+    // Use parent position plus relative position.
+    child.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
+
+    // remove old constraints
+    child.RemoveConstraints();
+
+    // apply new constraints to the child
+    mClusterStyle.ApplyStyle(child, childInfo.mPositionIndex, AlphaFunctions::EaseOut, 0.0f);
+  }
+  else
+  {
+    // already added.
+    ChildInfoContainer mNewChildren;
+    ChildInfoIter iter = mChildren.begin();
+    float depth = 0.0f;
+
+    for( ; iter != mChildren.end(); ++iter)
+    {
+      if(iter == offset)
+      {
+        SetDepth(childInfo, depth);
+        depth++;
+        // insert the new childInfo before offset.
+        mNewChildren.push_back(childInfo);
+      }
+      // copy all children except the one that we wish to move.
+      if((*iter).mActor != childInfo.mActor)
+      {
+        SetDepth(*iter, depth);
+        depth++;
+        mNewChildren.push_back(*iter);
+      }
+    } // end for.
+
+    if(iter == offset)
+    {
+      SetDepth(childInfo, depth);
+      // insert the new childInfo before offset (end).
+      mNewChildren.push_back(childInfo);
+    }
+
+    mChildren = mNewChildren;
+
+    // Todo somehow adjust their perceived depth.
+  }
+}
+
+void Cluster::SetDepth( ChildInfo& childInfo, float depth )
+{
+  Property::Index depthProperty = childInfo.mActor.GetPropertyIndex(Demo::Cluster::CLUSTER_ACTOR_DEPTH);
+  childInfo.mActor.SetProperty( depthProperty, depth );
+}
+
+ChildInfo Cluster::GetChildInfoAt( unsigned int index )
+{
+  // check if we have this position in the cluster
+  if( index < mChildren.size() )
+  {
+    // return the child handle
+    return mChildren[ index ];
+  }
+
+  // return an empty handle
+  return ChildInfo();
+}
+
+Actor Cluster::GetChildAt( unsigned int index )
+{
+  // check if we have this position in the cluster
+  if( index < mChildren.size() )
+  {
+    // return the child handle
+    return mChildren[ index ].mActor;
+  }
+
+  // return an empty handle
+  return Actor();
+}
+
+Actor Cluster::RemoveChildAt( unsigned int index )
+{
+  DALI_ASSERT_ALWAYS( index < mChildren.size() );
+
+  ChildInfoIter iter = mChildren.begin() + index;
+  Actor child = (*iter).mActor;
+  mChildren.erase( iter );
+  Self().Remove(child);
+  // note: constraints will automatically be removed in OnControlChildRemove
+
+  // update depths.
+  float depth = 0.0f;
+
+  for(ChildInfoIter iter = mChildren.begin(); iter != mChildren.end(); ++iter)
+  {
+    SetDepth(*iter, depth);
+    depth++;
+  } // end for.
+
+  return child;
+}
+
+void Cluster::ExpandChild( unsigned int index )
+{
+  if( index < mChildren.size() )
+  {
+    ChildInfo& childInfo = mChildren[ index ];
+    DALI_ASSERT_ALWAYS(childInfo.mActor);
+
+    if(!childInfo.mExpanded)
+    {
+      // expand child to a random position/angle.
+      const Vector3 clusterSize = Self().GetCurrentSize();
+      const float length = clusterSize.Length() * 0.1f;
+      const float zOffset = 50.0f;
+      const float angle = (rand()%360) * Math::PI / 180.0f;
+      Vector3 position(sin(angle) * length, -cos(angle) * length, zOffset);
+      const float scale(1.2f);
+      const Radian rotate( Degree( (rand()%30) - 15 ) );
+
+      position += childInfo.mActor.GetCurrentPosition();
+
+      TransformChild(index,
+                     position,
+                     Vector3::ONE * scale,
+                     Quaternion(rotate, Vector3::ZAXIS),
+                     AlphaFunctions::EaseOut,
+                     0.5f);
+    }
+  }
+}
+
+void Cluster::ExpandAllChildren()
+{
+  for(unsigned int index = 0;index < mChildren.size(); index++)
+  {
+    ExpandChild( index );
+  }
+}
+
+void Cluster::CollapseChild( unsigned int index, bool front )
+{
+  if( index < mChildren.size() )
+  {
+    RestoreChild(index,
+                 AlphaFunctions::EaseOut,
+                 0.25f,
+                 front);
+  }
+}
+
+void Cluster::CollapseAllChildren( bool front )
+{
+  for(unsigned int index = 0;index < mChildren.size(); index++)
+  {
+    RestoreChild(index,
+                 AlphaFunctions::EaseOut,
+                 0.25f,
+                 front);
+  }
+}
+
+void Cluster::TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period )
+{
+  if( index < mChildren.size() )
+  {
+    ChildInfo& childInfo = mChildren[ index ];
+    DALI_ASSERT_ALWAYS(childInfo.mActor);
+
+    if(!childInfo.mExpanded)
+    {
+      Actor child = childInfo.mActor;
+      childInfo.mExpanded = true;
+      mExpandedCount++;
+
+      child.RemoveConstraints();
+      Animation animation = Animation::New(period.delaySeconds + period.durationSeconds);
+      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();
+    }
+  }
+}
+
+void Cluster::RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front )
+{
+  if( index < mChildren.size() )
+  {
+    ChildInfo& childInfo = mChildren[ index ];
+    DALI_ASSERT_ALWAYS(childInfo.mActor);
+
+    if(childInfo.mExpanded)
+    {
+      Actor child = childInfo.mActor;
+      childInfo.mExpanded = false;
+      mExpandedCount--;
+      mClusterStyle.ApplyStyle( child, childInfo.mPositionIndex, alpha, period );
+
+      const unsigned int hideIndex = front ? mChildren.size() : 0;
+      AddChildInfoAt(childInfo, hideIndex); // move child info to the back or front of the pack.
+    }
+  }
+}
+
+void Cluster::SetBackgroundImage( Actor image )
+{
+  // Replaces the background image.
+  if(mBackgroundImage && mBackgroundImage.GetParent())
+  {
+    mBackgroundImage.GetParent().Remove(mBackgroundImage);
+  }
+
+  mBackgroundImage = image;
+  Self().Add(mBackgroundImage);
+
+  mBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  mBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
+
+  UpdateBackground(0.0f);
+}
+
+void Cluster::SetTitle( Actor text )
+{
+  // Replaces the title actor.
+  if(mTitle && mTitle.GetParent())
+  {
+    mTitle.GetParent().Remove( mTitle );
+  }
+
+  mTitle = text;
+  Self().Add( mTitle );
+
+  mTitle.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  mTitle.SetParentOrigin( ParentOrigin::TOP_LEFT );
+
+  UpdateTitle(0.0f);
+}
+
+void Cluster::SetStyle(Demo::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)
+  if(newChildrenNum < previousChildrenNum)
+  {
+    ChildInfoIter removeStart = mChildren.begin() + newChildrenNum;
+
+    for(ChildInfoIter iter = removeStart; iter != mChildren.end(); ++iter)
+    {
+      Actor child = (*iter).mActor;
+      child.RemoveConstraints();
+      Self().Remove(child);
+    }
+
+    mChildren.erase( removeStart, mChildren.end() );
+  }
+
+  for(ChildInfoIter iter = mChildren.begin(); iter != mChildren.end(); ++iter)
+  {
+
+    if((*iter).mActor)
+    {
+      mClusterStyle.ApplyStyle( (*iter).mActor,
+                        (*iter).mPositionIndex,
+                        AlphaFunctions::EaseOut,
+                        CLUSTER_STYLE_CONSTRAINT_DURATION );
+    }
+  }
+
+  UpdateBackground(CLUSTER_STYLE_CONSTRAINT_DURATION);
+  UpdateTitle(CLUSTER_STYLE_CONSTRAINT_DURATION);
+}
+
+Demo::ClusterStyle Cluster::GetStyle() const
+{
+  return mClusterStyle;
+}
+
+unsigned int Cluster::GetExpandedCount() const
+{
+  return mExpandedCount;
+}
+
+unsigned int Cluster::GetTotalCount() const
+{
+  return mChildren.size();
+}
+
+void Cluster::UpdateBackground(float duration)
+{
+  if (mBackgroundImage)
+  {
+    mClusterStyle.ApplyStyleToBackground(mBackgroundImage, AlphaFunctions::EaseOut, duration);
+  }
+}
+
+void Cluster::UpdateTitle(float duration)
+{
+  if (mTitle)
+  {
+    mClusterStyle.ApplyStyleToTitle(mTitle, AlphaFunctions::EaseOut, duration);
+  }
+}
+
+void Cluster::DoExpandAction(const PropertyValueContainer& attributes)
+{
+  if(attributes.size() >= 1)
+  {
+    for(PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter)
+    {
+      const Property::Value& value = *iter;
+
+      DALI_ASSERT_ALWAYS(value.GetType() == Property::FLOAT);
+      unsigned int index = value.Get<float>();
+      ExpandChild( index );
+    }
+  }
+  else
+  {
+    ExpandAllChildren();
+  }
+}
+
+void Cluster::DoCollapseAction(const PropertyValueContainer& attributes)
+{
+  if(attributes.size() >= 1)
+  {
+    for(PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter)
+    {
+      const Property::Value& value = *iter;
+
+      DALI_ASSERT_ALWAYS(value.GetType() == Property::FLOAT);
+      unsigned int index = value.Get<float>();
+      CollapseChild( index, false );
+    }
+  }
+  else
+  {
+    CollapseAllChildren( false );
+  }
+}
+
+void Cluster::DoTransformAction(const PropertyValueContainer& attributes)
+{
+  DALI_ASSERT_ALWAYS(attributes.size() >= 2);
+
+  DALI_ASSERT_ALWAYS(attributes[0].GetType() == Property::FLOAT);
+  unsigned int index = attributes[0].Get<float>();
+  Vector3 position;
+  Vector3 scale(Vector3::ONE);
+  Quaternion rotation( Dali::ANGLE_0, Vector3::ZAXIS );
+
+  DALI_ASSERT_ALWAYS(attributes[1].GetType() == Property::VECTOR3);
+  attributes[1].Get(position);
+
+  if(attributes.size()>2)
+  {
+    attributes[2].Get(scale);
+  }
+
+  if(attributes.size()>3)
+  {
+    attributes[3].Get(rotation);
+  }
+
+  // wrap index around -1 => size - 1
+  index%= mChildren.size();
+
+  TransformChild(index, position, scale, rotation, AlphaFunctions::EaseOut, 0.5f);
+}
+
+void Cluster::OnControlChildRemove(Actor& child)
+{
+  child.RemoveConstraints();
+}
+
+bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
+{
+  bool ret = false;
+
+  Dali::BaseHandle handle( object );
+
+  Demo::Cluster cluster = Demo::Cluster::DownCast( handle );
+
+  DALI_ASSERT_ALWAYS( cluster );
+
+  if( 0 == strcmp( actionName.c_str(), ACTION_EXPAND ) )
+  {
+    GetImpl( cluster ).DoExpandAction( attributes );
+    ret = true;
+  }
+  else if( 0 == strcmp( actionName.c_str(), ACTION_COLLAPSE ) )
+  {
+    GetImpl( cluster ).DoCollapseAction( attributes );
+    ret = true;
+  }
+  else if( 0 == strcmp( actionName.c_str(), ACTION_TRANSFORM ) )
+  {
+    GetImpl( cluster ).DoTransformAction( attributes );
+    ret = true;
+  }
+
+  return ret;
+}
+
+} // namespace Internal
+
+} // namespace Demo
+
+} // namespace Dali
diff --git a/examples/cluster/cluster-impl.h b/examples/cluster/cluster-impl.h
new file mode 100644 (file)
index 0000000..f57c221
--- /dev/null
@@ -0,0 +1,325 @@
+#ifndef __DALI_DEMO_INTERNAL_CLUSTER_H__
+#define __DALI_DEMO_INTERNAL_CLUSTER_H__
+
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/ref-object.h>
+
+// INTERNAL INCLUDES
+#include "cluster.h"
+#include "cluster-style.h"
+#include <dali-toolkit/public-api/controls/control-impl.h>
+
+namespace Dali
+{
+
+namespace Demo
+{
+
+namespace Internal
+{
+
+class Cluster;
+
+typedef IntrusivePtr<Cluster> ClusterPtr;
+
+class ChildInfo
+{
+
+public:
+
+  ChildInfo()
+  : mExpanded(false)
+  {
+  }
+
+  ChildInfo(Actor actor, unsigned int positionIndex)
+  : mActor(actor),
+    mExpanded(false),
+    mPositionIndex(positionIndex)
+  {
+  }
+
+  Actor mActor;
+  bool mExpanded;
+  unsigned int mPositionIndex;
+};
+
+typedef std::vector<ChildInfo> ChildInfoContainer;
+typedef ChildInfoContainer::iterator ChildInfoIter;
+typedef ChildInfoContainer::const_iterator ChildInfoConstIter;
+
+/**
+ * Cluster is a container of grouped actors positioned in different cluster styles.
+ * Multiple cluster styles may be provided, to determine the position, size, rotation, scale, color and visibility
+ * of the child actors in the cluster.
+ */
+class Cluster : public Toolkit::Internal::Control
+{
+public:
+
+  /**
+   * Create a new Cluster.
+   * @param[in] style of the cluster
+   * @return A public handle to the newly allocated Cluster.
+   */
+  static Dali::Demo::Cluster New(Demo::ClusterStyle& style);
+
+  /**
+   * @copydoc Demo::Cluster::AddChild( Actor child )
+   */
+  void AddChild( Actor child );
+
+  /**
+   * @copydoc Demo::Cluster::AddChild( Actor child, unsigned int positionIndex )
+   */
+  void AddChild( Actor child, unsigned int positionIndex );
+
+  /**
+   * @copydoc Demo::Cluster::AddChildAt( Actor child, unsigned int index );
+   */
+  void AddChildAt( Actor child, unsigned int index );
+
+  /**
+   * @copydoc Demo::Cluster::AddChildAt( Actor child, unsigned int positionIndex, unsigned int index );
+   */
+  void AddChildAt( Actor child, unsigned int positionIndex, unsigned int index );
+
+  /**
+   * Adds a ChildInfo struct to the end of the children list.
+   * @param[in] childInfo the child info to that to children list.
+   */
+  void AddChildInfo( ChildInfo childInfo );
+
+  /**
+   * Adds a ChildInfo struct before the specified index.
+   * @param[in] childInfo the child info to that to children list.
+   * @param[in] index the index within the children list to insert
+   * ChildInfo
+   */
+  void AddChildInfoAt( ChildInfo childInfo, unsigned int index );
+
+  /**
+   * @copydoc Demo::Cluster::GetChildAt
+   */
+  Actor GetChildAt( unsigned int index );
+
+  /**
+   * @copydoc Demo::Cluster::RemoveChildAt
+   */
+  Actor RemoveChildAt( unsigned int index );
+
+  /**
+   * @copydoc Demo::Cluster::ExpandChild
+   */
+  void ExpandChild( unsigned int index );
+
+  /**
+   * @copydoc Demo::Cluster::ExpandAllChildren
+   */
+  void ExpandAllChildren();
+
+  /**
+   * @copydoc Demo::Cluster::CollapseChild
+   */
+  void CollapseChild( unsigned int index, bool front );
+
+  /**
+   * @copydoc Demo::Cluster::CollapseAllChildren
+   */
+  void CollapseAllChildren( bool front );
+
+  /**
+   * @copydoc Demo::Cluster::TransformChild
+   */
+  void TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period );
+
+  /**
+   * @copydoc Demo::Cluster::RestoreChild
+   */
+  void RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front );
+
+  /**
+   * @copydoc Demo::Cluster::SetBackgroundImage
+   */
+  void SetBackgroundImage( Actor image );
+
+  /**
+   * @copydoc Demo::Cluster::SetTitle
+   */
+  void SetTitle( Actor text );
+
+  /**
+   * @copydoc Demo::Cluster::SetStyle
+   */
+  void SetStyle(Demo::ClusterStyle style);
+
+  /**
+   * @copydoc Demo::Cluster::GetStyle
+   */
+  Demo::ClusterStyle GetStyle() const;
+
+  /**
+   * @copydoc Demo::Cluster::GetExpandedCount
+   */
+  unsigned int GetExpandedCount() const;
+
+  /**
+   * @copydoc Demo::Cluster::GetTotalCount
+   */
+  unsigned int GetTotalCount() const;
+
+private:
+
+  ChildInfo GetChildInfoAt( unsigned int index );
+
+  void SetDepth( ChildInfo& childInfo, float depth );
+
+  /**
+   * Updates the style of the Background
+   * (occurs when either background changes or style changes)
+   * @param[in] duration apply duration for style
+   */
+  void UpdateBackground(float duration);
+
+  /**
+   * Updates the style of the Title
+   * (occurs when either background changes or style changes)
+   * @param[in] duration apply duration for style
+   */
+  void UpdateTitle(float duration);
+
+  /**
+   * Action: Expand
+   * Expands one or more actors.
+   *
+   * @param[in] attributes list of indices of actors to expand.
+   * (if no attributes specifies, then all actors expand)
+   */
+  void DoExpandAction(const PropertyValueContainer& attributes);
+
+  /**
+   * Action: Collapse
+   * Collapses one or more actors.
+   *
+   * @param[in] attributes list of indices of actors to collapse.
+   * (if no attributes specifies, then all actors collapse)
+   */
+  void DoCollapseAction(const PropertyValueContainer& attributes);
+
+  /**
+   * Action: Transform
+   * Transforms one actor (index) to a specified position (Vector3),
+   * scale (Vector3), and rotation (Quaternion).
+   *
+   * @param[in] attributes index and transform values.
+   */
+  void DoTransformAction(const PropertyValueContainer& attributes);
+
+private: // From Control
+  /**
+   * From Control; called shortly before a child is removed from the owning actor.
+   * @param[in] child The child being removed.Ptr
+   */
+  virtual void OnControlChildRemove(Actor& child);
+
+public:
+
+  /**
+   * Performs actions as requested using the action name.
+   * @param[in] object The object on which to perform the action.
+   * @param[in] actionName The action to perform.
+   * @param[in] attributes The attributes with which to perfrom this action.
+   * @return true if action has been accepted by this control
+   */
+  static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes);
+
+private: // From Control
+
+  /**
+   * @copydoc Demo::Control::OnInitialize()
+   */
+  virtual void OnInitialize();
+
+  /**
+   *
+   * @copydoc Demo::Control::OnControlSizeSet( const Vector3& targetSize )
+   */
+  virtual void OnControlSizeSet( const Vector3& targetSize );
+
+protected:
+
+  /**
+   * Construct a new Cluster.
+   * @param[in] style of the cluster
+   */
+  Cluster(Demo::ClusterStyle& style);
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~Cluster();
+
+private:
+
+  // Undefined
+  Cluster(const Cluster&);
+
+  // Undefined
+  Cluster& operator=(const Cluster& rhs);
+
+private:
+
+  Demo::ClusterStyle mClusterStyle;
+  ChildInfoContainer mChildren;
+  Vector3 mClusterSize;
+
+  Actor mBackgroundImage;           ///< Stores the background image.
+  Actor mTitle;                     ///< Stores the text title.
+  unsigned int mExpandedCount;      ///< A count of how many children have been expanded.
+
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Demo::Internal::Cluster& GetImpl(Demo::Cluster& cluster)
+{
+  DALI_ASSERT_ALWAYS(cluster);
+
+  Dali::RefObject& handle = cluster.GetImplementation();
+
+  return static_cast<Demo::Internal::Cluster&>(handle);
+}
+
+inline const Demo::Internal::Cluster& GetImpl(const Demo::Cluster& cluster)
+{
+  DALI_ASSERT_ALWAYS(cluster);
+
+  const Dali::RefObject& handle = cluster.GetImplementation();
+
+  return static_cast<const Demo::Internal::Cluster&>(handle);
+}
+
+} // namespace Demo
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_INTERNAL_CLUSTER_H__
diff --git a/examples/cluster/cluster-style-impl.cpp b/examples/cluster/cluster-style-impl.cpp
new file mode 100644 (file)
index 0000000..f73afff
--- /dev/null
@@ -0,0 +1,486 @@
+/*
+ * 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 "cluster-style-impl.h"
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/animation.h>
+
+// INTERNAL INCLUDES
+#include "cluster.h"
+
+namespace Dali
+{
+
+namespace // unnamed namespace
+{
+// Cluster style one
+
+const unsigned int STYLE_1_CHILDREN_NUMBER = 8;
+
+const float STYLE_1_BACKGROUND_IMAGE_OFFSET_Z = 1.0f;
+
+const float STYLE_1_CHILD_OFFSET_Z = 2.0f;
+const float STYLE_1_CHILD_GAP_FACTOR = 0.03f;
+const float STYLE_1_CHILD_SIZE_FACTOR[] = { 0.4f, 0.15f, 0.25f, 0.15f, 0.4f, 0.15f, 0.25f, 0.15f };
+const Vector3 STYLE_1_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            STYLE_1_CHILD_OFFSET_Z),
+                                                    Vector3(0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            0.5f - STYLE_1_CHILD_SIZE_FACTOR[1] - STYLE_1_CHILD_SIZE_FACTOR[2] - STYLE_1_CHILD_GAP_FACTOR * 1.5f,
+                                                            STYLE_1_CHILD_OFFSET_Z + 0.5f),
+                                                    Vector3(0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            0.5f - STYLE_1_CHILD_SIZE_FACTOR[2] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            STYLE_1_CHILD_OFFSET_Z + 1.0f),
+                                                    Vector3(0.5f + STYLE_1_CHILD_SIZE_FACTOR[2] + STYLE_1_CHILD_GAP_FACTOR * 1.5f,
+                                                            0.5f - STYLE_1_CHILD_SIZE_FACTOR[3] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            STYLE_1_CHILD_OFFSET_Z + 1.5f),
+                                                    Vector3(0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            STYLE_1_CHILD_OFFSET_Z + 2.0f),
+                                                    Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[5] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            0.5f + STYLE_1_CHILD_SIZE_FACTOR[6] + STYLE_1_CHILD_GAP_FACTOR * 1.5f,
+                                                            STYLE_1_CHILD_OFFSET_Z + 2.5f),
+                                                    Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[6] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            STYLE_1_CHILD_OFFSET_Z + 3.0f),
+                                                    Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[6] - STYLE_1_CHILD_SIZE_FACTOR[7] - STYLE_1_CHILD_GAP_FACTOR * 1.5f,
+                                                            0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                            STYLE_1_CHILD_OFFSET_Z + 3.5f) };
+
+const Vector3 STYLE_1_TITLE_SIZE_FACTOR = Vector3(0.3f, 0.11f, 1.0f);
+const Vector3 STYLE_1_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
+                                                        0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f - STYLE_1_TITLE_SIZE_FACTOR.height + 0.02f,
+                                                        0.0f);
+const Vector3 STYLE_1_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f);
+
+// Cluster style two
+
+const unsigned int STYLE_2_CHILDREN_NUMBER = 6;
+
+const float STYLE_2_BACKGROUND_IMAGE_OFFSET_Z = 1.0f;
+
+const float STYLE_2_CHILD_OFFSET_Z = 2.0f;
+const float STYLE_2_CHILD_GAP_FACTOR = 0.03f;
+const float STYLE_2_CHILD_SIZE_FACTOR[] = { 0.4f, 0.25f, 0.15f, 0.4f, 0.25f, 0.15f };
+const Vector3 STYLE_2_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] - STYLE_2_CHILD_GAP_FACTOR * 0.5f,
+                                                            0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] * 0.75f,
+                                                            STYLE_2_CHILD_OFFSET_Z),
+                                                    Vector3(0.5f + STYLE_2_CHILD_GAP_FACTOR * 0.5f,
+                                                            0.5f - STYLE_2_CHILD_SIZE_FACTOR[1] - STYLE_2_CHILD_SIZE_FACTOR[3] * 0.25f - STYLE_2_CHILD_GAP_FACTOR,
+                                                            STYLE_2_CHILD_OFFSET_Z + 0.5f),
+                                                    Vector3(0.5f + STYLE_2_CHILD_SIZE_FACTOR[1] + STYLE_2_CHILD_GAP_FACTOR * 1.5f,
+                                                            0.5f - STYLE_2_CHILD_SIZE_FACTOR[2] - STYLE_2_CHILD_SIZE_FACTOR[3] * 0.25f - STYLE_2_CHILD_GAP_FACTOR,
+                                                            STYLE_2_CHILD_OFFSET_Z + 1.0f),
+                                                    Vector3(0.5f + STYLE_2_CHILD_GAP_FACTOR * 0.5f,
+                                                            0.5f - STYLE_2_CHILD_SIZE_FACTOR[3] * 0.25f,
+                                                            STYLE_2_CHILD_OFFSET_Z + 1.5f),
+                                                    Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[4] - STYLE_2_CHILD_GAP_FACTOR * 0.5f,
+                                                            0.5f + STYLE_2_CHILD_SIZE_FACTOR[0] * 0.25f + STYLE_2_CHILD_GAP_FACTOR,
+                                                            STYLE_2_CHILD_OFFSET_Z + 2.0f),
+                                                    Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[4] - STYLE_2_CHILD_SIZE_FACTOR[5] - STYLE_2_CHILD_GAP_FACTOR * 1.5f,
+                                                            0.5f + STYLE_2_CHILD_SIZE_FACTOR[0] * 0.25f + STYLE_2_CHILD_GAP_FACTOR,
+                                                            STYLE_2_CHILD_OFFSET_Z + 2.5f) };
+
+const Vector3 STYLE_2_TITLE_SIZE_FACTOR = Vector3(0.3f, 0.11f, 1.0f);
+const Vector3 STYLE_2_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] - STYLE_2_CHILD_GAP_FACTOR * 0.5f,
+                                                        0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] * 0.75f - STYLE_2_TITLE_SIZE_FACTOR.height + 0.02f,
+                                                        0.0f);
+const Vector3 STYLE_2_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f);
+
+// Cluster style three
+
+const unsigned int STYLE_3_CHILDREN_NUMBER = 6;
+
+const Vector3 STYLE_3_TITLE_SIZE_FACTOR = Vector3(0.4f, 0.15f, 1.0f);
+
+const float STYLE_3_BACKGROUND_IMAGE_OFFSET_Z = 1.0f;
+
+const float STYLE_3_CHILD_OFFSET_Z = 2.0f;
+const float STYLE_3_CHILD_GAP_FACTOR = 0.03f;
+const float STYLE_3_CHILD_SIZE_FACTOR[] = { 0.4f, 0.4f, 0.15f, 0.25f, 0.25f, 0.15f };
+const float STYLE_3_CHILD_POSITION_OFFSET_Y = (1.0f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_SIZE_FACTOR[3] - STYLE_3_CHILD_GAP_FACTOR - STYLE_3_TITLE_SIZE_FACTOR.height) * 0.5f;
+const Vector3 STYLE_3_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f,
+                                                              0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
+                                                              STYLE_3_CHILD_OFFSET_Z),
+                                                      Vector3(0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f,
+                                                              0.5f - STYLE_3_CHILD_SIZE_FACTOR[1] - STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
+                                                              STYLE_3_CHILD_OFFSET_Z + 0.5f),
+                                                      Vector3(0.5f + STYLE_3_CHILD_SIZE_FACTOR[3] + STYLE_3_CHILD_GAP_FACTOR * 1.5f,
+                                                              0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
+                                                              STYLE_3_CHILD_OFFSET_Z + 1.0f),
+                                                      Vector3(0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f,
+                                                              0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
+                                                              STYLE_3_CHILD_OFFSET_Z + 1.5f),
+                                                      Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[4] - STYLE_3_CHILD_GAP_FACTOR * 0.5f,
+                                                              0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
+                                                              STYLE_3_CHILD_OFFSET_Z + 2.0f),
+                                                      Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[4] - STYLE_3_CHILD_SIZE_FACTOR[5] - STYLE_3_CHILD_GAP_FACTOR * 1.5f,
+                                                              0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
+                                                              STYLE_3_CHILD_OFFSET_Z + 2.5f) };
+
+const Vector3 STYLE_3_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f,
+                                                          0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y - STYLE_3_TITLE_SIZE_FACTOR.height + 0.02f,
+                                                          0.0f);
+const Vector3 STYLE_3_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f);
+
+// Cluster style four
+
+const unsigned int STYLE_4_CHILDREN_NUMBER = 6;
+
+const float STYLE_4_BACKGROUND_IMAGE_OFFSET_Z = 1.0f;
+
+const float STYLE_4_CHILD_OFFSET_Z = 2.0f;
+const float STYLE_4_CHILD_GAP_FACTOR = 0.03f;
+const float STYLE_4_CHILD_SIZE_FACTOR[] = { 0.4f, 0.22f, 0.13f, 0.4f, 0.22f, 0.13f };
+const Vector3 STYLE_4_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] * 0.9f,
+                                                             0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] - STYLE_4_CHILD_GAP_FACTOR * 0.5f,
+                                                             STYLE_4_CHILD_OFFSET_Z),
+                                                     Vector3(0.5f + STYLE_4_CHILD_SIZE_FACTOR[0] * 0.1f + STYLE_4_CHILD_GAP_FACTOR,
+                                                             0.5f - STYLE_4_CHILD_SIZE_FACTOR[1] - STYLE_4_CHILD_GAP_FACTOR * 0.5f,
+                                                             STYLE_4_CHILD_OFFSET_Z + 0.5f),
+                                                     Vector3(0.5f + STYLE_4_CHILD_SIZE_FACTOR[0] * 0.1f + STYLE_4_CHILD_SIZE_FACTOR[1] + STYLE_4_CHILD_GAP_FACTOR * 2.0f,
+                                                             0.5f - STYLE_4_CHILD_SIZE_FACTOR[2] - STYLE_4_CHILD_GAP_FACTOR * 0.5f,
+                                                             STYLE_4_CHILD_OFFSET_Z + 1.0f),
+                                                     Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[3] * 0.1f,
+                                                             0.5f + STYLE_4_CHILD_GAP_FACTOR * 0.5f,
+                                                             STYLE_4_CHILD_OFFSET_Z + 1.5f),
+                                                     Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[3] * 0.1f - STYLE_4_CHILD_SIZE_FACTOR[4] - STYLE_4_CHILD_GAP_FACTOR,
+                                                             0.5f + STYLE_4_CHILD_GAP_FACTOR * 0.5f,
+                                                             STYLE_4_CHILD_OFFSET_Z + 2.0f),
+                                                     Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[3] * 0.1f - STYLE_4_CHILD_SIZE_FACTOR[4] - STYLE_4_CHILD_SIZE_FACTOR[5] - STYLE_4_CHILD_GAP_FACTOR * 2.0f,
+                                                             0.5f + STYLE_4_CHILD_GAP_FACTOR * 0.5f,
+                                                             STYLE_4_CHILD_OFFSET_Z + 2.5f) };
+
+const Vector3 STYLE_4_TITLE_SIZE_FACTOR = Vector3(0.3f, 0.11f, 1.0f);
+const Vector3 STYLE_4_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] * 0.9f,
+                                                         0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] - STYLE_4_CHILD_GAP_FACTOR * 0.5f - STYLE_4_TITLE_SIZE_FACTOR.height + 0.02f,
+                                                         0.0f);
+const Vector3 STYLE_4_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f);
+const unsigned int CLUSTER_RANDOM_SEED(0x17eac9f3);         ///< Random seed for cluster data.
+
+const int STYLE_RANDOM_CHILDREN_NUMBER = 16;
+
+Vector3 FirstOrderEquation( const Vector3& source, const Vector3& relative, const Vector3& offset = Vector3::ZERO  )
+{
+  return source * relative + offset;
+}
+
+// random data generator //////////////////////////////////////////////////////
+
+const unsigned int GEN_RAND_CONST = 0x15d9a373;
+
+unsigned int genRandom(unsigned int& seed, unsigned int offset)
+{
+  unsigned int shft = offset&31;
+
+  offset++;
+
+  seed^= (seed << (shft) | seed >> (32 - shft)) * (offset * GEN_RAND_CONST);
+
+  return seed;
+}
+
+float genRandomFloat(unsigned int& seed, unsigned int offset, float min, float max)
+{
+  const float f = static_cast<float>(genRandom(seed, offset)) / 0xffffffff;
+  return f * (max - min) + min;
+}
+
+} // unnamed namespace
+
+namespace Demo
+{
+
+namespace Internal
+{
+
+// ClusterStyle ///////////////////////////////////////////////////////////////
+
+ClusterStyle::ClusterStyle()
+: mMaxChildren(0),
+  mTitlePositionRelative(Vector3::ONE),
+  mTitlePositionOffset(Vector3::ZERO),
+  mTitleSize(Vector3::ONE),
+  mBackgroundPositionRelative(Vector3::ONE),
+  mBackgroundPositionOffset(Vector3::ZERO),
+  mBackgroundSize(Vector3::ONE),
+  mClusterSize( Vector3::ZERO )
+{
+}
+
+ClusterStyle::~ClusterStyle()
+{
+
+}
+
+void ClusterStyle::SetMaximumNumberOfChildren(unsigned int maxChildren)
+{
+  mMaxChildren = maxChildren;
+}
+
+unsigned int ClusterStyle::GetMaximumNumberOfChildren() const
+{
+  return mMaxChildren;
+}
+
+void ClusterStyle::ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds)
+{
+  Apply( background,
+         FirstOrderEquation( GetClusterSize(), mBackgroundPositionRelative, mBackgroundPositionOffset ),
+         FirstOrderEquation( GetClusterSize(), mBackgroundSize ),
+         alpha,
+         durationSeconds);
+}
+
+void ClusterStyle::ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds)
+{
+  Apply( title,
+         FirstOrderEquation( GetClusterSize(), mTitlePositionRelative, mTitlePositionOffset ),
+         FirstOrderEquation( GetClusterSize(), mTitleSize ),
+         alpha,
+         durationSeconds);
+}
+
+void ClusterStyle::SetTitleProperties(const Vector3& relativePosition,
+                                      const Vector3& offsetPosition,
+                                      const Vector3& size)
+{
+  mTitlePositionRelative = relativePosition;
+  mTitlePositionOffset = offsetPosition;
+  mTitleSize = size;
+}
+
+void ClusterStyle::SetBackgroundProperties(const Vector3& relativePosition,
+                                           const Vector3& offsetPosition,
+                                           const Vector3& size)
+{
+  mBackgroundPositionRelative = relativePosition;
+  mBackgroundPositionOffset = offsetPosition;
+  mBackgroundSize = size;
+}
+
+void ClusterStyle::SetClusterSize( const Vector3& clusterSize )
+{
+  mClusterSize = clusterSize;
+}
+
+Vector3 ClusterStyle::GetClusterSize() const
+{
+  return mClusterSize;
+}
+
+void ClusterStyle::Apply( Actor actor,
+                          const Vector3& position,
+                          const Vector3& size,
+                          AlphaFunction alpha,
+                          const TimePeriod& durationSeconds)
+{
+  float animationDuration = durationSeconds.delaySeconds + durationSeconds.durationSeconds;
+  if( animationDuration > 0.f )
+  {
+    Animation animation = Animation::New(animationDuration);
+    animation.AnimateTo( Property( actor, Actor::Property::POSITION ), position, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
+    animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
+    animation.Play();
+  }
+  else
+  {
+    actor.SetPosition( position );
+    actor.SetSize( size );
+  }
+}
+
+void ClusterStyle::Apply( Actor actor,
+                          const Vector3& position,
+                          const Vector3& size,
+                          const Quaternion& rotation,
+                          const Vector3& scale,
+                          AlphaFunction alpha,
+                          const TimePeriod& durationSeconds)
+{
+  float animationDuration = durationSeconds.delaySeconds + durationSeconds.durationSeconds;
+  if( animationDuration > 0.f )
+  {
+    Animation animation = Animation::New(animationDuration);
+    animation.AnimateTo( Property( actor, Actor::Property::POSITION ), position, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
+    animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
+    animation.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), rotation, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
+    animation.AnimateTo( Property( actor, Actor::Property::SCALE ), scale, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
+    animation.Play();
+  }
+  else
+  {
+    actor.SetPosition( position );
+    actor.SetSize( size );
+    actor.SetOrientation( rotation );
+    actor.SetScale( scale );
+  }
+}
+
+// ClusterStyleStandard ///////////////////////////////////////////////////////
+
+ClusterStylePtr ClusterStyleStandard::New(StyleType style)
+{
+  ClusterStylePtr impl( new ClusterStyleStandard(style) );
+
+  return impl;
+}
+
+ClusterStyleStandard::ClusterStyleStandard(StyleType style)
+: ClusterStyle(),
+  mSizes(NULL),
+  mPositions(NULL)
+{
+  switch(style)
+  {
+    case Demo::ClusterStyleStandard::ClusterStyle1:
+    {
+      SetMaximumNumberOfChildren(STYLE_1_CHILDREN_NUMBER);
+      SetSizes(STYLE_1_CHILD_SIZE_FACTOR);
+      SetPositions(STYLE_1_CHILD_POSITION_FACTOR);
+      SetTitleProperties(STYLE_1_TITLE_POSITION_FACTOR,
+                         STYLE_1_TITLE_POSITION_OFFSET,
+                         STYLE_1_TITLE_SIZE_FACTOR);
+      SetBackgroundProperties(Vector3::ZERO,
+                              Vector3(0.0f, 0.0f, STYLE_1_BACKGROUND_IMAGE_OFFSET_Z),
+                              Vector3::ONE);
+      break;
+    }
+    case Demo::ClusterStyleStandard::ClusterStyle2:
+    {
+      SetMaximumNumberOfChildren(STYLE_2_CHILDREN_NUMBER);
+      SetSizes(STYLE_2_CHILD_SIZE_FACTOR);
+      SetPositions(STYLE_2_CHILD_POSITION_FACTOR);
+      SetTitleProperties(STYLE_2_TITLE_POSITION_FACTOR,
+                         STYLE_2_TITLE_POSITION_OFFSET,
+                         STYLE_2_TITLE_SIZE_FACTOR);
+      SetBackgroundProperties(Vector3::ZERO,
+                              Vector3(0.0f, 0.0f, STYLE_2_BACKGROUND_IMAGE_OFFSET_Z),
+                              Vector3::ONE);
+      break;
+    }
+    case Demo::ClusterStyleStandard::ClusterStyle3:
+    {
+      SetMaximumNumberOfChildren(STYLE_3_CHILDREN_NUMBER);
+      SetSizes(STYLE_3_CHILD_SIZE_FACTOR);
+      SetPositions(STYLE_3_CHILD_POSITION_FACTOR);
+      SetTitleProperties(STYLE_3_TITLE_POSITION_FACTOR,
+                         STYLE_3_TITLE_POSITION_OFFSET,
+                         STYLE_3_TITLE_SIZE_FACTOR);
+      SetBackgroundProperties(Vector3::ZERO,
+                              Vector3(0.0f, 0.0f, STYLE_3_BACKGROUND_IMAGE_OFFSET_Z),
+                              Vector3::ONE);
+      break;
+    }
+    case Demo::ClusterStyleStandard::ClusterStyle4:
+    {
+      SetMaximumNumberOfChildren(STYLE_4_CHILDREN_NUMBER);
+      SetSizes(STYLE_4_CHILD_SIZE_FACTOR);
+      SetPositions(STYLE_4_CHILD_POSITION_FACTOR);
+      SetTitleProperties(STYLE_4_TITLE_POSITION_FACTOR,
+                         STYLE_4_TITLE_POSITION_OFFSET,
+                         STYLE_4_TITLE_SIZE_FACTOR);
+      SetBackgroundProperties(Vector3::ZERO,
+                              Vector3(0.0f, 0.0f, STYLE_4_BACKGROUND_IMAGE_OFFSET_Z),
+                              Vector3::ONE);
+      break;
+    }
+    default:
+    {
+      DALI_ASSERT_ALWAYS(false && "Invalid Style");
+      break;
+    }
+  } // end switch
+}
+
+void ClusterStyleStandard::SetSizes(const float *sizes)
+{
+  mSizes = sizes;
+}
+
+void ClusterStyleStandard::SetPositions(const Vector3 *positions)
+{
+  mPositions = positions;
+}
+
+void ClusterStyleStandard::ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds)
+{
+  if(mPositions)
+  {
+    const float& size = mSizes[index];
+    // counter top-left parent origin and top-left anchor point.
+    const Vector3 position = mPositions[index] - Vector3(0.5f, 0.5f, 0.0f) + Vector3(size, size, 0.0f) * 0.5f;
+
+    Apply( child,
+           FirstOrderEquation( GetClusterSize(), Vector3(position.x, position.y, 0.0f), Vector3(0.0f, 0.0f, position.z) ),
+           FirstOrderEquation( GetClusterSize(), Vector3::ONE * size ),
+           Quaternion(),
+           Vector3::ONE,
+           alpha,
+           durationSeconds);
+  }
+}
+
+// ClusterStyleRandom /////////////////////////////////////////////////////////
+
+ClusterStylePtr ClusterStyleRandom::New()
+{
+  ClusterStylePtr impl( new ClusterStyleRandom() );
+
+  return impl;
+}
+
+ClusterStyleRandom::ClusterStyleRandom()
+: ClusterStyle()
+{
+  SetMaximumNumberOfChildren(STYLE_RANDOM_CHILDREN_NUMBER);
+  SetTitleProperties(Vector3::ZERO,
+                     Vector3::ZERO,
+                     Vector3::ONE);
+  SetBackgroundProperties(Vector3::ZERO,
+                          Vector3(0.0f, 0.0f, 0.0f),
+                          Vector3::ONE);
+}
+
+void ClusterStyleRandom::ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds)
+{
+  unsigned int seed = CLUSTER_RANDOM_SEED;
+  const float size = 0.5f;
+  const float rotation = genRandomFloat(seed, index, -1.0f, 1.0f) * Math::PI * 0.1; // +/- 18 degrees
+  const Vector3 position(genRandomFloat(seed, index, -0.1f, 0.1f),
+                         genRandomFloat(seed, index, -0.1f, 0.1f),
+                         0.0f);
+
+  Property::Index depthProperty = child.GetPropertyIndex(Demo::Cluster::CLUSTER_ACTOR_DEPTH);
+  float depthPropertyValue = child.GetProperty<float>( depthProperty );
+
+  Apply( child,
+         FirstOrderEquation( GetClusterSize(), Vector3(position.x, position.y, 0.0f), Vector3(0.0f, 0.0f, depthPropertyValue) ),
+         FirstOrderEquation( GetClusterSize(), Vector3::ONE * size),
+         Quaternion( Radian( rotation ), Vector3::ZAXIS ),
+         Vector3::ONE,
+         alpha,
+         durationSeconds);
+}
+
+} // namespace Internal
+
+} // namespace Demo
+
+} // namespace Dali
diff --git a/examples/cluster/cluster-style-impl.h b/examples/cluster/cluster-style-impl.h
new file mode 100644 (file)
index 0000000..8b0e9d0
--- /dev/null
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/vector3.h>
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include "cluster-style.h"
+
+namespace Dali
+{
+
+namespace Demo
+{
+
+namespace Internal
+{
+
+class ClusterStyle;
+
+typedef IntrusivePtr<ClusterStyle>       ClusterStylePtr;
+
+/**
+ * ClusterStyle internal implementation
+ */
+class ClusterStyle : public Dali::BaseObject
+{
+public:
+
+  /**
+   * @copydoc Demo::ClusterStyle::GetMaximumNumberOfChildren
+   */
+  unsigned int GetMaximumNumberOfChildren() const;
+
+  /**
+   * @copydoc Demo::ClusterStyle::ApplyStyle
+   */
+  virtual void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds) = 0;
+
+  /**
+   * @copydoc Demo::ClusterStyle::ApplyStyleToBackground
+   */
+  virtual void ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds);
+
+  /**
+   * @copydoc Demo::ClusterStyle::ApplyStyleToTitle
+   */
+  virtual void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds);
+
+  /**
+    * Set the size of cluster
+    */
+  void SetClusterSize( const Vector3& clusterSize );
+
+protected:
+
+  /**
+   * Set the maximum number of children this Style can handle.
+   * @param[in] The maximum number of children.
+   */
+  void SetMaximumNumberOfChildren(unsigned int children);
+
+  /**
+   * Set the title properties
+   * @param[in] relativePosition Relative position of the title
+   * @param[in] offsetPosition Offset position of the title
+   * @param[in] size The size of the title
+   */
+  void SetTitleProperties(const Vector3& relativePosition,
+                          const Vector3& offsetPosition,
+                          const Vector3& size);
+
+  /**
+   * Set the background properties
+   * @param[in] relativePosition Relative position of the background
+   * @param[in] offsetPosition Offset position of the background
+   * @param[in] size The size of the title
+   */
+  void SetBackgroundProperties(const Vector3& relativePosition,
+                               const Vector3& offsetPosition,
+                               const Vector3& size);
+
+  /**
+   * Get the size of cluster.
+   * @return the cluster size
+   */
+   Vector3 GetClusterSize() const;
+
+   /**
+    * Apply the given position & size to the actor
+    * @param[in] position The target position
+    * @param[in] size The target size
+    * @param[in] size The size to resize to
+    * @param[in] alpha The alpha function to use.
+    * @param[in] durationSeconds The time period to apply this style.
+    */
+   void Apply( Actor actor,
+               const Vector3& position,
+               const Vector3& size,
+               AlphaFunction alpha,
+               const TimePeriod& durationSeconds);
+   /**
+    * Apply the given position & size to the actor
+    * @param[in] actor The actor to apply the changes
+    * @param[in] position The target position
+    * @param[in] size The target size
+    * @param[in] rotation The target Quaternion value
+    * @param[in] scale The target scale
+    * @param[in] alpha The alpha function to use.
+    * @param[in] durationSeconds The time period to apply this style.
+    */
+   void Apply( Actor actor,
+               const Vector3& position,
+               const Vector3& size,
+               const Quaternion& rotation,
+               const Vector3& scale,
+               AlphaFunction alpha,
+               const TimePeriod& durationSeconds);
+
+protected:
+
+  /**
+   * Protected constructor see ClusterStyle::New().
+   */
+  ClusterStyle();
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~ClusterStyle();
+
+protected:
+
+  unsigned int mMaxChildren;                      ///< Maximum number of children that this style supports
+  Vector3 mTitlePositionRelative;                 ///< Title's position relative to size of cluster
+  Vector3 mTitlePositionOffset;                   ///< Title's position offset
+  Vector3 mTitleSize;                             ///< Title's size relative to size of cluster
+  Vector3 mBackgroundPositionRelative;            ///< Background's position relative to size of cluster
+  Vector3 mBackgroundPositionOffset;              ///< Background's position offset
+  Vector3 mBackgroundSize;                        ///< Background's size relative to size of cluster
+  Vector3 mClusterSize;                           ///< The size of cluster
+};
+
+/**
+ * ClusterStyleStandard internal implementation
+ */
+class ClusterStyleStandard : public ClusterStyle
+{
+public:
+
+  typedef Demo::ClusterStyleStandard::StyleType StyleType;
+
+public:
+
+  /**
+   * Create a new cluster style.
+   * @param[in] style The style type to create.
+   * @return A smart-pointer to the newly allocated ClusterStyle.
+   */
+  static ClusterStylePtr New(StyleType style);
+
+public:
+
+  /**
+   * @copydoc Demo::ClusterStyle::ApplyStyle
+   */
+  void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds);
+
+private:
+
+  /**
+   * Set the relative sizes of the children
+   * @param[in] size The list of sizes for the children
+   */
+  void SetSizes(const float *sizes);
+
+  /**
+   * Set the relative positions of the children
+   * @param[in] positions The list of positions for the children
+   */
+  void SetPositions(const Vector3 *positions);
+
+protected:
+
+  /**
+   * Protected constructor see ClusterStyleRandom::New().
+   */
+  ClusterStyleStandard(StyleType style);
+
+private:
+
+  const float *mSizes;                            ///< List of sizes
+  const Vector3 *mPositions;                      ///< List of positions
+
+};
+
+/**
+ * ClusterStyleRandom internal implementation
+ */
+class ClusterStyleRandom : public ClusterStyle
+{
+public:
+
+  /**
+   * Create a new cluster style.
+   * @return A smart-pointer to the newly allocated ClusterStyle.
+   */
+  static ClusterStylePtr New();
+
+public:
+
+  /**
+   * @copydoc Demo::ClusterStyle::ApplyStyle
+   */
+  void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds);
+
+protected:
+
+  /**
+   * Protected constructor see ClusterStyleRandom::New().
+   */
+  ClusterStyleRandom();
+
+private:
+
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::ClusterStyle& GetImpl(Demo::ClusterStyle& pub)
+{
+  DALI_ASSERT_ALWAYS(pub);
+
+  Dali::RefObject& handle = pub.GetBaseObject();
+
+  return static_cast<Internal::ClusterStyle&>(handle);
+}
+
+inline const Internal::ClusterStyle& GetImpl(const Demo::ClusterStyle& pub)
+{
+  DALI_ASSERT_ALWAYS(pub);
+
+  const Dali::RefObject& handle = pub.GetBaseObject();
+
+  return static_cast<const Internal::ClusterStyle&>(handle);
+}
+
+} // namespace Demo
+
+} // namespace Dali
diff --git a/examples/cluster/cluster-style.cpp b/examples/cluster/cluster-style.cpp
new file mode 100644 (file)
index 0000000..91c4c1c
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2015 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 "cluster-style.h"
+
+// EXTERNAL INCLUDES
+#include <limits>
+
+// INTERNAL INCLUDES
+#include "cluster-style-impl.h"
+
+using namespace Dali;
+using namespace Dali::Demo;
+
+namespace Dali
+{
+
+namespace Demo
+{
+
+// ClusterStyle ///////////////////////////////////////////////////////////////
+
+const unsigned int ClusterStyle::UNLIMITED_CHILDREN = std::numeric_limits<unsigned int>::max();
+
+ClusterStyle::ClusterStyle()
+{
+}
+
+ClusterStyle::~ClusterStyle()
+{
+}
+
+ClusterStyle::ClusterStyle(Internal::ClusterStyle* internal)
+: BaseHandle(internal)
+{
+}
+
+unsigned int ClusterStyle::GetMaximumNumberOfChildren() const
+{
+  return GetImpl(*this).GetMaximumNumberOfChildren();
+}
+
+void ClusterStyle::ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds)
+{
+  GetImpl(*this).ApplyStyle(child, index, alpha, durationSeconds);
+}
+
+void ClusterStyle::ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds)
+{
+  GetImpl(*this).ApplyStyleToBackground(background, alpha, durationSeconds);
+}
+
+void ClusterStyle::ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds)
+{
+  GetImpl(*this).ApplyStyleToTitle(title, alpha, durationSeconds);
+}
+
+// ClusterStyleStandard ///////////////////////////////////////////////////////
+
+ClusterStyleStandard ClusterStyleStandard::New(StyleType style)
+{
+  Internal::ClusterStylePtr internal = Internal::ClusterStyleStandard::New(style);
+
+  return ClusterStyleStandard(internal.Get());
+}
+
+ClusterStyleStandard::ClusterStyleStandard(Internal::ClusterStyle* internal)
+: ClusterStyle(internal)
+{
+}
+
+// ClusterStyleRandom /////////////////////////////////////////////////////////
+
+ClusterStyleRandom ClusterStyleRandom::New()
+{
+  Internal::ClusterStylePtr internal = Internal::ClusterStyleRandom::New();
+
+  return ClusterStyleRandom(internal.Get());
+}
+
+ClusterStyleRandom::ClusterStyleRandom(Internal::ClusterStyle* internal)
+: ClusterStyle(internal)
+{
+}
+
+} // namespace Demo
+
+} // namespace Dali
diff --git a/examples/cluster/cluster-style.h b/examples/cluster/cluster-style.h
new file mode 100644 (file)
index 0000000..ce2fabc
--- /dev/null
@@ -0,0 +1,183 @@
+#ifndef __DALI_DEMO_CLUSTER_STYLE_H__
+#define __DALI_DEMO_CLUSTER_STYLE_H__
+
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/animation/alpha-functions.h>
+#include <dali/public-api/animation/time-period.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-handle.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/enums.h>
+
+namespace Dali
+{
+
+class Actor;
+
+namespace Demo
+{
+
+namespace Internal DALI_INTERNAL
+{
+class ClusterStyle;
+class ClusterStyleRandom;
+}
+
+class ClusterStyle;
+
+typedef IntrusivePtr<ClusterStyle> ClusterStylePtr; ///< Pointer to a Dali::Demo::ClusterStyle object
+
+/**
+ * @brief A ClusterStyle describes the constraints which are imposed on the child actors in the cluster.
+ */
+class ClusterStyle : public Dali::BaseHandle
+{
+public:
+
+  static const unsigned int UNLIMITED_CHILDREN; ///< Constant that represents an unlimited number of children.
+
+public:
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   */
+  ~ClusterStyle();
+
+  /**
+   * @brief Query the maximum number of children this Style can handle.
+   *
+   * If return value is UNLIMITED_CHILDREN, then this style has no
+   * limit.
+   * @return The maximum number of children.
+   */
+  unsigned int GetMaximumNumberOfChildren() const;
+
+  /**
+   * @brief Applies style (position) to child actor over a specified time duration.
+   *
+   * @param[in] child The child actor to apply
+   * @param[in] index The style position index for the actor to transform to.
+   * @param[in] alpha The alpha function to use.
+   * @param[in] durationSeconds The time period to apply this style.
+   */
+  void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds);
+
+  /**
+   * @brief Applies style to background actor over a specified time duration.
+   *
+   * @param[in] background The background actor to apply
+   * @param[in] alpha The alpha function to use.
+   * @param[in] durationSeconds The time period to apply this style.
+   */
+  void ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds);
+
+  /**
+   * @brief Applies style to title actor over a specified time duration.
+   *
+   * @param[in] title The title actor to apply
+   * @param[in] alpha The alpha function to use.
+   * @param[in] durationSeconds The time period to apply this style.
+   */
+  void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds);
+
+protected:
+
+  /**
+   * @brief Create a new ClusterStyle; Only derived versions are instantiatable.
+   */
+  ClusterStyle();
+
+public: // Not intended for application developers
+
+  /**
+   * @brief This constructor is used by Dali New() methods.
+   *
+   * @param [in] internal A pointer to a newly allocated Dali resource
+   */
+  explicit DALI_INTERNAL ClusterStyle(Internal::ClusterStyle* internal);
+};
+
+/**
+ * @brief A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster.
+ */
+class ClusterStyleStandard : public ClusterStyle
+{
+public:
+
+  /**
+   * @brief Cluster Style type.
+   */
+  enum StyleType
+  {
+    ClusterStyle1,     ///< Style number 1
+    ClusterStyle2,     ///< Style number 2
+    ClusterStyle3,     ///< Style number 3
+    ClusterStyle4,     ///< Style number 4
+    TotalClusterStyles ///< The number of styles
+  };
+
+public:
+
+  /**
+   * @brief Create an initialized style.
+   */
+  static ClusterStyleStandard New(StyleType style);
+
+public: // Not intended for application developers
+
+  /**
+   * @brief This constructor is used by Dali New() methods.
+   *
+   * @param [in] internal A pointer to a newly allocated Dali resource
+   */
+  explicit DALI_INTERNAL ClusterStyleStandard(Internal::ClusterStyle* internal);
+};
+
+/**
+ * @brief A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster.
+ */
+class ClusterStyleRandom : public ClusterStyle
+{
+public:
+
+  /**
+   * @brief Create an initialized style.
+   */
+  static ClusterStyleRandom New();
+
+public: // Not intended for application developers
+
+  /**
+   * @brief This constructor is used by Dali New() methods.
+   *
+   * @param [in] internal A pointer to a newly allocated Dali resource
+   */
+  explicit DALI_INTERNAL ClusterStyleRandom(Internal::ClusterStyle* internal);
+};
+
+} // namespace Demo
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_CLUSTER_STYLE_H__
diff --git a/examples/cluster/cluster.cpp b/examples/cluster/cluster.cpp
new file mode 100644 (file)
index 0000000..76b8cf6
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2015 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 "cluster.h"
+
+// INTERNAL INCLUDES
+
+#include "cluster-impl.h"
+
+namespace Dali
+{
+
+namespace Demo
+{
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Cluster
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+const std::string Cluster::CLUSTER_ACTOR_DEPTH( "cluster-actor-depth" );
+
+Cluster::Cluster()
+{
+}
+
+Cluster::Cluster(const Cluster& cluster)
+: Toolkit::Control(cluster)
+{
+}
+
+Cluster& Cluster::operator =(const Cluster& cluster)
+{
+  if( &cluster != this )
+  {
+    Toolkit::Control::operator=( cluster );
+  }
+  return *this;
+}
+
+Cluster::~Cluster()
+{
+}
+
+Cluster Cluster::New( ClusterStyle& style )
+{
+  return Internal::Cluster::New(style);
+}
+
+Cluster Cluster::DownCast( BaseHandle handle )
+{
+  return Toolkit::Control::DownCast<Cluster, Internal::Cluster>(handle);
+}
+
+void Cluster::AddChild( Actor child )
+{
+  GetImpl(*this).AddChild( child );
+}
+
+void Cluster::AddChild( Actor child, unsigned int positionIndex )
+{
+  GetImpl(*this).AddChild( child, positionIndex);
+}
+
+void Cluster::AddChildAt( Actor child, unsigned int index )
+{
+  GetImpl(*this).AddChildAt( child, index );
+}
+
+void Cluster::AddChildAt( Actor child, unsigned int positionIndex, unsigned int index )
+{
+  GetImpl(*this).AddChildAt( child, positionIndex, index );
+}
+
+Actor Cluster::GetChildAt( unsigned int index )
+{
+  return GetImpl(*this).GetChildAt(index);
+}
+
+Actor Cluster::RemoveChildAt( unsigned int index )
+{
+  return GetImpl(*this).RemoveChildAt(index);
+}
+
+void Cluster::ExpandChild( unsigned int index )
+{
+  GetImpl(*this).ExpandChild(index);
+}
+
+void Cluster::ExpandAllChildren()
+{
+  GetImpl(*this).ExpandAllChildren();
+}
+
+void Cluster::CollapseChild( unsigned int index, bool front )
+{
+  GetImpl(*this).CollapseChild(index, front);
+}
+
+void Cluster::CollapseAllChildren( bool front )
+{
+  GetImpl(*this).CollapseAllChildren( front );
+}
+
+void Cluster::TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period )
+{
+  GetImpl(*this).TransformChild( index, position, scale, rotation, alpha, period );
+}
+
+void Cluster::RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front )
+{
+  GetImpl(*this).RestoreChild( index, alpha, period, front );
+}
+
+void Cluster::SetBackgroundImage( Actor image )
+{
+  GetImpl(*this).SetBackgroundImage(image);
+}
+
+void Cluster::SetTitle( Actor text )
+{
+  GetImpl(*this).SetTitle(text);
+}
+
+void Cluster::SetStyle(ClusterStyle style)
+{
+  GetImpl(*this).SetStyle(style);
+}
+
+ClusterStyle Cluster::GetStyle() const
+{
+  return GetImpl(*this).GetStyle();
+}
+
+unsigned int Cluster::GetExpandedCount() const
+{
+  return GetImpl(*this).GetExpandedCount();
+}
+
+unsigned int Cluster::GetTotalCount() const
+{
+  return GetImpl(*this).GetTotalCount();
+}
+
+Cluster::Cluster( Internal::Cluster& impl )
+: Toolkit::Control( impl )
+{
+}
+
+Cluster::Cluster( Dali::Internal::CustomActor* internal )
+: Toolkit::Control( internal )
+{
+  VerifyCustomActorPointer<Internal::Cluster>(internal);
+}
+
+} // namespace Demo
+
+} // namespace Dali
diff --git a/examples/cluster/cluster.h b/examples/cluster/cluster.h
new file mode 100644 (file)
index 0000000..98015bd
--- /dev/null
@@ -0,0 +1,264 @@
+#ifndef __DALI_DEMO_CLUSTER_H__
+#define __DALI_DEMO_CLUSTER_H__
+
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/alpha-functions.h>
+#include <dali/public-api/animation/time-period.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+
+namespace Dali
+{
+
+namespace Demo
+{
+
+namespace Internal DALI_INTERNAL
+{
+class Cluster;
+}
+
+class ClusterStyle;
+
+/**
+ * @brief Cluster is a container of grouped actors positioned in different cluster styles.
+ *
+ * Actions
+ * | %Action Name              | Method                    |
+ * |---------------------------|---------------------------|
+ * | expand                    | DoExpandAction()          |
+ * | collapse                  | DoCollapseAction()        |
+ * | transform                 | DoTransformAction()       |
+ */
+class Cluster : public Toolkit::Control
+{
+public:
+
+  // Custom properties
+
+  static const std::string CLUSTER_ACTOR_DEPTH;                           ///< Property, name "cluster-actor-depth",      type float
+
+public:
+
+  /**
+   * Create a Cluster handle; this can be initialised with Cluster::New()
+   * Calling member functions with an uninitialised handle is not allowed.
+   */
+  Cluster();
+
+  /**
+   * Copy Constructor.
+   */
+  Cluster( const Cluster& cluster );
+
+  /**
+   * Assignment Operator.
+   */
+  Cluster& operator=( const Cluster& cluster );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   */
+  ~Cluster();
+
+  /**
+   * Create the Cluster control with the given style.
+   * @param[in] style The style of the cluster
+   * @return A handle to the Cluster control.
+   */
+  static Cluster New( ClusterStyle& style );
+
+  /**
+   * Downcast an Object handle to Cluster. If handle points to a Cluster the
+   * downcast produces valid handle. If not the returned handle is left uninitialized.
+   * @param[in] handle Handle to an object
+   * @return handle to a Cluster or an uninitialized handle
+   */
+  static Cluster DownCast( BaseHandle handle );
+
+  /**
+   * Adds a child to the Cluster
+   * Will automatically choose a position for the child.
+   * @pre The child actor has been initialized.
+   * @param[in] child The child to add
+   */
+  void AddChild( Actor child );
+
+  /**
+   * Adds a child to the Cluster
+   * User specifies the position for the child.
+   * @pre The child actor has been initialized.
+   * @param[in] child The child to add
+   * @param[in] positionIndex The position for this child
+   */
+  void AddChild( Actor child, unsigned int positionIndex );
+
+  /**
+   * Adds a child to the Cluster to be inserted at a specified
+   * depth index.
+   * Will automatically choose a position for the child.
+   * @pre The child actor has been initialized.
+   * @param[in] child The child to add
+   * @param[in] index The depth position for this child
+   */
+  void AddChildAt( Actor child, unsigned int index );
+
+  /**
+   * Adds a child to the Cluster to be inserted at a specified
+   * depth index.
+   * User specifies the position for the child.
+   * @pre The child actor has been initialized.
+   * @param[in] child The child to add
+   * @param[in] positionIndex The position for this child
+   * @param[in] index The depth position for this child
+   */
+  void AddChildAt( Actor child, unsigned int positionIndex, unsigned int index );
+
+  /**
+   * Returns a child from the given layout position
+   * Note! if there is no child in this layout position this method returns an uninitialized
+   * Actor handle
+   * @param[in] index The child index in the cluster
+   * @return The child that was in the layout position or an uninitialized handle
+   */
+  Actor GetChildAt( unsigned int index );
+
+  /**
+   * Removes a child from the given layout position
+   * Note! if there is no child in this layout position this method does nothing
+   * @param[in] index The index of the child to remove
+   * @return The child that was removed or an uninitialized handle
+   */
+  Actor RemoveChildAt( unsigned int index );
+
+  /**
+   * Expands a child
+   * A child will move away from the cluster.
+   * @param[in] index The child position index to expand
+   */
+  void ExpandChild( unsigned int index );
+
+  /**
+   * Expands all children
+   * All children that have been collapsed will
+   * move away from the cluster
+   */
+  void ExpandAllChildren();
+
+  /**
+   * Collapses a child
+   * A child that has been expanded will move
+   * back to its original positions.
+   * @param[in] index The child index to collapse
+   * @param[in] front Whether to move child to the front or
+   * back of cluster (depth).
+   */
+  void CollapseChild( unsigned int index, bool front = false );
+
+  /**
+   * Collapses all children.
+   * All children that have been expanded will move
+   * back to their original positions.
+   * @param[in] front Whether to move child to the front or
+   * back of cluster (depth).
+   */
+  void CollapseAllChildren( bool front = false );
+
+  /**
+   * Transforms Actor from default transform to new transform
+   * @param[in] index The child index to move
+   * @param[in] position The position to move to
+   * @param[in] scale The scale to change to
+   * @param[in] rotation The rotation to change to
+   * @param[in] alpha The alpha function to use to tween to this transform
+   * @param[in] period The duration for this transformation to take
+   */
+  void TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period );
+
+  /**
+   * Restores Actor to the default transform (based on current style)
+   * @param[in] index The child index to move back
+   * @param[in] alpha The alpha function to use to tween to this transform
+   * @param[in] period The duration for this transformation to take
+   * @param[in] front Whether to move child to the front or
+   * back of cluster (depth).
+   */
+  void RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front = false );
+
+  /**
+   * Sets the background image.
+   * @param[in] image The background image.
+   */
+  void SetBackgroundImage( Actor image );
+
+  /**
+   * Sets the title.
+   *
+   * @param[in] text Title text.
+   */
+  void SetTitle( Actor text );
+
+  /**
+   * Sets the style of the cluster
+   * @param[in] style The style of the cluster
+   */
+  void SetStyle(ClusterStyle style);
+
+  /**
+   * Gets the style of the cluster
+   * @return style of the cluster
+   */
+  ClusterStyle GetStyle() const;
+
+  /**
+   * Gets the number of children that have been expanded in this cluster.
+   * @return the number of children expanded.
+   */
+  unsigned int GetExpandedCount() const;
+
+  /**
+   * Gets the number of children that have been added to this cluster.
+   * @return the total number of children.
+   */
+  unsigned int GetTotalCount() const;
+
+public: // Not intended for application developers
+
+  /**
+   * Creates a handle using the Toolkit::Internal implementation.
+   * @param[in]  implementation  The Control implementation.
+   */
+  DALI_INTERNAL Cluster( Internal::Cluster& implementation );
+
+  /**
+   * Allows the creation of this Control from an Internal::CustomActor pointer.
+   * @param[in]  internal  A pointer to the internal CustomActor.
+   */
+  explicit DALI_INTERNAL Cluster( Dali::Internal::CustomActor* internal );
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_DEMO_CLUSTER_H__
index abc16d8..5961390 100644 (file)
@@ -168,7 +168,7 @@ private:
 
 private:
   Application&                    mApplication;
-  Toolkit::View                   mView;
+  Toolkit::Control                mView;
   Toolkit::ToolBar                mToolBar;
   Layer                           mContent;
   Toolkit::TextLabel              mTitleActor;
index fdada71..9be4308 100644 (file)
@@ -152,7 +152,7 @@ private:
 
 private:
   Application&                    mApplication;
-  Toolkit::View                   mView;
+  Toolkit::Control                mView;
   Toolkit::ToolBar                mToolBar;
   Layer                           mContent;
   Toolkit::TextLabel              mTitleActor;
index d0772a3..ced7828 100644 (file)
@@ -568,7 +568,7 @@ private:
   Application&  mApplication;
 
   Layer mContentLayer;                ///< The content layer (contains non gui chrome actors)
-  Toolkit::View mView;                ///< The View instance.
+  Toolkit::Control mView;             ///< The View instance.
   Toolkit::ToolBar mToolBar;          ///< The View's Toolbar.
   TextLabel mTitleActor;               ///< The Toolbar's Title.
   Actor mGridActor;                   ///< The container for the grid of images
index 9bfbac8..2fc3609 100644 (file)
@@ -253,7 +253,7 @@ public:
                                              TOOLBAR_IMAGE,
                                              "" );
 
-    mView.OrientationAnimationStartedSignal().Connect( this, &ItemViewExample::OnOrientationChanged );
+    app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &ItemViewExample::OnOrientationChanged );
 
     // Create an edit mode button. (left of toolbar)
     Toolkit::PushButton editButton = Toolkit::PushButton::New();
@@ -414,7 +414,7 @@ public:
    * Orientation changed signal callback
    * @param orientation
    */
-  void OnOrientationChanged( View view, Animation& animation, const Orientation& orientation )
+  void OnOrientationChanged( Orientation orientation )
   {
     const unsigned int angle = orientation.GetDegrees();
 
@@ -1105,7 +1105,7 @@ private:
   Mode mMode;
   bool mMenuShown;
 
-  Toolkit::View mView;
+  Toolkit::Control mView;
   unsigned int mOrientation;
 
   Toolkit::ToolBar mToolBar;
index 2abc12b..f61a5c1 100644 (file)
@@ -722,7 +722,7 @@ class LoggingController: public ConnectionTracker
   };
 
   Application&      mApplication;
-  Toolkit::View     mView;                   ///< The View instance.
+  Toolkit::Control  mView;                   ///< The View instance.
   Toolkit::ToolBar  mToolBar;                ///< The View's Toolbar.
   Layer             mContentLayer;           ///< Content layer
 
index 791935d..2954cb9 100644 (file)
@@ -225,7 +225,7 @@ public:
     Stage::GetCurrent().Add(overlay);
 
     mMagnifier = Toolkit::Magnifier::New();
-    mMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
+    mMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
     mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width );  // Size of magnifier is in relation to stage width
     mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
     mMagnifier.SetScale(Vector3::ZERO);
@@ -242,7 +242,7 @@ public:
 
     // Create bouncing magnifier automatically bounces around screen.
     mBouncingMagnifier = Toolkit::Magnifier::New();
-    mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
+    mBouncingMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
     mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
     mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
     overlay.Add( mBouncingMagnifier );
@@ -393,7 +393,7 @@ public:
 private:
 
   Application&  mApplication;                             ///< Application instance
-  Toolkit::View mView;                                    ///< The view
+  Toolkit::Control mView;                                 ///< The view
   Layer mContent;                                         ///< The content layer
   Toolkit::Magnifier mMagnifier;                          ///< The manually controlled magnifier
   Toolkit::Magnifier mBouncingMagnifier;                  ///< The animating magnifier (swirly animation)
index c35f474..b733c6d 100644 (file)
@@ -503,7 +503,7 @@ public:
 
 private:
   Application&               mApplication;            ///< Application instance
-  Toolkit::View              mView;
+  Toolkit::Control           mView;
   Toolkit::ToolBar           mToolBar;
   Image                      mIconEffectsOff;
   Image                      mIconEffectsOn;
index ff61118..570005e 100644 (file)
@@ -400,7 +400,7 @@ public:
 
 private:
   Application&               mApplication;            ///< Application instance
-  Toolkit::View              mView;
+  Toolkit::Control           mView;
   Toolkit::ToolBar           mToolBar;
   Image                      mIconEffectsOff;
   Image                      mIconEffectsOn;
index 1f918f0..3533cd2 100644 (file)
@@ -88,7 +88,7 @@ private:
   MeshActor                  mMeshActor;
   MeshActor                  mAnimatedMeshActor;
 
-  Toolkit::View              mView;                              ///< The View instance.
+  Toolkit::Control           mView;                              ///< The View instance.
   Toolkit::ToolBar           mToolBar;                           ///< The View's Toolbar.
   TextLabel                   mTitleActor;                        ///< The Toolbar's Title.
   Layer                      mContentLayer;                      ///< Content layer (scrolling cluster content)
index a57b9f4..3596034 100644 (file)
@@ -152,11 +152,9 @@ private:
 
   /**
    * This method gets called when the screen is rotated, switch between portrait and landscape views
-   * param [in] view The view receiving the orientation change signal
-   * param [in] animation The Orientation Rotating animation
    * param [in] orientation The current screen orientation
    */
-  void OnOrientationAnimationStarted( View view, Animation& animation, const Orientation& orientation );
+  void OnOrientationAnimationStarted( Orientation orientation );
 
   /**
    * Main key event handler
@@ -196,7 +194,7 @@ private:
 private:
 
   Application&                mApplication;
-  View                        mView;
+  Actor                       mView;
 
   PageTurnView                mPageTurnPortraitView;
   PageTurnView                mPageTurnLandscapeView;
@@ -231,7 +229,10 @@ void PageTurnController::OnInit( Application& app )
   Vector2 stageSize =  stage.GetSize();
 
   // Create default View.
-  mView = View::New();
+  mView = Actor::New();
+  mView.SetAnchorPoint( Dali::AnchorPoint::CENTER );
+  mView.SetParentOrigin( Dali::ParentOrigin::CENTER );
+  mView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   stage.Add( mView );
 
   Dali::Window winHandle = app.GetWindow();
@@ -239,10 +240,9 @@ void PageTurnController::OnInit( Application& app )
   winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE );
   winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE  );
   winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE );
-  // FIXME
-  //app.GetOrientation().ChangedSignal().Connect( &mView, &View::OrientationChanged );
+
   // view will response to orientation change to display portrait or landscape views
-  mView.OrientationAnimationStartedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted );
+  app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted );
 
   mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize );
   mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) );
@@ -262,7 +262,7 @@ void PageTurnController::OnInit( Application& app )
   mView.Add(mPageTurnPortraitView);
 }
 
-void PageTurnController::OnOrientationAnimationStarted( View view, Animation& animation, const Orientation& orientation )
+void PageTurnController::OnOrientationAnimationStarted( Orientation orientation )
 {
   switch( orientation.GetDegrees() )
   {
index 5566cc9..06b3cf0 100644 (file)
@@ -444,7 +444,7 @@ public:
     stage.KeyEventSignal().Connect(this, &PathController::OnKeyEvent);
 
     // Create a default view with a default tool bar:
-    Toolkit::View view;                ///< The View instance.
+    Toolkit::Control view;              ///< The View instance.
     Toolkit::ToolBar toolBar;          ///< The View's Toolbar.
     mContentLayer = DemoHelper::CreateView( mApplication,
                                             view,
index 278dddc..01b9bad 100644 (file)
@@ -91,7 +91,7 @@ private: // Member variables
   };
 
   Application     mApplication; ///< The application handle
-  Toolkit::View   mView;        ///< The toolbar view
+  Toolkit::Control mView;        ///< The toolbar view
   Layer           mContents;    ///< The toolbar contents pane
   ImageActor      mImageActor;  ///< Image actor shown by stencil mask
   Animation       mAnimation;
index dfcf9d8..61bae03 100644 (file)
@@ -325,7 +325,7 @@ private:
     // Creates a default view with a default tool bar.
     // The view is added to the stage.
     Toolkit::ToolBar toolBar;
-    Toolkit::View    view;
+    Toolkit::Control    view;
     mContent = DemoHelper::CreateView( application,
         view,
         toolBar,
index e499377..d459b45 100644 (file)
@@ -659,7 +659,7 @@ private:
 private:
 
   Application& mApplication;                            ///< Application instance
-  Toolkit::View mView;                                  ///< The View instance.
+  Toolkit::Control mView;                               ///< The View instance.
   Toolkit::ToolBar mToolBar;                            ///< The View's Toolbar.
   TextLabel mTitleActor;                                ///< The Toolbar's Title.
   Layer mContentLayer;                                  ///< The content layer (contains game actors)
index 4a3ca8a..b06a7fd 100644 (file)
@@ -444,7 +444,7 @@ public:
 
 private:
   Application&              mApp;
-  Toolkit::View             mView;
+  Toolkit::Control          mView;
   Layer                     mContents;
   Actor                     mSceneActor;
   Animation                 mAnimation;
index cae5517..60ee45d 100644 (file)
@@ -1275,7 +1275,7 @@ private:
   };
 
   Application&      mApplication;
-  Toolkit::View     mView;                   ///< The View instance.
+  Toolkit::Control  mView;                   ///< The View instance.
   Toolkit::ToolBar  mToolBar;                ///< The View's Toolbar.
   Layer             mContentLayer;           ///< Content layer
 
index d1cca77..930511e 100644 (file)
@@ -120,7 +120,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar,
 }
 
 Dali::Layer CreateView( Dali::Application& application,
-                        Dali::Toolkit::View& view,
+                        Dali::Toolkit::Control& view,
                         Dali::Toolkit::ToolBar& toolBar,
                         const std::string& backgroundImagePath,
                         const std::string& toolbarImagePath,
@@ -130,7 +130,9 @@ Dali::Layer CreateView( Dali::Application& application,
   Dali::Stage stage = Dali::Stage::GetCurrent();
 
   // Create default View.
-  view = Dali::Toolkit::View::New();
+  view = Dali::Toolkit::Control::New();
+  view.SetAnchorPoint( Dali::AnchorPoint::CENTER );
+  view.SetParentOrigin( Dali::ParentOrigin::CENTER );
   view.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
 
   // Add the view to the stage before setting the background.
@@ -140,8 +142,7 @@ Dali::Layer CreateView( Dali::Application& application,
   if ( !backgroundImagePath.empty() )
   {
     Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath, Dali::ImageDimensions( stage.GetSize().x, stage.GetSize().y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR );
-    Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage );
-    view.SetBackground( backgroundImageActor );
+    view.SetBackgroundImage( backgroundImage );
   }
 
   // FIXME
@@ -152,14 +153,14 @@ Dali::Layer CreateView( Dali::Application& application,
   Dali::Layer toolBarLayer = CreateToolbar( toolBar, toolbarImagePath, title, style );
 
   // Add tool bar layer to the view.
-  view.AddContentLayer( toolBarLayer );
+  view.Add( toolBarLayer );
 
   // Create a content layer.
   Dali::Layer contentLayer = Dali::Layer::New();
   contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER );
   contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER );
   contentLayer.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
-  view.AddContentLayer( contentLayer );
+  view.Add( contentLayer );
   contentLayer.LowerBelow( toolBarLayer );
 
   return contentLayer;