Merge "Removing unused variables" into devel/master
[platform/core/uifw/dali-demo.git] / examples / item-view / item-view-example.cpp
index 156176e..e4aee2b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 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.
@@ -20,6 +20,7 @@
 
 #include <dali/dali.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -195,14 +196,14 @@ public:
    */
   void OnInit(Application& app)
   {
-    Stage stage = Dali::Stage::GetCurrent();
-    stage.KeyEventSignal().Connect(this, &ItemViewExample::OnKeyEvent);
-    stage.GetRootLayer().SetBehavior(Layer::LAYER_3D);
+    Window window = app.GetWindow();
+    window.KeyEventSignal().Connect(this, &ItemViewExample::OnKeyEvent);
+    window.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
 
-    Vector2 stageSize = Stage::GetCurrent().GetSize();
+    Vector2 windowSize = window.GetSize();
 
     // Creates a default view with a default tool bar.
-    // The view is added to the stage.
+    // The view is added to the window.
 
     Layer contents = DemoHelper::CreateView( mApplication,
                                              mView,
@@ -213,73 +214,73 @@ public:
 
     // Create an edit mode button. (left of toolbar)
     Toolkit::PushButton editButton = Toolkit::PushButton::New();
-    editButton.SetUnselectedImage( EDIT_IMAGE );
-    editButton.SetSelectedImage( EDIT_IMAGE_SELECTED );
+    editButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, EDIT_IMAGE );
+    editButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, EDIT_IMAGE_SELECTED );
     editButton.ClickedSignal().Connect( this, &ItemViewExample::OnModeButtonClicked);
-    editButton.SetLeaveRequired( true );
+    editButton.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
     mToolBar.AddControl( editButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING  );
 
     // Create a layout toggle button. (right of toolbar)
     mLayoutButton = Toolkit::PushButton::New();
-    mLayoutButton.SetUnselectedImage( SPIRAL_LAYOUT_IMAGE );
-    mLayoutButton.SetSelectedImage(SPIRAL_LAYOUT_IMAGE_SELECTED );
+    mLayoutButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE );
+    mLayoutButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE_SELECTED );
     mLayoutButton.ClickedSignal().Connect( this, &ItemViewExample::OnLayoutButtonClicked);
-    mLayoutButton.SetLeaveRequired( true );
+    mLayoutButton.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
     mToolBar.AddControl( mLayoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING  );
 
     // Create a delete button (bottom right of screen)
     mDeleteButton = Toolkit::PushButton::New();
-    mDeleteButton.SetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
-    mDeleteButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
-    mDeleteButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER );
-    mDeleteButton.SetDrawMode( DrawMode::OVERLAY_2D );
-    mDeleteButton.SetUnselectedImage( DELETE_IMAGE );
-    mDeleteButton.SetSelectedImage( DELETE_IMAGE_SELECTED );
-    mDeleteButton.SetBackgroundImage( TOOLBAR_IMAGE );
-    mDeleteButton.SetSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
+    mDeleteButton.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT);
+    mDeleteButton.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+    mDeleteButton.SetProperty( Actor::Property::POSITION, Vector2( BUTTON_BORDER, BUTTON_BORDER ));
+    mDeleteButton.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
+    mDeleteButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, DELETE_IMAGE );
+    mDeleteButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, DELETE_IMAGE_SELECTED );
+    mDeleteButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE );
+    mDeleteButton.SetProperty( Actor::Property::SIZE, Vector2( windowSize.width * 0.15f, windowSize.width * 0.15f ) );
     mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked);
-    mDeleteButton.SetLeaveRequired( true );
-    mDeleteButton.SetVisible( false );
-    stage.Add( mDeleteButton );
+    mDeleteButton.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+    mDeleteButton.SetProperty( Actor::Property::VISIBLE, false );
+    window.Add( mDeleteButton );
 
     // Create an insert button (bottom right of screen)
     mInsertButton = Toolkit::PushButton::New();
-    mInsertButton.SetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
-    mInsertButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
-    mInsertButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER );
-    mInsertButton.SetDrawMode( DrawMode::OVERLAY_2D );
-    mInsertButton.SetUnselectedImage( INSERT_IMAGE );
-    mInsertButton.SetSelectedImage( INSERT_IMAGE_SELECTED );
-    mInsertButton.SetBackgroundImage( TOOLBAR_IMAGE );
-    mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f );
+    mInsertButton.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT);
+    mInsertButton.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+    mInsertButton.SetProperty( Actor::Property::POSITION, Vector2( BUTTON_BORDER, BUTTON_BORDER ));
+    mInsertButton.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
+    mInsertButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, INSERT_IMAGE );
+    mInsertButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, INSERT_IMAGE_SELECTED );
+    mInsertButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE );
+    mInsertButton.SetProperty( Actor::Property::SIZE, Vector2( windowSize.width * 0.15f, windowSize.width * 0.15f ) );
     mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked);
-    mInsertButton.SetLeaveRequired( true );
-    mInsertButton.SetVisible( false );
-    stage.Add( mInsertButton );
+    mInsertButton.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+    mInsertButton.SetProperty( Actor::Property::VISIBLE, false );
+    window.Add( mInsertButton );
 
     // Create an replace button (bottom right of screen)
     mReplaceButton = Toolkit::PushButton::New();
-    mReplaceButton.SetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
-    mReplaceButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
-    mReplaceButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER );
-    mReplaceButton.SetDrawMode( DrawMode::OVERLAY_2D );
-    mReplaceButton.SetUnselectedImage( REPLACE_IMAGE );
-    mReplaceButton.SetSelectedImage( REPLACE_IMAGE_SELECTED );
-    mReplaceButton.SetBackgroundImage( TOOLBAR_IMAGE );
-    mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f );
+    mReplaceButton.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT);
+    mReplaceButton.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+    mReplaceButton.SetProperty( Actor::Property::POSITION, Vector2( BUTTON_BORDER, BUTTON_BORDER ));
+    mReplaceButton.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
+    mReplaceButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, REPLACE_IMAGE );
+    mReplaceButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, REPLACE_IMAGE_SELECTED );
+    mReplaceButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE );
+    mReplaceButton.SetProperty( Actor::Property::SIZE, Vector2( windowSize.width * 0.15f, windowSize.width * 0.15f ) );
     mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked);
-    mReplaceButton.SetLeaveRequired( true );
-    mReplaceButton.SetVisible( false );
-    stage.Add( mReplaceButton );
+    mReplaceButton.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+    mReplaceButton.SetProperty( Actor::Property::VISIBLE, false );
+    window.Add( mReplaceButton );
 
     // Create the item view actor
     mItemView = ItemView::New(*this);
-    mItemView.SetParentOrigin(ParentOrigin::CENTER);
-    mItemView.SetAnchorPoint(AnchorPoint::CENTER);
+    mItemView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
+    mItemView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
 
-    // Display item view on the stage
-    stage.Add( mItemView );
-    stage.GetRootLayer().SetBehavior( Layer::LAYER_3D );
+    // Display item view on the window
+    window.Add( mItemView );
+    window.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
 
     // Create the layouts
     mSpiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
@@ -296,7 +297,7 @@ public:
 
     // Activate the spiral layout
     SetLayout( mCurrentLayout );
-    mItemView.SetKeyboardFocusable( true );
+    mItemView.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
     KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &ItemViewExample::OnKeyboardPreFocusChange );
 
     // Set the title and icon to the current layout
@@ -343,18 +344,18 @@ public:
    */
   void SetLayout( int layoutId )
   {
-    Stage stage = Dali::Stage::GetCurrent();
+    Window window = mApplication.GetWindow();
     switch( mCurrentLayout )
     {
       case SPIRAL_LAYOUT:
       case DEPTH_LAYOUT:
       {
-        stage.GetRootLayer().SetBehavior(Layer::LAYER_3D);
+        window.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
         break;
       }
       case GRID_LAYOUT:
       {
-        stage.GetRootLayer().SetBehavior(Layer::LAYER_2D);
+        window.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_UI );
         break;
       }
     }
@@ -362,18 +363,18 @@ public:
     // Set the new orientation to the layout
     mItemView.GetLayout(layoutId)->SetOrientation(static_cast<ControlOrientation::Type>(mOrientation / 90));
 
-    Vector2 stageSize = Stage::GetCurrent().GetSize();
+    Vector2 windowSize = window.GetSize();
 
     if(layoutId == DEPTH_LAYOUT)
     {
       // Set up the depth layout according to the new orientation
       if(Toolkit::IsVertical(mDepthLayout->GetOrientation()))
       {
-        mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionPortrait( stageSize.width ) );
+        mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionPortrait( windowSize.width ) );
       }
       else
       {
-        mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionLandscape( stageSize.height ) );
+        mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionLandscape( windowSize.height ) );
       }
     }
 
@@ -381,7 +382,7 @@ public:
     mItemView.SetAnchoring(layoutId == DEPTH_LAYOUT);
 
     // Activate the layout
-    mItemView.ActivateLayout( layoutId, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f );
+    mItemView.ActivateLayout( layoutId, Vector3(windowSize.x, windowSize.y, windowSize.x), 0.0f );
   }
 
   bool OnLayoutButtonClicked( Toolkit::Button button )
@@ -494,7 +495,7 @@ public:
   {
     SetTitle("Edit: Remove Many");
 
-    mDeleteButton.SetVisible( true );
+    mDeleteButton.SetProperty( Actor::Property::VISIBLE, true );
 
     mTapDetector = TapGestureDetector::New();
 
@@ -506,7 +507,7 @@ public:
       if( box )
       {
         mTapDetector.Attach( child );
-        box.SetVisible( true );
+        box.SetProperty( Actor::Property::VISIBLE, true );
       }
     }
 
@@ -522,19 +523,19 @@ public:
 
       if( box )
       {
-        box.SetVisible( false );
+        box.SetProperty( Actor::Property::VISIBLE, false );
 
         Actor tick = box.FindChildByName( "Tick" );
         if( tick )
         {
-          tick.SetVisible( false );
+          tick.SetProperty( Actor::Property::VISIBLE, false );
         }
       }
     }
 
     mTapDetector.Reset();
 
-    mDeleteButton.SetVisible( false );
+    mDeleteButton.SetProperty( Actor::Property::VISIBLE, false );
   }
 
   void SelectOnTap( Actor actor, const TapGesture& tap )
@@ -542,7 +543,7 @@ public:
     Actor tick = actor.FindChildByName( "Tick" );
     if( tick )
     {
-      tick.SetVisible( !tick.IsVisible() );
+      tick.SetProperty( Actor::Property::VISIBLE, !tick.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
     }
   }
 
@@ -552,7 +553,7 @@ public:
     {
       case Gesture::Started:
       {
-        const Size& size = Stage::GetCurrent().GetSize();
+        const Size& size = mApplication.GetWindow().GetSize();
 
         ItemRange range( 0u, 0u );
         mItemView.GetItemsRange( range );
@@ -584,7 +585,7 @@ public:
       Actor child = mItemView.GetChildAt( i );
       Actor tick = child.FindChildByName( "Tick" );
 
-      if( tick && tick.IsVisible() )
+      if( tick && tick.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) )
       {
         removeList.push_back( mItemView.GetItemId(child) );
       }
@@ -630,7 +631,7 @@ public:
   {
     SetTitle("Edit: Insert Many");
 
-    mInsertButton.SetVisible( true );
+    mInsertButton.SetProperty( Actor::Property::VISIBLE, true );
 
     mTapDetector = TapGestureDetector::New();
 
@@ -642,7 +643,7 @@ public:
       if( box )
       {
         mTapDetector.Attach( child );
-        box.SetVisible( true );
+        box.SetProperty( Actor::Property::VISIBLE, true );
       }
     }
 
@@ -658,19 +659,19 @@ public:
 
       if( box )
       {
-        box.SetVisible( false );
+        box.SetProperty( Actor::Property::VISIBLE, false );
 
         Actor tick = box.FindChildByName( "Tick" );
         if( tick )
         {
-          tick.SetVisible( false );
+          tick.SetProperty( Actor::Property::VISIBLE, false );
         }
       }
     }
 
     mTapDetector.Reset();
 
-    mInsertButton.SetVisible( false );
+    mInsertButton.SetProperty( Actor::Property::VISIBLE, false );
   }
 
   bool OnInsertButtonClicked( Toolkit::Button button )
@@ -682,7 +683,7 @@ public:
       Actor child = mItemView.GetChildAt( i );
       Actor tick = child.FindChildByName( "Tick" );
 
-      if( tick && tick.IsVisible() )
+      if( tick && tick.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) )
       {
         insertList.push_back( Item( mItemView.GetItemId(child), NewItem(rand()) ) );
       }
@@ -724,7 +725,7 @@ public:
   {
     SetTitle("Edit: Replace Many");
 
-    mReplaceButton.SetVisible( true );
+    mReplaceButton.SetProperty( Actor::Property::VISIBLE, true );
 
     mTapDetector = TapGestureDetector::New();
 
@@ -736,7 +737,7 @@ public:
       if( box )
       {
         mTapDetector.Attach( child );
-        box.SetVisible( true );
+        box.SetProperty( Actor::Property::VISIBLE, true );
       }
     }
 
@@ -752,19 +753,19 @@ public:
 
       if( box )
       {
-        box.SetVisible( false );
+        box.SetProperty( Actor::Property::VISIBLE, false );
 
         Actor tick = box.FindChildByName( "Tick" );
         if( tick )
         {
-          tick.SetVisible( false );
+          tick.SetProperty( Actor::Property::VISIBLE, false );
         }
       }
     }
 
     mTapDetector.Reset();
 
-    mReplaceButton.SetVisible( false );
+    mReplaceButton.SetProperty( Actor::Property::VISIBLE, false );
   }
 
   bool OnReplaceButtonClicked( Toolkit::Button button )
@@ -776,7 +777,7 @@ public:
       Actor child = mItemView.GetChildAt( i );
       Actor tick = child.FindChildByName( "Tick" );
 
-      if( tick && tick.IsVisible() )
+      if( tick && tick.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) )
       {
         replaceList.push_back( Item( mItemView.GetItemId(child), NewItem(rand()) ) );
       }
@@ -821,22 +822,22 @@ public:
       {
         case SPIRAL_LAYOUT:
         {
-          mLayoutButton.SetUnselectedImage( SPIRAL_LAYOUT_IMAGE );
-          mLayoutButton.SetSelectedImage( SPIRAL_LAYOUT_IMAGE_SELECTED );
+          mLayoutButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE );
+          mLayoutButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE_SELECTED );
           break;
         }
 
         case GRID_LAYOUT:
         {
-          mLayoutButton.SetUnselectedImage( GRID_LAYOUT_IMAGE );
-          mLayoutButton.SetSelectedImage( GRID_LAYOUT_IMAGE_SELECTED );
+          mLayoutButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, GRID_LAYOUT_IMAGE );
+          mLayoutButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, GRID_LAYOUT_IMAGE_SELECTED );
           break;
         }
 
         case DEPTH_LAYOUT:
         {
-          mLayoutButton.SetUnselectedImage( DEPTH_LAYOUT_IMAGE );
-          mLayoutButton.SetSelectedImage( DEPTH_LAYOUT_IMAGE_SELECTED );
+          mLayoutButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, DEPTH_LAYOUT_IMAGE );
+          mLayoutButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, DEPTH_LAYOUT_IMAGE_SELECTED );
           break;
         }
 
@@ -865,63 +866,69 @@ public: // From ItemFactory
   virtual Actor NewItem(unsigned int itemId)
   {
     // Create an image view for this item
-    ImageView actor = ImageView::New( IMAGE_PATHS[ itemId % NUM_IMAGES ] );
-    actor.SetZ( 0.0f );
-    actor.SetPosition( INITIAL_OFFSCREEN_POSITION );
+    Property::Map propertyMap;
+    propertyMap.Insert(Toolkit::Visual::Property::TYPE,  Visual::IMAGE);
+    propertyMap.Insert(ImageVisual::Property::URL, IMAGE_PATHS[ itemId % NUM_IMAGES ] );
+    propertyMap.Insert(DevelVisual::Property::VISUAL_FITTING_MODE, DevelVisual::FILL);
+    ImageView actor = ImageView::New();
+    actor.SetProperty( Toolkit::ImageView::Property::IMAGE, propertyMap );
+    actor.SetProperty( Actor::Property::POSITION_Z,  0.0f );
+    actor.SetProperty( Actor::Property::POSITION, INITIAL_OFFSCREEN_POSITION );
 
     // Add a border image child actor
     ImageView borderActor = ImageView::New();
-    borderActor.SetParentOrigin( ParentOrigin::CENTER );
-    borderActor.SetAnchorPoint( AnchorPoint::CENTER );
+    borderActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+    borderActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
     borderActor.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
-    borderActor.SetSizeModeFactor( Vector3( 2.0f * ITEM_BORDER_SIZE, 2.0f * ITEM_BORDER_SIZE, 0.0f ) );
-    borderActor.SetColorMode( USE_PARENT_COLOR );
+    borderActor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 2.0f * ITEM_BORDER_SIZE, 2.0f * ITEM_BORDER_SIZE, 0.0f ) );
+    borderActor.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
 
     Property::Map borderProperty;
-    borderProperty.Insert( "rendererType", "BORDER" );
-    borderProperty.Insert( "borderColor", Color::WHITE );
-    borderProperty.Insert( "borderSize", ITEM_BORDER_SIZE );
-    borderProperty.Insert( "antiAliasing", true );
+    borderProperty.Insert( Toolkit::Visual::Property::TYPE, Visual::BORDER );
+    borderProperty.Insert( BorderVisual::Property::COLOR, Color::WHITE );
+    borderProperty.Insert( BorderVisual::Property::SIZE, ITEM_BORDER_SIZE );
+    borderProperty.Insert( BorderVisual::Property::ANTI_ALIASING, true );
     borderActor.SetProperty( ImageView::Property::IMAGE, borderProperty );
 
     actor.Add(borderActor);
 
-    actor.SetKeyboardFocusable( true );
+    actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
 
     Vector3 spiralItemSize;
-    static_cast<ItemLayout&>(*mSpiralLayout).GetItemSize( 0u, Vector3( Stage::GetCurrent().GetSize() ), spiralItemSize );
+    Vector2 windowSize = mApplication.GetWindow().GetSize();
+    static_cast<ItemLayout&>(*mSpiralLayout).GetItemSize( 0u, Vector3( windowSize ), spiralItemSize );
 
     // Add a checkbox child actor; invisible until edit-mode is enabled
     ImageView checkbox = ImageView::New();
-    checkbox.SetName( "CheckBox" );
-    checkbox.SetColorMode( USE_PARENT_COLOR );
-    checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT );
-    checkbox.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
-    checkbox.SetSize( spiralItemSize.width * 0.2f, spiralItemSize.width * 0.2f );
-    checkbox.SetPosition( -SELECTION_BORDER_WIDTH, SELECTION_BORDER_WIDTH );
-    checkbox.SetZ( 0.1f );
+    checkbox.SetProperty( Dali::Actor::Property::NAME, "CheckBox" );
+    checkbox.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
+    checkbox.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
+    checkbox.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT );
+    checkbox.SetProperty( Actor::Property::SIZE, Vector2( spiralItemSize.width * 0.2f, spiralItemSize.width * 0.2f ) );
+    checkbox.SetProperty( Actor::Property::POSITION, Vector2( -SELECTION_BORDER_WIDTH, SELECTION_BORDER_WIDTH ));
+    checkbox.SetProperty( Actor::Property::POSITION_Z,  0.1f );
 
     Property::Map solidColorProperty;
-    solidColorProperty.Insert( "rendererType", "COLOR" );
-    solidColorProperty.Insert( "mixColor", Vector4(0.f, 0.f, 0.f, 0.6f) );
+    solidColorProperty.Insert( Toolkit::Visual::Property::TYPE, Visual::COLOR );
+    solidColorProperty.Insert( ColorVisual::Property::MIX_COLOR, Vector4(0.f, 0.f, 0.f, 0.6f) );
     checkbox.SetProperty( ImageView::Property::IMAGE, solidColorProperty );
 
     if( MODE_REMOVE_MANY  != mMode &&
         MODE_INSERT_MANY  != mMode &&
         MODE_REPLACE_MANY != mMode )
     {
-      checkbox.SetVisible( false );
+      checkbox.SetProperty( Actor::Property::VISIBLE, false );
     }
     borderActor.Add( checkbox );
 
     ImageView tick = ImageView::New( SELECTED_IMAGE );
-    tick.SetName( "Tick" );
-    tick.SetColorMode( USE_PARENT_COLOR );
-    tick.SetParentOrigin( ParentOrigin::TOP_RIGHT );
-    tick.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
-    tick.SetSize( spiralItemSize.width * 0.2f, spiralItemSize.width * 0.2f );
-    tick.SetZ( 0.2f );
-    tick.SetVisible( false );
+    tick.SetProperty( Dali::Actor::Property::NAME, "Tick" );
+    tick.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
+    tick.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
+    tick.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT );
+    tick.SetProperty( Actor::Property::SIZE, Vector2( spiralItemSize.width * 0.2f, spiralItemSize.width * 0.2f ) );
+    tick.SetProperty( Actor::Property::POSITION_Z,  0.2f );
+    tick.SetProperty( Actor::Property::VISIBLE, false );
     checkbox.Add( tick );
 
     // Connect new items for various editing modes
@@ -956,7 +963,7 @@ private:
    */
   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 ) )
       {
@@ -993,18 +1000,10 @@ private:
   LongPressGestureDetector mLongPressDetector;
 };
 
-void RunTest(Application& app)
-{
-  ItemViewExample test(app);
-
-  app.MainLoop();
-}
-
 int DALI_EXPORT_API main(int argc, char **argv)
 {
   Application app = Application::New(&argc, &argv, DEMO_THEME_PATH);
-
-  RunTest(app);
-
+  ItemViewExample test(app);
+  app.MainLoop();
   return 0;
 }