Changes after TouchedSignal changes
[platform/core/uifw/dali-demo.git] / examples / web-view / web-view-example.cpp
index eb9af25..7d48243 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 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.
@@ -57,36 +57,36 @@ 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( Vector4(0.2, 0.6, 1, 1) );
+    // Get a handle to the window
+    Window window = application.GetWindow();
+    window.SetBackgroundColor( Vector4(0.2, 0.6, 1, 1) );
 
-    float width = stage.GetSize().width;
-    float height = stage.GetSize().height;
+    float width = window.GetSize().GetWidth();
+    float height = window.GetSize().GetHeight();
     float fontSize = width * 0.02f;
 
     mWebView = Toolkit::WebView::New( "ko-KR", "Asia/Seoul" );
-    mWebView.SetParentOrigin( Dali::ParentOrigin::CENTER );
-    mWebView.SetAnchorPoint( Dali::AnchorPoint::CENTER );
-    mWebView.SetPosition( 0, 0 );
-    mWebView.SetSize( width, height );
+    mWebView.SetProperty( Actor::Property::PARENT_ORIGIN, Dali::ParentOrigin::CENTER );
+    mWebView.SetProperty( Actor::Property::ANCHOR_POINT, Dali::AnchorPoint::CENTER );
+    mWebView.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
+    mWebView.SetProperty( Actor::Property::SIZE, Vector2( width, height ) );
     mWebView.PageLoadStartedSignal().Connect( this, &WebViewController::OnPageLoadStarted );
     mWebView.PageLoadFinishedSignal().Connect( this, &WebViewController::OnPageLoadFinished );
 
     std::string url = GetNextUrl();
     mWebView.LoadUrl( url );
-    stage.Add(mWebView);
+    window.Add(mWebView);
 
     mAddressLabel = Toolkit::TextLabel::New( url );
-    mAddressLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+    mAddressLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
     mAddressLabel.SetProperty( Toolkit::TextLabel::Property::POINT_SIZE, fontSize );
     mAddressLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
     mAddressLabel.SetBackgroundColor( Vector4( 0, 0, 0, 0.5f ) );
     mAddressLabel.TouchedSignal().Connect( this, &WebViewController::OnTouchText );
-    stage.Add( mAddressLabel );
+    window.Add( mAddressLabel );
 
     // Respond to key events
-    stage.KeyEventSignal().Connect( this, &WebViewController::OnKeyEvent );
+    window.KeyEventSignal().Connect( this, &WebViewController::OnKeyEvent );
     Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor( mWebView );
   }
 
@@ -100,9 +100,9 @@ public:
     mAddressLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, url.c_str() );
   }
 
-  bool OnTouchText( Actor actor, const TouchEvent& event )
+  bool OnTouchText( Actor actor, const TouchEvent& touch )
   {
-    if ( event.GetPoint( 0 ).state == TouchPoint::Up )
+    if ( touch.GetState( 0 ) == PointState::UP )
     {
       std::string url = GetNextUrl();
       mAddressLabel.SetProperty(Toolkit::TextLabel::Property::TEXT, "Waiting" );
@@ -114,7 +114,7 @@ public:
 
   void OnKeyEvent( const KeyEvent& event )
   {
-    if( event.state == KeyEvent::Down )
+    if( event.GetState() == KeyEvent::DOWN )
     {
       if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
       {