Changes after TouchedSignal changes
[platform/core/uifw/dali-demo.git] / examples / web-view / web-view-example.cpp
index 6a54a2c..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,12 +57,12 @@ 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" );
@@ -75,7 +75,7 @@ public:
 
     std::string url = GetNextUrl();
     mWebView.LoadUrl( url );
-    stage.Add(mWebView);
+    window.Add(mWebView);
 
     mAddressLabel = Toolkit::TextLabel::New( url );
     mAddressLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
@@ -83,10 +83,10 @@ public:
     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 ) )
       {