<ui-application appid="bubble-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/bubble-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
<label>Bubble Effect</label>
</ui-application>
- <ui-application appid="cluster.example" exec="/usr/apps/com.samsung.dali-demo/bin/cluster.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
- <label>Cluster example</label>
- </ui-application>
<ui-application appid="cube-transition-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/cube-transition-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
<label>Cube transition effect</label>
</ui-application>
demo.AddExample(Example("bubble-effect.example", DALI_DEMO_STR_TITLE_BUBBLES));
demo.AddExample(Example("blocks.example", DALI_DEMO_STR_TITLE_BLOCKS));
- demo.AddExample(Example("cluster.example", DALI_DEMO_STR_TITLE_CLUSTER));
demo.AddExample(Example("cube-transition-effect.example", DALI_DEMO_STR_TITLE_CUBE_TRANSITION));
demo.AddExample(Example("dissolve-effect.example", DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION));
demo.AddExample(Example("item-view.example", DALI_DEMO_STR_TITLE_ITEM_VIEW));
+++ /dev/null
-/*
- * 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.
- *
- */
-
-#include <sstream>
-#include <iomanip>
-
-#include "shared/view.h"
-#include <dali/dali.h>
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/shader-effects/motion-blur-effect.h>
-#include <dali-toolkit/devel-api/controls/popup/popup.h>
-#include <dali-toolkit/devel-api/shader-effects/carousel-effect.h>
-
-#include "cluster.h"
-#include "cluster-style.h"
-
-
-using namespace Dali;
-using namespace Dali::Demo;
-using namespace Dali::Toolkit;
-using namespace DemoHelper;
-
-namespace // unnamed namespace
-{
-
-const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" );
-const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
-const char * const APPLICATION_TITLE( "Clusters" );
-const char * const LAYOUT_NONE_IMAGE( DALI_IMAGE_DIR "icon-cluster-none.png" );
-const char * const LAYOUT_NONE_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-cluster-none-selected.png" );
-const char * const LAYOUT_MOTION_BLUR_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" );
-const char * const LAYOUT_MOTION_BLUR_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-cluster-wobble-selected.png" );
-const char * const LAYOUT_CAROUSEL_IMAGE( DALI_IMAGE_DIR "icon-cluster-carousel.png" );
-const char * const LAYOUT_CAROUSEL_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-cluster-carousel-selected.png" );
-const char * const LAYOUT_SPHERE_IMAGE( DALI_IMAGE_DIR "icon-cluster-sphere.png" );
-const char * const LAYOUT_SPHERE_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-cluster-sphere-selected.png" );
-
-enum ClusterType
-{
- PEOPLE,
- TODAY,
- PHONE,
- PICTURES,
- MUSIC,
- MAGAZINE,
-
- CLUSTER_COUNT
-};
-
-const char* PEOPLE_IMAGE_PATHS[] = { DALI_IMAGE_DIR "people-medium-1.jpg",
- DALI_IMAGE_DIR "people-medium-2.jpg",
- DALI_IMAGE_DIR "people-medium-3.jpg",
- DALI_IMAGE_DIR "people-medium-4.jpg",
- DALI_IMAGE_DIR "people-medium-5.jpg",
- DALI_IMAGE_DIR "people-medium-6.jpg",
- DALI_IMAGE_DIR "people-medium-7.jpg",
- DALI_IMAGE_DIR "people-medium-8.jpg",
- NULL };
-
-const char* TODAY_IMAGE_PATHS[] = { DALI_IMAGE_DIR "gallery-medium-1.jpg",
- DALI_IMAGE_DIR "gallery-medium-2.jpg",
- DALI_IMAGE_DIR "gallery-medium-3.jpg",
- DALI_IMAGE_DIR "gallery-medium-4.jpg",
- DALI_IMAGE_DIR "gallery-medium-5.jpg",
- DALI_IMAGE_DIR "gallery-medium-6.jpg",
- NULL };
-
-const char* PHONE_IMAGE_PATHS[] = { DALI_IMAGE_DIR "gallery-medium-7.jpg",
- DALI_IMAGE_DIR "gallery-medium-8.jpg",
- DALI_IMAGE_DIR "gallery-medium-9.jpg",
- DALI_IMAGE_DIR "gallery-medium-10.jpg",
- DALI_IMAGE_DIR "gallery-medium-11.jpg",
- DALI_IMAGE_DIR "gallery-medium-12.jpg",
- NULL };
-
-const char* PICTURES_IMAGE_PATHS[] = { DALI_IMAGE_DIR "gallery-medium-13.jpg",
- DALI_IMAGE_DIR "gallery-medium-14.jpg",
- DALI_IMAGE_DIR "gallery-medium-15.jpg",
- DALI_IMAGE_DIR "gallery-medium-16.jpg",
- DALI_IMAGE_DIR "gallery-medium-17.jpg",
- DALI_IMAGE_DIR "gallery-medium-18.jpg",
- NULL };
-
-const char* MUSIC_IMAGE_PATHS[] = { DALI_IMAGE_DIR "gallery-medium-19.jpg",
- DALI_IMAGE_DIR "gallery-medium-20.jpg",
- DALI_IMAGE_DIR "gallery-medium-21.jpg",
- DALI_IMAGE_DIR "gallery-medium-22.jpg",
- DALI_IMAGE_DIR "gallery-medium-23.jpg",
- DALI_IMAGE_DIR "gallery-medium-24.jpg",
- NULL };
-
-const char* MAGAZINE_IMAGE_PATHS[] = { DALI_IMAGE_DIR "gallery-medium-25.jpg",
- DALI_IMAGE_DIR "gallery-medium-26.jpg",
- DALI_IMAGE_DIR "gallery-medium-27.jpg",
- DALI_IMAGE_DIR "gallery-medium-28.jpg",
- DALI_IMAGE_DIR "gallery-medium-29.jpg",
- DALI_IMAGE_DIR "gallery-medium-30.jpg",
- NULL };
-
-const char **IMAGE_GROUPS[] = {PEOPLE_IMAGE_PATHS,
- TODAY_IMAGE_PATHS,
- PHONE_IMAGE_PATHS,
- PICTURES_IMAGE_PATHS,
- MUSIC_IMAGE_PATHS,
- MAGAZINE_IMAGE_PATHS,
- NULL};
-
-const float CLUSTER_IMAGE_THUMBNAIL_WIDTH = 256.0f;
-const float CLUSTER_IMAGE_THUMBNAIL_HEIGHT = 256.0f;
-
-const char* CLUSTER_SHADOW_IMAGE_PATH = DALI_IMAGE_DIR "cluster-image-shadow.png";
-const char* CLUSTER_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "cluster-image-frame.png";
-const char* CLUSTER_BACKGROUND_IMAGE_PATH = DALI_IMAGE_DIR "cluster-background.png";
-
-const float CLUSTER_IMAGE_BORDER_INDENT = 14.0f; ///< Indent of border in pixels.
-const float CLUSTER_IMAGE_BORDER_WIDTH = 128; ///< Width of border in pixels.
-const float CLUSTER_IMAGE_BORDER_HEIGHT = 128; ///< Height of border in pixels.
-
-const Vector4 CLUSTER_IMAGE_BORDER_ABSOLUTE( 16.0f, 16.0f, 16.0f, 16.0f ); // Border dimensions in absolute pixel coordinates.
-
-// These values depend on the border image
-const float CLUSTER_RELATIVE_SIZE = 0.65f; ///< Cluster size relative to screen width
-
-const float CLUSTER_GROUP_DELAY_TOP = 0.25f; ///< Delay for top Clusters in seconds.
-const float CLUSTER_GROUP_DELAY_BOTTOM = 0.0f; ///< Delay for bottom Clusters in seconds.
-
-const float CLUSTER_COLUMN_INDENT = 0.1f; ///< Left Indentation in screen coordinates.
-const float CLUSTER_ROW_INDENT = 0.13f; ///< Top Indentation in screen coordinates.
-
-const float UI_MARGIN = 10.0f; ///< Screen Margin for placement of UI buttons
-
-const float CAROUSEL_EFFECT_RADIUS = 500.0f; ///< In Carousel Effect mode: Radius of carousel (Z peak depth)
-const float CAROUSEL_EFFECT_ANGLE_SWEEP = 90.0f; ///< In Carousel Effect mode: Angle sweep from left to right of screen
-const float SPHERE_EFFECT_RADIUS = 1000.0f; ///< In Sphere Effect mode: Radius of sphere carousel (Z peak depth)
-const float SPHERE_EFFECT_POSITION_Z = -700.0f; ///< In Sphere Effect mode: Z position alter (as carousel is coming out to screen we move back)
-const float SPHERE_EFFECT_ANGLE_SWEEP = 90.0f; ///< In Sphere Effect mode: Angle sweep from edge to opposite side of circle.
-const float SPHERE_EFFECT_VERTICAL_DOMAIN = 0.15f; ///< In Sphere Effect mode: How much the user can pan in the vertical axis. (in stageHeights)
-
-/**
- * List of effect types that user can select through.
- */
-enum ExampleEffectType
-{
- NO_EFFECT = 0,
- MOTION_BLUR_EFFECT,
- CAROUSEL_EFFECT,
- SPHERE_EFFECT,
- TOTAL_EFFECTS,
-};
-
-/**
- * List of effect type names that appear on the Effect button.
- */
-const char* EXAMPLE_EFFECT_LABEL[] = { "None",
- "Motion Blur",
- "Carousel",
- "Sphere",
- };
-
-/**
- * CarouselEffectOrientationConstraint
- * Based on the View orientation i.e. portrait (0 degrees), landscape (90 degrees) etc.
- * carousel shader effect should bend differently (as a function of this orientation),
- * as shader effect is applied to the screen coordinates.
- */
-struct CarouselEffectOrientationConstraint
-{
- /**
- * Constructor
- * @param[in] angleSweep The amount of degrees to rotate by per pixel.
- */
- CarouselEffectOrientationConstraint( const Vector2 angleSweep )
- : mAngleSweep( angleSweep )
- {
- }
-
- /**
- * @param[in] current The object's current property value
- * @return The object's new property value
- */
- void operator()( Vector2& current, const PropertyInputContainer& inputs )
- {
- Vector3 axis;
- Radian angle;
- inputs[0]->GetQuaternion().ToAxisAngle( axis, angle );
-
- current.x = cosf(angle);
- current.y = sinf(angle);
-
- current *= mAngleSweep;
- }
-
- Vector2 mAngleSweep;
-
-};
-
-/**
- * SphereEffectOffsetConstraint
- *
- * Sets SphereEffect's center to be a function of the
- * screen orientation (portrait or landscape).
- */
-struct SphereEffectOffsetConstraint
-{
- /**
- * @param[in] stageSize The stage size (not subject to orientation)
- * @param[in] center Shear Center position based on initial orientation.
- */
- SphereEffectOffsetConstraint(float offset)
- : mOffset(offset)
- {
- }
-
- /**
- * @param[in] current The current center
- * @param[in] propertyViewSize The current view size
- * @return vector to provide SphereShaderEffect
- */
- void operator()( float& current, const PropertyInputContainer& /* inputs */ )
- {
- current += mOffset;
- }
-
- float mOffset;
-};
-
-/**
- * ClusterInfo struct
- *
- * Contains information about each cluster in mClusterInfo list.
- */
-struct ClusterInfo
-{
- /**
- * Constructor
- *
- * @param[in] cluster The cluster instance
- * @param[in] index The cluster's index (starting from 0 for the first cluster)
- * @param[in] position The cluster's original position
- * @param[in] size The cluster's original size
- */
- ClusterInfo(Cluster cluster, int index, const Vector3& position, const Vector3& size)
- : mCluster(cluster),
- mIndex(index),
- mPosition(position),
- mSize(size)
- {
-
- }
-
- /**
- * Copy constructor
- *
- * @param[in] rhs The ClusterInfo struct to be copied.
- */
- ClusterInfo( const ClusterInfo& rhs )
- : mCluster(rhs.mCluster),
- mIndex(rhs.mIndex),
- mPosition(rhs.mPosition),
- mSize(rhs.mSize)
- {
-
- }
-
- /**
- * Assignment operator
- */
- ClusterInfo& operator=( const ClusterInfo& rhs )
- {
- if( this != &rhs )
- {
- mCluster = rhs.mCluster;
- mIndex = rhs.mIndex;
- mPosition = rhs.mPosition;
- mSize = rhs.mSize;
- }
- return *this;
- }
-
-
- Cluster mCluster; ///< Cluster instance
- int mIndex; ///< Cluster index
- Vector3 mPosition; ///< Cluster original position
- Vector3 mSize; ///< Cluster original size
- Constraint mEffectConstraint; ///< Cluster constraint
-};
-
-/**
- * Shrinks Actor based on parent's aspect ratio.
- */
-struct ShrinkConstraint
-{
- /**
- * Constructor
- */
- ShrinkConstraint()
- {
- }
-
- /**
- * @param[in] current The object's current scale value
- * @param[in] parentScale The parent's scale
- * @return The object's new scale value
- */
- Vector3 operator()(const Vector3& current,
- const PropertyInput& parentScale)
- {
- return Vector3( parentScale.GetVector3().x / parentScale.GetVector3().y, 1.0f, 1.0f );
- }
-};
-
-struct ButtonImages
-{
- std::string mButtonImage;
- std::string mSelectedImage;
-};
-
-
-} // unnamed namespace
-
-/**
- * Custom position and size of shadow image
- */
-namespace ShadowProperty
-{
-const Vector3 ANCHOR_POINT (0.54f, 0.6f, 0.5f);
-const Vector3 RELATIVE_POSITION (0.0f, 0.0f, -0.1f);
-const Vector3 SIZE_SCALE (1.4f, 1.4f, 1.0f);
-}
-
-// This example shows how to use Cluster UI control
-//
-class ClusterController : public ConnectionTracker
-{
-public:
-
- /**
- * Constructor
- * @param application class, stored as reference
- */
- ClusterController(Application &app)
- : mApplication(app),
- mClusterCount(0),
- mExampleEffect(NO_EFFECT)
- {
- // Connect to the Application's Init signal
- app.InitSignal().Connect(this, &ClusterController::Create);
- }
-
- ~ClusterController()
- {
- // Nothing to do here; everything gets deleted automatically
- }
-
- /**
- * This method gets called once the main loop of application is up and running
- */
- void Create(Application& application)
- {
- Stage::GetCurrent().KeyEventSignal().Connect(this, &ClusterController::OnKeyEvent);
-
- // The Init signal is received once (only) during the Application lifetime
-
- // Hide the indicator bar
- application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
-
- // Creates a default view with a default tool bar.
- // The view is added to the stage.
- mContentLayer = DemoHelper::CreateView( application,
- mView,
- mToolBar,
- BACKGROUND_IMAGE,
- TOOLBAR_IMAGE,
- "" );
-
- mContentLayer.SetProperty(Layer::Property::BEHAVIOR, "Dali::Layer::LAYER_3D");
-
- // Create a effect toggle button. (right of toolbar)
- mLayoutButtonImages[ NO_EFFECT ].mButtonImage = LAYOUT_NONE_IMAGE;
- mLayoutButtonImages[ NO_EFFECT ].mSelectedImage = LAYOUT_NONE_IMAGE_SELECTED;
- mLayoutButtonImages[ MOTION_BLUR_EFFECT ].mButtonImage = LAYOUT_MOTION_BLUR_IMAGE;
- mLayoutButtonImages[ MOTION_BLUR_EFFECT ].mSelectedImage = LAYOUT_MOTION_BLUR_IMAGE_SELECTED;
- mLayoutButtonImages[ CAROUSEL_EFFECT ].mButtonImage = LAYOUT_CAROUSEL_IMAGE;
- mLayoutButtonImages[ CAROUSEL_EFFECT ].mSelectedImage = LAYOUT_CAROUSEL_IMAGE_SELECTED;
- mLayoutButtonImages[ SPHERE_EFFECT ].mButtonImage = LAYOUT_SPHERE_IMAGE;
- mLayoutButtonImages[ SPHERE_EFFECT ].mSelectedImage = LAYOUT_SPHERE_IMAGE_SELECTED;
-
- mLayoutButton = Toolkit::PushButton::New();
- mLayoutButton.ClickedSignal().Connect( this, &ClusterController::OnEffectTouched );
- mToolBar.AddControl( mLayoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
-
- // create and setup the scroll view...
- mScrollView = ScrollView::New();
- mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- // anchor the scroll view from its center point to the middle of its parent
- mScrollView.SetAnchorPoint(AnchorPoint::CENTER);
- mScrollView.SetParentOrigin(ParentOrigin::CENTER);
-
- // Scale ScrollView to fit parent (mContentLayer)
- mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- // Add the scroll view to the content layer
- mContentLayer.Add(mScrollView);
-
- // Create the image border shared by all the cluster image actors
- mClusterBorderImage = ResourceImage::New(CLUSTER_BORDER_IMAGE_PATH);
-
- AddCluster( PEOPLE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1) );
- AddCluster( TODAY, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle2) );
- AddCluster( PHONE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle3) );
- AddCluster( PICTURES, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle4) );
- AddCluster( MUSIC, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle2) );
- AddCluster( MAGAZINE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle3) );
-
- SetEffect(MOTION_BLUR_EFFECT);
- }
-
- /**
- * Helper to create the cluster actors
- */
- Cluster CreateClusterActor(ClusterType clusterType, ClusterStyle style, Vector3& clusterSize)
- {
- // Create the cluster actor with the given cluster style
- Cluster clusterActor = Cluster::New(style);
- clusterActor.SetParentOrigin(ParentOrigin::CENTER);
- clusterActor.SetAnchorPoint(AnchorPoint::CENTER);
-
- Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
- float minStageDimension = std::min(stageSize.x, stageSize.y);
-
- clusterSize.x = minStageDimension * CLUSTER_RELATIVE_SIZE;
- clusterSize.y = minStageDimension * CLUSTER_RELATIVE_SIZE;
-
- clusterActor.SetSize( clusterSize );
-
- DALI_ASSERT_ALWAYS(clusterType < CLUSTER_COUNT);
- const char **paths = IMAGE_GROUPS[clusterType];
- DALI_ASSERT_ALWAYS(paths);
-
- // Add a background image to the cluster, limiting the loaded size by
- // fitting it inside a quarter of the stage area with the conservative BOX
- // filter mode:
- Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH, Dali::ImageDimensions( stageSize.x * 0.5f, stageSize.y * 0.5f ), Dali::FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX );
- Control clusterControl = Control::DownCast( clusterActor );
- clusterControl.SetBackgroundImage( bg );
-
- // Add actors (pictures) as the children of the cluster
- for (unsigned int i = 0; (i < style.GetMaximumNumberOfChildren()) && (*paths); i++, paths++)
- {
- clusterActor.AddChild(CreateClusterPictureActor(clusterType, *paths), i);
- }
-
- return clusterActor;
- }
-
- /**
- * Helper to create the picture actors in the cluster
- */
- Actor CreateClusterPictureActor(ClusterType clusterType, const std::string& imagePath)
- {
- // Create a picture for this cluster image
- // actor|->shadow
- // |->image
- // |->border
- Actor actor = Actor::New();
- actor.SetSize(CLUSTER_IMAGE_THUMBNAIL_WIDTH, CLUSTER_IMAGE_THUMBNAIL_HEIGHT);
- actor.SetParentOrigin( ParentOrigin::CENTER );
- actor.SetAnchorPoint( AnchorPoint::CENTER );
-
- // Load the thumbnail at quarter of screen width or standard size if that is smaller:
- Size stageQuarter = Stage::GetCurrent().GetSize() * 0.25f;
- const ImageDimensions requestedDims = ImageDimensions( std::min( stageQuarter.x, CLUSTER_IMAGE_THUMBNAIL_WIDTH ), std::min( stageQuarter.y, CLUSTER_IMAGE_THUMBNAIL_HEIGHT ) );
-
- // Add a shadow image child actor
- Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, requestedDims, Dali::FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX );
- ImageActor shadowActor = ImageActor::New(shadowImage);
-
- // Shadow is not exactly located on the center of the image, so it is moved to a little
- // upper-left side of the image relatively using customised AnchorPoint.
- shadowActor.SetParentOrigin(ShadowProperty::ANCHOR_POINT);
- shadowActor.SetAnchorPoint(AnchorPoint::CENTER);
- shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f));
-
- // Apply size-relative mode to auto-size the image shadow
- shadowActor.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
- shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE );
- actor.Add( shadowActor );
-
- // Add a picture image actor to actor (with equal size to the parent).
- Image image = ResourceImage::New( imagePath, requestedDims, Dali::FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX );
- ImageActor imageActor = ImageActor::New( image );
- imageActor.SetParentOrigin( ParentOrigin::CENTER );
- imageActor.SetAnchorPoint( AnchorPoint::CENTER );
- imageActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- actor.Add( imageActor );
-
- // Add a border image child actor (with a fixed size offset from parent).
- ImageActor borderActor = ImageActor::New( mClusterBorderImage );
- borderActor.SetParentOrigin( ParentOrigin::CENTER );
- borderActor.SetAnchorPoint( AnchorPoint::CENTER );
- borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
- borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE );
- borderActor.SetPosition( Vector3( 0.0f, 0.0f, 1.0f ) );
- borderActor.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
- borderActor.SetSizeModeFactor( Vector3( CLUSTER_IMAGE_BORDER_INDENT - 1.0f, CLUSTER_IMAGE_BORDER_INDENT - 1.0f, 0.0f ) * 2.0f );
- actor.Add( borderActor );
-
- return actor;
- }
-
-
- /**
- * Adds a Cluster to the ScrollView
- *
- * @param[in] clusterType The type of cluster (determines the image content)
- * @param[in] style The style to be used for this cluster.
- */
- void AddCluster(ClusterType clusterType, ClusterStyle style)
- {
- Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
-
- int column = mClusterCount>>1;
- int row = mClusterCount&1;
-
- float minStageDimension = std::min(stageSize.x, stageSize.y);
- float clusterRightShift = 1.0f - CLUSTER_COLUMN_INDENT * 2.0f;
- Vector3 clusterPosition = Vector3(CLUSTER_COLUMN_INDENT * stageSize.width + row * (clusterRightShift * stageSize.width - minStageDimension * CLUSTER_RELATIVE_SIZE),
- CLUSTER_ROW_INDENT * stageSize.height + row * (clusterRightShift * stageSize.height - minStageDimension * CLUSTER_RELATIVE_SIZE), 0.0f);
-
- Actor pageView = Actor::New();
- mScrollView.Add(pageView);
- pageView.SetParentOrigin(ParentOrigin::CENTER);
- pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f));
- pageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- // Create cluster actors and add them to scroll view
- Vector3 clusterSize;
- Cluster cluster = CreateClusterActor( clusterType, style, clusterSize );
- cluster.SetParentOrigin(ParentOrigin::TOP_LEFT);
- cluster.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- cluster.SetPosition( clusterPosition );
-
- pageView.Add(cluster);
-
- mClusterInfo.push_back( ClusterInfo( cluster, mClusterCount, clusterPosition, clusterSize ) );
-
- mClusterCount++;
- }
-
- /**
- * Sets motion blur effect to a cluster and all its children
- *
- * @param[in] actor Cluster control to which the effect will be applied
- */
- void SetMotionBlurEffect( Actor actor )
- {
-
- // only do something if the actor and effect are valid
- if( actor )
- {
- // first remove from this actor
- ImageActor imageActor = ImageActor::DownCast( actor );
- if( imageActor )
- {
- ShaderEffect shaderEffect = Toolkit::CreateMotionBlurEffect();
- shaderEffect.SetUniform("uSpeedScalingFactor",0.1f);
-
- Dali::Property::Index uModelProperty = shaderEffect.GetPropertyIndex( "uModelLastFrame" );
- Constraint constraint = Constraint::New<Matrix>( shaderEffect, uModelProperty, EqualToConstraint() );
- constraint.AddSource( Source( imageActor , Actor::Property::WORLD_MATRIX ) );
- constraint.Apply();
- imageActor.SetShaderEffect( shaderEffect );
- }
- // then all children recursively
- const unsigned int count = actor.GetChildCount();
- for( unsigned int index = 0; index < count; ++index )
- {
- Actor child( actor.GetChildAt( index ) );
- SetMotionBlurEffect( child );
- }
- }
- }
-
- /**
- * Resets ScrollView and Clusters settings
- * to reflect the new ExampleEffectType
- *
- * TODO: Add animation transition to fade out of existing effect,
- * and into new effect.
- *
- * @param[in] type The desired effect to switch to.
- */
- void SetEffect(ExampleEffectType type)
- {
- Vector2 stageSize(Dali::Stage::GetCurrent().GetSize());
-
- mExampleEffect = type;
-
- std::stringstream ss(APPLICATION_TITLE);
- ss << APPLICATION_TITLE << ": " << EXAMPLE_EFFECT_LABEL[mExampleEffect];
- SetTitle(ss.str());
-
- // Set up default ruler settings (fixed in horizontal, disabled in vertical)
- RulerPtr rulerX;
- rulerX = new FixedRuler(stageSize.x);
- int columns = (mClusterCount + 1) >> 1;
- rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * columns, true));
- mScrollView.SetRulerX(rulerX);
-
- RulerPtr rulerY = new DefaultRuler();
- rulerY->Disable();
- mScrollView.SetRulerY(rulerY);
-
- mScrollView.SetActorAutoSnap(false);
-
- // Remove all shader-effects from mScrollView and it's children (the clusters)
- mScrollView.SetPosition(Vector3::ZERO);
-
- mLayoutButton.SetUnselectedImage( mLayoutButtonImages[ type ].mButtonImage );
- mLayoutButton.SetSelectedImage( mLayoutButtonImages[ type ].mSelectedImage );
-
- for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i )
- {
- Cluster cluster = i->mCluster;
- RemoveShaderEffectRecursively( cluster );
- if( i->mEffectConstraint )
- {
- i->mEffectConstraint.Remove();
- i->mEffectConstraint.Reset();
- }
- }
-
- // Apply new shader-effects.
- // Move Y to origin incase we came from an effect where user could free pan in y axis.
- const Vector2 currentScrollPosition(mScrollView.GetCurrentScrollPosition());
- mScrollView.ScrollTo(Vector2(currentScrollPosition.x, 0.0f));
-
- switch(type)
- {
- case NO_EFFECT:
- {
- break;
- }
-
- case MOTION_BLUR_EFFECT:
- {
- for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i )
- {
- SetMotionBlurEffect( i->mCluster );
- }
- break;
- }
-
- case CAROUSEL_EFFECT:
- {
- // Apply Carousel Shader Effect to scrollView
- ShaderEffect shaderEffect = Toolkit::CreateCarouselEffect();
- shaderEffect.SetUniform( "uRadius", -CAROUSEL_EFFECT_RADIUS );
- // dont apply shader effect to scrollview as it might override internal shaders for bounce effect etc
- for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i )
- {
- Cluster cluster = i->mCluster;
- SetShaderEffectRecursively( cluster, shaderEffect );
- }
- mScrollView.SetPosition( Vector3( 0.0f, 0.0f, CAROUSEL_EFFECT_RADIUS ) );
-
- const Vector2 angleSweep( CAROUSEL_EFFECT_ANGLE_SWEEP / stageSize.width,
- CAROUSEL_EFFECT_ANGLE_SWEEP / stageSize.width );
-
- Property::Index anglePerUnit = shaderEffect.GetPropertyIndex( "uAnglePerUnit" );
- Constraint constraint = Constraint::New<Vector2>( shaderEffect, anglePerUnit, CarouselEffectOrientationConstraint( angleSweep ) );
- constraint.AddSource( Source(mView, Actor::Property::ORIENTATION) );
- constraint.Apply();
-
- break;
- }
-
- case SPHERE_EFFECT:
- {
- // Change ruler to free panning...
- RulerPtr rulerX;
- rulerX = new DefaultRuler();
- int columns = (mClusterCount + 1) >> 1;
- rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * columns, true));
- mScrollView.SetRulerX(rulerX);
-
- RulerPtr rulerY = new DefaultRuler();
- rulerY->SetDomain(RulerDomain( -stageSize.y * SPHERE_EFFECT_VERTICAL_DOMAIN, stageSize.y * (1.0f + SPHERE_EFFECT_VERTICAL_DOMAIN), true));
- mScrollView.SetRulerY(rulerY);
-
- // Apply Carousel Shader Effect to scrollView (Spherical style)
- ShaderEffect shaderEffect = Toolkit::CreateCarouselEffect();
-
- shaderEffect.SetUniform( "uRadius", SPHERE_EFFECT_RADIUS );
- shaderEffect.SetUniform( "uAnglePerUnit", Vector2( SPHERE_EFFECT_ANGLE_SWEEP / stageSize.y, SPHERE_EFFECT_ANGLE_SWEEP / stageSize.y ) );
- // dont apply shader effect to scrollview as it might override internal shaders for bounce effect etc
- for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i )
- {
- Cluster cluster = i->mCluster;
- i->mEffectConstraint = Constraint::New<float>( cluster, Actor::Property::POSITION_Z, SphereEffectOffsetConstraint( SPHERE_EFFECT_POSITION_Z ) );
- i->mEffectConstraint.SetRemoveAction(Constraint::Discard);
- SetShaderEffectRecursively( cluster, shaderEffect );
- i->mEffectConstraint.Apply();
- }
- break;
- }
-
- default:
- break;
- }
-
- }
-
- /**
- * Signal handler, called when quit button is pressed
- */
- bool OnEffectTouched( Toolkit::Button button )
- {
- // quit the application
- SetEffect(static_cast<ExampleEffectType>( (mExampleEffect + 1) % TOTAL_EFFECTS) );
- return true;
- }
-
- /**
- * Sets/Updates the title of the View
- * @param[in] title The new title for the view.
- */
- void SetTitle(const std::string& title)
- {
- if(!mTitleActor)
- {
- mTitleActor = DemoHelper::CreateToolBarLabel( "" );
-
- // Add title to the tool bar.
- mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
- }
-
- mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
- }
-
- /**
- * Main key event handler
- */
- void OnKeyEvent(const KeyEvent& event)
- {
- if(event.state == KeyEvent::Down)
- {
- if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
- {
- mApplication.Quit();
- }
- }
- }
-
-private:
-
- Application& mApplication; ///< Application 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)
-
- ScrollView mScrollView; ///< The ScrollView container for all clusters
- Image mClusterBorderImage; ///< The border frame that appears on each image
-
- std::vector<ClusterInfo> mClusterInfo; ///< Keeps track of each cluster's information.
- int mClusterCount; ///< Current number of clusters in use
- ExampleEffectType mExampleEffect; ///< Current example effect.
-
- Toolkit::PushButton mLayoutButton; ///< The layout button
- ButtonImages mLayoutButtonImages[TOTAL_EFFECTS]; ///< Image when no layout
-};
-
-// Entry point for Linux & Tizen applications
-//
-int main(int argc, char **argv)
-{
- Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH);
- ClusterController test(app);
- app.MainLoop();
-
- return 0;
-}
+++ /dev/null
-/*
- * 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/property-array.h>
-#include <dali/devel-api/object/type-registry-helper.h>
-#include <dali/devel-api/scripting/scripting.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::OnSizeSet( 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,
- AlphaFunction::EASE_OUT,
- TimePeriod(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, AlphaFunction::EASE_OUT, TimePeriod(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),
- AlphaFunction::EASE_OUT,
- TimePeriod(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,
- AlphaFunction::EASE_OUT,
- TimePeriod(0.25f),
- front);
- }
-}
-
-void Cluster::CollapseAllChildren( bool front )
-{
- for(unsigned int index = 0;index < mChildren.size(); index++)
- {
- RestoreChild(index,
- AlphaFunction::EASE_OUT,
- TimePeriod(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, AlphaFunction::EASE_OUT, period);
- animation.AnimateTo( Property(child, Actor::Property::SCALE), scale, AlphaFunction::EASE_OUT, period);
- animation.AnimateTo( Property(child, Actor::Property::ORIENTATION), rotation, AlphaFunction::EASE_OUT, 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::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,
- AlphaFunction::EASE_OUT,
- TimePeriod(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, AlphaFunction::EASE_OUT, TimePeriod(duration));
- }
-}
-
-void Cluster::UpdateTitle(float duration)
-{
- if (mTitle)
- {
- mClusterStyle.ApplyStyleToTitle(mTitle, AlphaFunction::EASE_OUT, TimePeriod(duration));
- }
-}
-
-void Cluster::DoExpandAction(const Property::Map& attributes)
-{
- Property::Value* value = attributes.Find( "indices" );
-
- if( value )
- {
- if( value->GetType() == Property::ARRAY )
- {
- Property::Array array = value->Get<Property::Array>();
- for( size_t i = 0; i < array.Size(); i++ )
- {
- Property::Value& item = array[i];
- DALI_ASSERT_ALWAYS(item.GetType() == Property::INTEGER);
- ExpandChild( item.Get<int>() );
- }
- }
- }
- else
- {
- ExpandAllChildren();
- }
-}
-
-void Cluster::DoCollapseAction(const Property::Map& attributes)
-{
- Property::Value* value = attributes.Find( "indices" );
-
- if( value )
- {
- if( value->GetType() == Property::ARRAY )
- {
- Property::Array array = value->Get<Property::Array>();
- for( size_t i = 0; i < array.Size(); i++ )
- {
- Property::Value& item = array[i];
- DALI_ASSERT_ALWAYS(item.GetType() == Property::INTEGER);
- CollapseChild( item.Get<int>(), false );
- }
- }
- }
- else
- {
- CollapseAllChildren( false );
- }
-}
-
-
-void Cluster::DoTransformAction(const Property::Map& attributes)
-{
- typedef Dali::StringValuePair StringValuePair;
-
- int index = 0;
- Vector3 position;
- Vector3 scale(Vector3::ONE);
- Quaternion rotation( Dali::ANGLE_0, Vector3::ZAXIS );
-
- for(size_t i = 0; i < attributes.Count(); i++)
- {
- StringValuePair& stringValue = attributes.GetPair(i);
- Property::Type type = stringValue.second.GetType();
-
- if( Property::VECTOR3 == type && "position" == stringValue.first )
- {
- stringValue.second.Get( position );
- }
- else if( Property::VECTOR3 == type && "scale" == stringValue.first )
- {
- stringValue.second.Get( scale );
- }
- else if( "rotation" == stringValue.first )
- {
- stringValue.second.Get( rotation );
- }
- }
-
- // wrap index around -1 => size - 1
- index%= mChildren.size();
-
- TransformChild(index, position, scale, rotation, AlphaFunction::EASE_OUT, TimePeriod(0.5f));
-}
-
-void Cluster::OnControlChildRemove(Actor& child)
-{
- child.RemoveConstraints();
-}
-
-bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const Property::Map& 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
+++ /dev/null
-#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::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 Property::Map& 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 Property::Map& 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 Property::Map& 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 Property::Map& attributes);
-
-private: // From Control
-
- /**
- * @copydoc Control::OnInitialize()
- */
- virtual void OnInitialize();
-
- /**
- *
- * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize )
- */
- virtual void OnSizeSet( 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__
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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, TimePeriod(durationSeconds));
-}
-
-void ClusterStyle::ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds)
-{
- GetImpl(*this).ApplyStyleToBackground(background, alpha, TimePeriod(durationSeconds));
-}
-
-void ClusterStyle::ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds)
-{
- GetImpl(*this).ApplyStyleToTitle(title, alpha, TimePeriod(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
+++ /dev/null
-#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-function.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__
+++ /dev/null
-/*
- * 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::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
+++ /dev/null
-#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-function.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 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__
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": {"color": [ 1, 1, 1, 1 ]},
"color": [
1,
1,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": {"color": [ 1, 1, 1, 1 ]},
"color": [
1,
1,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.5686274509803921,
0.5294117647058824,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.17647058823529413,
0.5686274509803921,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.7411764705882353,
0,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.23137254901960785,
0.09803921568627451,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.17647058823529413,
0.24313725490196078,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.396078431372549,
0.29411764705882354,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0,
0.6901960784313725,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.20784313725490197,
0.5686274509803921,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.4196078431372549,
0.047058823529411764,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.47843137254901963,
0.42745098039215684,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.4470588235294118,
0.45098039215686275,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
1,
0.4823529411764706,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.43137254901960786,
0,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.8196078431372549,
0.5803921568627451,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.6313725490196078,
0.6274509803921569,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.9176470588235294,
0,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.24313725490196078,
0.25882352941176473,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0,
1,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
1,
0.8980392156862745,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0,
0.6,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
1,
0,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.01568627450980392,
0,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.2784313725490196,
0.1803921568627451,
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": { "color": [1,1,1,1] },
"color": [
0.1568627450980392,
0.9215686274509803,
"text": "Hello World",
"parent-origin": "TOP_CENTER",
"anchor-point": "TOP_CENTER",
- "background-color": [1, 0, 0, 1],
"position": [0, 50, 0],
"point-size": 40,
- "size": [400, 150, 1]
+ "size": [400, 150, 1],
+ "background":{
+ "color": [1, 0, 0, 1]
+ }
},
// A container with a yellow background
"relayout-enabled": false,
"parent-origin": "CENTER",
"anchor-point": "BOTTOM_CENTER",
- "background-color": [1, 1, 0, 1],
- "size": [400, 150, 1]
+ "size": [400, 150, 1],
+ "background":{
+ "color": [1, 1, 0, 1]
+ }
},
// A container with an image
"parent-origin": "CENTER",
"anchor-point": "TOP_CENTER",
"size": [400, 150, 1],
- "background-image": {
+ "background": {
"filename": "{DALI_IMAGE_DIR}button-background.png"
}
},
"parent-origin": "BOTTOM_CENTER",
"anchor-point": "BOTTOM_CENTER",
"size": [400, 150, 1],
- "background-color": [0, 0, 1, 1],
- "background-image": {
+ "background": {
"filename": "{DALI_IMAGE_DIR}button-background.png"
}
}
60,
1
],
- "background-color": [
- 0.95,
- 0.41,
- 0.18,
- 1
- ],
+ "background": {"color": [0.95, 0.41, 0.18, 1] },
"color-alpha": 0
}
},
1
],
"sizeAspectRatio": false,
- "background-color": [
- 0.85,
- 0.75,
- 0.45,
- 1
- ],
+ "background": { "color": [0.85, 0.75, 0.45, 1] },
"color-alpha": 0
},
{
"stage": [
{
"type": "Control",
- "background-color": [ 1, 1, 1, 1 ],
+ "background": {"color": [ 1, 1, 1, 1 ]},
"parent-origin": "TOP_LEFT",
"anchor-point": "TOP_LEFT",
"draw-mode": "STENCIL",
1
],
"sizeAspectRatio": false,
- "background-color": [
- 1,
- 1,
- 1,
- 1
- ],
+ "background": {"color": [ 1, 1, 1, 1 ]},
"color": [
1,
1,
1
],
"sizeAspectRatio": false,
- "background-color": [
+ "background": {"color": [
0.788235294117647,
0.7647058823529411,
0.7647058823529411,
1
- ],
+ ] },
"color": [
0.788235294117647,
0.7647058823529411,
"selection-type":
{
"type": "Control",
- "background-color": [ 1, 0.5, 0, 0.6 ],
+ "background": {"color": [ 1, 0.5, 0, 0.6 ]},
"color-alpha": 0.05,
"parent-origin": "CENTER",
"anchor-point": "CENTER",
{
"type": "Control",
"name": "stencil",
- "background-color": [ 1, 1, 1, 1 ],
+ "background": {"color": [ 1, 1, 1, 1 ]},
"parent-origin": "CENTER",
"anchor-point": "CENTER",
"draw-mode": "STENCIL",
"stage": [
{
"type": "Control",
- "background-color": [ 1, 1, 1, 1 ],
+ "background": {"color": [ 1, 1, 1, 1 ]},
"parent-origin": "TOP_LEFT",
"anchor-point": "TOP_LEFT",
"draw-mode": "STENCIL",
1
],
"sizeAspectRatio": false,
- "background-color": [
+ "background":{"color": [
0,
0,
0,
1
- ]
+ ]}
},
{
"type": "Control",
1
],
"sizeAspectRatio": false,
- "background-color": [
+ "background":{ "color": [
0.33725490196078434,
0.7568627450980392,
0.6509803921568628,
1
- ],
+ ]},
"color": [
0.33725490196078434,
0.7568627450980392,
1
],
"sizeAspectRatio": false,
- "background-color": [
+ "background": {"color": [
1,
1,
1,
1
- ],
+ ]},
"color": [
1,
1,
1
],
"sizeAspectRatio": false,
- "background-color": [
+ "background":{ "color": [
0.18823529411764706,
0.3411764705882353,
0.403921568627451,
1
- ]
+ ]}
},
{
"type": "ImageActor",
"stage": [{
"name":"simple-table",
"type":"TableView",
- "background-color": [0.5,0.5,0,1],
+ "background":{
+ "color": [0.5,0.5,0,1]
+ },
"parent-origin": "CENTER",
"size":[400,400,1],
"rows": 4,
"size": [ 100, 100, 1 ],
"scale": [ 0.1, 0.1, 1 ],
"color-alpha": 0,
- "background-color": [ 0.95, 0.65, 0.1, 1 ]
+ "background":{ "color": [ 0.95, 0.65, 0.1, 1 ] }
}
},
"stage": [
0,
-1
],
- "background-color": [
+ "background": {"color": [
1,
1,
1,
1
- ],
+ ]},
"signals": [
{
"name": "tapped",
#define DALI_DEMO_STR_TITLE_BUBBLES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUBBLES")
#define DALI_DEMO_STR_TITLE_BLOCKS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BLOCKS")
-#define DALI_DEMO_STR_TITLE_CLUSTER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLUSTER")
#define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION")
#define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION")
#define DALI_DEMO_STR_TITLE_ITEM_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_ITEM_VIEW")
#define DALI_DEMO_STR_TITLE_BUBBLES "Bubbles"
#define DALI_DEMO_STR_TITLE_BLOCKS "Blocks"
-#define DALI_DEMO_STR_TITLE_CLUSTER "Cluster"
#define DALI_DEMO_STR_TITLE_CUBE_TRANSITION "Cube Effect"
#define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION "Dissolve Effect"
#define DALI_DEMO_STR_TITLE_ITEM_VIEW "Item View"