Skip to main content

Crate stipple

Crate stipple 

Source
Expand description

Stipple — a cross-platform, self-drawn UI toolkit in Rust.

This umbrella crate ties the layers together and provides the App entry point and a prelude. See ROADMAP.md for the architecture and phased plan.

use stipple::prelude::*;

struct Counter {
    n: i64,
}

let mut app = App::new(Counter { n: 0 }, |state: &Counter, cx: &mut Cx<Counter>| {
    let theme = *cx.theme();
    panel(
        &theme,
        vec![button(&theme).on_tap(cx, |s: &mut Counter| s.n += 1)],
    )
})
.title("Counter")
.logical_size(Size::new(360.0, 200.0));

// Render one frame off-screen (no window needed) and inspect it.
let frame = app.render_once();
assert_eq!(frame.size().width, 360);

Modules§

anim
Animation primitives for Stipple.
core
Stipple’s runtime core.
geometry
2D geometry primitives for the Stipple UI toolkit.
layout
Stipple’s layout primitives.
platform
Stipple’s platform layer.
prelude
The common imports for building a Stipple app.
render
The Stipple rendering seam.
style
Design tokens and themes for Stipple’s self-drawn widgets.
widgets
Stipple’s self-drawn widget library.

Macros§

web_app
Make this crate a web app: generate the C ABI that web/stipple.js (in Stipple’s repository) calls to run $make’s App in a <canvas>.

Structs§

App
A Stipple application.

Type Aliases§

FrameRenderer
A pluggable rasterizer: turns a built Scene (with a background color, at a scale factor) into the Pixmap the Surface presents. Set via App::render_with to route frames through a GPU backend.
MenuFn
A menu bar declared as a function of the app state (see App::menu).
ThemeFn
The active theme as a function of the app state and the theme set with App::theme (see App::theme_with).
TrayFn
A tray icon declared as a function of the app state (see App::tray).
ViewFn
A view closure mapping the shared state (and a Cx for registering event handlers) to an Element tree. Boxed so each window can hold its own view.
ViewportInputFn
A sink for input forwarded to an embedded viewport’s content: receives the target ViewportId and a ViewportEvent (pointer/keys/wheel) in viewport-local coordinates. Set via App::on_viewport_input.