Removing unused variables
[platform/core/uifw/dali-demo.git] / examples / primitive-shapes / primitive-shapes-example.cpp
index f7e9350..b613980 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 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.
@@ -16,6 +16,7 @@
  */
 
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -82,21 +83,18 @@ public:
   // The Init signal is received once (only) during the Application lifetime
   void Create( Application& application )
   {
-    // Get a handle to the stage
-    Stage stage = Stage::GetCurrent();
-    stage.SetBackgroundColor( Color::WHITE );
-
-    // Hide the indicator bar
-    application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
+    // Get a handle to the window
+    Window window = application.GetWindow();
+    window.SetBackgroundColor( Color::WHITE );
 
     //Set up layer to place UI on.
     Layer layer = Layer::New();
     layer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     layer.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
     layer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-    layer.SetBehavior( Layer::LAYER_UI ); //We use a 2D layer as this is closer to UI work than full 3D scene creation.
-    layer.SetDepthTestDisabled( false ); //Enable depth testing, as otherwise the 2D layer would not do so.
-    stage.Add( layer );
+    layer.SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_UI ); //We use a 2D layer as this is closer to UI work than full 3D scene creation.
+    layer.SetProperty( Layer::Property::DEPTH_TEST, true ); //Enable depth testing, as otherwise the 2D layer would not do so.
+    window.Add( layer );
 
     //Set up model selection buttons.
     SetupButtons( layer );
@@ -108,7 +106,7 @@ public:
     SetupModel( layer );
 
     //Allow for exiting of the application via key presses.
-    stage.KeyEventSignal().Connect( this, &PrimitiveShapesController::OnKeyEvent );
+    window.KeyEventSignal().Connect( this, &PrimitiveShapesController::OnKeyEvent );
   }
 
   //Place buttons on the top of the screen, which allow for selection of the shape to be displayed.
@@ -163,7 +161,7 @@ public:
     mShapeTitle.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     mShapeTitle.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
     mShapeTitle.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
-    mShapeTitle.SetPadding( Padding( elementPadding, elementPadding, elementPadding, elementPadding ) );
+    mShapeTitle.SetProperty( Actor::Property::PADDING, Padding( elementPadding, elementPadding, elementPadding, elementPadding ) );
     topAlignment.Add( mShapeTitle );
 
     //Create a variable-length container that can wrap buttons around as more are added.
@@ -172,7 +170,7 @@ public:
     buttonContainer.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
     buttonContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
     buttonContainer.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
-    buttonContainer.SetPadding( Padding( containerPadding, containerPadding, containerPadding, containerPadding ) );
+    buttonContainer.SetProperty( Actor::Property::PADDING, Padding( containerPadding, containerPadding, containerPadding, containerPadding ) );
     buttonContainer.SetProperty( FlexContainer::Property::FLEX_DIRECTION, FlexContainer::ROW );
     buttonContainer.SetProperty( FlexContainer::Property::FLEX_WRAP, FlexContainer::WRAP );
     topAlignment.Add( buttonContainer );
@@ -184,7 +182,7 @@ public:
       button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
       button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
       button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
-      button.SetPadding( Padding( elementPadding, elementPadding, elementPadding, elementPadding ) );
+      button.SetProperty( Actor::Property::PADDING, Padding( elementPadding, elementPadding, elementPadding, elementPadding ) );
       button.SetProperty( Button::Property::UNSELECTED_BACKGROUND_VISUAL, BUTTON_IMAGE_URL[modelNumber] );
       button.SetProperty( Button::Property::SELECTED_BACKGROUND_VISUAL,  BUTTON_IMAGE_URL[modelNumber] );
       button.RegisterProperty( "modelNumber", Property::Value( modelNumber ) );
@@ -235,7 +233,7 @@ public:
     mSliderTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
     mSliderTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
     mSliderTable.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
-    mSliderTable.SetSizeModeFactor( Vector3( 0.9, 0.3, 0.0 ) );  //90% of width, 30% of height.
+    mSliderTable.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.9, 0.3, 0.0 ) );  //90% of width, 30% of height.
     mSliderTable.SetFitWidth( 0 );  //Label column should fit to natural size of label.
     mSliderTable.SetRelativeWidth( 1, 1.0f );  //Slider column should fill remaining space.
     mSliderTable.SetCellPadding( Vector2( 10.0f, 0.0f ) ); //Leave a gap between the slider and its label.
@@ -270,7 +268,7 @@ public:
     }
   }
 
-  //Adds a control to the centre of the stage to display the 3D shapes.
+  //Adds a control to the centre of the window to display the 3D shapes.
   //The model is placed in the center of the screen, like so:
   //
   //           +--------------------------------+
@@ -308,7 +306,7 @@ public:
     //Create a container to house the visual-holding actor, to provide a constant hitbox.
     Actor container = Actor::New();
     container.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
-    container.SetSizeModeFactor( Vector3( 0.9, 0.3, 0.0 ) );  //90% of width, 30% of height.
+    container.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.9, 0.3, 0.0 ) );  //90% of width, 30% of height.
     container.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     container.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
     layer.Add( container );
@@ -650,7 +648,7 @@ public:
         Quaternion rotation = Quaternion( Radian( mRotation.x ), Vector3::XAXIS) *
                               Quaternion( Radian( mRotation.y ), Vector3::YAXIS);
 
-        mModel.SetOrientation( rotation );
+        mModel.SetProperty( Actor::Property::ORIENTATION, rotation );
 
         break;
       }
@@ -678,7 +676,7 @@ public:
   //If escape or the back button is pressed, quit the application (and return to the launcher)
   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 ) )
       {