Support scroll in web engine.
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / web-engine.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/devel-api/adaptor-framework/web-engine.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/web-engine/common/web-engine-impl.h>
23
24 namespace Dali
25 {
26 WebEngine::WebEngine()
27 {
28 }
29
30 WebEngine::WebEngine(Internal::Adaptor::WebEngine* internal)
31 : BaseHandle(internal)
32 {
33 }
34
35 WebEngine::~WebEngine()
36 {
37 }
38
39 WebEngine WebEngine::New()
40 {
41   Internal::Adaptor::WebEnginePtr engine = Internal::Adaptor::WebEngine::New();
42
43   return WebEngine(engine.Get());
44 }
45
46 WebEngine::WebEngine(const WebEngine& webEngine)
47 : BaseHandle(webEngine)
48 {
49 }
50
51 WebEngine& WebEngine::operator=(const WebEngine& webEngine)
52 {
53   if(*this != webEngine)
54   {
55     BaseHandle::operator=(webEngine);
56   }
57   return *this;
58 }
59
60 WebEngine WebEngine::DownCast(BaseHandle handle)
61 {
62   return WebEngine(dynamic_cast<Internal::Adaptor::WebEngine*>(handle.GetObjectPtr()));
63 }
64
65 void WebEngine::Create(int width, int height, const std::string& locale, const std::string& timezoneId)
66 {
67   GetImplementation(*this).Create(width, height, locale, timezoneId);
68 }
69
70 void WebEngine::Destroy()
71 {
72   GetImplementation(*this).Destroy();
73 }
74
75 NativeImageInterfacePtr WebEngine::GetNativeImageSource()
76 {
77   return GetImplementation(*this).GetNativeImageSource();
78 }
79
80 void WebEngine::LoadUrl(const std::string& url)
81 {
82   return GetImplementation(*this).LoadUrl(url);
83 }
84
85 const std::string& WebEngine::GetUrl()
86 {
87   return GetImplementation(*this).GetUrl();
88 }
89
90 void WebEngine::LoadHTMLString(const std::string& htmlString)
91 {
92   GetImplementation(*this).LoadHTMLString(htmlString);
93 }
94
95 void WebEngine::Reload()
96 {
97   GetImplementation(*this).Reload();
98 }
99
100 void WebEngine::StopLoading()
101 {
102   GetImplementation(*this).StopLoading();
103 }
104
105 void WebEngine::Suspend()
106 {
107   GetImplementation(*this).Suspend();
108 }
109
110 void WebEngine::Resume()
111 {
112   GetImplementation(*this).Resume();
113 }
114
115 void WebEngine::ScrollBy( int deltaX, int deltaY )
116 {
117   GetImplementation( *this ).ScrollBy( deltaX, deltaY );
118 }
119
120 void WebEngine::SetScrollPosition( int x, int y )
121 {
122   GetImplementation( *this ).SetScrollPosition( x, y );
123 }
124
125 void WebEngine::GetScrollPosition( int& x, int& y ) const
126 {
127   GetImplementation( *this ).GetScrollPosition( x, y );
128 }
129
130 void WebEngine::GetScrollSize( int& width, int& height ) const
131 {
132   GetImplementation( *this ).GetScrollSize( width, height );
133 }
134
135 void WebEngine::GetContentSize( int& width, int& height ) const
136 {
137   GetImplementation( *this ).GetContentSize( width, height );
138 }
139
140 bool WebEngine::CanGoForward()
141 {
142   return GetImplementation(*this).CanGoForward();
143 }
144
145 void WebEngine::GoForward()
146 {
147   GetImplementation(*this).GoForward();
148 }
149
150 bool WebEngine::CanGoBack()
151 {
152   return GetImplementation(*this).CanGoBack();
153 }
154
155 void WebEngine::GoBack()
156 {
157   GetImplementation(*this).GoBack();
158 }
159
160 void WebEngine::EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler)
161 {
162   GetImplementation(*this).EvaluateJavaScript(script, resultHandler);
163 }
164
165 void WebEngine::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler)
166 {
167   GetImplementation(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
168 }
169
170 void WebEngine::ClearHistory()
171 {
172   return GetImplementation(*this).ClearHistory();
173 }
174
175 void WebEngine::ClearCache()
176 {
177   return GetImplementation(*this).ClearCache();
178 }
179
180 void WebEngine::ClearCookies()
181 {
182   return GetImplementation(*this).ClearCookies();
183 }
184
185 Dali::WebEnginePlugin::CacheModel WebEngine::GetCacheModel() const
186 {
187   return GetImplementation(*this).GetCacheModel();
188 }
189
190 void WebEngine::SetCacheModel(Dali::WebEnginePlugin::CacheModel cacheModel)
191 {
192   GetImplementation(*this).SetCacheModel(cacheModel);
193 }
194
195 Dali::WebEnginePlugin::CookieAcceptPolicy WebEngine::GetCookieAcceptPolicy() const
196 {
197   return GetImplementation(*this).GetCookieAcceptPolicy();
198 }
199
200 void WebEngine::SetCookieAcceptPolicy(Dali::WebEnginePlugin::CookieAcceptPolicy policy)
201 {
202   GetImplementation(*this).SetCookieAcceptPolicy(policy);
203 }
204
205 const std::string& WebEngine::GetUserAgent() const
206 {
207   return GetImplementation(*this).GetUserAgent();
208 }
209
210 void WebEngine::SetUserAgent(const std::string& userAgent)
211 {
212   GetImplementation(*this).SetUserAgent(userAgent);
213 }
214
215 bool WebEngine::IsJavaScriptEnabled() const
216 {
217   return GetImplementation(*this).IsJavaScriptEnabled();
218 }
219
220 void WebEngine::EnableJavaScript(bool enabled)
221 {
222   GetImplementation(*this).EnableJavaScript(enabled);
223 }
224
225 bool WebEngine::AreImagesAutomaticallyLoaded() const
226 {
227   return GetImplementation(*this).AreImagesAutomaticallyLoaded();
228 }
229
230 void WebEngine::LoadImagesAutomatically(bool automatic)
231 {
232   GetImplementation(*this).LoadImagesAutomatically(automatic);
233 }
234
235 const std::string& WebEngine::GetDefaultTextEncodingName() const
236 {
237   return GetImplementation(*this).GetDefaultTextEncodingName();
238 }
239
240 void WebEngine::SetDefaultTextEncodingName(const std::string& defaultTextEncodingName)
241 {
242   GetImplementation(*this).SetDefaultTextEncodingName(defaultTextEncodingName);
243 }
244
245 int WebEngine::GetDefaultFontSize() const
246 {
247   return GetImplementation(*this).GetDefaultFontSize();
248 }
249
250 void WebEngine::SetDefaultFontSize(int defaultFontSize)
251 {
252   GetImplementation(*this).SetDefaultFontSize(defaultFontSize);
253 }
254
255 void WebEngine::SetSize(int width, int height)
256 {
257   return GetImplementation(*this).SetSize(width, height);
258 }
259
260 bool WebEngine::SendTouchEvent(const TouchEvent& touch)
261 {
262   return GetImplementation(*this).SendTouchEvent(touch);
263 }
264
265 bool WebEngine::SendKeyEvent(const KeyEvent& event)
266 {
267   return GetImplementation(*this).SendKeyEvent(event);
268 }
269
270 void WebEngine::SetFocus( bool focused )
271 {
272   GetImplementation( *this ).SetFocus( focused );
273 }
274
275 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal()
276 {
277   return GetImplementation(*this).PageLoadStartedSignal();
278 }
279
280 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadFinishedSignal()
281 {
282   return GetImplementation(*this).PageLoadFinishedSignal();
283 }
284
285 Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErrorSignal()
286 {
287   return GetImplementation(*this).PageLoadErrorSignal();
288 }
289
290 Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& WebEngine::ScrollEdgeReachedSignal()
291 {
292   return GetImplementation( *this ).ScrollEdgeReachedSignal();
293 }
294
295 } // namespace Dali