Skip to content

Platform-specific API

Include platform headers explicitly; the portable umbrella does not make a backend API available on another target. Platform integration code runs under the owning host’s thread and resource rules.

PlatformViewFactory<Properties, Instance, Controller = void> retains a shared Instance, extracts its stable platform view once, and applies subsequent properties. create and view are required. Non-void properties require update; a controller requires both connect and disconnect. Optional dispose runs after controller disconnection.

Header Namespace Creation context / extracted view
<huxerui/android/platform_registry.h> android Current JNIEnv*, Android Context / local reference to the retained Java View.
<huxerui/ios/platform_registry.h> ios UIViewController* / UIView*.
<huxerui/macos/platform_registry.h> macos AppKit host context / NSView*.
<huxerui/windows/platform_registry.h> windows Parent HWND / child HWND.
<huxerui/web/platform_registry.h> web Browser event loop / detached HTMLElement in emscripten::val.

Register with RootContext::RegisterPlatformView. Direct C++ properties/controllers keep their exact types. Do not return temporary platform views or retain borrowed callback contexts.

The Android registry header also exposes PlatformEnv and GetPlatformEnv(PlatformAdapter&) for the current UI-thread JNI environment/context, PlatformModuleFactory<Module, Options> for direct JNI factories, and JavaPlatformModuleFactory / JavaPlatformViewFactory for Java implementations.

Java factories identify a public, no-argument-constructible class by class_name. Their structured values cross through PlatformPayload; an optional typed facade/controller wraps PlatformChannel. Keep registration in a root hook.

<huxerui/android/jni.h> supplies UTF-8 and byte-array conversion and the move-only LocalRef<Reference>. It deletes only its owned JNI local reference. Never retain JNIEnv*; use explicit global references for Java objects that must outlive a callback.

The Web registry header offers JavaScriptPlatformModuleFactory and JavaScriptPlatformViewFactory. Supply the JavaScript factory object directly from the root hook; there is no second global registration table. Modules provide create/invoke/dispose, with optional request cancellation; views also expose a detached element and property updates.

<huxerui/web/navigation.h> declares BrowserNavigationStack(root, path, resolver, codec). The codec supplies Decode(location) and Encode(path); one stack owns same-document URL synchronization. This does not replace browser server fallback configuration for direct navigation.

All producer objects derive from ExternalTexture; share them through std::shared_ptr.

Header Types and publication
<huxerui/android/external_texture.h> BitmapTexture::Publish(JNIEnv*, jobject), GlTexture::PublishCurrent(Frame), and SurfaceStreamTexture for a platform surface stream.
<huxerui/ios/external_texture.h> PixelBufferTexture::Publish(CVPixelBufferRef) and MetalTexture::Publish(Frame).
<huxerui/macos/external_texture.h> AppKit equivalents of PixelBufferTexture and MetalTexture.
<huxerui/windows/external_texture.h> PixelFormat, PixelFrame, PixelTexture, and D3D11Texture.
<huxerui/linux/external_texture.h> PixelFormat, PixelFrame, PixelTexture, GlTexture, and immutable GdkTexture publication.
<huxerui/web/external_texture.h> VideoFrameTexture::Publish(const emscripten::val&).

Software PixelFrame publication copies straight-alpha RGBA/BGRA rows. GPU producers have format/context/synchronization constraints, not a universal “borrow any texture” contract. Read ExternalTexture integration before choosing one.

<huxerui/windows/installer.h> exposes a specialized WiX Burn application boundary, not a normal desktop application service.

Install windows::InstallInstallerSession once in the installer’s root hooks and enter through RunInstallerApplication() from the generated bootstrapper entry. UseInstaller() returns InstallerHandle; its status supplies product state, phase, progress, failure, and any outstanding prompt.

Install(InstallerInstallOptions), Repair(), Uninstall(), and Cancel() request engine operations. Installation options can override absolute destination and desktop shortcut choice. ChooseDestinationAsync(initial) returns an optional directory; cancellation is empty. Respond(prompt_id, choice) answers the identified prompt; stale IDs are ignored. Do not use this service from an ordinary executable.

Linux currently has no public PlatformView factory header; a GTK renderer does not imply that arbitrary GTK controls can be embedded through the shared component.

PlatformAdapter and backend implementation machinery are not ordinary app APIs. Names in huxerui::detail remain internal even when templates mention them. See platform capabilities for implementation status and validation limits.

The Apple registry headers also expose HUXBufferReference (Swift BufferReference), with retained-owner construction, scoped withUnsafeBytes access and slice(offset:length:). It is a read-only view of live storage, not a frozen snapshot. Keep the native allocation valid and coordinate mutation independently.

The iOS registry additionally exposes HUXGetLocalNotificationData(UNNotificationContent*) (Swift localNotificationData) for a Notification Content Extension to inspect the submitted payload. Validate the payload before using it; this is application data, not an authorization grant.

Windows URL and local-notification registration live in the explicit Windows namespace of the shared <huxerui/system.h> header. See System API.