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’sAppin a<canvas>.
Structs§
- App
- A Stipple application.
Type Aliases§
- Frame
Renderer - A pluggable rasterizer: turns a built
Scene(with a background color, at a scale factor) into thePixmaptheSurfacepresents. Set viaApp::render_withto 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(seeApp::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
Cxfor registering event handlers) to anElementtree. Boxed so each window can hold its own view. - Viewport
Input Fn - A sink for input forwarded to an embedded viewport’s content: receives the
target
ViewportIdand aViewportEvent(pointer/keys/wheel) in viewport-local coordinates. Set viaApp::on_viewport_input.