NAME
view.h - Bark reactive UI viewport, layout, input events, video slots, and asset loading.
SYNOPSIS
Classes
Axis-aligned layout rectangle in logical viewport pixels.
Normalized input event passed to bark_view_on_event() callbacks.
Window and stylesheet configuration for bark_view_open().
Parsed DOM KeyboardEvent JSON payload delivered to onKeyDown handlers.
Macros
Typedefs
Opaque visual document host handle.
Axis-aligned layout rectangle in logical viewport pixels.
Input and window event categories delivered to bark_view_event_fn.
Normalized input event passed to bark_view_on_event() callbacks.
Application render callback returning the root bud_node* VDOM tree.
Callback receiving UTF-8 bytes typed into an embedded #term ANSI terminal.
Optional custom image fetcher callback when an <img> source is not cached.
Raw event interceptor; return non-zero to consume the event before VDOM dispatch.
Window and stylesheet configuration for bark_view_open().
Optional callback executed immediately after each VDOM reconciliation pass.
Parsed DOM KeyboardEvent JSON payload delivered to onKeyDown handlers.
Enumerations
Input and window event categories delivered to bark_view_event_fn.
Functions
Open a windowed or headless visual host from cfg.
Close and destroy a host opened with bark_view_open().
Create a bare offscreen/headless visual host of size vw x vh.
Destroy a visual host created with bark_view_create().
Load and parse a CSS stylesheet from a file path.
Load and parse a CSS stylesheet from an in-memory string.
Set a CSS custom property (e.g. --accent")atruntime.
Override loaded font handles for sans/mono regular and bold faces.
Set the base directory for resolving relative <img src=...">paths.
Auto-discover installed/bundled CSS and asset directory relative to argv0 and config_dir.
Install a custom image fetch callback for uncached <img> URLs.
Supply encoded image bytes for a cached src URL or data URI.
Check whether src is decoded and ready, optionally returning pixel dimensions.
Bind a bark_net_t handle so relative/HTTP <img> tags auto-fetch from origin.
Return the count of in-flight network image fetches.
Block up to timeout_ms pumping net until pending images finish loading.
Bind a bark_sys_t handle for clipboard and file drag-and-drop integration.
Register the application's declarative render function invoked on sync.
Register a post-reconciliation hook (useful for updating video slot bindings).
Register an input callback for an embedded #term ANSI terminal widget.
Toggle dark mode defaults at runtime.
Set the active global view instance used by WASM DOM callbacks.
Upload an RGBA8 frame directly to a <video id=...">element.
Alias for bark_view_push_video_rgba().
Upload an RGBA8 frame to a named video source key shared across video slots.
Clear and release a named video source key.
Bind a <video id=...">elementtoanamedsourcekey(orNULLtoclear).
Bind an existing OpenGL texture ID directly to a <video id=...">element.
Detach any video frame or source from <video id=...">.
Scroll a scrollable container element (id) to its bottom edge.
Mark the VDOM dirty so the next bark_view_sync() re-renders.
Return non-zero if a re-render is pending.
Resize the logical viewport (primarily for headless tests).
Query the current logical viewport width and height.
Poll OS window/input events; returns 0 when the user closes the window.
Invoke the render callback (if dirty) and reconcile the VDOM diff.
Render the reconciled layout tree to the active OpenGL framebuffer.
Sync (if dirty), clear with clear_rgb, render, swap buffers, and pace to target_fps.
Register a raw input event interceptor invoked before VDOM event dispatch.
Inject a synthetic bark_view_event_t (useful in headless automated tests).
Attach native window input callbacks to the VDOM dispatcher.
Dispatch a named event directly on the VDOM root node.
Query pixel dimensions of the active <canvas> WebGL2 stage surface.
Bind and prepare the <canvas> WebGL2 stage surface for custom 3D rendering.
Finish custom 3D rendering on the <canvas> stage surface.
Append ANSI-formatted terminal output bytes to an embedded #term widget.
Return the number of rendered lines in the #term scrollback buffer.
Copy plain text of line idx_from_bottom from the #term widget into buf.
Return the last rendered root bud_node* tree (read-only inspection).
Query the computed layout bounding box of element id. Returns 1 if found.
Hit-test whether an element with id lies at viewport coordinates (x, y).
Hit-test whether an element with CSS class cls lies at (x, y).
Hit-test whether an element with HTML tag tag lies at (x, y).
Walk ancestors at (x, y) matching class cls and extract attribute attr and rect.
Return non-zero when a text <input> or <textarea> currently has keyboard focus.
Return non-zero when the embedded #term widget currently has keyboard focus.
Return non-zero when the document / window is currently visible to the user.
Detailed Description
Bark reactive UI viewport, layout, input events, video slots, and asset loading.
Visual browser-like declarative UI host (libbud VDOM + CSS on native OpenGL or browser DOM).
Reconciles declarative libbud VDOM trees and CSS stylesheets into either a native desktop window (OpenGL/GLFW/liblamina), an offscreen headless layout engine for automated UI tests, or the live browser DOM in WASM.
Macro Definition Documentation
#define BARK_MOD_ALT 4
Alt/Option modifier bit.
#define BARK_MOD_CTRL 2
Control modifier bit.
#define BARK_MOD_META 8
Super/Command modifier bit.
#define BARK_MOD_SHIFT 1
Shift modifier bit.
#define BARK_MOUSE_LEFT 0
Primary mouse button.
#define BARK_MOUSE_MIDDLE 2
Middle mouse button.
#define BARK_MOUSE_RIGHT 1
Secondary mouse button.
Enumeration Type Documentation
enum bark_ev_type
Input and window event categories delivered to bark_view_event_fn.
Enumerator
- BARK_EV_NONE
- No event.
- BARK_EV_RESIZE
- Viewport resized.
- BARK_EV_MOUSE_MOVE
- Pointer moved.
- BARK_EV_MOUSE_BTN
- Mouse button pressed or released.
- BARK_EV_SCROLL
- Mouse wheel or trackpad scroll.
- BARK_EV_KEY
- Physical key press/repeat/release.
- BARK_EV_CHAR
- Unicode text character input.
- BARK_EV_FILE_DROP
- OS file dropped onto window.
Author
Generated automatically by Doxygen for Bark from the source code.