Further Setter/Getter public API removal from Dali::Actor
[platform/core/uifw/dali-demo.git] / examples / bubble-effect / bubble-effect-example.cpp
index 8de8a42..444f8d7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 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.
@@ -108,8 +108,8 @@ private:
 
     // Add a button to change background. (right of toolbar)
     mChangeBackgroundButton = Toolkit::PushButton::New();
-    mChangeBackgroundButton.SetUnselectedImage( CHANGE_BACKGROUND_ICON );
-    mChangeBackgroundButton.SetSelectedImage( CHANGE_BACKGROUND_ICON_SELECTED );
+    mChangeBackgroundButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON );
+    mChangeBackgroundButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON_SELECTED );
     mChangeBackgroundButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked );
     toolBar.AddControl( mChangeBackgroundButton,
                         DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
@@ -117,8 +117,8 @@ private:
                         DemoHelper::DEFAULT_MODE_SWITCH_PADDING  );
     // Add a button to change bubble shape. ( left of bar )
     mChangeBubbleShapeButton = Toolkit::PushButton::New();
-    mChangeBubbleShapeButton.SetUnselectedImage( CHANGE_BUBBLE_SHAPE_ICON );
-    mChangeBubbleShapeButton.SetSelectedImage( CHANGE_BUBBLE_SHAPE_ICON_SELECTED );
+    mChangeBubbleShapeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BUBBLE_SHAPE_ICON );
+    mChangeBubbleShapeButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BUBBLE_SHAPE_ICON_SELECTED );
     mChangeBubbleShapeButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked );
     toolBar.AddControl( mChangeBubbleShapeButton,
                         DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
@@ -135,14 +135,12 @@ private:
 
     // Get the root actor of all bubbles, and add it to stage.
     Actor bubbleRoot = mBubbleEmitter.GetRootActor();
-    bubbleRoot.SetParentOrigin(ParentOrigin::CENTER);
-    bubbleRoot.SetZ(0.1f); // Make sure the bubbles displayed on top og the background.
+    bubbleRoot.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
+    bubbleRoot.SetProperty( Actor::Property::POSITION_Z, 0.1f); // Make sure the bubbles displayed on top og the background.
     content.Add( bubbleRoot );
 
     // Set the application background
-    mBackground.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
-      .Add( Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::IMAGE )
-      .Add( Dali::Toolkit::ImageVisual::Property::URL, BACKGROUND_IMAGES[mCurrentBackgroundImageId] ));
+    mBackground.SetProperty( Toolkit::Control::Property::BACKGROUND, BACKGROUND_IMAGES[ mCurrentBackgroundImageId ] );
 
     // Set up the timer to emit bubble regularly when the finger is touched down but not moved
     mTimerForBubbleEmission = Timer::New( mTimerInterval );
@@ -258,9 +256,7 @@ private:
       mBubbleEmitter.SetBackground( DemoHelper::LoadStageFillingTexture( BACKGROUND_IMAGES[ mCurrentBackgroundImageId  ] ), mHSVDelta );
 
       // Set the application background
-      mBackground.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
-      .Add( Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::IMAGE )
-      .Add( Dali::Toolkit::ImageVisual::Property::URL, BACKGROUND_IMAGES[mCurrentBackgroundImageId] ));
+      mBackground.SetProperty( Toolkit::Control::Property::BACKGROUND, BACKGROUND_IMAGES[ mCurrentBackgroundImageId ] );
     }
     else if( button == mChangeBubbleShapeButton )
     {
@@ -309,20 +305,10 @@ private:
 
 /*****************************************************************************/
 
-static void
-RunTest(Application& app)
-{
-  BubbleEffectExample theApp(app);
-  app.MainLoop();
-}
-
-/*****************************************************************************/
-
 int DALI_EXPORT_API main(int argc, char **argv)
 {
   Application app = Application::New(&argc, &argv, DEMO_THEME_PATH);
-
-  RunTest(app);
-
+  BubbleEffectExample theApp(app);
+  app.MainLoop();
   return 0;
 }