Loading...
Searching...
No Matches
ultralight Namespace Reference

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
 

Enumerations

enum class  DialogIcon { Info , Warning , Error , Question }
 Enum representing the icon to be displayed in a dialog. More...
 
enum class  ButtonType { OK , OKCancel , YesNo }
 Enum representing the button types in a dialog. More...
 
enum class  ButtonResult { OK , Cancel , Yes , No }
 Enum representing the result of a dialog button press. More...
 
enum  WindowFlags : uint8_t {
  kWindowFlags_Borderless = 1 << 0 , kWindowFlags_Titled = 1 << 1 , kWindowFlags_Resizable = 1 << 2 , kWindowFlags_Maximizable = 1 << 3 ,
  kWindowFlags_Hidden = 1 << 4
}
 Window creation flags. More...
 
enum class  BitmapFormat : uint8_t { A8_UNORM , BGRA8_UNORM_SRGB }
 The various Bitmap formats. More...
 
enum  MessageSource {
  kMessageSource_XML = 0 , kMessageSource_JS , kMessageSource_Network , kMessageSource_ConsoleAPI ,
  kMessageSource_Storage , kMessageSource_AppCache , kMessageSource_Rendering , kMessageSource_CSS ,
  kMessageSource_Security , kMessageSource_ContentBlocker , kMessageSource_Media , kMessageSource_MediaSource ,
  kMessageSource_WebRTC , kMessageSource_ITPDebug , kMessageSource_PrivateClickMeasurement , kMessageSource_PaymentRequest ,
  kMessageSource_Other
}
 MessageSource types. More...
 
enum  MessageType {
  kMessageType_Log = 0 , kMessageType_Dir , kMessageType_DirXML , kMessageType_Table ,
  kMessageType_Trace , kMessageType_StartGroup , kMessageType_StartGroupCollapsed , kMessageType_EndGroup ,
  kMessageType_Clear , kMessageType_Assert , kMessageType_Timing , kMessageType_Profile ,
  kMessageType_ProfileEnd , kMessageType_Image
}
 
enum  MessageLevel {
  kMessageLevel_Log = 0 , kMessageLevel_Warning , kMessageLevel_Error , kMessageLevel_Debug ,
  kMessageLevel_Info
}
 MessageLevel types. More...
 
enum  Cursor {
  kCursor_Pointer = 0 , kCursor_Cross , kCursor_Hand , kCursor_IBeam ,
  kCursor_Wait , kCursor_Help , kCursor_EastResize , kCursor_NorthResize ,
  kCursor_NorthEastResize , kCursor_NorthWestResize , kCursor_SouthResize , kCursor_SouthEastResize ,
  kCursor_SouthWestResize , kCursor_WestResize , kCursor_NorthSouthResize , kCursor_EastWestResize ,
  kCursor_NorthEastSouthWestResize , kCursor_NorthWestSouthEastResize , kCursor_ColumnResize , kCursor_RowResize ,
  kCursor_MiddlePanning , kCursor_EastPanning , kCursor_NorthPanning , kCursor_NorthEastPanning ,
  kCursor_NorthWestPanning , kCursor_SouthPanning , kCursor_SouthEastPanning , kCursor_SouthWestPanning ,
  kCursor_WestPanning , kCursor_Move , kCursor_VerticalText , kCursor_Cell ,
  kCursor_ContextMenu , kCursor_Alias , kCursor_Progress , kCursor_NoDrop ,
  kCursor_Copy , kCursor_None , kCursor_NotAllowed , kCursor_ZoomIn ,
  kCursor_ZoomOut , kCursor_Grab , kCursor_Grabbing , kCursor_Custom
}
 Cursor types,. More...
 
enum class  FaceWinding : uint8_t { Clockwise , CounterClockwise }
 The winding order for front-facing triangles. More...
 
enum class  FontHinting : uint8_t { Smooth , Normal , Monochrome , None }
 
enum class  EffectQuality : uint8_t { Low , Medium , High }
 
enum class  VertexBufferFormat : uint8_t { _2f_4ub_2f , _2f_4ub_2f_2f_28f }
 Vertex buffer formats. More...
 
enum class  ShaderType : uint8_t { Fill , FillPath }
 Shader program types. More...
 
enum class  CommandType : uint8_t { ClearRenderBuffer , DrawGeometry }
 The types of commands. More...
 
enum class  LogLevel : uint8_t { Error , Warning , Info }
 Log levels, used with Logger::LogMessage. More...
 
enum class  ThreadType : uint8_t {
  Unknown = 0 , JavaScript , Compiler , GarbageCollection ,
  Network , Graphics , Audio
}
 The type of thread, you can choose to optionally handle these for better performance. More...
 

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.
 
FontLoaderGetPlatformFontLoader ()
 Get the native font loader for the current platform.
 
FileSystemGetPlatformFileSystem (const String &baseDir)
 Get the native file system for the current platform, creating it if it doesn't exist using the base directory provided.
 
LoggerGetDefaultLogger (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)
 
SurfaceFactoryGetBitmapSurfaceFactory ()
 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 Documentation

◆ Char16

typedef detail::selector<sizeof(wchar_t)>::Char16 Char16

◆ DestroyBitmapCallback

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.

Parameters
user_dataPointer to user-defined user-data (this will be the same value as what was passed to Bitmap::Create, if any)
dataPointer to raw Bitmap pixel data.

◆ DestroyBufferCallback

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.

Parameters
user_dataPointer to user-defined user-data (this will be the same value as what was passed to Buffer::Create, if any)
dataPointer to raw Buffer data.

◆ DownloadId

typedef uint32_t DownloadId

A unique identifier representing an active download.

◆ IndexType

typedef uint32_t IndexType

Vertex index type.

◆ JSCallback

typedef std::function<void(const JSObject&, const JSArgs&)> JSCallback

JSCallback typedef used for binding C++ callbacks to JavaScript functions.

Takes two arguments (const JSObject& thisObj, const JSArgs& args) and returns nothing (void).

◆ JSCallbackWithRetval

typedef std::function<JSValue(const JSObject&, const JSArgs&)> JSCallbackWithRetval

JSCallbackWithRetval typedef used for binding C++ callbacks to JavaScript functions with an optional return value.

Takes two arguments (const JSObject& thisObj, const JSArgs& args) and returns a JSValue back to JavaScript.

◆ LockHolder

using LockHolder = std::lock_guard<Lock>

◆ Point

typedef vec2 Point

Point is typedef'd to a 2D vector.

◆ ThreadEntryPoint

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.

◆ ThreadHandle

typedef uint64_t ThreadHandle

Platform-specific handle.

  • on Windows this is HANDLE
  • on POSIX this is pthread_t

◆ ThreadId

typedef uint32_t ThreadId

Unique id of the thread, used for referencing the created thread later.

  • on Windows this should match the thread identifier returned by either _beginthreadex() or GetCurrentThreadId()
  • on POSIX this can be whatever unique id you want

Enumeration Type Documentation

◆ BitmapFormat

enum class BitmapFormat : uint8_t
strong

The various Bitmap formats.

Enumerator
A8_UNORM 

Alpha channel only, 8-bits per pixel.

Encoding: 8-bits per channel, unsigned normalized.

Color-space: Linear (no gamma), alpha-coverage only.

BGRA8_UNORM_SRGB 

Blue Green Red Alpha channels, 32-bits per pixel.

Encoding: 8-bits per channel, unsigned normalized.

Color-space: sRGB gamma with premultiplied linear alpha channel.

◆ ButtonResult

enum class ButtonResult
strong

Enum representing the result of a dialog button press.

Enumerator
OK 

"OK" button was pressed

Cancel 

"Cancel" button was pressed

Yes 

"Yes" button was pressed

No 

"No" button was pressed

◆ ButtonType

enum class ButtonType
strong

Enum representing the button types in a dialog.

Enumerator
OK 

Single "OK" button.

OKCancel 

"OK" and "Cancel" buttons

YesNo 

"Yes" and "No" buttons

◆ CommandType

enum class CommandType : uint8_t
strong

The types of commands.

This enumeration describes the type of command to execute on the GPU.

See also
Command
Enumerator
ClearRenderBuffer 

Clear the specified render buffer.

DrawGeometry 

Draw the specified geometry to the specified render buffer.

◆ Cursor

enum Cursor

Cursor types,.

See also
ViewListener::OnChangeCursor
Enumerator
kCursor_Pointer 
kCursor_Cross 
kCursor_Hand 
kCursor_IBeam 
kCursor_Wait 
kCursor_Help 
kCursor_EastResize 
kCursor_NorthResize 
kCursor_NorthEastResize 
kCursor_NorthWestResize 
kCursor_SouthResize 
kCursor_SouthEastResize 
kCursor_SouthWestResize 
kCursor_WestResize 
kCursor_NorthSouthResize 
kCursor_EastWestResize 
kCursor_NorthEastSouthWestResize 
kCursor_NorthWestSouthEastResize 
kCursor_ColumnResize 
kCursor_RowResize 
kCursor_MiddlePanning 
kCursor_EastPanning 
kCursor_NorthPanning 
kCursor_NorthEastPanning 
kCursor_NorthWestPanning 
kCursor_SouthPanning 
kCursor_SouthEastPanning 
kCursor_SouthWestPanning 
kCursor_WestPanning 
kCursor_Move 
kCursor_VerticalText 
kCursor_Cell 
kCursor_ContextMenu 
kCursor_Alias 
kCursor_Progress 
kCursor_NoDrop 
kCursor_Copy 
kCursor_None 
kCursor_NotAllowed 
kCursor_ZoomIn 
kCursor_ZoomOut 
kCursor_Grab 
kCursor_Grabbing 
kCursor_Custom 

◆ DialogIcon

enum class DialogIcon
strong

Enum representing the icon to be displayed in a dialog.

Enumerator
Info 

Information icon.

Warning 

Warning icon.

Error 

Error icon.

Question 

Question icon.

◆ EffectQuality

enum class EffectQuality : uint8_t
strong
Enumerator
Low 

Fastest effect quality– uses the lowest quality effects (half-resolution, fewer passes, etc.)

Medium 

Default effect quality– strikes a good balance between quality and performance.

High 

Highest effect quality– favors quality over performance.

◆ FaceWinding

enum class FaceWinding : uint8_t
strong

The winding order for front-facing triangles.

(Only used when the GPU renderer is used)

Enumerator
Clockwise 

Clockwise Winding (Direct3D, etc.)

CounterClockwise 

Counter-Clockwise Winding (OpenGL, etc.)

◆ FontHinting

enum class FontHinting : uint8_t
strong
Enumerator
Smooth 

Lighter hinting algorithm– glyphs are slightly fuzzier but better resemble their original shape.

This is achieved by snapping glyphs to the pixel grid only vertically which better preserves inter-glyph spacing.

Normal 

Default hinting algorithm– offers a good balance between sharpness and shape at smaller font sizes.

Monochrome 

Strongest hinting algorithm– outputs only black/white glyphs.

The result is usually unpleasant if the underlying TTF does not contain hints for this type of rendering.

None 

No hinting is performed– fonts may be blurry at smaller font sizes.

◆ LogLevel

enum class LogLevel : uint8_t
strong

Log levels, used with Logger::LogMessage.

Enumerator
Error 
Warning 
Info 

◆ MessageLevel

MessageLevel types.

Enumerator
kMessageLevel_Log 
kMessageLevel_Warning 
kMessageLevel_Error 
kMessageLevel_Debug 
kMessageLevel_Info 

◆ MessageSource

MessageSource types.

Enumerator
kMessageSource_XML 
kMessageSource_JS 
kMessageSource_Network 
kMessageSource_ConsoleAPI 
kMessageSource_Storage 
kMessageSource_AppCache 
kMessageSource_Rendering 
kMessageSource_CSS 
kMessageSource_Security 
kMessageSource_ContentBlocker 
kMessageSource_Media 
kMessageSource_MediaSource 
kMessageSource_WebRTC 
kMessageSource_ITPDebug 
kMessageSource_PrivateClickMeasurement 
kMessageSource_PaymentRequest 
kMessageSource_Other 

◆ MessageType

Enumerator
kMessageType_Log 
kMessageType_Dir 
kMessageType_DirXML 
kMessageType_Table 
kMessageType_Trace 
kMessageType_StartGroup 
kMessageType_StartGroupCollapsed 
kMessageType_EndGroup 
kMessageType_Clear 
kMessageType_Assert 
kMessageType_Timing 
kMessageType_Profile 
kMessageType_ProfileEnd 
kMessageType_Image 

◆ ShaderType

enum class ShaderType : uint8_t
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.

See also
GPUState::shader_type
Enumerator
Fill 

Shader program for filling quad geometry.

FillPath 

Shader program for filling tesselated path geometry.

◆ ThreadType

enum class ThreadType : uint8_t
strong

The type of thread, you can choose to optionally handle these for better performance.

Enumerator
Unknown 
JavaScript 
Compiler 
GarbageCollection 
Network 
Graphics 
Audio 

◆ VertexBufferFormat

enum class VertexBufferFormat : uint8_t
strong

Vertex buffer formats.

This enumeration describes the format of a vertex buffer.

Note
Identifiers start with an underscore due to C++ naming rules.
See also
VertexBuffer
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)

◆ WindowFlags

enum WindowFlags : uint8_t

Window creation flags.

See also
Window::Create
Enumerator
kWindowFlags_Borderless 
kWindowFlags_Titled 
kWindowFlags_Resizable 
kWindowFlags_Maximizable 
kWindowFlags_Hidden 

Function Documentation

◆ AdoptRef()

template<typename T >
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());

◆ Convert()

template<typename To = void, typename From >
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>().

Template Parameters
ToThe target string type (optional, deduced in common cases)
FromThe source string type (optional)
Parameters
fromThe string to convert
Returns
The converted string in the target type

Example

ultralight::String myStr("Hello, world!");
// ultralight::String -> std::string
std::string stdStr = ultralight::Convert(myStr);
// ultralight::String -> std::string_view
std::string_view svStr = ultralight::Convert<std::string_view>(myStr);
// std::string -> ultralight::String
// std::string_view -> ultralight::String
ultralight::String fromView = ultralight::Convert(std::string_view("View"));
Unicode string container with conversions for UTF-8, UTF-16, and UTF-32.
Definition String.h:34
auto Convert(const From &from)
Convert between string types.
Definition StringSTL.h:99

◆ GetBitmapSurfaceFactory()

SurfaceFactory * GetBitmapSurfaceFactory ( )

Get the default Bitmap Surface Factory singleton.

(Do not destroy this, this singleton is owned by the library).

◆ GetDefaultLogger()

Logger * GetDefaultLogger ( const String & logPath)

Get the default logger (writes the log to a file on disk).

Parameters
logPathA file path to write the log to.
Note
This singleton is owned by the library, do not destroy it.

◆ GetJSContext()

JSContextRef GetJSContext ( )

Get the current JSContext.

◆ GetKeyFromVirtualKeyCode()

void GetKeyFromVirtualKeyCode ( int virtual_key_code,
bool shift,
String & key_result )

Utility function for generating a key string from a virtual key-code.

Parameters
virtual_key_codeThe virtual key-code to generate the key string from.
shiftWhether or not the shift key is currently pressed.
key_resultThe string to store the result in.
Note
This function assumes US keyboard layout.
See also
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values

◆ GetKeyIdentifierFromVirtualKeyCode()

void GetKeyIdentifierFromVirtualKeyCode ( int virtual_key_code,
String & key_identifier_result )

Utility function for generating a key identifier string from a virtual key-code.

Parameters
virtual_key_codeThe virtual key-code to generate the key identifier from.
key_identifier_resultThe string to store the result in.

◆ GetPlatformFileSystem()

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.

Parameters
baseDirAn 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.
Note
This singleton is owned by the library, do not destroy it.

◆ GetPlatformFontLoader()

FontLoader * GetPlatformFontLoader ( )

Get the native font loader for the current platform.

Note
This singleton is owned by the library, do not destroy it.

◆ JSEval()

JSValue JSEval ( const JSString & str)

Evaluate a string of JavaScript and return a result.

◆ JSGlobalObject()

JSObject JSGlobalObject ( )

Get the Global Object for the current JSContext.

In JavaScript, this would be equivalent to the "window" object.

◆ operator!=() [1/5]

bool operator!= ( const Matrix & a,
const Matrix & b )

◆ operator!=() [2/5]

bool operator!= ( const Matrix4x4 & a,
const Matrix4x4 & b )

◆ operator!=() [3/5]

template<typename T , typename U >
bool operator!= ( const RefPtr< T > & a,
const RefPtr< U > & b )

◆ operator!=() [4/5]

template<typename T , typename U >
bool operator!= ( const RefPtr< T > & a,
const U * b )

◆ operator!=() [5/5]

template<typename T , typename U >
bool operator!= ( const T * a,
const RefPtr< U > & b )

◆ operator==() [1/5]

bool operator== ( const Matrix & a,
const Matrix & b )

◆ operator==() [2/5]

bool operator== ( const Matrix4x4 & a,
const Matrix4x4 & b )

◆ operator==() [3/5]

template<typename T , typename U >
bool operator== ( const RefPtr< T > & a,
const RefPtr< U > & b )

◆ operator==() [4/5]

template<typename T , typename U >
bool operator== ( const RefPtr< T > & a,
const U * b )

◆ operator==() [5/5]

template<typename T , typename U >
bool operator== ( const T * a,
const RefPtr< U > & b )

◆ SetJSContext()

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.

Note
You MUST set a JSContext before using most of the C++ API below.

◆ ShowMessageBox()

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.

Parameters
titleThe title of the message box.
messageThe message to display in the message box.
iconThe icon to display in the message box (default: DialogIcon::Info).
buttonsThe button type to display in the message box (default: ButtonType::OK).
Returns
The result of the button press.

◆ swap()

template<class T >
void swap ( RefPtr< T > & a,
RefPtr< T > & b )