Commit e193b880408e91c3c21b8ed40a4c03a43369d707

Authored by Lee Morgan
2 parents f0916c53 4bf641b9

[dali_1.0.40] Merge branch 'tizen'

Change-Id: Id72a4c7a907ee04179c9ef09efdf84dcc2dc8643
Showing 46 changed files with 3417 additions and 151 deletions
com.samsung.dali-demo.xml
... ... @@ -53,8 +53,8 @@
53 53 <label>Refraction effect</label>
54 54 </ui-application>
55 55 <ui-application appid="scripting.example" exec="/usr/apps/com.samsung.dali-demo/bin/scripting.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
56   - <label>Scroll View</label>
57   - </ui-application>
  56 + <label>Scroll View</label>
  57 + </ui-application>
58 58 <ui-application appid="scroll-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/scroll-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
59 59 <label>Scroll View</label>
60 60 </ui-application>
... ... @@ -67,8 +67,11 @@
67 67 <ui-application appid="builder.example" exec="/usr/apps/com.samsung.dali-demo/bin/builder.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
68 68 <label>Script Based UI</label>
69 69 </ui-application>
  70 + <ui-application appid="image-scaling-and-filtering.example" exec="/usr/apps/com.samsung.dali-demo/bin/image-scaling-and-filtering.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
  71 + <label>Image Fitting and Sampling</label>
  72 + </ui-application>
70 73 <ui-application appid="image-scaling-irregular-grid.example" exec="/usr/apps/com.samsung.dali-demo/bin/image-scaling-irregular-grid.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
71   - <label>Image Scaling Modes</label>
  74 + <label>Image Scaling Grid</label>
72 75 </ui-application>
73 76 <ui-application appid="buttons.example" exec="/usr/apps/com.samsung.dali-demo/bin/buttons.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
74 77 <label>Buttons</label>
... ...
demo/dali-demo.cpp
... ... @@ -51,6 +51,7 @@ int main(int argc, char **argv)
51 51 demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW));
52 52 demo.AddExample(Example("shadow-bone-lighting.example", DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS));
53 53 demo.AddExample(Example("builder.example", DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI));
  54 + demo.AddExample(Example("image-scaling-and-filtering.example", DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING));
54 55 demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING));
55 56 demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL));
56 57 demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE));
... ...
demo/dali-table-view.cpp
... ... @@ -86,8 +86,6 @@ const Vector2 POSITION_SWING_3DEFFECT( 0.55f, 0.4f ); ///&lt; Position
86 86 const Vector3 ANCHOR_3DEFFECT_STYLE0( -105.0f, 30.0f, -240.0f ); ///< Rotation Anchor position for 3D Effect (Style 0)
87 87 const Vector3 ANCHOR_3DEFFECT_STYLE1( 65.0f, -70.0f, -500.0f ); ///< Rotation Anchor position for 3D Effect (Style 1)
88 88  
89   -const Dali::Vector4 TABLE_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
90   -
91 89 Vector3 ScalePointSize(const Vector3& vec)
92 90 {
93 91 return Vector3( DemoHelper::ScalePointSize( vec.x ), DemoHelper::ScalePointSize( vec.y ), DemoHelper::ScalePointSize( vec.z ) );
... ... @@ -479,8 +477,8 @@ void DaliTableView::Rotate( unsigned int degrees )
479 477 }
480 478  
481 479 mRotateAnimation = Animation::New( ROTATE_ANIMATION_TIME );
482   - mRotateAnimation.AnimateTo( Property( mRootActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 - degrees ) ), Vector3::ZAXIS ), AlphaFunctions::EaseOut );
483   - mRotateAnimation.AnimateTo( Property( mRootActor, Actor::Property::SIZE ), targetSize, AlphaFunctions::EaseOut );
  480 + mRotateAnimation.AnimateTo( Property( mRootActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 - degrees ) ), Vector3::ZAXIS ), AlphaFunction::EASE_OUT );
  481 + mRotateAnimation.AnimateTo( Property( mRootActor, Actor::Property::SIZE ), targetSize, AlphaFunction::EASE_OUT );
484 482 mRotateAnimation.Play();
485 483 }
486 484  
... ... @@ -523,7 +521,6 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit
523 521 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
524 522 label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
525 523 label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
526   - label.SetColor( TABLE_TEXT_STYLE_COLOR );
527 524 content.Add( label );
528 525  
529 526 // Set the tile to be keyboard focusable
... ... @@ -592,9 +589,9 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent&amp; event )
592 589  
593 590 // scale the content actor within the Tile, as to not affect the placement within the Table.
594 591 Actor content = actor.GetChildAt(0);
595   - mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3( 0.9f, 0.9f, 1.0f ), AlphaFunctions::EaseInOut,
  592 + mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3( 0.9f, 0.9f, 1.0f ), AlphaFunction::EASE_IN_OUT,
596 593 TimePeriod( 0.0f, BUTTON_PRESS_ANIMATION_TIME * 0.5f ) );
597   - mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3::ONE, AlphaFunctions::EaseInOut,
  594 + mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3::ONE, AlphaFunction::EASE_IN_OUT,
598 595 TimePeriod( BUTTON_PRESS_ANIMATION_TIME * 0.5f, BUTTON_PRESS_ANIMATION_TIME * 0.5f ) );
599 596 mPressedAnimation.Play();
600 597 mPressedAnimation.FinishedSignal().Connect( this, &DaliTableView::OnPressedAnimationFinished );
... ... @@ -759,7 +756,7 @@ void DaliTableView::InitialiseBackgroundActors( Actor actor )
759 756  
760 757 // Kickoff animation
761 758 Animation animation = Animation::New( Random::Range( 40.0f, 80.0f ) );
762   - animation.AnimateBy( Property( child, Actor::Property::POSITION ), Vector3( 0.0f, -1.0f, 0.0f ), AlphaFunctions::Linear );
  759 + animation.AnimateBy( Property( child, Actor::Property::POSITION ), Vector3( 0.0f, -1.0f, 0.0f ), AlphaFunction::LINEAR );
763 760 animation.SetLooping( true );
764 761 animation.Play();
765 762 mBackgroundAnimations.push_back( animation );
... ...
examples/animated-shapes/animated-shapes-example.cpp
... ... @@ -55,16 +55,14 @@ public:
55 55 Stage stage = Stage::GetCurrent();
56 56  
57 57 //Create a view
58   - mView = Dali::Toolkit::View::New();
  58 + mView = Dali::Toolkit::Control::New();
  59 + mView.SetAnchorPoint( Dali::AnchorPoint::CENTER );
  60 + mView.SetParentOrigin( Dali::ParentOrigin::CENTER );
59 61 mView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
60 62 stage.Add( mView );
61 63  
62 64 //Set background image for the view
63   - Image image = ResourceImage::New( BACKGROUND_IMAGE );
64   -
65   -
66   - Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( image );
67   - mView.SetBackground( backgroundImageActor );
  65 + mView.SetBackgroundImage( ResourceImage::New( BACKGROUND_IMAGE ) );
68 66  
69 67 CreateTriangleMorph(Vector3( stage.GetSize().x*0.5f,stage.GetSize().y*0.15f,0.0f), 100.0f );
70 68 CreateCircleMorph( Vector3( stage.GetSize().x*0.5f,stage.GetSize().y*0.85f,0.0f), 60.0f );
... ... @@ -145,25 +143,25 @@ public:
145 143 k0.Add( 0.0f, Vector3( 0.0f,-radius, 0.0f) );
146 144 k0.Add( 0.5f, Vector3(0.0f, -radius*4.0f, 0.0f));
147 145 k0.Add( 1.0f, Vector3( 0.0f,-radius, 0.0f) );
148   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(1)),k0,AlphaFunctions::EaseInOutSine );
  146 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(1)),k0,AlphaFunction::EASE_IN_OUT );
149 147  
150 148 k0 = KeyFrames::New();
151 149 k0.Add( 0.0f, Vector3( radius, 0.0f, 0.0f) );
152 150 k0.Add( 0.5f, Vector3(radius*4.0f,0.0f, 0.0f));
153 151 k0.Add( 1.0f, Vector3( radius,0.0f, 0.0f));
154   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(4)),k0,AlphaFunctions::EaseInOutSine );
  152 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(4)),k0,AlphaFunction::EASE_IN_OUT );
155 153  
156 154 k0 = KeyFrames::New();
157 155 k0.Add( 0.0f, Vector3(0.0f,radius, 0.0f) );
158 156 k0.Add( 0.5f, Vector3(0.0f,radius*4.0f, 0.0f));
159 157 k0.Add( 1.0f, Vector3(0.0f,radius, 0.0f) );
160   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(7)),k0,AlphaFunctions::EaseInOutSine );
  158 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(7)),k0,AlphaFunction::EASE_IN_OUT );
161 159  
162 160 k0 = KeyFrames::New();
163 161 k0.Add( 0.0f, Vector3( -radius, 0.0f, 0.0f) );
164 162 k0.Add( 0.5f, Vector3(-radius*4.0f,0.0f, 0.0f));
165 163 k0.Add( 1.0f, Vector3( -radius, 0.0f, 0.0f) );
166   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(10)),k0,AlphaFunctions::EaseInOutSine );
  164 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(10)),k0,AlphaFunction::EASE_IN_OUT );
167 165  
168 166 animation.AnimateBy( Property( meshActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(90.0f) ), Vector3::ZAXIS ) );
169 167 animation.SetLooping( true );
... ... @@ -246,19 +244,19 @@ public:
246 244 k0.Add( 0.0f,v3 );
247 245 k0.Add( 0.5f, v3 + Vector3(-200.0f,-200.0f,0.0f));
248 246 k0.Add( 1.0f, v3 );
249   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(1)),k0,AlphaFunctions::EaseInOutSine );
  247 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(1)),k0,AlphaFunction::EASE_IN_OUT );
250 248  
251 249 k0 = KeyFrames::New();
252 250 k0.Add( 0.0f,v4 );
253 251 k0.Add( 0.5f, v4 + Vector3(200.0f,-200.0f,0.0f));
254 252 k0.Add( 1.0f, v4 );
255   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(4)),k0,AlphaFunctions::EaseInOutSine );
  253 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(4)),k0,AlphaFunction::EASE_IN_OUT );
256 254  
257 255 k0 = KeyFrames::New();
258 256 k0.Add( 0.0f,v5 );
259 257 k0.Add( 0.5f, v5 + Vector3(0.0,200.0f,0.0f));
260 258 k0.Add( 1.0f, v5 );
261   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(7)),k0,AlphaFunctions::EaseInOutSine );
  259 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(7)),k0,AlphaFunction::EASE_IN_OUT );
262 260 animation.SetLooping( true );
263 261 animation.Play();
264 262 }
... ... @@ -326,25 +324,25 @@ public:
326 324 k0.Add( 0.0f, Vector3( 0.0f,-radius*2.0, 0.0f) );
327 325 k0.Add( 0.5f, Vector3(-radius*2.0, -radius*3.0f, 0.0f));
328 326 k0.Add( 1.0f, Vector3( 0.0f,-radius*2.0, 0.0f) );
329   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(1)),k0,AlphaFunctions::EaseInOutSine );
  327 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(1)),k0,AlphaFunction::EASE_IN_OUT );
330 328  
331 329 k0 = KeyFrames::New();
332 330 k0.Add( 0.0f, Vector3( radius*2.0, 0.0f, 0.0f) );
333 331 k0.Add( 0.5f, Vector3(radius*3.0f,-radius*2.0, 0.0f));
334 332 k0.Add( 1.0f, Vector3( radius*2.0,0.0f, 0.0f));
335   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(4)),k0,AlphaFunctions::EaseInOutSine );
  333 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(4)),k0,AlphaFunction::EASE_IN_OUT );
336 334  
337 335 k0 = KeyFrames::New();
338 336 k0.Add( 0.0f, Vector3(0.0f,radius*2.0, 0.0f) );
339 337 k0.Add( 0.5f, Vector3(radius*2.0,radius*3.0f, 0.0f));
340 338 k0.Add( 1.0f, Vector3(0.0f,radius*2.0, 0.0f) );
341   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(7)),k0,AlphaFunctions::EaseInOutSine );
  339 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(7)),k0,AlphaFunction::EASE_IN_OUT );
342 340  
343 341 k0 = KeyFrames::New();
344 342 k0.Add( 0.0f, Vector3( -radius*2.0, 0.0f, 0.0f) );
345 343 k0.Add( 0.5f, Vector3(-radius*3.0f,radius*2.0, 0.0f));
346 344 k0.Add( 1.0f, Vector3( -radius*2.0, 0.0f, 0.0f) );
347   - animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(10)),k0,AlphaFunctions::EaseInOutSine );
  345 + animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(10)),k0,AlphaFunction::EASE_IN_OUT );
348 346  
349 347 animation.AnimateBy( Property( meshActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(-90.0f) ), Vector3::ZAXIS ) );
350 348 animation.SetLooping( true );
... ... @@ -364,7 +362,7 @@ public:
364 362  
365 363 private:
366 364 Application& mApplication;
367   - Toolkit::View mView;
  365 + Toolkit::Control mView;
368 366 };
369 367  
370 368 void RunTest( Application& application )
... ...
examples/atlas/atlas-example.cpp
... ... @@ -207,7 +207,7 @@ private:
207 207 Application& mApplication;
208 208 PanGestureDetector mPanGestureDetector;
209 209  
210   - Toolkit::View mView; ///< The View instance.
  210 + Toolkit::Control mView; ///< The View instance.
211 211 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
212 212 Layer mContentLayer; ///< Content layer (scrolling cluster content)
213 213 Toolkit::PushButton mLoseContextButton;
... ...
examples/blocks/blocks-example.cpp
... ... @@ -595,8 +595,8 @@ private:
595 595  
596 596 mDragActor = actor;
597 597 mDragAnimation = Animation::New(0.25f);
598   - mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.1f, 1.1f, 1.0f), AlphaFunctions::EaseOut);
599   - mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 0.0f), AlphaFunctions::EaseOut);
  598 + mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.1f, 1.1f, 1.0f), AlphaFunction::EASE_OUT);
  599 + mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 0.0f), AlphaFunction::EASE_OUT);
600 600 mDragAnimation.Play();
601 601 }
602 602 }
... ... @@ -621,8 +621,8 @@ private:
621 621 if(point.state==TouchPoint::Up) // Stop dragging
622 622 {
623 623 mDragAnimation = Animation::New(0.25f);
624   - mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.0f, 1.0f, 1.0f), AlphaFunctions::EaseIn);
625   - mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f), AlphaFunctions::EaseOut);
  624 + mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.0f, 1.0f, 1.0f), AlphaFunction::EASE_IN);
  625 + mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f), AlphaFunction::EASE_OUT);
626 626 mDragAnimation.Play();
627 627 mDragActor.Reset();
628 628 }
... ... @@ -764,7 +764,7 @@ private:
764 764  
765 765 // fade brick (destroy)
766 766 Animation destroyAnimation = Animation::New(0.5f);
767   - destroyAnimation.AnimateTo( Property( brick, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunctions::EaseIn );
  767 + destroyAnimation.AnimateTo( Property( brick, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunction::EASE_IN );
768 768 destroyAnimation.Play();
769 769 destroyAnimation.FinishedSignal().Connect( this, &ExampleController::OnBrickDestroyed );
770 770 mDestroyAnimationMap[destroyAnimation] = brick;
... ... @@ -806,7 +806,7 @@ private:
806 806 private:
807 807  
808 808 Application& mApplication; ///< Application instance
809   - Toolkit::View mView; ///< The View instance.
  809 + Toolkit::Control mView; ///< The View instance.
810 810 Layer mContentLayer; ///< The content layer (contains game actors)
811 811 ImageActor mBall; ///< The Moving ball image.
812 812 Vector3 mBallStartPosition; ///< Ball Start position
... ...
examples/bubble-effect/bubble-effect-example.cpp
... ... @@ -101,7 +101,7 @@ private:
101 101 // Creates a default view with a default tool bar.
102 102 // The view is added to the stage.
103 103 Toolkit::ToolBar toolBar;
104   - Toolkit::View view;
  104 + Toolkit::Control view;
105 105 Layer content = DemoHelper::CreateView( app,
106 106 view,
107 107 toolBar,
... ... @@ -141,8 +141,8 @@ private:
141 141 content.Add( bubbleRoot );
142 142  
143 143 // Add the background image actor to stage
144   - mBackgroundActor = ImageActor::New( mBackgroundImage );
145   - view.SetBackground( mBackgroundActor );
  144 + view.SetBackgroundImage( mBackgroundImage );
  145 + mBackgroundActor = ImageActor::DownCast( view.GetBackgroundActor() );
146 146  
147 147 // Set up the timer to emit bubble regularly when the finger is touched down but not moved
148 148 mTimerForBubbleEmission = Timer::New( mTimerInterval );
... ...
examples/builder/examples.cpp
... ... @@ -275,6 +275,7 @@ public:
275 275 void EnterSelection()
276 276 {
277 277 Stage stage = Stage::GetCurrent();
  278 + stage.SetBackgroundColor( Color::WHITE );
278 279  
279 280 mTapDetector = TapGestureDetector::New();
280 281 mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap );
... ... @@ -587,7 +588,7 @@ private:
587 588 GridLayoutPtr mGridLayout;
588 589 ItemView mItemView;
589 590  
590   - Toolkit::View mView;
  591 + Toolkit::Control mView;
591 592 unsigned int mOrientation;
592 593  
593 594 Toolkit::ToolBar mToolBar;
... ...
examples/buttons/buttons-example.cpp
... ... @@ -484,7 +484,7 @@ class ButtonsController: public ConnectionTracker
484 484 {
485 485 if( mAnimation )
486 486 {
487   - mAnimation.AnimateBy( Property(actor, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear );
  487 + mAnimation.AnimateBy( Property(actor, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunction::LINEAR );
488 488 mAnimation.Play();
489 489 mLastPoint = localPoint;
490 490 }
... ... @@ -497,7 +497,7 @@ class ButtonsController: public ConnectionTracker
497 497 private:
498 498  
499 499 Application& mApplication;
500   - Toolkit::View mView; ///< The View instance.
  500 + Toolkit::Control mView; ///< The View instance.
501 501 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
502 502 Layer mContentLayer; ///< Content layer
503 503  
... ...
examples/cluster/cluster-example.cpp
... ... @@ -22,7 +22,12 @@
22 22 #include <dali/dali.h>
23 23 #include <dali-toolkit/dali-toolkit.h>
24 24  
  25 +#include "cluster.h"
  26 +#include "cluster-style.h"
  27 +
  28 +
25 29 using namespace Dali;
  30 +using namespace Dali::Demo;
26 31 using namespace Dali::Toolkit;
27 32 using namespace DemoHelper;
28 33  
... ... @@ -449,8 +454,6 @@ public:
449 454  
450 455 Stage::GetCurrent().KeyEventSignal().Connect(this, &ClusterController::OnKeyEvent);
451 456  
452   - Vector2 stageSize = Stage::GetCurrent().GetSize();
453   -
454 457 // The Init signal is received once (only) during the Application lifetime
455 458  
456 459 // Hide the indicator bar
... ... @@ -477,7 +480,7 @@ public:
477 480  
478 481 // create and setup the scroll view...
479 482 mScrollView = ScrollView::New();
480   - mScrollView.SetSize(stageSize);
  483 + mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
481 484  
482 485 // attach Wobble Effect to ScrollView
483 486 mScrollViewEffect = ScrollViewWobbleEffect::New();
... ... @@ -842,9 +845,9 @@ public:
842 845 private:
843 846  
844 847 Application& mApplication; ///< Application instance
845   - Toolkit::View mView; ///< The View instance.
  848 + Toolkit::Control mView; ///< The View instance.
846 849 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
847   - TextLabel mTitleActor; ///< The Toolbar's Title.
  850 + TextLabel mTitleActor; ///< The Toolbar's Title.
848 851  
849 852 Layer mContentLayer; ///< Content layer (scrolling cluster content)
850 853  
... ...
examples/cluster/cluster-impl.cpp 0 โ†’ 100644
  1 +/*
  2 + * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +// CLASS HEADER
  19 +#include "cluster-impl.h"
  20 +
  21 +// EXTERNAL INCLUDES
  22 +#include <algorithm>
  23 +#include <cstring> // for strcmp
  24 +#include <dali/public-api/animation/animation.h>
  25 +#include <dali/public-api/object/type-registry.h>
  26 +#include <dali/public-api/object/type-registry-helper.h>
  27 +#include <dali/integration-api/debug.h>
  28 +
  29 +// INTERNAL INCLUDES
  30 +#include "cluster-style.h"
  31 +#include "cluster-style-impl.h"
  32 +
  33 +using namespace Dali;
  34 +
  35 +namespace Dali
  36 +{
  37 +
  38 +namespace Demo
  39 +{
  40 +
  41 +namespace Internal
  42 +{
  43 +
  44 +namespace
  45 +{
  46 +
  47 +BaseHandle Create()
  48 +{
  49 + Demo::ClusterStyleStandard s = Demo::ClusterStyleStandard::New( Demo::ClusterStyleStandard::ClusterStyle1 );
  50 + return Demo::Cluster::New( s );
  51 +}
  52 +
  53 +DALI_TYPE_REGISTRATION_BEGIN( Demo::Cluster, Toolkit::Control, Create )
  54 +
  55 +DALI_ACTION_REGISTRATION( Demo, Cluster, "expand", ACTION_EXPAND )
  56 +DALI_ACTION_REGISTRATION( Demo, Cluster, "collapse", ACTION_COLLAPSE )
  57 +DALI_ACTION_REGISTRATION( Demo, Cluster, "transform", ACTION_TRANSFORM )
  58 +
  59 +DALI_TYPE_REGISTRATION_END()
  60 +
  61 +const float CLUSTER_STYLE_CONSTRAINT_DURATION = 1.0f;
  62 +
  63 +}
  64 +
  65 +///////////////////////////////////////////////////////////////////////////////////////////////////
  66 +// Cluster
  67 +///////////////////////////////////////////////////////////////////////////////////////////////////
  68 +
  69 +Dali::Demo::Cluster Cluster::New(Demo::ClusterStyle& style)
  70 +{
  71 + // Create the implementation
  72 + ClusterPtr cluster(new Cluster(style));
  73 +
  74 + // Pass ownership to CustomActor via derived handle
  75 + Dali::Demo::Cluster handle(*cluster);
  76 +
  77 + // Second-phase init of the implementation
  78 + // This can only be done after the CustomActor connection has been made...
  79 + cluster->Initialize();
  80 +
  81 + return handle;
  82 +}
  83 +
  84 +Cluster::Cluster(Demo::ClusterStyle& style)
  85 +: Toolkit::Internal::Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | DISABLE_SIZE_NEGOTIATION ) ),
  86 + mClusterStyle(style),
  87 + mExpandedCount(0)
  88 +{
  89 +}
  90 +
  91 +void Cluster::OnInitialize()
  92 +{
  93 +}
  94 +
  95 +void Cluster::OnControlSizeSet( const Vector3& targetSize )
  96 +{
  97 + mClusterSize = targetSize;
  98 + GetImpl(mClusterStyle).SetClusterSize(targetSize);
  99 +
  100 + for(ChildInfoIter iter = mChildren.begin(); iter != mChildren.end(); ++iter)
  101 + {
  102 +
  103 + if((*iter).mActor)
  104 + {
  105 + mClusterStyle.ApplyStyle( (*iter).mActor,
  106 + (*iter).mPositionIndex,
  107 + AlphaFunction::EASE_OUT,
  108 + TimePeriod(0.f) );
  109 + }
  110 + }
  111 +
  112 + UpdateBackground(0.f);
  113 + UpdateTitle(0.f);
  114 +}
  115 +
  116 +Cluster::~Cluster()
  117 +{
  118 +}
  119 +
  120 +void Cluster::AddChild( Actor child )
  121 +{
  122 + // automatically add child with a position at end.
  123 + AddChild( child, mChildren.size() );
  124 +}
  125 +
  126 +void Cluster::AddChild( Actor child, unsigned int positionIndex )
  127 +{
  128 + AddChildInfo( ChildInfo(child, positionIndex) );
  129 +}
  130 +
  131 +void Cluster::AddChildAt( Actor child, unsigned int index )
  132 +{
  133 + // automatically add child with a position at end.
  134 + AddChild( child, mChildren.size() );
  135 +}
  136 +
  137 +void Cluster::AddChildAt( Actor child, unsigned int positionIndex, unsigned int index )
  138 +{
  139 + AddChildInfoAt( ChildInfo(child, positionIndex), index );
  140 +}
  141 +
  142 +void Cluster::AddChildInfo( ChildInfo childInfo )
  143 +{
  144 + AddChildInfoAt(childInfo, mChildren.size());
  145 +}
  146 +
  147 +void Cluster::AddChildInfoAt( ChildInfo childInfo, unsigned int index )
  148 +{
  149 + // check that the child is valid
  150 + DALI_ASSERT_ALWAYS( childInfo.mActor );
  151 +
  152 + ChildInfoIter offset = index < mChildren.size() ? (mChildren.begin() + index) : mChildren.end();
  153 + // now perform customization on this child.
  154 +
  155 + // adopt the child
  156 + if(childInfo.mActor.GetParent() != Self())
  157 + {
  158 + Actor& child = childInfo.mActor;
  159 + const float depth = std::distance(mChildren.begin(), offset);
  160 +
  161 + Property::Index depthProperty = child.GetPropertyIndex(Demo::Cluster::CLUSTER_ACTOR_DEPTH);
  162 + if(depthProperty == Property::INVALID_INDEX)
  163 + {
  164 + child.RegisterProperty(Demo::Cluster::CLUSTER_ACTOR_DEPTH, depth);
  165 + }
  166 +
  167 + // not added prior
  168 + Self().Add( childInfo.mActor );
  169 + mChildren.insert( offset, childInfo );
  170 +
  171 + // Use parent position plus relative position.
  172 + child.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
  173 +
  174 + // remove old constraints
  175 + child.RemoveConstraints();
  176 +
  177 + // apply new constraints to the child
  178 + mClusterStyle.ApplyStyle(child, childInfo.mPositionIndex, AlphaFunction::EASE_OUT, TimePeriod(0.0f));
  179 + }
  180 + else
  181 + {
  182 + // already added.
  183 + ChildInfoContainer mNewChildren;
  184 + ChildInfoIter iter = mChildren.begin();
  185 + float depth = 0.0f;
  186 +
  187 + for( ; iter != mChildren.end(); ++iter)
  188 + {
  189 + if(iter == offset)
  190 + {
  191 + SetDepth(childInfo, depth);
  192 + depth++;
  193 + // insert the new childInfo before offset.
  194 + mNewChildren.push_back(childInfo);
  195 + }
  196 + // copy all children except the one that we wish to move.
  197 + if((*iter).mActor != childInfo.mActor)
  198 + {
  199 + SetDepth(*iter, depth);
  200 + depth++;
  201 + mNewChildren.push_back(*iter);
  202 + }
  203 + } // end for.
  204 +
  205 + if(iter == offset)
  206 + {
  207 + SetDepth(childInfo, depth);
  208 + // insert the new childInfo before offset (end).
  209 + mNewChildren.push_back(childInfo);
  210 + }
  211 +
  212 + mChildren = mNewChildren;
  213 +
  214 + // Todo somehow adjust their perceived depth.
  215 + }
  216 +}
  217 +
  218 +void Cluster::SetDepth( ChildInfo& childInfo, float depth )
  219 +{
  220 + Property::Index depthProperty = childInfo.mActor.GetPropertyIndex(Demo::Cluster::CLUSTER_ACTOR_DEPTH);
  221 + childInfo.mActor.SetProperty( depthProperty, depth );
  222 +}
  223 +
  224 +ChildInfo Cluster::GetChildInfoAt( unsigned int index )
  225 +{
  226 + // check if we have this position in the cluster
  227 + if( index < mChildren.size() )
  228 + {
  229 + // return the child handle
  230 + return mChildren[ index ];
  231 + }
  232 +
  233 + // return an empty handle
  234 + return ChildInfo();
  235 +}
  236 +
  237 +Actor Cluster::GetChildAt( unsigned int index )
  238 +{
  239 + // check if we have this position in the cluster
  240 + if( index < mChildren.size() )
  241 + {
  242 + // return the child handle
  243 + return mChildren[ index ].mActor;
  244 + }
  245 +
  246 + // return an empty handle
  247 + return Actor();
  248 +}
  249 +
  250 +Actor Cluster::RemoveChildAt( unsigned int index )
  251 +{
  252 + DALI_ASSERT_ALWAYS( index < mChildren.size() );
  253 +
  254 + ChildInfoIter iter = mChildren.begin() + index;
  255 + Actor child = (*iter).mActor;
  256 + mChildren.erase( iter );
  257 + Self().Remove(child);
  258 + // note: constraints will automatically be removed in OnControlChildRemove
  259 +
  260 + // update depths.
  261 + float depth = 0.0f;
  262 +
  263 + for(ChildInfoIter iter = mChildren.begin(); iter != mChildren.end(); ++iter)
  264 + {
  265 + SetDepth(*iter, depth);
  266 + depth++;
  267 + } // end for.
  268 +
  269 + return child;
  270 +}
  271 +
  272 +void Cluster::ExpandChild( unsigned int index )
  273 +{
  274 + if( index < mChildren.size() )
  275 + {
  276 + ChildInfo& childInfo = mChildren[ index ];
  277 + DALI_ASSERT_ALWAYS(childInfo.mActor);
  278 +
  279 + if(!childInfo.mExpanded)
  280 + {
  281 + // expand child to a random position/angle.
  282 + const Vector3 clusterSize = Self().GetCurrentSize();
  283 + const float length = clusterSize.Length() * 0.1f;
  284 + const float zOffset = 50.0f;
  285 + const float angle = (rand()%360) * Math::PI / 180.0f;
  286 + Vector3 position(sin(angle) * length, -cos(angle) * length, zOffset);
  287 + const float scale(1.2f);
  288 + const Radian rotate( Degree( (rand()%30) - 15 ) );
  289 +
  290 + position += childInfo.mActor.GetCurrentPosition();
  291 +
  292 + TransformChild(index,
  293 + position,
  294 + Vector3::ONE * scale,
  295 + Quaternion(rotate, Vector3::ZAXIS),
  296 + AlphaFunction::EASE_OUT,
  297 + TimePeriod(0.5f));
  298 + }
  299 + }
  300 +}
  301 +
  302 +void Cluster::ExpandAllChildren()
  303 +{
  304 + for(unsigned int index = 0;index < mChildren.size(); index++)
  305 + {
  306 + ExpandChild( index );
  307 + }
  308 +}
  309 +
  310 +void Cluster::CollapseChild( unsigned int index, bool front )
  311 +{
  312 + if( index < mChildren.size() )
  313 + {
  314 + RestoreChild(index,
  315 + AlphaFunction::EASE_OUT,
  316 + TimePeriod(0.25f),
  317 + front);
  318 + }
  319 +}
  320 +
  321 +void Cluster::CollapseAllChildren( bool front )
  322 +{
  323 + for(unsigned int index = 0;index < mChildren.size(); index++)
  324 + {
  325 + RestoreChild(index,
  326 + AlphaFunction::EASE_OUT,
  327 + TimePeriod(0.25f),
  328 + front);
  329 + }
  330 +}
  331 +
  332 +void Cluster::TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period )
  333 +{
  334 + if( index < mChildren.size() )
  335 + {
  336 + ChildInfo& childInfo = mChildren[ index ];
  337 + DALI_ASSERT_ALWAYS(childInfo.mActor);
  338 +
  339 + if(!childInfo.mExpanded)
  340 + {
  341 + Actor child = childInfo.mActor;
  342 + childInfo.mExpanded = true;
  343 + mExpandedCount++;
  344 +
  345 + child.RemoveConstraints();
  346 + Animation animation = Animation::New(period.delaySeconds + period.durationSeconds);
  347 + animation.AnimateTo( Property(child, Actor::Property::POSITION), position, AlphaFunction::EASE_OUT, period);
  348 + animation.AnimateTo( Property(child, Actor::Property::SCALE), scale, AlphaFunction::EASE_OUT, period);
  349 + animation.AnimateTo( Property(child, Actor::Property::ORIENTATION), rotation, AlphaFunction::EASE_OUT, period);
  350 + animation.Play();
  351 + }
  352 + }
  353 +}
  354 +
  355 +void Cluster::RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front )
  356 +{
  357 + if( index < mChildren.size() )
  358 + {
  359 + ChildInfo& childInfo = mChildren[ index ];
  360 + DALI_ASSERT_ALWAYS(childInfo.mActor);
  361 +
  362 + if(childInfo.mExpanded)
  363 + {
  364 + Actor child = childInfo.mActor;
  365 + childInfo.mExpanded = false;
  366 + mExpandedCount--;
  367 + mClusterStyle.ApplyStyle( child, childInfo.mPositionIndex, alpha, period );
  368 +
  369 + const unsigned int hideIndex = front ? mChildren.size() : 0;
  370 + AddChildInfoAt(childInfo, hideIndex); // move child info to the back or front of the pack.
  371 + }
  372 + }
  373 +}
  374 +
  375 +void Cluster::SetBackgroundImage( Actor image )
  376 +{
  377 + // Replaces the background image.
  378 + if(mBackgroundImage && mBackgroundImage.GetParent())
  379 + {
  380 + mBackgroundImage.GetParent().Remove(mBackgroundImage);
  381 + }
  382 +
  383 + mBackgroundImage = image;
  384 + Self().Add(mBackgroundImage);
  385 +
  386 + mBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  387 + mBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
  388 +
  389 + UpdateBackground(0.0f);
  390 +}
  391 +
  392 +void Cluster::SetTitle( Actor text )
  393 +{
  394 + // Replaces the title actor.
  395 + if(mTitle && mTitle.GetParent())
  396 + {
  397 + mTitle.GetParent().Remove( mTitle );
  398 + }
  399 +
  400 + mTitle = text;
  401 + Self().Add( mTitle );
  402 +
  403 + mTitle.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  404 + mTitle.SetParentOrigin( ParentOrigin::TOP_LEFT );
  405 +
  406 + UpdateTitle(0.0f);
  407 +}
  408 +
  409 +void Cluster::SetStyle(Demo::ClusterStyle style)
  410 +{
  411 + unsigned int previousChildrenNum = mChildren.size();
  412 + mClusterStyle = style;
  413 + GetImpl(mClusterStyle).SetClusterSize(mClusterSize);
  414 + unsigned int newChildrenNum = mClusterStyle.GetMaximumNumberOfChildren();
  415 +
  416 + // New style supports less children (remove those that no longer belong)
  417 + if(newChildrenNum < previousChildrenNum)
  418 + {
  419 + ChildInfoIter removeStart = mChildren.begin() + newChildrenNum;
  420 +
  421 + for(ChildInfoIter iter = removeStart; iter != mChildren.end(); ++iter)
  422 + {
  423 + Actor child = (*iter).mActor;
  424 + child.RemoveConstraints();
  425 + Self().Remove(child);
  426 + }
  427 +
  428 + mChildren.erase( removeStart, mChildren.end() );
  429 + }
  430 +
  431 + for(ChildInfoIter iter = mChildren.begin(); iter != mChildren.end(); ++iter)
  432 + {
  433 +
  434 + if((*iter).mActor)
  435 + {
  436 + mClusterStyle.ApplyStyle( (*iter).mActor,
  437 + (*iter).mPositionIndex,
  438 + AlphaFunction::EASE_OUT,
  439 + TimePeriod(CLUSTER_STYLE_CONSTRAINT_DURATION) );
  440 + }
  441 + }
  442 +
  443 + UpdateBackground(CLUSTER_STYLE_CONSTRAINT_DURATION);
  444 + UpdateTitle(CLUSTER_STYLE_CONSTRAINT_DURATION);
  445 +}
  446 +
  447 +Demo::ClusterStyle Cluster::GetStyle() const
  448 +{
  449 + return mClusterStyle;
  450 +}
  451 +
  452 +unsigned int Cluster::GetExpandedCount() const
  453 +{
  454 + return mExpandedCount;
  455 +}
  456 +
  457 +unsigned int Cluster::GetTotalCount() const
  458 +{
  459 + return mChildren.size();
  460 +}
  461 +
  462 +void Cluster::UpdateBackground(float duration)
  463 +{
  464 + if (mBackgroundImage)
  465 + {
  466 + mClusterStyle.ApplyStyleToBackground(mBackgroundImage, AlphaFunction::EASE_OUT, TimePeriod(duration));
  467 + }
  468 +}
  469 +
  470 +void Cluster::UpdateTitle(float duration)
  471 +{
  472 + if (mTitle)
  473 + {
  474 + mClusterStyle.ApplyStyleToTitle(mTitle, AlphaFunction::EASE_OUT, TimePeriod(duration));
  475 + }
  476 +}
  477 +
  478 +void Cluster::DoExpandAction(const PropertyValueContainer& attributes)
  479 +{
  480 + if(attributes.size() >= 1)
  481 + {
  482 + for(PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter)
  483 + {
  484 + const Property::Value& value = *iter;
  485 +
  486 + DALI_ASSERT_ALWAYS(value.GetType() == Property::FLOAT);
  487 + unsigned int index = value.Get<float>();
  488 + ExpandChild( index );
  489 + }
  490 + }
  491 + else
  492 + {
  493 + ExpandAllChildren();
  494 + }
  495 +}
  496 +
  497 +void Cluster::DoCollapseAction(const PropertyValueContainer& attributes)
  498 +{
  499 + if(attributes.size() >= 1)
  500 + {
  501 + for(PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter)
  502 + {
  503 + const Property::Value& value = *iter;
  504 +
  505 + DALI_ASSERT_ALWAYS(value.GetType() == Property::FLOAT);
  506 + unsigned int index = value.Get<float>();
  507 + CollapseChild( index, false );
  508 + }
  509 + }
  510 + else
  511 + {
  512 + CollapseAllChildren( false );
  513 + }
  514 +}
  515 +
  516 +void Cluster::DoTransformAction(const PropertyValueContainer& attributes)
  517 +{
  518 + DALI_ASSERT_ALWAYS(attributes.size() >= 2);
  519 +
  520 + DALI_ASSERT_ALWAYS(attributes[0].GetType() == Property::FLOAT);
  521 + unsigned int index = attributes[0].Get<float>();
  522 + Vector3 position;
  523 + Vector3 scale(Vector3::ONE);
  524 + Quaternion rotation( Dali::ANGLE_0, Vector3::ZAXIS );
  525 +
  526 + DALI_ASSERT_ALWAYS(attributes[1].GetType() == Property::VECTOR3);
  527 + attributes[1].Get(position);
  528 +
  529 + if(attributes.size()>2)
  530 + {
  531 + attributes[2].Get(scale);
  532 + }
  533 +
  534 + if(attributes.size()>3)
  535 + {
  536 + attributes[3].Get(rotation);
  537 + }
  538 +
  539 + // wrap index around -1 => size - 1
  540 + index%= mChildren.size();
  541 +
  542 + TransformChild(index, position, scale, rotation, AlphaFunction::EASE_OUT, TimePeriod(0.5f));
  543 +}
  544 +
  545 +void Cluster::OnControlChildRemove(Actor& child)
  546 +{
  547 + child.RemoveConstraints();
  548 +}
  549 +
  550 +bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes)
  551 +{
  552 + bool ret = false;
  553 +
  554 + Dali::BaseHandle handle( object );
  555 +
  556 + Demo::Cluster cluster = Demo::Cluster::DownCast( handle );
  557 +
  558 + DALI_ASSERT_ALWAYS( cluster );
  559 +
  560 + if( 0 == strcmp( actionName.c_str(), ACTION_EXPAND ) )
  561 + {
  562 + GetImpl( cluster ).DoExpandAction( attributes );
  563 + ret = true;
  564 + }
  565 + else if( 0 == strcmp( actionName.c_str(), ACTION_COLLAPSE ) )
  566 + {
  567 + GetImpl( cluster ).DoCollapseAction( attributes );
  568 + ret = true;
  569 + }
  570 + else if( 0 == strcmp( actionName.c_str(), ACTION_TRANSFORM ) )
  571 + {
  572 + GetImpl( cluster ).DoTransformAction( attributes );
  573 + ret = true;
  574 + }
  575 +
  576 + return ret;
  577 +}
  578 +
  579 +} // namespace Internal
  580 +
  581 +} // namespace Demo
  582 +
  583 +} // namespace Dali
... ...
examples/cluster/cluster-impl.h 0 โ†’ 100644
  1 +#ifndef __DALI_DEMO_INTERNAL_CLUSTER_H__
  2 +#define __DALI_DEMO_INTERNAL_CLUSTER_H__
  3 +
  4 +/*
  5 + * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + *
  19 + */
  20 +
  21 +// EXTERNAL INCLUDES
  22 +#include <dali/public-api/object/ref-object.h>
  23 +
  24 +// INTERNAL INCLUDES
  25 +#include "cluster.h"
  26 +#include "cluster-style.h"
  27 +#include <dali-toolkit/public-api/controls/control-impl.h>
  28 +
  29 +namespace Dali
  30 +{
  31 +
  32 +namespace Demo
  33 +{
  34 +
  35 +namespace Internal
  36 +{
  37 +
  38 +class Cluster;
  39 +
  40 +typedef IntrusivePtr<Cluster> ClusterPtr;
  41 +
  42 +class ChildInfo
  43 +{
  44 +
  45 +public:
  46 +
  47 + ChildInfo()
  48 + : mExpanded(false)
  49 + {
  50 + }
  51 +
  52 + ChildInfo(Actor actor, unsigned int positionIndex)
  53 + : mActor(actor),
  54 + mExpanded(false),
  55 + mPositionIndex(positionIndex)
  56 + {
  57 + }
  58 +
  59 + Actor mActor;
  60 + bool mExpanded;
  61 + unsigned int mPositionIndex;
  62 +};
  63 +
  64 +typedef std::vector<ChildInfo> ChildInfoContainer;
  65 +typedef ChildInfoContainer::iterator ChildInfoIter;
  66 +typedef ChildInfoContainer::const_iterator ChildInfoConstIter;
  67 +
  68 +/**
  69 + * Cluster is a container of grouped actors positioned in different cluster styles.
  70 + * Multiple cluster styles may be provided, to determine the position, size, rotation, scale, color and visibility
  71 + * of the child actors in the cluster.
  72 + */
  73 +class Cluster : public Toolkit::Internal::Control
  74 +{
  75 +public:
  76 +
  77 + /**
  78 + * Create a new Cluster.
  79 + * @param[in] style of the cluster
  80 + * @return A public handle to the newly allocated Cluster.
  81 + */
  82 + static Dali::Demo::Cluster New(Demo::ClusterStyle& style);
  83 +
  84 + /**
  85 + * @copydoc Demo::Cluster::AddChild( Actor child )
  86 + */
  87 + void AddChild( Actor child );
  88 +
  89 + /**
  90 + * @copydoc Demo::Cluster::AddChild( Actor child, unsigned int positionIndex )
  91 + */
  92 + void AddChild( Actor child, unsigned int positionIndex );
  93 +
  94 + /**
  95 + * @copydoc Demo::Cluster::AddChildAt( Actor child, unsigned int index );
  96 + */
  97 + void AddChildAt( Actor child, unsigned int index );
  98 +
  99 + /**
  100 + * @copydoc Demo::Cluster::AddChildAt( Actor child, unsigned int positionIndex, unsigned int index );
  101 + */
  102 + void AddChildAt( Actor child, unsigned int positionIndex, unsigned int index );
  103 +
  104 + /**
  105 + * Adds a ChildInfo struct to the end of the children list.
  106 + * @param[in] childInfo the child info to that to children list.
  107 + */
  108 + void AddChildInfo( ChildInfo childInfo );
  109 +
  110 + /**
  111 + * Adds a ChildInfo struct before the specified index.
  112 + * @param[in] childInfo the child info to that to children list.
  113 + * @param[in] index the index within the children list to insert
  114 + * ChildInfo
  115 + */
  116 + void AddChildInfoAt( ChildInfo childInfo, unsigned int index );
  117 +
  118 + /**
  119 + * @copydoc Demo::Cluster::GetChildAt
  120 + */
  121 + Actor GetChildAt( unsigned int index );
  122 +
  123 + /**
  124 + * @copydoc Demo::Cluster::RemoveChildAt
  125 + */
  126 + Actor RemoveChildAt( unsigned int index );
  127 +
  128 + /**
  129 + * @copydoc Demo::Cluster::ExpandChild
  130 + */
  131 + void ExpandChild( unsigned int index );
  132 +
  133 + /**
  134 + * @copydoc Demo::Cluster::ExpandAllChildren
  135 + */
  136 + void ExpandAllChildren();
  137 +
  138 + /**
  139 + * @copydoc Demo::Cluster::CollapseChild
  140 + */
  141 + void CollapseChild( unsigned int index, bool front );
  142 +
  143 + /**
  144 + * @copydoc Demo::Cluster::CollapseAllChildren
  145 + */
  146 + void CollapseAllChildren( bool front );
  147 +
  148 + /**
  149 + * @copydoc Demo::Cluster::TransformChild
  150 + */
  151 + void TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period );
  152 +
  153 + /**
  154 + * @copydoc Demo::Cluster::RestoreChild
  155 + */
  156 + void RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front );
  157 +
  158 + /**
  159 + * @copydoc Demo::Cluster::SetBackgroundImage
  160 + */
  161 + void SetBackgroundImage( Actor image );
  162 +
  163 + /**
  164 + * @copydoc Demo::Cluster::SetTitle
  165 + */
  166 + void SetTitle( Actor text );
  167 +
  168 + /**
  169 + * @copydoc Demo::Cluster::SetStyle
  170 + */
  171 + void SetStyle(Demo::ClusterStyle style);
  172 +
  173 + /**
  174 + * @copydoc Demo::Cluster::GetStyle
  175 + */
  176 + Demo::ClusterStyle GetStyle() const;
  177 +
  178 + /**
  179 + * @copydoc Demo::Cluster::GetExpandedCount
  180 + */
  181 + unsigned int GetExpandedCount() const;
  182 +
  183 + /**
  184 + * @copydoc Demo::Cluster::GetTotalCount
  185 + */
  186 + unsigned int GetTotalCount() const;
  187 +
  188 +private:
  189 +
  190 + ChildInfo GetChildInfoAt( unsigned int index );
  191 +
  192 + void SetDepth( ChildInfo& childInfo, float depth );
  193 +
  194 + /**
  195 + * Updates the style of the Background
  196 + * (occurs when either background changes or style changes)
  197 + * @param[in] duration apply duration for style
  198 + */
  199 + void UpdateBackground(float duration);
  200 +
  201 + /**
  202 + * Updates the style of the Title
  203 + * (occurs when either background changes or style changes)
  204 + * @param[in] duration apply duration for style
  205 + */
  206 + void UpdateTitle(float duration);
  207 +
  208 + /**
  209 + * Action: Expand
  210 + * Expands one or more actors.
  211 + *
  212 + * @param[in] attributes list of indices of actors to expand.
  213 + * (if no attributes specifies, then all actors expand)
  214 + */
  215 + void DoExpandAction(const PropertyValueContainer& attributes);
  216 +
  217 + /**
  218 + * Action: Collapse
  219 + * Collapses one or more actors.
  220 + *
  221 + * @param[in] attributes list of indices of actors to collapse.
  222 + * (if no attributes specifies, then all actors collapse)
  223 + */
  224 + void DoCollapseAction(const PropertyValueContainer& attributes);
  225 +
  226 + /**
  227 + * Action: Transform
  228 + * Transforms one actor (index) to a specified position (Vector3),
  229 + * scale (Vector3), and rotation (Quaternion).
  230 + *
  231 + * @param[in] attributes index and transform values.
  232 + */
  233 + void DoTransformAction(const PropertyValueContainer& attributes);
  234 +
  235 +private: // From Control
  236 + /**
  237 + * From Control; called shortly before a child is removed from the owning actor.
  238 + * @param[in] child The child being removed.Ptr
  239 + */
  240 + virtual void OnControlChildRemove(Actor& child);
  241 +
  242 +public:
  243 +
  244 + /**
  245 + * Performs actions as requested using the action name.
  246 + * @param[in] object The object on which to perform the action.
  247 + * @param[in] actionName The action to perform.
  248 + * @param[in] attributes The attributes with which to perfrom this action.
  249 + * @return true if action has been accepted by this control
  250 + */
  251 + static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes);
  252 +
  253 +private: // From Control
  254 +
  255 + /**
  256 + * @copydoc Demo::Control::OnInitialize()
  257 + */
  258 + virtual void OnInitialize();
  259 +
  260 + /**
  261 + *
  262 + * @copydoc Demo::Control::OnControlSizeSet( const Vector3& targetSize )
  263 + */
  264 + virtual void OnControlSizeSet( const Vector3& targetSize );
  265 +
  266 +protected:
  267 +
  268 + /**
  269 + * Construct a new Cluster.
  270 + * @param[in] style of the cluster
  271 + */
  272 + Cluster(Demo::ClusterStyle& style);
  273 +
  274 + /**
  275 + * A reference counted object may only be deleted by calling Unreference()
  276 + */
  277 + virtual ~Cluster();
  278 +
  279 +private:
  280 +
  281 + // Undefined
  282 + Cluster(const Cluster&);
  283 +
  284 + // Undefined
  285 + Cluster& operator=(const Cluster& rhs);
  286 +
  287 +private:
  288 +
  289 + Demo::ClusterStyle mClusterStyle;
  290 + ChildInfoContainer mChildren;
  291 + Vector3 mClusterSize;
  292 +
  293 + Actor mBackgroundImage; ///< Stores the background image.
  294 + Actor mTitle; ///< Stores the text title.
  295 + unsigned int mExpandedCount; ///< A count of how many children have been expanded.
  296 +
  297 +};
  298 +
  299 +} // namespace Internal
  300 +
  301 +// Helpers for public-api forwarding methods
  302 +
  303 +inline Demo::Internal::Cluster& GetImpl(Demo::Cluster& cluster)
  304 +{
  305 + DALI_ASSERT_ALWAYS(cluster);
  306 +
  307 + Dali::RefObject& handle = cluster.GetImplementation();
  308 +
  309 + return static_cast<Demo::Internal::Cluster&>(handle);
  310 +}
  311 +
  312 +inline const Demo::Internal::Cluster& GetImpl(const Demo::Cluster& cluster)
  313 +{
  314 + DALI_ASSERT_ALWAYS(cluster);
  315 +
  316 + const Dali::RefObject& handle = cluster.GetImplementation();
  317 +
  318 + return static_cast<const Demo::Internal::Cluster&>(handle);
  319 +}
  320 +
  321 +} // namespace Demo
  322 +
  323 +} // namespace Dali
  324 +
  325 +#endif // __DALI_TOOLKIT_INTERNAL_CLUSTER_H__
... ...
examples/cluster/cluster-style-impl.cpp 0 โ†’ 100644
  1 +/*
  2 + * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +// CLASS HEADER
  19 +#include "cluster-style-impl.h"
  20 +
  21 +// EXTERNAL INCLUDES
  22 +#include <dali/public-api/animation/animation.h>
  23 +
  24 +// INTERNAL INCLUDES
  25 +#include "cluster.h"
  26 +
  27 +namespace Dali
  28 +{
  29 +
  30 +namespace // unnamed namespace
  31 +{
  32 +// Cluster style one
  33 +
  34 +const unsigned int STYLE_1_CHILDREN_NUMBER = 8;
  35 +
  36 +const float STYLE_1_BACKGROUND_IMAGE_OFFSET_Z = 1.0f;
  37 +
  38 +const float STYLE_1_CHILD_OFFSET_Z = 2.0f;
  39 +const float STYLE_1_CHILD_GAP_FACTOR = 0.03f;
  40 +const float STYLE_1_CHILD_SIZE_FACTOR[] = { 0.4f, 0.15f, 0.25f, 0.15f, 0.4f, 0.15f, 0.25f, 0.15f };
  41 +const Vector3 STYLE_1_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  42 + 0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  43 + STYLE_1_CHILD_OFFSET_Z),
  44 + Vector3(0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  45 + 0.5f - STYLE_1_CHILD_SIZE_FACTOR[1] - STYLE_1_CHILD_SIZE_FACTOR[2] - STYLE_1_CHILD_GAP_FACTOR * 1.5f,
  46 + STYLE_1_CHILD_OFFSET_Z + 0.5f),
  47 + Vector3(0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  48 + 0.5f - STYLE_1_CHILD_SIZE_FACTOR[2] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  49 + STYLE_1_CHILD_OFFSET_Z + 1.0f),
  50 + Vector3(0.5f + STYLE_1_CHILD_SIZE_FACTOR[2] + STYLE_1_CHILD_GAP_FACTOR * 1.5f,
  51 + 0.5f - STYLE_1_CHILD_SIZE_FACTOR[3] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  52 + STYLE_1_CHILD_OFFSET_Z + 1.5f),
  53 + Vector3(0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  54 + 0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  55 + STYLE_1_CHILD_OFFSET_Z + 2.0f),
  56 + Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[5] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  57 + 0.5f + STYLE_1_CHILD_SIZE_FACTOR[6] + STYLE_1_CHILD_GAP_FACTOR * 1.5f,
  58 + STYLE_1_CHILD_OFFSET_Z + 2.5f),
  59 + Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[6] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  60 + 0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  61 + STYLE_1_CHILD_OFFSET_Z + 3.0f),
  62 + Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[6] - STYLE_1_CHILD_SIZE_FACTOR[7] - STYLE_1_CHILD_GAP_FACTOR * 1.5f,
  63 + 0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  64 + STYLE_1_CHILD_OFFSET_Z + 3.5f) };
  65 +
  66 +const Vector3 STYLE_1_TITLE_SIZE_FACTOR = Vector3(0.3f, 0.11f, 1.0f);
  67 +const Vector3 STYLE_1_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f,
  68 + 0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f - STYLE_1_TITLE_SIZE_FACTOR.height + 0.02f,
  69 + 0.0f);
  70 +const Vector3 STYLE_1_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f);
  71 +
  72 +// Cluster style two
  73 +
  74 +const unsigned int STYLE_2_CHILDREN_NUMBER = 6;
  75 +
  76 +const float STYLE_2_BACKGROUND_IMAGE_OFFSET_Z = 1.0f;
  77 +
  78 +const float STYLE_2_CHILD_OFFSET_Z = 2.0f;
  79 +const float STYLE_2_CHILD_GAP_FACTOR = 0.03f;
  80 +const float STYLE_2_CHILD_SIZE_FACTOR[] = { 0.4f, 0.25f, 0.15f, 0.4f, 0.25f, 0.15f };
  81 +const Vector3 STYLE_2_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] - STYLE_2_CHILD_GAP_FACTOR * 0.5f,
  82 + 0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] * 0.75f,
  83 + STYLE_2_CHILD_OFFSET_Z),
  84 + Vector3(0.5f + STYLE_2_CHILD_GAP_FACTOR * 0.5f,
  85 + 0.5f - STYLE_2_CHILD_SIZE_FACTOR[1] - STYLE_2_CHILD_SIZE_FACTOR[3] * 0.25f - STYLE_2_CHILD_GAP_FACTOR,
  86 + STYLE_2_CHILD_OFFSET_Z + 0.5f),
  87 + Vector3(0.5f + STYLE_2_CHILD_SIZE_FACTOR[1] + STYLE_2_CHILD_GAP_FACTOR * 1.5f,
  88 + 0.5f - STYLE_2_CHILD_SIZE_FACTOR[2] - STYLE_2_CHILD_SIZE_FACTOR[3] * 0.25f - STYLE_2_CHILD_GAP_FACTOR,
  89 + STYLE_2_CHILD_OFFSET_Z + 1.0f),
  90 + Vector3(0.5f + STYLE_2_CHILD_GAP_FACTOR * 0.5f,
  91 + 0.5f - STYLE_2_CHILD_SIZE_FACTOR[3] * 0.25f,
  92 + STYLE_2_CHILD_OFFSET_Z + 1.5f),
  93 + Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[4] - STYLE_2_CHILD_GAP_FACTOR * 0.5f,
  94 + 0.5f + STYLE_2_CHILD_SIZE_FACTOR[0] * 0.25f + STYLE_2_CHILD_GAP_FACTOR,
  95 + STYLE_2_CHILD_OFFSET_Z + 2.0f),
  96 + Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[4] - STYLE_2_CHILD_SIZE_FACTOR[5] - STYLE_2_CHILD_GAP_FACTOR * 1.5f,
  97 + 0.5f + STYLE_2_CHILD_SIZE_FACTOR[0] * 0.25f + STYLE_2_CHILD_GAP_FACTOR,
  98 + STYLE_2_CHILD_OFFSET_Z + 2.5f) };
  99 +
  100 +const Vector3 STYLE_2_TITLE_SIZE_FACTOR = Vector3(0.3f, 0.11f, 1.0f);
  101 +const Vector3 STYLE_2_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] - STYLE_2_CHILD_GAP_FACTOR * 0.5f,
  102 + 0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] * 0.75f - STYLE_2_TITLE_SIZE_FACTOR.height + 0.02f,
  103 + 0.0f);
  104 +const Vector3 STYLE_2_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f);
  105 +
  106 +// Cluster style three
  107 +
  108 +const unsigned int STYLE_3_CHILDREN_NUMBER = 6;
  109 +
  110 +const Vector3 STYLE_3_TITLE_SIZE_FACTOR = Vector3(0.4f, 0.15f, 1.0f);
  111 +
  112 +const float STYLE_3_BACKGROUND_IMAGE_OFFSET_Z = 1.0f;
  113 +
  114 +const float STYLE_3_CHILD_OFFSET_Z = 2.0f;
  115 +const float STYLE_3_CHILD_GAP_FACTOR = 0.03f;
  116 +const float STYLE_3_CHILD_SIZE_FACTOR[] = { 0.4f, 0.4f, 0.15f, 0.25f, 0.25f, 0.15f };
  117 +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;
  118 +const Vector3 STYLE_3_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f,
  119 + 0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
  120 + STYLE_3_CHILD_OFFSET_Z),
  121 + Vector3(0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f,
  122 + 0.5f - STYLE_3_CHILD_SIZE_FACTOR[1] - STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
  123 + STYLE_3_CHILD_OFFSET_Z + 0.5f),
  124 + Vector3(0.5f + STYLE_3_CHILD_SIZE_FACTOR[3] + STYLE_3_CHILD_GAP_FACTOR * 1.5f,
  125 + 0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
  126 + STYLE_3_CHILD_OFFSET_Z + 1.0f),
  127 + Vector3(0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f,
  128 + 0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
  129 + STYLE_3_CHILD_OFFSET_Z + 1.5f),
  130 + Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[4] - STYLE_3_CHILD_GAP_FACTOR * 0.5f,
  131 + 0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
  132 + STYLE_3_CHILD_OFFSET_Z + 2.0f),
  133 + Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[4] - STYLE_3_CHILD_SIZE_FACTOR[5] - STYLE_3_CHILD_GAP_FACTOR * 1.5f,
  134 + 0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y,
  135 + STYLE_3_CHILD_OFFSET_Z + 2.5f) };
  136 +
  137 +const Vector3 STYLE_3_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f,
  138 + 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,
  139 + 0.0f);
  140 +const Vector3 STYLE_3_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f);
  141 +
  142 +// Cluster style four
  143 +
  144 +const unsigned int STYLE_4_CHILDREN_NUMBER = 6;
  145 +
  146 +const float STYLE_4_BACKGROUND_IMAGE_OFFSET_Z = 1.0f;
  147 +
  148 +const float STYLE_4_CHILD_OFFSET_Z = 2.0f;
  149 +const float STYLE_4_CHILD_GAP_FACTOR = 0.03f;
  150 +const float STYLE_4_CHILD_SIZE_FACTOR[] = { 0.4f, 0.22f, 0.13f, 0.4f, 0.22f, 0.13f };
  151 +const Vector3 STYLE_4_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] * 0.9f,
  152 + 0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] - STYLE_4_CHILD_GAP_FACTOR * 0.5f,
  153 + STYLE_4_CHILD_OFFSET_Z),
  154 + Vector3(0.5f + STYLE_4_CHILD_SIZE_FACTOR[0] * 0.1f + STYLE_4_CHILD_GAP_FACTOR,
  155 + 0.5f - STYLE_4_CHILD_SIZE_FACTOR[1] - STYLE_4_CHILD_GAP_FACTOR * 0.5f,
  156 + STYLE_4_CHILD_OFFSET_Z + 0.5f),
  157 + Vector3(0.5f + STYLE_4_CHILD_SIZE_FACTOR[0] * 0.1f + STYLE_4_CHILD_SIZE_FACTOR[1] + STYLE_4_CHILD_GAP_FACTOR * 2.0f,
  158 + 0.5f - STYLE_4_CHILD_SIZE_FACTOR[2] - STYLE_4_CHILD_GAP_FACTOR * 0.5f,
  159 + STYLE_4_CHILD_OFFSET_Z + 1.0f),
  160 + Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[3] * 0.1f,
  161 + 0.5f + STYLE_4_CHILD_GAP_FACTOR * 0.5f,
  162 + STYLE_4_CHILD_OFFSET_Z + 1.5f),
  163 + Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[3] * 0.1f - STYLE_4_CHILD_SIZE_FACTOR[4] - STYLE_4_CHILD_GAP_FACTOR,
  164 + 0.5f + STYLE_4_CHILD_GAP_FACTOR * 0.5f,
  165 + STYLE_4_CHILD_OFFSET_Z + 2.0f),
  166 + 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,
  167 + 0.5f + STYLE_4_CHILD_GAP_FACTOR * 0.5f,
  168 + STYLE_4_CHILD_OFFSET_Z + 2.5f) };
  169 +
  170 +const Vector3 STYLE_4_TITLE_SIZE_FACTOR = Vector3(0.3f, 0.11f, 1.0f);
  171 +const Vector3 STYLE_4_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] * 0.9f,
  172 + 0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] - STYLE_4_CHILD_GAP_FACTOR * 0.5f - STYLE_4_TITLE_SIZE_FACTOR.height + 0.02f,
  173 + 0.0f);
  174 +const Vector3 STYLE_4_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f);
  175 +const unsigned int CLUSTER_RANDOM_SEED(0x17eac9f3); ///< Random seed for cluster data.
  176 +
  177 +const int STYLE_RANDOM_CHILDREN_NUMBER = 16;
  178 +
  179 +Vector3 FirstOrderEquation( const Vector3& source, const Vector3& relative, const Vector3& offset = Vector3::ZERO )
  180 +{
  181 + return source * relative + offset;
  182 +}
  183 +
  184 +// random data generator //////////////////////////////////////////////////////
  185 +
  186 +const unsigned int GEN_RAND_CONST = 0x15d9a373;
  187 +
  188 +unsigned int genRandom(unsigned int& seed, unsigned int offset)
  189 +{
  190 + unsigned int shft = offset&31;
  191 +
  192 + offset++;
  193 +
  194 + seed^= (seed << (shft) | seed >> (32 - shft)) * (offset * GEN_RAND_CONST);
  195 +
  196 + return seed;
  197 +}
  198 +
  199 +float genRandomFloat(unsigned int& seed, unsigned int offset, float min, float max)
  200 +{
  201 + const float f = static_cast<float>(genRandom(seed, offset)) / 0xffffffff;
  202 + return f * (max - min) + min;
  203 +}
  204 +
  205 +} // unnamed namespace
  206 +
  207 +namespace Demo
  208 +{
  209 +
  210 +namespace Internal
  211 +{
  212 +
  213 +// ClusterStyle ///////////////////////////////////////////////////////////////
  214 +
  215 +ClusterStyle::ClusterStyle()
  216 +: mMaxChildren(0),
  217 + mTitlePositionRelative(Vector3::ONE),
  218 + mTitlePositionOffset(Vector3::ZERO),
  219 + mTitleSize(Vector3::ONE),
  220 + mBackgroundPositionRelative(Vector3::ONE),
  221 + mBackgroundPositionOffset(Vector3::ZERO),
  222 + mBackgroundSize(Vector3::ONE),
  223 + mClusterSize( Vector3::ZERO )
  224 +{
  225 +}
  226 +
  227 +ClusterStyle::~ClusterStyle()
  228 +{
  229 +
  230 +}
  231 +
  232 +void ClusterStyle::SetMaximumNumberOfChildren(unsigned int maxChildren)
  233 +{
  234 + mMaxChildren = maxChildren;
  235 +}
  236 +
  237 +unsigned int ClusterStyle::GetMaximumNumberOfChildren() const
  238 +{
  239 + return mMaxChildren;
  240 +}
  241 +
  242 +void ClusterStyle::ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds)
  243 +{
  244 + Apply( background,
  245 + FirstOrderEquation( GetClusterSize(), mBackgroundPositionRelative, mBackgroundPositionOffset ),
  246 + FirstOrderEquation( GetClusterSize(), mBackgroundSize ),
  247 + alpha,
  248 + durationSeconds);
  249 +}
  250 +
  251 +void ClusterStyle::ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds)
  252 +{
  253 + Apply( title,
  254 + FirstOrderEquation( GetClusterSize(), mTitlePositionRelative, mTitlePositionOffset ),
  255 + FirstOrderEquation( GetClusterSize(), mTitleSize ),
  256 + alpha,
  257 + durationSeconds);
  258 +}
  259 +
  260 +void ClusterStyle::SetTitleProperties(const Vector3& relativePosition,
  261 + const Vector3& offsetPosition,
  262 + const Vector3& size)
  263 +{
  264 + mTitlePositionRelative = relativePosition;
  265 + mTitlePositionOffset = offsetPosition;
  266 + mTitleSize = size;
  267 +}
  268 +
  269 +void ClusterStyle::SetBackgroundProperties(const Vector3& relativePosition,
  270 + const Vector3& offsetPosition,
  271 + const Vector3& size)
  272 +{
  273 + mBackgroundPositionRelative = relativePosition;
  274 + mBackgroundPositionOffset = offsetPosition;
  275 + mBackgroundSize = size;
  276 +}
  277 +
  278 +void ClusterStyle::SetClusterSize( const Vector3& clusterSize )
  279 +{
  280 + mClusterSize = clusterSize;
  281 +}
  282 +
  283 +Vector3 ClusterStyle::GetClusterSize() const
  284 +{
  285 + return mClusterSize;
  286 +}
  287 +
  288 +void ClusterStyle::Apply( Actor actor,
  289 + const Vector3& position,
  290 + const Vector3& size,
  291 + AlphaFunction alpha,
  292 + const TimePeriod& durationSeconds)
  293 +{
  294 + float animationDuration = durationSeconds.delaySeconds + durationSeconds.durationSeconds;
  295 + if( animationDuration > 0.f )
  296 + {
  297 + Animation animation = Animation::New(animationDuration);
  298 + animation.AnimateTo( Property( actor, Actor::Property::POSITION ), position, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
  299 + animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
  300 + animation.Play();
  301 + }
  302 + else
  303 + {
  304 + actor.SetPosition( position );
  305 + actor.SetSize( size );
  306 + }
  307 +}
  308 +
  309 +void ClusterStyle::Apply( Actor actor,
  310 + const Vector3& position,
  311 + const Vector3& size,
  312 + const Quaternion& rotation,
  313 + const Vector3& scale,
  314 + AlphaFunction alpha,
  315 + const TimePeriod& durationSeconds)
  316 +{
  317 + float animationDuration = durationSeconds.delaySeconds + durationSeconds.durationSeconds;
  318 + if( animationDuration > 0.f )
  319 + {
  320 + Animation animation = Animation::New(animationDuration);
  321 + animation.AnimateTo( Property( actor, Actor::Property::POSITION ), position, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
  322 + animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
  323 + animation.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), rotation, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
  324 + animation.AnimateTo( Property( actor, Actor::Property::SCALE ), scale, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
  325 + animation.Play();
  326 + }
  327 + else
  328 + {
  329 + actor.SetPosition( position );
  330 + actor.SetSize( size );
  331 + actor.SetOrientation( rotation );
  332 + actor.SetScale( scale );
  333 + }
  334 +}
  335 +
  336 +// ClusterStyleStandard ///////////////////////////////////////////////////////
  337 +
  338 +ClusterStylePtr ClusterStyleStandard::New(StyleType style)
  339 +{
  340 + ClusterStylePtr impl( new ClusterStyleStandard(style) );
  341 +
  342 + return impl;
  343 +}
  344 +
  345 +ClusterStyleStandard::ClusterStyleStandard(StyleType style)
  346 +: ClusterStyle(),
  347 + mSizes(NULL),
  348 + mPositions(NULL)
  349 +{
  350 + switch(style)
  351 + {
  352 + case Demo::ClusterStyleStandard::ClusterStyle1:
  353 + {
  354 + SetMaximumNumberOfChildren(STYLE_1_CHILDREN_NUMBER);
  355 + SetSizes(STYLE_1_CHILD_SIZE_FACTOR);
  356 + SetPositions(STYLE_1_CHILD_POSITION_FACTOR);
  357 + SetTitleProperties(STYLE_1_TITLE_POSITION_FACTOR,
  358 + STYLE_1_TITLE_POSITION_OFFSET,
  359 + STYLE_1_TITLE_SIZE_FACTOR);
  360 + SetBackgroundProperties(Vector3::ZERO,
  361 + Vector3(0.0f, 0.0f, STYLE_1_BACKGROUND_IMAGE_OFFSET_Z),
  362 + Vector3::ONE);
  363 + break;
  364 + }
  365 + case Demo::ClusterStyleStandard::ClusterStyle2:
  366 + {
  367 + SetMaximumNumberOfChildren(STYLE_2_CHILDREN_NUMBER);
  368 + SetSizes(STYLE_2_CHILD_SIZE_FACTOR);
  369 + SetPositions(STYLE_2_CHILD_POSITION_FACTOR);
  370 + SetTitleProperties(STYLE_2_TITLE_POSITION_FACTOR,
  371 + STYLE_2_TITLE_POSITION_OFFSET,
  372 + STYLE_2_TITLE_SIZE_FACTOR);
  373 + SetBackgroundProperties(Vector3::ZERO,
  374 + Vector3(0.0f, 0.0f, STYLE_2_BACKGROUND_IMAGE_OFFSET_Z),
  375 + Vector3::ONE);
  376 + break;
  377 + }
  378 + case Demo::ClusterStyleStandard::ClusterStyle3:
  379 + {
  380 + SetMaximumNumberOfChildren(STYLE_3_CHILDREN_NUMBER);
  381 + SetSizes(STYLE_3_CHILD_SIZE_FACTOR);
  382 + SetPositions(STYLE_3_CHILD_POSITION_FACTOR);
  383 + SetTitleProperties(STYLE_3_TITLE_POSITION_FACTOR,
  384 + STYLE_3_TITLE_POSITION_OFFSET,
  385 + STYLE_3_TITLE_SIZE_FACTOR);
  386 + SetBackgroundProperties(Vector3::ZERO,
  387 + Vector3(0.0f, 0.0f, STYLE_3_BACKGROUND_IMAGE_OFFSET_Z),
  388 + Vector3::ONE);
  389 + break;
  390 + }
  391 + case Demo::ClusterStyleStandard::ClusterStyle4:
  392 + {
  393 + SetMaximumNumberOfChildren(STYLE_4_CHILDREN_NUMBER);
  394 + SetSizes(STYLE_4_CHILD_SIZE_FACTOR);
  395 + SetPositions(STYLE_4_CHILD_POSITION_FACTOR);
  396 + SetTitleProperties(STYLE_4_TITLE_POSITION_FACTOR,
  397 + STYLE_4_TITLE_POSITION_OFFSET,
  398 + STYLE_4_TITLE_SIZE_FACTOR);
  399 + SetBackgroundProperties(Vector3::ZERO,
  400 + Vector3(0.0f, 0.0f, STYLE_4_BACKGROUND_IMAGE_OFFSET_Z),
  401 + Vector3::ONE);
  402 + break;
  403 + }
  404 + default:
  405 + {
  406 + DALI_ASSERT_ALWAYS(false && "Invalid Style");
  407 + break;
  408 + }
  409 + } // end switch
  410 +}
  411 +
  412 +void ClusterStyleStandard::SetSizes(const float *sizes)
  413 +{
  414 + mSizes = sizes;
  415 +}
  416 +
  417 +void ClusterStyleStandard::SetPositions(const Vector3 *positions)
  418 +{
  419 + mPositions = positions;
  420 +}
  421 +
  422 +void ClusterStyleStandard::ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds)
  423 +{
  424 + if(mPositions)
  425 + {
  426 + const float& size = mSizes[index];
  427 + // counter top-left parent origin and top-left anchor point.
  428 + const Vector3 position = mPositions[index] - Vector3(0.5f, 0.5f, 0.0f) + Vector3(size, size, 0.0f) * 0.5f;
  429 +
  430 + Apply( child,
  431 + FirstOrderEquation( GetClusterSize(), Vector3(position.x, position.y, 0.0f), Vector3(0.0f, 0.0f, position.z) ),
  432 + FirstOrderEquation( GetClusterSize(), Vector3::ONE * size ),
  433 + Quaternion(),
  434 + Vector3::ONE,
  435 + alpha,
  436 + durationSeconds);
  437 + }
  438 +}
  439 +
  440 +// ClusterStyleRandom /////////////////////////////////////////////////////////
  441 +
  442 +ClusterStylePtr ClusterStyleRandom::New()
  443 +{
  444 + ClusterStylePtr impl( new ClusterStyleRandom() );
  445 +
  446 + return impl;
  447 +}
  448 +
  449 +ClusterStyleRandom::ClusterStyleRandom()
  450 +: ClusterStyle()
  451 +{
  452 + SetMaximumNumberOfChildren(STYLE_RANDOM_CHILDREN_NUMBER);
  453 + SetTitleProperties(Vector3::ZERO,
  454 + Vector3::ZERO,
  455 + Vector3::ONE);
  456 + SetBackgroundProperties(Vector3::ZERO,
  457 + Vector3(0.0f, 0.0f, 0.0f),
  458 + Vector3::ONE);
  459 +}
  460 +
  461 +void ClusterStyleRandom::ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds)
  462 +{
  463 + unsigned int seed = CLUSTER_RANDOM_SEED;
  464 + const float size = 0.5f;
  465 + const float rotation = genRandomFloat(seed, index, -1.0f, 1.0f) * Math::PI * 0.1; // +/- 18 degrees
  466 + const Vector3 position(genRandomFloat(seed, index, -0.1f, 0.1f),
  467 + genRandomFloat(seed, index, -0.1f, 0.1f),
  468 + 0.0f);
  469 +
  470 + Property::Index depthProperty = child.GetPropertyIndex(Demo::Cluster::CLUSTER_ACTOR_DEPTH);
  471 + float depthPropertyValue = child.GetProperty<float>( depthProperty );
  472 +
  473 + Apply( child,
  474 + FirstOrderEquation( GetClusterSize(), Vector3(position.x, position.y, 0.0f), Vector3(0.0f, 0.0f, depthPropertyValue) ),
  475 + FirstOrderEquation( GetClusterSize(), Vector3::ONE * size),
  476 + Quaternion( Radian( rotation ), Vector3::ZAXIS ),
  477 + Vector3::ONE,
  478 + alpha,
  479 + durationSeconds);
  480 +}
  481 +
  482 +} // namespace Internal
  483 +
  484 +} // namespace Demo
  485 +
  486 +} // namespace Dali
... ...
examples/cluster/cluster-style-impl.h 0 โ†’ 100644
  1 +/*
  2 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +// EXTERNAL INCLUDES
  19 +#include <dali/public-api/object/ref-object.h>
  20 +#include <dali/public-api/common/dali-common.h>
  21 +#include <dali/public-api/math/vector3.h>
  22 +#include <dali/public-api/object/base-object.h>
  23 +
  24 +// INTERNAL INCLUDES
  25 +#include "cluster-style.h"
  26 +
  27 +namespace Dali
  28 +{
  29 +
  30 +namespace Demo
  31 +{
  32 +
  33 +namespace Internal
  34 +{
  35 +
  36 +class ClusterStyle;
  37 +
  38 +typedef IntrusivePtr<ClusterStyle> ClusterStylePtr;
  39 +
  40 +/**
  41 + * ClusterStyle internal implementation
  42 + */
  43 +class ClusterStyle : public Dali::BaseObject
  44 +{
  45 +public:
  46 +
  47 + /**
  48 + * @copydoc Demo::ClusterStyle::GetMaximumNumberOfChildren
  49 + */
  50 + unsigned int GetMaximumNumberOfChildren() const;
  51 +
  52 + /**
  53 + * @copydoc Demo::ClusterStyle::ApplyStyle
  54 + */
  55 + virtual void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds) = 0;
  56 +
  57 + /**
  58 + * @copydoc Demo::ClusterStyle::ApplyStyleToBackground
  59 + */
  60 + virtual void ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds);
  61 +
  62 + /**
  63 + * @copydoc Demo::ClusterStyle::ApplyStyleToTitle
  64 + */
  65 + virtual void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds);
  66 +
  67 + /**
  68 + * Set the size of cluster
  69 + */
  70 + void SetClusterSize( const Vector3& clusterSize );
  71 +
  72 +protected:
  73 +
  74 + /**
  75 + * Set the maximum number of children this Style can handle.
  76 + * @param[in] The maximum number of children.
  77 + */
  78 + void SetMaximumNumberOfChildren(unsigned int children);
  79 +
  80 + /**
  81 + * Set the title properties
  82 + * @param[in] relativePosition Relative position of the title
  83 + * @param[in] offsetPosition Offset position of the title
  84 + * @param[in] size The size of the title
  85 + */
  86 + void SetTitleProperties(const Vector3& relativePosition,
  87 + const Vector3& offsetPosition,
  88 + const Vector3& size);
  89 +
  90 + /**
  91 + * Set the background properties
  92 + * @param[in] relativePosition Relative position of the background
  93 + * @param[in] offsetPosition Offset position of the background
  94 + * @param[in] size The size of the title
  95 + */
  96 + void SetBackgroundProperties(const Vector3& relativePosition,
  97 + const Vector3& offsetPosition,
  98 + const Vector3& size);
  99 +
  100 + /**
  101 + * Get the size of cluster.
  102 + * @return the cluster size
  103 + */
  104 + Vector3 GetClusterSize() const;
  105 +
  106 + /**
  107 + * Apply the given position & size to the actor
  108 + * @param[in] position The target position
  109 + * @param[in] size The target size
  110 + * @param[in] size The size to resize to
  111 + * @param[in] alpha The alpha function to use.
  112 + * @param[in] durationSeconds The time period to apply this style.
  113 + */
  114 + void Apply( Actor actor,
  115 + const Vector3& position,
  116 + const Vector3& size,
  117 + AlphaFunction alpha,
  118 + const TimePeriod& durationSeconds);
  119 + /**
  120 + * Apply the given position & size to the actor
  121 + * @param[in] actor The actor to apply the changes
  122 + * @param[in] position The target position
  123 + * @param[in] size The target size
  124 + * @param[in] rotation The target Quaternion value
  125 + * @param[in] scale The target scale
  126 + * @param[in] alpha The alpha function to use.
  127 + * @param[in] durationSeconds The time period to apply this style.
  128 + */
  129 + void Apply( Actor actor,
  130 + const Vector3& position,
  131 + const Vector3& size,
  132 + const Quaternion& rotation,
  133 + const Vector3& scale,
  134 + AlphaFunction alpha,
  135 + const TimePeriod& durationSeconds);
  136 +
  137 +protected:
  138 +
  139 + /**
  140 + * Protected constructor see ClusterStyle::New().
  141 + */
  142 + ClusterStyle();
  143 +
  144 + /**
  145 + * A reference counted object may only be deleted by calling Unreference()
  146 + */
  147 + virtual ~ClusterStyle();
  148 +
  149 +protected:
  150 +
  151 + unsigned int mMaxChildren; ///< Maximum number of children that this style supports
  152 + Vector3 mTitlePositionRelative; ///< Title's position relative to size of cluster
  153 + Vector3 mTitlePositionOffset; ///< Title's position offset
  154 + Vector3 mTitleSize; ///< Title's size relative to size of cluster
  155 + Vector3 mBackgroundPositionRelative; ///< Background's position relative to size of cluster
  156 + Vector3 mBackgroundPositionOffset; ///< Background's position offset
  157 + Vector3 mBackgroundSize; ///< Background's size relative to size of cluster
  158 + Vector3 mClusterSize; ///< The size of cluster
  159 +};
  160 +
  161 +/**
  162 + * ClusterStyleStandard internal implementation
  163 + */
  164 +class ClusterStyleStandard : public ClusterStyle
  165 +{
  166 +public:
  167 +
  168 + typedef Demo::ClusterStyleStandard::StyleType StyleType;
  169 +
  170 +public:
  171 +
  172 + /**
  173 + * Create a new cluster style.
  174 + * @param[in] style The style type to create.
  175 + * @return A smart-pointer to the newly allocated ClusterStyle.
  176 + */
  177 + static ClusterStylePtr New(StyleType style);
  178 +
  179 +public:
  180 +
  181 + /**
  182 + * @copydoc Demo::ClusterStyle::ApplyStyle
  183 + */
  184 + void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds);
  185 +
  186 +private:
  187 +
  188 + /**
  189 + * Set the relative sizes of the children
  190 + * @param[in] size The list of sizes for the children
  191 + */
  192 + void SetSizes(const float *sizes);
  193 +
  194 + /**
  195 + * Set the relative positions of the children
  196 + * @param[in] positions The list of positions for the children
  197 + */
  198 + void SetPositions(const Vector3 *positions);
  199 +
  200 +protected:
  201 +
  202 + /**
  203 + * Protected constructor see ClusterStyleRandom::New().
  204 + */
  205 + ClusterStyleStandard(StyleType style);
  206 +
  207 +private:
  208 +
  209 + const float *mSizes; ///< List of sizes
  210 + const Vector3 *mPositions; ///< List of positions
  211 +
  212 +};
  213 +
  214 +/**
  215 + * ClusterStyleRandom internal implementation
  216 + */
  217 +class ClusterStyleRandom : public ClusterStyle
  218 +{
  219 +public:
  220 +
  221 + /**
  222 + * Create a new cluster style.
  223 + * @return A smart-pointer to the newly allocated ClusterStyle.
  224 + */
  225 + static ClusterStylePtr New();
  226 +
  227 +public:
  228 +
  229 + /**
  230 + * @copydoc Demo::ClusterStyle::ApplyStyle
  231 + */
  232 + void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds);
  233 +
  234 +protected:
  235 +
  236 + /**
  237 + * Protected constructor see ClusterStyleRandom::New().
  238 + */
  239 + ClusterStyleRandom();
  240 +
  241 +private:
  242 +
  243 +};
  244 +
  245 +} // namespace Internal
  246 +
  247 +// Helpers for public-api forwarding methods
  248 +
  249 +inline Internal::ClusterStyle& GetImpl(Demo::ClusterStyle& pub)
  250 +{
  251 + DALI_ASSERT_ALWAYS(pub);
  252 +
  253 + Dali::RefObject& handle = pub.GetBaseObject();
  254 +
  255 + return static_cast<Internal::ClusterStyle&>(handle);
  256 +}
  257 +
  258 +inline const Internal::ClusterStyle& GetImpl(const Demo::ClusterStyle& pub)
  259 +{
  260 + DALI_ASSERT_ALWAYS(pub);
  261 +
  262 + const Dali::RefObject& handle = pub.GetBaseObject();
  263 +
  264 + return static_cast<const Internal::ClusterStyle&>(handle);
  265 +}
  266 +
  267 +} // namespace Demo
  268 +
  269 +} // namespace Dali
... ...
examples/cluster/cluster-style.cpp 0 โ†’ 100644
  1 +/*
  2 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +// CLASS HEADER
  19 +#include "cluster-style.h"
  20 +
  21 +// EXTERNAL INCLUDES
  22 +#include <limits>
  23 +
  24 +// INTERNAL INCLUDES
  25 +#include "cluster-style-impl.h"
  26 +
  27 +using namespace Dali;
  28 +using namespace Dali::Demo;
  29 +
  30 +namespace Dali
  31 +{
  32 +
  33 +namespace Demo
  34 +{
  35 +
  36 +// ClusterStyle ///////////////////////////////////////////////////////////////
  37 +
  38 +const unsigned int ClusterStyle::UNLIMITED_CHILDREN = std::numeric_limits<unsigned int>::max();
  39 +
  40 +ClusterStyle::ClusterStyle()
  41 +{
  42 +}
  43 +
  44 +ClusterStyle::~ClusterStyle()
  45 +{
  46 +}
  47 +
  48 +ClusterStyle::ClusterStyle(Internal::ClusterStyle* internal)
  49 +: BaseHandle(internal)
  50 +{
  51 +}
  52 +
  53 +unsigned int ClusterStyle::GetMaximumNumberOfChildren() const
  54 +{
  55 + return GetImpl(*this).GetMaximumNumberOfChildren();
  56 +}
  57 +
  58 +void ClusterStyle::ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds)
  59 +{
  60 + GetImpl(*this).ApplyStyle(child, index, alpha, TimePeriod(durationSeconds));
  61 +}
  62 +
  63 +void ClusterStyle::ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds)
  64 +{
  65 + GetImpl(*this).ApplyStyleToBackground(background, alpha, TimePeriod(durationSeconds));
  66 +}
  67 +
  68 +void ClusterStyle::ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds)
  69 +{
  70 + GetImpl(*this).ApplyStyleToTitle(title, alpha, TimePeriod(durationSeconds));
  71 +}
  72 +
  73 +// ClusterStyleStandard ///////////////////////////////////////////////////////
  74 +
  75 +ClusterStyleStandard ClusterStyleStandard::New(StyleType style)
  76 +{
  77 + Internal::ClusterStylePtr internal = Internal::ClusterStyleStandard::New(style);
  78 +
  79 + return ClusterStyleStandard(internal.Get());
  80 +}
  81 +
  82 +ClusterStyleStandard::ClusterStyleStandard(Internal::ClusterStyle* internal)
  83 +: ClusterStyle(internal)
  84 +{
  85 +}
  86 +
  87 +// ClusterStyleRandom /////////////////////////////////////////////////////////
  88 +
  89 +ClusterStyleRandom ClusterStyleRandom::New()
  90 +{
  91 + Internal::ClusterStylePtr internal = Internal::ClusterStyleRandom::New();
  92 +
  93 + return ClusterStyleRandom(internal.Get());
  94 +}
  95 +
  96 +ClusterStyleRandom::ClusterStyleRandom(Internal::ClusterStyle* internal)
  97 +: ClusterStyle(internal)
  98 +{
  99 +}
  100 +
  101 +} // namespace Demo
  102 +
  103 +} // namespace Dali
... ...
examples/cluster/cluster-style.h 0 โ†’ 100644
  1 +#ifndef __DALI_DEMO_CLUSTER_STYLE_H__
  2 +#define __DALI_DEMO_CLUSTER_STYLE_H__
  3 +
  4 +/*
  5 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + *
  19 + */
  20 +
  21 +// EXTERNAL INCLUDES
  22 +#include <dali/public-api/actors/actor.h>
  23 +#include <dali/public-api/animation/alpha-function.h>
  24 +#include <dali/public-api/animation/time-period.h>
  25 +#include <dali/public-api/common/dali-common.h>
  26 +#include <dali/public-api/object/base-handle.h>
  27 +
  28 +// INTERNAL INCLUDES
  29 +#include <dali-toolkit/public-api/enums.h>
  30 +
  31 +namespace Dali
  32 +{
  33 +
  34 +class Actor;
  35 +
  36 +namespace Demo
  37 +{
  38 +
  39 +namespace Internal DALI_INTERNAL
  40 +{
  41 +class ClusterStyle;
  42 +class ClusterStyleRandom;
  43 +}
  44 +
  45 +class ClusterStyle;
  46 +
  47 +typedef IntrusivePtr<ClusterStyle> ClusterStylePtr; ///< Pointer to a Dali::Demo::ClusterStyle object
  48 +
  49 +/**
  50 + * @brief A ClusterStyle describes the constraints which are imposed on the child actors in the cluster.
  51 + */
  52 +class ClusterStyle : public Dali::BaseHandle
  53 +{
  54 +public:
  55 +
  56 + static const unsigned int UNLIMITED_CHILDREN; ///< Constant that represents an unlimited number of children.
  57 +
  58 +public:
  59 +
  60 + /**
  61 + * @brief Destructor
  62 + *
  63 + * This is non-virtual since derived Handle types must not contain data or virtual methods.
  64 + */
  65 + ~ClusterStyle();
  66 +
  67 + /**
  68 + * @brief Query the maximum number of children this Style can handle.
  69 + *
  70 + * If return value is UNLIMITED_CHILDREN, then this style has no
  71 + * limit.
  72 + * @return The maximum number of children.
  73 + */
  74 + unsigned int GetMaximumNumberOfChildren() const;
  75 +
  76 + /**
  77 + * @brief Applies style (position) to child actor over a specified time duration.
  78 + *
  79 + * @param[in] child The child actor to apply
  80 + * @param[in] index The style position index for the actor to transform to.
  81 + * @param[in] alpha The alpha function to use.
  82 + * @param[in] durationSeconds The time period to apply this style.
  83 + */
  84 + void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds);
  85 +
  86 + /**
  87 + * @brief Applies style to background actor over a specified time duration.
  88 + *
  89 + * @param[in] background The background actor to apply
  90 + * @param[in] alpha The alpha function to use.
  91 + * @param[in] durationSeconds The time period to apply this style.
  92 + */
  93 + void ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds);
  94 +
  95 + /**
  96 + * @brief Applies style to title actor over a specified time duration.
  97 + *
  98 + * @param[in] title The title actor to apply
  99 + * @param[in] alpha The alpha function to use.
  100 + * @param[in] durationSeconds The time period to apply this style.
  101 + */
  102 + void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds);
  103 +
  104 +protected:
  105 +
  106 + /**
  107 + * @brief Create a new ClusterStyle; Only derived versions are instantiatable.
  108 + */
  109 + ClusterStyle();
  110 +
  111 +public: // Not intended for application developers
  112 +
  113 + /**
  114 + * @brief This constructor is used by Dali New() methods.
  115 + *
  116 + * @param [in] internal A pointer to a newly allocated Dali resource
  117 + */
  118 + explicit DALI_INTERNAL ClusterStyle(Internal::ClusterStyle* internal);
  119 +};
  120 +
  121 +/**
  122 + * @brief A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster.
  123 + */
  124 +class ClusterStyleStandard : public ClusterStyle
  125 +{
  126 +public:
  127 +
  128 + /**
  129 + * @brief Cluster Style type.
  130 + */
  131 + enum StyleType
  132 + {
  133 + ClusterStyle1, ///< Style number 1
  134 + ClusterStyle2, ///< Style number 2
  135 + ClusterStyle3, ///< Style number 3
  136 + ClusterStyle4, ///< Style number 4
  137 + TotalClusterStyles ///< The number of styles
  138 + };
  139 +
  140 +public:
  141 +
  142 + /**
  143 + * @brief Create an initialized style.
  144 + */
  145 + static ClusterStyleStandard New(StyleType style);
  146 +
  147 +public: // Not intended for application developers
  148 +
  149 + /**
  150 + * @brief This constructor is used by Dali New() methods.
  151 + *
  152 + * @param [in] internal A pointer to a newly allocated Dali resource
  153 + */
  154 + explicit DALI_INTERNAL ClusterStyleStandard(Internal::ClusterStyle* internal);
  155 +};
  156 +
  157 +/**
  158 + * @brief A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster.
  159 + */
  160 +class ClusterStyleRandom : public ClusterStyle
  161 +{
  162 +public:
  163 +
  164 + /**
  165 + * @brief Create an initialized style.
  166 + */
  167 + static ClusterStyleRandom New();
  168 +
  169 +public: // Not intended for application developers
  170 +
  171 + /**
  172 + * @brief This constructor is used by Dali New() methods.
  173 + *
  174 + * @param [in] internal A pointer to a newly allocated Dali resource
  175 + */
  176 + explicit DALI_INTERNAL ClusterStyleRandom(Internal::ClusterStyle* internal);
  177 +};
  178 +
  179 +} // namespace Demo
  180 +
  181 +} // namespace Dali
  182 +
  183 +#endif // __DALI_TOOLKIT_CLUSTER_STYLE_H__
... ...
examples/cluster/cluster.cpp 0 โ†’ 100644
  1 +/*
  2 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +// CLASS HEADER
  19 +
  20 +#include "cluster.h"
  21 +
  22 +// INTERNAL INCLUDES
  23 +
  24 +#include "cluster-impl.h"
  25 +
  26 +namespace Dali
  27 +{
  28 +
  29 +namespace Demo
  30 +{
  31 +
  32 +///////////////////////////////////////////////////////////////////////////////////////////////////
  33 +// Cluster
  34 +///////////////////////////////////////////////////////////////////////////////////////////////////
  35 +
  36 +const std::string Cluster::CLUSTER_ACTOR_DEPTH( "cluster-actor-depth" );
  37 +
  38 +Cluster::Cluster()
  39 +{
  40 +}
  41 +
  42 +Cluster::Cluster(const Cluster& cluster)
  43 +: Toolkit::Control(cluster)
  44 +{
  45 +}
  46 +
  47 +Cluster& Cluster::operator =(const Cluster& cluster)
  48 +{
  49 + if( &cluster != this )
  50 + {
  51 + Toolkit::Control::operator=( cluster );
  52 + }
  53 + return *this;
  54 +}
  55 +
  56 +Cluster::~Cluster()
  57 +{
  58 +}
  59 +
  60 +Cluster Cluster::New( ClusterStyle& style )
  61 +{
  62 + return Internal::Cluster::New(style);
  63 +}
  64 +
  65 +Cluster Cluster::DownCast( BaseHandle handle )
  66 +{
  67 + return Toolkit::Control::DownCast<Cluster, Internal::Cluster>(handle);
  68 +}
  69 +
  70 +void Cluster::AddChild( Actor child )
  71 +{
  72 + GetImpl(*this).AddChild( child );
  73 +}
  74 +
  75 +void Cluster::AddChild( Actor child, unsigned int positionIndex )
  76 +{
  77 + GetImpl(*this).AddChild( child, positionIndex);
  78 +}
  79 +
  80 +void Cluster::AddChildAt( Actor child, unsigned int index )
  81 +{
  82 + GetImpl(*this).AddChildAt( child, index );
  83 +}
  84 +
  85 +void Cluster::AddChildAt( Actor child, unsigned int positionIndex, unsigned int index )
  86 +{
  87 + GetImpl(*this).AddChildAt( child, positionIndex, index );
  88 +}
  89 +
  90 +Actor Cluster::GetChildAt( unsigned int index )
  91 +{
  92 + return GetImpl(*this).GetChildAt(index);
  93 +}
  94 +
  95 +Actor Cluster::RemoveChildAt( unsigned int index )
  96 +{
  97 + return GetImpl(*this).RemoveChildAt(index);
  98 +}
  99 +
  100 +void Cluster::ExpandChild( unsigned int index )
  101 +{
  102 + GetImpl(*this).ExpandChild(index);
  103 +}
  104 +
  105 +void Cluster::ExpandAllChildren()
  106 +{
  107 + GetImpl(*this).ExpandAllChildren();
  108 +}
  109 +
  110 +void Cluster::CollapseChild( unsigned int index, bool front )
  111 +{
  112 + GetImpl(*this).CollapseChild(index, front);
  113 +}
  114 +
  115 +void Cluster::CollapseAllChildren( bool front )
  116 +{
  117 + GetImpl(*this).CollapseAllChildren( front );
  118 +}
  119 +
  120 +void Cluster::TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period )
  121 +{
  122 + GetImpl(*this).TransformChild( index, position, scale, rotation, alpha, period );
  123 +}
  124 +
  125 +void Cluster::RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front )
  126 +{
  127 + GetImpl(*this).RestoreChild( index, alpha, period, front );
  128 +}
  129 +
  130 +void Cluster::SetBackgroundImage( Actor image )
  131 +{
  132 + GetImpl(*this).SetBackgroundImage(image);
  133 +}
  134 +
  135 +void Cluster::SetTitle( Actor text )
  136 +{
  137 + GetImpl(*this).SetTitle(text);
  138 +}
  139 +
  140 +void Cluster::SetStyle(ClusterStyle style)
  141 +{
  142 + GetImpl(*this).SetStyle(style);
  143 +}
  144 +
  145 +ClusterStyle Cluster::GetStyle() const
  146 +{
  147 + return GetImpl(*this).GetStyle();
  148 +}
  149 +
  150 +unsigned int Cluster::GetExpandedCount() const
  151 +{
  152 + return GetImpl(*this).GetExpandedCount();
  153 +}
  154 +
  155 +unsigned int Cluster::GetTotalCount() const
  156 +{
  157 + return GetImpl(*this).GetTotalCount();
  158 +}
  159 +
  160 +Cluster::Cluster( Internal::Cluster& impl )
  161 +: Toolkit::Control( impl )
  162 +{
  163 +}
  164 +
  165 +Cluster::Cluster( Dali::Internal::CustomActor* internal )
  166 +: Toolkit::Control( internal )
  167 +{
  168 + VerifyCustomActorPointer<Internal::Cluster>(internal);
  169 +}
  170 +
  171 +} // namespace Demo
  172 +
  173 +} // namespace Dali
... ...
examples/cluster/cluster.h 0 โ†’ 100644
  1 +#ifndef __DALI_DEMO_CLUSTER_H__
  2 +#define __DALI_DEMO_CLUSTER_H__
  3 +
  4 +/*
  5 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + *
  19 + */
  20 +
  21 +// EXTERNAL INCLUDES
  22 +#include <dali/public-api/animation/alpha-function.h>
  23 +#include <dali/public-api/animation/time-period.h>
  24 +
  25 +// INTERNAL INCLUDES
  26 +#include <dali-toolkit/public-api/controls/control.h>
  27 +
  28 +namespace Dali
  29 +{
  30 +
  31 +namespace Demo
  32 +{
  33 +
  34 +namespace Internal DALI_INTERNAL
  35 +{
  36 +class Cluster;
  37 +}
  38 +
  39 +class ClusterStyle;
  40 +
  41 +/**
  42 + * @brief Cluster is a container of grouped actors positioned in different cluster styles.
  43 + *
  44 + * Actions
  45 + * | %Action Name | Method |
  46 + * |---------------------------|---------------------------|
  47 + * | expand | DoExpandAction() |
  48 + * | collapse | DoCollapseAction() |
  49 + * | transform | DoTransformAction() |
  50 + */
  51 +class Cluster : public Toolkit::Control
  52 +{
  53 +public:
  54 +
  55 + // Custom properties
  56 +
  57 + static const std::string CLUSTER_ACTOR_DEPTH; ///< Property, name "cluster-actor-depth", type float
  58 +
  59 +public:
  60 +
  61 + /**
  62 + * Create a Cluster handle; this can be initialised with Cluster::New()
  63 + * Calling member functions with an uninitialised handle is not allowed.
  64 + */
  65 + Cluster();
  66 +
  67 + /**
  68 + * Copy Constructor.
  69 + */
  70 + Cluster( const Cluster& cluster );
  71 +
  72 + /**
  73 + * Assignment Operator.
  74 + */
  75 + Cluster& operator=( const Cluster& cluster );
  76 +
  77 + /**
  78 + * @brief Destructor
  79 + *
  80 + * This is non-virtual since derived Handle types must not contain data or virtual methods.
  81 + */
  82 + ~Cluster();
  83 +
  84 + /**
  85 + * Create the Cluster control with the given style.
  86 + * @param[in] style The style of the cluster
  87 + * @return A handle to the Cluster control.
  88 + */
  89 + static Cluster New( ClusterStyle& style );
  90 +
  91 + /**
  92 + * Downcast an Object handle to Cluster. If handle points to a Cluster the
  93 + * downcast produces valid handle. If not the returned handle is left uninitialized.
  94 + * @param[in] handle Handle to an object
  95 + * @return handle to a Cluster or an uninitialized handle
  96 + */
  97 + static Cluster DownCast( BaseHandle handle );
  98 +
  99 + /**
  100 + * Adds a child to the Cluster
  101 + * Will automatically choose a position for the child.
  102 + * @pre The child actor has been initialized.
  103 + * @param[in] child The child to add
  104 + */
  105 + void AddChild( Actor child );
  106 +
  107 + /**
  108 + * Adds a child to the Cluster
  109 + * User specifies the position for the child.
  110 + * @pre The child actor has been initialized.
  111 + * @param[in] child The child to add
  112 + * @param[in] positionIndex The position for this child
  113 + */
  114 + void AddChild( Actor child, unsigned int positionIndex );
  115 +
  116 + /**
  117 + * Adds a child to the Cluster to be inserted at a specified
  118 + * depth index.
  119 + * Will automatically choose a position for the child.
  120 + * @pre The child actor has been initialized.
  121 + * @param[in] child The child to add
  122 + * @param[in] index The depth position for this child
  123 + */
  124 + void AddChildAt( Actor child, unsigned int index );
  125 +
  126 + /**
  127 + * Adds a child to the Cluster to be inserted at a specified
  128 + * depth index.
  129 + * User specifies the position for the child.
  130 + * @pre The child actor has been initialized.
  131 + * @param[in] child The child to add
  132 + * @param[in] positionIndex The position for this child
  133 + * @param[in] index The depth position for this child
  134 + */
  135 + void AddChildAt( Actor child, unsigned int positionIndex, unsigned int index );
  136 +
  137 + /**
  138 + * Returns a child from the given layout position
  139 + * Note! if there is no child in this layout position this method returns an uninitialized
  140 + * Actor handle
  141 + * @param[in] index The child index in the cluster
  142 + * @return The child that was in the layout position or an uninitialized handle
  143 + */
  144 + Actor GetChildAt( unsigned int index );
  145 +
  146 + /**
  147 + * Removes a child from the given layout position
  148 + * Note! if there is no child in this layout position this method does nothing
  149 + * @param[in] index The index of the child to remove
  150 + * @return The child that was removed or an uninitialized handle
  151 + */
  152 + Actor RemoveChildAt( unsigned int index );
  153 +
  154 + /**
  155 + * Expands a child
  156 + * A child will move away from the cluster.
  157 + * @param[in] index The child position index to expand
  158 + */
  159 + void ExpandChild( unsigned int index );
  160 +
  161 + /**
  162 + * Expands all children
  163 + * All children that have been collapsed will
  164 + * move away from the cluster
  165 + */
  166 + void ExpandAllChildren();
  167 +
  168 + /**
  169 + * Collapses a child
  170 + * A child that has been expanded will move
  171 + * back to its original positions.
  172 + * @param[in] index The child index to collapse
  173 + * @param[in] front Whether to move child to the front or
  174 + * back of cluster (depth).
  175 + */
  176 + void CollapseChild( unsigned int index, bool front = false );
  177 +
  178 + /**
  179 + * Collapses all children.
  180 + * All children that have been expanded will move
  181 + * back to their original positions.
  182 + * @param[in] front Whether to move child to the front or
  183 + * back of cluster (depth).
  184 + */
  185 + void CollapseAllChildren( bool front = false );
  186 +
  187 + /**
  188 + * Transforms Actor from default transform to new transform
  189 + * @param[in] index The child index to move
  190 + * @param[in] position The position to move to
  191 + * @param[in] scale The scale to change to
  192 + * @param[in] rotation The rotation to change to
  193 + * @param[in] alpha The alpha function to use to tween to this transform
  194 + * @param[in] period The duration for this transformation to take
  195 + */
  196 + void TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period );
  197 +
  198 + /**
  199 + * Restores Actor to the default transform (based on current style)
  200 + * @param[in] index The child index to move back
  201 + * @param[in] alpha The alpha function to use to tween to this transform
  202 + * @param[in] period The duration for this transformation to take
  203 + * @param[in] front Whether to move child to the front or
  204 + * back of cluster (depth).
  205 + */
  206 + void RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front = false );
  207 +
  208 + /**
  209 + * Sets the background image.
  210 + * @param[in] image The background image.
  211 + */
  212 + void SetBackgroundImage( Actor image );
  213 +
  214 + /**
  215 + * Sets the title.
  216 + *
  217 + * @param[in] text Title text.
  218 + */
  219 + void SetTitle( Actor text );
  220 +
  221 + /**
  222 + * Sets the style of the cluster
  223 + * @param[in] style The style of the cluster
  224 + */
  225 + void SetStyle(ClusterStyle style);
  226 +
  227 + /**
  228 + * Gets the style of the cluster
  229 + * @return style of the cluster
  230 + */
  231 + ClusterStyle GetStyle() const;
  232 +
  233 + /**
  234 + * Gets the number of children that have been expanded in this cluster.
  235 + * @return the number of children expanded.
  236 + */
  237 + unsigned int GetExpandedCount() const;
  238 +
  239 + /**
  240 + * Gets the number of children that have been added to this cluster.
  241 + * @return the total number of children.
  242 + */
  243 + unsigned int GetTotalCount() const;
  244 +
  245 +public: // Not intended for application developers
  246 +
  247 + /**
  248 + * Creates a handle using the Toolkit::Internal implementation.
  249 + * @param[in] implementation The Control implementation.
  250 + */
  251 + DALI_INTERNAL Cluster( Internal::Cluster& implementation );
  252 +
  253 + /**
  254 + * Allows the creation of this Control from an Internal::CustomActor pointer.
  255 + * @param[in] internal A pointer to the internal CustomActor.
  256 + */
  257 + explicit DALI_INTERNAL Cluster( Dali::Internal::CustomActor* internal );
  258 +};
  259 +
  260 +} // namespace Toolkit
  261 +
  262 +} // namespace Dali
  263 +
  264 +#endif // __DALI_DEMO_CLUSTER_H__
... ...
examples/cube-transition-effect/cube-transition-effect-example.cpp
... ... @@ -168,7 +168,7 @@ private:
168 168  
169 169 private:
170 170 Application& mApplication;
171   - Toolkit::View mView;
  171 + Toolkit::Control mView;
172 172 Toolkit::ToolBar mToolBar;
173 173 Layer mContent;
174 174 Toolkit::TextLabel mTitleActor;
... ...
examples/dissolve-effect/dissolve-effect-example.cpp
... ... @@ -152,7 +152,7 @@ private:
152 152  
153 153 private:
154 154 Application& mApplication;
155   - Toolkit::View mView;
  155 + Toolkit::Control mView;
156 156 Toolkit::ToolBar mToolBar;
157 157 Layer mContent;
158 158 Toolkit::TextLabel mTitleActor;
... ... @@ -297,21 +297,21 @@ void DissolveEffectApp::StartTransition(Vector2 position, Vector2 displacement)
297 297 mCurrentImageEffect.SetCentralLine(position,displacement);
298 298 mCurrentImageEffect.SetDistortion(0.0f);
299 299 mCurrentImage.SetShaderEffect(mCurrentImageEffect);
300   - mAnimation.AnimateTo( Property(mCurrentImageEffect, mCurrentImageEffect.GetDistortionPropertyName()), 1.0f, AlphaFunctions::Linear );
  300 + mAnimation.AnimateTo( Property(mCurrentImageEffect, mCurrentImageEffect.GetDistortionPropertyName()), 1.0f, AlphaFunction::LINEAR );
301 301  
302 302 mNextImage.SetOpacity(0.0f);
303   - mAnimation.AnimateTo( Property( mNextImage, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::Linear );
  303 + mAnimation.AnimateTo( Property( mNextImage, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::LINEAR );
304 304  
305 305 if(mUseHighPrecision)
306 306 {
307 307 mNextImageEffect.SetCentralLine(position,-displacement);
308 308 mNextImageEffect.SetDistortion(1.0f);
309 309 mNextImage.SetShaderEffect(mNextImageEffect);
310   - mAnimation.AnimateTo( Property(mNextImageEffect, mNextImageEffect.GetDistortionPropertyName()), 0.0f, AlphaFunctions::Linear );
  310 + mAnimation.AnimateTo( Property(mNextImageEffect, mNextImageEffect.GetDistortionPropertyName()), 0.0f, AlphaFunction::LINEAR );
311 311 }
312 312 else
313 313 {
314   - mAnimation.AnimateTo( Property( mNextImage, Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), AlphaFunctions::Linear );
  314 + mAnimation.AnimateTo( Property( mNextImage, Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), AlphaFunction::LINEAR );
315 315 }
316 316  
317 317 mAnimation.FinishedSignal().Connect( this, &DissolveEffectApp::OnTransitionCompleted );
... ...
examples/hello-world/hello-world-example.cpp
... ... @@ -43,6 +43,7 @@ public:
43 43 {
44 44 // Get a handle to the stage
45 45 Stage stage = Stage::GetCurrent();
  46 + stage.SetBackgroundColor( Color::WHITE );
46 47  
47 48 TextLabel textLabel = TextLabel::New( "Hello World" );
48 49 textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
... ...
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp 0 โ†’ 100644
  1 +/*
  2 + * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +#include <dali/dali.h>
  19 +#include <dali-toolkit/dali-toolkit.h>
  20 +#include "shared/view.h"
  21 +#include <iostream>
  22 +
  23 +using namespace Dali;
  24 +using Toolkit::TextLabel;
  25 +
  26 +namespace
  27 +{
  28 +
  29 +const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-gradient.jpg" );
  30 +const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f );
  31 +
  32 +const int MARGIN_SIZE = 10;
  33 +
  34 +const char* const NEXT_BUTTON_ID = "NEXT_BUTTON";
  35 +const char* const PREVIOUS_BUTTON_ID = "PREVIOUS_BUTTON";
  36 +const char * const DALI_ICON_PLAY = DALI_IMAGE_DIR "icon-play.png";
  37 +
  38 +const char* const PUSHBUTTON_PRESS_IMAGE = DALI_IMAGE_DIR "button-down.9.png";
  39 +const char* const PUSHBUTTON_BUTTON_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
  40 +const char* const PUSHBUTTON_DISABLED_IMAGE = DALI_IMAGE_DIR "button-disabled.9.png";
  41 +
  42 +const char* const FITTING_BUTTON_ID = "FITTING_BUTTON";
  43 +const char* const SAMPLING_BUTTON_ID = "SAMPLING_BUTTON";
  44 +const char* const FITTING_BUTTON_TEXT = "Fitting";
  45 +const char* const SAMPLING_BUTTON_TEXT = "Sampling";
  46 +
  47 +const char* const STYLE_LABEL_TEXT = "grouplabel";
  48 +const char* const STYLE_BUTTON_TEXT = "buttonlabel";
  49 +
  50 +
  51 +
  52 +const char* IMAGE_PATHS[] =
  53 +{
  54 + // Worst case for aliasing in downscaling, 2k x 2k 1 bit per pixel dithered
  55 + // black and white image:
  56 + DALI_IMAGE_DIR "gallery-large-14.wbmp",
  57 + // Variety of sizes, shapes and formats:
  58 + DALI_IMAGE_DIR "animation-list.png",
  59 + DALI_IMAGE_DIR "layer1.png",
  60 + DALI_IMAGE_DIR "layer2.png",
  61 + DALI_IMAGE_DIR "music-libray-main-screen.png",
  62 + DALI_IMAGE_DIR "music-libray-record-cover.png",
  63 + DALI_IMAGE_DIR "contacts-background.png",
  64 + DALI_IMAGE_DIR "portrait_screen_primitive_shapes.gif",
  65 + DALI_IMAGE_DIR "landscape_screen_primitive_shapes.gif",
  66 + DALI_IMAGE_DIR "square_primitive_shapes.bmp",
  67 + DALI_IMAGE_DIR "dali-logo.png",
  68 + DALI_IMAGE_DIR "com.samsung.dali-demo.ico",
  69 + DALI_IMAGE_DIR "gallery-large-14.jpg",
  70 + DALI_IMAGE_DIR "book-landscape-cover.jpg",
  71 + DALI_IMAGE_DIR "book-portrait-p1.jpg",
  72 + DALI_IMAGE_DIR "book-landscape-cover-back.jpg",
  73 + DALI_IMAGE_DIR "background-1.jpg",
  74 + DALI_IMAGE_DIR "background-blocks.jpg",
  75 + DALI_IMAGE_DIR "background-magnifier.jpg",
  76 + DALI_IMAGE_DIR "gallery-large-14.jpg",
  77 + NULL
  78 +};
  79 +const int NUM_IMAGE_PATHS = sizeof(IMAGE_PATHS) / sizeof(IMAGE_PATHS[0]) - 1u;
  80 +
  81 +/** Cycle the scaling mode options. */
  82 +FittingMode::Type NextScalingMode( FittingMode::Type oldMode )
  83 +{
  84 + FittingMode::Type newMode = FittingMode::SHRINK_TO_FIT;
  85 + switch ( oldMode )
  86 + {
  87 + case FittingMode::SHRINK_TO_FIT:
  88 + newMode = FittingMode::SCALE_TO_FILL;
  89 + break;
  90 + case FittingMode::SCALE_TO_FILL:
  91 + newMode = FittingMode::FIT_WIDTH;
  92 + break;
  93 + case FittingMode::FIT_WIDTH:
  94 + newMode = FittingMode::FIT_HEIGHT;
  95 + break;
  96 + case FittingMode::FIT_HEIGHT:
  97 + newMode = FittingMode::SHRINK_TO_FIT;
  98 + break;
  99 + }
  100 + return newMode;
  101 +}
  102 +
  103 +/** Cycle through filter mode options. */
  104 +SamplingMode::Type NextFilterMode( SamplingMode::Type oldMode )
  105 +{
  106 + SamplingMode::Type newMode = SamplingMode::BOX;
  107 +
  108 + switch ( oldMode )
  109 + {
  110 + case SamplingMode::BOX:
  111 + newMode = SamplingMode::NEAREST;
  112 + break;
  113 + case SamplingMode::NEAREST:
  114 + newMode = SamplingMode::LINEAR;
  115 + break;
  116 + case SamplingMode::LINEAR:
  117 + newMode = SamplingMode::BOX_THEN_NEAREST;
  118 + break;
  119 + case SamplingMode::BOX_THEN_NEAREST:
  120 + newMode = SamplingMode::BOX_THEN_LINEAR;
  121 + break;
  122 + case SamplingMode::BOX_THEN_LINEAR:
  123 + newMode = SamplingMode::NO_FILTER;
  124 + break;
  125 + case SamplingMode::NO_FILTER:
  126 + newMode = SamplingMode::BOX;
  127 + break;
  128 + case SamplingMode::DONT_CARE:
  129 + newMode = SamplingMode::BOX;
  130 + break;
  131 + }
  132 + return newMode;
  133 +}
  134 +
  135 +const char* StringFromScalingMode( FittingMode::Type scalingMode )
  136 +{
  137 + return scalingMode == FittingMode::SCALE_TO_FILL ? "SCALE_TO_FILL" : scalingMode == FittingMode::SHRINK_TO_FIT ? "SHRINK_TO_FIT" : scalingMode == FittingMode::FIT_WIDTH ? "FIT_WIDTH" : scalingMode == FittingMode::FIT_HEIGHT ? "FIT_HEIGHT" : "UnknownScalingMode";
  138 +}
  139 +
  140 +const char* StringFromFilterMode( SamplingMode::Type filterMode )
  141 +{
  142 + return filterMode == SamplingMode::BOX ? "BOX" : filterMode == SamplingMode::BOX_THEN_NEAREST ? "BOX_THEN_NEAREST" : filterMode == SamplingMode::BOX_THEN_LINEAR ? "BOX_THEN_LINEAR" : filterMode == SamplingMode::NEAREST ? "NEAREST" : filterMode == SamplingMode::LINEAR ? "LINEAR" : filterMode == SamplingMode::NO_FILTER ? "NO_FILTER" : filterMode == SamplingMode::DONT_CARE ? "DONT_CARE" : "UnknownFilterMode";
  143 +}
  144 +
  145 +}
  146 +
  147 +// This example shows the load-time image scaling and filtering features.
  148 +//
  149 +class ImageScalingAndFilteringController : public ConnectionTracker
  150 +{
  151 +public:
  152 +
  153 + ImageScalingAndFilteringController( Application& application )
  154 + : mApplication( application ),
  155 + mImageStageScale( 0.5f, 0.5f ),
  156 + mCurrentPath( 0 ),
  157 + mFittingMode( FittingMode::SCALE_TO_FILL ),
  158 + mSamplingMode( SamplingMode::BOX_THEN_LINEAR)
  159 + {
  160 + // Connect to the Application's Init signal
  161 + mApplication.InitSignal().Connect( this, &ImageScalingAndFilteringController::Create );
  162 + }
  163 +
  164 + ~ImageScalingAndFilteringController()
  165 + {
  166 + // Nothing to do here;
  167 + }
  168 +
  169 + // The Init signal is received once (only) during the Application lifetime
  170 + void Create( Application& application )
  171 + {
  172 + // Apply the default theme:
  173 + DemoHelper::RequestThemeChange();
  174 +
  175 + // Get a handle to the stage
  176 + Stage stage = Stage::GetCurrent();
  177 +
  178 + // Background image:
  179 + ResourceImage backgroundImage = ResourceImage::New( BACKGROUND_IMAGE, ImageDimensions( stage.GetSize().width, stage.GetSize().height ), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR );
  180 + ImageActor background = ImageActor::New( backgroundImage );
  181 + background.SetZ( -2.0f );
  182 + background.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  183 + background.SetSize( stage.GetSize() );
  184 + stage.Add( background );
  185 +
  186 + // Make grey pixels for the desired box, the desired height the desired width:
  187 + BufferImage desiredBackground = BufferImage::WHITE();
  188 +
  189 + BufferImage heightBackground = BufferImage::WHITE();
  190 + PixelBuffer* const heightPixel = heightBackground.GetBuffer();
  191 + heightPixel[0] = 0x8f;
  192 + heightPixel[1] = 0x8f;
  193 + heightPixel[2] = 0x8f;
  194 +
  195 + BufferImage widthBackground = BufferImage::WHITE();
  196 + PixelBuffer* const widthPixel = widthBackground.GetBuffer();
  197 + widthPixel[0] = 0x4f;
  198 + widthPixel[1] = 0x4f;
  199 + widthPixel[2] = 0x4f;
  200 +
  201 + mHeightBox = ImageActor::New( heightBackground );
  202 + mHeightBox.SetOpacity( 0.2f );
  203 + stage.Add( mHeightBox );
  204 +
  205 + mWidthBox = ImageActor::New( widthBackground );
  206 + mWidthBox.SetOpacity( 0.2f );
  207 + stage.Add( mWidthBox );
  208 +
  209 + mDesiredBox = ImageActor::New( desiredBackground );
  210 + stage.Add( mDesiredBox );
  211 +
  212 + mDesiredBox.SetSize( stage.GetSize() * mImageStageScale );
  213 + mDesiredBox.SetParentOrigin( ParentOrigin::CENTER );
  214 + mDesiredBox.SetAnchorPoint( AnchorPoint::CENTER );
  215 + mDesiredBox.SetPosition( 0, 0, -1 );
  216 +
  217 + mHeightBox.SetSize( stage.GetSize().width, (stage.GetSize() * mImageStageScale).height );
  218 + mHeightBox.SetParentOrigin( ParentOrigin::CENTER );
  219 + mHeightBox.SetAnchorPoint( AnchorPoint::CENTER );
  220 + mHeightBox.SetPosition( 0, 0, -1 );
  221 +
  222 + mWidthBox.SetSize( (stage.GetSize() * mImageStageScale).width, stage.GetSize().height );
  223 + mWidthBox.SetParentOrigin( ParentOrigin::CENTER );
  224 + mWidthBox.SetAnchorPoint( AnchorPoint::CENTER );
  225 + mWidthBox.SetPosition( 0, 0, -1 );
  226 +
  227 + // Make a grab-handle for resizing the image:
  228 + mGrabCorner = Toolkit::PushButton::New();
  229 + mGrabCorner.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH );
  230 + mGrabCorner.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  231 + mGrabCorner.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  232 + mGrabCorner.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  233 + mGrabCorner.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) );
  234 + mGrabCorner.SetName( "GrabCorner" );
  235 + mGrabCorner.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
  236 + mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT );
  237 + mGrabCorner.SetSize( Vector2( stage.GetSize().width*0.08f, stage.GetSize().width*0.08f ) );
  238 + mGrabCorner.SetZ( 1.0f );
  239 + mGrabCorner.SetOpacity( 0.6f );
  240 + mDesiredBox.Add( mGrabCorner );
  241 + mPanGestureDetector = PanGestureDetector::New();
  242 + mPanGestureDetector.Attach( mGrabCorner );
  243 + mPanGestureDetector.DetectedSignal().Connect( this, &ImageScalingAndFilteringController::OnPan );
  244 +
  245 + // Initialize the actor
  246 + mImageActor = ImageActor::New();
  247 +
  248 + // Reposition the actor
  249 + mImageActor.SetParentOrigin( ParentOrigin::CENTER );
  250 + mImageActor.SetAnchorPoint( AnchorPoint::CENTER );
  251 +
  252 + // Display the actor on the stage
  253 + stage.Add( mImageActor );
  254 +
  255 + mImageActor.SetSize( stage.GetSize() * mImageStageScale );
  256 +
  257 + // Setup the pinch detector for scaling the desired image load dimensions:
  258 + mPinchDetector = PinchGestureDetector::New();
  259 + mPinchDetector.Attach( mImageActor );
  260 + mPinchDetector.DetectedSignal().Connect( this, &ImageScalingAndFilteringController::OnPinch );
  261 +
  262 + // Tie-in input event handlers:
  263 + stage.KeyEventSignal().Connect( this, &ImageScalingAndFilteringController::OnKeyEvent );
  264 +
  265 + CreateControls();
  266 +
  267 + ResizeImage();
  268 + }
  269 +
  270 + /**
  271 + * Create the GUI controls which float above the scene
  272 + */
  273 + void CreateControls()
  274 + {
  275 + Stage stage = Stage::GetCurrent();
  276 +
  277 + Dali::Layer controlsLayer = Dali::Layer::New();
  278 + controlsLayer.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
  279 + controlsLayer.SetSizeModeFactor( Vector3( 1.0f, 1.0f, 1.0f ) );
  280 + controlsLayer.SetAnchorPoint( AnchorPoint::TOP_LEFT);
  281 + controlsLayer.SetParentOrigin( ParentOrigin::TOP_LEFT);
  282 + stage.Add( controlsLayer );
  283 +
  284 + // Back and next image buttons in corners of stage:
  285 + unsigned int playWidth = std::min( stage.GetSize().x * (1 / 5.0f), 58.0f );
  286 + Image playImage = ResourceImage::New( DALI_ICON_PLAY, ImageDimensions( playWidth, playWidth ), FittingMode::SHRINK_TO_FIT, SamplingMode::BOX_THEN_LINEAR );
  287 + Actor imagePrevious = ImageActor::New( playImage );
  288 +
  289 + // Last image button:
  290 + imagePrevious.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  291 + imagePrevious.RotateBy( Radian(3.14159265358979323846f), Vector3( 0, 1.0f, 0 ) );
  292 + imagePrevious.SetY( playWidth * 0.5f );
  293 + imagePrevious.SetX( playWidth + playWidth * 0.5f );
  294 + imagePrevious.SetOpacity( 0.6f );
  295 + controlsLayer.Add( imagePrevious );
  296 + imagePrevious.SetName( PREVIOUS_BUTTON_ID );
  297 + imagePrevious.TouchedSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched );
  298 +
  299 + // Next image button:
  300 + Actor imageNext = ImageActor::New( playImage );
  301 + imageNext.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
  302 + imageNext.SetY( playWidth * 0.5f );
  303 + imageNext.SetX( stage.GetSize().x - playWidth * 0.5f );
  304 + imageNext.SetOpacity( 0.6f );
  305 + controlsLayer.Add( imageNext );
  306 + imageNext.SetName( NEXT_BUTTON_ID );
  307 + imageNext.TouchedSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched );
  308 +
  309 + // Buttons to popup selectors for fitting and sampling modes:
  310 +
  311 + // Wrapper table to hold two buttons side by side:
  312 + Toolkit::TableView modesGroupBackground = Toolkit::TableView::New( 1, 2 );
  313 + modesGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  314 + modesGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  315 + modesGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR );
  316 + modesGroupBackground.SetCellPadding( Size( MARGIN_SIZE * 0.5f, MARGIN_SIZE ) );
  317 + modesGroupBackground.SetFitHeight( 0 );
  318 +
  319 + modesGroupBackground.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
  320 + modesGroupBackground.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
  321 + modesGroupBackground.SetPosition( 0.0f, 0.0f );
  322 +
  323 + controlsLayer.Add( modesGroupBackground );
  324 +
  325 + {
  326 + // Vertical table to hold label and button:
  327 + Toolkit::TableView fittingModeGroup = Toolkit::TableView::New( 2, 1 );
  328 + fittingModeGroup.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  329 + fittingModeGroup.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  330 + fittingModeGroup.SetBackgroundColor( BACKGROUND_COLOUR );
  331 + fittingModeGroup.SetCellPadding( Size( MARGIN_SIZE * 0.5f, MARGIN_SIZE * 0.5f ) );
  332 + fittingModeGroup.SetFitHeight( 0 );
  333 + fittingModeGroup.SetFitHeight( 1 );
  334 +
  335 + TextLabel label = TextLabel::New( "Image fitting mode:" );
  336 + label.SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_LABEL_TEXT );
  337 + fittingModeGroup.Add( label );
  338 +
  339 + Toolkit::PushButton button = CreateButton( FITTING_BUTTON_ID, StringFromScalingMode( mFittingMode ) );
  340 + button.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT );
  341 + fittingModeGroup.Add( button );
  342 + mFittingModeButton = button;
  343 +
  344 + modesGroupBackground.Add( fittingModeGroup );
  345 + }
  346 +
  347 + {
  348 + // Vertical table to hold label and button:
  349 + Toolkit::TableView samplingModeGroup = Toolkit::TableView::New( 2, 1 );
  350 + samplingModeGroup.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  351 + samplingModeGroup.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  352 + samplingModeGroup.SetBackgroundColor( BACKGROUND_COLOUR );
  353 + samplingModeGroup.SetCellPadding( Size( MARGIN_SIZE * 0.5f, MARGIN_SIZE * 0.5f ) );
  354 + samplingModeGroup.SetFitHeight( 0 );
  355 + samplingModeGroup.SetFitHeight( 1 );
  356 +
  357 + TextLabel label = TextLabel::New( "Image sampling mode:" );
  358 + label.SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_LABEL_TEXT );
  359 + samplingModeGroup.Add( label );
  360 +
  361 + Toolkit::PushButton button = CreateButton( SAMPLING_BUTTON_ID, StringFromFilterMode( mSamplingMode ) );
  362 + button.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT );
  363 + samplingModeGroup.Add( button );
  364 + mSamplingModeButton = button;
  365 +
  366 + modesGroupBackground.Add( samplingModeGroup );
  367 + }
  368 + }
  369 +
  370 + Toolkit::PushButton CreateButton( const char * id, const char * label )
  371 + {
  372 + Toolkit::PushButton button = Toolkit::PushButton::New();
  373 + button.SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT );
  374 + button.SetName( id );
  375 + button.SetLabel( label );
  376 + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  377 + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  378 + button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  379 + button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  380 + button.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) );
  381 + button.ClickedSignal().Connect( this, &ImageScalingAndFilteringController::OnButtonClicked );
  382 + return button;
  383 + }
  384 +
  385 + Toolkit::Popup CreatePopup()
  386 + {
  387 + Stage stage = Stage::GetCurrent();
  388 + const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f;
  389 +
  390 + Toolkit::Popup popup = Toolkit::Popup::New();
  391 + popup.SetName( "POPUP" );
  392 + popup.SetParentOrigin( ParentOrigin::CENTER );
  393 + popup.SetAnchorPoint( AnchorPoint::CENTER );
  394 + popup.SetSize( POPUP_WIDTH_DP, 0.0f );
  395 + popup.HideTail();
  396 +
  397 + popup.OutsideTouchedSignal().Connect( this, &ImageScalingAndFilteringController::OnPopupOutsideTouched );
  398 +
  399 + return popup;
  400 + }
  401 +
  402 + //void CreatePopupButton( Toolkit::Popup popup, const char* id )
  403 + Toolkit::PushButton CreatePopupButton( Actor parent, const char* id )
  404 + {
  405 + Toolkit::PushButton button = Toolkit::PushButton::New();
  406 + button.SetName( id );
  407 + button.SetLabel( id );
  408 + button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  409 + button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  410 + Toolkit::TextLabel textLabel = Toolkit::TextLabel::DownCast( button.GetLabel() );
  411 + textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 12.0f );
  412 +
  413 + button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  414 + button.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
  415 + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  416 + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  417 +
  418 + button.ClickedSignal().Connect( this, &ImageScalingAndFilteringController::OnButtonClicked );
  419 +
  420 + parent.Add( button );
  421 + return button;
  422 + }
  423 +
  424 + bool OnButtonClicked( Toolkit::Button button )
  425 + {
  426 + if( button.GetName() == FITTING_BUTTON_ID )
  427 + {
  428 + mPopup = CreatePopup();
  429 +
  430 + // Four-row table to hold buttons:
  431 + Toolkit::TableView fittingModes = Toolkit::TableView::New( 4, 1 );
  432 + fittingModes.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  433 + fittingModes.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  434 + fittingModes.SetBackgroundColor( BACKGROUND_COLOUR );
  435 + fittingModes.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5 ) );
  436 + fittingModes.SetFitHeight( 0 );
  437 + fittingModes.SetFitHeight( 1 );
  438 + fittingModes.SetFitHeight( 2 );
  439 + fittingModes.SetFitHeight( 3 );
  440 +
  441 + CreatePopupButton( fittingModes, StringFromScalingMode( FittingMode::SCALE_TO_FILL ) );
  442 + CreatePopupButton( fittingModes, StringFromScalingMode( FittingMode::SHRINK_TO_FIT ) );
  443 + CreatePopupButton( fittingModes, StringFromScalingMode( FittingMode::FIT_WIDTH ) );
  444 + CreatePopupButton( fittingModes, StringFromScalingMode( FittingMode::FIT_HEIGHT ) );
  445 +
  446 + mPopup.Add( fittingModes );
  447 + mPopup.Show();
  448 + }
  449 + else if( button.GetName() == SAMPLING_BUTTON_ID )
  450 + {
  451 + mPopup = CreatePopup();
  452 +
  453 + // Table to hold buttons for each sampling mode:
  454 + Toolkit::TableView samplingModes = Toolkit::TableView::New( 6, 1 );
  455 + samplingModes.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  456 + samplingModes.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  457 + samplingModes.SetBackgroundColor( BACKGROUND_COLOUR );
  458 + samplingModes.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5 ) );
  459 + samplingModes.SetFitHeight( 0 );
  460 + samplingModes.SetFitHeight( 1 );
  461 + samplingModes.SetFitHeight( 2 );
  462 + samplingModes.SetFitHeight( 3 );
  463 + samplingModes.SetFitHeight( 4 );
  464 + samplingModes.SetFitHeight( 5 );
  465 +
  466 + CreatePopupButton( samplingModes, StringFromFilterMode( SamplingMode::NEAREST ) );
  467 + CreatePopupButton( samplingModes, StringFromFilterMode( SamplingMode::LINEAR ) );
  468 + CreatePopupButton( samplingModes, StringFromFilterMode( SamplingMode::BOX ) );
  469 + CreatePopupButton( samplingModes, StringFromFilterMode( SamplingMode::BOX_THEN_NEAREST ) );
  470 + CreatePopupButton( samplingModes, StringFromFilterMode( SamplingMode::BOX_THEN_LINEAR ) );
  471 + CreatePopupButton( samplingModes, StringFromFilterMode( SamplingMode::NO_FILTER ) );
  472 +
  473 + mPopup.Add( samplingModes );
  474 + mPopup.Show();
  475 + }
  476 + else if( CheckFittingModeButton( button, FittingMode::SCALE_TO_FILL) ||
  477 + CheckFittingModeButton( button, FittingMode::SHRINK_TO_FIT) ||
  478 + CheckFittingModeButton( button, FittingMode::FIT_WIDTH) ||
  479 + CheckFittingModeButton( button, FittingMode::FIT_HEIGHT) )
  480 + {
  481 + }
  482 + else if( CheckSamplingModeButton( button, SamplingMode::NEAREST ) ||
  483 + CheckSamplingModeButton( button, SamplingMode::LINEAR ) ||
  484 + CheckSamplingModeButton( button, SamplingMode::BOX ) ||
  485 + CheckSamplingModeButton( button, SamplingMode::LINEAR ) ||
  486 + CheckSamplingModeButton( button, SamplingMode::BOX_THEN_NEAREST ) ||
  487 + CheckSamplingModeButton( button, SamplingMode::BOX_THEN_LINEAR ) ||
  488 + CheckSamplingModeButton( button, SamplingMode::NO_FILTER ) )
  489 + {
  490 + }
  491 + return true;
  492 + }
  493 +
  494 + bool CheckFittingModeButton( Actor &button, FittingMode::Type mode )
  495 + {
  496 + const char * const modeName = StringFromScalingMode( mode );
  497 + if( button.GetName() == modeName )
  498 + {
  499 + mFittingMode = mode;
  500 + mFittingModeButton.SetLabel( modeName );
  501 + mFittingModeButton.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT );
  502 + ResizeImage();
  503 + mPopup.Hide();
  504 + mPopup.Reset();
  505 + return true;
  506 + }
  507 + return false;
  508 + }
  509 +
  510 + bool CheckSamplingModeButton( Actor &button, SamplingMode::Type mode )
  511 + {
  512 + const char * const modeName = StringFromFilterMode( mode );
  513 + if( button.GetName() == modeName )
  514 + {
  515 + mSamplingMode = mode;
  516 + mSamplingModeButton.SetLabel( modeName );
  517 + mSamplingModeButton.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT );
  518 + ResizeImage();
  519 + mPopup.Hide();
  520 + mPopup.Reset();
  521 + return true;
  522 + }
  523 + return false;
  524 + }
  525 +
  526 + void OnPopupOutsideTouched()
  527 + {
  528 + if( mPopup )
  529 + {
  530 + mPopup.Hide();
  531 + mPopup.Reset();
  532 + }
  533 + }
  534 +
  535 + void OnImageLoaded( ResourceImage image )
  536 + {
  537 + DALI_ASSERT_DEBUG( image == mNextImage );
  538 + mImageActor.SetImage( image );
  539 + mImageActor.SetSize( Size( image.GetWidth(), image.GetHeight() ) );
  540 + }
  541 +
  542 + bool OnControlTouched( Actor actor, const TouchEvent& event )
  543 + {
  544 + if(event.GetPointCount() > 0)
  545 + {
  546 + const TouchPoint& point = event.GetPoint(0);
  547 + switch(point.state)
  548 + {
  549 + case TouchPoint::Up:
  550 + {
  551 + const std::string & name = actor.GetName();
  552 + if( name == NEXT_BUTTON_ID )
  553 + {
  554 + mCurrentPath = mCurrentPath + 1;
  555 + mCurrentPath = mCurrentPath < NUM_IMAGE_PATHS ? mCurrentPath : 0;
  556 + ResizeImage();
  557 + }
  558 + else if( name == PREVIOUS_BUTTON_ID )
  559 + {
  560 + mCurrentPath = mCurrentPath - 1;
  561 + mCurrentPath = mCurrentPath >= 0 ? mCurrentPath : NUM_IMAGE_PATHS - 1;
  562 + ResizeImage();
  563 + }
  564 + break;
  565 + }
  566 + default:
  567 + {
  568 + break;
  569 + }
  570 + } // end switch
  571 + }
  572 +
  573 + return false;
  574 + }
  575 +
  576 + void OnPinch( Actor actor, const PinchGesture& pinch )
  577 + {
  578 + if( pinch.state == Gesture::Started )
  579 + {
  580 + mLastPinchScale = pinch.scale;
  581 + }
  582 + const float scale = pinch.scale;
  583 +
  584 + if( scale != mLastPinchScale )
  585 + {
  586 + if ( scale < mLastPinchScale )
  587 + {
  588 + mImageStageScale.x = std::max( 0.05f, mImageStageScale.x * 0.9f );
  589 + mImageStageScale.y = std::max( 0.05f, mImageStageScale.y * 0.9f );
  590 + }
  591 + else
  592 + {
  593 + mImageStageScale.x = std::max( 0.05f, std::min( 1.0f, mImageStageScale.x * 1.1f ) );
  594 + mImageStageScale.y = std::max( 0.05f, std::min( 1.0f, mImageStageScale.y * 1.1f ) );
  595 + }
  596 + ResizeImage();
  597 + }
  598 + mLastPinchScale = scale;
  599 + }
  600 +
  601 + void OnPan( Actor actor, const PanGesture& gesture )
  602 + {
  603 + Stage stage = Stage::GetCurrent();
  604 + mImageStageScale.x = std::max( 0.05f, std::min( 1.0f, mImageStageScale.x + (gesture.displacement.x * 2.0f / stage.GetSize().width ) ) );
  605 + mImageStageScale.y = std::max( 0.05f, std::min( 1.0f, mImageStageScale.y + (gesture.displacement.y * 2.0f / stage.GetSize().height ) ) );
  606 + ResizeImage();
  607 + }
  608 +
  609 + void OnKeyEvent(const KeyEvent& event)
  610 + {
  611 + if( event.state == KeyEvent::Down )
  612 + {
  613 + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
  614 + {
  615 + if( mPopup && mPopup.IsVisible() )
  616 + {
  617 + mPopup.Hide();
  618 + mPopup.Reset();
  619 + }
  620 + else
  621 + {
  622 + mApplication.Quit();
  623 + }
  624 + }
  625 + else if ( event.keyPressedName == "Right" )
  626 + {
  627 + mImageStageScale.x = std::max( 0.05f, std::min( 1.0f, mImageStageScale.x * 1.1f ) );
  628 + }
  629 + else if ( event.keyPressedName == "Left" )
  630 + {
  631 + mImageStageScale.x = std::max( 0.05f, mImageStageScale.x * 0.9f );
  632 + }
  633 + else if ( event.keyPressedName == "Up" )
  634 + {
  635 + mImageStageScale.y = std::max( 0.05f, std::min( 1.0f, mImageStageScale.y * 1.1f ) );
  636 + }
  637 + else if ( event.keyPressedName == "Down" )
  638 + {
  639 + mImageStageScale.y = std::max( 0.05f, mImageStageScale.y * 0.9f );
  640 + }
  641 + else if ( event.keyPressedName == "o" )
  642 + {
  643 + mImageStageScale.x = std::max( 0.05f, mImageStageScale.x * 0.9f );
  644 + mImageStageScale.y = std::max( 0.05f, mImageStageScale.y * 0.9f );
  645 + }
  646 + else if ( event.keyPressedName == "p" )
  647 + {
  648 + mImageStageScale.x = std::max( 0.05f, std::min( 1.0f, mImageStageScale.x * 1.1f ) );
  649 + mImageStageScale.y = std::max( 0.05f, std::min( 1.0f, mImageStageScale.y * 1.1f ) );
  650 + }
  651 + else if ( event.keyPressedName == "n" )
  652 + {
  653 + mCurrentPath = mCurrentPath + 1;
  654 + mCurrentPath = mCurrentPath < NUM_IMAGE_PATHS ? mCurrentPath : 0;
  655 + }
  656 + else if ( event.keyPressedName == "b" )
  657 + {
  658 + mCurrentPath = mCurrentPath - 1;
  659 + mCurrentPath = mCurrentPath >= 0 ? mCurrentPath : NUM_IMAGE_PATHS - 1;
  660 + }
  661 + // Cycle filter and scaling modes:
  662 + else if ( event.keyPressedName == "f" )
  663 + {
  664 + mSamplingMode = NextFilterMode( mSamplingMode );
  665 + mSamplingModeButton.SetLabel( StringFromFilterMode( mSamplingMode ) );
  666 + mSamplingModeButton.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT );
  667 + }
  668 + // Cycle filter and scaling modes:
  669 + else if ( event.keyPressedName == "s" )
  670 + {
  671 + mFittingMode = NextScalingMode( mFittingMode );
  672 + mFittingModeButton.SetLabel( StringFromScalingMode( mFittingMode ) );
  673 + mFittingModeButton.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT );
  674 + }
  675 + else
  676 + {
  677 + return;
  678 + }
  679 +
  680 + ResizeImage();
  681 + }
  682 + }
  683 +
  684 +private:
  685 + void ResizeImage()
  686 + {
  687 + const char * const path = IMAGE_PATHS[mCurrentPath];
  688 +
  689 + Stage stage = Stage::GetCurrent();
  690 + Size imageSize = stage.GetSize() * mImageStageScale;
  691 + const ImageDimensions imageSizeInt = ImageDimensions::FromFloatArray( &imageSize.x );
  692 +
  693 + ResourceImage image = ResourceImage::New( path, imageSizeInt, mFittingMode, mSamplingMode );
  694 + image.LoadingFinishedSignal().Connect( this, &ImageScalingAndFilteringController::OnImageLoaded );
  695 +
  696 + mNextImage = image;
  697 +
  698 + mDesiredBox.SetSize( stage.GetSize() * mImageStageScale );
  699 + mHeightBox.SetSize( stage.GetSize().width, (stage.GetSize() * mImageStageScale).height );
  700 + mWidthBox.SetSize( (stage.GetSize() * mImageStageScale).width, stage.GetSize().height );
  701 + }
  702 +
  703 +private:
  704 + Application& mApplication;
  705 + Actor mDesiredBox; //< Background rectangle to show requested image size.
  706 + Actor mHeightBox; //< Background horizontal stripe to show requested image height.
  707 + Actor mWidthBox; //< Background vertical stripe to show requested image width.
  708 + Toolkit::PushButton mFittingModeButton;
  709 + Toolkit::PushButton mSamplingModeButton;
  710 + Toolkit::Popup mPopup;
  711 + PinchGestureDetector mPinchDetector;
  712 + float mLastPinchScale;
  713 + Toolkit::PushButton mGrabCorner;
  714 + PanGestureDetector mPanGestureDetector;
  715 + ImageActor mImageActor;
  716 + ResourceImage mNextImage; //< Currently-loading image
  717 + Vector2 mImageStageScale;
  718 + int mCurrentPath;
  719 + FittingMode::Type mFittingMode;
  720 + SamplingMode::Type mSamplingMode;
  721 +};
  722 +
  723 +void RunTest( Application& application )
  724 +{
  725 + ImageScalingAndFilteringController test( application );
  726 +
  727 + application.MainLoop();
  728 +}
  729 +
  730 +// Entry point for Linux & Tizen applications
  731 +int main( int argc, char **argv )
  732 +{
  733 + Application application = Application::New( &argc, &argv );
  734 +
  735 + RunTest( application );
  736 +
  737 + return 0;
  738 +}
... ...
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
... ... @@ -465,7 +465,7 @@ public:
465 465 {
466 466 // Spin the image a few times:
467 467 Animation animation = Animation::New(SPIN_DURATION);
468   - animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f * SPIN_DURATION) ), Vector3::XAXIS ), AlphaFunctions::EaseOut );
  468 + animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f * SPIN_DURATION) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT );
469 469 animation.Play();
470 470  
471 471 // Change the scaling mode:
... ... @@ -568,7 +568,7 @@ private:
568 568 Application& mApplication;
569 569  
570 570 Layer mContentLayer; ///< The content layer (contains non gui chrome actors)
571   - Toolkit::View mView; ///< The View instance.
  571 + Toolkit::Control mView; ///< The View instance.
572 572 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
573 573 TextLabel mTitleActor; ///< The Toolbar's Title.
574 574 Actor mGridActor; ///< The container for the grid of images
... ...
examples/item-view/item-view-example.cpp
... ... @@ -103,9 +103,9 @@ const unsigned int IMAGE_WIDTH = 256;
103 103 const unsigned int IMAGE_HEIGHT = 256;
104 104 const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8;
105 105  
106   -AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunctions::Linear,
107   - AlphaFunctions::EaseIn,
108   - AlphaFunctions::EaseOut };
  106 +AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunction(AlphaFunction::LINEAR),
  107 + AlphaFunction(AlphaFunction::EASE_IN),
  108 + AlphaFunction(AlphaFunction::EASE_OUT) };
109 109  
110 110 const unsigned int NUM_ALPHA_FUNCTIONS = sizeof(ALPHA_FUNCTIONS) / sizeof(AlphaFunction);
111 111  
... ... @@ -253,7 +253,7 @@ public:
253 253 TOOLBAR_IMAGE,
254 254 "" );
255 255  
256   - mView.OrientationAnimationStartedSignal().Connect( this, &ItemViewExample::OnOrientationChanged );
  256 + app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &ItemViewExample::OnOrientationChanged );
257 257  
258 258 // Create an edit mode button. (left of toolbar)
259 259 Toolkit::PushButton editButton = Toolkit::PushButton::New();
... ... @@ -414,7 +414,7 @@ public:
414 414 * Orientation changed signal callback
415 415 * @param orientation
416 416 */
417   - void OnOrientationChanged( View view, Animation& animation, const Orientation& orientation )
  417 + void OnOrientationChanged( Orientation orientation )
418 418 {
419 419 const unsigned int angle = orientation.GetDegrees();
420 420  
... ... @@ -1105,7 +1105,7 @@ private:
1105 1105 Mode mMode;
1106 1106 bool mMenuShown;
1107 1107  
1108   - Toolkit::View mView;
  1108 + Toolkit::Control mView;
1109 1109 unsigned int mOrientation;
1110 1110  
1111 1111 Toolkit::ToolBar mToolBar;
... ...
examples/logging/logging-example.cpp
... ... @@ -700,7 +700,7 @@ class LoggingController: public ConnectionTracker
700 700 {
701 701 if( mAnimation )
702 702 {
703   - mAnimation.AnimateBy( Property(actor, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear );
  703 + mAnimation.AnimateBy( Property(actor, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunction::LINEAR );
704 704 mAnimation.Play();
705 705 mLastPoint = localPoint;
706 706 }
... ... @@ -722,7 +722,7 @@ class LoggingController: public ConnectionTracker
722 722 };
723 723  
724 724 Application& mApplication;
725   - Toolkit::View mView; ///< The View instance.
  725 + Toolkit::Control mView; ///< The View instance.
726 726 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
727 727 Layer mContentLayer; ///< Content layer
728 728  
... ...
examples/magnifier/magnifier-example.cpp
... ... @@ -225,7 +225,7 @@ public:
225 225 Stage::GetCurrent().Add(overlay);
226 226  
227 227 mMagnifier = Toolkit::Magnifier::New();
228   - mMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
  228 + mMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
229 229 mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
230 230 mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
231 231 mMagnifier.SetScale(Vector3::ZERO);
... ... @@ -242,7 +242,7 @@ public:
242 242  
243 243 // Create bouncing magnifier automatically bounces around screen.
244 244 mBouncingMagnifier = Toolkit::Magnifier::New();
245   - mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
  245 + mBouncingMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
246 246 mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
247 247 mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
248 248 overlay.Add( mBouncingMagnifier );
... ... @@ -344,7 +344,7 @@ public:
344 344 if(!mMagnifierShown)
345 345 {
346 346 Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
347   - animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ONE, AlphaFunctions::EaseIn);
  347 + animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ONE, AlphaFunction::EASE_IN);
348 348 animation.Play();
349 349 mMagnifierShown = true;
350 350 }
... ... @@ -358,7 +358,7 @@ public:
358 358 if(mMagnifierShown)
359 359 {
360 360 Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
361   - animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut);
  361 + animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ZERO, AlphaFunction::EASE_OUT);
362 362 animation.Play();
363 363 mMagnifierShown = false;
364 364 }
... ... @@ -393,7 +393,7 @@ public:
393 393 private:
394 394  
395 395 Application& mApplication; ///< Application instance
396   - Toolkit::View mView; ///< The view
  396 + Toolkit::Control mView; ///< The view
397 397 Layer mContent; ///< The content layer
398 398 Toolkit::Magnifier mMagnifier; ///< The manually controlled magnifier
399 399 Toolkit::Magnifier mBouncingMagnifier; ///< The animating magnifier (swirly animation)
... ...
examples/motion-blur/motion-blur-example.cpp
... ... @@ -322,7 +322,7 @@ public:
322 322 {
323 323 // has parent so we expect it to be on stage, start animation
324 324 mRotateAnimation = Animation::New( ORIENTATION_DURATION );
325   - mRotateAnimation.AnimateTo( Property( mView, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -orientation ) ), Vector3::ZAXIS ), AlphaFunctions::EaseOut );
  325 + mRotateAnimation.AnimateTo( Property( mView, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -orientation ) ), Vector3::ZAXIS ), AlphaFunction::EASE_OUT );
326 326 mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_WIDTH ), targetSize.width );
327 327 mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_HEIGHT ), targetSize.height );
328 328 mRotateAnimation.Play();
... ... @@ -367,7 +367,7 @@ public:
367 367 mActorTapMovementAnimation = Animation::New( animDuration );
368 368 if ( mMotionBlurImageActor )
369 369 {
370   - mActorTapMovementAnimation.AnimateTo( Property(mMotionBlurImageActor, Actor::Property::POSITION), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) );
  370 + mActorTapMovementAnimation.AnimateTo( Property(mMotionBlurImageActor, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(animDuration) );
371 371 }
372 372 mActorTapMovementAnimation.SetEndAction( Animation::Bake );
373 373 mActorTapMovementAnimation.Play();
... ... @@ -383,7 +383,7 @@ public:
383 383 {
384 384 float animDuration = 1.0f;
385 385 mActorAnimation = Animation::New(animDuration);
386   - mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunctions::EaseInOut );
  386 + mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunction::EASE_IN_OUT );
387 387 mActorAnimation.SetEndAction( Animation::Bake );
388 388 mActorAnimation.Play();
389 389 }
... ... @@ -394,7 +394,7 @@ public:
394 394 {
395 395 float animDuration = 1.0f;
396 396 mActorAnimation = Animation::New(animDuration);
397   - mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunctions::EaseInOut );
  397 + mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunction::EASE_IN_OUT );
398 398 mActorAnimation.SetEndAction( Animation::Bake );
399 399 mActorAnimation.Play();
400 400 }
... ... @@ -405,8 +405,8 @@ public:
405 405 {
406 406 float animDuration = 1.0f;
407 407 mActorAnimation = Animation::New(animDuration);
408   - mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunctions::EaseInOut );
409   - mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunctions::EaseInOut );
  408 + mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunction::EASE_IN_OUT );
  409 + mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunction::EASE_IN_OUT );
410 410 mActorAnimation.SetEndAction( Animation::Bake );
411 411 mActorAnimation.Play();
412 412 }
... ... @@ -417,7 +417,7 @@ public:
417 417 {
418 418 float animDuration = 1.0f;
419 419 mActorAnimation = Animation::New(animDuration);
420   - mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::SCALE ), Vector3(2.0f, 2.0f, 2.0f), AlphaFunctions::Bounce, TimePeriod( 0.0f, 1.0f ) );
  420 + mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::SCALE ), Vector3(2.0f, 2.0f, 2.0f), AlphaFunction::BOUNCE, TimePeriod( 0.0f, 1.0f ) );
421 421 mActorAnimation.SetEndAction( Animation::Bake );
422 422 mActorAnimation.Play();
423 423 }
... ... @@ -503,7 +503,7 @@ public:
503 503  
504 504 private:
505 505 Application& mApplication; ///< Application instance
506   - Toolkit::View mView;
  506 + Toolkit::Control mView;
507 507 Toolkit::ToolBar mToolBar;
508 508 Image mIconEffectsOff;
509 509 Image mIconEffectsOn;
... ...
examples/motion-stretch/motion-stretch-example.cpp
... ... @@ -220,7 +220,7 @@ public:
220 220 {
221 221 // has parent so we expect it to be on stage, start animation
222 222 mRotateAnimation = Animation::New( ORIENTATION_DURATION );
223   - mRotateAnimation.AnimateTo( Property( mView, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -orientation ) ), Vector3::ZAXIS ), AlphaFunctions::EaseOut );
  223 + mRotateAnimation.AnimateTo( Property( mView, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -orientation ) ), Vector3::ZAXIS ), AlphaFunction::EASE_OUT );
224 224 mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_WIDTH ), targetSize.width );
225 225 mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_HEIGHT ), targetSize.height );
226 226 mRotateAnimation.Play();
... ... @@ -264,7 +264,7 @@ public:
264 264 mActorTapMovementAnimation = Animation::New( animDuration );
265 265 if ( mMotionStretchImageActor )
266 266 {
267   - mActorTapMovementAnimation.AnimateTo( Property(mMotionStretchImageActor, Actor::Property::POSITION), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) );
  267 + mActorTapMovementAnimation.AnimateTo( Property(mMotionStretchImageActor, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(animDuration) );
268 268 }
269 269 mActorTapMovementAnimation.SetEndAction( Animation::Bake );
270 270 mActorTapMovementAnimation.Play();
... ... @@ -280,7 +280,7 @@ public:
280 280 {
281 281 float animDuration = 1.0f;
282 282 mActorAnimation = Animation::New(animDuration);
283   - mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunctions::EaseInOut );
  283 + mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunction::EASE_IN_OUT );
284 284 mActorAnimation.SetEndAction( Animation::Bake );
285 285 mActorAnimation.Play();
286 286 }
... ... @@ -291,7 +291,7 @@ public:
291 291 {
292 292 float animDuration = 1.0f;
293 293 mActorAnimation = Animation::New(animDuration);
294   - mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunctions::EaseInOut );
  294 + mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunction::EASE_IN_OUT );
295 295 mActorAnimation.SetEndAction( Animation::Bake );
296 296 mActorAnimation.Play();
297 297 }
... ... @@ -302,8 +302,8 @@ public:
302 302 {
303 303 float animDuration = 1.0f;
304 304 mActorAnimation = Animation::New(animDuration);
305   - mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunctions::EaseInOut );
306   - mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunctions::EaseInOut );
  305 + mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunction::EASE_IN_OUT );
  306 + mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunction::EASE_IN_OUT );
307 307 mActorAnimation.SetEndAction( Animation::Bake );
308 308 mActorAnimation.Play();
309 309 }
... ... @@ -314,7 +314,7 @@ public:
314 314 {
315 315 float animDuration = 1.0f;
316 316 mActorAnimation = Animation::New(animDuration);
317   - mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::SCALE ), Vector3(2.0f, 2.0f, 2.0f), AlphaFunctions::Bounce, TimePeriod( 0.0f, 1.0f ) );
  317 + mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::SCALE ), Vector3(2.0f, 2.0f, 2.0f), AlphaFunction::BOUNCE, TimePeriod( 0.0f, 1.0f ) );
318 318 mActorAnimation.SetEndAction( Animation::Bake );
319 319 mActorAnimation.Play();
320 320 }
... ... @@ -400,7 +400,7 @@ public:
400 400  
401 401 private:
402 402 Application& mApplication; ///< Application instance
403   - Toolkit::View mView;
  403 + Toolkit::Control mView;
404 404 Toolkit::ToolBar mToolBar;
405 405 Image mIconEffectsOff;
406 406 Image mIconEffectsOn;
... ...
examples/new-window/new-window-example.cpp
... ... @@ -88,7 +88,7 @@ private:
88 88 MeshActor mMeshActor;
89 89 MeshActor mAnimatedMeshActor;
90 90  
91   - Toolkit::View mView; ///< The View instance.
  91 + Toolkit::Control mView; ///< The View instance.
92 92 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
93 93 TextLabel mTitleActor; ///< The Toolbar's Title.
94 94 Layer mContentLayer; ///< Content layer (scrolling cluster content)
... ...
examples/page-turn-view/page-turn-view-example.cpp
... ... @@ -152,11 +152,9 @@ private:
152 152  
153 153 /**
154 154 * This method gets called when the screen is rotated, switch between portrait and landscape views
155   - * param [in] view The view receiving the orientation change signal
156   - * param [in] animation The Orientation Rotating animation
157 155 * param [in] orientation The current screen orientation
158 156 */
159   - void OnOrientationAnimationStarted( View view, Animation& animation, const Orientation& orientation );
  157 + void OnOrientationAnimationStarted( Orientation orientation );
160 158  
161 159 /**
162 160 * Main key event handler
... ... @@ -196,7 +194,7 @@ private:
196 194 private:
197 195  
198 196 Application& mApplication;
199   - View mView;
  197 + Actor mView;
200 198  
201 199 PageTurnView mPageTurnPortraitView;
202 200 PageTurnView mPageTurnLandscapeView;
... ... @@ -231,7 +229,10 @@ void PageTurnController::OnInit( Application&amp; app )
231 229 Vector2 stageSize = stage.GetSize();
232 230  
233 231 // Create default View.
234   - mView = View::New();
  232 + mView = Actor::New();
  233 + mView.SetAnchorPoint( Dali::AnchorPoint::CENTER );
  234 + mView.SetParentOrigin( Dali::ParentOrigin::CENTER );
  235 + mView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
235 236 stage.Add( mView );
236 237  
237 238 Dali::Window winHandle = app.GetWindow();
... ... @@ -239,10 +240,9 @@ void PageTurnController::OnInit( Application&amp; app )
239 240 winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE );
240 241 winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE );
241 242 winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE );
242   - // FIXME
243   - //app.GetOrientation().ChangedSignal().Connect( &mView, &View::OrientationChanged );
  243 +
244 244 // view will response to orientation change to display portrait or landscape views
245   - mView.OrientationAnimationStartedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted );
  245 + app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted );
246 246  
247 247 mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize );
248 248 mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) );
... ... @@ -262,7 +262,7 @@ void PageTurnController::OnInit( Application&amp; app )
262 262 mView.Add(mPageTurnPortraitView);
263 263 }
264 264  
265   -void PageTurnController::OnOrientationAnimationStarted( View view, Animation& animation, const Orientation& orientation )
  265 +void PageTurnController::OnOrientationAnimationStarted( Orientation orientation )
266 266 {
267 267 switch( orientation.GetDegrees() )
268 268 {
... ...
examples/path-animation/path-animation.cpp
... ... @@ -444,7 +444,7 @@ public:
444 444 stage.KeyEventSignal().Connect(this, &PathController::OnKeyEvent);
445 445  
446 446 // Create a default view with a default tool bar:
447   - Toolkit::View view; ///< The View instance.
  447 + Toolkit::Control view; ///< The View instance.
448 448 Toolkit::ToolBar toolBar; ///< The View's Toolbar.
449 449 mContentLayer = DemoHelper::CreateView( mApplication,
450 450 view,
... ...
examples/radial-menu/radial-menu-example.cpp
... ... @@ -91,7 +91,7 @@ private: // Member variables
91 91 };
92 92  
93 93 Application mApplication; ///< The application handle
94   - Toolkit::View mView; ///< The toolbar view
  94 + Toolkit::Control mView; ///< The toolbar view
95 95 Layer mContents; ///< The toolbar contents pane
96 96 ImageActor mImageActor; ///< Image actor shown by stencil mask
97 97 Animation mAnimation;
... ... @@ -194,8 +194,8 @@ void RadialMenuExample::StartAnimation()
194 194 mRadialSweepView1.Activate(mAnimation, 0.0f, 3.0f);
195 195 mRadialSweepView2.Activate(mAnimation, 1.5f, 3.0f);
196 196 mRadialSweepView3.Activate(mAnimation, 3.0f, 3.0f);
197   - mAnimation.AnimateTo( Property( mDialActor, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn, TimePeriod( 0.0f, 0.8f ) );
198   - mAnimation.AnimateTo( Property( mRadialSweepView1, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn, TimePeriod( 0.0f, 0.5f ) );
  197 + mAnimation.AnimateTo( Property( mDialActor, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::EASE_IN, TimePeriod( 0.0f, 0.8f ) );
  198 + mAnimation.AnimateTo( Property( mRadialSweepView1, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::EASE_IN, TimePeriod( 0.0f, 0.5f ) );
199 199 mAnimation.FinishedSignal().Connect( this, &RadialMenuExample::OnAnimationFinished );
200 200  
201 201 mAnimationState = PLAYING;
... ... @@ -259,7 +259,7 @@ RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName,
259 259 radialSweepView.SetInitialSector( Degree(0.0f) );
260 260 radialSweepView.SetFinalSector( Degree(359.999f) );
261 261 radialSweepView.SetSize( Stage::GetCurrent().GetSize());
262   - radialSweepView.SetEasingFunction( Dali::AlphaFunctions::EaseInOut );
  262 + radialSweepView.SetEasingFunction( Dali::AlphaFunction::EASE_IN_OUT );
263 263 radialSweepView.SetPositionInheritanceMode(USE_PARENT_POSITION);
264 264 mContents.Add(radialSweepView);
265 265 radialSweepView.Add( mImageActor );
... ...
examples/radial-menu/radial-sweep-view-impl.cpp
... ... @@ -67,11 +67,13 @@ float HoldZeroFastEaseInOutHoldOne(float progress)
67 67 }
68 68 else if(progress < 0.5f)
69 69 {
70   - return AlphaFunctions::EaseIn((progress-0.2) / 0.3f) * 0.5f;
  70 + progress = (progress-0.2) / 0.3f;
  71 + return progress*progress*progress*0.5f;
71 72 }
72 73 else if(progress < 0.8f)
73 74 {
74   - return AlphaFunctions::EaseOut((progress - 0.5f) / 0.3f) * 0.5f + 0.5f;
  75 + progress = ((progress - 0.5f) / 0.3f) - 1.0f;
  76 + return (progress*progress*progress+1.0f) * 0.5f + 0.5f;
75 77 }
76 78 else
77 79 {
... ...
examples/refraction-effect/refraction-effect-example.cpp
... ... @@ -325,7 +325,7 @@ private:
325 325 // Creates a default view with a default tool bar.
326 326 // The view is added to the stage.
327 327 Toolkit::ToolBar toolBar;
328   - Toolkit::View view;
  328 + Toolkit::Control view;
329 329 mContent = DemoHelper::CreateView( application,
330 330 view,
331 331 toolBar,
... ...
examples/scroll-view/scroll-view-example.cpp
... ... @@ -353,8 +353,8 @@ private:
353 353 mScrollViewEffect = ScrollViewDepthEffect::New();
354 354 mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION);
355 355 mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION);
356   - mScrollView.SetScrollSnapAlphaFunction(AlphaFunctions::EaseOut);
357   - mScrollView.SetScrollFlickAlphaFunction(AlphaFunctions::EaseOut);
  356 + mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT);
  357 + mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT);
358 358 mScrollView.RemoveConstraintsFromChildren();
359 359 break;
360 360 }
... ... @@ -364,8 +364,8 @@ private:
364 364 mScrollViewEffect = ScrollViewCubeEffect::New();
365 365 mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION);
366 366 mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION);
367   - mScrollView.SetScrollSnapAlphaFunction(AlphaFunctions::EaseOutBack);
368   - mScrollView.SetScrollFlickAlphaFunction(AlphaFunctions::EaseOutBack);
  367 + mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT_BACK);
  368 + mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT_BACK);
369 369 mScrollView.RemoveConstraintsFromChildren();
370 370 break;
371 371 }
... ... @@ -375,8 +375,8 @@ private:
375 375 mScrollViewEffect = ScrollViewPageCarouselEffect::New();
376 376 mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION);
377 377 mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION);
378   - mScrollView.SetScrollSnapAlphaFunction(AlphaFunctions::EaseOut);
379   - mScrollView.SetScrollFlickAlphaFunction(AlphaFunctions::EaseOut);
  378 + mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT);
  379 + mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT);
380 380 mScrollView.RemoveConstraintsFromChildren();
381 381 break;
382 382 }
... ... @@ -386,8 +386,8 @@ private:
386 386 mScrollViewEffect = ScrollViewPageCubeEffect::New();
387 387 mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION);
388 388 mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION);
389   - mScrollView.SetScrollSnapAlphaFunction(AlphaFunctions::EaseOut);
390   - mScrollView.SetScrollFlickAlphaFunction(AlphaFunctions::EaseOut);
  389 + mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT);
  390 + mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT);
391 391 mScrollView.RemoveConstraintsFromChildren();
392 392 break;
393 393 }
... ... @@ -397,8 +397,8 @@ private:
397 397 mScrollViewEffect = ScrollViewPageSpiralEffect::New();
398 398 mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION);
399 399 mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION);
400   - mScrollView.SetScrollSnapAlphaFunction(AlphaFunctions::EaseOut);
401   - mScrollView.SetScrollFlickAlphaFunction(AlphaFunctions::EaseOut);
  400 + mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT);
  401 + mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT);
402 402 mScrollView.RemoveConstraintsFromChildren();
403 403 break;
404 404 }
... ... @@ -607,7 +607,7 @@ private:
607 607 {
608 608 // Spin the Image a few times.
609 609 Animation animation = Animation::New(SPIN_DURATION);
610   - animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f * SPIN_DURATION) ), Vector3::XAXIS ), AlphaFunctions::EaseOut );
  610 + animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f * SPIN_DURATION) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT );
611 611 animation.Play();
612 612 }
613 613 }
... ... @@ -659,7 +659,7 @@ private:
659 659 private:
660 660  
661 661 Application& mApplication; ///< Application instance
662   - Toolkit::View mView; ///< The View instance.
  662 + Toolkit::Control mView; ///< The View instance.
663 663 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
664 664 TextLabel mTitleActor; ///< The Toolbar's Title.
665 665 Layer mContentLayer; ///< The content layer (contains game actors)
... ...
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
... ... @@ -277,7 +277,7 @@ public:
277 277  
278 278 // Want to animate angle from 30 => -30 and back again smoothly.
279 279  
280   - mSceneAnimation.AnimateTo( Property( mImageActor2, angleIndex ), Property::Value(-Dali::ANGLE_30), AlphaFunctions::Sin );
  280 + mSceneAnimation.AnimateTo( Property( mImageActor2, angleIndex ), Property::Value(-Dali::ANGLE_30), AlphaFunction::SIN );
281 281  
282 282 mSceneAnimation.SetLooping(true);
283 283 mSceneAnimation.Play();
... ... @@ -444,7 +444,7 @@ public:
444 444  
445 445 private:
446 446 Application& mApp;
447   - Toolkit::View mView;
  447 + Toolkit::Control mView;
448 448 Layer mContents;
449 449 Actor mSceneActor;
450 450 Animation mAnimation;
... ...
examples/size-negotiation/size-negotiation-example.cpp
... ... @@ -1275,7 +1275,7 @@ private:
1275 1275 };
1276 1276  
1277 1277 Application& mApplication;
1278   - Toolkit::View mView; ///< The View instance.
  1278 + Toolkit::Control mView; ///< The View instance.
1279 1279 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
1280 1280 Layer mContentLayer; ///< Content layer
1281 1281  
... ...
examples/text-field/text-field-example.cpp
... ... @@ -25,17 +25,48 @@
25 25 #include <dali/public-api/text-abstraction/text-abstraction.h>
26 26  
27 27 // INTERNAL INCLUDES
  28 +#include "shared/multi-language-strings.h"
28 29 #include "shared/view.h"
29 30  
30 31 using namespace Dali;
31 32 using namespace Dali::Toolkit;
  33 +using namespace MultiLanguageStrings;
32 34  
33 35 namespace
34 36 {
35 37  
36   -const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
  38 + const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
37 39  
38   -const float BORDER_WIDTH = 4.0f;
  40 + const float BORDER_WIDTH = 4.0f;
  41 +
  42 + const unsigned int KEY_ZERO = 10;
  43 + const unsigned int KEY_ONE = 11;
  44 + const unsigned int KEY_F = 41;
  45 + const unsigned int KEY_H = 43;
  46 + const unsigned int KEY_V = 55;
  47 + const unsigned int KEY_M = 58;
  48 + const unsigned int KEY_L = 46;
  49 + const unsigned int KEY_S = 39;
  50 + const unsigned int KEY_PLUS = 21;
  51 + const unsigned int KEY_MINUS = 20;
  52 +
  53 + const char* H_ALIGNMENT_STRING_TABLE[] =
  54 + {
  55 + "BEGIN",
  56 + "CENTER",
  57 + "END"
  58 + };
  59 +
  60 + const unsigned int H_ALIGNMENT_STRING_COUNT = sizeof( H_ALIGNMENT_STRING_TABLE ) / sizeof( H_ALIGNMENT_STRING_TABLE[0u] );
  61 +
  62 + const char* V_ALIGNMENT_STRING_TABLE[] =
  63 + {
  64 + "TOP",
  65 + "CENTER",
  66 + "BOTTOM"
  67 + };
  68 +
  69 + const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] );
39 70  
40 71 } // unnamed namespace
41 72  
... ... @@ -47,7 +78,9 @@ class TextFieldExample : public ConnectionTracker
47 78 public:
48 79  
49 80 TextFieldExample( Application& application )
50   - : mApplication( application )
  81 + : mApplication( application ),
  82 + mLanguageId( 0u ),
  83 + mAlignment( 0u )
51 84 {
52 85 // Connect to the Application's Init signal
53 86 mApplication.InitSignal().Connect( this, &TextFieldExample::Create );
... ... @@ -67,33 +100,41 @@ public:
67 100  
68 101 Stage stage = Stage::GetCurrent();
69 102  
  103 + mTapGestureDetector = TapGestureDetector::New();
  104 + mTapGestureDetector.Attach( stage.GetRootLayer() );
  105 + mTapGestureDetector.DetectedSignal().Connect( this, &TextFieldExample::OnTap );
  106 +
70 107 stage.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent);
71 108  
72 109 Vector2 stageSize = stage.GetSize();
73 110  
74   - mContainer = Control::New();
75   - mContainer.SetName( "Container" );
76   - mContainer.SetParentOrigin( ParentOrigin::CENTER );
77   - mContainer.SetSize( Vector2(stageSize.width*0.6f, stageSize.width*0.6f) );
78   - mContainer.SetBackgroundImage( ResourceImage::New( BACKGROUND_IMAGE ) );
79   - mContainer.GetChildAt(0).SetZ(-1.0f);
80   - stage.Add( mContainer );
  111 + Control container = Control::New();
  112 + container.SetName( "Container" );
  113 + container.SetParentOrigin( ParentOrigin::CENTER );
  114 + container.SetSize( Vector2(stageSize.width*0.6f, stageSize.width*0.6f) );
  115 + container.SetBackgroundColor( Color::WHITE );
  116 + container.GetChildAt(0).SetZ(-1.0f);
  117 + stage.Add( container );
81 118  
82   - TextField field = TextField::New();
83   - field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
84   - field.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
85   - field.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  119 + mField = TextField::New();
  120 + mField.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  121 + mField.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  122 + mField.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  123 + mField.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" );
  124 + mField.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) );
86 125  
87   - mContainer.Add( field );
  126 + container.Add( mField );
88 127  
89   - field.SetProperty( TextField::Property::TEXT, "Hello" );
90   - field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) );
91   -
92   - Property::Value fieldText = field.GetProperty( TextField::Property::TEXT );
  128 + Property::Value fieldText = mField.GetProperty( TextField::Property::TEXT );
93 129  
94 130 std::cout << "Displaying text: " << fieldText.Get< std::string >() << std::endl;
95 131 }
96 132  
  133 + void OnTap( Actor actor, const TapGesture& tapGesture )
  134 + {
  135 + mField.ClearKeyInputFocus();
  136 + }
  137 +
97 138 /**
98 139 * Main key event handler
99 140 */
... ... @@ -105,6 +146,73 @@ public:
105 146 {
106 147 mApplication.Quit();
107 148 }
  149 + else if( event.IsCtrlModifier() )
  150 + {
  151 + switch( event.keyCode )
  152 + {
  153 + // Select rendering back-end
  154 + case KEY_ZERO: // fall through
  155 + case KEY_ONE:
  156 + {
  157 + mField.SetProperty( TextField::Property::RENDERING_BACKEND, event.keyCode - 10 );
  158 + break;
  159 + }
  160 + case KEY_H: // Horizontal alignment
  161 + {
  162 + if( ++mAlignment >= H_ALIGNMENT_STRING_COUNT )
  163 + {
  164 + mAlignment = 0u;
  165 + }
  166 +
  167 + mField.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, H_ALIGNMENT_STRING_TABLE[ mAlignment ] );
  168 + break;
  169 + }
  170 + case KEY_V: // Vertical alignment
  171 + {
  172 + if( ++mAlignment >= V_ALIGNMENT_STRING_COUNT )
  173 + {
  174 + mAlignment = 0u;
  175 + }
  176 +
  177 + mField.SetProperty( TextField::Property::VERTICAL_ALIGNMENT, V_ALIGNMENT_STRING_TABLE[ mAlignment ] );
  178 + break;
  179 + }
  180 + case KEY_L: // Language
  181 + {
  182 + const Language& language = LANGUAGES[ mLanguageId ];
  183 +
  184 + mField.SetProperty( TextField::Property::TEXT, language.text );
  185 +
  186 + if( ++mLanguageId >= NUMBER_OF_LANGUAGES )
  187 + {
  188 + mLanguageId = 0u;
  189 + }
  190 + break;
  191 + }
  192 + case KEY_S: // Shadow color
  193 + {
  194 + if( Color::BLACK == mField.GetProperty<Vector4>( TextField::Property::SHADOW_COLOR ) )
  195 + {
  196 + mField.SetProperty( TextField::Property::SHADOW_COLOR, Color::RED );
  197 + }
  198 + else
  199 + {
  200 + mField.SetProperty( TextField::Property::SHADOW_COLOR, Color::BLACK );
  201 + }
  202 + break;
  203 + }
  204 + case KEY_PLUS: // Increase shadow offset
  205 + {
  206 + mField.SetProperty( TextField::Property::SHADOW_OFFSET, mField.GetProperty<Vector2>( TextField::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) );
  207 + break;
  208 + }
  209 + case KEY_MINUS: // Decrease shadow offset
  210 + {
  211 + mField.SetProperty( TextField::Property::SHADOW_OFFSET, mField.GetProperty<Vector2>( TextField::Property::SHADOW_OFFSET ) - Vector2( 1.0f, 1.0f ) );
  212 + break;
  213 + }
  214 + }
  215 + }
108 216 }
109 217 }
110 218  
... ... @@ -112,7 +220,12 @@ private:
112 220  
113 221 Application& mApplication;
114 222  
115   - Control mContainer;
  223 + TextField mField;
  224 +
  225 + TapGestureDetector mTapGestureDetector;
  226 +
  227 + unsigned int mLanguageId;
  228 + unsigned int mAlignment;
116 229 };
117 230  
118 231 void RunTest( Application& application )
... ...
examples/text-label-emojis/text-label-emojis.cpp
... ... @@ -56,6 +56,7 @@ public:
56 56 void Create( Application& application )
57 57 {
58 58 Stage stage = Stage::GetCurrent();
  59 + stage.SetBackgroundColor( Color::WHITE );
59 60 stage.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent);
60 61  
61 62 mTableView = Toolkit::TableView::New( NUMBER_OF_EMOJIS, 1 );
... ... @@ -99,7 +100,7 @@ public:
99 100 {
100 101 if( mAnimation )
101 102 {
102   - mAnimation.AnimateBy( Property(mTableView, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear );
  103 + mAnimation.AnimateBy( Property(mTableView, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunction::LINEAR );
103 104 mAnimation.Play();
104 105 mLastPoint = localPoint;
105 106 }
... ...
examples/text-label-multi-language/text-label-multi-language-example.cpp
... ... @@ -62,6 +62,7 @@ public:
62 62 Stage stage = Stage::GetCurrent();
63 63  
64 64 stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent);
  65 + stage.SetBackgroundColor( Color::WHITE );
65 66  
66 67 mTableView = Toolkit::TableView::New( NUMBER_OF_LANGUAGES, 1 );
67 68 mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
... ... @@ -104,7 +105,7 @@ public:
104 105 {
105 106 if( mAnimation )
106 107 {
107   - mAnimation.AnimateBy( Property(mTableView, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear );
  108 + mAnimation.AnimateBy( Property(mTableView, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunction::LINEAR );
108 109 mAnimation.Play();
109 110 mLastPoint = localPoint;
110 111 }
... ...
examples/text-label/text-label-example.cpp
... ... @@ -131,9 +131,10 @@ public:
131 131 mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
132 132 mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
133 133 mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true );
  134 + mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
134 135 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
135 136 mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
136   - mLabel.SetBackgroundColor( Vector4(0.3f,0.3f,0.6f,1.0f) );
  137 + mLabel.SetBackgroundColor( Color::WHITE );
137 138 mContainer.Add( mLabel );
138 139  
139 140 Property::Value labelText = mLabel.GetProperty( TextLabel::Property::TEXT );
... ...
packaging/com.samsung.dali-demo.spec
... ... @@ -2,7 +2,7 @@
2 2  
3 3 Name: com.samsung.dali-demo
4 4 Summary: The OpenGLES Canvas Core Demo
5   -Version: 1.0.39
  5 +Version: 1.0.40
6 6 Release: 1
7 7 Group: System/Libraries
8 8 License: Apache-2.0
... ...
resources/style/demo-theme.json
... ... @@ -54,6 +54,16 @@ distributing this software or its derivatives.
54 54 "scrollview":
55 55 {
56 56 "overshoot-effect-color":"B018"
  57 + },
  58 +
  59 + "grouplabel":
  60 + {
  61 + "point-size":9
  62 + },
  63 +
  64 + "buttonlabel":
  65 + {
  66 + "point-size":11
57 67 }
58 68 }
59 69 }
... ...
resources/style/mobile/demo-theme.json
... ... @@ -94,6 +94,16 @@ distributing this software or its derivatives.
94 94 "scrollview":
95 95 {
96 96 "overshoot-effect-color":"B018"
  97 + },
  98 +
  99 + "grouplabel":
  100 + {
  101 + "point-size":6
  102 + },
  103 +
  104 + "buttonlabel":
  105 + {
  106 + "point-size":8
97 107 }
98 108 }
99 109 }
... ...
shared/dali-demo-strings.h
... ... @@ -47,6 +47,7 @@ extern &quot;C&quot;
47 47 #define DALI_DEMO_STR_TITLE_SCROLL_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCROLL_VIEW")
48 48 #define DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS")
49 49 #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI")
  50 +#define DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING")
50 51 #define DALI_DEMO_STR_TITLE_IMAGE_SCALING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_SCALING")
51 52 #define DALI_DEMO_STR_TITLE_TEXT_LABEL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL")
52 53 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE")
... ... @@ -74,7 +75,8 @@ extern &quot;C&quot;
74 75 #define DALI_DEMO_STR_TITLE_SCROLL_VIEW "Scroll View"
75 76 #define DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS "Lights and shadows"
76 77 #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI"
77   -#define DALI_DEMO_STR_TITLE_IMAGE_SCALING "Image Scaling Modes"
  78 +#define DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING "Image Fitting and Sampling"
  79 +#define DALI_DEMO_STR_TITLE_IMAGE_SCALING "Image Scaling Grid"
78 80 #define DALI_DEMO_STR_TITLE_TEXT_LABEL "Text Label"
79 81 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE "Text Scripts"
80 82 #define DALI_DEMO_STR_TITLE_EMOJI_TEXT "Emoji Text"
... ...
shared/view.h
... ... @@ -46,7 +46,6 @@ const ViewStyle DEFAULT_VIEW_STYLE( 0.1f, 0.7f, 80.f, 4.f );
46 46 const char* DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNue");
47 47 const char* DEFAULT_TEXT_STYLE_FONT_STYLE("Regular");
48 48 const float DEFAULT_TEXT_STYLE_POINT_SIZE( 8.0f );
49   -const Dali::Vector4 DEFAULT_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
50 49  
51 50 const Dali::Toolkit::Alignment::Padding DEFAULT_PLAY_PADDING(12.0f, 12.0f, 12.0f, 12.0f);
52 51 const Dali::Toolkit::Alignment::Padding DEFAULT_MODE_SWITCH_PADDING(8.0f, 8.0f, 8.0f, 8.0f);
... ... @@ -109,7 +108,6 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar,
109 108 label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
110 109 label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
111 110 label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT );
112   - label.SetColor( DEFAULT_TEXT_STYLE_COLOR );
113 111  
114 112 // Add title to the tool bar.
115 113 const float padding( style.mToolBarPadding );
... ... @@ -120,7 +118,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar,
120 118 }
121 119  
122 120 Dali::Layer CreateView( Dali::Application& application,
123   - Dali::Toolkit::View& view,
  121 + Dali::Toolkit::Control& view,
124 122 Dali::Toolkit::ToolBar& toolBar,
125 123 const std::string& backgroundImagePath,
126 124 const std::string& toolbarImagePath,
... ... @@ -130,7 +128,9 @@ Dali::Layer CreateView( Dali::Application&amp; application,
130 128 Dali::Stage stage = Dali::Stage::GetCurrent();
131 129  
132 130 // Create default View.
133   - view = Dali::Toolkit::View::New();
  131 + view = Dali::Toolkit::Control::New();
  132 + view.SetAnchorPoint( Dali::AnchorPoint::CENTER );
  133 + view.SetParentOrigin( Dali::ParentOrigin::CENTER );
134 134 view.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
135 135  
136 136 // Add the view to the stage before setting the background.
... ... @@ -140,8 +140,7 @@ Dali::Layer CreateView( Dali::Application&amp; application,
140 140 if ( !backgroundImagePath.empty() )
141 141 {
142 142 Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath, Dali::ImageDimensions( stage.GetSize().x, stage.GetSize().y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR );
143   - Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage );
144   - view.SetBackground( backgroundImageActor );
  143 + view.SetBackgroundImage( backgroundImage );
145 144 }
146 145  
147 146 // FIXME
... ... @@ -152,14 +151,14 @@ Dali::Layer CreateView( Dali::Application&amp; application,
152 151 Dali::Layer toolBarLayer = CreateToolbar( toolBar, toolbarImagePath, title, style );
153 152  
154 153 // Add tool bar layer to the view.
155   - view.AddContentLayer( toolBarLayer );
  154 + view.Add( toolBarLayer );
156 155  
157 156 // Create a content layer.
158 157 Dali::Layer contentLayer = Dali::Layer::New();
159 158 contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER );
160 159 contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER );
161 160 contentLayer.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
162   - view.AddContentLayer( contentLayer );
  161 + view.Add( contentLayer );
163 162 contentLayer.LowerBelow( toolBarLayer );
164 163  
165 164 return contentLayer;
... ... @@ -173,7 +172,6 @@ Dali::Toolkit::TextLabel CreateToolBarLabel( const std::string&amp; text )
173 172 label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
174 173 label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
175 174 label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT );
176   - label.SetColor( DEFAULT_TEXT_STYLE_COLOR );
177 175  
178 176 return label;
179 177 }
... ...