1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<!-- THIS FILE IS GENERATED DO NOT EDIT -->
<erlref>
<header>
<copyright>
<year>2020</year>
<holder>wxWidgets team.</holder></copyright>
<legalnotice>Licensed under the wxWindows Free Documentation Licence, Version 3
</legalnotice>
<title>wxWebView</title>
</header>
<module>wxWebView</module>
<modulesummary>Functions for wxWebView class</modulesummary>
<description><p>This control may be used to render web (HTML / CSS / javascript) documents. It is designed to allow the creation of multiple backends for each port, although currently just one is available. It differs from <seeerl marker="wxHtmlWindow"><c>wxHtmlWindow</c></seeerl> in that each backend is actually a full rendering engine, Trident on MSW and Webkit on macOS and GTK. This allows the correct viewing of complex pages with javascript and css.
</p><p>Backend Descriptions</p> <p>Par: The IE backend uses Microsoft's Trident rendering engine, specifically the version used by the locally installed copy of Internet Explorer. As such it is only available for the MSW port. By default recent versions of the <url href="http://msdn.microsoft.com/en-us/library/aa752085%28v=VS.85%29.aspx">WebBrowser</url> control, which this backend uses, emulate Internet Explorer 7. This can be changed with a registry setting by wxWebView::MSWSetEmulationLevel() see <url href="http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation">this</url> article for more information. This backend has full support for custom schemes and virtual file systems.
</p><p>Par: The Edge (Chromium) backend uses Microsoft's <url href="https://docs.microsoft.com/en-us/microsoft-edge/hosting/webview2">Edge WebView2</url>. It is available for Windows 7 and newer. The following features are currently unsupported with this backend: virtual filesystems, custom urls, find.
</p><p> This backend is not enabled by default, to build it follow these steps:
</p><p>Par: Under GTK the WebKit backend uses <url href="http://webkitgtk.org/">WebKitGTK+</url>. The current minimum version required is 1.3.1 which ships by default with Ubuntu Natty and Debian Wheezy and has the package name libwebkitgtk-dev. Custom schemes and virtual files systems are supported under this backend, however embedded resources such as images and stylesheets are currently loaded using the data:// scheme.
</p><p>Par: Under GTK3 the WebKit2 version of <url href="http://webkitgtk.org/">WebKitGTK+</url> is used. In Ubuntu the required package name is libwebkit2gtk-4.0-dev and under Fedora it is webkitgtk4-devel. All wxWEBVIEW_WEBKIT features are supported except for clearing and enabling / disabling the history.
</p><p>Par: The macOS WebKit backend uses Apple's <url href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/WebKit/Classes/WebView_Class/Reference/Reference.html#//apple_ref/doc/uid/20001903">WebView</url> class. This backend has full support for custom schemes and virtual file systems.
</p><p>Asynchronous Notifications</p> <p>Many of the methods in <seeerl marker="wxWebView"><c>wxWebView</c></seeerl> are asynchronous, i.e. they return immediately and perform their work in the background. This includes functions such as <seemfa marker="#loadURL/2"><c>loadURL/2</c></seemfa> and <seemfa marker="#reload/2"><c>reload/2</c></seemfa>. To receive notification of the progress and completion of these functions you need to handle the events that are provided. Specifically <c>wxEVT_WEBVIEW_LOADED</c> notifies when the page or a sub-frame has finished loading and <c>wxEVT_WEBVIEW_ERROR</c> notifies that an error has occurred.
</p><p>Virtual File Systems and Custom Schemes</p> <p><seeerl marker="wxWebView"><c>wxWebView</c></seeerl> supports the registering of custom scheme handlers, for example <c>file</c> or <c>http</c>. To do this create a new class which inherits from <c>wxWebViewHandler</c> (not implemented in wx), where wxWebHandler::GetFile() returns a pointer to a <c>wxFSFile</c> (not implemented in wx) which represents the given url. You can then register your handler with <c>RegisterHandler()</c> (not implemented in wx) it will be called for all pages and resources.
</p> <p><c>wxWebViewFSHandler</c> (not implemented in wx) is provided to access the virtual file system encapsulated by <c>wxFileSystem</c> (not implemented in wx). The <c>wxMemoryFSHandler</c> (not implemented in wx) documentation gives an example of how this may be used.
</p> <p><c>wxWebViewArchiveHandler</c> (not implemented in wx) is provided to allow the navigation of pages inside a zip archive. It supports paths of the form: <c>scheme:///C</c>:/example/docs.zip;protocol=zip/main.htm
</p> <p>Since: 2.9.3
</p><p>See: <c>wxWebViewHandler</c> (not implemented in wx), <seeerl marker="wxWebViewEvent"><c>wxWebViewEvent</c></seeerl>
</p>
<p>This class is derived (and can use functions) from:
<seeerl marker="wxControl"><c>wxControl</c></seeerl> <seeerl marker="wxWindow"><c>wxWindow</c></seeerl> <seeerl marker="wxEvtHandler"><c>wxEvtHandler</c></seeerl></p>
<p>wxWidgets docs: <url href="https://docs.wxwidgets.org/3.1/classwx_web_view.html">wxWebView</url></p>
</description><section><title>Events</title><p>Event types emitted from this class: <seeerl marker="wxWebViewEvent"><c>webview_navigating</c></seeerl>, <seeerl marker="wxWebViewEvent"><c>webview_navigated</c></seeerl>, <seeerl marker="wxWebViewEvent"><c>webview_loaded</c></seeerl>, <seeerl marker="wxWebViewEvent"><c>webview_error</c></seeerl>, <seeerl marker="wxWebViewEvent"><c>webview_newwindow</c></seeerl>, <seeerl marker="wxWebViewEvent"><c>webview_title_changed</c></seeerl></p></section>
<datatypes><datatype><name name="wxWebView"/></datatype></datatypes>
<funcs>
<func>
<name name="new" arity="2" clause_i="1" since=""/>
<fsummary>See: <c>new/3</c></fsummary>
</func>
<func>
<name name="new" arity="3" clause_i="1" since=""/>
<fsummary>Factory function to create a new <c>wxWebView</c> using a <c>wxWebViewFactory</c> (not implemented in wx). </fsummary>
<desc><p>Factory function to create a new <seeerl marker="wxWebView"><c>wxWebView</c></seeerl> using a <c>wxWebViewFactory</c> (not implemented in wx).
</p><p>Return: The created <seeerl marker="wxWebView"><c>wxWebView</c></seeerl>, or <c>NULL</c> if the requested backend is not available
</p><p>Since: 2.9.5
</p></desc>
</func>
<func>
<name name="getCurrentTitle" arity="1" clause_i="1" since=""/>
<fsummary>Get the title of the current web page, or its URL/path if title is not available. </fsummary>
<desc><p>Get the title of the current web page, or its URL/path if title is not available.
</p></desc>
</func>
<func>
<name name="getCurrentURL" arity="1" clause_i="1" since=""/>
<fsummary>Get the URL of the currently displayed document. </fsummary>
<desc><p>Get the URL of the currently displayed document.
</p></desc>
</func>
<func>
<name name="getPageSource" arity="1" clause_i="1" since=""/>
<fsummary>Get the HTML source code of the currently displayed document. </fsummary>
<desc><p>Get the HTML source code of the currently displayed document.
</p><p>Return: The HTML source code, or an empty string if no page is currently shown.
</p></desc>
</func>
<func>
<name name="getPageText" arity="1" clause_i="1" since=""/>
<fsummary>Get the text of the current page. </fsummary>
<desc><p>Get the text of the current page.
</p></desc>
</func>
<func>
<name name="isBusy" arity="1" clause_i="1" since=""/>
<fsummary>Returns whether the web control is currently busy (e.g. loading a page). </fsummary>
<desc><p>Returns whether the web control is currently busy (e.g. loading a page).
</p></desc>
</func>
<func>
<name name="isEditable" arity="1" clause_i="1" since=""/>
<fsummary>Returns whether the web control is currently editable. </fsummary>
<desc><p>Returns whether the web control is currently editable.
</p></desc>
</func>
<func>
<name name="loadURL" arity="2" clause_i="1" since=""/>
<fsummary>Load a web page from a URL. </fsummary>
<desc><p>Load a web page from a URL.
</p><p>Note: Web engines generally report errors asynchronously, so if you wish to know whether loading the URL was successful, register to receive navigation error events.
</p></desc>
</func>
<func>
<name name="print" arity="1" clause_i="1" since=""/>
<fsummary>Opens a print dialog so that the user may print the currently displayed page. </fsummary>
<desc><p>Opens a print dialog so that the user may print the currently displayed page.
</p></desc>
</func>
<func>
<name name="reload" arity="1" clause_i="1" since=""/>
<fsummary>See: <c>reload/2</c></fsummary>
</func>
<func>
<name name="reload" arity="2" clause_i="1" since=""/>
<fsummary>Reload the currently displayed URL. </fsummary>
<desc><p>Reload the currently displayed URL.
</p><p>Note: The flags are ignored by the edge backend.
</p></desc>
</func>
<func>
<name name="runScript" arity="2" clause_i="1" since=""/>
<fsummary>Runs the given JavaScript code. </fsummary>
<desc><p>Runs the given JavaScript code.
</p><p>JavaScript code is executed inside the browser control and has full access to DOM and other browser-provided functionality. For example, this code will replace the current page contents with the provided string.
</p><p>If <c>output</c> is non-null, it is filled with the result of executing this code on success, e.g. a JavaScript value such as a string, a number (integer or floating point), a boolean or JSON representation for non-primitive types such as arrays and objects. For example:
</p><p>This function has a few platform-specific limitations:
</p><p>Also notice that under MSW converting JavaScript objects to JSON is not supported in the default emulation mode. <seeerl marker="wxWebView"><c>wxWebView</c></seeerl> implements its own object-to-JSON conversion as a fallback for this case, however it is not as full-featured, well-tested or performing as the implementation of this functionality in the browser control itself, so it is recommended to use MSWSetEmulationLevel() to change emulation level to a more modern one in which JSON conversion is done by the control itself.
</p><p>Return: true if there is a result, false if there is an error.
</p></desc>
</func>
<func>
<name name="setEditable" arity="1" clause_i="1" since=""/>
<fsummary>See: <c>setEditable/2</c></fsummary>
</func>
<func>
<name name="setEditable" arity="2" clause_i="1" since=""/>
<fsummary>Set the editable property of the web control. </fsummary>
<desc><p>Set the editable property of the web control.
</p><p>Enabling allows the user to edit the page even if the <c>contenteditable</c> attribute is not set. The exact capabilities vary with the backend being used.
</p></desc>
</func>
<func>
<name name="setPage" arity="3" clause_i="1" since=""/>
<fsummary>Set the displayed page source to the contents of the given string. </fsummary>
<desc><p>Set the displayed page source to the contents of the given string.
</p><p>Note: When using <c>wxWEBVIEW_BACKEND_IE</c> you must wait for the current page to finish loading before calling <seemfa marker="#setPage/3"><c>setPage/3</c></seemfa>. The baseURL parameter is not used in this backend and the edge backend.
</p></desc>
</func>
<func>
<name name="stop" arity="1" clause_i="1" since=""/>
<fsummary>Stop the current page loading process, if any. </fsummary>
<desc><p>Stop the current page loading process, if any.
</p><p>May trigger an error event of type <c>wxWEBVIEW_NAV_ERR_USER_CANCELLED</c>. TODO: make <c>wxWEBVIEW_NAV_ERR_USER_CANCELLED</c> errors uniform across ports.
</p></desc>
</func>
<func>
<name name="canCopy" arity="1" clause_i="1" since=""/>
<fsummary>Returns true if the current selection can be copied. </fsummary>
<desc><p>Returns true if the current selection can be copied.
</p><p>Note: This always returns <c>true</c> on the macOS WebKit backend.
</p></desc>
</func>
<func>
<name name="canCut" arity="1" clause_i="1" since=""/>
<fsummary>Returns true if the current selection can be cut. </fsummary>
<desc><p>Returns true if the current selection can be cut.
</p><p>Note: This always returns <c>true</c> on the macOS WebKit backend.
</p></desc>
</func>
<func>
<name name="canPaste" arity="1" clause_i="1" since=""/>
<fsummary>Returns true if data can be pasted. </fsummary>
<desc><p>Returns true if data can be pasted.
</p><p>Note: This always returns <c>true</c> on the macOS WebKit backend.
</p></desc>
</func>
<func>
<name name="copy" arity="1" clause_i="1" since=""/>
<fsummary>Copies the current selection. </fsummary>
<desc><p>Copies the current selection.
</p></desc>
</func>
<func>
<name name="cut" arity="1" clause_i="1" since=""/>
<fsummary>Cuts the current selection. </fsummary>
<desc><p>Cuts the current selection.
</p></desc>
</func>
<func>
<name name="paste" arity="1" clause_i="1" since=""/>
<fsummary>Pastes the current data. </fsummary>
<desc><p>Pastes the current data.
</p></desc>
</func>
<func>
<name name="enableContextMenu" arity="1" clause_i="1" since=""/>
<fsummary>See: <c>enableContextMenu/2</c></fsummary>
</func>
<func>
<name name="enableContextMenu" arity="2" clause_i="1" since=""/>
<fsummary>Enable or disable the right click context menu. </fsummary>
<desc><p>Enable or disable the right click context menu.
</p><p>By default the standard context menu is enabled, this method can be used to disable it or re-enable it later.
</p><p>Since: 2.9.5
</p></desc>
</func>
<func>
<name name="isContextMenuEnabled" arity="1" clause_i="1" since=""/>
<fsummary>Returns true if a context menu will be shown on right click. </fsummary>
<desc><p>Returns true if a context menu will be shown on right click.
</p><p>Since: 2.9.5
</p></desc>
</func>
<func>
<name name="canGoBack" arity="1" clause_i="1" since=""/>
<fsummary>Returns true if it is possible to navigate backward in the history of visited pages. </fsummary>
<desc><p>Returns true if it is possible to navigate backward in the history of visited pages.
</p></desc>
</func>
<func>
<name name="canGoForward" arity="1" clause_i="1" since=""/>
<fsummary>Returns true if it is possible to navigate forward in the history of visited pages. </fsummary>
<desc><p>Returns true if it is possible to navigate forward in the history of visited pages.
</p></desc>
</func>
<func>
<name name="clearHistory" arity="1" clause_i="1" since=""/>
<fsummary>Clear the history, this will also remove the visible page. </fsummary>
<desc><p>Clear the history, this will also remove the visible page.
</p><p>Note: This is not implemented on the WebKit2GTK+ backend.
</p></desc>
</func>
<func>
<name name="enableHistory" arity="1" clause_i="1" since=""/>
<fsummary>See: <c>enableHistory/2</c></fsummary>
</func>
<func>
<name name="enableHistory" arity="2" clause_i="1" since=""/>
<fsummary>Enable or disable the history. </fsummary>
<desc><p>Enable or disable the history.
</p><p>This will also clear the history.
</p><p>Note: This is not implemented on the WebKit2GTK+ backend.
</p></desc>
</func>
<func>
<name name="goBack" arity="1" clause_i="1" since=""/>
<fsummary>Navigate back in the history of visited pages. </fsummary>
<desc><p>Navigate back in the history of visited pages.
</p><p>Only valid if <seemfa marker="#canGoBack/1"><c>canGoBack/1</c></seemfa> returns true.
</p></desc>
</func>
<func>
<name name="goForward" arity="1" clause_i="1" since=""/>
<fsummary>Navigate forward in the history of visited pages. </fsummary>
<desc><p>Navigate forward in the history of visited pages.
</p><p>Only valid if <seemfa marker="#canGoForward/1"><c>canGoForward/1</c></seemfa> returns true.
</p></desc>
</func>
<func>
<name name="clearSelection" arity="1" clause_i="1" since=""/>
<fsummary>Clears the current selection. </fsummary>
<desc><p>Clears the current selection.
</p></desc>
</func>
<func>
<name name="deleteSelection" arity="1" clause_i="1" since=""/>
<fsummary>Deletes the current selection. </fsummary>
<desc><p>Deletes the current selection.
</p><p>Note that for <c>wxWEBVIEW_BACKEND_WEBKIT</c> the selection must be editable, either through SetEditable or the correct HTML attribute.
</p></desc>
</func>
<func>
<name name="getSelectedSource" arity="1" clause_i="1" since=""/>
<fsummary>Returns the currently selected source, if any. </fsummary>
<desc><p>Returns the currently selected source, if any.
</p></desc>
</func>
<func>
<name name="getSelectedText" arity="1" clause_i="1" since=""/>
<fsummary>Returns the currently selected text, if any. </fsummary>
<desc><p>Returns the currently selected text, if any.
</p></desc>
</func>
<func>
<name name="hasSelection" arity="1" clause_i="1" since=""/>
<fsummary>Returns true if there is a current selection. </fsummary>
<desc><p>Returns true if there is a current selection.
</p></desc>
</func>
<func>
<name name="selectAll" arity="1" clause_i="1" since=""/>
<fsummary>Selects the entire page. </fsummary>
<desc><p>Selects the entire page.
</p></desc>
</func>
<func>
<name name="canRedo" arity="1" clause_i="1" since=""/>
<fsummary>Returns true if there is an action to redo. </fsummary>
<desc><p>Returns true if there is an action to redo.
</p></desc>
</func>
<func>
<name name="canUndo" arity="1" clause_i="1" since=""/>
<fsummary>Returns true if there is an action to undo. </fsummary>
<desc><p>Returns true if there is an action to undo.
</p></desc>
</func>
<func>
<name name="redo" arity="1" clause_i="1" since=""/>
<fsummary>Redos the last action. </fsummary>
<desc><p>Redos the last action.
</p></desc>
</func>
<func>
<name name="undo" arity="1" clause_i="1" since=""/>
<fsummary>Undos the last action. </fsummary>
<desc><p>Undos the last action.
</p></desc>
</func>
<func>
<name name="find" arity="2" clause_i="1" since=""/>
<fsummary>See: <c>find/3</c></fsummary>
</func>
<func>
<name name="find" arity="3" clause_i="1" since=""/>
<fsummary>Finds a phrase on the current page and if found, the control will scroll the phrase into view and select it. </fsummary>
<desc><p>Finds a phrase on the current page and if found, the control will scroll the phrase into view and select it.
</p><p>Return: If search phrase was not found in combination with the flags then <c>wxNOT_FOUND</c> is returned. If called for the first time with search phrase then the total number of results will be returned. Then for every time its called with the same search phrase it will return the number of the current match.
</p><p>Note: This function will restart the search if the flags <c>wxWEBVIEW_FIND_ENTIRE_WORD</c> or <c>wxWEBVIEW_FIND_MATCH_CASE</c> are changed, since this will require a new search. To reset the search, for example resetting the highlights call the function with an empty search phrase. This always returns <c>wxNOT_FOUND</c> on the macOS WebKit backend.
</p><p>Since: 2.9.5
</p></desc>
</func>
<func>
<name name="canSetZoomType" arity="2" clause_i="1" since=""/>
<fsummary>Retrieve whether the current HTML engine supports a zoom type. </fsummary>
<desc><p>Retrieve whether the current HTML engine supports a zoom type.
</p><p>Return: Whether this type of zoom is supported by this HTML engine (and thus can be set through <seemfa marker="#setZoomType/2"><c>setZoomType/2</c></seemfa>).
</p></desc>
</func>
<func>
<name name="getZoom" arity="1" clause_i="1" since=""/>
<fsummary>Get the zoom level of the page. </fsummary>
<desc><p>Get the zoom level of the page.
</p><p>See <seemfa marker="#getZoomFactor/1"><c>getZoomFactor/1</c></seemfa> to get more precise zoom scale value other than as provided by <c>wxWebViewZoom</c>.
</p><p>Return: The current level of zoom.
</p></desc>
</func>
<func>
<name name="getZoomType" arity="1" clause_i="1" since=""/>
<fsummary>Get how the zoom factor is currently interpreted. </fsummary>
<desc><p>Get how the zoom factor is currently interpreted.
</p><p>Return: How the zoom factor is currently interpreted by the HTML engine.
</p></desc>
</func>
<func>
<name name="setZoom" arity="2" clause_i="1" since=""/>
<fsummary>Set the zoom level of the page. </fsummary>
<desc><p>Set the zoom level of the page.
</p><p>See <seemfa marker="#setZoomFactor/2"><c>setZoomFactor/2</c></seemfa> for more precise scaling other than the measured steps provided by <c>wxWebViewZoom</c>.
</p></desc>
</func>
<func>
<name name="setZoomType" arity="2" clause_i="1" since=""/>
<fsummary>Set how to interpret the zoom factor. </fsummary>
<desc><p>Set how to interpret the zoom factor.
</p><p>Note: invoke <seemfa marker="#canSetZoomType/2"><c>canSetZoomType/2</c></seemfa> first, some HTML renderers may not support all zoom types.
</p></desc>
</func>
<func>
<name name="getZoomFactor" arity="1" clause_i="1" since=""/>
<fsummary>Get the zoom factor of the page. </fsummary>
<desc><p>Get the zoom factor of the page.
</p><p>Return: The current factor of zoom.
</p><p>Since: 3.1.4
</p></desc>
</func>
<func>
<name name="setZoomFactor" arity="2" clause_i="1" since=""/>
<fsummary>Set the zoom factor of the page. </fsummary>
<desc><p>Set the zoom factor of the page.
</p><p>Note: zoom scale in IE will be converted into <c>wxWebViewZoom</c> levels for <c>wxWebViewZoomType</c> of <c>wxWEBVIEW_ZOOM_TYPE_TEXT</c>.
</p><p>Since: 3.1.4
</p></desc>
</func>
<func>
<name name="isBackendAvailable" arity="1" clause_i="1" since=""/>
<fsummary>Allows to check if a specific backend is currently available. </fsummary>
<desc><p>Allows to check if a specific backend is currently available.
</p><p>Since: 3.1.4
</p></desc>
</func>
</funcs>
</erlref>
|