Changes after TouchedSignal changes
[platform/core/uifw/dali-demo.git] / examples / bezier-curve / bezier-curve-example.cpp
index b3e5a16..07eb159 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.
@@ -149,22 +149,19 @@ public:
   // The Init signal is received once (only) during the Application lifetime
   void Create( Application& application )
   {
-    // Hide the indicator bar
-    application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
+    Window window = mApplication.GetWindow();
+    window.KeyEventSignal().Connect( this, &BezierCurveExample::OnKeyEvent );
 
-    Stage stage = Stage::GetCurrent();
-    stage.KeyEventSignal().Connect( this, &BezierCurveExample::OnKeyEvent );
-
-    CreateBackground(stage);
+    CreateBackground(window);
 
     mControlPointScale = 0.5f;
     mControlPointZoomScale = mControlPointScale * 2.0f;
 
     mContentLayer = Layer::New();
     mContentLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-    mContentLayer.TouchSignal().Connect(this, &BezierCurveExample::OnTouchLayer);
+    mContentLayer.TouchedSignal().Connect(this, &BezierCurveExample::OnTouchLayer);
     mContentLayer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
-    stage.Add( mContentLayer );
+    window.Add( mContentLayer );
 
     // 6 rows: title, grid, coords, play, anim1, anim2
     TableView contentLayout = TableView::New(5, 1);
@@ -278,7 +275,7 @@ public:
     UpdateCurve();
   }
 
-  void CreateBackground( Stage stage )
+  void CreateBackground( Window window )
   {
     Toolkit::Control background = Dali::Toolkit::Control::New();
     background.SetProperty( Actor::Property::ANCHOR_POINT, Dali::AnchorPoint::CENTER );
@@ -289,7 +286,7 @@ public:
     map.Insert( Visual::Property::TYPE,  Visual::COLOR );
     map.Insert( ColorVisual::Property::MIX_COLOR, Vector4( 253/255.0f, 245/255.0f, 230/255.0f, 1.0f ) );
     background.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
-    stage.Add( background );
+    window.Add( background );
   }
 
   void CreateCubic(Actor parent)
@@ -303,7 +300,7 @@ public:
 
     Property::Map curveVertexFormat;
     curveVertexFormat["aPosition"] = Property::VECTOR2;
-    mCurveVertices = PropertyBuffer::New( curveVertexFormat );
+    mCurveVertices = VertexBuffer::New( curveVertexFormat );
     Vector2 vertexData[2] = { Vector2(-0.5f, 0.5f), Vector2( 0.5f, -0.5f ) };
     mCurveVertices.SetData( vertexData, 2 );
 
@@ -333,11 +330,11 @@ public:
     constraint.AddSource( Source( parent, Actor::Property::SIZE ) );
     constraint.Apply();
 
-    actor.TouchSignal().Connect(this, &BezierCurveExample::OnTouchControlPoint);
+    actor.TouchedSignal().Connect(this, &BezierCurveExample::OnTouchControlPoint);
     return actor;
   }
 
-  Actor CreateControlLine( PropertyBuffer vertexBuffer )
+  Actor CreateControlLine( VertexBuffer vertexBuffer )
   {
     Actor line = Actor::New();
     line.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
@@ -367,8 +364,8 @@ public:
 
     Property::Map lineVertexFormat;
     lineVertexFormat["aPosition"] = Property::VECTOR2;
-    mLine1Vertices = PropertyBuffer::New( lineVertexFormat );
-    mLine2Vertices = PropertyBuffer::New( lineVertexFormat );
+    mLine1Vertices = VertexBuffer::New( lineVertexFormat );
+    mLine2Vertices = VertexBuffer::New( lineVertexFormat );
 
     mControlLine1 = CreateControlLine( mLine1Vertices );
     mControlLine2 = CreateControlLine( mLine2Vertices );
@@ -495,7 +492,7 @@ public:
     }
   }
 
-  bool OnTouchControlPoint( Actor controlPoint, const TouchData& event )
+  bool OnTouchControlPoint( Actor controlPoint, const TouchEvent& event )
   {
     if( event.GetPointCount() > 0 )
     {
@@ -513,7 +510,7 @@ public:
     return false; // Don't mark this as consumed - let the layer get the touch
   }
 
-  bool OnTouchLayer( Actor actor, const TouchData& event )
+  bool OnTouchLayer( Actor actor, const TouchEvent& event )
   {
     if( event.GetPointCount() > 0 )
     {
@@ -576,7 +573,7 @@ public:
   void OnKeyEvent(const KeyEvent& event)
   {
 
-    if( event.state == KeyEvent::Down && (IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ))  )
+    if( event.GetState() == KeyEvent::DOWN && (IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ))  )
     {
       mApplication.Quit();
     }
@@ -598,9 +595,9 @@ private:
   Timer mTimer;
   Animation mDragAnimation;
   Animation mBezierAnimation;
-  PropertyBuffer mCurveVertices;
-  PropertyBuffer mLine1Vertices;
-  PropertyBuffer mLine2Vertices;
+  VertexBuffer mCurveVertices;
+  VertexBuffer mLine1Vertices;
+  VertexBuffer mLine2Vertices;
   Vector2 mRelativeDragPoint;
   Vector2 mLastControlPointPosition1;
   Vector2 mLastControlPointPosition2;