Skip to main content

Crate forge_ui

Crate forge_ui 

Source
Expand description

Forge UI: an owned widget/layout/painting engine with a native desktop adapter.

Applications describe a tree and reduce semantic actions into their own state. IDs are stable identity: never derive an interactive ID from its current value.

use forge_ui::*;
struct Counter(i32);
impl Application for Counter {
    fn view(&self) -> Node {
        Node::column("root", vec![
            Node::label("count", format!("Count: {}", self.0)),
            Node::button("add", "Add one"),
        ]).padding(24.0).gap(12.0)
    }
    fn update(&mut self, action: Action) {
        if action.id == "add" { self.0 += 1; }
    }
}
run(Counter(0), WindowOptions::default()).unwrap();

Modules§

journal
Optional real NEDB persistence adapter. One immutable version holds action + resulting state. Restoration appends a new version; it never deletes or rewrites history.

Structs§

Action
Semantic result of a human or agent interaction, reduced by the application.
Color
Packed opaque RGB color, independent of the windowing backend.
LayoutItem
Node
Declarative widget tree; retained interaction state lives in Ui, keyed by id.
Painter
CPU rasterizer. All public drawing coordinates are logical pixels. Glyphs are cached by character, weight and physical pixel size.
Rect
Style
Theme
Shared design tokens. All widget colors are derived from these tokens.
Ui
Headless-capable layout and interaction runtime. Native and agent input share it.
WindowOptions

Enums§

ActionKind
Axis
Input
Kind
Length
Source

Traits§

Application
Implement this trait to build an app. UI construction is side-effect free.

Functions§

run
Run a native window. Set options.agent to opt into local JSON-lines stdin/stdout. No server is opened. EOF leaves the window open; send quit to exit.

Type Aliases§

PaintFn
Custom painting is clipped to this node’s rectangle. It never receives window access.