|
Ultralight C API 2.0.0
|
Web-page container rendered to an offscreen surface.
#include <Ultralight/CAPI/CAPI_View.h>
The View class is responsible for loading and rendering web-pages to an offscreen surface. It is completely isolated from the OS windowing system, you must forward all input events to it from your application.
You can create a View by calling ulCreateView():
Each ulViewSet*Callback() function holds one callback. Setting a callback replaces the previous one, and a NULL callback removes it.
Ownership of user_data transfers to the View. destroy_user_data (may be NULL) is invoked exactly once when the callback is replaced or the ULView handle is destroyed (never while the callback itself is running). If view is NULL, nothing is set and destroy_user_data runs right away.
Each setter owns its user_data separately, so a pointer registered with a destroy hook on two setters is released twice. Share one context by passing it with a NULL destroy_user_data to all but one setter, or give each setter its own allocation.
Callbacks belong to the ULView handle you set them on, and each callback receives that handle. A View delivers each group of callbacks to one handle: the load events (below), the download callbacks, the network-request callback, the editing callbacks (editable state and composition), and all the others. Setting a callback on a second handle for the same View (eg, another ulPanelGetView() result) moves its group to that handle, which turns off the first handle's callbacks in the group. Set all of a View's callbacks through one handle. Destroying a handle turns off only its own callbacks.
Callbacks run on the Renderer's thread.
A page load calls these callbacks in order:
| Callback setter | When |
|---|---|
| ulViewSetBeginLoadingCallback() | The load starts |
| ulViewSetWindowObjectReadyCallback() | Before the page's scripts run |
| ulViewSetDOMReadyCallback() | The document is parsed |
| ulViewSetFinishLoadingCallback() | The load ends |
| ulViewSetPageSettledCallback() | Loading and layout have gone quiet |
If the load fails, the fail-loading callback comes just before the finish-loading callback.
The window-object-ready and DOM-ready callbacks are called for every frame on the page (check is_main_frame). The begin, finish, and fail loading callbacks are called once per load for the frame that started it (usually the main frame).
Functions | |
| ULViewConfig | ulCreateViewConfig (void) |
| Create view configuration with default values (see <Ultralight/View.h>). | |
| void | ulDestroyViewConfig (ULViewConfig config) |
| Destroy a view configuration created by ulCreateViewConfig(). | |
| void | ulViewConfigSetDisplayId (ULViewConfig config, unsigned int display_id) |
| Set a user-generated id of the display (monitor, TV, or screen) that the View will be shown on. | |
| void | ulViewConfigSetIsAccelerated (ULViewConfig config, bool is_accelerated) |
| Set whether to render using the GPU renderer (accelerated) or the CPU renderer (unaccelerated). | |
| void | ulViewConfigSetIsTransparent (ULViewConfig config, bool is_transparent) |
| Set whether or not the View should support transparent backgrounds. | |
| void | ulViewConfigSetBackgroundColor (ULViewConfig config, ULColor color) |
| Set the base background color the page renders on before any page styling applies, the color visible while a page loads and wherever the page itself paints nothing. | |
| void | ulViewConfigSetPreferredColorScheme (ULViewConfig config, ULColorScheme scheme) |
| Set the color scheme the View reports to pages via the prefers-color-scheme CSS media feature. | |
| void | ulViewConfigSetClipboardReadPolicy (ULViewConfig config, ULClipboardReadPolicy policy) |
| Set which pages may read the clipboard from script, eg, a page's own Paste button calling document.execCommand('paste'). | |
| void | ulViewConfigSetInitialDeviceScale (ULViewConfig config, double initial_device_scale) |
| Set the initial device scale, ie. | |
| void | ulViewConfigSetInitialFocus (ULViewConfig config, bool is_focused) |
| Set whether or not the View should initially have input focus. | |
| void | ulViewConfigSetEnableImages (ULViewConfig config, bool enabled) |
| Set whether images should be enabled (Default = True). | |
| void | ulViewConfigSetEnableJavaScript (ULViewConfig config, bool enabled) |
| Set whether JavaScript should be enabled (Default = True). | |
| void | ulViewConfigSetMatchNativeEditingBehavior (ULViewConfig config, bool enabled) |
| Set whether text editing should follow the host OS's native conventions instead of the library's cross-platform behavior (Default = False). | |
| void | ulViewConfigSetFontFamilyStandard (ULViewConfig config, ULString font_name) |
| Set the default font family, used for text that doesn't set one (Default = Times New Roman). | |
| void | ulViewConfigSetFontFamilyFixed (ULViewConfig config, ULString font_name) |
| Set the default monospace font family, eg, for pre and code (Default = Courier New). | |
| void | ulViewConfigSetFontFamilySerif (ULViewConfig config, ULString font_name) |
| Set the default font family for the CSS serif generic (Default = Times New Roman). | |
| void | ulViewConfigSetFontFamilySansSerif (ULViewConfig config, ULString font_name) |
| Set the default font family for the CSS sans-serif generic (Default = Arial). | |
| void | ulViewConfigSetFontFamilyCursive (ULViewConfig config, ULString font_name) |
| Set the default font family for the CSS cursive generic (Default = Comic Sans MS). | |
| void | ulViewConfigSetFontFamilyFantasy (ULViewConfig config, ULString font_name) |
| Set the default font family for the CSS fantasy generic (Default = Impact). | |
| void | ulViewConfigSetFontFamilyPictograph (ULViewConfig config, ULString font_name) |
| Set the default font family for the CSS -webkit-pictograph generic. | |
| void | ulViewConfigSetFontSizeDefault (ULViewConfig config, unsigned int size) |
| Set the default font size, in pixels (Default = 16). | |
| void | ulViewConfigSetFontSizeFixed (ULViewConfig config, unsigned int size) |
| Set the default font size for monospace text, eg, pre and code, in pixels (Default = 13). | |
| void | ulViewConfigSetUserAgent (ULViewConfig config, ULString agent_string) |
| Set user agent string (See <Ultralight/platform/Config.h> for the default). | |
| void | ulViewConfigSetEnableCompositor (ULViewConfig config, bool enabled) |
| Set whether or not compositing should be enabled. | |
| void | ulViewConfigSetEnableCompositorDebugInfo (ULViewConfig config, bool enabled) |
| Set whether or not to display compositor debug information. | |
| void | ulViewConfigSetEnableCanvasFilters (ULViewConfig config, bool enabled) |
| Set whether or not the HTML5 Canvas Filters API (CanvasRenderingContext2D.filter) is enabled. | |
| void | ulViewConfigSetEnableHiddenTimerThrottling (ULViewConfig config, bool enabled) |
| Set whether to throttle JavaScript timers (setTimeout / setInterval) while the View is hidden (Default = False). | |
| void | ulViewConfigSetMaxRenderFps (ULViewConfig config, unsigned int fps) |
| Set the maximum rate, in frames per second, at which the View advances its animations and repaints. | |
| void | ulViewConfigSetJavaScriptCanOpenWindowsAutomatically (ULViewConfig config, bool enabled) |
| Set whether or not a script can open a window with window.open() without a user gesture (Default = False). | |
| void | ulViewConfigSetAllowUniversalAccessFromFileURLs (ULViewConfig config, bool enabled) |
| Set whether or not pages loaded from file:/// URLs can access content from any origin (Default = True). | |
| ULView | ulCreateView (ULRenderer renderer, unsigned int width, unsigned int height, ULViewConfig view_config, ULSession session) |
| Create a View with certain size (in pixels). | |
| void | ulDestroyView (ULView view) |
| Destroy a View previously created with ulCreateView(). | |
| ULString | ulViewGetURL (ULView view) |
| Get current URL. | |
| ULString | ulViewGetTitle (ULView view) |
| Get current title. | |
| unsigned int | ulViewGetWidth (ULView view) |
| Get the width, in pixels. | |
| unsigned int | ulViewGetHeight (ULView view) |
| Get the height, in pixels. | |
| unsigned int | ulViewGetDisplayId (ULView view) |
| Get the display id of the View. | |
| void | ulViewSetDisplayId (ULView view, unsigned int display_id) |
| Set the display id of the View. | |
| double | ulViewGetDeviceScale (ULView view) |
| Get the device scale, ie. | |
| void | ulViewSetDeviceScale (ULView view, double scale) |
| Set the device scale. | |
| bool | ulViewIsAccelerated (ULView view) |
| Whether or not the View is GPU-accelerated. | |
| bool | ulViewIsTransparent (ULView view) |
| Whether or not the View supports transparent backgrounds. | |
| bool | ulViewIsLoading (ULView view) |
| Check if the main frame of the page is currently loading. | |
| bool | ulViewIsSettled (ULView view) |
| Check whether the page has settled after loading. | |
| ULRenderTarget | ulViewGetRenderTarget (ULView view) |
| Get the RenderTarget for the View. | |
| ULSurface | ulViewGetSurface (ULView view) |
| Get the Surface for the View (native pixel buffer that the CPU renderer draws into). | |
| void | ulViewLoadHTML (ULView view, ULString html_string) |
| Load a raw string of HTML, the View will navigate to it as a new page. | |
| void | ulViewLoadHTMLWithParams (ULView view, ULString html_string, ULString url, bool add_to_history) |
| Load a raw string of HTML with additional options. | |
| void | ulViewLoadURL (ULView view, ULString url_string) |
| Load a URL, the View will navigate to it as a new page. | |
| void | ulViewResize (ULView view, unsigned int width, unsigned int height) |
| Resize view to a certain width and height (in pixels). | |
| void | ulViewResizeWithScale (ULView view, unsigned int width, unsigned int height, double device_scale) |
| Resize view and apply a new device scale in the same pass. | |
| JSContextRef | ulViewLockJSContext (ULView view) |
| Acquire the page's JSContext for use with JavaScriptCore API. | |
| void | ulViewUnlockJSContext (ULView view) |
| Unlock the page's JSContext after a previous call to ulViewLockJSContext(). | |
| ULString | ulViewEvaluateScript (ULView view, ULString js_string, ULString *exception) |
| Evaluate a string of JavaScript and return result. | |
| JSContextRef | ulViewLockJSContextWithFrame (ULView view, ULString frame) |
| Acquire the JSContext of a specific frame for use with JavaScriptCore API. | |
| void | ulViewUnlockJSContextWithFrame (ULView view, ULString frame) |
| Unlock the JSContext of a specific frame after a previous call to ulViewLockJSContextWithFrame(). | |
| ULJSContext | ulViewGetJSContext (ULView view) |
| Get a ULJS handle to the main frame's JavaScript context. | |
| void * | ulViewJavaScriptVMWithFrame (ULView view, ULString frame) |
| Get a handle to the internal JavaScriptCore VM for a specific frame. | |
| ULString | ulViewEvaluateScriptWithFrame (ULView view, ULString js_string, ULString *exception, ULString frame) |
| Evaluate a string of JavaScript in a specific frame and return the result. | |
| bool | ulViewCanGoBack (ULView view) |
| Whether or not the View can navigate back in history. | |
| bool | ulViewCanGoForward (ULView view) |
| Whether or not the View can navigate forward in history. | |
| void | ulViewGoBack (ULView view) |
| Navigate backwards in history. | |
| void | ulViewGoForward (ULView view) |
| Navigate forwards in history. | |
| void | ulViewGoToHistoryOffset (ULView view, int offset) |
| Navigate to an arbitrary offset in history. | |
| void | ulViewReload (ULView view) |
| Reload current page. | |
| void | ulViewStop (ULView view) |
| Stop all page loads. | |
| void | ulViewFocus (ULView view) |
| Give focus to the View. | |
| void | ulViewUnfocus (ULView view) |
| Remove focus from the View. | |
| bool | ulViewHasFocus (ULView view) |
| Whether or not the View has focus. | |
| bool | ulViewHasInputFocus (ULView view) |
| Whether or not the View has an input element with visible keyboard focus (indicated by a blinking caret). | |
| void | ulViewFireKeyEvent (ULView view, ULKeyEvent key_event) |
| Fire a keyboard event. | |
| void | ulViewFireMouseEvent (ULView view, ULMouseEvent mouse_event) |
| Fire a mouse event. | |
| void | ulViewFireScrollEvent (ULView view, ULScrollEvent scroll_event) |
| Fire a scroll event. | |
| void | ulViewSetChangeTitleCallback (ULView view, ULChangeTitleCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the page title changes. | |
| void | ulViewSetChangeURLCallback (ULView view, ULChangeURLCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the main frame loads a new page. | |
| void | ulViewSetChangeTooltipCallback (ULView view, ULChangeTooltipCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the tooltip under the mouse changes (the text is empty when there's no tooltip). | |
| void | ulViewSetChangeCursorCallback (ULView view, ULChangeCursorCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the mouse cursor changes. | |
| void | ulViewSetChangeEditableStateCallback (ULView view, ULChangeEditableStateCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the editable state changes. | |
| void | ulViewSetUpdateCompositionCallback (ULView view, ULUpdateCompositionCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for after every change to the active composition. | |
| void | ulViewSetDiscardCompositionCallback (ULView view, ULDiscardCompositionCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the page ends the active composition on its own (eg, on navigation or when the selection moves away from it). | |
| void | ulViewSetAddConsoleMessageCallback (ULView view, ULAddConsoleMessageCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the page adds a message to the console (useful for errors and debugging). | |
| void | ulViewSetCreateChildViewCallback (ULView view, ULCreateChildViewCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the page wants to open a new window (a link with target="_blank" or a call to window.open()). | |
| void | ulViewSetCreateInspectorViewCallback (ULView view, ULCreateInspectorViewCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the inspector needs a View to display in (after ulViewCreateLocalInspectorView() or when a remote inspector connects). | |
| void | ulViewSetBeginLoadingCallback (ULView view, ULBeginLoadingCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when a load starts (see "Load Events" in the file description). | |
| void | ulViewSetFinishLoadingCallback (ULView view, ULFinishLoadingCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when a load ends (whether or not it succeeded). | |
| void | ulViewSetFailLoadingCallback (ULView view, ULFailLoadingCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when a load fails (just before the finish-loading callback). | |
| void | ulViewSetWindowObjectReadyCallback (ULView view, ULWindowObjectReadyCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for before a frame's scripts run. | |
| void | ulViewSetDOMReadyCallback (ULView view, ULDOMReadyCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when a frame's document has been parsed and the DOM is ready. | |
| void | ulViewSetUpdateHistoryCallback (ULView view, ULUpdateHistoryCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the main frame's back-forward history changes. | |
| void | ulViewSetPageSettledCallback (ULView view, ULPageSettledCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the page has settled and is ready to capture or display (resources have loaded, initial scripts have run, and layout is stable). | |
| void | ulViewSetNeedsPaint (ULView view, bool needs_paint) |
| Set whether or not a view should be repainted during the next call to ulRender(). | |
| bool | ulViewGetNeedsPaint (ULView view) |
| Whether or not a view should be painted during the next call to ulRender(). | |
| void | ulViewSetVisible (ULView view, bool visible) |
| Set whether or not this View is visible. | |
| bool | ulViewIsVisible (ULView view) |
| Whether or not this View is visible. | |
| unsigned int | ulViewGetMaxRenderFps (ULView view) |
| Get the frame-rate cap (in FPS) set for the View, or 0 if none is set. | |
| void | ulViewSetMaxRenderFps (ULView view, unsigned int fps) |
| Set the maximum rate, in frames per second, at which the View advances its animations and repaints. | |
| void | ulViewSetPreferredColorScheme (ULView view, ULColorScheme scheme) |
| Set the color scheme this View reports to pages via the prefers-color-scheme CSS media feature. | |
| ULColorScheme | ulViewGetPreferredColorScheme (ULView view) |
| Get the color scheme this View reports to pages. | |
| void | ulViewCreateLocalInspectorView (ULView view) |
| Create an Inspector View to inspect / debug this View locally. | |
| void | ulViewSetCompositorDebugInfoEnabled (ULView view, bool enabled) |
| Set whether or not to display compositor debug information. | |
| bool | ulViewGetCompositorDebugInfoEnabled (ULView view) |
| Whether or not compositor debug information is enabled. | |
| void | ulViewSetRequestCloseCallback (ULView view, ULRequestCloseCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the page asks to close (window.close() in a window that script opened, or in one with a single page in its history). | |
| void | ulViewSetDownloadNextIdCallback (ULView view, ULDownloadNextIdCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for generating unique download ids. | |
| void | ulViewSetDownloadRequestCallback (ULView view, ULDownloadRequestCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the View requests a download. | |
| void | ulViewSetDownloadBeginCallback (ULView view, ULDownloadBeginCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when a download begins. | |
| void | ulViewSetDownloadReceiveDataCallback (ULView view, ULDownloadReceiveDataCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when download data is received. | |
| void | ulViewSetDownloadFinishCallback (ULView view, ULDownloadFinishCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when a download finishes. | |
| void | ulViewSetDownloadFailCallback (ULView view, ULDownloadFailCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when a download fails. | |
| void | ulViewCancelDownload (ULView view, unsigned int id) |
| Cancel an active download. | |
| void | ulViewSetNetworkRequestCallback (ULView view, ULNetworkRequestCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data) |
| Set callback for when the View is about to begin a network request. | |
Typedefs | |
| typedef void(*) | ULChangeTitleCallback(void *user_data, ULView caller, ULString title) |
| typedef void(*) | ULChangeURLCallback(void *user_data, ULView caller, ULString url) |
| typedef void(*) | ULChangeTooltipCallback(void *user_data, ULView caller, ULString tooltip) |
| typedef void(*) | ULChangeCursorCallback(void *user_data, ULView caller, ULCursor cursor) |
| typedef void(*) | ULChangeEditableStateCallback(void *user_data, ULView caller, ULEditableState state) |
| typedef void(*) | ULUpdateCompositionCallback(void *user_data, ULView caller) |
| typedef void(*) | ULDiscardCompositionCallback(void *user_data, ULView caller) |
| typedef void(*) | ULAddConsoleMessageCallback(void *user_data, ULView caller, ULMessageSource source, ULMessageLevel level, ULString message, unsigned int line_number, unsigned int column_number, ULString source_id) |
| typedef ULView(*) | ULCreateChildViewCallback(void *user_data, ULView caller, ULString opener_url, ULString target_url, bool is_popup, ULIntRect popup_rect) |
| typedef ULView(*) | ULCreateInspectorViewCallback(void *user_data, ULView caller, bool is_local, ULString inspected_url) |
| typedef void(*) | ULBeginLoadingCallback(void *user_data, ULView caller, unsigned long long frame_id, bool is_main_frame, ULString url) |
| typedef void(*) | ULFinishLoadingCallback(void *user_data, ULView caller, unsigned long long frame_id, bool is_main_frame, ULString url) |
| typedef void(*) | ULFailLoadingCallback(void *user_data, ULView caller, unsigned long long frame_id, bool is_main_frame, ULString url, ULString description, ULString error_domain, int error_code) |
| typedef void(*) | ULWindowObjectReadyCallback(void *user_data, ULView caller, unsigned long long frame_id, bool is_main_frame, ULString url) |
| typedef void(*) | ULDOMReadyCallback(void *user_data, ULView caller, unsigned long long frame_id, bool is_main_frame, ULString url) |
| typedef void(*) | ULUpdateHistoryCallback(void *user_data, ULView caller) |
| typedef void(*) | ULPageSettledCallback(void *user_data, ULView caller, ULString url) |
| typedef void(*) | ULRequestCloseCallback(void *user_data, ULView caller) |
| typedef unsigned int(*) | ULDownloadNextIdCallback(void *user_data, ULView caller) |
| Callback for when the View needs an ID for a new download. | |
| typedef bool(*) | ULDownloadRequestCallback(void *user_data, ULView caller, unsigned int id, ULString url) |
| Callback for when the page wants to download a file. | |
| typedef void(*) | ULDownloadBeginCallback(void *user_data, ULView caller, unsigned int id, ULString url, ULString filename, long long expected_content_length) |
| Callback for when a download starts. | |
| typedef void(*) | ULDownloadReceiveDataCallback(void *user_data, ULView caller, unsigned int id, ULBuffer data) |
| Callback for when a download receives data (usually several times per download). | |
| typedef void(*) | ULDownloadFinishCallback(void *user_data, ULView caller, unsigned int id) |
| Callback for when a download finishes. | |
| typedef void(*) | ULDownloadFailCallback(void *user_data, ULView caller, unsigned int id) |
| Callback for when a download fails. | |
| typedef bool(*) | ULNetworkRequestCallback(void *user_data, ULView caller, ULString url) |
| Callback for before the View sends a network request. | |
| ULView ulCreateView | ( | ULRenderer | renderer, |
| unsigned int | width, | ||
| unsigned int | height, | ||
| ULViewConfig | view_config, | ||
| ULSession | session ) |
Create a View with certain size (in pixels).
| renderer | The active renderer instance. |
| width | The initial width, in pixels. |
| height | The initial height, in pixels. |
| view_config | Configuration details for the View. Pass NULL to use the default configuration. |
| session | The session to store local data in. Pass NULL to use the default session. |
| ULViewConfig ulCreateViewConfig | ( | void | ) |
Create view configuration with default values (see <Ultralight/View.h>).
| void ulDestroyView | ( | ULView | view | ) |
Destroy a View previously created with ulCreateView().
| view | The View to destroy (can be NULL). |
| void ulDestroyViewConfig | ( | ULViewConfig | config | ) |
Destroy a view configuration created by ulCreateViewConfig().
| config | The view configuration to destroy (can be NULL). |
| void ulViewCancelDownload | ( | ULView | view, |
| unsigned int | id ) |
Cancel an active download.
No more data arrives for the download, and the callback set with ulViewSetDownloadFailCallback() is called for it during a later ulUpdate().
| view | The View. |
| id | The download id to cancel. |
| bool ulViewCanGoBack | ( | ULView | view | ) |
Whether or not the View can navigate back in history.
| bool ulViewCanGoForward | ( | ULView | view | ) |
Whether or not the View can navigate forward in history.
| void ulViewConfigSetAllowUniversalAccessFromFileURLs | ( | ULViewConfig | config, |
| bool | enabled ) |
Set whether or not pages loaded from file:/// URLs can access content from any origin (Default = True).
When true, a file:/// page can read other frames' documents and make requests to any origin without cross-origin checks. Set this to false to give file:/// pages the same cross-origin rules as web pages (they stay same-origin with other file:/// pages).
| void ulViewConfigSetBackgroundColor | ( | ULViewConfig | config, |
| ULColor | color ) |
Set the base background color the page renders on before any page styling applies, the color visible while a page loads and wherever the page itself paints nothing.
(Default = unset, meaning opaque white)
Dark applications set a dark base so pages never flash white during load.
Transparent Views keep a fully transparent base regardless of this value. On opaque Views a translucent color is composited over white, so the View itself stays opaque.
| void ulViewConfigSetClipboardReadPolicy | ( | ULViewConfig | config, |
| ULClipboardReadPolicy | policy ) |
Set which pages may read the clipboard from script, eg, a page's own Paste button calling document.execCommand('paste').
(Default = kClipboardReadPolicy_AllowForAppContent)
The library only considers requests made during a user gesture (a click or key press); script running outside a gesture is always refused. Pastes the user performs directly (Ctrl+V, or ulEditorExecute with kEditorCommand_Paste) are never affected by this policy.
kClipboardReadPolicy_AllowForAppContent (the default) grants requests from your application's own content (local file:/// pages and pages loaded from application-supplied data, eg, ulViewLoadHTML()) and refuses them from other pages. kClipboardReadPolicy_Allow grants requests from any page; kClipboardReadPolicy_Deny refuses them all.
An out-of-range value logs a warning and leaves the config unchanged.
| void ulViewConfigSetDisplayId | ( | ULViewConfig | config, |
| unsigned int | display_id ) |
Set a user-generated id of the display (monitor, TV, or screen) that the View will be shown on.
Animations are driven based on the physical refresh rate of the display. Multiple Views can share the same display.
| void ulViewConfigSetEnableCanvasFilters | ( | ULViewConfig | config, |
| bool | enabled ) |
Set whether or not the HTML5 Canvas Filters API (CanvasRenderingContext2D.filter) is enabled.
(Default = True)
| void ulViewConfigSetEnableCompositor | ( | ULViewConfig | config, |
| bool | enabled ) |
Set whether or not compositing should be enabled.
(Default = True)
When enabled, certain content (eg, 3D transforms, will-change, animated transforms or opacity, and video) paints into separate composited layers, making transform and opacity changes cheap to animate.
| void ulViewConfigSetEnableCompositorDebugInfo | ( | ULViewConfig | config, |
| bool | enabled ) |
Set whether or not to display compositor debug information.
(Default = False)
| void ulViewConfigSetEnableHiddenTimerThrottling | ( | ULViewConfig | config, |
| bool | enabled ) |
Set whether to throttle JavaScript timers (setTimeout / setInterval) while the View is hidden (Default = False).
When enabled, repeating timers in a hidden View are aligned to roughly one-second boundaries (about 1 Hz) to reduce CPU usage for off-screen Views. They return to their normal rate once the View is shown again.
| void ulViewConfigSetEnableImages | ( | ULViewConfig | config, |
| bool | enabled ) |
Set whether images should be enabled (Default = True).
| void ulViewConfigSetEnableJavaScript | ( | ULViewConfig | config, |
| bool | enabled ) |
Set whether JavaScript should be enabled (Default = True).
| void ulViewConfigSetFontFamilyCursive | ( | ULViewConfig | config, |
| ULString | font_name ) |
Set the default font family for the CSS cursive generic (Default = Comic Sans MS).
| void ulViewConfigSetFontFamilyFantasy | ( | ULViewConfig | config, |
| ULString | font_name ) |
Set the default font family for the CSS fantasy generic (Default = Impact).
| void ulViewConfigSetFontFamilyFixed | ( | ULViewConfig | config, |
| ULString | font_name ) |
Set the default monospace font family, eg, for pre and code (Default = Courier New).
| void ulViewConfigSetFontFamilyPictograph | ( | ULViewConfig | config, |
| ULString | font_name ) |
Set the default font family for the CSS -webkit-pictograph generic.
Pass an empty string to use the standard font family (Default = empty).
| void ulViewConfigSetFontFamilySansSerif | ( | ULViewConfig | config, |
| ULString | font_name ) |
Set the default font family for the CSS sans-serif generic (Default = Arial).
| void ulViewConfigSetFontFamilySerif | ( | ULViewConfig | config, |
| ULString | font_name ) |
Set the default font family for the CSS serif generic (Default = Times New Roman).
| void ulViewConfigSetFontFamilyStandard | ( | ULViewConfig | config, |
| ULString | font_name ) |
Set the default font family, used for text that doesn't set one (Default = Times New Roman).
| void ulViewConfigSetFontSizeDefault | ( | ULViewConfig | config, |
| unsigned int | size ) |
Set the default font size, in pixels (Default = 16).
| void ulViewConfigSetFontSizeFixed | ( | ULViewConfig | config, |
| unsigned int | size ) |
Set the default font size for monospace text, eg, pre and code, in pixels (Default = 13).
| void ulViewConfigSetInitialDeviceScale | ( | ULViewConfig | config, |
| double | initial_device_scale ) |
Set the initial device scale, ie.
the amount to scale page units to screen pixels. This should be set to the scaling factor of the device that the View is displayed on. (Default = 1.0)
| void ulViewConfigSetInitialFocus | ( | ULViewConfig | config, |
| bool | is_focused ) |
Set whether or not the View should initially have input focus.
(Default = True)
| void ulViewConfigSetIsAccelerated | ( | ULViewConfig | config, |
| bool | is_accelerated ) |
Set whether to render using the GPU renderer (accelerated) or the CPU renderer (unaccelerated).
This option is only valid if you're managing the Renderer yourself (eg, you've previously called ulCreateRenderer() instead of ulCreateApp()).
When true, the View will be rendered to an offscreen GPU texture using the GPU driver set in ulPlatformSetGPUDriver(). You can fetch details for the texture via ulViewGetRenderTarget().
When false (the default), the View will be rendered to an offscreen pixel buffer using the multithreaded CPU renderer. This pixel buffer can optionally be provided by the user– for more info see ulViewGetSurface().
| void ulViewConfigSetIsTransparent | ( | ULViewConfig | config, |
| bool | is_transparent ) |
Set whether or not the View should support transparent backgrounds.
(Default = False)
The page needs a transparent background too:
| void ulViewConfigSetJavaScriptCanOpenWindowsAutomatically | ( | ULViewConfig | config, |
| bool | enabled ) |
Set whether or not a script can open a window with window.open() without a user gesture (Default = False).
When false, Ultralight behaves like a typical browser: a window.open() call succeeds only while the page is handling a user gesture, such as from a click handler. A call made on its own (on page load, or from a timer) is blocked as a popup. Set this to true to let scripts call window.open() at any time. The same gesture rule applies to a form submission that targets a new window.
| void ulViewConfigSetMatchNativeEditingBehavior | ( | ULViewConfig | config, |
| bool | enabled ) |
Set whether text editing should follow the host OS's native conventions instead of the library's cross-platform behavior (Default = False).
When false, text selection and editing behave identically on every platform (a directionless selection is promoted to forward, the convention Windows browsers use). Set this to true for desktop applications that should feel native to each platform.
| void ulViewConfigSetMaxRenderFps | ( | ULViewConfig | config, |
| unsigned int | fps ) |
Set the maximum rate, in frames per second, at which the View advances its animations and repaints.
(Default = 0, unthrottled)
This caps the View's whole frame loop (requestAnimationFrame, CSS and Web animations, smooth scrolling, and painting). A value of 0 leaves the View unthrottled, advancing at the display's refresh rate.
| void ulViewConfigSetPreferredColorScheme | ( | ULViewConfig | config, |
| ULColorScheme | scheme ) |
Set the color scheme the View reports to pages via the prefers-color-scheme CSS media feature.
(Default = kColorScheme_Auto)
kColorScheme_Auto follows the system scheme set via ulRendererSetSystemColorScheme() (Light until it is fed a different value). Light or Dark pins the scheme for this View.
An out-of-range value logs a warning and leaves the config unchanged.
| void ulViewConfigSetUserAgent | ( | ULViewConfig | config, |
| ULString | agent_string ) |
Set user agent string (See <Ultralight/platform/Config.h> for the default).
| void ulViewCreateLocalInspectorView | ( | ULView | view | ) |
Create an Inspector View to inspect / debug this View locally.
This will only succeed if you have the inspector assets in your filesystem– the inspector will look for file:///inspector/Main.html when it first loads.
You must handle ulViewSetCreateInspectorViewCallback() so that the library has a View to display the inspector in. This function will call the callback only if an inspector view is not currently active.
Evaluate a string of JavaScript and return result.
| view | The View. |
| js_string | The string of JavaScript to evaluate. |
| exception | The address of a ULString that receives the exception message if the script throws, or an empty string if it doesn't. Pass NULL to ignore this. Don't destroy the exception string returned, it's owned by the View. |
| ULString ulViewEvaluateScriptWithFrame | ( | ULView | view, |
| ULString | js_string, | ||
| ULString * | exception, | ||
| ULString | frame ) |
Evaluate a string of JavaScript in a specific frame and return the result.
| view | The View. |
| js_string | The string of JavaScript to evaluate. |
| exception | The address of a ULString that receives the exception message if the script throws, or an empty string if it doesn't. Pass NULL to ignore this. Don't destroy the exception string returned, it's owned by the View. |
| frame | The name of the frame to evaluate the script in. Pass an empty string for the main frame, or the name attribute of one of the main frame's iframes. |
| void ulViewFireKeyEvent | ( | ULView | view, |
| ULKeyEvent | key_event ) |
Fire a keyboard event.
| view | The View. |
| key_event | The key event. |
| void ulViewFireMouseEvent | ( | ULView | view, |
| ULMouseEvent | mouse_event ) |
Fire a mouse event.
| view | The View. |
| mouse_event | The mouse event. |
| void ulViewFireScrollEvent | ( | ULView | view, |
| ULScrollEvent | scroll_event ) |
Fire a scroll event.
| view | The View. |
| scroll_event | The scroll event. |
| void ulViewFocus | ( | ULView | view | ) |
Give focus to the View.
You should call this to give visual indication that the View has input focus (changes active text selection colors, for example). The page gets a window focus event, and so does the element that had focus before ulViewUnfocus().
| bool ulViewGetCompositorDebugInfoEnabled | ( | ULView | view | ) |
Whether or not compositor debug information is enabled.
| double ulViewGetDeviceScale | ( | ULView | view | ) |
Get the device scale, ie.
the amount to scale page units to screen pixels.
For example, a value of 1.0 is equivalent to 100% zoom. A value of 2.0 is 200% zoom.
| unsigned int ulViewGetDisplayId | ( | ULView | view | ) |
Get the display id of the View.
| unsigned int ulViewGetHeight | ( | ULView | view | ) |
Get the height, in pixels.
| ULJSContext ulViewGetJSContext | ( | ULView | view | ) |
Get a ULJS handle to the main frame's JavaScript context.
Unlike ulViewLockJSContext(), the returned handle never keeps the page alive. When the page navigates away or the View is destroyed, the handle stops working and operations on it fail safely. Use it with the functions in <Ultralight/CAPI/CAPI_JSValue.h>.
| unsigned int ulViewGetMaxRenderFps | ( | ULView | view | ) |
Get the frame-rate cap (in FPS) set for the View, or 0 if none is set.
| bool ulViewGetNeedsPaint | ( | ULView | view | ) |
Whether or not a view should be painted during the next call to ulRender().
When this returns false, rendering would reproduce the previous frame, so you can skip rendering or presenting the view. This is always false while the View is hidden, and while its frame-rate cap holds back its next frame.
When this returns true, the next call to ulRender() repaints the view. The resulting frame may still be visually identical to the previous frame.
| ULColorScheme ulViewGetPreferredColorScheme | ( | ULView | view | ) |
Get the color scheme this View reports to pages.
| ULRenderTarget ulViewGetRenderTarget | ( | ULView | view | ) |
Get the RenderTarget for the View.
You can use this with your GPUDriver implementation to bind and display the corresponding texture in your application.
Get the Surface for the View (native pixel buffer that the CPU renderer draws into).
This returns NULL if the View uses the GPU renderer.
The default Surface is BitmapSurface, but you can provide your own Surface implementation with ulPlatformSetSurfaceDefinition().
When using the default Surface, you can retrieve the underlying bitmap by casting ULSurface to ULBitmapSurface and calling ulBitmapSurfaceGetBitmap().
Get current title.
Get current URL.
| unsigned int ulViewGetWidth | ( | ULView | view | ) |
Get the width, in pixels.
| void ulViewGoBack | ( | ULView | view | ) |
Navigate backwards in history.
| void ulViewGoForward | ( | ULView | view | ) |
Navigate forwards in history.
| void ulViewGoToHistoryOffset | ( | ULView | view, |
| int | offset ) |
Navigate to an arbitrary offset in history.
| view | The View. |
| offset | The number of entries to move (negative goes back, positive goes forward). |
| bool ulViewHasFocus | ( | ULView | view | ) |
Whether or not the View has focus.
| bool ulViewHasInputFocus | ( | ULView | view | ) |
Whether or not the View has an input element with visible keyboard focus (indicated by a blinking caret).
You can use this to decide whether or not the View should consume keyboard input events (useful in games with mixed UI and key handling).
| bool ulViewIsAccelerated | ( | ULView | view | ) |
Whether or not the View is GPU-accelerated.
If this is false, the page will be rendered via the CPU renderer.
| bool ulViewIsLoading | ( | ULView | view | ) |
Check if the main frame of the page is currently loading.
| bool ulViewIsSettled | ( | ULView | view | ) |
Check whether the page has settled after loading.
This is the queryable form of the page-settled callback. It flips true when that callback fires and resets to false on each new navigation.
| bool ulViewIsTransparent | ( | ULView | view | ) |
Whether or not the View supports transparent backgrounds.
| bool ulViewIsVisible | ( | ULView | view | ) |
Whether or not this View is visible.
Get a handle to the internal JavaScriptCore VM for a specific frame.
| view | The View. |
| frame | The name of the frame to access. Pass an empty string for the main frame, or the name attribute of one of the main frame's iframes. |
Load a raw string of HTML, the View will navigate to it as a new page.
| void ulViewLoadHTMLWithParams | ( | ULView | view, |
| ULString | html_string, | ||
| ULString | url, | ||
| bool | add_to_history ) |
Load a raw string of HTML with additional options.
| view | The View. |
| html_string | The raw HTML string to load. |
| url | An optional URL for this load (to make it appear as if the HTML was loaded from a certain URL). Can be used for resolving relative URLs and cross-origin rules. Pass an empty ULString to use no URL. |
| add_to_history | Whether or not this load should be added to the session's history (eg, the back/forward list). |
Load a URL, the View will navigate to it as a new page.
| view | The View. |
| url_string | The URL to load. |
| JSContextRef ulViewLockJSContext | ( | ULView | view | ) |
Acquire the page's JSContext for use with JavaScriptCore API.
| JSContextRef ulViewLockJSContextWithFrame | ( | ULView | view, |
| ULString | frame ) |
Acquire the JSContext of a specific frame for use with JavaScriptCore API.
| view | The View. |
| frame | The name of the frame to access. Pass an empty string for the main frame, or the name attribute of one of the main frame's iframes. |
| void ulViewReload | ( | ULView | view | ) |
Reload current page.
| void ulViewResize | ( | ULView | view, |
| unsigned int | width, | ||
| unsigned int | height ) |
Resize view to a certain width and height (in pixels).
| void ulViewResizeWithScale | ( | ULView | view, |
| unsigned int | width, | ||
| unsigned int | height, | ||
| double | device_scale ) |
Resize view and apply a new device scale in the same pass.
Prefer this over separate ulViewSetDeviceScale() and ulViewResize() calls when both change at once, for example when a window moves to a display with a different DPI. Applying them together resizes the page once instead of twice.
| view | The View. |
| width | The new width, in pixels. |
| height | The new height, in pixels. |
| device_scale | The new device scale (see ulViewSetDeviceScale()). |
| void ulViewSetAddConsoleMessageCallback | ( | ULView | view, |
| ULAddConsoleMessageCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the page adds a message to the console (useful for errors and debugging).
| void ulViewSetBeginLoadingCallback | ( | ULView | view, |
| ULBeginLoadingCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when a load starts (see "Load Events" in the file description).
| void ulViewSetChangeCursorCallback | ( | ULView | view, |
| ULChangeCursorCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the mouse cursor changes.
| void ulViewSetChangeEditableStateCallback | ( | ULView | view, |
| ULChangeEditableStateCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the editable state changes.
This happens when focus moves to or from an editable element, when the View gains or loses focus, and when the focused element's inputmode changes. Use the state to turn an input method or on-screen keyboard on or off (see ULEditableState).
| void ulViewSetChangeTitleCallback | ( | ULView | view, |
| ULChangeTitleCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the page title changes.
| void ulViewSetChangeTooltipCallback | ( | ULView | view, |
| ULChangeTooltipCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the tooltip under the mouse changes (the text is empty when there's no tooltip).
This is called as the mouse moves over the page, with the tooltip text of the element under the cursor (eg, its title attribute). It may repeat the same text on every move.
The library doesn't display tooltips (and neither does AppCore)– you should draw the text yourself near the cursor and hide it when the text is empty.
| void ulViewSetChangeURLCallback | ( | ULView | view, |
| ULChangeURLCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the main frame loads a new page.
| void ulViewSetCompositorDebugInfoEnabled | ( | ULView | view, |
| bool | enabled ) |
Set whether or not to display compositor debug information.
| view | The View. |
| enabled | Whether or not to show the debug information. |
| void ulViewSetCreateChildViewCallback | ( | ULView | view, |
| ULCreateChildViewCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the page wants to open a new window (a link with target="_blank" or a call to window.open()).
Return a new View from the callback to allow the window or NULL to block it. The library loads target_url into the View, and you display it. popup_rect is the position and size the page asked for in window.open().
| void ulViewSetCreateInspectorViewCallback | ( | ULView | view, |
| ULCreateInspectorViewCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the inspector needs a View to display in (after ulViewCreateLocalInspectorView() or when a remote inspector connects).
Return a new View from the callback or NULL to cancel. The library loads the inspector into the View, and you display it.
| void ulViewSetDeviceScale | ( | ULView | view, |
| double | scale ) |
Set the device scale.
| view | The View. |
| scale | The new device scale (see ulViewGetDeviceScale()). |
| void ulViewSetDiscardCompositionCallback | ( | ULView | view, |
| ULDiscardCompositionCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the page ends the active composition on its own (eg, on navigation or when the selection moves away from it).
Cancel the input method's composition from the callback (on Windows, call ImmNotifyIME() with CPS_CANCEL). The composition's text stays in the page as final text, so don't insert it again.
| void ulViewSetDisplayId | ( | ULView | view, |
| unsigned int | display_id ) |
Set the display id of the View.
You should call this when the View moves to another display.
| view | The View. |
| display_id | The id of the new display (see ulViewConfigSetDisplayId()). |
| void ulViewSetDOMReadyCallback | ( | ULView | view, |
| ULDOMReadyCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when a frame's document has been parsed and the DOM is ready.
This is the best time to read or change the DOM. The page's own DOMContentLoaded event has already fired. This is also called when JavaScript is disabled.
| void ulViewSetDownloadBeginCallback | ( | ULView | view, |
| ULDownloadBeginCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when a download begins.
| void ulViewSetDownloadFailCallback | ( | ULView | view, |
| ULDownloadFailCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when a download fails.
| void ulViewSetDownloadFinishCallback | ( | ULView | view, |
| ULDownloadFinishCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when a download finishes.
| void ulViewSetDownloadNextIdCallback | ( | ULView | view, |
| ULDownloadNextIdCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for generating unique download ids.
| void ulViewSetDownloadReceiveDataCallback | ( | ULView | view, |
| ULDownloadReceiveDataCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when download data is received.
| void ulViewSetDownloadRequestCallback | ( | ULView | view, |
| ULDownloadRequestCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the View requests a download.
| void ulViewSetFailLoadingCallback | ( | ULView | view, |
| ULFailLoadingCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when a load fails (just before the finish-loading callback).
HTTP error responses count as failures (error_domain is "HTTPErrorDomain" and error_code is the HTTP status code). Canceled loads aren't reported.
| void ulViewSetFinishLoadingCallback | ( | ULView | view, |
| ULFinishLoadingCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when a load ends (whether or not it succeeded).
| void ulViewSetMaxRenderFps | ( | ULView | view, |
| unsigned int | fps ) |
Set the maximum rate, in frames per second, at which the View advances its animations and repaints.
(Default = 0, unthrottled)
This caps the View's whole frame loop (requestAnimationFrame, CSS and Web animations, smooth scrolling, and painting).
| view | The View. |
| fps | The frame-rate cap, or 0 to remove it (the View then advances at the display's refresh rate). |
| void ulViewSetNeedsPaint | ( | ULView | view, |
| bool | needs_paint ) |
Set whether or not a view should be repainted during the next call to ulRender().
| view | The View. |
| needs_paint | Whether or not the View needs a repaint. |
| void ulViewSetNetworkRequestCallback | ( | ULView | view, |
| ULNetworkRequestCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the View is about to begin a network request.
| void ulViewSetPageSettledCallback | ( | ULView | view, |
| ULPageSettledCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the page has settled and is ready to capture or display (resources have loaded, initial scripts have run, and layout is stable).
This fires after the finish-loading callback once network and layout activity have stayed idle for a short time (see ulConfigSetPageSettleDelay()).
| void ulViewSetPreferredColorScheme | ( | ULView | view, |
| ULColorScheme | scheme ) |
Set the color scheme this View reports to pages via the prefers-color-scheme CSS media feature.
(Default = kColorScheme_Auto)
Overrides the value set via ulViewConfigSetPreferredColorScheme(). A change re-evaluates prefers-color-scheme media queries on the page. matchMedia change listeners fire and styles recalculate, the same as an OS theme change.
An out-of-range value logs a warning and leaves the View unchanged.
| void ulViewSetRequestCloseCallback | ( | ULView | view, |
| ULRequestCloseCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the page asks to close (window.close() in a window that script opened, or in one with a single page in its history).
| void ulViewSetUpdateCompositionCallback | ( | ULView | view, |
| ULUpdateCompositionCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for after every change to the active composition.
Move the input method's candidate window from the callback (see ulEditorGetCompositionCharacterBounds()).
| void ulViewSetUpdateHistoryCallback | ( | ULView | view, |
| ULUpdateHistoryCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for when the main frame's back-forward history changes.
| void ulViewSetVisible | ( | ULView | view, |
| bool | visible ) |
Set whether or not this View is visible.
(Default = True)
Hiding a View (passing false) stops it from being painted during ulRender and pauses its requestAnimationFrame callbacks and CSS animations (they stop advancing while hidden). The page's visibilitychange event fires with document.visibilityState set to "hidden".
Showing a View again (passing true) resumes its animations and forces a repaint on the next call to ulRender.
| view | The View. |
| visible | Whether or not the View is visible. |
| void ulViewSetWindowObjectReadyCallback | ( | ULView | view, |
| ULWindowObjectReadyCallback | callback, | ||
| void * | user_data, | ||
| ULUserDataDestroyCallback | destroy_user_data ) |
Set callback for before a frame's scripts run.
Set up JavaScript state for the page from the callback (APIs you added with ulViewAttachJSAPI() are already there). Use the DOM-ready callback for anything that needs the DOM.
| void ulViewStop | ( | ULView | view | ) |
Stop all page loads.
| void ulViewUnfocus | ( | ULView | view | ) |
Remove focus from the View.
You should call this to give visual indication that the View has lost input focus. The page gets a window blur event.
| void ulViewUnlockJSContext | ( | ULView | view | ) |
Unlock the page's JSContext after a previous call to ulViewLockJSContext().
Unlock the JSContext of a specific frame after a previous call to ulViewLockJSContextWithFrame().
| view | The View. |
| frame | The frame name you passed to ulViewLockJSContextWithFrame(). |
| typedef void(*) ULAddConsoleMessageCallback(void *user_data, ULView caller, ULMessageSource source, ULMessageLevel level, ULString message, unsigned int line_number, unsigned int column_number, ULString source_id) |
| typedef void(*) ULBeginLoadingCallback(void *user_data, ULView caller, unsigned long long frame_id, bool is_main_frame, ULString url) |
| typedef void(*) ULChangeEditableStateCallback(void *user_data, ULView caller, ULEditableState state) |
| typedef ULView(*) ULCreateChildViewCallback(void *user_data, ULView caller, ULString opener_url, ULString target_url, bool is_popup, ULIntRect popup_rect) |
| typedef ULView(*) ULCreateInspectorViewCallback(void *user_data, ULView caller, bool is_local, ULString inspected_url) |
| typedef void(*) ULDiscardCompositionCallback(void *user_data, ULView caller) |
| typedef void(*) ULDOMReadyCallback(void *user_data, ULView caller, unsigned long long frame_id, bool is_main_frame, ULString url) |
| typedef void(*) ULDownloadBeginCallback(void *user_data, ULView caller, unsigned int id, ULString url, ULString filename, long long expected_content_length) |
Callback for when a download starts.
Open a file to write the data to here. filename is the suggested file name (from the server, or the end of the URL).
| typedef void(*) ULDownloadFailCallback(void *user_data, ULView caller, unsigned int id) |
Callback for when a download fails.
Close the file and delete it here.
| typedef void(*) ULDownloadFinishCallback(void *user_data, ULView caller, unsigned int id) |
Callback for when a download finishes.
Close the file here.
| typedef unsigned int(*) ULDownloadNextIdCallback(void *user_data, ULView caller) |
Callback for when the View needs an ID for a new download.
A download starts when the page navigates to a file it can't display (eg, a response with Content-Disposition: attachment). Downloads are ignored until you set the download callbacks.
The library doesn't write anything to disk. You save the data yourself in these callbacks (called in this order):
| Callback | What to do |
|---|---|
| ULDownloadNextIdCallback | Return a new ID |
| ULDownloadRequestCallback | Return true to accept the download |
| ULDownloadBeginCallback | Open a file |
| ULDownloadReceiveDataCallback | Write the data to the file |
| ULDownloadFinishCallback | Close the file |
| ULDownloadFailCallback | Close the file and delete it |
| typedef void(*) ULDownloadReceiveDataCallback(void *user_data, ULView caller, unsigned int id, ULBuffer data) |
Callback for when a download receives data (usually several times per download).
Write the data to the file here.
| data | The data (only valid during this call, so copy it to keep it). |
| typedef bool(*) ULDownloadRequestCallback(void *user_data, ULView caller, unsigned int id, ULString url) |
Callback for when the page wants to download a file.
| typedef void(*) ULFailLoadingCallback(void *user_data, ULView caller, unsigned long long frame_id, bool is_main_frame, ULString url, ULString description, ULString error_domain, int error_code) |
| typedef void(*) ULFinishLoadingCallback(void *user_data, ULView caller, unsigned long long frame_id, bool is_main_frame, ULString url) |
Callback for before the View sends a network request.
| typedef void(*) ULRequestCloseCallback(void *user_data, ULView caller) |
| typedef void(*) ULUpdateCompositionCallback(void *user_data, ULView caller) |
| typedef void(*) ULUpdateHistoryCallback(void *user_data, ULView caller) |
| typedef void(*) ULWindowObjectReadyCallback(void *user_data, ULView caller, unsigned long long frame_id, bool is_main_frame, ULString url) |
| enum ULCursor |
Cursor types.
| enum ULMessageLevel |
The severity level of a console message.
| Enumerator | |
|---|---|
| kMessageLevel_Log | |
| kMessageLevel_Warning | |
| kMessageLevel_Error | |
| kMessageLevel_Debug | |
| kMessageLevel_Info | |
| enum ULMessageSource |
The source of a console message.