Further Setter/Getter public API removal from Dali::Actor
[platform/core/uifw/dali-demo.git] / examples / line-mesh / line-mesh-example.cpp
index c6740ad..b4fd114 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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,7 +16,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/rendering/renderer.h>
 #include <dali-toolkit/dali-toolkit.h>
 
 // INTERNAL INCLUDES
@@ -195,14 +194,14 @@ public:
 
     mMeshActor = Actor::New();
     mMeshActor.AddRenderer( mRenderer );
-    mMeshActor.SetSize(200, 200);
+    mMeshActor.SetProperty( Actor::Property::SIZE, Vector2(200, 200) );
 
     Property::Index morphAmountIndex = mMeshActor.RegisterProperty( "uMorphAmount", 0.0f );
 
     mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, 0 );
 
-    mMeshActor.SetParentOrigin( ParentOrigin::CENTER );
-    mMeshActor.SetAnchorPoint( AnchorPoint::CENTER );
+    mMeshActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+    mMeshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
     stage.Add( mMeshActor );
 
     Animation  animation = Animation::New(5);
@@ -223,13 +222,13 @@ public:
     Stage stage = Stage::GetCurrent();
 
     Toolkit::TableView modeSelectTableView = Toolkit::TableView::New( 4, 1 );
-    modeSelectTableView.SetParentOrigin( ParentOrigin::TOP_LEFT );
-    modeSelectTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+    modeSelectTableView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+    modeSelectTableView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
     modeSelectTableView.SetFitHeight( 0 );
     modeSelectTableView.SetFitHeight( 1 );
     modeSelectTableView.SetFitHeight( 2 );
     modeSelectTableView.SetCellPadding( Vector2( 6.0f, 0.0f ) );
-    modeSelectTableView.SetScale( Vector3( 0.8f, 0.8f, 0.8f ));
+    modeSelectTableView.SetProperty( Actor::Property::SCALE, Vector3( 0.8f, 0.8f, 0.8f ));
 
     const char* labels[] =
     {
@@ -240,16 +239,18 @@ public:
 
     for( int i = 0; i < 3; ++i )
     {
-      Property::Map labelMap;
-      labelMap[ "text" ]      = labels[i];
-      labelMap[ "textColor" ] = Vector4( 0.8f, 0.8f, 0.8f, 1.0f );
-
       Dali::Toolkit::RadioButton radio = Dali::Toolkit::RadioButton::New();
 
-      radio.SetProperty( Dali::Toolkit::Button::Property::LABEL, labelMap );
-      radio.SetParentOrigin( ParentOrigin::TOP_LEFT );
-      radio.SetAnchorPoint( AnchorPoint::TOP_LEFT );
-      radio.SetSelected( i == 0 );
+      radio.SetProperty( Toolkit::Button::Property::LABEL,
+                                 Property::Map()
+                                  .Add( Toolkit::Visual::Property::TYPE, Toolkit::Visual::TEXT )
+                                  .Add( Toolkit::TextVisual::Property::TEXT, labels[i] )
+                                  .Add( Toolkit::TextVisual::Property::TEXT_COLOR, Vector4( 0.8f, 0.8f, 0.8f, 1.0f ) )
+                               );
+
+      radio.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+      radio.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+      radio.SetProperty( Toolkit::Button::Property::SELECTED, i == 0 );
       radio.PressedSignal().Connect( this, &ExampleController::OnButtonPressed );
       mButtons[i] = radio;
       modeSelectTableView.AddChild( radio, Toolkit::TableView::CellPosition( i,  0 ) );
@@ -257,28 +258,28 @@ public:
 
     Toolkit::TableView elementCountTableView = Toolkit::TableView::New( 1, 3 );
     elementCountTableView.SetCellPadding( Vector2( 6.0f, 0.0f ) );
-    elementCountTableView.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
-    elementCountTableView.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
+    elementCountTableView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT );
+    elementCountTableView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
     elementCountTableView.SetFitHeight( 0 );
     elementCountTableView.SetFitWidth( 0 );
     elementCountTableView.SetFitWidth( 1 );
     elementCountTableView.SetFitWidth( 2 );
     mMinusButton = Toolkit::PushButton::New();
-    mMinusButton.SetLabelText( "<<" );
-    mMinusButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
-    mMinusButton.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
+    mMinusButton.SetProperty( Toolkit::Button::Property::LABEL, "<<" );
+    mMinusButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+    mMinusButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
 
     Toolkit::PushButton mPlusButton = Toolkit::PushButton::New();
-    mPlusButton.SetLabelText( ">>" );
-    mPlusButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
-    mPlusButton.SetAnchorPoint( AnchorPoint::CENTER_RIGHT );
+    mPlusButton.SetProperty( Toolkit::Button::Property::LABEL, ">>" );
+    mPlusButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+    mPlusButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_RIGHT );
 
     mMinusButton.ClickedSignal().Connect( this, &ExampleController::OnButtonClicked );
     mPlusButton.ClickedSignal().Connect( this, &ExampleController::OnButtonClicked );
 
     mIndicesCountLabel = Toolkit::TextLabel::New();
-    mIndicesCountLabel.SetParentOrigin( ParentOrigin::CENTER );
-    mIndicesCountLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+    mIndicesCountLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+    mIndicesCountLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
 
     std::stringstream str;
     str << mCurrentIndexCount;
@@ -390,20 +391,10 @@ private:
   int      mMaxIndexCount;
 };
 
-void RunTest( Application& application )
-{
-  ExampleController test( application );
-
-  application.MainLoop();
-}
-
-// Entry point for Linux & SLP applications
-//
 int DALI_EXPORT_API main( int argc, char **argv )
 {
   Application application = Application::New( &argc, &argv );
-
-  RunTest( application );
-
+  ExampleController test( application );
+  application.MainLoop();
   return 0;
 }