Further Setter/Getter public API removal from Dali::Actor
[platform/core/uifw/dali-demo.git] / examples / tooltip / tooltip-example.cpp
index 3af4e11..36f436e 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.
@@ -18,8 +18,6 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/tooltip/tooltip-properties.h>
-#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -65,8 +63,8 @@ private:
 
     // Add a text label at the top for information purposes
     Control label = TextLabel::New( "Hover over buttons to see tooltip" );
-    label.SetParentOrigin( ParentOrigin::TOP_CENTER );
-    label.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+    label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
+    label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
     label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "Center" );
     stage.Add( label );
 
@@ -96,21 +94,21 @@ private:
     SetLabel( customFromCode, "Custom From Code" );
     Layout( customFromCode, stageSize );
     customFromCode.SetProperty( DevelControl::Property::TOOLTIP,
-                                Property::Map().Add( Tooltip::Property::CONTENT,
-                                                     Property::Array().Add( Property::Map().Add( Visual::Property::TYPE, Visual::IMAGE )
-                                                                                           .Add( ImageVisual::Property::URL, DEMO_IMAGE_DIR "Logo-for-demo.png" ) )
-                                                                      .Add( Property::Map().Add( Visual::Property::TYPE, DevelVisual::TEXT )
-                                                                                           .Add( TextVisual::Property::TEXT_COLOR, Color::WHITE )
-                                                                                           .Add( TextVisual::Property::TEXT, "Custom coded style\nat hover point" )
-                                                                                           .Add( TextVisual::Property::MULTI_LINE, true )
-                                                                                           .Add( TextVisual::Property::HORIZONTAL_ALIGNMENT, "CENTER" )
-                                                                                           .Add( TextVisual::Property::POINT_SIZE, 16 ) ) )
-                                               .Add( Tooltip::Property::LAYOUT, Vector2( 2, 1 ) )
-                                               .Add( Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT )
-                                               .Add( Tooltip::Property::BACKGROUND,
-                                                     Property::Map().Add( Tooltip::Background::Property::VISUAL, DEMO_IMAGE_DIR "tooltip.9.png" )
-                                                                    .Add( Tooltip::Background::Property::BORDER, Rect< int >( 1, 5, 5, 1 ) ) )
-                              );
+                                { { Tooltip::Property::CONTENT,
+                                    Property::Array{ { { { Toolkit::Visual::Property::TYPE, Visual::IMAGE },
+                                                         { ImageVisual::Property::URL, DEMO_IMAGE_DIR "Logo-for-demo.png" } } },
+                                                     { { { Toolkit::Visual::Property::TYPE, Visual::TEXT },
+                                                         { TextVisual::Property::TEXT_COLOR, Color::WHITE },
+                                                         { TextVisual::Property::TEXT, "Custom coded style\nat hover point" },
+                                                         { TextVisual::Property::MULTI_LINE, true },
+                                                         { TextVisual::Property::HORIZONTAL_ALIGNMENT, "CENTER" },
+                                                         { TextVisual::Property::POINT_SIZE, 16 } } } } },
+                                  { Tooltip::Property::LAYOUT, Vector2( 2, 1 ) },
+                                  { Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT },
+                                  { Tooltip::Property::BACKGROUND,
+                                    { { Tooltip::Background::Property::VISUAL, DEMO_IMAGE_DIR "tooltip.9.png" },
+                                      { Tooltip::Background::Property::BORDER, Rect< int >( 1, 5, 5, 1 ) } } }
+                                } );
     stage.Add( customFromCode );
   }
 
@@ -140,7 +138,7 @@ private:
     if( control )
     {
       control.SetProperty( Button::Property::LABEL,
-                           Property::Map().Add( Visual::Property::TYPE, DevelVisual::TEXT )
+                           Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::TEXT )
                                           .Add( TextVisual::Property::TEXT, label ) );
     }
   }
@@ -156,10 +154,10 @@ private:
     {
       previousPosition += POSITION_INCREMENTER;
       control.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
-      control.SetSizeModeFactor( Vector3( 0.75, 0.1, 1.0 ) );
-      control.SetAnchorPoint( AnchorPoint::CENTER );
-      control.SetParentOrigin( ParentOrigin::TOP_CENTER );
-      control.SetY( stageSize.height * previousPosition );
+      control.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75, 0.1, 1.0 ) );
+      control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+      control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
+      control.SetProperty( Actor::Property::POSITION_Y,  stageSize.height * previousPosition );
     }
   }