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.
- Layout
Item - Node
- Declarative widget tree; retained interaction state lives in
Ui, keyed byid. - 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.
- Window
Options
Enums§
Traits§
- Application
- Implement this trait to build an app. UI construction is side-effect free.
Functions§
- run
- Run a native window. Set
options.agentto opt into local JSON-lines stdin/stdout. No server is opened. EOF leaves the window open; sendquitto exit.
Type Aliases§
- PaintFn
- Custom painting is clipped to this node’s rectangle. It never receives window access.