|
iPlug2 - C++ Audio Plug-in Framework
|
IWebView is a base interface for hosting a platform web view inside an IPlug plug-in's UI. More...
#include <IPlugWebView.h>
Public Types | |
| using | completionHandlerFunc = std::function< void(const char *result)> |
Public Member Functions | |
| IWebView (bool opaque=true, bool enableDevTools=false, const char *customUrlScheme="") | |
| Constructs an IWebView. More... | |
| void * | OpenWebView (void *pParent, float x, float y, float w, float h, float scale=1.0f) |
| void | CloseWebView () |
| void | HideWebView (bool hide) |
| void | LoadHTML (const char *html) |
| Load an HTML string into the webview. | |
| void | LoadURL (const char *url) |
| Instruct the webview to load an external URL. | |
| void | LoadFile (const char *fileName, const char *bundleID="") |
| Load a file on disk into the web view. More... | |
| void | ReloadPageContent () |
| Trigger a reload of the webview's content. | |
| void | EvaluateJavaScript (const char *scriptStr, completionHandlerFunc func=nullptr) |
| Runs some JavaScript in the webview. More... | |
| void | EnableScroll (bool enable) |
| Enable scrolling on the webview. More... | |
| void | EnableInteraction (bool enable) |
| Sets whether the webview is interactive. | |
| void | SetWebViewBounds (float x, float y, float w, float h, float scale=1.) |
| Set the bounds of the webview in the parent window. More... | |
| void | GetWebRoot (WDL_String &path) const |
| Fills the path where web content is being served from, when LoadFile() is used. | |
| const char * | GetCustomUrlScheme () const |
| Returns the custom URL scheme, if set. More... | |
| bool | GetEnableDevTools () const |
| Are developer tools enabled on this webview. More... | |
| bool | IsOpaque () const |
| True if the webview was configured opaque. More... | |
| void | SetCustomUrlScheme (const char *customUrlScheme) |
| Used to set the URL scheme after the IWebView has been contstructed;. More... | |
| void | SetEnableDevTools (bool enable) |
| Used to toggle devtools after the IWebView has been contstructed. More... | |
| virtual void | OnWebViewReady () |
| Called when the web view is ready to receive navigation instructions. More... | |
| virtual void | OnWebContentLoaded () |
| Called after navigation instructions have been exectued and e.g. More... | |
| virtual void | OnMessageFromWebView (const char *json) |
| When a script in the web view posts a message, it will arrive as a UTF8 json string here. More... | |
| virtual bool | OnCanNavigateToURL (const char *url) |
| Override to filter URLs. More... | |
| virtual bool | OnCanDownloadMIMEType (const char *mimeType) |
| Override to filter MIME types that should be downloaded. More... | |
| virtual void | OnGetLocalDownloadPathForFile (const char *fileName, WDL_String &localPath) |
| Override to download the file to a specific location other than e.g. More... | |
| virtual void | OnDownloadedFile (const char *path) |
| Override to handle file download success. More... | |
| virtual void | OnFailedToDownloadFile (const char *path) |
| Override to handle file download failure. More... | |
| virtual void | OnReceivedData (size_t numBytesReceived, size_t totalNumBytes) |
| Override to handle file download progress. More... | |
IWebView is a base interface for hosting a platform web view inside an IPlug plug-in's UI.
Definition at line 43 of file IPlugWebView.h.
| using IWebView::completionHandlerFunc = std::function<void(const char* result)> |
Definition at line 46 of file IPlugWebView.h.
| IWebView::IWebView | ( | bool | opaque = true, |
| bool | enableDevTools = false, |
||
| const char * | customUrlScheme = "" |
||
| ) |
Constructs an IWebView.
| opaque. | Is the WebView opaque or does it have a transparent background |
| enableDevTools. | Should the WebView's developer tools panel be enabled |
| customUrlScheme | If set, the string used as a custom url scheme. It should not include a colon. This means that the webview content is served as if it was on a web server (required for some web frameworks |
| void IWebView::EnableScroll | ( | bool | enable | ) |
Enable scrolling on the webview.
NOTE: currently only implemented for iOS
Referenced by IWebViewControl::OnAttached().
| void IWebView::EvaluateJavaScript | ( | const char * | scriptStr, |
| completionHandlerFunc | func = nullptr |
||
| ) |
Runs some JavaScript in the webview.
| scriptStr | UTF8 encoded JavaScript code to run |
| func | A function conforming to completionHandlerFunc that should be called on successful execution of the script |
Referenced by WebViewEditorDelegate::SendArbitraryMsgFromDelegate(), WebViewEditorDelegate::SendControlMsgFromDelegate(), WebViewEditorDelegate::SendControlValueFromDelegate(), WebViewEditorDelegate::SendMidiMsgFromDelegate(), and WebViewEditorDelegate::SendParameterValueFromDelegate().
|
inline |
Returns the custom URL scheme, if set.
Definition at line 93 of file IPlugWebView.h.
|
inline |
Are developer tools enabled on this webview.
Definition at line 96 of file IPlugWebView.h.
|
inline |
True if the webview was configured opaque.
Definition at line 99 of file IPlugWebView.h.
| void IWebView::LoadFile | ( | const char * | fileName, |
| const char * | bundleID = "" |
||
| ) |
Load a file on disk into the web view.
| fileName | On windows this should be an absolute path to the file you want to load. On macOS/iOS it can just be the file name if the file is packaged into a subfolder "web" of the bundle resources |
| bundleID | The NSBundleID of the macOS/iOS bundle, not required on Windows |
Referenced by WebViewEditorDelegate::LoadIndexHtml().
|
inlinevirtual |
Override to filter MIME types that should be downloaded.
Definition at line 122 of file IPlugWebView.h.
|
inlinevirtual |
Override to filter URLs.
Definition at line 119 of file IPlugWebView.h.
|
inlinevirtual |
Override to handle file download success.
Definition at line 128 of file IPlugWebView.h.
|
inlinevirtual |
Override to handle file download failure.
Definition at line 131 of file IPlugWebView.h.
|
virtual |
Override to download the file to a specific location other than e.g.
NSTemporaryDirectory
|
inlinevirtual |
When a script in the web view posts a message, it will arrive as a UTF8 json string here.
Reimplemented in IWebViewControl, and WebViewEditorDelegate.
Definition at line 116 of file IPlugWebView.h.
|
inlinevirtual |
Override to handle file download progress.
Definition at line 134 of file IPlugWebView.h.
|
inlinevirtual |
Called after navigation instructions have been exectued and e.g.
a page has loaded
Reimplemented in IWebViewControl, and WebViewEditorDelegate.
Definition at line 113 of file IPlugWebView.h.
|
inlinevirtual |
Called when the web view is ready to receive navigation instructions.
Reimplemented in IWebViewControl, and WebViewEditorDelegate.
Definition at line 110 of file IPlugWebView.h.
|
inline |
Used to set the URL scheme after the IWebView has been contstructed;.
Definition at line 102 of file IPlugWebView.h.
|
inline |
Used to toggle devtools after the IWebView has been contstructed.
Will only have an effect after close/reopen
Definition at line 105 of file IPlugWebView.h.
| void IWebView::SetWebViewBounds | ( | float | x, |
| float | y, | ||
| float | w, | ||
| float | h, | ||
| float | scale = 1. |
||
| ) |
Set the bounds of the webview in the parent window.
xywh are specifed in relation to a 1:1 non retina screen