silk/webview
Types
pub type EditableOption {
Enable(Bool)
}
Constructors
-
Enable(Bool)
pub type Option {
Url(String)
Pos(#(Int, Int))
Size(#(Int, Int))
Backend(String)
Style(Int)
}
Constructors
-
Url(String)
-
Pos(#(Int, Int))
-
Size(#(Int, Int))
-
Backend(String)
-
Style(Int)
Functions
pub fn can_copy(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns true if the current selection can be copied.
pub fn can_cut(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns true if the current selection can be cut.
pub fn can_go_back(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns true if it is possible to navigate backward in the history of visited pages.
pub fn can_go_forward(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns true if it is possible to navigate forward in the history of visited pages.
pub fn can_paste(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns true if data can be pasted.
pub fn can_redo(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns true if there is an action to redo.
pub fn can_undo(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns true if there is an action to undo.
pub fn clear_history(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Clear the history, this will also remove the visible page.
pub fn clear_selection(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Clears the current selection.
pub fn copy(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Copies the current selection.
pub fn cut(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Cuts the current selection.
pub fn delete_selection(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Deletes the current selection.
pub fn get_current_title(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> String
Get the title of the current web page, or its URL/path if title is not available.
pub fn get_current_url(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> String
Get the URL of the currently displayed document.
pub fn get_page_source(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> String
Get the HTML source code of the currently displayed document.
Return: The HTML source code, or an empty string if no page is currently shown.
pub fn get_page_text(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> String
Get the text of the current page.
pub fn get_selected_source(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> String
Returns the currently selected source, if any.
pub fn get_selected_text(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> String
Returns the currently selected text, if any.
pub fn go_back(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Navigate back in the history of visited pages.
Only valid if can_go_back
returns true.
pub fn go_forward(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Navigate forward in the history of visited pages.
Only valid if can_go_forward
returns true.
pub fn has_selection(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns true if there is a current selection.
pub fn is_backend_available(backend: String) -> Bool
Allows to check if a specific backend is currently available.
pub fn is_busy(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns whether the web control is currently busy (e.g. loading a page).
pub fn is_context_menu_enabled(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns true if a context menu will be shown on right click.
pub fn is_editable(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Bool
Returns whether the web control is currently editable.
pub fn load_url(
this: WxObject(WxWindow(WxControl(WxWebView))),
url: String,
) -> Result(Nil, Nil)
Load a web page from a URL.
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.
pub fn new(
parent: WxObject(WxWindow(a)),
id: Int,
) -> WxObject(WxWindow(WxControl(WxWebView)))
Equivalent to new3(Parent, Id, [])
.
pub fn new3(
parent: WxObject(WxWindow(a)),
id: Int,
options: List(Option),
) -> WxObject(WxWindow(WxControl(WxWebView)))
Factory function to create a new WxWebView
using a wxWebViewFactory
(not implemented in wx).
Return: The created WxWebView
, or NULL if the requested backend is not available
pub fn paste(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Pastes the current data.
pub fn print(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Opens a print dialog so that the user may print the currently displayed page.
pub fn redo(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Redos the last action.
pub fn reload(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Equivalent to reload2(This, [])
.
pub fn reload2(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Reload the currently displayed URL.
pub fn run_script(
this: WxObject(WxWindow(WxControl(WxWebView))),
javascript: String,
) -> Result(Bool, String)
Runs the given JavaScript code.
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.
If output
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:
This function has a few platform-specific limitations:
- When using WebKit v1 in wxGTK2, retrieving the result of JavaScript execution is unsupported and this function will always return false if output is non-null to indicate this. This functionality is fully supported when using WebKit v2 or later in wxGTK3.
- When using WebKit under macOS, code execution is limited to at most 10MiB of memory and 10 seconds of execution time.
- When using IE backend under MSW, scripts can only be executed when the current page is fully loaded (i.e. wxEVT_WEBVIEW_LOADED event was received). A script tag inside the page HTML is required in order to run JavaScript.
Also notice that under MSW converting JavaScript objects to JSON is not supported in the default emulation mode. wxWebView 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.
Return: true if there is a result, false if there is an error.
pub fn select_all(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Selects the entire page.
pub fn set_editable(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Equivalent to setEditable2(This, [])
.
pub fn set_editable2(
this: WxObject(WxWindow(WxControl(WxWebView))),
option: EditableOption,
) -> Result(Nil, Nil)
Set the editable property of the web control.
Enabling allows the user to edit the page even if the contenteditable attribute is not set. The exact capabilities vary with the backend being used.
pub fn set_page(
this: WxObject(WxWindow(WxControl(WxWebView))),
html: String,
baseurl: String,
) -> Result(Nil, Nil)
Set the displayed page source to the contents of the given string.
Note: When using wxWEBVIEW_BACKEND_IE you must wait for the current page to finish loading before calling setPage/3. The baseURL parameter is not used in this backend and the edge backend.
pub fn stop(
this: WxObject(WxWindow(WxControl(WxWebView))),
) -> Result(Nil, Nil)
Stop the current page loading process, if any.
May trigger an error event of type wxWEBVIEW_NAV_ERR_USER_CANCELLED. TODO: make wxWEBVIEW_NAV_ERR_USER_CANCELLED errors uniform across ports.