Support scroll in web view.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / web-view / web-view.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali-toolkit/devel-api/controls/web-view/web-view.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/internal/controls/web-view/web-view-impl.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 WebView::WebView()
29 {
30 }
31
32 WebView::WebView(const WebView& WebView)
33 : Control(WebView)
34 {
35 }
36
37 WebView& WebView::operator=(const WebView& view)
38 {
39   if(&view != this)
40   {
41     Control::operator=(view);
42   }
43
44   return *this;
45 }
46
47 WebView::~WebView()
48 {
49 }
50
51 WebView WebView::New()
52 {
53   return Internal::WebView::New();
54 }
55
56 WebView WebView::New(const std::string& locale, const std::string& timezoneId)
57 {
58   return Internal::WebView::New(locale, timezoneId);
59 }
60
61 WebView WebView::DownCast(BaseHandle handle)
62 {
63   return Control::DownCast<WebView, Internal::WebView>(handle);
64 }
65
66 void WebView::LoadUrl(const std::string& url)
67 {
68   Dali::Toolkit::GetImpl(*this).LoadUrl(url);
69 }
70
71 void WebView::LoadHTMLString(const std::string& htmlString)
72 {
73   Dali::Toolkit::GetImpl(*this).LoadHTMLString(htmlString);
74 }
75
76 void WebView::Reload()
77 {
78   Dali::Toolkit::GetImpl(*this).Reload();
79 }
80
81 void WebView::StopLoading()
82 {
83   Dali::Toolkit::GetImpl(*this).StopLoading();
84 }
85
86 void WebView::Suspend()
87 {
88   Dali::Toolkit::GetImpl(*this).Suspend();
89 }
90
91 void WebView::Resume()
92 {
93   Dali::Toolkit::GetImpl(*this).Resume();
94 }
95
96 void WebView::ScrollBy( int deltaX, int deltaY )
97 {
98   Dali::Toolkit::GetImpl( *this ).ScrollBy( deltaX, deltaY );
99 }
100
101 bool WebView::CanGoForward()
102 {
103   return Dali::Toolkit::GetImpl(*this).CanGoForward();
104 }
105
106 void WebView::GoForward()
107 {
108   Dali::Toolkit::GetImpl(*this).GoForward();
109 }
110
111 bool WebView::CanGoBack()
112 {
113   return Dali::Toolkit::GetImpl(*this).CanGoBack();
114 }
115
116 void WebView::GoBack()
117 {
118   Dali::Toolkit::GetImpl(*this).GoBack();
119 }
120
121 void WebView::EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler)
122 {
123   Dali::Toolkit::GetImpl(*this).EvaluateJavaScript(script, resultHandler);
124 }
125
126 void WebView::EvaluateJavaScript(const std::string& script)
127 {
128   Dali::Toolkit::GetImpl(*this).EvaluateJavaScript(script, nullptr);
129 }
130
131 void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler)
132 {
133   Dali::Toolkit::GetImpl(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
134 }
135
136 void WebView::ClearHistory()
137 {
138   Dali::Toolkit::GetImpl(*this).ClearHistory();
139 }
140
141 void WebView::ClearCache()
142 {
143   Dali::Toolkit::GetImpl(*this).ClearCache();
144 }
145
146 void WebView::ClearCookies()
147 {
148   Dali::Toolkit::GetImpl(*this).ClearCookies();
149 }
150
151 WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
152 {
153   return Dali::Toolkit::GetImpl(*this).PageLoadStartedSignal();
154 }
155
156 WebView::WebViewPageLoadSignalType& WebView::PageLoadFinishedSignal()
157 {
158   return Dali::Toolkit::GetImpl(*this).PageLoadFinishedSignal();
159 }
160
161 WebView::WebViewPageLoadErrorSignalType& WebView::PageLoadErrorSignal()
162 {
163   return Dali::Toolkit::GetImpl(*this).PageLoadErrorSignal();
164 }
165
166 WebView::WebViewScrollEdgeReachedSignalType& WebView::ScrollEdgeReachedSignal()
167 {
168   return Dali::Toolkit::GetImpl( *this ).ScrollEdgeReachedSignal();
169 }
170
171 WebView::WebView(Internal::WebView& implementation)
172 : Control(implementation)
173 {
174 }
175
176 WebView::WebView(Dali::Internal::CustomActor* internal)
177 : Control(internal)
178 {
179   VerifyCustomActorPointer<Internal::WebView>(internal);
180 }
181
182 } // namespace Toolkit
183
184 } // namespace Dali