Per-instance UI context: backends, theme, text engine, frame state, and routing.
More...
|
|
| UIContext (const UIContext &)=delete |
|
UIContext & | operator= (const UIContext &)=delete |
|
| UIContext (UIContext &&)=delete |
|
UIContext & | operator= (UIContext &&)=delete |
| void | attachBackend (IRenderer *r, IPlatform *p, IAssetProvider *a, UIContext **ownerSlot=nullptr) |
| | Attach renderer, platform, and asset backends to this context.
|
|
void | detachBackend () |
| | Flush pooled render targets while the renderer is still valid and clear backend pointers.
|
|
FontHandle | loadFont (std::string_view name, std::string_view path) |
| | Load a TTF/OTF font from disk under logical name.
|
|
FontHandle | loadFontFromMemory (std::string_view name, const void *data, size_t size) |
| | Load a TTF/OTF font from memory under logical name (copies bytes).
|
|
void | unloadFont (std::string_view name) |
| | Unload a font by logical name.
|
|
FontHandle | getFont (std::string_view name) const |
| | Look up a loaded font by logical name ({0} if not found).
|
|
void | setDefaultFont (FontHandle h) |
| | Set the fallback font used when a node specifies no font or an unknown font name.
|
|
FontHandle | defaultFont () const |
| | Return the current default font handle ({0} if none).
|
|
TextureHandle | loadTexture (std::string_view name, std::string_view path) |
| | Load a 2D texture from disk under logical name.
|
|
TextureHandle | loadTextureFromMemory (std::string_view name, const void *data, size_t size) |
| | Load a 2D texture from encoded image bytes (PNG/JPG/BMP/...) under logical name.
|
|
void | unloadTexture (std::string_view name) |
| | Unload a 2D texture by logical name.
|
|
TextureHandle | getTexture (std::string_view name) const |
| | Look up a loaded 2D texture by logical name ({0} if not found).
|
|
EffectHandle | loadEffect (std::string_view name, std::string_view fsPath, std::string_view vsPath={}) |
| | Load a fragment (and optional vertex) shader from disk under logical name.
|
|
EffectHandle | loadEffectFromMemory (std::string_view name, std::string_view fsSource, std::string_view vsSource={}) |
| | Load a shader effect from in-memory source strings under logical name.
|
|
EffectHandle | loadEffectAsset (std::string_view name, std::string_view baseDir, std::string_view fileStem) |
| | Load a shader effect by stem fileStem under baseDir, automatically resolving the file extension for the active renderer's ShaderLanguage.
|
|
void | unloadEffect (std::string_view name) |
| | Unload a shader effect by logical name.
|
|
EffectHandle | getEffect (std::string_view name) const |
| | Look up a loaded shader effect by logical name ({0} if not found).
|
|
void | consumeClick (MouseButton b) |
| | Mark b as consumed; subsequent handlers in the same frame will skip it.
|
|
bool | wasConsumed (MouseButton b) const |
| | true if b was already consumed this frame.
|
| ZMarkup::Registry & | markupRegistry () |
| | Return this context's isolated ZMarkup::Registry, lazily initialized with built-in widgets.
|
|
const ZMarkup::Registry * | markupRegistryPtr () const noexcept |
| | Return this context's ZMarkup::Registry if initialized, or nullptr without allocating.
|
|
void | invalidateStyles () |
| | Force style-cache invalidation across the tree.
|
|
bool | isPressTarget (const Layout *n) const |
| | true if n is the current press target.
|
|
bool | isValidClick () const |
| | true if press and release targets agree (a valid click).
|
|
bool | isDragging () const noexcept |
| | true while a drag gesture has crossed dragThreshold and is active.
|
|
bool | hasPendingDrag () const noexcept |
| | true while a press on a draggable node is waiting to cross dragThreshold.
|
|
void | clearDragState () |
| | Reset all pending/active drag state and destroy any active drag ghost without invoking callbacks.
|
|
std::shared_ptr< Layout > | dragGhost () const |
| | Return the currently active drag ghost node, or nullptr if none.
|
|
void | applyCursor (CursorShape shape) |
| | Apply shape to the active platform backend, deduplicating unchanged requests.
|
|
void | setTextInputRect (Rect inputRect, float cursorXOffset=0.0f) |
| | Forward the active text-input IME rect to the platform, deduplicating unchanged rects.
|
| void | resetImeRectState () |
| | Clear cached IME rect state (e.g.
|
|
Rect | getCullingClip () const |
| | Active screen-space clip rect used by Layout::draw() for off-screen culling.
|
|
void | pushLayerTarget (TargetHandle t, float targetScale=1.0f) |
| | Push an off-screen target while preserving the root screen-space culling clip.
|
|
void | popLayerTarget () |
| | Pop an off-screen target pushed via pushLayerTarget.
|
| void | beginFrame (float delta_time) |
| | Advance the frame: pull platform state and reset one-shot flags.
|
|
void | endFrame () |
| | End-of-frame housekeeping (trims idle pooled render targets).
|
|
void | requestFocus (std::shared_ptr< Layout > n) |
| | Set n as the focused node; null clears focus.
|
|
void | mount (Layout &root) |
| | Attach a root Layout subtree to this context and set it as the primary root.
|
|
void | mount (const std::shared_ptr< Layout > &root) |
|
void | unmount (Layout &root) |
| | Detach a previously mounted root Layout subtree from this context.
|
|
void | unmount (const std::shared_ptr< Layout > &root) |
|
void | unmount () |
| | Detach the currently mounted primary root, if any.
|
|
Layout * | mountedRoot () const |
| | Return the primary root set by mount(), or nullptr if none.
|
|
void | detachAllRoots () |
| | Detach every root currently attached to this context.
|
|
void | runFrame (float dt) |
| | Run one full update/measure/arrange frame on the mounted primary root.
|
|
void | renderFrame () |
| | Render the mounted primary root (beginFrame, draw, endFrame).
|
|
void | runFrame (Layout &root, float dt) |
| | Run one full update/measure/arrange frame on root using this context.
|
|
void | renderFrame (Layout &root) |
| | Render root (beginFrame, draw, endFrame) using this context.
|
|
void | releaseFocus () |
| | Clear focus.
|
|
bool | hasFocus (const Layout *n) const |
| | true if n is the current focused node.
|