Commit 661d97a34184795b6a99266a4a8b744f5fc11aa8
Merge remote-tracking branch 'origin/tizen' into devel/new_mesh
Conflicts: examples/animated-shapes/animated-shapes-example.cpp examples/new-window/new-window-example.cpp examples/path-animation/path-animation.cpp examples/radial-menu/radial-menu-example.cpp examples/radial-menu/radial-sweep-view-impl.h examples/radial-menu/radial-sweep-view.cpp examples/refraction-effect/refraction-effect-example.cpp Change-Id: I9da2bc5f3145cd179535081fca2d2504f4fd6cd6
Showing
22 changed files
with
491 additions
and
749 deletions
demo/dali-table-view.cpp
| @@ -22,6 +22,7 @@ | @@ -22,6 +22,7 @@ | ||
| 22 | #include <algorithm> | 22 | #include <algorithm> |
| 23 | #include <sstream> | 23 | #include <sstream> |
| 24 | #include <unistd.h> | 24 | #include <unistd.h> |
| 25 | +#include <dali/devel-api/images/distance-field.h> | ||
| 25 | 26 | ||
| 26 | // INTERNAL INCLUDES | 27 | // INTERNAL INCLUDES |
| 27 | #include "shared/view.h" | 28 | #include "shared/view.h" |
| @@ -65,6 +66,8 @@ const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap | @@ -65,6 +66,8 @@ const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap | ||
| 65 | const float EFFECT_FLICK_DURATION = 0.5f; ///< Scroll Flick Duration for Effects | 66 | const float EFFECT_FLICK_DURATION = 0.5f; ///< Scroll Flick Duration for Effects |
| 66 | const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f); | 67 | const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f); |
| 67 | 68 | ||
| 69 | + | ||
| 70 | + | ||
| 68 | const int NUM_BACKGROUND_IMAGES = 18; | 71 | const int NUM_BACKGROUND_IMAGES = 18; |
| 69 | const float BACKGROUND_SWIPE_SCALE = 0.025f; | 72 | const float BACKGROUND_SWIPE_SCALE = 0.025f; |
| 70 | const float BACKGROUND_SPREAD_SCALE = 1.5f; | 73 | const float BACKGROUND_SPREAD_SCALE = 1.5f; |
| @@ -80,21 +83,6 @@ const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ); | @@ -80,21 +83,6 @@ const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ); | ||
| 80 | const float BUBBLE_MIN_Z = -1.0; | 83 | const float BUBBLE_MIN_Z = -1.0; |
| 81 | const float BUBBLE_MAX_Z = 0.0f; | 84 | const float BUBBLE_MAX_Z = 0.0f; |
| 82 | 85 | ||
| 83 | -// 3D Effect constants | ||
| 84 | -const Vector2 ANGLE_SWING_3DEFFECT( Math::PI_2 * 0.75, Math::PI_2 * 0.75f ); ///< Angle Swing in radians | ||
| 85 | -const Vector2 POSITION_SWING_3DEFFECT( 0.55f, 0.4f ); ///< Position Swing relative to stage size. | ||
| 86 | -const Vector3 ANCHOR_3DEFFECT_STYLE0( -105.0f, 30.0f, -240.0f ); ///< Rotation Anchor position for 3D Effect (Style 0) | ||
| 87 | -const Vector3 ANCHOR_3DEFFECT_STYLE1( 65.0f, -70.0f, -500.0f ); ///< Rotation Anchor position for 3D Effect (Style 1) | ||
| 88 | - | ||
| 89 | -const Dali::Vector4 TABLE_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f); | ||
| 90 | - | ||
| 91 | -Vector3 ScalePointSize(const Vector3& vec) | ||
| 92 | -{ | ||
| 93 | - return Vector3( DemoHelper::ScalePointSize( vec.x ), DemoHelper::ScalePointSize( vec.y ), DemoHelper::ScalePointSize( vec.z ) ); | ||
| 94 | -} | ||
| 95 | - | ||
| 96 | -#define DP(x) DemoHelper::ScalePointSize(x) | ||
| 97 | - | ||
| 98 | /** | 86 | /** |
| 99 | * Creates the background image | 87 | * Creates the background image |
| 100 | */ | 88 | */ |
| @@ -142,7 +130,7 @@ public: | @@ -142,7 +130,7 @@ public: | ||
| 142 | 130 | ||
| 143 | // Bubbles X position moves parallax to horizontal | 131 | // Bubbles X position moves parallax to horizontal |
| 144 | // panning by a scale factor unique to each bubble. | 132 | // panning by a scale factor unique to each bubble. |
| 145 | - position.x = mInitialX + ( inputs[0]->GetVector3().x * mScale ); | 133 | + position.x = mInitialX + ( inputs[0]->GetVector2().x * mScale ); |
| 146 | } | 134 | } |
| 147 | 135 | ||
| 148 | private: | 136 | private: |
| @@ -320,7 +308,7 @@ void DaliTableView::Initialize( Application& application ) | @@ -320,7 +308,7 @@ void DaliTableView::Initialize( Application& application ) | ||
| 320 | Populate(); | 308 | Populate(); |
| 321 | 309 | ||
| 322 | // Remove constraints for inner cube effect | 310 | // Remove constraints for inner cube effect |
| 323 | - ApplyCubeEffectToActors(); | 311 | + ApplyCubeEffectToPages(); |
| 324 | 312 | ||
| 325 | Dali::Window winHandle = application.GetWindow(); | 313 | Dali::Window winHandle = application.GetWindow(); |
| 326 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT ); | 314 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT ); |
| @@ -348,21 +336,14 @@ void DaliTableView::Initialize( Application& application ) | @@ -348,21 +336,14 @@ void DaliTableView::Initialize( Application& application ) | ||
| 348 | KeyboardFocusManager::Get().FocusedActorActivatedSignal().Connect( this, &DaliTableView::OnFocusedActorActivated ); | 336 | KeyboardFocusManager::Get().FocusedActorActivatedSignal().Connect( this, &DaliTableView::OnFocusedActorActivated ); |
| 349 | } | 337 | } |
| 350 | 338 | ||
| 351 | -void DaliTableView::ApplyCubeEffectToActors() | 339 | +void DaliTableView::ApplyCubeEffectToPages() |
| 352 | { | 340 | { |
| 353 | - for( ActorIter pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter ) | 341 | + ScrollViewPagePathEffect effect = ScrollViewPagePathEffect::DownCast( mScrollViewEffect ); |
| 342 | + unsigned int pageCount(0); | ||
| 343 | + for( std::vector< Actor >::iterator pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter ) | ||
| 354 | { | 344 | { |
| 355 | Actor page = *pageIter; | 345 | Actor page = *pageIter; |
| 356 | - | ||
| 357 | - for( unsigned int i = 0, numChildren = page.GetChildCount(); i < numChildren; ++i) | ||
| 358 | - { | ||
| 359 | - // Remove old effect's manual constraints. | ||
| 360 | - Actor child = page.GetChildAt(i); | ||
| 361 | - if( child ) | ||
| 362 | - { | ||
| 363 | - ApplyCubeEffectToActor( child ); | ||
| 364 | - } | ||
| 365 | - } | 346 | + effect.ApplyToPage( page, pageCount++ ); |
| 366 | } | 347 | } |
| 367 | } | 348 | } |
| 368 | 349 | ||
| @@ -448,9 +429,9 @@ void DaliTableView::Populate() | @@ -448,9 +429,9 @@ void DaliTableView::Populate() | ||
| 448 | } | 429 | } |
| 449 | 430 | ||
| 450 | // Update Ruler info. | 431 | // Update Ruler info. |
| 451 | - mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x ); | 432 | + mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f ); |
| 452 | mScrollRulerY = new DefaultRuler(); | 433 | mScrollRulerY = new DefaultRuler(); |
| 453 | - mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * TABLE_RELATIVE_SIZE.x, true ) ); | 434 | + mScrollRulerX->SetDomain( RulerDomain( 0.0f, (mTotalPages+1) * stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f, true ) ); |
| 454 | mScrollRulerY->Disable(); | 435 | mScrollRulerY->Disable(); |
| 455 | mScrollView.SetRulerX( mScrollRulerX ); | 436 | mScrollView.SetRulerX( mScrollRulerX ); |
| 456 | mScrollView.SetRulerY( mScrollRulerY ); | 437 | mScrollView.SetRulerY( mScrollRulerY ); |
| @@ -523,7 +504,6 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | @@ -523,7 +504,6 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | ||
| 523 | label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | 504 | label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); |
| 524 | label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | 505 | label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); |
| 525 | label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); | 506 | label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); |
| 526 | - label.SetColor( TABLE_TEXT_STYLE_COLOR ); | ||
| 527 | content.Add( label ); | 507 | content.Add( label ); |
| 528 | 508 | ||
| 529 | // Set the tile to be keyboard focusable | 509 | // Set the tile to be keyboard focusable |
| @@ -640,14 +620,14 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source ) | @@ -640,14 +620,14 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source ) | ||
| 640 | } | 620 | } |
| 641 | } | 621 | } |
| 642 | 622 | ||
| 643 | -void DaliTableView::OnScrollStart( const Dali::Vector3& position ) | 623 | +void DaliTableView::OnScrollStart( const Dali::Vector2& position ) |
| 644 | { | 624 | { |
| 645 | mScrolling = true; | 625 | mScrolling = true; |
| 646 | 626 | ||
| 647 | PlayAnimation(); | 627 | PlayAnimation(); |
| 648 | } | 628 | } |
| 649 | 629 | ||
| 650 | -void DaliTableView::OnScrollComplete( const Dali::Vector3& position ) | 630 | +void DaliTableView::OnScrollComplete( const Dali::Vector2& position ) |
| 651 | { | 631 | { |
| 652 | mScrolling = false; | 632 | mScrolling = false; |
| 653 | 633 | ||
| @@ -684,21 +664,29 @@ void DaliTableView::ApplyScrollViewEffect() | @@ -684,21 +664,29 @@ void DaliTableView::ApplyScrollViewEffect() | ||
| 684 | 664 | ||
| 685 | void DaliTableView::SetupInnerPageCubeEffect() | 665 | void DaliTableView::SetupInnerPageCubeEffect() |
| 686 | { | 666 | { |
| 687 | - mScrollViewEffect = ScrollViewCubeEffect::New(); | ||
| 688 | - mScrollView.SetScrollSnapDuration( EFFECT_SNAP_DURATION ); | ||
| 689 | - mScrollView.SetScrollFlickDuration( EFFECT_FLICK_DURATION ); | ||
| 690 | - mScrollView.RemoveConstraintsFromChildren(); | ||
| 691 | -} | ||
| 692 | - | ||
| 693 | -void DaliTableView::ApplyCubeEffectToActor( Actor actor ) | ||
| 694 | -{ | ||
| 695 | - actor.RemoveConstraints(); | 667 | + const Vector2 stageSize = Stage::GetCurrent().GetSize(); |
| 696 | 668 | ||
| 697 | - ScrollViewCubeEffect cubeEffect = ScrollViewCubeEffect::DownCast(mScrollViewEffect); | ||
| 698 | - cubeEffect.ApplyToActor( actor, | ||
| 699 | - ScalePointSize( ( rand() & 1 ) ? ANCHOR_3DEFFECT_STYLE0 : ANCHOR_3DEFFECT_STYLE1 ), | ||
| 700 | - ANGLE_SWING_3DEFFECT, | ||
| 701 | - POSITION_SWING_3DEFFECT * Vector2(Stage::GetCurrent().GetSize())); | 669 | + Dali::Path path = Dali::Path::New(); |
| 670 | + Dali::Property::Array points; | ||
| 671 | + points.Resize(3); | ||
| 672 | + points[0] = Vector3( stageSize.x*0.5, 0.0f, stageSize.x*0.5f); | ||
| 673 | + points[1] = Vector3( 0.0f, 0.0f, 0.0f ); | ||
| 674 | + points[2] = Vector3( -stageSize.x*0.5f, 0.0f, stageSize.x*0.5f); | ||
| 675 | + path.SetProperty( Path::Property::POINTS, points ); | ||
| 676 | + | ||
| 677 | + Dali::Property::Array controlPoints; | ||
| 678 | + controlPoints.Resize(4); | ||
| 679 | + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, stageSize.x*0.3f ); | ||
| 680 | + controlPoints[1] = Vector3( stageSize.x*0.3f, 0.0f, 0.0f ); | ||
| 681 | + controlPoints[2] = Vector3(-stageSize.x*0.3f, 0.0f, 0.0f ); | ||
| 682 | + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, stageSize.x*0.3f ); | ||
| 683 | + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints ); | ||
| 684 | + | ||
| 685 | + | ||
| 686 | + mScrollViewEffect = ScrollViewPagePathEffect::New(path, | ||
| 687 | + Vector3(-1.0f,0.0f,0.0f), | ||
| 688 | + Toolkit::ScrollView::Property::SCROLL_FINAL_X, | ||
| 689 | + Vector3(stageSize.x*TABLE_RELATIVE_SIZE.x,stageSize.y*TABLE_RELATIVE_SIZE.y,0.0f),mTotalPages); | ||
| 702 | } | 690 | } |
| 703 | 691 | ||
| 704 | void DaliTableView::OnKeyEvent( const KeyEvent& event ) | 692 | void DaliTableView::OnKeyEvent( const KeyEvent& event ) |
demo/dali-table-view.h
| @@ -217,14 +217,14 @@ private: // Application callbacks & implementation | @@ -217,14 +217,14 @@ private: // Application callbacks & implementation | ||
| 217 | * | 217 | * |
| 218 | * @param[in] position The current position of the scroll contents. | 218 | * @param[in] position The current position of the scroll contents. |
| 219 | */ | 219 | */ |
| 220 | - void OnScrollStart(const Dali::Vector3& position); | 220 | + void OnScrollStart(const Dali::Vector2& position); |
| 221 | 221 | ||
| 222 | /** | 222 | /** |
| 223 | * Signal emitted when scrolling has completed. | 223 | * Signal emitted when scrolling has completed. |
| 224 | * | 224 | * |
| 225 | * @param[in] position The current position of the scroll contents. | 225 | * @param[in] position The current position of the scroll contents. |
| 226 | */ | 226 | */ |
| 227 | - void OnScrollComplete(const Dali::Vector3& position); | 227 | + void OnScrollComplete(const Dali::Vector2& position); |
| 228 | 228 | ||
| 229 | /** | 229 | /** |
| 230 | * Signal emitted when any Sensitive Actor has been touched | 230 | * Signal emitted when any Sensitive Actor has been touched |
| @@ -245,7 +245,7 @@ private: // Application callbacks & implementation | @@ -245,7 +245,7 @@ private: // Application callbacks & implementation | ||
| 245 | /** | 245 | /** |
| 246 | * Apply the cube effect to all the page actors | 246 | * Apply the cube effect to all the page actors |
| 247 | */ | 247 | */ |
| 248 | - void ApplyCubeEffectToActors(); | 248 | + void ApplyCubeEffectToPages(); |
| 249 | 249 | ||
| 250 | /** | 250 | /** |
| 251 | * Setup the inner cube effect | 251 | * Setup the inner cube effect |
| @@ -253,11 +253,6 @@ private: // Application callbacks & implementation | @@ -253,11 +253,6 @@ private: // Application callbacks & implementation | ||
| 253 | void SetupInnerPageCubeEffect(); | 253 | void SetupInnerPageCubeEffect(); |
| 254 | 254 | ||
| 255 | /** | 255 | /** |
| 256 | - * Apply the cube effect to an actor | ||
| 257 | - */ | ||
| 258 | - void ApplyCubeEffectToActor( Dali::Actor actor ); | ||
| 259 | - | ||
| 260 | - /** | ||
| 261 | * Apply a shader effect to a table tile | 256 | * Apply a shader effect to a table tile |
| 262 | */ | 257 | */ |
| 263 | void ApplyEffectToTile(Dali::Actor tile); | 258 | void ApplyEffectToTile(Dali::Actor tile); |
| @@ -410,9 +405,9 @@ private: | @@ -410,9 +405,9 @@ private: | ||
| 410 | Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information | 405 | Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information |
| 411 | Dali::Vector3 mButtonsPageRelativeSize; ///< Size of a buttons page relative to the stage size | 406 | Dali::Vector3 mButtonsPageRelativeSize; ///< Size of a buttons page relative to the stage size |
| 412 | 407 | ||
| 413 | - Dali::ActorContainer mPages; ///< List of pages. | ||
| 414 | - Dali::ActorContainer mTableViewImages; ///< Offscreen render of tableview | ||
| 415 | - Dali::ActorContainer mBackgroundActors; ///< List of background actors used in the effect | 408 | + std::vector< Dali::Actor > mPages; ///< List of pages. |
| 409 | + std::vector< Dali::Actor > mTableViewImages; ///< Offscreen render of tableview | ||
| 410 | + std::vector< Dali::Actor > mBackgroundActors; ///< List of background actors used in the effect | ||
| 416 | AnimationList mBackgroundAnimations; ///< List of background bubble animations | 411 | AnimationList mBackgroundAnimations; ///< List of background bubble animations |
| 417 | ExampleList mExampleList; ///< List of examples. | 412 | ExampleList mExampleList; ///< List of examples. |
| 418 | ExampleMap mExampleMap; ///< Map LUT for examples. | 413 | ExampleMap mExampleMap; ///< Map LUT for examples. |
examples/atlas/atlas-example.cpp
examples/builder/examples.cpp
| @@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
| 20 | // | 20 | // |
| 21 | //------------------------------------------------------------------------------ | 21 | //------------------------------------------------------------------------------ |
| 22 | 22 | ||
| 23 | -#include "dali.h" | 23 | +#include <dali/dali.h> |
| 24 | #include <dali-toolkit/dali-toolkit.h> | 24 | #include <dali-toolkit/dali-toolkit.h> |
| 25 | #include <dali-toolkit/public-api/builder/builder.h> | 25 | #include <dali-toolkit/public-api/builder/builder.h> |
| 26 | #include <dali-toolkit/public-api/builder/tree-node.h> | 26 | #include <dali-toolkit/public-api/builder/tree-node.h> |
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | 36 | ||
| 37 | #include "sys/stat.h" | 37 | #include "sys/stat.h" |
| 38 | #include <ctime> | 38 | #include <ctime> |
| 39 | +#include <cstring> | ||
| 39 | 40 | ||
| 40 | #include <dali/integration-api/debug.h> | 41 | #include <dali/integration-api/debug.h> |
| 41 | #include "shared/view.h" | 42 | #include "shared/view.h" |
| @@ -141,11 +142,6 @@ const std::string ShortName( const std::string& name ) | @@ -141,11 +142,6 @@ const std::string ShortName( const std::string& name ) | ||
| 141 | } | 142 | } |
| 142 | } | 143 | } |
| 143 | 144 | ||
| 144 | -static Vector3 SetItemSize(unsigned int numberOfColumns, float layoutWidth, float sideMargin, float columnSpacing) | ||
| 145 | -{ | ||
| 146 | - return Vector3(layoutWidth, 50, 1); | ||
| 147 | -} | ||
| 148 | - | ||
| 149 | //------------------------------------------------------------------------------ | 145 | //------------------------------------------------------------------------------ |
| 150 | // | 146 | // |
| 151 | // | 147 | // |
| @@ -275,6 +271,7 @@ public: | @@ -275,6 +271,7 @@ public: | ||
| 275 | void EnterSelection() | 271 | void EnterSelection() |
| 276 | { | 272 | { |
| 277 | Stage stage = Stage::GetCurrent(); | 273 | Stage stage = Stage::GetCurrent(); |
| 274 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 278 | 275 | ||
| 279 | mTapDetector = TapGestureDetector::New(); | 276 | mTapDetector = TapGestureDetector::New(); |
| 280 | mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap ); | 277 | mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap ); |
| @@ -290,17 +287,12 @@ public: | @@ -290,17 +287,12 @@ public: | ||
| 290 | stage.Add( mItemView ); | 287 | stage.Add( mItemView ); |
| 291 | mItemView.SetParentOrigin(ParentOrigin::CENTER); | 288 | mItemView.SetParentOrigin(ParentOrigin::CENTER); |
| 292 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); | 289 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); |
| 293 | - mGridLayout = GridLayout::New(); | ||
| 294 | - mGridLayout->SetNumberOfColumns(1); | 290 | + mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST ); |
| 295 | 291 | ||
| 296 | - mGridLayout->SetItemSizeFunction(SetItemSize); | 292 | + mLayout->SetItemSize( Vector3( stage.GetSize().width, 50, 1 ) ); |
| 297 | 293 | ||
| 298 | - mGridLayout->SetTopMargin(DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight); | 294 | + mItemView.AddLayout( *mLayout ); |
| 299 | 295 | ||
| 300 | - mItemView.AddLayout(*mGridLayout); | ||
| 301 | - | ||
| 302 | - Vector3 size(stage.GetSize()); | ||
| 303 | - mItemView.ActivateLayout(0, size, 0.0f/*immediate*/); | ||
| 304 | mItemView.SetKeyboardFocusable( true ); | 296 | mItemView.SetKeyboardFocusable( true ); |
| 305 | 297 | ||
| 306 | mFiles.clear(); | 298 | mFiles.clear(); |
| @@ -368,9 +360,9 @@ public: | @@ -368,9 +360,9 @@ public: | ||
| 368 | 360 | ||
| 369 | SetTitle("Select"); | 361 | SetTitle("Select"); |
| 370 | 362 | ||
| 371 | - // Itemview renderes the previous items unless its scrolled. Not sure why at the moment so we force a scroll | ||
| 372 | - mItemView.ScrollToItem(0, 0); | ||
| 373 | - | 363 | + // Activate the layout |
| 364 | + Vector3 size(stage.GetSize()); | ||
| 365 | + mItemView.ActivateLayout(0, size, 0.0f/*immediate*/); | ||
| 374 | } | 366 | } |
| 375 | 367 | ||
| 376 | void ExitSelection() | 368 | void ExitSelection() |
| @@ -584,7 +576,7 @@ public: | @@ -584,7 +576,7 @@ public: | ||
| 584 | private: | 576 | private: |
| 585 | Application& mApp; | 577 | Application& mApp; |
| 586 | 578 | ||
| 587 | - GridLayoutPtr mGridLayout; | 579 | + ItemLayoutPtr mLayout; |
| 588 | ItemView mItemView; | 580 | ItemView mItemView; |
| 589 | 581 | ||
| 590 | Toolkit::Control mView; | 582 | Toolkit::Control mView; |
examples/cluster/cluster-example.cpp
| @@ -38,7 +38,7 @@ const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" ); | @@ -38,7 +38,7 @@ const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" ); | ||
| 38 | const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); | 38 | const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); |
| 39 | const char * const APPLICATION_TITLE( "Clusters" ); | 39 | const char * const APPLICATION_TITLE( "Clusters" ); |
| 40 | const char * const LAYOUT_NONE_IMAGE( DALI_IMAGE_DIR "icon-cluster-none.png" ); | 40 | const char * const LAYOUT_NONE_IMAGE( DALI_IMAGE_DIR "icon-cluster-none.png" ); |
| 41 | -const char * const LAYOUT_WOBBLE_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" ); | 41 | +const char * const LAYOUT_MOTION_BLUR_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" ); |
| 42 | const char * const LAYOUT_CAROUSEL_IMAGE( DALI_IMAGE_DIR "icon-cluster-carousel.png" ); | 42 | const char * const LAYOUT_CAROUSEL_IMAGE( DALI_IMAGE_DIR "icon-cluster-carousel.png" ); |
| 43 | const char * const LAYOUT_SPHERE_IMAGE( DALI_IMAGE_DIR "icon-cluster-sphere.png" ); | 43 | const char * const LAYOUT_SPHERE_IMAGE( DALI_IMAGE_DIR "icon-cluster-sphere.png" ); |
| 44 | 44 | ||
| @@ -134,9 +134,6 @@ const float CLUSTER_GROUP_DELAY_BOTTOM = 0.0f; ///< Delay for botto | @@ -134,9 +134,6 @@ const float CLUSTER_GROUP_DELAY_BOTTOM = 0.0f; ///< Delay for botto | ||
| 134 | const float CLUSTER_COLUMN_INDENT = 0.1f; ///< Left Indentation in screen coordinates. | 134 | const float CLUSTER_COLUMN_INDENT = 0.1f; ///< Left Indentation in screen coordinates. |
| 135 | const float CLUSTER_ROW_INDENT = 0.13f; ///< Top Indentation in screen coordinates. | 135 | const float CLUSTER_ROW_INDENT = 0.13f; ///< Top Indentation in screen coordinates. |
| 136 | 136 | ||
| 137 | -const Vector3 SHEAR_EFFECT_ANCHOR_POINT(0.5f, 1.0f, 0.5f); ///< Anchor Point used for the shear effect (extends outside of Cluster) | ||
| 138 | -const float SHEAR_EFFECT_MAX_OVERSHOOT = 30.0f; ///< Max Overshoot for shear effect (in degrees). | ||
| 139 | - | ||
| 140 | const float UI_MARGIN = 10.0f; ///< Screen Margin for placement of UI buttons | 137 | const float UI_MARGIN = 10.0f; ///< Screen Margin for placement of UI buttons |
| 141 | 138 | ||
| 142 | const float CAROUSEL_EFFECT_RADIUS = 500.0f; ///< In Carousel Effect mode: Radius of carousel (Z peak depth) | 139 | const float CAROUSEL_EFFECT_RADIUS = 500.0f; ///< In Carousel Effect mode: Radius of carousel (Z peak depth) |
| @@ -152,7 +149,7 @@ const float SPHERE_EFFECT_VERTICAL_DOMAIN = 0.15f; ///< In Sphere Effec | @@ -152,7 +149,7 @@ const float SPHERE_EFFECT_VERTICAL_DOMAIN = 0.15f; ///< In Sphere Effec | ||
| 152 | enum ExampleEffectType | 149 | enum ExampleEffectType |
| 153 | { | 150 | { |
| 154 | NO_EFFECT, | 151 | NO_EFFECT, |
| 155 | - WOBBLE_EFFECT, | 152 | + MOTION_BLUR_EFFECT, |
| 156 | CAROUSEL_EFFECT, | 153 | CAROUSEL_EFFECT, |
| 157 | SPHERE_EFFECT, | 154 | SPHERE_EFFECT, |
| 158 | TOTAL_EFFECTS | 155 | TOTAL_EFFECTS |
| @@ -161,10 +158,10 @@ enum ExampleEffectType | @@ -161,10 +158,10 @@ enum ExampleEffectType | ||
| 161 | /** | 158 | /** |
| 162 | * List of effect type names that appear on the Effect button. | 159 | * List of effect type names that appear on the Effect button. |
| 163 | */ | 160 | */ |
| 164 | -const char* EXAMPLE_EFFECT_LABEL[] = { "NONE", | ||
| 165 | - "WOBBLE", | ||
| 166 | - "CAROUSEL", | ||
| 167 | - "SPHERE", | 161 | +const char* EXAMPLE_EFFECT_LABEL[] = { "None", |
| 162 | + "Motion Blur", | ||
| 163 | + "Carousel", | ||
| 164 | + "Sphere", | ||
| 168 | }; | 165 | }; |
| 169 | 166 | ||
| 170 | /** | 167 | /** |
| @@ -205,96 +202,6 @@ struct CarouselEffectOrientationConstraint | @@ -205,96 +202,6 @@ struct CarouselEffectOrientationConstraint | ||
| 205 | }; | 202 | }; |
| 206 | 203 | ||
| 207 | /** | 204 | /** |
| 208 | - * ShearEffectConstraint | ||
| 209 | - * | ||
| 210 | - * Constrains ShearEffect's tilt to be a function of scrollview's | ||
| 211 | - * horizontal overshoot amount. | ||
| 212 | - */ | ||
| 213 | -struct ShearEffectConstraint | ||
| 214 | -{ | ||
| 215 | - /** | ||
| 216 | - * @param[in] stageSize The stage size (not subject to orientation) | ||
| 217 | - * @param[in] maxOvershoot Maximum amount overshoot can affect shear. | ||
| 218 | - * @param[in] componentMask Whether constraint should take the X shear | ||
| 219 | - * or the Y shear component. | ||
| 220 | - */ | ||
| 221 | - ShearEffectConstraint(Vector2 stageSize, float maxOvershoot, Vector2 componentMask) | ||
| 222 | - : mStageSize(stageSize), | ||
| 223 | - mMaxOvershoot(maxOvershoot), | ||
| 224 | - mComponentMask(componentMask) | ||
| 225 | - { | ||
| 226 | - } | ||
| 227 | - | ||
| 228 | - /** | ||
| 229 | - * @param[in,out] current The current shear effect Angle. | ||
| 230 | - * @param[in] inputs Contains the overshoot property from ScrollView and the orientation of the view e.g. Portrait, Landscape. | ||
| 231 | - * @return angle to provide ShearShaderEffect | ||
| 232 | - */ | ||
| 233 | - void operator()( float& current, const PropertyInputContainer& inputs ) | ||
| 234 | - { | ||
| 235 | - float f = inputs[0]->GetVector3().x; | ||
| 236 | - | ||
| 237 | - float mag = fabsf(f); | ||
| 238 | - float halfWidth = mStageSize.x * 0.5f; | ||
| 239 | - | ||
| 240 | - // inverse exponential tail-off | ||
| 241 | - float overshoot = 1.0f - halfWidth / (halfWidth + mag); | ||
| 242 | - if (f > 0.0f) | ||
| 243 | - { | ||
| 244 | - overshoot = -overshoot; | ||
| 245 | - } | ||
| 246 | - | ||
| 247 | - // Channel this shear value into either the X or Y axis depending on | ||
| 248 | - // the component mask passed in. | ||
| 249 | - Vector3 axis; | ||
| 250 | - Radian angle; | ||
| 251 | - inputs[1]->GetQuaternion().ToAxisAngle( axis, angle ); | ||
| 252 | - Vector2 direction( cosf(angle), sinf(angle) ); | ||
| 253 | - float yield = direction.x * mComponentMask.x + direction.y * mComponentMask.y; | ||
| 254 | - | ||
| 255 | - current = overshoot * mMaxOvershoot * yield; | ||
| 256 | - } | ||
| 257 | - | ||
| 258 | - Vector2 mStageSize; | ||
| 259 | - float mMaxOvershoot; | ||
| 260 | - Vector2 mComponentMask; | ||
| 261 | -}; | ||
| 262 | - | ||
| 263 | -/** | ||
| 264 | - * ShearEffectCenterConstraint | ||
| 265 | - * | ||
| 266 | - * Sets ShearEffect's center to be a function of the | ||
| 267 | - * screen orientation (portrait or landscape). | ||
| 268 | - */ | ||
| 269 | -struct ShearEffectCenterConstraint | ||
| 270 | -{ | ||
| 271 | - /** | ||
| 272 | - * @param[in] stageSize The stage size (not subject to orientation) | ||
| 273 | - * @param[in] center Shear Center position based on initial orientation. | ||
| 274 | - */ | ||
| 275 | - ShearEffectCenterConstraint(Vector2 stageSize, Vector2 center) | ||
| 276 | - : mStageSize(stageSize), | ||
| 277 | - mCenter(center) | ||
| 278 | - { | ||
| 279 | - } | ||
| 280 | - | ||
| 281 | - /** | ||
| 282 | - * @param[in,out] current The current center | ||
| 283 | - * @param[in] inputs Contains the current view size | ||
| 284 | - * @return vector to provide ShearShaderEffect | ||
| 285 | - */ | ||
| 286 | - void operator()( Vector2& current, const PropertyInputContainer& inputs ) | ||
| 287 | - { | ||
| 288 | - float f = inputs[0]->GetVector3().width / mStageSize.width; | ||
| 289 | - current.x = f * mCenter.x; | ||
| 290 | - current.y = mCenter.y; | ||
| 291 | - } | ||
| 292 | - | ||
| 293 | - Vector2 mStageSize; | ||
| 294 | - Vector2 mCenter; | ||
| 295 | -}; | ||
| 296 | - | ||
| 297 | -/** | ||
| 298 | * SphereEffectOffsetConstraint | 205 | * SphereEffectOffsetConstraint |
| 299 | * | 206 | * |
| 300 | * Sets SphereEffect's center to be a function of the | 207 | * Sets SphereEffect's center to be a function of the |
| @@ -470,7 +377,7 @@ public: | @@ -470,7 +377,7 @@ public: | ||
| 470 | 377 | ||
| 471 | // Create a effect toggle button. (right of toolbar) | 378 | // Create a effect toggle button. (right of toolbar) |
| 472 | mLayoutButtonImages[ NO_EFFECT ] = ResourceImage::New( LAYOUT_NONE_IMAGE ); | 379 | mLayoutButtonImages[ NO_EFFECT ] = ResourceImage::New( LAYOUT_NONE_IMAGE ); |
| 473 | - mLayoutButtonImages[ WOBBLE_EFFECT ] = ResourceImage::New( LAYOUT_WOBBLE_IMAGE ); | 380 | + mLayoutButtonImages[ MOTION_BLUR_EFFECT ] = ResourceImage::New( LAYOUT_MOTION_BLUR_IMAGE ); |
| 474 | mLayoutButtonImages[ CAROUSEL_EFFECT ] = ResourceImage::New( LAYOUT_CAROUSEL_IMAGE ); | 381 | mLayoutButtonImages[ CAROUSEL_EFFECT ] = ResourceImage::New( LAYOUT_CAROUSEL_IMAGE ); |
| 475 | mLayoutButtonImages[ SPHERE_EFFECT ] = ResourceImage::New( LAYOUT_SPHERE_IMAGE ); | 382 | mLayoutButtonImages[ SPHERE_EFFECT ] = ResourceImage::New( LAYOUT_SPHERE_IMAGE ); |
| 476 | 383 | ||
| @@ -482,10 +389,6 @@ public: | @@ -482,10 +389,6 @@ public: | ||
| 482 | mScrollView = ScrollView::New(); | 389 | mScrollView = ScrollView::New(); |
| 483 | mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 390 | mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 484 | 391 | ||
| 485 | - // attach Wobble Effect to ScrollView | ||
| 486 | - mScrollViewEffect = ScrollViewWobbleEffect::New(); | ||
| 487 | - mScrollView.ApplyEffect(mScrollViewEffect); | ||
| 488 | - | ||
| 489 | // anchor the scroll view from its center point to the middle of its parent | 392 | // anchor the scroll view from its center point to the middle of its parent |
| 490 | mScrollView.SetAnchorPoint(AnchorPoint::CENTER); | 393 | mScrollView.SetAnchorPoint(AnchorPoint::CENTER); |
| 491 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); | 394 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); |
| @@ -506,7 +409,7 @@ public: | @@ -506,7 +409,7 @@ public: | ||
| 506 | AddCluster( MUSIC, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle2) ); | 409 | AddCluster( MUSIC, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle2) ); |
| 507 | AddCluster( MAGAZINE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle3) ); | 410 | AddCluster( MAGAZINE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle3) ); |
| 508 | 411 | ||
| 509 | - SetEffect(WOBBLE_EFFECT); | 412 | + SetEffect(MOTION_BLUR_EFFECT); |
| 510 | } | 413 | } |
| 511 | 414 | ||
| 512 | /** | 415 | /** |
| @@ -627,7 +530,7 @@ public: | @@ -627,7 +530,7 @@ public: | ||
| 627 | pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); | 530 | pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); |
| 628 | pageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 531 | pageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 629 | 532 | ||
| 630 | - // Create cluster actors, add them to scroll view, and set the shear effect with the given center point. | 533 | + // Create cluster actors and add them to scroll view |
| 631 | Vector3 clusterSize; | 534 | Vector3 clusterSize; |
| 632 | Cluster cluster = CreateClusterActor( clusterType, style, clusterSize ); | 535 | Cluster cluster = CreateClusterActor( clusterType, style, clusterSize ); |
| 633 | cluster.SetParentOrigin(ParentOrigin::TOP_LEFT); | 536 | cluster.SetParentOrigin(ParentOrigin::TOP_LEFT); |
| @@ -642,6 +545,40 @@ public: | @@ -642,6 +545,40 @@ public: | ||
| 642 | } | 545 | } |
| 643 | 546 | ||
| 644 | /** | 547 | /** |
| 548 | + * Sets motion blur effect to a cluster and all its children | ||
| 549 | + * | ||
| 550 | + * @param[in] actor Cluster control to which the effect will be applied | ||
| 551 | + */ | ||
| 552 | + void SetMotionBlurEffect( Actor actor ) | ||
| 553 | + { | ||
| 554 | + /* | ||
| 555 | + // only do something if the actor and effect are valid | ||
| 556 | + if( actor ) | ||
| 557 | + { | ||
| 558 | + // first remove from this actor | ||
| 559 | + RenderableActor renderable = RenderableActor::DownCast( actor ); | ||
| 560 | + if( renderable ) | ||
| 561 | + { | ||
| 562 | + MotionBlurEffect shaderEffect = MotionBlurEffect::New(); | ||
| 563 | + shaderEffect.SetSpeedScalingFactor(0.1f); | ||
| 564 | + | ||
| 565 | + Dali::Property::Index uModelProperty = shaderEffect.GetPropertyIndex( "uModelLastFrame" ); | ||
| 566 | + Constraint constraint = Constraint::New<Matrix>( shaderEffect, uModelProperty, EqualToConstraint() ); | ||
| 567 | + constraint.AddSource( Source( actor , Actor::Property::WORLD_MATRIX ) ); | ||
| 568 | + constraint.Apply(); | ||
| 569 | + renderable.SetShaderEffect( shaderEffect ); | ||
| 570 | + } | ||
| 571 | + // then all children recursively | ||
| 572 | + const unsigned int count = actor.GetChildCount(); | ||
| 573 | + for( unsigned int index = 0; index < count; ++index ) | ||
| 574 | + { | ||
| 575 | + Actor child( actor.GetChildAt( index ) ); | ||
| 576 | + SetMotionBlurEffect( child ); | ||
| 577 | + } | ||
| 578 | + }*/ | ||
| 579 | + } | ||
| 580 | + | ||
| 581 | + /** | ||
| 645 | * Resets ScrollView and Clusters settings | 582 | * Resets ScrollView and Clusters settings |
| 646 | * to reflect the new ExampleEffectType | 583 | * to reflect the new ExampleEffectType |
| 647 | * | 584 | * |
| @@ -691,8 +628,8 @@ public: | @@ -691,8 +628,8 @@ public: | ||
| 691 | 628 | ||
| 692 | // Apply new shader-effects. | 629 | // Apply new shader-effects. |
| 693 | // Move Y to origin incase we came from an effect where user could free pan in y axis. | 630 | // Move Y to origin incase we came from an effect where user could free pan in y axis. |
| 694 | - const Vector3 currentScrollPosition(mScrollView.GetCurrentScrollPosition()); | ||
| 695 | - mScrollView.ScrollTo(Vector3(currentScrollPosition.x, 0.0f, 0.0f)); | 631 | + const Vector2 currentScrollPosition(mScrollView.GetCurrentScrollPosition()); |
| 632 | + mScrollView.ScrollTo(Vector2(currentScrollPosition.x, 0.0f)); | ||
| 696 | 633 | ||
| 697 | switch(type) | 634 | switch(type) |
| 698 | { | 635 | { |
| @@ -701,42 +638,11 @@ public: | @@ -701,42 +638,11 @@ public: | ||
| 701 | break; | 638 | break; |
| 702 | } | 639 | } |
| 703 | 640 | ||
| 704 | - case WOBBLE_EFFECT: | 641 | + case MOTION_BLUR_EFFECT: |
| 705 | { | 642 | { |
| 706 | for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) | 643 | for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) |
| 707 | { | 644 | { |
| 708 | - Cluster cluster = i->mCluster; | ||
| 709 | - Vector3 position = i->mPosition; | ||
| 710 | - Vector3 size = i->mSize; | ||
| 711 | - | ||
| 712 | - ShearEffect shaderEffect = ShearEffect::New(); | ||
| 713 | - Vector3 shearAnchor = SHEAR_EFFECT_ANCHOR_POINT; | ||
| 714 | - | ||
| 715 | - Vector2 shearCenter( Vector2(position.x + size.width * shearAnchor.x, position.y + size.height * shearAnchor.y) ); | ||
| 716 | - Property::Index centerProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetCenterPropertyName()); | ||
| 717 | - Constraint constraint = Constraint::New<Vector2>( shaderEffect, centerProperty, ShearEffectCenterConstraint(stageSize, shearCenter) ); | ||
| 718 | - constraint.AddSource( Source(mView, Actor::Property::SIZE) ); | ||
| 719 | - | ||
| 720 | - constraint.Apply(); | ||
| 721 | - | ||
| 722 | - SetShaderEffectRecursively( cluster,shaderEffect ); | ||
| 723 | - | ||
| 724 | - // Apply Constraint to Shader Effect | ||
| 725 | - Property::Index scrollOvershootProperty = /*targetGroup*/mScrollView.GetPropertyIndex(ScrollViewWobbleEffect::EFFECT_OVERSHOOT); | ||
| 726 | - Property::Index angleXAxisProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetAngleXAxisPropertyName()); | ||
| 727 | - Property::Index angleYAxisProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetAngleYAxisPropertyName()); | ||
| 728 | - | ||
| 729 | - constraint = Constraint::New<float>( shaderEffect, angleXAxisProperty, ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) ); | ||
| 730 | - constraint.AddSource( Source(mScrollView, scrollOvershootProperty) ); | ||
| 731 | - constraint.AddSource( Source(mView, Actor::Property::ORIENTATION) ); | ||
| 732 | - constraint.Apply(); | ||
| 733 | - | ||
| 734 | - constraint = Constraint::New<float>( shaderEffect, angleYAxisProperty, ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS ) ); | ||
| 735 | - constraint.AddSource( Source(mScrollView, scrollOvershootProperty) ); | ||
| 736 | - constraint.AddSource( Source(mView, Actor::Property::ORIENTATION) ); | ||
| 737 | - constraint.Apply(); | ||
| 738 | - | ||
| 739 | - | 645 | + SetMotionBlurEffect( i->mCluster ); |
| 740 | } | 646 | } |
| 741 | break; | 647 | break; |
| 742 | } | 648 | } |
| @@ -852,7 +758,6 @@ private: | @@ -852,7 +758,6 @@ private: | ||
| 852 | Layer mContentLayer; ///< Content layer (scrolling cluster content) | 758 | Layer mContentLayer; ///< Content layer (scrolling cluster content) |
| 853 | 759 | ||
| 854 | ScrollView mScrollView; ///< The ScrollView container for all clusters | 760 | ScrollView mScrollView; ///< The ScrollView container for all clusters |
| 855 | - ScrollViewWobbleEffect mScrollViewEffect; ///< ScrollView Wobble effect | ||
| 856 | Image mClusterBorderImage; ///< The border frame that appears on each image | 761 | Image mClusterBorderImage; ///< The border frame that appears on each image |
| 857 | 762 | ||
| 858 | std::vector<ClusterInfo> mClusterInfo; ///< Keeps track of each cluster's information. | 763 | std::vector<ClusterInfo> mClusterInfo; ///< Keeps track of each cluster's information. |
examples/cluster/cluster-impl.cpp
| @@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
| 23 | #include <cstring> // for strcmp | 23 | #include <cstring> // for strcmp |
| 24 | #include <dali/public-api/animation/animation.h> | 24 | #include <dali/public-api/animation/animation.h> |
| 25 | #include <dali/public-api/object/type-registry.h> | 25 | #include <dali/public-api/object/type-registry.h> |
| 26 | -#include <dali/public-api/object/type-registry-helper.h> | 26 | +#include <dali/devel-api/object/type-registry-helper.h> |
| 27 | #include <dali/integration-api/debug.h> | 27 | #include <dali/integration-api/debug.h> |
| 28 | 28 | ||
| 29 | // INTERNAL INCLUDES | 29 | // INTERNAL INCLUDES |
examples/hello-world/hello-world-example.cpp
| @@ -43,6 +43,7 @@ public: | @@ -43,6 +43,7 @@ public: | ||
| 43 | { | 43 | { |
| 44 | // Get a handle to the stage | 44 | // Get a handle to the stage |
| 45 | Stage stage = Stage::GetCurrent(); | 45 | Stage stage = Stage::GetCurrent(); |
| 46 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 46 | 47 | ||
| 47 | TextLabel textLabel = TextLabel::New( "Hello World" ); | 48 | TextLabel textLabel = TextLabel::New( "Hello World" ); |
| 48 | textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 49 | textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
examples/image-scaling-irregular-grid/grid-flags.h
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| @@ -335,13 +335,11 @@ public: | @@ -335,13 +335,11 @@ public: | ||
| 335 | mScrollView.ScrollStartedSignal().Connect( this, &ImageScalingIrregularGridController::OnScrollStarted ); | 335 | mScrollView.ScrollStartedSignal().Connect( this, &ImageScalingIrregularGridController::OnScrollStarted ); |
| 336 | mScrollView.ScrollCompletedSignal().Connect( this, &ImageScalingIrregularGridController::OnScrollCompleted ); | 336 | mScrollView.ScrollCompletedSignal().Connect( this, &ImageScalingIrregularGridController::OnScrollCompleted ); |
| 337 | 337 | ||
| 338 | - mScrollView.EnableScrollComponent( Scrollable::VerticalScrollBar ); | ||
| 339 | - mScrollView.EnableScrollComponent( Scrollable::HorizontalScrollBar ); | ||
| 340 | - | ||
| 341 | mScrollView.SetAnchorPoint(AnchorPoint::CENTER); | 338 | mScrollView.SetAnchorPoint(AnchorPoint::CENTER); |
| 342 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); | 339 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); |
| 343 | 340 | ||
| 344 | - mScrollView.SetSize( stageSize );//Vector2( stageSize.width, fieldHeight ) );//stageSize ); | 341 | + mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 342 | + | ||
| 345 | mScrollView.SetAxisAutoLock( true ); | 343 | mScrollView.SetAxisAutoLock( true ); |
| 346 | mScrollView.SetAxisAutoLockGradient( 1.0f ); | 344 | mScrollView.SetAxisAutoLockGradient( 1.0f ); |
| 347 | 345 | ||
| @@ -351,7 +349,7 @@ public: | @@ -351,7 +349,7 @@ public: | ||
| 351 | rulerX->SetDomain( RulerDomain( stageSize.width * -0.125f, stageSize.width * 1.125f ) ); //< Scroll slightly left/right of image field. | 349 | rulerX->SetDomain( RulerDomain( stageSize.width * -0.125f, stageSize.width * 1.125f ) ); //< Scroll slightly left/right of image field. |
| 352 | mScrollView.SetRulerX ( rulerX ); | 350 | mScrollView.SetRulerX ( rulerX ); |
| 353 | 351 | ||
| 354 | - RulerPtr rulerY = new DefaultRuler(); //stageSize.height ); //< Snap in multiples of a screen / stage height | 352 | + RulerPtr rulerY = new DefaultRuler(); //< Snap in multiples of a screen / stage height |
| 355 | rulerY->SetDomain( RulerDomain( - fieldHeight * 0.5f + stageSize.height * 0.5f - GRID_CELL_PADDING, fieldHeight * 0.5f + stageSize.height * 0.5f + GRID_CELL_PADDING ) ); | 353 | rulerY->SetDomain( RulerDomain( - fieldHeight * 0.5f + stageSize.height * 0.5f - GRID_CELL_PADDING, fieldHeight * 0.5f + stageSize.height * 0.5f + GRID_CELL_PADDING ) ); |
| 356 | mScrollView.SetRulerY ( rulerY ); | 354 | mScrollView.SetRulerY ( rulerY ); |
| 357 | 355 | ||
| @@ -359,8 +357,31 @@ public: | @@ -359,8 +357,31 @@ public: | ||
| 359 | mScrollView.Add( imageField ); | 357 | mScrollView.Add( imageField ); |
| 360 | mGridActor = imageField; | 358 | mGridActor = imageField; |
| 361 | 359 | ||
| 360 | + // Create the scroll bar | ||
| 361 | + mScrollBarVertical = ScrollBar::New(Toolkit::ScrollBar::Vertical); | ||
| 362 | + mScrollBarVertical.SetParentOrigin(ParentOrigin::TOP_RIGHT); | ||
| 363 | + mScrollBarVertical.SetAnchorPoint(AnchorPoint::TOP_RIGHT); | ||
| 364 | + mScrollBarVertical.SetResizePolicy(Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT); | ||
| 365 | + mScrollBarVertical.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::WIDTH); | ||
| 366 | + mScrollView.Add(mScrollBarVertical); | ||
| 367 | + | ||
| 368 | + mScrollBarHorizontal = ScrollBar::New(Toolkit::ScrollBar::Horizontal); | ||
| 369 | + mScrollBarHorizontal.SetParentOrigin(ParentOrigin::BOTTOM_LEFT); | ||
| 370 | + mScrollBarHorizontal.SetAnchorPoint(AnchorPoint::TOP_LEFT); | ||
| 371 | + mScrollBarHorizontal.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::WIDTH); | ||
| 372 | + mScrollBarHorizontal.SetOrientation(Quaternion(Radian( 1.5f * Math::PI ), Vector3::ZAXIS)); | ||
| 373 | + mScrollView.Add(mScrollBarHorizontal); | ||
| 374 | + | ||
| 375 | + mScrollView.OnRelayoutSignal().Connect( this, &ImageScalingIrregularGridController::OnScrollViewRelayout ); | ||
| 376 | + | ||
| 362 | // Scroll to top of grid so first images loaded are on-screen: | 377 | // Scroll to top of grid so first images loaded are on-screen: |
| 363 | - mScrollView.ScrollTo( Vector3( 0, -1000000, 0 ) ); | 378 | + mScrollView.ScrollTo( Vector2( 0, -1000000 ) ); |
| 379 | + } | ||
| 380 | + | ||
| 381 | + void OnScrollViewRelayout(Actor actor) | ||
| 382 | + { | ||
| 383 | + // Make the height of the horizontal scroll bar to be the same as the width of scroll view. | ||
| 384 | + mScrollBarHorizontal.SetSize(Vector2(0.0f, mScrollView.GetRelayoutSize( Dimension::WIDTH) )); | ||
| 364 | } | 385 | } |
| 365 | 386 | ||
| 366 | /** | 387 | /** |
| @@ -549,7 +570,7 @@ public: | @@ -549,7 +570,7 @@ public: | ||
| 549 | * note this state (mScrolling = true) | 570 | * note this state (mScrolling = true) |
| 550 | * @param[in] position Current Scroll Position | 571 | * @param[in] position Current Scroll Position |
| 551 | */ | 572 | */ |
| 552 | - void OnScrollStarted( const Vector3& position ) | 573 | + void OnScrollStarted( const Vector2& position ) |
| 553 | { | 574 | { |
| 554 | mScrolling = true; | 575 | mScrolling = true; |
| 555 | } | 576 | } |
| @@ -559,7 +580,7 @@ public: | @@ -559,7 +580,7 @@ public: | ||
| 559 | * note this state (mScrolling = false). | 580 | * note this state (mScrolling = false). |
| 560 | * @param[in] position Current Scroll Position | 581 | * @param[in] position Current Scroll Position |
| 561 | */ | 582 | */ |
| 562 | - void OnScrollCompleted( const Vector3& position ) | 583 | + void OnScrollCompleted( const Vector2& position ) |
| 563 | { | 584 | { |
| 564 | mScrolling = false; | 585 | mScrolling = false; |
| 565 | } | 586 | } |
| @@ -573,6 +594,8 @@ private: | @@ -573,6 +594,8 @@ private: | ||
| 573 | TextLabel mTitleActor; ///< The Toolbar's Title. | 594 | TextLabel mTitleActor; ///< The Toolbar's Title. |
| 574 | Actor mGridActor; ///< The container for the grid of images | 595 | Actor mGridActor; ///< The container for the grid of images |
| 575 | ScrollView mScrollView; ///< ScrollView UI Component | 596 | ScrollView mScrollView; ///< ScrollView UI Component |
| 597 | + ScrollBar mScrollBarVertical; | ||
| 598 | + ScrollBar mScrollBarHorizontal; | ||
| 576 | bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary) | 599 | bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary) |
| 577 | std::map<unsigned, Dali::FittingMode::Type> mFittingModes; ///< Stores the current scaling mode of each image, keyed by image actor id. | 600 | std::map<unsigned, Dali::FittingMode::Type> mFittingModes; ///< Stores the current scaling mode of each image, keyed by image actor id. |
| 578 | std::map<unsigned, Vector2> mSizes; ///< Stores the current size of each image, keyed by image actor id. | 601 | std::map<unsigned, Vector2> mSizes; ///< Stores the current size of each image, keyed by image actor id. |
examples/item-view/item-view-example.cpp
| @@ -25,6 +25,7 @@ | @@ -25,6 +25,7 @@ | ||
| 25 | 25 | ||
| 26 | #include <dali/dali.h> | 26 | #include <dali/dali.h> |
| 27 | #include <dali-toolkit/dali-toolkit.h> | 27 | #include <dali-toolkit/dali-toolkit.h> |
| 28 | +#include <dali/devel-api/images/atlas.h> | ||
| 28 | 29 | ||
| 29 | using namespace Dali; | 30 | using namespace Dali; |
| 30 | using namespace Dali::Toolkit; | 31 | using namespace Dali::Toolkit; |
| @@ -103,16 +104,6 @@ const unsigned int IMAGE_WIDTH = 256; | @@ -103,16 +104,6 @@ const unsigned int IMAGE_WIDTH = 256; | ||
| 103 | const unsigned int IMAGE_HEIGHT = 256; | 104 | const unsigned int IMAGE_HEIGHT = 256; |
| 104 | const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8; | 105 | const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8; |
| 105 | 106 | ||
| 106 | -AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunction(AlphaFunction::LINEAR), | ||
| 107 | - AlphaFunction(AlphaFunction::EASE_IN), | ||
| 108 | - AlphaFunction(AlphaFunction::EASE_OUT) }; | ||
| 109 | - | ||
| 110 | -const unsigned int NUM_ALPHA_FUNCTIONS = sizeof(ALPHA_FUNCTIONS) / sizeof(AlphaFunction); | ||
| 111 | - | ||
| 112 | -const char* ALPHA_FUNCTIONS_TEXT[] = { "Linear", | ||
| 113 | - "EaseIn", | ||
| 114 | - "EaseOut" }; | ||
| 115 | - | ||
| 116 | const char* BACKGROUND_IMAGE( "" ); | 107 | const char* BACKGROUND_IMAGE( "" ); |
| 117 | const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); | 108 | const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); |
| 118 | const char* EDIT_IMAGE( DALI_IMAGE_DIR "icon-edit.png" ); | 109 | const char* EDIT_IMAGE( DALI_IMAGE_DIR "icon-edit.png" ); |
| @@ -138,20 +129,10 @@ const float ITEM_IMAGE_BORDER_RIGHT = 13.0f; | @@ -138,20 +129,10 @@ const float ITEM_IMAGE_BORDER_RIGHT = 13.0f; | ||
| 138 | const float ITEM_IMAGE_BORDER_TOP = 13.0f; | 129 | const float ITEM_IMAGE_BORDER_TOP = 13.0f; |
| 139 | const float ITEM_IMAGE_BORDER_BOTTOM = 13.0f; | 130 | const float ITEM_IMAGE_BORDER_BOTTOM = 13.0f; |
| 140 | 131 | ||
| 141 | -const unsigned int DEPTH_LAYOUT_ROWS_PORTRAIT = 26; | ||
| 142 | -const unsigned int DEPTH_LAYOUT_ROWS_LANDSCAPE = 16; | ||
| 143 | -const float DEPTH_LAYOUT_TILT_ANGLE_PORTRAIT = 25.0f; | ||
| 144 | -const float DEPTH_LAYOUT_TILT_ANGLE_LANDSCAPE = 21.0f; | ||
| 145 | -const float DEPTH_LAYOUT_ROW_SPACING_FACTOR = 0.1f; | ||
| 146 | const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT = 1.0f; | 132 | const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT = 1.0f; |
| 147 | const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE = 0.8f; | 133 | const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE = 0.8f; |
| 148 | -const float DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_PORTRAIT = 0.2f; | ||
| 149 | -const float DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_LANDSCAPE = 0.1f; | 134 | +const float DEPTH_LAYOUT_COLUMNS = 3.0f; |
| 150 | 135 | ||
| 151 | -const float SPIRAL_LAYOUT_REVOLUTION_NUMBER_PORTRAIT = 4.5f; | ||
| 152 | -const float SPIRAL_LAYOUT_REVOLUTION_NUMBER_LANDSCAPE = 2.5f; | ||
| 153 | - | ||
| 154 | -const float DEPTH_LAYOUT_HEIGHT_SCALE = 20.0f; | ||
| 155 | const float MIN_SWIPE_DISTANCE = 15.0f; | 136 | const float MIN_SWIPE_DISTANCE = 15.0f; |
| 156 | const float MIN_SWIPE_SPEED = 5.0f; | 137 | const float MIN_SWIPE_SPEED = 5.0f; |
| 157 | 138 | ||
| @@ -162,33 +143,23 @@ const float LABEL_TEXT_SIZE_Y = 20.0f; | @@ -162,33 +143,23 @@ const float LABEL_TEXT_SIZE_Y = 20.0f; | ||
| 162 | 143 | ||
| 163 | const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f ); | 144 | const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f ); |
| 164 | 145 | ||
| 165 | -static Vector3 DepthLayoutItemSizeFunctionPortrait(unsigned int numberOfColumns, float layoutWidth) | 146 | +static Vector3 DepthLayoutItemSizeFunctionPortrait( float layoutWidth ) |
| 166 | { | 147 | { |
| 167 | - float width = (layoutWidth / static_cast<float>(numberOfColumns + 1)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT; | 148 | + float width = ( layoutWidth / ( DEPTH_LAYOUT_COLUMNS + 1.0f ) ) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT; |
| 168 | 149 | ||
| 169 | // 1x1 aspect ratio | 150 | // 1x1 aspect ratio |
| 170 | return Vector3(width, width, width); | 151 | return Vector3(width, width, width); |
| 171 | } | 152 | } |
| 172 | 153 | ||
| 173 | -static Vector3 DepthLayoutItemSizeFunctionLandscape(unsigned int numberOfColumns, float layoutWidth) | 154 | +static Vector3 DepthLayoutItemSizeFunctionLandscape( float layoutWidth ) |
| 174 | { | 155 | { |
| 175 | - float width = (layoutWidth / static_cast<float>(numberOfColumns + 1)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE; | 156 | + float width = ( layoutWidth / ( DEPTH_LAYOUT_COLUMNS + 1.0f ) ) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE; |
| 176 | 157 | ||
| 177 | // 1x1 aspect ratio | 158 | // 1x1 aspect ratio |
| 178 | return Vector3(width, width, width); | 159 | return Vector3(width, width, width); |
| 179 | } | 160 | } |
| 180 | 161 | ||
| 181 | -static float DepthLayoutBottomMarginFunctionPortrait(float layoutHeight) | ||
| 182 | -{ | ||
| 183 | - return layoutHeight * DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_PORTRAIT; | ||
| 184 | -} | ||
| 185 | - | ||
| 186 | -static float DepthLayoutBottomMarginFunctionLandscape(float layoutHeight) | ||
| 187 | -{ | ||
| 188 | - return layoutHeight * DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_LANDSCAPE; | ||
| 189 | -} | ||
| 190 | - | ||
| 191 | -} | 162 | +} // unnamed namespace |
| 192 | 163 | ||
| 193 | /** | 164 | /** |
| 194 | * This example shows how to use ItemView UI control. | 165 | * This example shows how to use ItemView UI control. |
| @@ -219,11 +190,9 @@ public: | @@ -219,11 +190,9 @@ public: | ||
| 219 | ItemViewExample( Application& application ) | 190 | ItemViewExample( Application& application ) |
| 220 | : mApplication( application ), | 191 | : mApplication( application ), |
| 221 | mMode( MODE_NORMAL ), | 192 | mMode( MODE_NORMAL ), |
| 222 | - mMenuShown( false ), | ||
| 223 | mOrientation( 0 ), | 193 | mOrientation( 0 ), |
| 224 | mCurrentLayout( SPIRAL_LAYOUT ), | 194 | mCurrentLayout( SPIRAL_LAYOUT ), |
| 225 | - mDurationSeconds( 1.0f ), | ||
| 226 | - mAlphaFuncIndex( 0u ) | 195 | + mDurationSeconds( 0.25f ) |
| 227 | { | 196 | { |
| 228 | // Connect to the Application's Init signal | 197 | // Connect to the Application's Init signal |
| 229 | mApplication.InitSignal().Connect(this, &ItemViewExample::OnInit); | 198 | mApplication.InitSignal().Connect(this, &ItemViewExample::OnInit); |
| @@ -321,9 +290,9 @@ public: | @@ -321,9 +290,9 @@ public: | ||
| 321 | stage.Add( mItemView ); | 290 | stage.Add( mItemView ); |
| 322 | 291 | ||
| 323 | // Create the layouts | 292 | // Create the layouts |
| 324 | - mSpiralLayout = SpiralLayout::New(); | ||
| 325 | - mDepthLayout = DepthLayout::New(); | ||
| 326 | - mGridLayout = GridLayout::New(); | 293 | + mSpiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL ); |
| 294 | + mDepthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH ); | ||
| 295 | + mGridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID ); | ||
| 327 | 296 | ||
| 328 | // Add the layouts to item view | 297 | // Add the layouts to item view |
| 329 | mItemView.AddLayout(*mSpiralLayout); | 298 | mItemView.AddLayout(*mSpiralLayout); |
| @@ -334,7 +303,7 @@ public: | @@ -334,7 +303,7 @@ public: | ||
| 334 | mItemView.SetMinimumSwipeSpeed(MIN_SWIPE_SPEED); | 303 | mItemView.SetMinimumSwipeSpeed(MIN_SWIPE_SPEED); |
| 335 | 304 | ||
| 336 | // Activate the spiral layout | 305 | // Activate the spiral layout |
| 337 | - UseLayout(mCurrentLayout, 0.0f); | 306 | + SetLayout( mCurrentLayout ); |
| 338 | mItemView.SetKeyboardFocusable( true ); | 307 | mItemView.SetKeyboardFocusable( true ); |
| 339 | KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &ItemViewExample::OnKeyboardPreFocusChange ); | 308 | KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &ItemViewExample::OnKeyboardPreFocusChange ); |
| 340 | 309 | ||
| @@ -357,49 +326,45 @@ public: | @@ -357,49 +326,45 @@ public: | ||
| 357 | } | 326 | } |
| 358 | 327 | ||
| 359 | /** | 328 | /** |
| 329 | + * Animate to a different layout | ||
| 330 | + */ | ||
| 331 | + void ChangeLayout() | ||
| 332 | + { | ||
| 333 | + Animation animation = Animation::New( mDurationSeconds ); | ||
| 334 | + animation.FinishedSignal().Connect( this, &ItemViewExample::AnimationFinished ); | ||
| 335 | + animation.AnimateTo( Property( mItemView, Actor::Property::COLOR_ALPHA ), 0.0f ); | ||
| 336 | + animation.Play(); | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + void AnimationFinished( Animation& ) | ||
| 340 | + { | ||
| 341 | + SetLayout( mCurrentLayout ); | ||
| 342 | + | ||
| 343 | + Animation animation = Animation::New( mDurationSeconds ); | ||
| 344 | + animation.AnimateTo( Property( mItemView, Actor::Property::COLOR_ALPHA ), 1.0f ); | ||
| 345 | + animation.Play(); | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + /** | ||
| 360 | * Switch to a different item view layout | 349 | * Switch to a different item view layout |
| 361 | */ | 350 | */ |
| 362 | - void UseLayout(int layoutId, float duration) | 351 | + void SetLayout( int layoutId ) |
| 363 | { | 352 | { |
| 364 | // Set the new orientation to the layout | 353 | // Set the new orientation to the layout |
| 365 | mItemView.GetLayout(layoutId)->SetOrientation(static_cast<ControlOrientation::Type>(mOrientation / 90)); | 354 | mItemView.GetLayout(layoutId)->SetOrientation(static_cast<ControlOrientation::Type>(mOrientation / 90)); |
| 366 | 355 | ||
| 367 | Vector2 stageSize = Stage::GetCurrent().GetSize(); | 356 | Vector2 stageSize = Stage::GetCurrent().GetSize(); |
| 368 | 357 | ||
| 369 | - if(layoutId == SPIRAL_LAYOUT) | ||
| 370 | - { | ||
| 371 | - mSpiralLayout->SetRevolutionDistance(stageSize.height / Stage::GetCurrent().GetDpi().y * 45.0f); | ||
| 372 | - } | ||
| 373 | - | ||
| 374 | - if(layoutId == GRID_LAYOUT) | ||
| 375 | - { | ||
| 376 | - // Set up the grid layout according to the new orientation | ||
| 377 | - float layoutWidth = Toolkit::IsHorizontal(mGridLayout->GetOrientation()) ? stageSize.height : stageSize.width; | ||
| 378 | - float gridItemSize = (layoutWidth / mGridLayout->GetNumberOfColumns()) * 0.5f; | ||
| 379 | - mGridLayout->SetScrollSpeedFactor(mGridLayout->GetNumberOfColumns() / gridItemSize); | ||
| 380 | - | ||
| 381 | - float toolbarHeight = mToolBar.GetCurrentSize().y; | ||
| 382 | - mGridLayout->SetTopMargin(toolbarHeight + mGridLayout->GetRowSpacing()); | ||
| 383 | - } | ||
| 384 | - | ||
| 385 | if(layoutId == DEPTH_LAYOUT) | 358 | if(layoutId == DEPTH_LAYOUT) |
| 386 | { | 359 | { |
| 387 | // Set up the depth layout according to the new orientation | 360 | // Set up the depth layout according to the new orientation |
| 388 | if(Toolkit::IsVertical(mDepthLayout->GetOrientation())) | 361 | if(Toolkit::IsVertical(mDepthLayout->GetOrientation())) |
| 389 | { | 362 | { |
| 390 | - mDepthLayout->SetRowSpacing(stageSize.height * DEPTH_LAYOUT_ROW_SPACING_FACTOR); | ||
| 391 | - mDepthLayout->SetNumberOfRows(DEPTH_LAYOUT_ROWS_PORTRAIT); | ||
| 392 | - mDepthLayout->SetTiltAngle( Degree( DEPTH_LAYOUT_TILT_ANGLE_PORTRAIT - mDepthLayout->GetNumberOfColumns() ) ); | ||
| 393 | - mDepthLayout->SetItemSizeFunction(DepthLayoutItemSizeFunctionPortrait); | ||
| 394 | - mDepthLayout->SetBottomMarginFunction(DepthLayoutBottomMarginFunctionPortrait); | 363 | + mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionPortrait( stageSize.width ) ); |
| 395 | } | 364 | } |
| 396 | else | 365 | else |
| 397 | { | 366 | { |
| 398 | - mDepthLayout->SetRowSpacing(stageSize.width * DEPTH_LAYOUT_ROW_SPACING_FACTOR); | ||
| 399 | - mDepthLayout->SetNumberOfRows(DEPTH_LAYOUT_ROWS_LANDSCAPE); | ||
| 400 | - mDepthLayout->SetTiltAngle( Degree( DEPTH_LAYOUT_TILT_ANGLE_LANDSCAPE - mDepthLayout->GetNumberOfColumns() ) ); | ||
| 401 | - mDepthLayout->SetItemSizeFunction(DepthLayoutItemSizeFunctionLandscape); | ||
| 402 | - mDepthLayout->SetBottomMarginFunction(DepthLayoutBottomMarginFunctionLandscape); | 367 | + mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionLandscape( stageSize.height ) ); |
| 403 | } | 368 | } |
| 404 | } | 369 | } |
| 405 | 370 | ||
| @@ -407,7 +372,7 @@ public: | @@ -407,7 +372,7 @@ public: | ||
| 407 | mItemView.SetAnchoring(layoutId == DEPTH_LAYOUT); | 372 | mItemView.SetAnchoring(layoutId == DEPTH_LAYOUT); |
| 408 | 373 | ||
| 409 | // Activate the layout | 374 | // Activate the layout |
| 410 | - mItemView.ActivateLayout(layoutId, Vector3(stageSize.x, stageSize.y, stageSize.x), duration); | 375 | + mItemView.ActivateLayout( layoutId, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f ); |
| 411 | } | 376 | } |
| 412 | 377 | ||
| 413 | /** | 378 | /** |
| @@ -424,7 +389,7 @@ public: | @@ -424,7 +389,7 @@ public: | ||
| 424 | // Remember orientation | 389 | // Remember orientation |
| 425 | mOrientation = angle; | 390 | mOrientation = angle; |
| 426 | 391 | ||
| 427 | - UseLayout(mCurrentLayout, mDurationSeconds); | 392 | + SetLayout( mCurrentLayout ); |
| 428 | } | 393 | } |
| 429 | } | 394 | } |
| 430 | 395 | ||
| @@ -433,7 +398,7 @@ public: | @@ -433,7 +398,7 @@ public: | ||
| 433 | // Switch to the next layout | 398 | // Switch to the next layout |
| 434 | mCurrentLayout = (mCurrentLayout + 1) % mItemView.GetLayoutCount(); | 399 | mCurrentLayout = (mCurrentLayout + 1) % mItemView.GetLayoutCount(); |
| 435 | 400 | ||
| 436 | - UseLayout(mCurrentLayout, mDurationSeconds); | 401 | + ChangeLayout(); |
| 437 | 402 | ||
| 438 | SetLayoutTitle(); | 403 | SetLayoutTitle(); |
| 439 | SetLayoutImage(); | 404 | SetLayoutImage(); |
| @@ -973,100 +938,6 @@ private: | @@ -973,100 +938,6 @@ private: | ||
| 973 | mTitleActor.SetProperty( TextLabel::Property::TEXT, title ); | 938 | mTitleActor.SetProperty( TextLabel::Property::TEXT, title ); |
| 974 | } | 939 | } |
| 975 | 940 | ||
| 976 | - void ShowMenu() | ||
| 977 | - { | ||
| 978 | - Stage stage = Stage::GetCurrent(); | ||
| 979 | - const float popupWidth = stage.GetSize().x * 0.75f; | ||
| 980 | - | ||
| 981 | - mMenu = Toolkit::Popup::New(); | ||
| 982 | - mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); | ||
| 983 | - mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT ); | ||
| 984 | - mMenu.SetSize( popupWidth, MENU_OPTION_HEIGHT * 2 ); | ||
| 985 | - mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu ); | ||
| 986 | - | ||
| 987 | - TableView tableView = TableView::New( 0, 0 ); | ||
| 988 | - tableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 989 | - mMenu.Add( tableView ); | ||
| 990 | - | ||
| 991 | - Slider slider = Slider::New(); | ||
| 992 | - slider.SetProperty( Slider::Property::LOWER_BOUND, 0.0f ); | ||
| 993 | - slider.SetProperty( Slider::Property::UPPER_BOUND, 3.0f ); | ||
| 994 | - slider.SetProperty( Slider::Property::VALUE, mDurationSeconds ); | ||
| 995 | - slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 ); | ||
| 996 | - slider.SetProperty( Slider::Property::SHOW_POPUP, true ); | ||
| 997 | - slider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 998 | - slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange ); | ||
| 999 | - tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) ); | ||
| 1000 | - | ||
| 1001 | - TextLabel text = TextLabel::New( "Duration" ); | ||
| 1002 | - text.SetAnchorPoint( ParentOrigin::TOP_LEFT ); | ||
| 1003 | - text.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 1004 | - text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | ||
| 1005 | - text.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); | ||
| 1006 | - text.SetSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) ); | ||
| 1007 | - slider.Add( text ); | ||
| 1008 | - | ||
| 1009 | - Actor textContainer = Actor::New(); | ||
| 1010 | - textContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 1011 | - mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] ); | ||
| 1012 | - mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER ); | ||
| 1013 | - mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 1014 | - textContainer.Add( mAlphaFunctionText ); | ||
| 1015 | - tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) ); | ||
| 1016 | - | ||
| 1017 | - mTapDetector = TapGestureDetector::New(); | ||
| 1018 | - mTapDetector.Attach(mAlphaFunctionText); | ||
| 1019 | - mTapDetector.DetectedSignal().Connect( this, &ItemViewExample::ChangeAlphaFunctionOnTap ); | ||
| 1020 | - | ||
| 1021 | - text = TextLabel::New( "Alpha Function" ); | ||
| 1022 | - text.SetAnchorPoint( ParentOrigin::TOP_LEFT ); | ||
| 1023 | - text.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 1024 | - text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | ||
| 1025 | - text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y ); | ||
| 1026 | - textContainer.Add( text ); | ||
| 1027 | - | ||
| 1028 | - mMenu.Show(); | ||
| 1029 | - mMenuShown = true; | ||
| 1030 | - } | ||
| 1031 | - | ||
| 1032 | - bool SliderValueChange( Toolkit::Slider slider, float value ) | ||
| 1033 | - { | ||
| 1034 | - mDurationSeconds = value; | ||
| 1035 | - | ||
| 1036 | - return true; | ||
| 1037 | - } | ||
| 1038 | - | ||
| 1039 | - void ChangeAlphaFunctionOnTap( Actor actor, const TapGesture& tap ) | ||
| 1040 | - { | ||
| 1041 | - if( NUM_ALPHA_FUNCTIONS <= ++mAlphaFuncIndex ) | ||
| 1042 | - { | ||
| 1043 | - mAlphaFuncIndex = 0; | ||
| 1044 | - } | ||
| 1045 | - | ||
| 1046 | - if( mAlphaFunctionText ) | ||
| 1047 | - { | ||
| 1048 | - mAlphaFunctionText.SetProperty( TextLabel::Property::TEXT, std::string(ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex]) ); | ||
| 1049 | - } | ||
| 1050 | - | ||
| 1051 | - if( mItemView ) | ||
| 1052 | - { | ||
| 1053 | - mItemView.GetActiveLayout()->SetAlphaFunction( ALPHA_FUNCTIONS[mAlphaFuncIndex] ); | ||
| 1054 | - } | ||
| 1055 | - } | ||
| 1056 | - | ||
| 1057 | - void HideMenu() | ||
| 1058 | - { | ||
| 1059 | - mTapDetector.Reset(); | ||
| 1060 | - | ||
| 1061 | - if( mMenu ) | ||
| 1062 | - { | ||
| 1063 | - mMenu.Hide(); | ||
| 1064 | - mMenu.Reset(); | ||
| 1065 | - } | ||
| 1066 | - | ||
| 1067 | - mMenuShown = false; | ||
| 1068 | - } | ||
| 1069 | - | ||
| 1070 | /** | 941 | /** |
| 1071 | * Main key event handler | 942 | * Main key event handler |
| 1072 | */ | 943 | */ |
| @@ -1074,27 +945,9 @@ private: | @@ -1074,27 +945,9 @@ private: | ||
| 1074 | { | 945 | { |
| 1075 | if(event.state == KeyEvent::Down) | 946 | if(event.state == KeyEvent::Down) |
| 1076 | { | 947 | { |
| 1077 | - if( IsKey( event, DALI_KEY_MENU ) ) | ||
| 1078 | - { | ||
| 1079 | - if( mMenuShown ) | ||
| 1080 | - { | ||
| 1081 | - HideMenu(); | ||
| 1082 | - } | ||
| 1083 | - else | ||
| 1084 | - { | ||
| 1085 | - ShowMenu(); | ||
| 1086 | - } | ||
| 1087 | - } | ||
| 1088 | - else if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | 948 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) |
| 1089 | { | 949 | { |
| 1090 | - if( mMenuShown ) | ||
| 1091 | - { | ||
| 1092 | - HideMenu(); | ||
| 1093 | - } | ||
| 1094 | - else | ||
| 1095 | - { | ||
| 1096 | - mApplication.Quit(); | ||
| 1097 | - } | 950 | + mApplication.Quit(); |
| 1098 | } | 951 | } |
| 1099 | } | 952 | } |
| 1100 | } | 953 | } |
| @@ -1103,7 +956,6 @@ private: | @@ -1103,7 +956,6 @@ private: | ||
| 1103 | 956 | ||
| 1104 | Application& mApplication; | 957 | Application& mApplication; |
| 1105 | Mode mMode; | 958 | Mode mMode; |
| 1106 | - bool mMenuShown; | ||
| 1107 | 959 | ||
| 1108 | Toolkit::Control mView; | 960 | Toolkit::Control mView; |
| 1109 | unsigned int mOrientation; | 961 | unsigned int mOrientation; |
| @@ -1117,11 +969,9 @@ private: | @@ -1117,11 +969,9 @@ private: | ||
| 1117 | unsigned int mCurrentLayout; | 969 | unsigned int mCurrentLayout; |
| 1118 | float mDurationSeconds; | 970 | float mDurationSeconds; |
| 1119 | 971 | ||
| 1120 | - SpiralLayoutPtr mSpiralLayout; | ||
| 1121 | - DepthLayoutPtr mDepthLayout; | ||
| 1122 | - GridLayoutPtr mGridLayout; | ||
| 1123 | - | ||
| 1124 | - Toolkit::Popup mMenu; | 972 | + ItemLayoutPtr mSpiralLayout; |
| 973 | + ItemLayoutPtr mDepthLayout; | ||
| 974 | + ItemLayoutPtr mGridLayout; | ||
| 1125 | 975 | ||
| 1126 | TapGestureDetector mTapDetector; | 976 | TapGestureDetector mTapDetector; |
| 1127 | Toolkit::PushButton mLayoutButton; | 977 | Toolkit::PushButton mLayoutButton; |
| @@ -1129,8 +979,6 @@ private: | @@ -1129,8 +979,6 @@ private: | ||
| 1129 | Toolkit::PushButton mInsertButton; | 979 | Toolkit::PushButton mInsertButton; |
| 1130 | Toolkit::PushButton mReplaceButton; | 980 | Toolkit::PushButton mReplaceButton; |
| 1131 | 981 | ||
| 1132 | - unsigned int mAlphaFuncIndex; | ||
| 1133 | - TextLabel mAlphaFunctionText; | ||
| 1134 | BufferImage mWhiteImage; | 982 | BufferImage mWhiteImage; |
| 1135 | }; | 983 | }; |
| 1136 | 984 |
examples/logging/logging-example.cpp
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | #include "shared/view.h" | 18 | #include "shared/view.h" |
| 19 | #include <dali/dali.h> | 19 | #include <dali/dali.h> |
| 20 | #include <dali-toolkit/dali-toolkit.h> | 20 | #include <dali-toolkit/dali-toolkit.h> |
| 21 | - | 21 | +#include <devel-api/adaptor-framework/performance-logger.h> |
| 22 | #include <sstream> | 22 | #include <sstream> |
| 23 | 23 | ||
| 24 | using namespace Dali; | 24 | using namespace Dali; |
examples/scroll-view/scroll-view-example.cpp
| 1 | /* | 1 | /* |
| 2 | - * Copyright (c) 2014 Samsung Electronics Co., Ltd. | 2 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| @@ -31,18 +31,15 @@ namespace | @@ -31,18 +31,15 @@ namespace | ||
| 31 | const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" ); | 31 | const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" ); |
| 32 | const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); | 32 | const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); |
| 33 | const char * const APPLICATION_TITLE( "ScrollView" ); | 33 | const char * const APPLICATION_TITLE( "ScrollView" ); |
| 34 | -const char * const EFFECT_DEPTH_IMAGE( DALI_IMAGE_DIR "icon-scroll-view-depth.png" ); | ||
| 35 | -const char * const EFFECT_INNER_CUBE_IMAGE( DALI_IMAGE_DIR "icon-scroll-view-inner-cube.png" ); | ||
| 36 | const char * const EFFECT_CAROUSEL_IMAGE( DALI_IMAGE_DIR "icon-scroll-view-carousel.png" ); | 34 | const char * const EFFECT_CAROUSEL_IMAGE( DALI_IMAGE_DIR "icon-scroll-view-carousel.png" ); |
| 37 | 35 | ||
| 38 | const Vector3 ICON_SIZE(100.0f, 100.0f, 0.0f); | 36 | const Vector3 ICON_SIZE(100.0f, 100.0f, 0.0f); |
| 39 | 37 | ||
| 40 | const char* EFFECT_MODE_NAME[] = { | 38 | const char* EFFECT_MODE_NAME[] = { |
| 41 | - "Depth", | ||
| 42 | - "Cube", | ||
| 43 | "PageCarousel", | 39 | "PageCarousel", |
| 44 | "PageCube", | 40 | "PageCube", |
| 45 | - "PageSpiral" | 41 | + "PageSpiral", |
| 42 | + "PageWave" | ||
| 46 | }; | 43 | }; |
| 47 | 44 | ||
| 48 | const char * const IMAGE_PATHS[] = { | 45 | const char * const IMAGE_PATHS[] = { |
| @@ -119,25 +116,6 @@ const int PAGE_COLUMNS = 10; ///< | @@ -119,25 +116,6 @@ const int PAGE_COLUMNS = 10; ///< | ||
| 119 | const int PAGE_ROWS = 1; ///< Number of Pages going down (rows) | 116 | const int PAGE_ROWS = 1; ///< Number of Pages going down (rows) |
| 120 | const int IMAGE_ROWS = 5; ///< Number of Images going down (rows) with a Page | 117 | const int IMAGE_ROWS = 5; ///< Number of Images going down (rows) with a Page |
| 121 | 118 | ||
| 122 | -// 3D Effect constants | ||
| 123 | -const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.2f, Math::PI * 0.2f, 0.0f); ///< Cube page rotates as if it has ten sides with the camera positioned inside | ||
| 124 | -const Vector2 ANGLE_CUSTOM_CUBE_SWING(-Math::PI * 0.45f, -Math::PI * 0.45f); ///< outer cube pages swing 90 degrees as they pan offscreen | ||
| 125 | -const Vector2 ANGLE_SPIRAL_SWING_IN(Math::PI * 0.45f, Math::PI * 0.45f); | ||
| 126 | -const Vector2 ANGLE_SPIRAL_SWING_OUT(Math::PI * 0.3f, Math::PI * 0.3f); | ||
| 127 | - | ||
| 128 | -// Depth Effect constants | ||
| 129 | -const Vector2 POSITION_EXTENT_DEPTH_EFFECT(0.5f, 2.5f); ///< Extent of X & Y position to alter function exponent. | ||
| 130 | -const Vector2 OFFSET_EXTENT_DEPTH_EFFECT(1.0f, 1.0f); ///< Function exponent offset constant. | ||
| 131 | -const float POSITION_SCALE_DEPTH_EFFECT(1.5f); ///< Position scaling. | ||
| 132 | -const float SCALE_EXTENT_DEPTH_EFFECT(0.5f); ///< Maximum scale factor when Actors scrolled one page away (50% size) | ||
| 133 | - | ||
| 134 | -// 3D Effect constants | ||
| 135 | -const Vector2 ANGLE_SWING_3DEFFECT(Math::PI_2 * 0.75, Math::PI_2 * 0.75f); ///< Angle Swing in radians | ||
| 136 | -const Vector2 POSITION_SWING_3DEFFECT(0.25f, 0.25f); ///< Position Swing relative to stage size. | ||
| 137 | -const Vector3 ANCHOR_3DEFFECT_STYLE0(-105.0f, 30.0f, -240.0f); ///< Rotation Anchor position for 3D Effect (Style 0) | ||
| 138 | -const Vector3 ANCHOR_3DEFFECT_STYLE1(65.0f, -70.0f, -300.0f); ///< Rotation Anchor position for 3D Effect (Style 1) | ||
| 139 | - | ||
| 140 | - | ||
| 141 | const unsigned int IMAGE_THUMBNAIL_WIDTH = 256; ///< Width of Thumbnail Image in texels | 119 | const unsigned int IMAGE_THUMBNAIL_WIDTH = 256; ///< Width of Thumbnail Image in texels |
| 142 | const unsigned int IMAGE_THUMBNAIL_HEIGHT = 256; ///< Height of Thumbnail Image in texels | 120 | const unsigned int IMAGE_THUMBNAIL_HEIGHT = 256; ///< Height of Thumbnail Image in texels |
| 143 | 121 | ||
| @@ -163,7 +141,7 @@ public: | @@ -163,7 +141,7 @@ public: | ||
| 163 | : mApplication( application ), | 141 | : mApplication( application ), |
| 164 | mView(), | 142 | mView(), |
| 165 | mScrolling(false), | 143 | mScrolling(false), |
| 166 | - mEffectMode(CubeEffect) | 144 | + mEffectMode(PageCarouselEffect) |
| 167 | { | 145 | { |
| 168 | // Connect to the Application's Init and orientation changed signal | 146 | // Connect to the Application's Init and orientation changed signal |
| 169 | mApplication.InitSignal().Connect(this, &ExampleController::OnInit); | 147 | mApplication.InitSignal().Connect(this, &ExampleController::OnInit); |
| @@ -196,11 +174,10 @@ public: | @@ -196,11 +174,10 @@ public: | ||
| 196 | TOOLBAR_IMAGE, | 174 | TOOLBAR_IMAGE, |
| 197 | "" ); | 175 | "" ); |
| 198 | 176 | ||
| 199 | - mEffectIcon[ DepthEffect ] = ResourceImage::New( EFFECT_DEPTH_IMAGE ); | ||
| 200 | - mEffectIcon[ CubeEffect ] = ResourceImage::New( EFFECT_INNER_CUBE_IMAGE ); | ||
| 201 | mEffectIcon[ PageCarouselEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); | 177 | mEffectIcon[ PageCarouselEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); |
| 202 | mEffectIcon[ PageCubeEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); | 178 | mEffectIcon[ PageCubeEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); |
| 203 | mEffectIcon[ PageSpiralEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); | 179 | mEffectIcon[ PageSpiralEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); |
| 180 | + mEffectIcon[ PageWaveEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); | ||
| 204 | 181 | ||
| 205 | // Create a effect change button. (right of toolbar) | 182 | // Create a effect change button. (right of toolbar) |
| 206 | mEffectChangeButton = Toolkit::PushButton::New(); | 183 | mEffectChangeButton = Toolkit::PushButton::New(); |
| @@ -274,23 +251,11 @@ private: | @@ -274,23 +251,11 @@ private: | ||
| 274 | 251 | ||
| 275 | // apply new Effect to ScrollView | 252 | // apply new Effect to ScrollView |
| 276 | ApplyEffectToScrollView(); | 253 | ApplyEffectToScrollView(); |
| 277 | - | ||
| 278 | - for(ActorIter pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter) | 254 | + unsigned int pageCount(0); |
| 255 | + for( std::vector< Actor >::iterator pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter) | ||
| 279 | { | 256 | { |
| 280 | Actor page = *pageIter; | 257 | Actor page = *pageIter; |
| 281 | - ApplyEffectToPage( page ); | ||
| 282 | - | ||
| 283 | - unsigned int numChildren = (*pageIter).GetChildCount(); | ||
| 284 | - for(unsigned int i=0; i<numChildren; ++i) | ||
| 285 | - { | ||
| 286 | - Actor image = (*pageIter).GetChildAt(i); | ||
| 287 | - | ||
| 288 | - // Remove old effect's manual constraints. | ||
| 289 | - image.RemoveConstraints(); | ||
| 290 | - | ||
| 291 | - // Apply new effect's manual constraints. | ||
| 292 | - ApplyEffectToActor( image, page ); | ||
| 293 | - } | 258 | + ApplyEffectToPage( page, pageCount++ ); |
| 294 | } | 259 | } |
| 295 | } | 260 | } |
| 296 | 261 | ||
| @@ -346,83 +311,107 @@ private: | @@ -346,83 +311,107 @@ private: | ||
| 346 | Stage stage = Stage::GetCurrent(); | 311 | Stage stage = Stage::GetCurrent(); |
| 347 | Vector2 stageSize = stage.GetSize(); | 312 | Vector2 stageSize = stage.GetSize(); |
| 348 | 313 | ||
| 349 | - switch( mEffectMode ) | 314 | + RulerPtr rulerX = CreateRuler(snap ? stageSize.width : 0.0f); |
| 315 | + RulerPtr rulerY = new DefaultRuler; | ||
| 316 | + rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * PAGE_COLUMNS, !wrap)); | ||
| 317 | + rulerY->Disable(); | ||
| 318 | + | ||
| 319 | + Dali::Path path = Dali::Path::New(); | ||
| 320 | + Dali::Property::Array points; | ||
| 321 | + points.Resize(3); | ||
| 322 | + Dali::Property::Array controlPoints; | ||
| 323 | + controlPoints.Resize(4); | ||
| 324 | + Vector3 forward; | ||
| 325 | + if( mEffectMode == PageCarouselEffect) | ||
| 350 | { | 326 | { |
| 351 | - case DepthEffect: | ||
| 352 | - { | ||
| 353 | - mScrollViewEffect = ScrollViewDepthEffect::New(); | ||
| 354 | - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); | ||
| 355 | - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); | ||
| 356 | - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT); | ||
| 357 | - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT); | ||
| 358 | - mScrollView.RemoveConstraintsFromChildren(); | ||
| 359 | - break; | ||
| 360 | - } | ||
| 361 | 327 | ||
| 362 | - case CubeEffect: | ||
| 363 | - { | ||
| 364 | - mScrollViewEffect = ScrollViewCubeEffect::New(); | ||
| 365 | - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); | ||
| 366 | - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); | ||
| 367 | - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT_BACK); | ||
| 368 | - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT_BACK); | ||
| 369 | - mScrollView.RemoveConstraintsFromChildren(); | ||
| 370 | - break; | ||
| 371 | - } | 328 | + points[0] = Vector3( stageSize.x*0.75, 0.0f, -stageSize.x*0.75f); |
| 329 | + points[1] = Vector3( 0.0f, 0.0f, 0.0f ); | ||
| 330 | + points[2] = Vector3( -stageSize.x*0.75f, 0.0f, -stageSize.x*0.75f); | ||
| 331 | + path.SetProperty( Path::Property::POINTS, points ); | ||
| 372 | 332 | ||
| 373 | - case PageCarouselEffect: | ||
| 374 | - { | ||
| 375 | - mScrollViewEffect = ScrollViewPageCarouselEffect::New(); | ||
| 376 | - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); | ||
| 377 | - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); | ||
| 378 | - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT); | ||
| 379 | - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT); | ||
| 380 | - mScrollView.RemoveConstraintsFromChildren(); | ||
| 381 | - break; | ||
| 382 | - } | 333 | + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f ); |
| 334 | + controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f ); | ||
| 335 | + controlPoints[2] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f ); | ||
| 336 | + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f ); | ||
| 337 | + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints ); | ||
| 383 | 338 | ||
| 384 | - case PageCubeEffect: | ||
| 385 | - { | ||
| 386 | - mScrollViewEffect = ScrollViewPageCubeEffect::New(); | ||
| 387 | - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); | ||
| 388 | - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); | ||
| 389 | - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT); | ||
| 390 | - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT); | ||
| 391 | - mScrollView.RemoveConstraintsFromChildren(); | ||
| 392 | - break; | ||
| 393 | - } | 339 | + forward = Vector3::ZERO; |
| 340 | + } | ||
| 341 | + else if( mEffectMode == PageCubeEffect) | ||
| 342 | + { | ||
| 343 | + points[0] = Vector3( stageSize.x*0.5, 0.0f, stageSize.x*0.5f); | ||
| 344 | + points[1] = Vector3( 0.0f, 0.0f, 0.0f ); | ||
| 345 | + points[2] = Vector3( -stageSize.x*0.5f, 0.0f, stageSize.x*0.5f); | ||
| 346 | + path.SetProperty( Path::Property::POINTS, points ); | ||
| 347 | + | ||
| 348 | + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, stageSize.x*0.3f ); | ||
| 349 | + controlPoints[1] = Vector3( stageSize.x*0.3f, 0.0f, 0.0f ); | ||
| 350 | + controlPoints[2] = Vector3(-stageSize.x*0.3f, 0.0f, 0.0f ); | ||
| 351 | + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, stageSize.x*0.3f ); | ||
| 352 | + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints ); | ||
| 353 | + | ||
| 354 | + forward = Vector3(-1.0f,0.0f,0.0f); | ||
| 355 | + } | ||
| 356 | + else if( mEffectMode == PageSpiralEffect) | ||
| 357 | + { | ||
| 358 | + points[0] = Vector3( stageSize.x*0.5, 0.0f, -stageSize.x*0.5f); | ||
| 359 | + points[1] = Vector3( 0.0f, 0.0f, 0.0f ); | ||
| 360 | + points[2] = Vector3( -stageSize.x*0.5f, 0.0f, -stageSize.x*0.5f); | ||
| 361 | + path.SetProperty( Path::Property::POINTS, points ); | ||
| 362 | + | ||
| 363 | + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f ); | ||
| 364 | + controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f ); | ||
| 365 | + controlPoints[2] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f ); | ||
| 366 | + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f ); | ||
| 367 | + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints ); | ||
| 368 | + | ||
| 369 | + forward = Vector3(-1.0f,0.0f,0.0f); | ||
| 370 | + } | ||
| 371 | + else if( mEffectMode == PageWaveEffect) | ||
| 372 | + { | ||
| 373 | + points[0] = Vector3( stageSize.x, 0.0f, -stageSize.x); | ||
| 374 | + points[1] = Vector3( 0.0f, 0.0f, 0.0f ); | ||
| 375 | + points[2] = Vector3( -stageSize.x, 0.0f, -stageSize.x); | ||
| 376 | + path.SetProperty( Path::Property::POINTS, points ); | ||
| 377 | + | ||
| 378 | + controlPoints[0] = Vector3( 0.0f, 0.0f, -stageSize.x ); | ||
| 379 | + controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f ); | ||
| 380 | + controlPoints[2] = Vector3( -stageSize.x*0.5f, 0.0f, 0.0f); | ||
| 381 | + controlPoints[3] = Vector3(0.0f, 0.0f,-stageSize.x ); | ||
| 382 | + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints ); | ||
| 383 | + | ||
| 384 | + forward = Vector3(-1.0f,0.0f,0.0f); | ||
| 385 | + } | ||
| 394 | 386 | ||
| 395 | - case PageSpiralEffect: | ||
| 396 | - { | ||
| 397 | - mScrollViewEffect = ScrollViewPageSpiralEffect::New(); | ||
| 398 | - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); | ||
| 399 | - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); | ||
| 400 | - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT); | ||
| 401 | - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT); | ||
| 402 | - mScrollView.RemoveConstraintsFromChildren(); | ||
| 403 | - break; | ||
| 404 | - } | 387 | + mScrollViewEffect = ScrollViewPagePathEffect::New(path, forward,Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(stageSize.x,stageSize.y,0.0f),PAGE_COLUMNS); |
| 388 | + mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); | ||
| 389 | + mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); | ||
| 390 | + mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT); | ||
| 391 | + mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT); | ||
| 392 | + mScrollView.RemoveConstraintsFromChildren(); | ||
| 405 | 393 | ||
| 406 | - default: | ||
| 407 | - { | ||
| 408 | - break; | ||
| 409 | - } | 394 | + rulerX = CreateRuler(snap ? stageSize.width * 0.5f : 0.0f); |
| 395 | + if( wrap ) | ||
| 396 | + { | ||
| 397 | + rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * 0.5f * PAGE_COLUMNS, !wrap)); | ||
| 398 | + } | ||
| 399 | + else | ||
| 400 | + { | ||
| 401 | + rulerX->SetDomain(RulerDomain(0.0f, stageSize.x*0.5f* (PAGE_COLUMNS+1), !wrap)); | ||
| 410 | } | 402 | } |
| 411 | 403 | ||
| 404 | + unsigned int currentPage = mScrollView.GetCurrentPage(); | ||
| 412 | if( mScrollViewEffect ) | 405 | if( mScrollViewEffect ) |
| 413 | { | 406 | { |
| 414 | mScrollView.ApplyEffect(mScrollViewEffect); | 407 | mScrollView.ApplyEffect(mScrollViewEffect); |
| 415 | } | 408 | } |
| 416 | 409 | ||
| 417 | mScrollView.SetWrapMode(wrap); | 410 | mScrollView.SetWrapMode(wrap); |
| 418 | - | ||
| 419 | - RulerPtr rulerX = CreateRuler(snap ? stageSize.width : 0.0f); | ||
| 420 | - RulerPtr rulerY = new DefaultRuler; | ||
| 421 | - rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * PAGE_COLUMNS, !wrap)); | ||
| 422 | - rulerY->Disable(); | ||
| 423 | - | ||
| 424 | mScrollView.SetRulerX( rulerX ); | 411 | mScrollView.SetRulerX( rulerX ); |
| 425 | mScrollView.SetRulerY( rulerY ); | 412 | mScrollView.SetRulerY( rulerY ); |
| 413 | + | ||
| 414 | + mScrollView.ScrollTo( currentPage, 0.0f ); | ||
| 426 | } | 415 | } |
| 427 | 416 | ||
| 428 | /** | 417 | /** |
| @@ -449,110 +438,16 @@ private: | @@ -449,110 +438,16 @@ private: | ||
| 449 | * | 438 | * |
| 450 | * @param[in] page The page Actor to apply effect to. | 439 | * @param[in] page The page Actor to apply effect to. |
| 451 | */ | 440 | */ |
| 452 | - void ApplyEffectToPage(Actor page) | 441 | + void ApplyEffectToPage(Actor page, unsigned int pageOrder ) |
| 453 | { | 442 | { |
| 454 | page.RemoveConstraints(); | 443 | page.RemoveConstraints(); |
| 455 | page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 444 | page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 456 | 445 | ||
| 457 | - switch( mEffectMode ) | ||
| 458 | - { | ||
| 459 | - case PageCarouselEffect: | ||
| 460 | - { | ||
| 461 | - ScrollViewPageCarouselEffect effect = ScrollViewPageCarouselEffect::DownCast( mScrollViewEffect ); | ||
| 462 | - effect.ApplyToPage( page ); | ||
| 463 | - break; | ||
| 464 | - } | ||
| 465 | - | ||
| 466 | - case PageCubeEffect: | ||
| 467 | - { | ||
| 468 | - ScrollViewPageCubeEffect effect = ScrollViewPageCubeEffect::DownCast( mScrollViewEffect ); | ||
| 469 | - effect.ApplyToPage( page, ANGLE_SWING_3DEFFECT ); | ||
| 470 | - break; | ||
| 471 | - } | ||
| 472 | - | ||
| 473 | - case PageSpiralEffect: | ||
| 474 | - { | ||
| 475 | - ScrollViewPageSpiralEffect effect = ScrollViewPageSpiralEffect::DownCast( mScrollViewEffect ); | ||
| 476 | - effect.ApplyToPage( page, ANGLE_SWING_3DEFFECT ); | ||
| 477 | - break; | ||
| 478 | - } | ||
| 479 | - | ||
| 480 | - default: | ||
| 481 | - { | ||
| 482 | - break; | ||
| 483 | - } | ||
| 484 | - } | 446 | + ScrollViewPagePathEffect effect = ScrollViewPagePathEffect::DownCast( mScrollViewEffect ); |
| 447 | + effect.ApplyToPage( page, pageOrder ); | ||
| 485 | } | 448 | } |
| 486 | 449 | ||
| 487 | /** | 450 | /** |
| 488 | - * [Actor] | ||
| 489 | - * Applies effect to child which resides in page (which in turn resides in scrollview) | ||
| 490 | - * | ||
| 491 | - * @note Page is typically the Parent of child, although in | ||
| 492 | - * some scenarios Page is simply a container which has a child as | ||
| 493 | - * a descendent. | ||
| 494 | - * | ||
| 495 | - * @param[in] child The child actor to apply effect to | ||
| 496 | - * @param[in] page The page which this child is inside | ||
| 497 | - */ | ||
| 498 | - void ApplyEffectToActor( Actor child, Actor page ) | ||
| 499 | - { | ||
| 500 | - switch( mEffectMode ) | ||
| 501 | - { | ||
| 502 | - case DepthEffect: | ||
| 503 | - { | ||
| 504 | - ApplyDepthEffectToActor( child ); | ||
| 505 | - break; | ||
| 506 | - } | ||
| 507 | - | ||
| 508 | - case CubeEffect: | ||
| 509 | - { | ||
| 510 | - ApplyCubeEffectToActor( child ); | ||
| 511 | - break; | ||
| 512 | - } | ||
| 513 | - | ||
| 514 | - default: | ||
| 515 | - { | ||
| 516 | - break; | ||
| 517 | - } | ||
| 518 | - } | ||
| 519 | - } | ||
| 520 | - | ||
| 521 | - /** | ||
| 522 | - * Applies depth effect to the child which resides in page (which in turn resides in scrollview) | ||
| 523 | - * | ||
| 524 | - * @param[in] child The child actor to apply depth effect to | ||
| 525 | - */ | ||
| 526 | - void ApplyDepthEffectToActor( Actor child ) | ||
| 527 | - { | ||
| 528 | - ScrollViewDepthEffect depthEffect = ScrollViewDepthEffect::DownCast(mScrollViewEffect); | ||
| 529 | - depthEffect.ApplyToActor( child, | ||
| 530 | - POSITION_EXTENT_DEPTH_EFFECT, | ||
| 531 | - OFFSET_EXTENT_DEPTH_EFFECT, | ||
| 532 | - POSITION_SCALE_DEPTH_EFFECT, | ||
| 533 | - SCALE_EXTENT_DEPTH_EFFECT ); | ||
| 534 | - } | ||
| 535 | - | ||
| 536 | - void ApplyCubeEffectToActor( Actor child ) | ||
| 537 | - { | ||
| 538 | - Vector3 anchor; | ||
| 539 | - if(rand()&1) | ||
| 540 | - { | ||
| 541 | - anchor = ANCHOR_3DEFFECT_STYLE0; | ||
| 542 | - } | ||
| 543 | - else | ||
| 544 | - { | ||
| 545 | - anchor = ANCHOR_3DEFFECT_STYLE1; | ||
| 546 | - } | ||
| 547 | - | ||
| 548 | - ScrollViewCubeEffect cubeEffect = ScrollViewCubeEffect::DownCast(mScrollViewEffect); | ||
| 549 | - cubeEffect.ApplyToActor( child, | ||
| 550 | - anchor, | ||
| 551 | - ANGLE_SWING_3DEFFECT, | ||
| 552 | - POSITION_SWING_3DEFFECT * Vector2(Stage::GetCurrent().GetSize())); | ||
| 553 | - } | ||
| 554 | - | ||
| 555 | - /** | ||
| 556 | * Creates an Image (Helper) | 451 | * Creates an Image (Helper) |
| 557 | * | 452 | * |
| 558 | * @param[in] filename the path of the image. | 453 | * @param[in] filename the path of the image. |
| @@ -577,7 +472,7 @@ private: | @@ -577,7 +472,7 @@ private: | ||
| 577 | * note this state (mScrolling = true) | 472 | * note this state (mScrolling = true) |
| 578 | * @param[in] position Current Scroll Position | 473 | * @param[in] position Current Scroll Position |
| 579 | */ | 474 | */ |
| 580 | - void OnScrollStarted( const Vector3& position ) | 475 | + void OnScrollStarted( const Vector2& position ) |
| 581 | { | 476 | { |
| 582 | mScrolling = true; | 477 | mScrolling = true; |
| 583 | } | 478 | } |
| @@ -587,7 +482,7 @@ private: | @@ -587,7 +482,7 @@ private: | ||
| 587 | * note this state (mScrolling = false) | 482 | * note this state (mScrolling = false) |
| 588 | * @param[in] position Current Scroll Position | 483 | * @param[in] position Current Scroll Position |
| 589 | */ | 484 | */ |
| 590 | - void OnScrollCompleted( const Vector3& position ) | 485 | + void OnScrollCompleted( const Vector2& position ) |
| 591 | { | 486 | { |
| 592 | mScrolling = false; | 487 | mScrolling = false; |
| 593 | } | 488 | } |
| @@ -666,18 +561,17 @@ private: | @@ -666,18 +561,17 @@ private: | ||
| 666 | ScrollView mScrollView; ///< ScrollView UI Component | 561 | ScrollView mScrollView; ///< ScrollView UI Component |
| 667 | bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary) | 562 | bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary) |
| 668 | ScrollViewEffect mScrollViewEffect; ///< ScrollView Effect instance. | 563 | ScrollViewEffect mScrollViewEffect; ///< ScrollView Effect instance. |
| 669 | - ActorContainer mPages; ///< Keeps track of all the pages for applying effects. | 564 | + std::vector< Actor > mPages; ///< Keeps track of all the pages for applying effects. |
| 670 | 565 | ||
| 671 | /** | 566 | /** |
| 672 | * Enumeration of different effects this scrollview can operate under. | 567 | * Enumeration of different effects this scrollview can operate under. |
| 673 | */ | 568 | */ |
| 674 | enum EffectMode | 569 | enum EffectMode |
| 675 | { | 570 | { |
| 676 | - DepthEffect, ///< Depth Effect | ||
| 677 | - CubeEffect, ///< Cube effect | ||
| 678 | PageCarouselEffect, ///< Page carousel effect | 571 | PageCarouselEffect, ///< Page carousel effect |
| 679 | PageCubeEffect, ///< Page cube effect | 572 | PageCubeEffect, ///< Page cube effect |
| 680 | PageSpiralEffect, ///< Page spiral effect | 573 | PageSpiralEffect, ///< Page spiral effect |
| 574 | + PageWaveEffect, ///< Page wave effect | ||
| 681 | 575 | ||
| 682 | Total | 576 | Total |
| 683 | }; | 577 | }; |
examples/size-negotiation/size-negotiation-example.cpp
| @@ -193,17 +193,13 @@ public: | @@ -193,17 +193,13 @@ public: | ||
| 193 | mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 193 | mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 194 | 194 | ||
| 195 | // Use a grid layout for tests | 195 | // Use a grid layout for tests |
| 196 | - Toolkit::GridLayoutPtr gridLayout = Toolkit::GridLayout::New(); | ||
| 197 | - gridLayout->SetNumberOfColumns( 2 ); | ||
| 198 | - gridLayout->SetTopMargin( DP(TOOLBAR_HEIGHT) + DP(20.0f) ); | ||
| 199 | - gridLayout->SetBottomMargin( DP(100.0f) ); | ||
| 200 | - gridLayout->SetRowSpacing( DP(20.0f) ); | ||
| 201 | - mItemView.AddLayout( *gridLayout ); | ||
| 202 | - | ||
| 203 | Vector2 stageSize = stage.GetSize(); | 196 | Vector2 stageSize = stage.GetSize(); |
| 204 | - float layoutWidth = Toolkit::IsHorizontal( gridLayout->GetOrientation() ) ? stageSize.height : stageSize.width; | ||
| 205 | - float gridItemSize = ( layoutWidth / gridLayout->GetNumberOfColumns() ) * 0.5f; | ||
| 206 | - gridLayout->SetScrollSpeedFactor( gridLayout->GetNumberOfColumns() / gridItemSize * 0.5f ); | 197 | + Toolkit::ItemLayoutPtr gridLayout = Toolkit::DefaultItemLayout::New( Toolkit::DefaultItemLayout::LIST ); |
| 198 | + Vector3 itemSize; | ||
| 199 | + gridLayout->GetItemSize( 0, Vector3( stageSize ), itemSize ); | ||
| 200 | + itemSize.height = stageSize.y / 10; | ||
| 201 | + gridLayout->SetItemSize( itemSize ); | ||
| 202 | + mItemView.AddLayout( *gridLayout ); | ||
| 207 | 203 | ||
| 208 | mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f ); | 204 | mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f ); |
| 209 | 205 |
examples/text-field/text-field-example.cpp
| @@ -22,20 +22,51 @@ | @@ -22,20 +22,51 @@ | ||
| 22 | 22 | ||
| 23 | // EXTERNAL INCLUDES | 23 | // EXTERNAL INCLUDES |
| 24 | #include <dali-toolkit/dali-toolkit.h> | 24 | #include <dali-toolkit/dali-toolkit.h> |
| 25 | -#include <dali/public-api/text-abstraction/text-abstraction.h> | 25 | +#include <iostream> |
| 26 | 26 | ||
| 27 | // INTERNAL INCLUDES | 27 | // INTERNAL INCLUDES |
| 28 | +#include "shared/multi-language-strings.h" | ||
| 28 | #include "shared/view.h" | 29 | #include "shared/view.h" |
| 29 | 30 | ||
| 30 | using namespace Dali; | 31 | using namespace Dali; |
| 31 | using namespace Dali::Toolkit; | 32 | using namespace Dali::Toolkit; |
| 33 | +using namespace MultiLanguageStrings; | ||
| 32 | 34 | ||
| 33 | namespace | 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 | } // unnamed namespace | 71 | } // unnamed namespace |
| 41 | 72 | ||
| @@ -47,7 +78,9 @@ class TextFieldExample : public ConnectionTracker | @@ -47,7 +78,9 @@ class TextFieldExample : public ConnectionTracker | ||
| 47 | public: | 78 | public: |
| 48 | 79 | ||
| 49 | TextFieldExample( Application& application ) | 80 | TextFieldExample( Application& application ) |
| 50 | - : mApplication( application ) | 81 | + : mApplication( application ), |
| 82 | + mLanguageId( 0u ), | ||
| 83 | + mAlignment( 0u ) | ||
| 51 | { | 84 | { |
| 52 | // Connect to the Application's Init signal | 85 | // Connect to the Application's Init signal |
| 53 | mApplication.InitSignal().Connect( this, &TextFieldExample::Create ); | 86 | mApplication.InitSignal().Connect( this, &TextFieldExample::Create ); |
| @@ -67,33 +100,42 @@ public: | @@ -67,33 +100,42 @@ public: | ||
| 67 | 100 | ||
| 68 | Stage stage = Stage::GetCurrent(); | 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 | stage.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent); | 107 | stage.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent); |
| 71 | 108 | ||
| 72 | Vector2 stageSize = stage.GetSize(); | 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::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." ); | ||
| 125 | + mField.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) ); | ||
| 86 | 126 | ||
| 87 | - mContainer.Add( field ); | 127 | + container.Add( mField ); |
| 88 | 128 | ||
| 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 ); | 129 | + Property::Value fieldText = mField.GetProperty( TextField::Property::TEXT ); |
| 93 | 130 | ||
| 94 | std::cout << "Displaying text: " << fieldText.Get< std::string >() << std::endl; | 131 | std::cout << "Displaying text: " << fieldText.Get< std::string >() << std::endl; |
| 95 | } | 132 | } |
| 96 | 133 | ||
| 134 | + void OnTap( Actor actor, const TapGesture& tapGesture ) | ||
| 135 | + { | ||
| 136 | + mField.ClearKeyInputFocus(); | ||
| 137 | + } | ||
| 138 | + | ||
| 97 | /** | 139 | /** |
| 98 | * Main key event handler | 140 | * Main key event handler |
| 99 | */ | 141 | */ |
| @@ -105,6 +147,73 @@ public: | @@ -105,6 +147,73 @@ public: | ||
| 105 | { | 147 | { |
| 106 | mApplication.Quit(); | 148 | mApplication.Quit(); |
| 107 | } | 149 | } |
| 150 | + else if( event.IsCtrlModifier() ) | ||
| 151 | + { | ||
| 152 | + switch( event.keyCode ) | ||
| 153 | + { | ||
| 154 | + // Select rendering back-end | ||
| 155 | + case KEY_ZERO: // fall through | ||
| 156 | + case KEY_ONE: | ||
| 157 | + { | ||
| 158 | + mField.SetProperty( TextField::Property::RENDERING_BACKEND, event.keyCode - 10 ); | ||
| 159 | + break; | ||
| 160 | + } | ||
| 161 | + case KEY_H: // Horizontal alignment | ||
| 162 | + { | ||
| 163 | + if( ++mAlignment >= H_ALIGNMENT_STRING_COUNT ) | ||
| 164 | + { | ||
| 165 | + mAlignment = 0u; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + mField.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, H_ALIGNMENT_STRING_TABLE[ mAlignment ] ); | ||
| 169 | + break; | ||
| 170 | + } | ||
| 171 | + case KEY_V: // Vertical alignment | ||
| 172 | + { | ||
| 173 | + if( ++mAlignment >= V_ALIGNMENT_STRING_COUNT ) | ||
| 174 | + { | ||
| 175 | + mAlignment = 0u; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + mField.SetProperty( TextField::Property::VERTICAL_ALIGNMENT, V_ALIGNMENT_STRING_TABLE[ mAlignment ] ); | ||
| 179 | + break; | ||
| 180 | + } | ||
| 181 | + case KEY_L: // Language | ||
| 182 | + { | ||
| 183 | + const Language& language = LANGUAGES[ mLanguageId ]; | ||
| 184 | + | ||
| 185 | + mField.SetProperty( TextField::Property::TEXT, language.text ); | ||
| 186 | + | ||
| 187 | + if( ++mLanguageId >= NUMBER_OF_LANGUAGES ) | ||
| 188 | + { | ||
| 189 | + mLanguageId = 0u; | ||
| 190 | + } | ||
| 191 | + break; | ||
| 192 | + } | ||
| 193 | + case KEY_S: // Shadow color | ||
| 194 | + { | ||
| 195 | + if( Color::BLACK == mField.GetProperty<Vector4>( TextField::Property::SHADOW_COLOR ) ) | ||
| 196 | + { | ||
| 197 | + mField.SetProperty( TextField::Property::SHADOW_COLOR, Color::RED ); | ||
| 198 | + } | ||
| 199 | + else | ||
| 200 | + { | ||
| 201 | + mField.SetProperty( TextField::Property::SHADOW_COLOR, Color::BLACK ); | ||
| 202 | + } | ||
| 203 | + break; | ||
| 204 | + } | ||
| 205 | + case KEY_PLUS: // Increase shadow offset | ||
| 206 | + { | ||
| 207 | + mField.SetProperty( TextField::Property::SHADOW_OFFSET, mField.GetProperty<Vector2>( TextField::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) ); | ||
| 208 | + break; | ||
| 209 | + } | ||
| 210 | + case KEY_MINUS: // Decrease shadow offset | ||
| 211 | + { | ||
| 212 | + mField.SetProperty( TextField::Property::SHADOW_OFFSET, mField.GetProperty<Vector2>( TextField::Property::SHADOW_OFFSET ) - Vector2( 1.0f, 1.0f ) ); | ||
| 213 | + break; | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + } | ||
| 108 | } | 217 | } |
| 109 | } | 218 | } |
| 110 | 219 | ||
| @@ -112,7 +221,12 @@ private: | @@ -112,7 +221,12 @@ private: | ||
| 112 | 221 | ||
| 113 | Application& mApplication; | 222 | Application& mApplication; |
| 114 | 223 | ||
| 115 | - Control mContainer; | 224 | + TextField mField; |
| 225 | + | ||
| 226 | + TapGestureDetector mTapGestureDetector; | ||
| 227 | + | ||
| 228 | + unsigned int mLanguageId; | ||
| 229 | + unsigned int mAlignment; | ||
| 116 | }; | 230 | }; |
| 117 | 231 | ||
| 118 | void RunTest( Application& application ) | 232 | void RunTest( Application& application ) |
examples/text-label-emojis/text-label-emojis.cpp
| @@ -17,7 +17,6 @@ | @@ -17,7 +17,6 @@ | ||
| 17 | 17 | ||
| 18 | // EXTERNAL INCLUDES | 18 | // EXTERNAL INCLUDES |
| 19 | #include <dali-toolkit/dali-toolkit.h> | 19 | #include <dali-toolkit/dali-toolkit.h> |
| 20 | -#include <dali/public-api/text-abstraction/text-abstraction.h> | ||
| 21 | #include <iostream> | 20 | #include <iostream> |
| 22 | 21 | ||
| 23 | // INTERNAL INCLUDES | 22 | // INTERNAL INCLUDES |
| @@ -56,6 +55,7 @@ public: | @@ -56,6 +55,7 @@ public: | ||
| 56 | void Create( Application& application ) | 55 | void Create( Application& application ) |
| 57 | { | 56 | { |
| 58 | Stage stage = Stage::GetCurrent(); | 57 | Stage stage = Stage::GetCurrent(); |
| 58 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 59 | stage.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent); | 59 | stage.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent); |
| 60 | 60 | ||
| 61 | mTableView = Toolkit::TableView::New( NUMBER_OF_EMOJIS, 1 ); | 61 | mTableView = Toolkit::TableView::New( NUMBER_OF_EMOJIS, 1 ); |
examples/text-label-multi-language/text-label-multi-language-example.cpp
| @@ -22,7 +22,6 @@ | @@ -22,7 +22,6 @@ | ||
| 22 | 22 | ||
| 23 | // EXTERNAL INCLUDES | 23 | // EXTERNAL INCLUDES |
| 24 | #include <dali-toolkit/dali-toolkit.h> | 24 | #include <dali-toolkit/dali-toolkit.h> |
| 25 | -#include <dali/public-api/text-abstraction/text-abstraction.h> | ||
| 26 | 25 | ||
| 27 | // INTERNAL INCLUDES | 26 | // INTERNAL INCLUDES |
| 28 | #include "shared/multi-language-strings.h" | 27 | #include "shared/multi-language-strings.h" |
| @@ -62,6 +61,7 @@ public: | @@ -62,6 +61,7 @@ public: | ||
| 62 | Stage stage = Stage::GetCurrent(); | 61 | Stage stage = Stage::GetCurrent(); |
| 63 | 62 | ||
| 64 | stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent); | 63 | stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent); |
| 64 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 65 | 65 | ||
| 66 | mTableView = Toolkit::TableView::New( NUMBER_OF_LANGUAGES, 1 ); | 66 | mTableView = Toolkit::TableView::New( NUMBER_OF_LANGUAGES, 1 ); |
| 67 | mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | 67 | mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
examples/text-label/text-label-example.cpp
| @@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
| 22 | 22 | ||
| 23 | // EXTERNAL INCLUDES | 23 | // EXTERNAL INCLUDES |
| 24 | #include <dali-toolkit/dali-toolkit.h> | 24 | #include <dali-toolkit/dali-toolkit.h> |
| 25 | -#include <dali/public-api/text-abstraction/text-abstraction.h> | 25 | +#include <iostream> |
| 26 | 26 | ||
| 27 | // INTERNAL INCLUDES | 27 | // INTERNAL INCLUDES |
| 28 | #include "shared/multi-language-strings.h" | 28 | #include "shared/multi-language-strings.h" |
| @@ -131,9 +131,10 @@ public: | @@ -131,9 +131,10 @@ public: | ||
| 131 | mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | 131 | mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 132 | mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); | 132 | mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); |
| 133 | mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); | 133 | mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); |
| 134 | + mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE ); | ||
| 134 | mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) ); | 135 | mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) ); |
| 135 | mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK ); | 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 | mContainer.Add( mLabel ); | 138 | mContainer.Add( mLabel ); |
| 138 | 139 | ||
| 139 | Property::Value labelText = mLabel.GetProperty( TextLabel::Property::TEXT ); | 140 | Property::Value labelText = mLabel.GetProperty( TextLabel::Property::TEXT ); |
examples/text-message-field/text-message-field-example.cpp
| @@ -22,7 +22,6 @@ | @@ -22,7 +22,6 @@ | ||
| 22 | 22 | ||
| 23 | // EXTERNAL INCLUDES | 23 | // EXTERNAL INCLUDES |
| 24 | #include <dali-toolkit/dali-toolkit.h> | 24 | #include <dali-toolkit/dali-toolkit.h> |
| 25 | -#include <dali/public-api/text-abstraction/text-abstraction.h> | ||
| 26 | 25 | ||
| 27 | using namespace Dali; | 26 | using namespace Dali; |
| 28 | using namespace Dali::Toolkit; | 27 | using namespace Dali::Toolkit; |
packaging/com.samsung.dali-demo.spec
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | Name: com.samsung.dali-demo | 3 | Name: com.samsung.dali-demo |
| 4 | Summary: The OpenGLES Canvas Core Demo | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.0.39 | 5 | +Version: 1.0.41 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |
resources/scripts/navigation.json deleted
| 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 | - "stage": [{ | ||
| 19 | - "type": "NavigationControl", | ||
| 20 | - "name": "navigation", | ||
| 21 | - "parent-origin": "CENTER", | ||
| 22 | - "signals": [{ | ||
| 23 | - "name": "on-stage", | ||
| 24 | - "actor": "navigation", | ||
| 25 | - "action": "push", | ||
| 26 | - "parameters": ["page1"] | ||
| 27 | - }], | ||
| 28 | - "actors": [{ | ||
| 29 | - "type": "Page", | ||
| 30 | - "name": "page1", | ||
| 31 | - "title": "title", | ||
| 32 | - "sub-title": "sub title", | ||
| 33 | - "actors": [{ | ||
| 34 | - "type": "TextLabel", // styles can be additive | ||
| 35 | - "parent-origin": [0.5, 0.5, 0], | ||
| 36 | - "anchor-point": [0.5, 0.5, 0], | ||
| 37 | - "size": [200, 200, 1], | ||
| 38 | - "text": "Touch to push new item!", | ||
| 39 | - "signals": [{ | ||
| 40 | - "name": "touched", | ||
| 41 | - "actor": "navigation", | ||
| 42 | - "action": "push", | ||
| 43 | - "parameters": ["page2"] | ||
| 44 | - }] | ||
| 45 | - }] | ||
| 46 | - }, { | ||
| 47 | - "type": "Page", | ||
| 48 | - "name": "page2", | ||
| 49 | - "actors": [{ | ||
| 50 | - "type": "TextLabel", // styles can be additive | ||
| 51 | - "parent-origin": [0.5, 0.5, 0.5], | ||
| 52 | - "anchor-point": [0.5, 0.5, 0.5], | ||
| 53 | - "size": [200, 200, 1], | ||
| 54 | - "text": "Hello World!" | ||
| 55 | - }, { | ||
| 56 | - "type": "TextLabel", // styles can be additive | ||
| 57 | - "parent-origin": [0.0, 0.0, 0.5], | ||
| 58 | - "anchor-point": [0.0, 0.0, 0.5], | ||
| 59 | - "size": [200, 200, 1], | ||
| 60 | - "text": "Back", | ||
| 61 | - "signals": [{ | ||
| 62 | - "name": "touched", | ||
| 63 | - "actor": "navigation", | ||
| 64 | - "action": "pop" | ||
| 65 | - }] | ||
| 66 | - }, { | ||
| 67 | - "type": "TextLabel", // styles can be additive | ||
| 68 | - "parent-origin": [1.0, 1.0, 0.5], | ||
| 69 | - "anchor-point": [1.0, 1.0, 0.5], | ||
| 70 | - "size": [200, 200, 1], | ||
| 71 | - "text": "Quit", | ||
| 72 | - "signals": [{ | ||
| 73 | - "name": "touched", | ||
| 74 | - "action": "quit" | ||
| 75 | - }] | ||
| 76 | - }] | ||
| 77 | - }] | ||
| 78 | - }] | ||
| 79 | -} |
resources/scripts/shader-effect-ripple.json
0 โ 100644
| 1 | +{ | ||
| 2 | + "stage": [ | ||
| 3 | + { | ||
| 4 | + "type": "ImageActor", | ||
| 5 | + "name": "Image1", | ||
| 6 | + "position": [ | ||
| 7 | + 0.40461349487305, | ||
| 8 | + 0.9150390625, | ||
| 9 | + 0.0 | ||
| 10 | + ], | ||
| 11 | + "parent-origin": [0.5, 0.5, 0.5], | ||
| 12 | + "size": [200, 200, 0], | ||
| 13 | + "effect": "Ripple2D", | ||
| 14 | + "image": { | ||
| 15 | + "filename": "{DALI_IMAGE_DIR}gallery-medium-25.jpg", | ||
| 16 | + "width": 200, | ||
| 17 | + "height": 80, | ||
| 18 | + "load-policy": "IMMEDIATE", | ||
| 19 | + "release-policy": "NEVER" | ||
| 20 | + }, | ||
| 21 | + "signals": [ | ||
| 22 | + { | ||
| 23 | + "name": "on-stage", | ||
| 24 | + "action": "play", | ||
| 25 | + "animation": "Animation_1" | ||
| 26 | + } | ||
| 27 | + ] | ||
| 28 | + } | ||
| 29 | + ], | ||
| 30 | + "paths": {}, | ||
| 31 | + "animations": { | ||
| 32 | + "Animation_1": { | ||
| 33 | + "loop":true, | ||
| 34 | + "properties": [ | ||
| 35 | + { | ||
| 36 | + "actor": "Image1", | ||
| 37 | + "property": "uTime", | ||
| 38 | + "value": 10.0, | ||
| 39 | + "alpha-function": "LINEAR", | ||
| 40 | + "time-period": { | ||
| 41 | + "delay": 0, | ||
| 42 | + "duration": 10.0 | ||
| 43 | + }, | ||
| 44 | + "gui-builder-timeline-color": "#8dc0da" | ||
| 45 | + } | ||
| 46 | + ] | ||
| 47 | + } | ||
| 48 | + }, | ||
| 49 | + "shader-effects": { | ||
| 50 | + "Ripple2D": { | ||
| 51 | + "program": { | ||
| 52 | + "vertexPrefix": "", | ||
| 53 | + "vertex": "void main(void)\n{\n gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n vTexCoord = aTexCoord;\n}\n\n", | ||
| 54 | + "fragmentPrefix": "", | ||
| 55 | + "fragment": "precision mediump float;\nuniform float uAmplitude; // 0.02; (< 1)\nuniform float uTime;\nvoid main()\n{\n highp vec2 textureSize = sTextureRect.zw - sTextureRect.xy;\n highp vec2 pos = -1.0 + 2.0 * vTexCoord.st/textureSize;\n highp float len = length(pos);\n highp vec2 texCoord = vTexCoord.st/textureSize + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude; \n gl_FragColor = texture2D(sTexture, texCoord) * uColor;\n}\n\n\n", | ||
| 56 | + "geometry-type": "GEOMETRY_TYPE_IMAGE" | ||
| 57 | + }, | ||
| 58 | + "geometry-hints": "HINT_NONE", | ||
| 59 | + "grid-density": 0, | ||
| 60 | + "loop": true, | ||
| 61 | + "uAmplitude": 0.02, | ||
| 62 | + "uTime": 0.0 | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | +} |
shared/view.h
| @@ -46,7 +46,6 @@ const ViewStyle DEFAULT_VIEW_STYLE( 0.1f, 0.7f, 80.f, 4.f ); | @@ -46,7 +46,6 @@ const ViewStyle DEFAULT_VIEW_STYLE( 0.1f, 0.7f, 80.f, 4.f ); | ||
| 46 | const char* DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNue"); | 46 | const char* DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNue"); |
| 47 | const char* DEFAULT_TEXT_STYLE_FONT_STYLE("Regular"); | 47 | const char* DEFAULT_TEXT_STYLE_FONT_STYLE("Regular"); |
| 48 | const float DEFAULT_TEXT_STYLE_POINT_SIZE( 8.0f ); | 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 | const Dali::Toolkit::Alignment::Padding DEFAULT_PLAY_PADDING(12.0f, 12.0f, 12.0f, 12.0f); | 50 | const Dali::Toolkit::Alignment::Padding DEFAULT_PLAY_PADDING(12.0f, 12.0f, 12.0f, 12.0f); |
| 52 | const Dali::Toolkit::Alignment::Padding DEFAULT_MODE_SWITCH_PADDING(8.0f, 8.0f, 8.0f, 8.0f); | 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& toolBar, | @@ -109,7 +108,6 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | ||
| 109 | label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | 108 | label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); |
| 110 | label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | 109 | label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); |
| 111 | label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT ); | 110 | label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT ); |
| 112 | - label.SetColor( DEFAULT_TEXT_STYLE_COLOR ); | ||
| 113 | 111 | ||
| 114 | // Add title to the tool bar. | 112 | // Add title to the tool bar. |
| 115 | const float padding( style.mToolBarPadding ); | 113 | const float padding( style.mToolBarPadding ); |
| @@ -174,7 +172,6 @@ Dali::Toolkit::TextLabel CreateToolBarLabel( const std::string& text ) | @@ -174,7 +172,6 @@ Dali::Toolkit::TextLabel CreateToolBarLabel( const std::string& text ) | ||
| 174 | label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | 172 | label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); |
| 175 | label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | 173 | label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); |
| 176 | label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT ); | 174 | label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT ); |
| 177 | - label.SetColor( DEFAULT_TEXT_STYLE_COLOR ); | ||
| 178 | 175 | ||
| 179 | return label; | 176 | return label; |
| 180 | } | 177 | } |