![]() |
Ultralight C++ API 1.4.0
|
Namespaces | |
namespace | KeyCodes |
Namespace containing all the key-code definitions for KeyboardEvent. | |
Classes | |
class | App |
Main application singleton (use this if you want to let the library manage window creation). More... | |
class | AppListener |
Interface for all App-related events. More... | |
class | Bitmap |
A thread-safe container for pixel data. More... | |
class | BitmapSurface |
The default surface implementation, backed by a bitmap. More... | |
class | Buffer |
A fixed-size container for raw byte data. More... | |
class | Clipboard |
User-defined clipboard interface. More... | |
struct | Command |
A command to execute on the GPU. More... | |
struct | CommandList |
List of commands to execute on the GPU. More... | |
struct | Config |
Core configuration for the renderer. More... | |
class | ConsoleMessage |
Interface for console messages. More... | |
struct | CreateThreadResult |
Result of creating a new thread. More... | |
class | DownloadListener |
User-defined interface to handle download-related events for a View. More... | |
class | FileSystem |
User-defined file system interface. More... | |
class | FontFile |
Represents a font file, either on-disk path or in-memory file contents. More... | |
class | FontLoader |
User-defined font loader interface. More... | |
class | GamepadAxisEvent |
Event representing a change in gamepad axis state (eg, pressing a stick in a certain direction). More... | |
class | GamepadButtonEvent |
Event representing a change in gamepad button state (eg, pressing a button on a gamepad). More... | |
class | GamepadEvent |
Event representing a change in gamepad connection state. More... | |
class | GPUDriver |
User-defined GPU driver interface. More... | |
struct | GPUState |
The state of the GPU for a given draw command. More... | |
class | ImageSource |
User-defined image source to display custom images on a web-page. More... | |
class | ImageSourceListener |
Listener for ImageSource events. More... | |
class | ImageSourceProvider |
Maps image sources to string identifiers. More... | |
class | ImageSourceProviderListener |
Listener for ImageSourceProvider events. More... | |
struct | IndexBuffer |
Index buffer description. More... | |
struct | IntRect |
Integer Rectangle Helper. More... | |
struct | is_string_type |
Trait to check if a type is a supported string-like type. More... | |
struct | is_string_type< const char * > |
struct | is_string_type< std::string > |
struct | is_string_type< std::string_view > |
struct | is_string_type< String > |
class | JSArgs |
A vector of JSValues, used for passing around arguments in JSCallback. More... | |
class | JSArray |
JSArray wrapper that automatically manages lifetime and provides convenient access to indices and Array functions. More... | |
class | JSContext |
This class wraps a JSContextRef (a JavaScript execution context for use with JavaScriptCore) and locks the context on the current thread for the duration of its lifetime. More... | |
class | JSFunction |
JSFunction wrapper that automatically manages lifetime and provides convenient function invocation operators. More... | |
class | JSObject |
JSObject wrapper that automatically manages lifetime and provides convenient access to properties. More... | |
class | JSPropertyValue |
Wrapper for JSObject property value (JSValue subclass). More... | |
class | JSString |
JavaScript String wrapper that automatically manages JSStringRef lifetime and provides helpful conversions. More... | |
class | JSValue |
JavaScript variant value wrapper that automatically manages JSValueRef lifetime and provides helpful conversions. More... | |
struct | JSValueNullTag |
Tag type used with the JSValue constructor to create "Null" types. More... | |
struct | JSValueUndefinedTag |
Tag type used with the JSValue constructor to create "Undefined" types. More... | |
class | KeyEvent |
Keyboard event representing a change in keyboard state. More... | |
class | LoadListener |
User-defined interface to handle load-related events for a View. More... | |
class | Lock |
Tiny, efficient spinlock that is optimized for short locking periods but will still intelligently yield the current thread and save CPU if the lock is held longer. More... | |
class | LockedPixels |
Forward declaration for the LockedPixels class. More... | |
class | Logger |
User-defined logging interface. More... | |
struct | Matrix |
Transformation Matrix helper. More... | |
struct | Matrix4x4 |
4x4 Matrix Helper More... | |
class | Monitor |
A platform-specific monitor. More... | |
class | MouseEvent |
Mouse event representing a change in mouse state. More... | |
class | NetworkListener |
User-defined interface to handle network-related events for a View. More... | |
class | NetworkRequest |
Interface for Network requests. More... | |
class | Overlay |
Web-content overlay, displays a web-page within a portion of a Window. More... | |
class | Platform |
Global platform singleton, manages user-defined platform handlers and global config. More... | |
struct | Rect |
Float Rectangle Helper. More... | |
class | RefCounted |
Interface for all ref-counted objects that will be managed using the RefPtr<> smart pointer. More... | |
class | RefPtr |
A nullable smart pointer. More... | |
struct | RenderBuffer |
Render buffer description. More... | |
class | Renderer |
Core renderer singleton for the library, coordinates all library functions. More... | |
struct | RenderTarget |
Offscreen render target, used when rendering Views via the GPU renderer. More... | |
struct | RoundedRect |
Rounded Rectangle Helper. More... | |
class | ScrollEvent |
Scroll event representing a change in scroll state. More... | |
class | Session |
Storage for a browsing session (cookies, local storage, etc.). More... | |
struct | Settings |
App-specific settings. More... | |
class | String |
Unicode string container with conversions for UTF-8, UTF-16, and UTF-32. More... | |
class | String16 |
A null-terminated UTF-16 string container. More... | |
class | String16Vector |
A UTF-16 string vector. More... | |
class | String32 |
A null-terminated UTF-32 string container. More... | |
class | String8 |
A null-terminated UTF-8 string container. More... | |
class | Surface |
User-defined pixel buffer surface. More... | |
class | SurfaceFactory |
User-defined factory to provide your own surface implementation. More... | |
class | ThreadFactory |
User-defined factory for creating new threads. More... | |
struct | vec2 |
2D Vector Helper More... | |
struct | vec3 |
3D Vector Helper More... | |
struct | vec4 |
4D Vector Helper More... | |
struct | Vertex_2f_4ub_2f |
Vertex layout for path vertices. More... | |
struct | Vertex_2f_4ub_2f_2f_28f |
Vertex layout for quad vertices. More... | |
struct | VertexBuffer |
Vertex buffer description. More... | |
class | View |
Web-page container rendered to an offscreen surface. More... | |
struct | ViewConfig |
View-specific configuration settings. More... | |
class | ViewListener |
User-defined interface to handle general events for a View. More... | |
class | Window |
A platform-specific window. More... | |
class | WindowListener |
Interface for all Window-related events. More... | |
Typedefs | |
typedef std::function< void(const JSObject &, const JSArgs &)> | JSCallback |
JSCallback typedef used for binding C++ callbacks to JavaScript functions. | |
typedef std::function< JSValue(const JSObject &, const JSArgs &)> | JSCallbackWithRetval |
JSCallbackWithRetval typedef used for binding C++ callbacks to JavaScript functions with an optional return value. | |
typedef void(* | DestroyBitmapCallback) (void *user_data, void *data) |
Function signature for a user-defined destruction callback to be optionally called when the Bitmap is destroyed. | |
typedef void(* | DestroyBufferCallback) (void *user_data, void *data) |
Function signature for a user-defined destruction callback to optionally be called when Buffer is destroyed. | |
typedef vec2 | Point |
Point is typedef'd to a 2D vector. | |
typedef uint32_t | DownloadId |
A unique identifier representing an active download. | |
using | LockHolder = std::lock_guard<Lock> |
typedef uint32_t | IndexType |
Vertex index type. | |
typedef uint32_t | ThreadId |
Unique id of the thread, used for referencing the created thread later. | |
typedef uint64_t | ThreadHandle |
Platform-specific handle. | |
typedef void(* | ThreadEntryPoint) (void *) |
Entry point for the thread, this function should be called by the thread once it is active and should be passed entry_point_data as the argument. | |
typedef detail::selector< sizeof(wchar_t)>::Char16 | Char16 |
Functions | |
ButtonResult | ShowMessageBox (const String &title, const String &message, DialogIcon icon=DialogIcon::Info, ButtonType buttons=ButtonType::OK) |
Shows a modal message box with the specified title, message, icon, and buttons. | |
void | SetJSContext (JSContextRef ctx) |
Set the current JSContext. | |
JSContextRef | GetJSContext () |
Get the current JSContext. | |
JSObject | JSGlobalObject () |
Get the Global Object for the current JSContext. | |
JSValue | JSEval (const JSString &str) |
Evaluate a string of JavaScript and return a result. | |
FontLoader * | GetPlatformFontLoader () |
Get the native font loader for the current platform. | |
FileSystem * | GetPlatformFileSystem (const String &baseDir) |
Get the native file system for the current platform, creating it if it doesn't exist using the base directory provided. | |
Logger * | GetDefaultLogger (const String &logPath) |
Get the default logger (writes the log to a file on disk). | |
void | GetKeyIdentifierFromVirtualKeyCode (int virtual_key_code, String &key_identifier_result) |
Utility function for generating a key identifier string from a virtual key-code. | |
void | GetKeyFromVirtualKeyCode (int virtual_key_code, bool shift, String &key_result) |
Utility function for generating a key string from a virtual key-code. | |
bool | operator== (const Matrix &a, const Matrix &b) |
bool | operator!= (const Matrix &a, const Matrix &b) |
bool | operator== (const Matrix4x4 &a, const Matrix4x4 &b) |
bool | operator!= (const Matrix4x4 &a, const Matrix4x4 &b) |
SurfaceFactory * | GetBitmapSurfaceFactory () |
Get the default Bitmap Surface Factory singleton. | |
template<typename T > | |
RefPtr< T > | AdoptRef (T &reference) |
Helper for wrapping new objects with the RefPtr smart pointer. | |
template<class T > | |
void | swap (RefPtr< T > &a, RefPtr< T > &b) |
template<typename T , typename U > | |
bool | operator== (const RefPtr< T > &a, const RefPtr< U > &b) |
template<typename T , typename U > | |
bool | operator== (const RefPtr< T > &a, const U *b) |
template<typename T , typename U > | |
bool | operator== (const T *a, const RefPtr< U > &b) |
template<typename T , typename U > | |
bool | operator!= (const RefPtr< T > &a, const RefPtr< U > &b) |
template<typename T , typename U > | |
bool | operator!= (const RefPtr< T > &a, const U *b) |
template<typename T , typename U > | |
bool | operator!= (const T *a, const RefPtr< U > &b) |
template<typename To = void, typename From > | |
auto | Convert (const From &from) |
Convert between string types. | |
typedef detail::selector<sizeof(wchar_t)>::Char16 Char16 |
typedef void(* DestroyBitmapCallback) (void *user_data, void *data) |
Function signature for a user-defined destruction callback to be optionally called when the Bitmap is destroyed.
user_data | Pointer to user-defined user-data (this will be the same value as what was passed to Bitmap::Create, if any) |
data | Pointer to raw Bitmap pixel data. |
typedef void(* DestroyBufferCallback) (void *user_data, void *data) |
Function signature for a user-defined destruction callback to optionally be called when Buffer is destroyed.
Users can use this to deallocate any data associated with the Buffer.
user_data | Pointer to user-defined user-data (this will be the same value as what was passed to Buffer::Create, if any) |
data | Pointer to raw Buffer data. |
typedef uint32_t DownloadId |
A unique identifier representing an active download.
typedef uint32_t IndexType |
Vertex index type.
typedef std::function<void(const JSObject&, const JSArgs&)> JSCallback |
typedef std::function<JSValue(const JSObject&, const JSArgs&)> JSCallbackWithRetval |
using LockHolder = std::lock_guard<Lock> |
typedef void(* ThreadEntryPoint) (void *) |
Entry point for the thread, this function should be called by the thread once it is active and should be passed entry_point_data as the argument.
typedef uint64_t ThreadHandle |
Platform-specific handle.
typedef uint32_t ThreadId |
Unique id of the thread, used for referencing the created thread later.
|
strong |
The various Bitmap formats.
|
strong |
|
strong |
|
strong |
The types of commands.
This enumeration describes the type of command to execute on the GPU.
Enumerator | |
---|---|
ClearRenderBuffer | Clear the specified render buffer. |
DrawGeometry | Draw the specified geometry to the specified render buffer. |
enum Cursor |
Cursor types,.
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
Log levels, used with Logger::LogMessage.
Enumerator | |
---|---|
Error | |
Warning | |
Info |
enum MessageLevel |
enum MessageSource |
MessageSource types.
enum MessageType |
|
strong |
Shader program types.
Each of these correspond to a vertex/pixel shader pair. You can find stock shader code for these in the shaders
folder of the AppCore repo.
Enumerator | |
---|---|
Fill | Shader program for filling quad geometry. |
FillPath | Shader program for filling tesselated path geometry. |
|
strong |
|
strong |
Vertex buffer formats.
This enumeration describes the format of a vertex buffer.
Enumerator | |
---|---|
_2f_4ub_2f | Vertex_2f_4ub_2f (used for path rendering) |
_2f_4ub_2f_2f_28f | Vertex_2f_4ub_2f_2f_28f (used for quad rendering) |
enum WindowFlags : uint8_t |
Window creation flags.
Enumerator | |
---|---|
kWindowFlags_Borderless | |
kWindowFlags_Titled | |
kWindowFlags_Resizable | |
kWindowFlags_Maximizable | |
kWindowFlags_Hidden |
RefPtr< T > AdoptRef | ( | T & | reference | ) |
Helper for wrapping new objects with the RefPtr smart pointer.
All ref-counted object are created with an initial ref-count of '1'. The AdoptRef() helper returns a RefPtr<T> without calling AddRef(). This is used for creating new objects, like so:
RefPtr<Object> ref = AdoptRef(*new ObjectImpl());
auto Convert | ( | const From & | from | ) |
Convert between string types.
This function provides efficient conversion between different string types. It supports ultralight::String, std::string, std::string_view, and const char*.
The following type conversions are automatically deduced (no template argument needed):
For explicit conversion to std::string_view, use Convert<std::string_view>().
To | The target string type (optional, deduced in common cases) |
From | The source string type (optional) |
from | The string to convert |
SurfaceFactory * GetBitmapSurfaceFactory | ( | ) |
Get the default logger (writes the log to a file on disk).
logPath | A file path to write the log to. |
JSContextRef GetJSContext | ( | ) |
Get the current JSContext.
void GetKeyFromVirtualKeyCode | ( | int | virtual_key_code, |
bool | shift, | ||
String & | key_result ) |
Utility function for generating a key string from a virtual key-code.
virtual_key_code | The virtual key-code to generate the key string from. |
shift | Whether or not the shift key is currently pressed. |
key_result | The string to store the result in. |
void GetKeyIdentifierFromVirtualKeyCode | ( | int | virtual_key_code, |
String & | key_identifier_result ) |
Utility function for generating a key identifier string from a virtual key-code.
virtual_key_code | The virtual key-code to generate the key identifier from. |
key_identifier_result | The string to store the result in. |
FileSystem * GetPlatformFileSystem | ( | const String & | baseDir | ) |
Get the native file system for the current platform, creating it if it doesn't exist using the base directory provided.
This is used to load data for file:/// URLs.
baseDir | An base file path that will be used to resolve relative file paths. You can optionally specify "@resource_path" on macOS to use the app bundle's resource path. |
FontLoader * GetPlatformFontLoader | ( | ) |
Get the native font loader for the current platform.
JSObject JSGlobalObject | ( | ) |
Get the Global Object for the current JSContext.
In JavaScript, this would be equivalent to the "window" object.
bool operator!= | ( | const RefPtr< T > & | a, |
const U * | b ) |
bool operator!= | ( | const T * | a, |
const RefPtr< U > & | b ) |
bool operator== | ( | const RefPtr< T > & | a, |
const U * | b ) |
bool operator== | ( | const T * | a, |
const RefPtr< U > & | b ) |
void SetJSContext | ( | JSContextRef | ctx | ) |
Set the current JSContext.
Most JavaScriptCore C API calls require an active JavaScript execution context (JSContextRef). You can get the JSContextRef for a page via View::LockJSContext()
. This context changes with each page navigation.
ButtonResult ShowMessageBox | ( | const String & | title, |
const String & | message, | ||
DialogIcon | icon = DialogIcon::Info, | ||
ButtonType | buttons = ButtonType::OK ) |
Shows a modal message box with the specified title, message, icon, and buttons.
title | The title of the message box. |
message | The message to display in the message box. |
icon | The icon to display in the message box (default: DialogIcon::Info). |
buttons | The button type to display in the message box (default: ButtonType::OK). |