Further Setter/Getter public API removal from Dali::Actor
[platform/core/uifw/dali-demo.git] / examples / image-policies / image-policies-example.cpp
index c96b7b3..8860ef0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -23,7 +23,6 @@
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
-#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
 
 using namespace Dali;
 using namespace Toolkit;
@@ -115,8 +114,8 @@ class ImagePolicies: public ConnectionTracker
     }
     imageView.SetProperty(ImageView::Property::IMAGE , imagePropertyMap );
 
-    imageView.SetParentOrigin( ParentOrigin::CENTER );
-    imageView.SetAnchorPoint( AnchorPoint::CENTER );
+    imageView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+    imageView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
     imageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
     return imageView;
@@ -173,9 +172,9 @@ class ImagePolicies: public ConnectionTracker
     mTable.RemoveChildAt( TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
     mInstructions.SetProperty( TextLabel::Property::TEXT, "Loading Image before staging, press next to see it in right column");
     TableView dualImageViewTable = TableView::New( 1, 2 );
-    dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
-    dualImageViewTable.SetName("dualTable");
-    dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+    dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+    dualImageViewTable.SetProperty( Dali::Actor::Property::NAME,"dualTable");
+    dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
     TextLabel attached = TextLabel::New("ATTACHED loaded image \nWill appear here");
@@ -202,9 +201,9 @@ class ImagePolicies: public ConnectionTracker
     mTable.RemoveChildAt( TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
 
     TableView dualImageViewTable = TableView::New( 2, 2 );
-    dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
-    dualImageViewTable.SetName("dualTable");
-    dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+    dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+    dualImageViewTable.SetProperty( Dali::Actor::Property::NAME,"dualTable");
+    dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
 
@@ -233,8 +232,8 @@ class ImagePolicies: public ConnectionTracker
     mInstructions.SetProperty( TextLabel::Property::TEXT, "ReleasePolicy::DESTROYED shown in first column, press next to destroy it.");
     DisableButtonWhilstLoading();
     TableView dualImageViewTable = TableView::New( 1, 2 );
-    dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
-    dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+    dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+    dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
 
@@ -256,8 +255,8 @@ class ImagePolicies: public ConnectionTracker
     mTable.RemoveChildAt( TableView::CellPosition( TableRowPlacement::IMAGE, 0 ) );
     DisableButtonWhilstLoading();
     TableView dualImageViewTable = TableView::New( 1, 2 );
-    dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
-    dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+    dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+    dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
 
@@ -279,8 +278,8 @@ class ImagePolicies: public ConnectionTracker
     mInstructions.SetProperty( TextLabel::Property::TEXT, "Image with ReleasePolicy::DESTROYED shown in first column, Image will be detached, reusing it will be fast");
     DisableButtonWhilstLoading();
     TableView dualImageViewTable = TableView::New( 1, 2 );
-    dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
-    dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+    dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+    dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
 
@@ -319,8 +318,8 @@ class ImagePolicies: public ConnectionTracker
     mInstructions.SetProperty( TextLabel::Property::TEXT, "Image with ReleasePolicy::DETACHED shown in first column, will be detached and reloaded");
     DisableButtonWhilstLoading();
     TableView dualImageViewTable = TableView::New( 1, 2 );
-    dualImageViewTable.SetAnchorPoint( AnchorPoint::CENTER );
-    dualImageViewTable.SetParentOrigin( ParentOrigin::CENTER );
+    dualImageViewTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+    dualImageViewTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     dualImageViewTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
     dualImageViewTable.SetCellPadding( Vector2( 6.0f, 0.0f ) );
 
@@ -387,19 +386,19 @@ class ImagePolicies: public ConnectionTracker
 
     // Create default View.
     Toolkit::Control view = Toolkit::Control::New();
-    view.SetAnchorPoint( Dali::AnchorPoint::CENTER );
-    view.SetParentOrigin( Dali::ParentOrigin::CENTER );
+    view.SetProperty( Actor::Property::ANCHOR_POINT, Dali::AnchorPoint::CENTER );
+    view.SetProperty( Actor::Property::PARENT_ORIGIN, Dali::ParentOrigin::CENTER );
     view.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
     view.SetProperty( Toolkit::Control::Property::BACKGROUND , gradientBackground );
     stage.Add( view );
 
     // Create a table view to show a pair of buttons above each image.
     mTable = TableView::New( TableRowPlacement::NUMBER_OF_ROWS, 1 );
-    mTable.SetAnchorPoint( AnchorPoint::CENTER );
-    mTable.SetParentOrigin( ParentOrigin::CENTER );
+    mTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+    mTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     mTable.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
     Vector3 offset( 0.9f, 0.90f, 0.0f );
-    mTable.SetSizeModeFactor( offset );
+    mTable.SetProperty( Actor::Property::SIZE_MODE_FACTOR, offset );
     mTable.SetFitHeight( TableRowPlacement::NEXT_BUTTON );
     mTable.SetFitHeight( TableRowPlacement::LOADING_STATUS );
     view.Add( mTable );
@@ -409,16 +408,16 @@ class ImagePolicies: public ConnectionTracker
     Property::Map imagePropertyMap;
     imagePropertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
     imagePropertyMap.Insert( ImageVisual::Property::URL, NEXT_BUTTON_IMAGE );
-    mNextButton.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, imagePropertyMap );
+    mNextButton.SetProperty( Button::Property::UNSELECTED_BACKGROUND_VISUAL, imagePropertyMap );
     imagePropertyMap.Clear();
     imagePropertyMap.Insert( Visual::Property::TYPE,  Visual::IMAGE );
     imagePropertyMap.Insert( ImageVisual::Property::URL, NEXT_BUTTON_PRESSED_IMAGE );
-    mNextButton.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, imagePropertyMap );
-    mNextButton.SetProperty( DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, LOADING_IMAGE );
-    mNextButton.SetProperty( DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL, NEXT_BUTTON_DISABLED_IMAGE );
-    mNextButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
-    mNextButton.SetY( -50.0f );
-    mNextButton.SetSize( 100.0f, 100.0f );
+    mNextButton.SetProperty( Button::Property::SELECTED_BACKGROUND_VISUAL, imagePropertyMap );
+    mNextButton.SetProperty( Button::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, LOADING_IMAGE );
+    mNextButton.SetProperty( Button::Property::DISABLED_SELECTED_BACKGROUND_VISUAL, NEXT_BUTTON_DISABLED_IMAGE );
+    mNextButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
+    mNextButton.SetProperty( Actor::Property::POSITION_Y,  -50.0f );
+    mNextButton.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
     mNextButton.ClickedSignal().Connect( this, &ImagePolicies::ChangeImageClicked );
     mTable.AddChild( mNextButton, TableView::CellPosition( TableRowPlacement::NEXT_BUTTON, 0 ) );
     mTable.SetCellPadding( Vector2( 2.0f, 2.0f ) );
@@ -507,8 +506,8 @@ private:
       {
         ReleasePolicyDestroyedExample06();
         // Change Next button to complete button ( will quit app once pressed )
-        button.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, OK_IMAGE_IMAGE );
-        button.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, OK_IMAGE_IMAGE );
+        button.SetProperty( Button::Property::UNSELECTED_BACKGROUND_VISUAL, OK_IMAGE_IMAGE );
+        button.SetProperty( Button::Property::SELECTED_BACKGROUND_VISUAL, OK_IMAGE_IMAGE );
         break;
       }
       default: