#include <customgui_htmlviewer.h>

Provides a custom GUI for displaying HTML content within Cinema 4D and interacting with it via JavaScript.
py-cmd_gui_html_2027 example in the Cinema 4D Python SDK for a practical demonstration of how to use this custom GUI. Static Public Member Functions | |
| static String | FilenameToURL (const Filename &f, Int32 *encoding) |
Private Member Functions | |
| HtmlViewerCustomGui () | |
| ~HtmlViewerCustomGui () | |
Additional Inherited Members | |
Static Public Attributes inherited from BaseCustomGui< 200000114 > | |
| static constexpr Int32 | VALUE |
|
private |
|
private |
| void ExecuteJavaScript | ( | const maxon::String & | script | ) |
Private.
| [in] | script | Private. |
| void PostWebMessage | ( | const maxon::String & | message | ) |
Posts a web message to the HTML viewer's JavaScript context.
The message is delivered to window.maxon.messageListener, the cross-platform receive hook that behaves identically on Windows and MacOS. The page assigns a function to it; the host invokes that function with the message.
| [in] | message | The message to send to JavaScript. Cannot be the empty string. We strongly recommend to send JSON-encoded strings to ensure proper parsing and handling. |
| void SetRequestHeader | ( | const maxon::String & | name, |
| const maxon::String & | value, | ||
| const maxon::String & | hostname, | ||
| Bool | httpsOnly = true |
||
| ) |
Sets an HTTP request header that is injected on requests to hostname.
Any HTTP request header can be set this way, be it a standard one (e.g. "Accept-Language") or an application-specific one. Set it before navigating with SetUrl(). Call the function repeatedly to register several headers. Calling it again for the same name (case-insensitive) and hostname replaces the previously registered value; there is no way to unregister a header.
| [in] | name | The header name, e.g. "Accept-Language". |
| [in] | value | The header value, e.g. "de-DE". |
| [in] | hostname | The host the header applies to, e.g. "example.com". Required; bare host only, no scheme, port or path. Matched exactly and case-insensitively, so a subdomain like "api.example.com" needs its own registration. |
| [in] | httpsOnly | Send the header only over HTTPS. Default is true; pass false for a host served over plain HTTP, e.g. a local development server. |
hostname, including those the page triggers itself. | void SetWebMessageCallback | ( | HtmlViewerCustomGuiWebMessageCallback * | callback, |
| const maxon::String & | urlPartial, | ||
| void * | user_data | ||
| ) |
Sets a callback for web messages sent from the HTML viewer's JavaScript context.
The callback is triggered when JavaScript calls window.maxon.postMessage(msg):
| [in] | callback | The callback function to handle web messages. |
| [in] | urlPartial | A partial URL to filter which messages trigger the callback. |
| [in] | user_data | User data pointer passed to the callback. |
| void SetUrl | ( | const maxon::String & | url, |
| Int32 | encoding | ||
| ) |
Sets the HTML viewer URL.
| [in] | url | The new URL. |
| [in] | encoding | The URL encoding: URL_ENCODING |
| void SetText | ( | const maxon::String & | url | ) |
Sets the HTML viewer text.
| [in] | url | The new text. |
| void DoAction | ( | Int32 | action | ) |
Do an action in the HTML viewer.
| [in] | action | The action: WEBPAGE |
| void SetURLCallback | ( | HtmlViewerCustomGuiURLCallback * | callback, |
| void * | user_data | ||
| ) |
Registers the URL callback.
| [in] | callback | The callback, or nullptr to disable it. |
| [in] | user_data | The user data. The caller owns the pointed data. |
| String GetTextArea | ( | const maxon::String & | id | ) |
Deprecated. Always return an empty string.
Converts a filename into an URL string.
| [in] | f | The filename. |
| [out] | encoding | Assigned the URL encoding: URL_ENCODING |
| void SetResourceRequestInterceptCallback | ( | HtmlViewerCustomGuiResourceRequestInterceptCallback * | callback, |
| void * | user_data | ||
| ) |
Registers the resource request interception callback.
| [in] | callback | The callback, or nullptr to disable it. |
| [in] | user_data | The user data. The caller owns the pointed data. |