Expand description
Denise’s scene graph, widgets and compositor.
A retained tree of widgets in a generational arena, stacked into scenes, drawn
through denise_render into a denise::Surface. This is the layer that
turns “a rasteriser and a display” into “a user interface”.
#[derive(Clone, Debug)]
enum Msg { Ok }
let mut ui: Ui<Msg> = Ui::new(Size::new(1920, 1080), theme::DARK);
let root = ui.root();
ui.add(root, Panel::default(), Rect::new(40, 40, 400, 240));
loop {
// ui.handle(&events);
ui.render(surface)?; // draws nothing at all when nothing changed
for message in ui.drain_messages() {
match message { Msg::Ok => {} }
}
}§Why a separate crate
denise is the platform-agnostic contract — geometry, colour, the pixel
buffer, input, damage, theming — and denise_render is the rasteriser that
depends on it. Widgets need both, so they cannot live in either without a
dependency cycle. Keeping them here also means a signage application that draws
its own scene links no arena, no tree and no widget code at all.
§What is not here
No layout engine. Nodes are positioned with explicit rectangles relative to their parent, which is what a fixed-resolution panel actually wants; a constraint solver can be added over this without changing anything below it.
Re-exports§
pub use anchor::Anchors;pub use anchor::Dock;pub use cursor::ARROW;pub use cursor::CROSSHAIR;pub use cursor::Cursor;pub use cursor::CursorImage;pub use motion::Motion;pub use motion::Wake;pub use overlay::Side;pub use overlay::anchored;pub use widget::Animation;pub use widget::Event;pub use widget::EventCtx;pub use widget::Handled;pub use widget::MeasureCtx;pub use widget::Measured;pub use widget::Offer;pub use widget::PaintCtx;pub use widget::VisualState;pub use widget::Void;pub use widget::Widget;pub use widgets::Alert;pub use widgets::Align;pub use widgets::Badge;pub use widgets::Button;pub use widgets::Checkbox;pub use widgets::Describe;pub use widgets::Divider;pub use widgets::DynDescribe;pub use widgets::Label;pub use widgets::List;pub use widgets::ListItem;pub use widgets::Mismatch;pub use widgets::Orientation;pub use widgets::Panel;pub use widgets::Progress;pub use widgets::Property;pub use widgets::PropertyError;pub use widgets::PropertyKind;pub use widgets::RadialProgress;pub use widgets::RadioGroup;pub use widgets::Select;pub use widgets::Slider;pub use widgets::Spinner;pub use widgets::TabEvent;pub use widgets::Tabs;pub use widgets::TextArea;pub use widgets::TextBuffer;pub use widgets::TextDocument;pub use widgets::TextInput;pub use widgets::Toggle;pub use widgets::Tree;pub use widgets::TreeItem;pub use widgets::Value;pub use widgets::open_select;
Modules§
- anchor
- What a node does when its parent is not the size it was designed against.
- cursor
- The composite cursor sprite.
- motion
- How fast the tree animates, and how a widget says what it is waiting for.
- overlay
- Placing a rectangle beside another one, and flipping when it will not fit.
- widget
- What a widget is, and the two contexts it is handed.
- widgets
- The widgets that ship with Denise.
Structs§
- FontId
- Identifies a font within one
TextEngine. - NodeId
- Identifies a node for exactly as long as that node exists.
- Text
Engine - Fonts, a bounded glyph cache, and everything that needs both.
- Text
Style - A font and a size, together, because neither is much use alone.
- Ui
- A retained tree of widgets, a stack of scenes, and the damage they generate.
Traits§
- Glyph
Source - A thing that can lay out, measure and rasterise glyphs.