X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fweb-view%2Fweb-view-example.cpp;h=7d48243f235f6af11e0e7610d6e5f8c85a20e9d1;hb=1a473d5189ca7e7d55aca3a64a8a4ff2dc3b6c67;hp=f3936abf239f8a113b96393ab006e3fee83fb3f8;hpb=37a13b8c501f11961832d7b7eda8351382d835af;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/web-view/web-view-example.cpp b/examples/web-view/web-view-example.cpp index f3936ab..7d48243 100644 --- a/examples/web-view/web-view-example.cpp +++ b/examples/web-view/web-view-example.cpp @@ -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. @@ -18,7 +18,6 @@ #include #include "dali-toolkit/devel-api/controls/web-view/web-view.h" #include -#include using namespace Dali; @@ -58,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 ); } @@ -101,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" ); @@ -115,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 ) ) {