X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fclipping-draw-order%2Fclipping-draw-order.cpp;h=0653f2a8f0886bf4cc720bd14900da0ec42786b2;hb=1a473d5189ca7e7d55aca3a64a8a4ff2dc3b6c67;hp=68ca7dfb8f5a5d5d1a2995d7067b826422cfd26c;hpb=9879c76252b384906ea35422547840350a72019c;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/clipping-draw-order/clipping-draw-order.cpp b/examples/clipping-draw-order/clipping-draw-order.cpp index 68ca7df..0653f2a 100644 --- a/examples/clipping-draw-order/clipping-draw-order.cpp +++ b/examples/clipping-draw-order/clipping-draw-order.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ */ #include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -48,27 +49,27 @@ public: // The Init signal is received once (only) during the Application lifetime. void Create( Application& application ) { - // Get a handle to the stage - Stage stage = Stage::GetCurrent(); - stage.SetBackgroundColor( Color::WHITE ); + // Get a handle to the window + Window window = application.GetWindow(); + window.SetBackgroundColor( Color::WHITE ); - // Connect to the stage's key signal to allow Back and Escape to exit. - stage.KeyEventSignal().Connect( this, &ClippingDrawOrderVerification::OnKeyEvent ); + // Connect to the window's key signal to allow Back and Escape to exit. + window.KeyEventSignal().Connect( this, &ClippingDrawOrderVerification::OnKeyEvent ); // Create the title label. TextLabel title = TextLabel::New( "Clipping draw order verification" ); title.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); title.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); - title.SetAnchorPoint( AnchorPoint::CENTER ); - title.SetParentOrigin( ParentOrigin::CENTER ); + title.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + title.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); // Create the description label. TextLabel description = TextLabel::New( "The bottom tree should have the same draw order as the top tree.\nThey should look identical except \"C\" is clipped on the bottom tree." ); description.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); description.SetProperty( TextLabel::Property::MULTI_LINE, true ); - description.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - description.SetParentOrigin( Vector3( 0.5f, 1.0f, 0.5f ) ); - stage.Add( description ); + description.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER ); + description.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, 1.0f, 0.5f ) ); + window.Add( description ); /* * Create a 4-row TableView. @@ -89,8 +90,8 @@ public: * +---------------+ */ TableView view = TableView::New( 4, 1 ); - view.SetAnchorPoint( AnchorPoint::CENTER ); - view.SetParentOrigin( ParentOrigin::CENTER ); + view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); view.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); view.SetCellAlignment( Toolkit::TableView::CellPosition( 0, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); @@ -129,8 +130,8 @@ public: for( int tree = 0; tree < 2; ++tree ) { Control container = Control::New(); - container.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - container.SetParentOrigin( ParentOrigin::TOP_CENTER ); + container.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER ); + container.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER ); container.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Vector4 backgroundColor = tree == 0 ? Vector4( 0.77f, 1.0f, 0.77f, 1.0f ) : Vector4( 0.8f, 0.8f, 1.0f, 1.0f ); container.SetProperty( Control::Property::BACKGROUND, backgroundColor ); @@ -142,24 +143,24 @@ public: std::stringstream labelStream; labelStream << static_cast( static_cast( i ) + 'A' ); TextLabel textLabel = TextLabel::New( labelStream.str() ); - textLabel.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + textLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER ); image[i] = ImageView::New( images[i] ); - image[i].SetAnchorPoint( AnchorPoint::TOP_CENTER ); + image[i].SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER ); // Calculate the relative positioning for the images and labels. float depth = static_cast( i == 0 ? 0 : ( ( i - 1 ) % 2 ) + 1 ); if( i == 0 ) { - image[i].SetParentOrigin( Vector3( 0.5f, treeYStart, 0.5f ) ); - textLabel.SetParentOrigin( Vector3( 1.0f, 0.05f * depth, 0.5f ) ); + image[i].SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, treeYStart, 0.5f ) ); + textLabel.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 1.0f, 0.05f * depth, 0.5f ) ); } else { float b = i > 2 ? 1.0f : -1.0f; - image[i].SetParentOrigin( Vector3( 0.5f + ( 0.2f * b ), depthGap, 0.5f ) ); - textLabel.SetParentOrigin( Vector3( 0.98f + 0.215f * b + ( 0.04f * b * depth ), treeYStart + 0.02f + ( 0.16f * depth ), 0.5f ) ); + image[i].SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f + ( 0.2f * b ), depthGap, 0.5f ) ); + textLabel.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.98f + 0.215f * b + ( 0.04f * b * depth ), treeYStart + 0.02f + ( 0.16f * depth ), 0.5f ) ); } container.Add( textLabel ); @@ -170,8 +171,8 @@ public: TextLabel treeLabel = TextLabel::New( treeText ); treeLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); treeLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "BOTTOM" ); - treeLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - treeLabel.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + treeLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER ); + treeLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER ); container.Add( treeLabel ); // Enable clipping for the 2nd tree. @@ -193,14 +194,14 @@ public: view.AddChild( container, TableView::CellPosition( 1u + tree, 0u ) ); } - // Add the finished TableView to the stage. - stage.Add( view ); + // Add the finished TableView to the window. + window.Add( view ); - // Respond to a click anywhere on the stage - stage.GetRootLayer().TouchSignal().Connect( this, &ClippingDrawOrderVerification::OnTouch ); + // Respond to a click anywhere on the window + window.GetRootLayer().TouchedSignal().Connect( this, &ClippingDrawOrderVerification::OnTouch ); } - bool OnTouch( Actor actor, const TouchData& touch ) + bool OnTouch( Actor actor, const TouchEvent& touch ) { // Quit the application. mApplication.Quit(); @@ -215,7 +216,7 @@ public: */ void OnKeyEvent( const KeyEvent& event ) { - if( event.state == KeyEvent::Down ) + if( event.GetState() == KeyEvent::DOWN ) { if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) {