Files
craft-libs/docs/contract-api.md
T
dotCooCoo 1ccea91875 ui-contract: an app can keep Alt codes to the keypad, and a host that composes codes ends its Alt hold
On Windows and Linux the raw-input step folds every unclaimed Alt+digit
into an Alt code, top-row digits included, so an app had no way to keep
top-row Alt+digits as key presses for its shortcuts.

RootEnv::alt_code_keys(AltCodeKeys::Keypad) keeps codes to the keypad
digits, the ones Windows composes codes from, read from the press's
physical key. A top-row Alt+digit then stays a key press: the app's
shortcuts can take it, and a focused text field types the digit's own
text. A top-row digit typed during a keypad code ends that code like any
other key. AltCodeKeys::AllDigits stays the default.

A host that composes keypad codes itself, from the platform's own key
messages, takes their digits out of the input before egui reads it. The
raw-input step then saw Alt go down and up with no key between, and the
key stage read the release as a lone Alt: an alert in a field that holds
drafts, or menu bar focus. runtime::egui::input::alt_code_digits_taken
marks the Alt hold under way, and its release ends a code instead. A
focus loss before the release clears the mark.
2026-11-30 01:14:00 -08:00

778 KiB
Raw Blame History

Contract API

Generated by cl cargo run -p craft-ui-gallery --bin contract-api; do not edit. Every public item of craft_behavior and of the shared modules of craft_ui (contract, layout, layout_components, primitives, runtime, style, testing and the crate root), by public path, with its signature line and the first sentence of its doc comment. Inherent methods and trait methods are indented under their type. Setters written by #[derive(Props)] are not listed: each #[prop] field of a type is a setter of the same name.

craft-ui-contract defines every module listed here except layout_components, which craft-ui-widgets defines; the craft-ui facade re-exports each under the same name. craft_ui::testing also re-exports the story helpers of craft-ui-widgets, testing::internals of craft-ui-panels and the tool and canvas fixtures of craft-ui-canvas, which are not listed.

craft_behavior

Pure UI behaviours (layer 1): press lifecycle, ValueDrag, navigation, item layouts, edit events, overlay::place, fit and the other rules that read no Context.

  • craft_behavior::AccessAction: re-export of accesskit::Action (outside these crates).
  • craft_behavior::AccessData: re-export of accesskit::ActionData (outside these crates).
  • craft_behavior::AccessRequest: re-export of craft_behavior::intent::AccessRequest.
  • craft_behavior::Anchor9: re-export of craft_behavior::anchor::Anchor9.
  • craft_behavior::Applied: re-export of craft_behavior::value::Applied.
  • craft_behavior::Arrangement: re-export of craft_behavior::arrangement::Arrangement.
  • craft_behavior::Arrows: pub enum Arrows { All, Horizontal, Vertical, None }. Which arrow keys a roving group moves its lead with.
  • craft_behavior::Axis: re-export of craft_behavior::flow::Axis.
  • craft_behavior::Buttons: re-export of craft_behavior::press::Buttons.
  • craft_behavior::CancelReason: re-export of craft_behavior::value::CancelReason.
  • craft_behavior::CancelRule: re-export of craft_behavior::focus::CancelRule.
  • craft_behavior::CanvasTransform: re-export of craft_behavior::canvas::CanvasTransform.
  • craft_behavior::CanvasView: pub struct CanvasView { pub rect: ScreenRect, pub center: Point, pub zoom: f64, pub rotation: f64, pub flip_x: bool, pub aspect: f64 }. How a canvas shows its document: where, how large, turned and mirrored how.
    • pub fn new(rect: ScreenRect, center: Point, zoom: f64) -> Self. An upright, unmirrored, square-pixel view of rect showing center at zoom.
    • pub const fn rotation(mut self, degrees: f64) -> Self. The same view turned degrees clockwise.
    • pub const fn flip_x(mut self, flip: bool) -> Self. The same view mirrored left-right (or not).
    • pub const fn aspect(mut self, aspect: f64) -> Self. The same view with a document unit aspect times as wide as it is tall.
    • pub fn points_per_unit(device_zoom: f64, pixels_per_point: f32) -> f64. zoom for a view that shows device_zoom device pixels per document unit at pixels_per_point: 1 shows one document pixel per device pixel at any interface scale.
    • pub fn affine(&self) -> Affine. Document to screen points.
    • pub fn to_screen(&self, p: Point) -> Pos2. Where the view draws document point p.
    • pub fn to_doc(&self, p: Pos2) -> Point. The document point under screen position p.
    • pub fn map_vec(&self, v: Vec2) -> ScreenVec. A document vector as the view draws it: stretched, turned, zoomed and mirrored.
    • pub fn unmap_vec(&self, v: ScreenVec) -> Vec2. The document vector a screen vector shows: the inverse of [map_vec].
    • pub fn zoom_x(&self) -> f64. Screen points per document unit along the document's x axis: zoom × aspect.
    • pub fn extent(&self, r: Rect) -> ScreenVec. The screen size of the box that holds document rect r at the view's zoom, rotation, aspect and flip: the bounding box of [CanvasView::quad].
    • pub fn quad(&self, r: Rect) -> [Pos2; 4]. The screen corners of document rect r, in order round it: (x0, y0), (x1, y0), (x1, y1), (x0, y1).
    • pub fn visible(&self) -> Rect. The document bounds of the screen rect: every document point the view can show.
    • pub fn doc_len(&self, points: f32) -> f64. A screen distance in document units along the document's y axis (divide by [zoom_x] for its x axis).
    • pub fn layer_transform(&self) -> Option<CanvasTransform>. The transform a canvas body is shown through when this view only scales and moves the document: unturned, unmirrored and square. None for any other view; its controls register parts in screen space through [to_screen] instead.
    • pub fn axis_aligned(&self) -> bool. Whether the rotation is a multiple of 90°, so document axes are screen axes.
    • pub fn level(&self, zero: Point) -> CanvasView. The view without its rotation, moved so it draws zero where this view does: the same zoom, flip and aspect, so ticks measured with it never stretch.
  • craft_behavior::Caret: re-export of craft_behavior::codec::Caret.
  • craft_behavior::CellAdvance: pub enum CellAdvance { Enter, Tab }. Which key moves the active cell after an entry: Enter goes down the rows, Tab along a row.
  • craft_behavior::CellAt: re-export of craft_behavior::selection::CellAt.
  • craft_behavior::CellDirection: pub enum CellDirection { Up, Down, Left, Right }. A move of one cell.
  • craft_behavior::CellRange: re-export of craft_behavior::selection::CellRange.
  • craft_behavior::CellSelection: re-export of craft_behavior::selection::CellSelection.
  • craft_behavior::Codec: re-export of craft_behavior::codec::Codec.
  • craft_behavior::ColumnKey: re-export of craft_behavior::columns::ColumnKey.
  • craft_behavior::ColumnWidth: re-export of craft_behavior::columns::ColumnWidth.
  • craft_behavior::CommandFlags: re-export of craft_behavior::command::CommandFlags.
  • craft_behavior::ControlMetrics: re-export of craft_behavior::sizing::ControlMetrics.
  • craft_behavior::CopyKeys: re-export of craft_behavior::keys::CopyKeys.
  • craft_behavior::CountMark: re-export of craft_behavior::cursor::CountMark.
  • craft_behavior::Cursor: re-export of craft_behavior::cursor::Cursor.
  • craft_behavior::CursorBadge: re-export of craft_behavior::cursor::CursorBadge.
  • craft_behavior::CursorIcon: re-export of craft_behavior::cursor::CursorIcon.
  • craft_behavior::CursorPriority: re-export of craft_behavior::cursor::CursorPriority.
  • craft_behavior::DigitEntry: re-export of craft_behavior::digit_keys::DigitEntry.
  • craft_behavior::DigitKeys: re-export of craft_behavior::digit_keys::DigitKeys.
  • craft_behavior::DisplayOrder: re-export of craft_behavior::item_source::DisplayOrder.
  • craft_behavior::DocKey: re-export of craft_behavior::doc_key::DocKey.
  • craft_behavior::DockSide: re-export of craft_behavior::dock::DockSide.
  • craft_behavior::DragModifier: re-export of craft_behavior::value_drag::DragModifier.
  • craft_behavior::DragModifiers: re-export of craft_behavior::value_drag::DragModifiers.
  • craft_behavior::DragWarp: re-export of craft_behavior::value_drag::DragWarp.
  • craft_behavior::DropOperation: re-export of craft_behavior::keys::DropOperation.
  • craft_behavior::EditCommand: re-export of craft_behavior::intent::EditCommand.
  • craft_behavior::EditEvent: re-export of craft_behavior::value::EditEvent.
  • craft_behavior::EditEvents: re-export of craft_behavior::value::EditEvents.
  • craft_behavior::EditHistory: re-export of craft_behavior::edit_history::EditHistory.
  • craft_behavior::EditPolicy: re-export of craft_behavior::value::EditPolicy.
  • craft_behavior::EditRun: re-export of craft_behavior::typing::EditRun.
  • craft_behavior::EditorInput: re-export of craft_behavior::editor::EditorInput.
  • craft_behavior::Ended: re-export of craft_behavior::typing::Ended.
  • craft_behavior::EscapeRule: re-export of craft_behavior::typing::EscapeRule.
  • craft_behavior::Escaped: re-export of craft_behavior::typing::Escaped.
  • craft_behavior::FRAME_STEP_MAX: re-export of craft_behavior::frame_step::FRAME_STEP_MAX.
  • craft_behavior::Flow: re-export of craft_behavior::flow::Flow.
  • craft_behavior::FreeLayout: re-export of craft_behavior::item_layout::FreeLayout.
  • craft_behavior::GESTURE_GAP: re-export of craft_behavior::wheel::GESTURE_GAP.
  • craft_behavior::Gesture: re-export of craft_behavior::value::Gesture.
  • craft_behavior::GestureId: re-export of craft_behavior::value::GestureId.
  • craft_behavior::GestureNote: re-export of craft_behavior::value::GestureNote.
  • craft_behavior::GesturePhase: re-export of craft_behavior::value::GesturePhase.
  • craft_behavior::Granularity: re-export of craft_behavior::intent::Granularity.
  • craft_behavior::GridCursor: re-export of craft_behavior::grid::GridCursor.
  • craft_behavior::GridFacts: re-export of craft_behavior::role_rule::GridFacts.
  • craft_behavior::GridMeasure: re-export of craft_behavior::grid::GridMeasure.
  • craft_behavior::GridSection: re-export of craft_behavior::columns::GridSection.
  • craft_behavior::GridView: re-export of craft_behavior::columns::GridView.
  • craft_behavior::HitLevel: re-export of craft_behavior::hit::HitLevel.
  • craft_behavior::HitPriority: re-export of craft_behavior::hit::HitPriority.
  • craft_behavior::HitShape: re-export of craft_behavior::hit::HitShape.
  • craft_behavior::HoldRepeat: re-export of craft_behavior::hold_repeat::HoldRepeat.
  • craft_behavior::IconId: re-export of craft_behavior::cursor::IconId.
  • craft_behavior::Input: re-export of craft_behavior::input::Input.
  • craft_behavior::Insets: re-export of craft_behavior::flow::Insets.
  • craft_behavior::Intent: re-export of craft_behavior::intent::Intent.
  • craft_behavior::ItemLayout: re-export of craft_behavior::item_layout::ItemLayout.
  • craft_behavior::ItemSource: re-export of craft_behavior::item_source::ItemSource.
  • craft_behavior::KeyOwner: re-export of craft_behavior::focus::KeyOwner.
  • craft_behavior::KeyRole: re-export of craft_behavior::keys::KeyRole.
  • craft_behavior::Keyed: re-export of craft_behavior::item_source::Keyed.
  • craft_behavior::LabelColumn: re-export of craft_behavior::label_column::LabelColumn.
  • craft_behavior::LabelPlacement: re-export of craft_behavior::label_column::LabelPlacement.
  • craft_behavior::Letters: pub enum Letters { None, TypeAhead }. Whether a roving group matches typed letters to entries.
  • craft_behavior::LineIndex: re-export of craft_behavior::item_layout::LineIndex.
  • craft_behavior::MarqueeMode: re-export of craft_behavior::item_marquee::MarqueeMode.
  • craft_behavior::MarqueeSelect: re-export of craft_behavior::item_marquee::MarqueeSelect.
  • craft_behavior::Metrics: re-export of craft_behavior::sizing::Metrics.
  • craft_behavior::MiddleButton: re-export of craft_behavior::middle_scroll::MiddleButton.
  • craft_behavior::MiddleScroll: re-export of craft_behavior::middle_scroll::MiddleScroll.
  • craft_behavior::Mixed: re-export of craft_behavior::value::Mixed.
  • craft_behavior::Monitor: re-export of craft_behavior::monitor::Monitor.
  • craft_behavior::MonitorKey: re-export of craft_behavior::monitor::MonitorKey.
  • craft_behavior::MotionKind: re-export of craft_behavior::motion::MotionKind.
  • craft_behavior::MotionMode: re-export of craft_behavior::motion::MotionMode.
  • craft_behavior::MoveMods: re-export of craft_behavior::intent::MoveMods.
  • craft_behavior::MultiTap: re-export of craft_behavior::press::MultiTap.
  • craft_behavior::MultiTouch: re-export of craft_behavior::press::MultiTouch.
  • craft_behavior::NavMove: re-export of craft_behavior::intent::NavMove.
  • craft_behavior::NavOutline: pub trait NavOutline. Positions, not keys: the key-free part of DisplayOrder.
    • fn len(&self) -> usize. The number of positions.
    • fn depth(&self, at: usize) -> usize. The nesting depth of the position, 0 for a root.
    • fn has_children(&self, at: usize) -> bool. Whether the position has children.
    • fn open(&self, at: usize) -> bool. Whether the position's children show.
    • fn is_section(&self, at: usize) -> bool. Whether the position is a section header, which a move skips.
    • fn enabled(&self, at: usize) -> bool. Whether the position can take the lead.
    • fn row_len(&self, _row: usize) -> Option<usize>. RaggedGrid: the number of positions in row; rows hold consecutive positions. None past the last row.
    • fn column_shift(&self, _from: usize, _to: usize) -> isize. RaggedGrid: how many columns a vertical move from row from to row to shifts the column by, for rows that are offset against each other (a honeycomb's). 0 for rows that line up.
    • fn columns(&self) -> usize. Cell: the cells of every position (a row of a sheet).
    • fn first_column(&self) -> Option<usize>. WrappedGrid: the column of position 0 when the grid has blank cells before it (the leading days of a calendar month), None for a grid that fills from its first column.
    • fn rect(&self, _at: usize) -> Option<Rect>. Spatial: where the position sits, in any one coordinate space.
    • fn is_empty(&self) -> bool. Whether there are no positions.
  • craft_behavior::NavShape: pub enum NavShape { Flat, Tree, WrappedGrid { columns: usize }, BoundedGrid { columns: usize }, RaggedGrid, Cell, Spatial }. The geometry a collection's keyboard navigation follows.
    • pub const fn wrapped_grid(columns: usize) -> Self. Equal-width cells that wrap at columns.
    • pub const fn bounded_grid(columns: usize) -> Self. Equal-width cells in columns columns whose Left and Right stop at the row ends.
  • craft_behavior::NavState: pub struct NavState { pub lead: Option<usize>, pub anchor: Option<usize>, pub page: usize, pub wrap: bool, pub column: usize }. Where a navigation stands between moves.
    • pub const fn new() -> Self. A state with no lead, a page of ten and no wrap.
    • pub const fn at(lead: usize) -> Self. A state at lead.
    • pub const fn page(mut self, rows: usize) -> Self. Sets the page size.
    • pub const fn wrap(mut self, on: bool) -> Self. Sets whether moves wrap.
    • pub const fn column(mut self, column: usize) -> Self. Sets the lead cell's column.
  • craft_behavior::NavStep: pub enum NavStep { Stay, Moved(usize), Expand(usize), Collapse(usize), Column(usize), Unhandled }. What one move did.
  • craft_behavior::NotAValue: re-export of craft_behavior::codec::NotAValue.
  • craft_behavior::NumberCodec: re-export of craft_behavior::codec::NumberCodec.
  • craft_behavior::Outline: re-export of craft_behavior::item_source::Outline.
  • craft_behavior::OwnerClass: re-export of craft_behavior::focus::OwnerClass.
  • craft_behavior::PaintedCursor: re-export of craft_behavior::cursor::PaintedCursor.
  • craft_behavior::ParseNote: re-export of craft_behavior::codec::ParseNote.
  • craft_behavior::PartKey: re-export of craft_behavior::part::PartKey.
  • craft_behavior::PartRef: re-export of craft_behavior::part::PartRef.
  • craft_behavior::PassInput: re-export of craft_behavior::press::PassInput.
  • craft_behavior::PixelSize: re-export of craft_behavior::pixel_size::PixelSize.
  • craft_behavior::PlacedSelection: pub struct PlacedSelection. The selected cells by position in one display order: the rows and columns of each range, and the cells taken out of them.
    • pub fn of_rows(spans: impl IntoIterator<Item = Range<usize>>) -> Self. The selected rows spans, every column of each.
    • pub fn of_cells(ranges: Vec<(Range<usize>, Range<u32>)>, mut removed: Vec<(usize, u32)>) -> Self. The ranges ranges (row positions, column positions) without the cells removed.
    • pub fn holds_row(&self, at: usize) -> bool. Whether the row at position at has a selected cell.
    • pub fn holds_cell(&self, at: usize, column: u32) -> bool. Whether the cell at row position at and column position column is selected.
    • pub fn rows(&self) -> Vec<usize>. The positions of the rows that have a selected cell, ascending.
  • craft_behavior::PlainText: re-export of craft_behavior::codec::PlainText.
  • craft_behavior::Playback: re-export of craft_behavior::motion::Playback.
  • craft_behavior::PointerButton: re-export of craft_behavior::press::PointerButton.
  • craft_behavior::PointerEvent: re-export of craft_behavior::press::PointerEvent.
  • craft_behavior::PointerGlyph: re-export of craft_behavior::cursor::PointerGlyph.
  • craft_behavior::PointerKind: re-export of craft_behavior::press::PointerKind.
  • craft_behavior::PointerSample: re-export of craft_behavior::press::PointerSample.
  • craft_behavior::Positions: pub struct Positions. The display order of a grid whose row keys are their positions (a sheet, a document table): key(at) == at, and index_of answers without a scan.
    • pub const fn new(rows: u32) -> Self. The order of rows rows.
  • craft_behavior::PressAside: re-export of craft_behavior::press::PressAside.
  • craft_behavior::PressCancel: re-export of craft_behavior::press::PressCancel.
  • craft_behavior::PressFocus: re-export of craft_behavior::focus::PressFocus.
  • craft_behavior::PressMachine: re-export of craft_behavior::press::PressMachine.
  • craft_behavior::PressPhase: re-export of craft_behavior::press::PressPhase.
  • craft_behavior::PressPick: re-export of craft_behavior::press::PressPick.
  • craft_behavior::PressStart: re-export of craft_behavior::press::PressStart.
  • craft_behavior::PressState: re-export of craft_behavior::press::PressState.
  • craft_behavior::PressStep: re-export of craft_behavior::press::PressStep.
  • craft_behavior::Preview: re-export of craft_behavior::value::Preview.
  • craft_behavior::Proposal: re-export of craft_behavior::sizing::Proposal.
  • craft_behavior::Reader: re-export of craft_behavior::quantity::Reader.
  • craft_behavior::ReorderKeys: re-export of craft_behavior::keys::ReorderKeys.
  • craft_behavior::ResolveFor: re-export of craft_behavior::hit::ResolveFor.
  • craft_behavior::RoleRule: re-export of craft_behavior::role_rule::RoleRule.
  • craft_behavior::Roving: pub struct Roving { pub shape: NavShape, pub wrap: bool, pub home_end: bool, pub page: Option<usize>, pub letters: Letters, pub arrows: Arrows, pub first_column: Option<usize>, pub hands_back: bool, pub no_lead: bool, pub keeps_lead_moves: bool }. A roving group's rules: one Tab stop whose members take moves.
    • pub const fn new(shape: NavShape) -> Roving. A group of shape with Home and End, no wrap, no paging and no letters.
    • pub const fn wrap(mut self, on: bool) -> Self. Whether moves wrap.
    • pub const fn home_end(mut self, on: bool) -> Self. Whether Home and End move to the ends.
    • pub const fn page(mut self, rows: Option<usize>) -> Self. Rows a Page key covers.
    • pub const fn letters(mut self, letters: Letters) -> Self. Whether letters pick entries.
    • pub const fn arrows(mut self, arrows: Arrows) -> Self. The arrows the group takes.
    • pub const fn first_column(mut self, column: usize) -> Self. The column of the first member of a wrapped grid with column blank cells before it: Up and Down keep the column, Home and End go to the ends of the row.
    • pub const fn hands_back(mut self) -> Self. A move the group cannot make reaches the owning component, which may page or change what the group shows.
    • pub const fn keeps_lead_moves(mut self) -> Self. Left and Right with the lead modifier reach the focused member.
    • pub const fn no_lead(mut self, on: bool) -> Self. Whether the focused member is no lead: the next move starts at an end, as from a group with no lead.
    • pub const fn state(&self, lead: Option<usize>) -> NavState. The state a step over this group starts from, at lead, or from no lead when the group has none.
    • pub const fn takes(&self, mv: NavMove, mods: MoveMods) -> bool. Whether the group handles mv with mods: Page moves only with a page size and without lead (on a document canvas that scrolls sideways), Start and End only with Home and End, and no lead_step in a group that keeps_lead_moves.
  • craft_behavior::RowAt: re-export of craft_behavior::selection::RowAt.
  • craft_behavior::RulerUnits: pub struct RulerUnits { pub per_doc: f64, pub ticks: Ticks, pub labels: TickLabels }. The ruler unit of one document axis: its size, its ticks and how it labels them.
    • pub const fn new(per_doc: f64, ticks: Ticks) -> Self. Ruler units of per_doc per document unit, spaced by ticks, labelled as [TickLabels::Distance].
    • pub const fn with_labels(mut self, labels: TickLabels) -> Self. The units with their ticks written as labels.
    • pub const fn pixels() -> Self. Whole document pixels.
    • pub fn step(&self, zoom: f64, step_min: f32) -> (f64, u32). The labelled step in ruler units and its subdivisions when one document unit is zoom screen points along this axis, with labels at least step_min points apart.
    • pub fn snap_to_tick(&self, position: f64, zero: f64, zoom: f64, step_min: f32) -> f64. position (document units) moved to the nearest minor tick of the ruler counting from zero, at zoom screen points per document unit (PhotoCraft's Shift snap, #3770).
    • pub fn distance(&self, position: f64, zero: f64) -> f64. The distance of position (document units) from zero, in ruler units.
    • pub fn label_decimals(&self, step: f64) -> RangeInclusive<usize>. The least and most decimals a ruler writes a tick of labelled step step with.
    • pub fn label_value(&self, value: f64, step: f64) -> f64. The number a ruler prints at the tick value (ruler units from the zero point) for a labelled step step:
  • craft_behavior::SHEET_ZOOM: re-export of craft_behavior::item_layout::SHEET_ZOOM.
  • craft_behavior::ScopeKind: re-export of craft_behavior::focus::ScopeKind.
  • craft_behavior::ScrollPos: re-export of craft_behavior::scroll::ScrollPos.
  • craft_behavior::ScrollSpan: re-export of craft_behavior::scroll::ScrollSpan.
  • craft_behavior::Selection: re-export of craft_behavior::selection::Selection.
  • craft_behavior::SelectionChange: re-export of craft_behavior::selection::SelectionChange.
  • craft_behavior::SelectionModel: re-export of craft_behavior::selection::SelectionModel.
  • craft_behavior::Sense: re-export of craft_behavior::sense::Sense.
  • craft_behavior::Shape: re-export of craft_behavior::hit::Shape.
  • craft_behavior::SheetLayout: re-export of craft_behavior::item_layout::SheetLayout.
  • craft_behavior::SizeHint: re-export of craft_behavior::item_source::SizeHint.
  • craft_behavior::SizeTween: re-export of craft_behavior::layout_memory::SizeTween.
  • craft_behavior::SpanLayout: re-export of craft_behavior::item_layout::SpanLayout.
  • craft_behavior::SurroundingUnit: re-export of craft_behavior::editor::SurroundingUnit.
  • craft_behavior::TextPos: re-export of craft_behavior::intent::TextPos.
  • craft_behavior::TickLabels: pub enum TickLabels { Distance, Signed }. How a ruler writes the number at a labelled tick.
  • craft_behavior::Ticks: pub enum Ticks { Decimal { whole: bool }, Custom(fn(f64) -> (f64, u32)) }. How a ruler divides its unit at a zoom.
    • pub const fn decimal(whole: bool) -> Self. PhotoCraft's decimal steps; whole keeps the step a whole number of units without 2.5.
  • craft_behavior::TileLayout: re-export of craft_behavior::item_layout::TileLayout.
  • craft_behavior::TypeAhead: pub struct TypeAhead. Typed letters of the last second as one prefix.
    • pub const fn new() -> Self. An empty buffer.
    • pub fn push(&mut self, letter: char, now: f64) -> &str. Adds letter typed at now seconds and returns the prefix, its letters as typed: case is the caller's fold, applied in pick, so it follows the interface language.
    • pub fn pick<'a>(prefix: &str, from: Option<usize>, len: usize, label: impl Fn(usize) -> std::borrow::Cow<'a, str>, fold: impl Fn(&str) -> String,) -> Option<usize>. The entry a prefix picks: the first match from the position after from when the prefix is one letter or one repeated letter (so repeating a letter cycles), from from itself for a longer prefix, wrapping at the end.
  • craft_behavior::Typed: re-export of craft_behavior::typing::Typed.
  • craft_behavior::TypingRun: re-export of craft_behavior::typing::TypingRun.
  • craft_behavior::Validity: re-export of craft_behavior::value::Validity.
  • craft_behavior::Value: re-export of craft_behavior::value::Value.
  • craft_behavior::ValueDrag: re-export of craft_behavior::value_drag::ValueDrag.
  • craft_behavior::ViewHistory: pub struct ViewHistory<K>. The places a window jumped between, oldest first, with the one it shows now.
    • pub const LIMIT: usize. Entries kept; the oldest go first.
    • pub fn leave(&mut self, place: ViewPlace<K>). The view is about to jump away from place: its entry keeps the centre and zoom the jump left it at, so Go Back returns there.
    • pub fn visit(&mut self, place: ViewPlace<K>). The view jumped to place.
    • pub fn go(&mut self, step: isize, exists: impl Fn(&K) -> bool) -> Option<ViewPlace<K>>. Go Back or Go Forward: the place to show, skipping places that no longer exist.
  • craft_behavior::ViewPlace: pub struct ViewPlace<K> { pub key: K, pub center: Point, pub zoom: f64 }. Where a view stood: what it showed (key: a page, an artboard, a document) and the view's centre and zoom there.
    • pub const fn new(key: K, center: Point, zoom: f64) -> Self. The view of key centred on center at zoom.
  • craft_behavior::Wheel: re-export of craft_behavior::wheel::Wheel.
  • craft_behavior::WheelEase: re-export of craft_behavior::wheel::WheelEase.
  • craft_behavior::WheelFocus: re-export of craft_behavior::wheel::WheelFocus.
  • craft_behavior::WheelGesture: re-export of craft_behavior::wheel::WheelGesture.
  • craft_behavior::WheelNotch: re-export of craft_behavior::wheel::WheelNotch.
  • craft_behavior::WheelPhase: re-export of craft_behavior::wheel::WheelPhase.
  • craft_behavior::WheelRoom: re-export of craft_behavior::wheel::WheelRoom.
  • craft_behavior::WheelSource: re-export of craft_behavior::wheel::WheelSource.
  • craft_behavior::WheelTaker: re-export of craft_behavior::wheel::WheelTaker.
  • craft_behavior::WheelUnit: re-export of craft_behavior::wheel::WheelUnit.
  • craft_behavior::Winner: re-export of craft_behavior::hit::Winner.
  • craft_behavior::ZoomFloor: re-export of craft_behavior::canvas::zoom::ZoomFloor.
  • craft_behavior::ZoomScheme: re-export of craft_behavior::canvas::zoom::ZoomScheme.
  • craft_behavior::count_clicks: re-export of craft_behavior::press::count_clicks.
  • craft_behavior::decimals_for_step: re-export of craft_behavior::codec::decimals_for_step.
  • craft_behavior::frame_step: re-export of craft_behavior::frame_step::frame_step.
  • craft_behavior::is_checkable: re-export of craft_behavior::role_rule::is_checkable.
  • craft_behavior::is_selectable: re-export of craft_behavior::role_rule::is_selectable.
  • craft_behavior::keyed: re-export of craft_behavior::item_source::keyed.
  • craft_behavior::kurbo: re-export of craft_behavior::kurbo (defined outside these crates).
  • craft_behavior::lead_step: pub const fn lead_step(mv: NavMove, mods: MoveMods) -> Option<NavMove>. The step Left or Right with the lead modifier makes, physical as the arrows are: Ctrl+Left and Ctrl+Right (Back and Forward with the lead), and Cmd+Left and Cmd+Right on macOS, which the key table makes a move to the start or end of the line.
  • craft_behavior::pick_instance: re-export of craft_behavior::command::pick_instance.
  • craft_behavior::resize_cursor: pub fn resize_cursor(view: &CanvasView, doc_dir: Vec2) -> CursorIcon. The resize arrow for moving along document direction doc_dir, as view shows it (its rotation, flip and aspect): the nearest of the four arrows.
  • craft_behavior::resolve: re-export of craft_behavior::hit::resolve.
  • craft_behavior::resolve_columns: re-export of craft_behavior::grid::resolve_columns.
  • craft_behavior::resolve_flags: re-export of craft_behavior::command::resolve_flags.
  • craft_behavior::resolve_mapped: re-export of craft_behavior::hit::resolve_mapped.
  • craft_behavior::role_violations: re-export of craft_behavior::role_rule::role_violations.
  • craft_behavior::same_in_f32: re-export of craft_behavior::value::same_in_f32.
  • craft_behavior::same_in_f32_at: re-export of craft_behavior::value::same_in_f32_at.
  • craft_behavior::sub_row_cells: re-export of craft_behavior::columns::sub_row_cells.
  • craft_behavior::wheel_step: pub fn wheel_step(steps: &ValueSteps, axes: ValueAxes, wheel: &Wheel, rtl: bool) -> StepResult. Maps a wheel share to the new value of a single-value control: one notch per whole wheel line the share carries ([Wheel::lines]), and one for a share of points or pages, up for positive scroll.
  • craft_behavior::wrap_value: re-export of craft_behavior::value_drag::wrap_value.

craft_behavior::anchor

The nine points of a box, shared by the transform box rules and the reference point picker.

  • craft_behavior::anchor::Anchor9: pub enum Anchor9 { TopLeft, Top, TopRight, Left, Centre, Right, BottomLeft, Bottom, BottomRight }. The nine points of a box: its corners, edge midpoints and centre, row by row from the top left.
    • pub const ALL: [Anchor9; 9]. Every point, row by row from the top left.
    • pub fn uv(self) -> (f64, f64). Where the point sits in the box: 0 to 1 across from the left edge and down from the top.
    • pub fn cell(self) -> (usize, usize). The point's column and row in the 3 by 3 grid, counted from the top left.

craft_behavior::arrangement

Arrangement: a custom placement for a body, in logical coordinates.

  • craft_behavior::arrangement::Arrangement: pub trait Arrangement. A placement of keyed children measured by the caller.
    • fn place(&self, room: Rect, sizes: &[Vec2], out: &mut Vec<Rect>) -> Vec2. Fills out with one rect per entry of sizes, in order, inside room; returns the size the placement takes.
    • fn mirrors(&self) -> bool. False for a placement that must not mirror (a free-position board).

craft_behavior::canvas

The transform a canvas body is shown through, and the canvas view with its zoom rules, history and ruler units.

  • craft_behavior::canvas::CanvasTransform: pub struct CanvasTransform { pub scale: f32, pub offset: Vec2 }. A canvas body's mapping from canvas coordinates to its layer: screen = canvas * scale + offset.
    • pub const fn new(scale: f32, offset: Vec2) -> Self. The transform with scale layer points per canvas unit and the canvas origin at offset.
    • pub fn to_layer(&self, canvas: Pos2) -> Pos2. The position in the layer of a canvas point.
  • craft_behavior::canvas::CanvasView: pub struct CanvasView { pub rect: ScreenRect, pub center: Point, pub zoom: f64, pub rotation: f64, pub flip_x: bool, pub aspect: f64 }. How a canvas shows its document: where, how large, turned and mirrored how.
    • pub fn new(rect: ScreenRect, center: Point, zoom: f64) -> Self. An upright, unmirrored, square-pixel view of rect showing center at zoom.
    • pub const fn rotation(mut self, degrees: f64) -> Self. The same view turned degrees clockwise.
    • pub const fn flip_x(mut self, flip: bool) -> Self. The same view mirrored left-right (or not).
    • pub const fn aspect(mut self, aspect: f64) -> Self. The same view with a document unit aspect times as wide as it is tall.
    • pub fn points_per_unit(device_zoom: f64, pixels_per_point: f32) -> f64. zoom for a view that shows device_zoom device pixels per document unit at pixels_per_point: 1 shows one document pixel per device pixel at any interface scale.
    • pub fn affine(&self) -> Affine. Document to screen points.
    • pub fn to_screen(&self, p: Point) -> Pos2. Where the view draws document point p.
    • pub fn to_doc(&self, p: Pos2) -> Point. The document point under screen position p.
    • pub fn map_vec(&self, v: Vec2) -> ScreenVec. A document vector as the view draws it: stretched, turned, zoomed and mirrored.
    • pub fn unmap_vec(&self, v: ScreenVec) -> Vec2. The document vector a screen vector shows: the inverse of [map_vec].
    • pub fn zoom_x(&self) -> f64. Screen points per document unit along the document's x axis: zoom × aspect.
    • pub fn extent(&self, r: Rect) -> ScreenVec. The screen size of the box that holds document rect r at the view's zoom, rotation, aspect and flip: the bounding box of [CanvasView::quad].
    • pub fn quad(&self, r: Rect) -> [Pos2; 4]. The screen corners of document rect r, in order round it: (x0, y0), (x1, y0), (x1, y1), (x0, y1).
    • pub fn visible(&self) -> Rect. The document bounds of the screen rect: every document point the view can show.
    • pub fn doc_len(&self, points: f32) -> f64. A screen distance in document units along the document's y axis (divide by [zoom_x] for its x axis).
    • pub fn layer_transform(&self) -> Option<CanvasTransform>. The transform a canvas body is shown through when this view only scales and moves the document: unturned, unmirrored and square. None for any other view; its controls register parts in screen space through [to_screen] instead.
    • pub fn axis_aligned(&self) -> bool. Whether the rotation is a multiple of 90°, so document axes are screen axes.
    • pub fn level(&self, zero: Point) -> CanvasView. The view without its rotation, moved so it draws zero where this view does: the same zoom, flip and aspect, so ticks measured with it never stretch.
  • craft_behavior::canvas::RulerUnits: pub struct RulerUnits { pub per_doc: f64, pub ticks: Ticks, pub labels: TickLabels }. The ruler unit of one document axis: its size, its ticks and how it labels them.
    • pub const fn new(per_doc: f64, ticks: Ticks) -> Self. Ruler units of per_doc per document unit, spaced by ticks, labelled as [TickLabels::Distance].
    • pub const fn with_labels(mut self, labels: TickLabels) -> Self. The units with their ticks written as labels.
    • pub const fn pixels() -> Self. Whole document pixels.
    • pub fn step(&self, zoom: f64, step_min: f32) -> (f64, u32). The labelled step in ruler units and its subdivisions when one document unit is zoom screen points along this axis, with labels at least step_min points apart.
    • pub fn snap_to_tick(&self, position: f64, zero: f64, zoom: f64, step_min: f32) -> f64. position (document units) moved to the nearest minor tick of the ruler counting from zero, at zoom screen points per document unit (PhotoCraft's Shift snap, #3770).
    • pub fn distance(&self, position: f64, zero: f64) -> f64. The distance of position (document units) from zero, in ruler units.
    • pub fn label_decimals(&self, step: f64) -> RangeInclusive<usize>. The least and most decimals a ruler writes a tick of labelled step step with.
    • pub fn label_value(&self, value: f64, step: f64) -> f64. The number a ruler prints at the tick value (ruler units from the zero point) for a labelled step step:
  • craft_behavior::canvas::TickLabels: pub enum TickLabels { Distance, Signed }. How a ruler writes the number at a labelled tick.
  • craft_behavior::canvas::Ticks: pub enum Ticks { Decimal { whole: bool }, Custom(fn(f64) -> (f64, u32)) }. How a ruler divides its unit at a zoom.
    • pub const fn decimal(whole: bool) -> Self. PhotoCraft's decimal steps; whole keeps the step a whole number of units without 2.5.
  • craft_behavior::canvas::ViewHistory: pub struct ViewHistory<K>. The places a window jumped between, oldest first, with the one it shows now.
    • pub const LIMIT: usize. Entries kept; the oldest go first.
    • pub fn leave(&mut self, place: ViewPlace<K>). The view is about to jump away from place: its entry keeps the centre and zoom the jump left it at, so Go Back returns there.
    • pub fn visit(&mut self, place: ViewPlace<K>). The view jumped to place.
    • pub fn go(&mut self, step: isize, exists: impl Fn(&K) -> bool) -> Option<ViewPlace<K>>. Go Back or Go Forward: the place to show, skipping places that no longer exist.
  • craft_behavior::canvas::ViewPlace: pub struct ViewPlace<K> { pub key: K, pub center: Point, pub zoom: f64 }. Where a view stood: what it showed (key: a page, an artboard, a document) and the view's centre and zoom there.
    • pub const fn new(key: K, center: Point, zoom: f64) -> Self. The view of key centred on center at zoom.
  • craft_behavior::canvas::ZoomFloor: re-export of craft_behavior::canvas::zoom::ZoomFloor.
  • craft_behavior::canvas::ZoomScheme: re-export of craft_behavior::canvas::zoom::ZoomScheme.
  • craft_behavior::canvas::resize_cursor: pub fn resize_cursor(view: &CanvasView, doc_dir: Vec2) -> CursorIcon. The resize arrow for moving along document direction doc_dir, as view shows it (its rotation, flip and aspect): the nearest of the four arrows.

craft_behavior::canvas::zoom

Zoom rules as pure functions on a [CanvasView]: the zoom scheme's range and Zoom In / Zoom Out rungs, Fit on Screen and Fill Screen, a zoom about a point and the anchors of wheel zoom.

  • craft_behavior::canvas::zoom::ZoomFloor: pub enum ZoomFloor { ShorterSide(f64), Fixed(f64) }. The least zoom: the document's shorter side that many device pixels, or a fixed zoom in scheme units.
  • craft_behavior::canvas::zoom::ZoomScheme: pub struct ZoomScheme { pub rungs: &'static [f64], pub max: f64, pub floor: ZoomFloor, pub hundred: f64 }. A zoom range and its Zoom In and Out rungs in scheme units (1 = its 100 %); hundred is the device zoom of 100 %.
    • pub const PHOTOSHOP: ZoomScheme. Photoshop's: 33 rungs, up to 12800 %, the shorter side 2 px at the least.
    • pub const ILLUSTRATOR: ZoomScheme. Illustrator's: 26 stops from 3.13 % to 64000 %.
    • pub const fn with_hundred(self, device: f64) -> Self. The scheme with device as the device zoom of 100 %.
    • pub fn min(&self, size: Size) -> f64. The least device zoom for a document of size.
    • pub fn max_device(&self) -> f64. The greatest device zoom.
    • pub fn clamp(&self, device: f64, size: Size) -> f64. device within the range for a document of size; a zoom that is not a finite number becomes 100 %.
    • pub fn step(&self, device: f64, dir: i32, size: Size) -> f64. Zoom In (dir > 0) or Zoom Out (dir < 0) from device: the next rung past it (a zoom within 0.1 % of a rung counts as on it), within the document's range.
    • pub fn step_in_range(&self, device: f64, dir: i32, range: RangeInclusive<f64>) -> f64. [step] within an explicit range of device zoom (a navigator or a zoom field with bounds of its own).
    • pub fn percent_range(&self, device: f64, size: Size) -> RangeInclusive<f64>. A zoom field's range in percent: the document's range widened to include device itself.
    • pub fn percent(&self, device: f64) -> f64. device zoom as percent of the scheme's 100 %.
    • pub fn device(&self, percent: f64) -> f64. The device zoom of percent of the scheme's 100 %.
  • craft_behavior::canvas::zoom::about: pub fn about(view: &mut CanvasView, screen: Pos2, device_zoom: f64, center_on_point: bool, pixels_per_point: f32). Set the zoom to device_zoom (clamped by the caller) keeping the document point under screen where it is, or, with Zoom Clicked Point to Center (center_on_point), moving it to the view's centre.
  • craft_behavior::canvas::zoom::anchor: pub fn anchor(view: &mut CanvasView, screen: Pos2, doc: Point, device_zoom: f64, pixels_per_point: f32). Set the zoom to device_zoom with the document point doc shown at screen.
  • craft_behavior::canvas::zoom::device: pub fn device(view: &CanvasView, pixels_per_point: f32) -> f64. view.zoom as device zoom (1 = 100 %) at pixels_per_point.
  • craft_behavior::canvas::zoom::fill: pub fn fill(view: &mut CanvasView, size: Size, pixels_per_point: f32, scheme: &ZoomScheme). Fill Screen: centre the document and zoom until it covers view.rect; one axis may extend past the canvas.
  • craft_behavior::canvas::zoom::fit: pub fn fit(view: &mut CanvasView, size: Size, pixels_per_point: f32, margin: f64, scheme: &ZoomScheme). Fit on Screen: centre the document and zoom so all of it shows inside view.rect less margin points on each side, never past 100 % (one document pixel per device pixel, so a 150 % display does not open documents magnified). size is in document units; the view's aspect and rotation are taken into account.
  • craft_behavior::canvas::zoom::fit_rect: pub fn fit_rect(view: &mut CanvasView, rect: Rect, size: Size, pixels_per_point: f32, margin: Vec2, scheme: &ZoomScheme). Fit a part of the document on screen (an artboard, the selected layers' bounds): centre rect, in document units, and zoom so all of it shows inside view.rect less margin.x points at the left and right and margin.y at the top and bottom, up to the scheme's greatest zoom.
  • craft_behavior::canvas::zoom::fit_up_to: pub fn fit_up_to(view: &mut CanvasView, size: Size, pixels_per_point: f32, max_device: f64, margin: f64, scheme: &ZoomScheme). [fit] with the device zoom allowed up to max_device (1 = 100 %) instead of 100 %: a small document is magnified to fill the canvas, as Photoshop's Fit on Screen does.
  • craft_behavior::canvas::zoom::step: pub fn step(view: &mut CanvasView, dir: i32, size: Size, pixels_per_point: f32, scheme: &ZoomScheme) -> bool. View › Zoom In (dir > 0) or Zoom Out (dir < 0): the next rung of the scheme ([ZoomScheme::step]), the view's centre unchanged.
  • craft_behavior::canvas::zoom::wheel_anchor: pub fn wheel_anchor(view: &CanvasView, screen: Pos2, size: Size) -> Pos2. Where a wheel or pinch zoom anchors for a pointer at screen: the pointer over the document, else the document's nearest point (an anchor out on the pasteboard slides the image out of the window after a few notches; Photoshop keeps it in view).
  • craft_behavior::canvas::zoom::with_device: pub fn with_device(view: &CanvasView, device: f64, size: Size, pixels_per_point: f32, scheme: &ZoomScheme) -> CanvasView. view at device zoom (1 = 100 %), clamped to the zoom range of a document of size, with its centre kept.
  • craft_behavior::canvas::zoom::wrapped_canvas: pub fn wrapped_canvas(view: &CanvasView, document: Size, canvas: ScreenRect) -> ScreenVec. The window-canvas size at which the zoomed document fits: the canvas size less the view's rect size plus the screen extent of the whole document.

craft_behavior::codec

Codec: how a text part turns a value into text and text into a value (18.2), with the library codecs of this crate.

  • craft_behavior::codec::Caret: pub enum Caret { All, End }. Where the caret goes when the part takes focus.
  • craft_behavior::codec::Codec: pub trait Codec. A value's text form.
    • type Value. The value the text stands for.
    • const DRAFTS_ARE_VALUES: bool. Every draft is a value (plain text): a draft applies as typed and never rejects.
    • fn format(&self, v: &Self::Value) -> String. The text of v.
    • fn parse(&self, text: &str, start: &Self::Value) -> Result<Self::Value, NotAValue>. The value of text; start is the value when editing began, for relative input.
    • fn parse_tagged(&self, text: &str, start: &Self::Value) -> Result<(Self::Value, ParseNote), NotAValue>. The value of text and what the parse learned beside it (Reader::read_tagged); the default notes nothing.
    • fn applies_as_typed(&self, _text: &str) -> bool. Whether text applies as soon as it is typed rather than on commit.
    • fn filter(&self, _c: char) -> bool. Whether the codec takes c as typed.
    • fn whole_paste(&self, _pasted: &str) -> bool. Whether a paste the codec reads whole replaces the field's text, wherever the caret is.
    • fn normalise(&self, _text: &str, v: &Self::Value) -> String. The text the field shows after committing v, which was parsed from text.
    • fn caret_on_focus(&self, _text: &str) -> Caret. Where the caret goes when the part takes focus with this text.
    • fn sample(&self, current: &Self::Value) -> Cow<'_, str>. The widest typical text, for the field's ideal width.
  • craft_behavior::codec::NotAValue: pub struct NotAValue. The text is not a value of the codec's type.
  • craft_behavior::codec::NumberCodec: pub struct NumberCodec. An optional number: empty text is None; anything else reads through a [Reader] unless overridden with [NumberCodec::parse_with].
    • pub fn new(reader: Reader, decimals: usize) -> Self. A codec reading with reader and writing at most decimals decimal places.
    • pub fn fixed(mut self) -> Self. The same codec writing every decimal place, trailing zeros included ("1.00"), as a field of a quantity shown at a set precision does.
    • pub fn zoom_typing(mut self) -> Self. The same codec with the typing rules of a zoom field: digits, / and the decimal separator, a/b as the percentage a ÷ b × 100, and a second separator cutting the text.
    • pub fn signed_zoom(mut self) -> Self. Allow a leading minus in zoom input so the field can reject negative values instead of discarding the sign.
    • pub fn share_of_start(mut self) -> Self. The same codec reading a lone percentage (50%, [Reader::share]) as that share of the value the edit started from, as a size field does: every pass of the edit reads the same value.
    • pub fn at_most(mut self, decimals: usize) -> Self. The same codec writing at most decimals decimal places.
    • pub fn or_parse(mut self, parse: impl Fn(&str) -> Option<f64> + Send + Sync + 'static) -> Self. The same codec with parse as a second reader: it runs when the reader rejects the text, so words of the field's context ("Auto") can stand for numbers.
    • pub fn parse_with(mut self, parse: impl Fn(&str) -> Option<f64> + Send + Sync + 'static) -> Self. The same codec with an authoritative reader for the complete, trimmed, non-empty input.
    • pub fn widest(&self, range: &RangeInclusive<f64>) -> String. The widest text the codec writes for a number in range: the longest of each end and the number one place of the last decimal inside it ("100" and "99.9" over 0 to 100 at one decimal), so a field over the range is sized for any value it shows in it.
    • pub fn decimals(&self) -> usize. The most decimal places the codec writes.
    • pub fn reader(&self) -> &Reader. The reader the codec parses with.
  • craft_behavior::codec::ParseNote: pub struct ParseNote { pub unit: Option<u32>, pub held: Option<f64>, pub cut: bool }. What a parse learned beside the value.
  • craft_behavior::codec::PlainText: pub struct PlainText. Plain text: every draft is a value.
  • craft_behavior::codec::decimals_for_step: pub fn decimals_for_step(step: f64) -> usize. The decimal places a step needs to be written exactly: 2 for 0.25, 3 for 0.001, 0 for a whole step.

craft_behavior::columns

Column keys, widths and the sections a grid layout reports.

  • craft_behavior::columns::ColumnKey: pub struct ColumnKey. The key of a column; stable across reordering and resizing.
    • pub const fn new(key: &'static str) -> Self. A key named key.
    • pub const fn index(column: u32) -> Self. The key of the column at column in a sheet whose columns are numbered rather than named (SheetLayout::lines).
    • pub fn as_str(&self) -> Option<&str>. The name of a key made by [ColumnKey::new]; None for a numbered key.
    • pub fn position(&self) -> Option<u32>. The position a key made by [ColumnKey::index] holds; None for a named key.
  • craft_behavior::columns::ColumnWidth: pub enum ColumnWidth { Content, Fixed(f32), Controls(f32), Toggle, Fill { weight: f32 } }. How wide a column is.
    • pub fn in_unit(self, unit: f32) -> Self. The width with Controls(n) turned into Fixed(n * unit).
    • pub const fn fill(weight: f32) -> Self. A share of the remaining width with weight among the Fill columns.
  • craft_behavior::columns::GridSection: pub struct GridSection { pub rect: Rect, pub columns: Range<u32>, pub edges: Vec<f32> }. One horizontal section of a grid layout: its rect, the columns it shows and their edges.
    • pub fn new(rect: Rect, columns: Range<u32>, edges: Vec<f32>) -> Self. A section at rect showing columns with their edges.
  • craft_behavior::columns::GridView: pub struct GridView { pub sections: SmallVec<[GridSection; 4]> }. The sections of a sheet layout, one per frozen area.
    • pub fn new(sections: impl IntoIterator<Item = GridSection>) -> Self. A view of sections, in reading order.
  • craft_behavior::columns::sub_row_cells: pub fn sub_row_cells(cells: &mut [(ColumnKey, Rect)], is_toggle: impl Fn(&ColumnKey) -> bool, indent: f32, rtl: bool). Moves the toggle cells of a sub-row (ItemSource::sub_row) into its content: side by side in column order, each its column's width, indent from the start edge of the first cell that is not a toggle cell, which then starts after them.

craft_behavior::command

The pure rules of command routing (spec 11.3): which state a command resolves to, and which live instance of a scope receives a command fired by a key, the menu bar, the palette or automation.

  • craft_behavior::command::CommandFlags: pub struct CommandFlags { pub enabled: bool, pub checked: Option<bool> }. A command's enabled and checked state.
    • pub const fn new(enabled: bool, checked: Option<bool>) -> Self. Flags with the given enabled and checked state.
    • pub const DEFAULT: CommandFlags. A command nobody published a state for: enabled, with no checked state.
  • craft_behavior::command::pick_instance: pub fn pick_instance<I: Copy + PartialEq>(live: &[I], focused: &[I], last_focused: &[I]) -> Option<I>. The instance a non-component source delivers to, out of the live instances of the command's scope in registration order: the one that contains key focus (focused, innermost last), else the one that contained it most recently (last_focused), else the first live one. None when no instance is live.
  • craft_behavior::command::resolve_flags: pub const fn resolve_flags(this_frame: Option<CommandFlags>, last_frame: Option<CommandFlags>) -> CommandFlags. This frame's state, else last frame's, else the default.

craft_behavior::cursor

Cursor requests as plain data and the rule that picks the winner (8.5).

  • craft_behavior::cursor::CountMark: pub enum CountMark { Add, Move, Delete }. The kind of a [CursorBadge::Count] mark.
  • craft_behavior::cursor::Cursor: pub enum Cursor { System(CursorIcon), Painted(PaintedCursor) }. What a cursor request names.
  • craft_behavior::cursor::CursorBadge: pub enum CursorBadge { Add, Subtract, Intersect, Copy, NotAllowed, Scissors, Close, Move, Arrow, Target, Continue, Count(CountMark), Corner }. A mark beside a painted cursor.
  • craft_behavior::cursor::CursorIcon: pub enum CursorIcon { Default, None, ContextMenu, Help, PointingHand, Progress, Wait, Cell, Crosshair, Text, VerticalText, Alias, Copy, Move, NoDrop, NotAllowed, Grab, Grabbing, AllScroll, ResizeHorizontal, ResizeNeSw, ResizeNwSe, ResizeVertical, ResizeColumn, ResizeEast, ResizeSouthEast, ResizeSouth, ResizeSouthWest, ResizeWest, ResizeNorthWest, ResizeNorth, ResizeNorthEast, ZoomIn, ZoomOut }. A system cursor: craft-behavior's copy of egui's set, converted by runtime::egui::output.
  • craft_behavior::cursor::CursorPriority: pub enum CursorPriority { Default, Tool, Hover, Part, DropTarget, Drag, Hidden }. Who asks, in ascending order of precedence.
  • craft_behavior::cursor::IconId: pub struct IconId. An icon's egui-free key (5.2), so plain data such as [PaintedCursor::Tool] names icons without egui.
    • pub const fn new(name: &'static str) -> Self. The icon named name.
    • pub fn name(&self) -> &str. The name.
  • craft_behavior::cursor::PaintedCursor: pub enum PaintedCursor { Crosshair, Circle { radius: f32, centre: bool, badge: Option<CursorBadge> }, Outline { rings: Vec<Vec<Pos2>>, centre: bool, badge: Option<CursorBadge> }, Hand, Zoom { out: bool }, Tool { icon: IconId, hotspot: Vec2, badge: Option<CursorBadge> }, Badged { base: CursorIcon, badge: CursorBadge }, Turn { toward: Vec2 }, Distort { dir: Vec2 }, Skew { dir: Vec2 }, TypeOn { path: bool }, Locator, Arrow { hollow: bool, toward: Option<Vec2> }, PathText { start: bool, end: bool }, PointerTool { pointer: PointerGlyph, icon: IconId, badge: Option<CursorBadge> }, Hidden, IBeam }. A cursor the overlay host paints.
    • pub const CENTRE_ARM: f32. The arm of the centre mark of a circle or an outline, in points.
    • pub const fn circle(radius: f32) -> Self. A circle of radius points, with no centre mark and no badge.
    • pub fn outline(rings: Vec<Vec<Pos2>>) -> Self. App shapes as closed rings, with no centre mark and no badge.
    • pub fn marked(self, centre: bool, badge: Option<CursorBadge>) -> Self. A circle or an outline with the centre mark when centre and badge centred on the pointer; any other cursor unchanged.
    • pub const fn zoom(out: bool) -> Self. A magnifier, zooming out when out.
    • pub const fn tool(icon: IconId, hotspot: Vec2, badge: Option<CursorBadge>) -> Self. A tool's icon with its hotspot and an optional badge.
    • pub const fn turn(toward: Vec2) -> Self. The rotate pointer bent toward screen direction toward.
    • pub const fn distort(dir: Vec2) -> Self. The free-distort pointer along screen direction dir.
    • pub const fn skew(dir: Vec2) -> Self. The skew pointer along screen direction dir.
    • pub const fn type_on(path: bool) -> Self. The type tool's pointer, over a path when path.
    • pub const fn arrow(hollow: bool) -> Self. An arrow with its tip on the hotspot, hollow when hollow.
    • pub const fn arrow_toward(dir: Vec2) -> Self. A solid arrow turned about its hotspot to point along dir.
    • pub const fn path_text(start: bool, end: bool) -> Self. An I-beam across the path with a triangle toward each grabbable side.
    • pub const fn pointer_tool(pointer: PointerGlyph, icon: IconId) -> Self. pointer with the tool's icon below and right of it.
    • pub const fn pointer_tool_badged(pointer: PointerGlyph, icon: IconId, badge: Option<CursorBadge>) -> Self. pointer with the tool's icon below and right of it, and badge at the icon's lower right.
    • pub const fn badged(base: CursorIcon, badge: CursorBadge) -> Self. A system cursor with a mark.
  • craft_behavior::cursor::PointerGlyph: pub enum PointerGlyph { Crosshair, Arrow }. The pointer of a [PaintedCursor::PointerTool].
  • craft_behavior::cursor::pick: pub fn pick(requests: &[(Cursor, CursorPriority)]) -> Option<&Cursor>. The winning request: the highest priority, the later request on a tie.
  • craft_behavior::cursor::pick_index: pub fn pick_index(requests: &[(Cursor, CursorPriority)]) -> Option<usize>. The index of the winning request ([pick]).

craft_behavior::digit_keys

[DigitKeys]: Photoshop's number keys for a tool's opacity. 1 sets 10 % … 9 sets 90 %, 0 sets 100 %; two digits typed within [DigitKeys::TWO_DIGITS] seconds set the exact value (4 then 5 is 45 %, 0 then 0 is 0 %).

  • craft_behavior::digit_keys::DigitEntry: pub struct DigitEntry { pub percent: f64, pub second: bool }. What a number key sets: the percentage and which value.
  • craft_behavior::digit_keys::DigitKeys: pub struct DigitKeys. The number keys' state between presses: the first digit of a pair.
    • pub const TWO_DIGITS: f64. Seconds within which a second digit makes an exact value.
    • pub fn press(&mut self, digit: u8, second: bool, now: f64) -> Option<DigitEntry>. One press of digit (0..=9) for the second value or not, at now seconds: 10 × the digit (0: 100) on its own, or the two-digit value when it follows a first digit for the same value in time. None for a digit over 9.

craft_behavior::divider

The resize of a row of segments separated by dividers.

  • craft_behavior::divider::Give: pub enum Give { Neighbours, Pair }. Which segments give way when a divider moves.
  • craft_behavior::divider::Segment: pub struct Segment { pub extent: f32, pub min: f32, pub max: f32 }. One segment of a row: its extent along the row and its limits.
    • pub const fn new(extent: f32, min: f32, max: f32) -> Self. A segment of extent that stays within min and max.
    • pub const fn unbounded(extent: f32, min: f32) -> Self. A segment of extent with no upper limit.
  • craft_behavior::divider::resize: pub fn resize(row: &[Segment], index: usize, target: f32, give: Give) -> Vec<f32>. The extents of row after the divider after row[index] moves to target, a distance from the row's start, clamped to its [travel].
  • craft_behavior::divider::travel: pub fn travel(row: &[Segment], index: usize, give: Give) -> (f32, f32). How far the divider after row[index] can move: (lo, hi), with lo <= 0 <= hi.

craft_behavior::doc_key

A stable, crate-prefixed semantic key for presence, automation, undo names and programmatic focus.

  • craft_behavior::doc_key::DocKey: pub struct DocKey. A document key such as "craft-ui.find-field".
    • pub const fn new(name: &'static str) -> DocKey. A key crate-prefix.name; evaluated in a const context it rejects a malformed name at compile time.
    • pub const fn name(self) -> &'static str. The name the key was declared with.

craft_behavior::dock

The dock model: the tree of splits over panel frames, the side of a group a drop lands on (20.6), and the rules that edit it.

  • craft_behavior::dock::DockSide: pub enum DockSide { Start, End, Top, Bottom, Center }. The side of a group a dropped panel docks on, in reading order: Start is the left half in a left-to-right window and the right half in a right-to-left one.
    • pub const fn axis(self) -> Option<Axis>. The axis the side splits along; None for Center.
    • pub fn area(self, group: Rect) -> Rect. The part of group a panel docked on this side takes: the half on that side, or the whole group.
  • craft_behavior::dock::Action: pub enum Action<P> { Move { panel: P, anchor: P, placement: DockPlacement<P> }, Float { panel: P, rect: Rect }, Close { panel: P }, Activate { panel: P }, Open { panel: P, anchor: Option<P> }, OpenAt { panel: P, anchor: P, placement: DockPlacement<P> }, MoveFloating { panel: P, rect: Rect, edge: Option<DockEdge> }, ResizeSplit { path: Vec<bool>, size: SplitSize }, SetStackOpen { panel: P, open: bool }, ResizeStack { panel: P, height: Option<f32> }, MoveGroup { panel: P, to: Target<P> }, StepGroup { panel: P, up: bool }, MoveColumn { panel: P, to: Target<P> }, MoveWindow { panel: P, to: Target<P> }, CloseGroup { panel: P }, CloseWindow { panel: P }, CloseOthers { panel: P }, SetMinimized { panel: P, minimized: bool }, SetIconic { panel: P, iconic: bool }, ResizeColumn { panel: P, width: f32 }, SetColumnSteps { panel: P, steps: u16 }, ResizeGroup { panel: P, height: Option<f32> }, ResizeFlyoutWidth { panel: P, width: Option<f32> }, MoveFlyoutTop { panel: P, offset: Option<f32> }, ResizeIconic { panel: P, width: Option<f32> }, SetNative { panel: P, placement: Option<Placement> }, MovePanel { panel: P, to: Target<P> }, Restore { panel: P, location: Location<P> } }. Groups, columns and floating windows are named by a panel they contain.
    • pub fn move_beside(panel: P, anchor: P, placement: DockPlacement<P>) -> Self. Builds [Action::Move].
    • pub fn float(panel: P, rect: Rect) -> Self. Builds [Action::Float].
    • pub fn close(panel: P) -> Self. Builds [Action::Close].
    • pub fn activate(panel: P) -> Self. Builds [Action::Activate].
    • pub fn open(panel: P, anchor: Option<P>) -> Self. Builds [Action::Open].
    • pub fn open_at(panel: P, anchor: P, placement: DockPlacement<P>) -> Self. Builds [Action::OpenAt].
    • pub fn move_floating(panel: P, rect: Rect) -> Self. Builds [Action::MoveFloating] with no edge: the area takes the edge nearer rect.
    • pub fn move_floating_with_edge(panel: P, rect: Rect, edge: Option<DockEdge>) -> Self. Builds [Action::MoveFloating] with the window's edge.
    • pub fn resize_split(path: Vec<bool>, size: SplitSize) -> Self. Builds [Action::ResizeSplit].
    • pub fn set_stack_open(panel: P, open: bool) -> Self. Builds [Action::SetStackOpen].
    • pub fn resize_stack(panel: P, height: Option<f32>) -> Self. Builds [Action::ResizeStack].
    • pub fn move_group(panel: P, to: Target<P>) -> Self. Builds [Action::MoveGroup].
    • pub fn step_group(panel: P, up: bool) -> Self. Builds [Action::StepGroup].
    • pub fn move_column(panel: P, to: Target<P>) -> Self. Builds [Action::MoveColumn].
    • pub fn move_window(panel: P, to: Target<P>) -> Self. Builds [Action::MoveWindow].
    • pub fn close_group(panel: P) -> Self. Builds [Action::CloseGroup].
    • pub fn close_window(panel: P) -> Self. Builds [Action::CloseWindow].
    • pub fn close_others(panel: P) -> Self. Builds [Action::CloseOthers].
    • pub fn set_minimized(panel: P, minimized: bool) -> Self. Builds [Action::SetMinimized].
    • pub fn set_iconic(panel: P, iconic: bool) -> Self. Builds [Action::SetIconic].
    • pub fn resize_column(panel: P, width: f32) -> Self. Builds [Action::ResizeColumn].
    • pub fn set_column_steps(panel: P, steps: u16) -> Self. Builds [Action::SetColumnSteps].
    • pub fn resize_group(panel: P, height: Option<f32>) -> Self. Builds [Action::ResizeGroup].
    • pub fn resize_flyout_width(panel: P, width: Option<f32>) -> Self. Builds [Action::ResizeFlyoutWidth].
    • pub fn move_flyout_top(panel: P, offset: Option<f32>) -> Self. Builds [Action::MoveFlyoutTop].
    • pub fn resize_iconic(panel: P, width: Option<f32>) -> Self. Builds [Action::ResizeIconic].
    • pub fn set_native(panel: P, placement: Option<Placement>) -> Self. Builds [Action::SetNative].
    • pub fn move_panel(panel: P, to: Target<P>) -> Self. Builds [Action::MovePanel].
    • pub fn restore(panel: P, location: Location<P>) -> Self. Builds [Action::Restore].
  • craft_behavior::dock::Arrangement: pub enum Arrangement { TileAllVertically, TileAllHorizontally, TwoUpVertical, TwoUpHorizontal, ThreeUpVertical, ThreeUpHorizontal, ThreeUpStacked, FourUp, SixUp, ConsolidateAllToTabs, Cascade, Tile, FloatInWindow, FloatAllInWindows, NewWindowForDocument, MatchZoom, MatchLocation, MatchRotation, MatchAll }. One Window › Arrange entry.
    • pub fn group_count(self, documents: usize) -> Option<usize>. How many document groups an n-up or tile arrangement wants, None for the window and view entries.
    • pub fn enabled(self, documents: usize, groups: usize, floating: usize) -> bool. Whether the entry is enabled with documents open and floating floating windows:
  • craft_behavior::dock::Column: pub struct Column<P> { pub groups: Vec<Group<P>>, pub width: Option<f32>, pub iconic: bool, pub iconic_width: Option<f32>, pub steps: Option<u16> }. One column of groups from top to bottom: a column of a dock, or the whole of a floating window.
    • pub fn new(groups: Vec<Group<P>>) -> Self. A column of groups, expanded at the theme's column width until the user resizes it.
    • pub fn with_width(mut self, width: f32) -> Self. The column resized to width points.
    • pub fn with_iconic(mut self, iconic: bool) -> Self. The column collapsed to icons, or expanded.
    • pub fn with_steps(mut self, steps: u16) -> Self. The column steps content columns wide ([Self::steps]).
    • pub fn panels(&self) -> impl Iterator<Item = &P>. Every panel of the column, top group first.
  • craft_behavior::dock::ColumnLocation: pub struct ColumnLocation { pub side: Option<DockEdge>, pub width: Option<f32>, pub iconic: bool, pub iconic_width: Option<f32>, pub steps: Option<u16> }. The column a closed panel's group was in.
    • pub const fn new(side: Option<DockEdge>, width: Option<f32>, iconic: bool, iconic_width: Option<f32>) -> Self. A column location on side (None for a floating window's column), width points wide when expanded (the theme's column width for None).
    • pub const fn with_steps(mut self, steps: Option<u16>) -> Self. The location with the column steps content columns wide ([Column::steps]).
  • craft_behavior::dock::DockEdge: pub enum DockEdge { Start, End }. The window edge a [Node::Dock] sits on, in reading order so right-to-left interfaces mirror. Start is the edge of a horizontal split's first child; the renderer maps it to a physical edge from the layout direction.
  • craft_behavior::dock::DockError: pub enum DockError { LimitExceeded, DuplicatePanel, MissingPanel, MissingTarget, InvalidSelection, InvalidGeometry, InvalidPlacement, NotAllowed, UnsupportedVersion }. Why a layout edit or load was refused.
  • craft_behavior::dock::DockPlacement: pub enum DockPlacement<P> { Tab { before: Option<P> }, Split(DockSide), SplitSized { zone: DockSide, size: SplitSize, outer: SplitSize }, Group { below: bool, height: Option<f32> }, Column { after: bool }, Edge(DockSide) }. Where a moved panel goes relative to an anchor panel.
    • pub fn tab(before: Option<P>) -> Self. Builds [DockPlacement::Tab].
    • pub fn group(below: bool, height: Option<f32>) -> Self. Builds [DockPlacement::Group].
    • pub fn column(after: bool) -> Self. Builds [DockPlacement::Column].
    • pub fn allowed_by(&self, anchor: Permissions) -> bool. Whether the anchor's permissions take this placement: tabs need accepts_tabs and shares_column, a group in the anchor's column shares_column, and side splits accepts_splits.
  • craft_behavior::dock::DocumentGroup: pub struct DocumentGroup<D> { pub id: u64, pub documents: Vec<D>, pub shown: Option<D> }. A document group: the documents in one tab strip, one of them shown.
    • pub fn new(id: u64, documents: Vec<D>) -> Self. A group with id id holding documents, none shown.
  • craft_behavior::dock::DocumentWindows: pub struct DocumentWindows<D> { pub docked: Vec<DocumentGroup<D>>, pub floating: Vec<(DocumentGroup<D>, Rect)>, pub arrangement: Option<Arrangement> }. The document windows of the app: the tabbed groups in the canvas area and the floating ones.
    • pub fn float(&mut self, document: &D, rect: Rect) -> Option<u64>. Float document from its group into a new window at rect.
    • pub fn float_all(&mut self, area: Rect, size: Vec2, step: f32). Every document into its own floating window, cascaded from area's top left.
    • pub fn consolidate(&mut self, active: Option<&D>). Every document back into one docked group, the active one shown.
    • pub fn split_into(&mut self, n: usize). Split the docked documents into n groups for an n-up arrangement, in order.
    • pub fn new_window_for(&mut self, document: &D, rect: Rect) -> u64. A second view of document: the same document id in a new window; the app keeps one view state per (document, window).
    • pub fn close_window(&mut self, id: u64) -> bool. Closes floating window id.
    • pub fn add_document(&mut self, document: &D). Adds document to the first docked group, or to a new docked group when there is none.
    • pub fn to_actions<P: Clone + Eq + Hash>(&self, layout: &Layout<P>, panel_of: impl Fn(u64) -> P) -> Vec<Action<P>>. The dock actions that put self into layout, for the dock to draw the windows.
  • craft_behavior::dock::Floating: pub struct Floating<P> { pub id: u64, pub column: Column<P>, pub rect: Rect, pub native: Option<Placement>, pub edge: Option<DockEdge> }. A floating window: one column of groups, the same [Column] a dock holds.
    • pub fn new(id: u64, column: Column<P>, rect: Rect) -> Self. The window id holding column.
    • pub fn single(id: u64, panels: Vec<P>, active: usize, rect: Rect) -> Self. The window id with one group.
    • pub fn with_id(mut self, id: u64) -> Self. The window with id in place of its own.
    • pub fn panels(&self) -> impl Iterator<Item = &P>. Every panel in the window, top group first.
    • pub fn stack(id: u64, groups: Vec<Group<P>>, rect: Rect) -> Option<Self>. The window id of groups, stacked top to bottom, expanded. None without groups.
    • pub fn groups(&self) -> &[Group<P>]. The window's groups, top to bottom.
    • pub fn contains<Q: ?Sized + PartialEq>(&self, panel: &Q) -> bool where P: std::borrow::Borrow<Q>,. True when a group of this window holds panel.
  • craft_behavior::dock::Group: pub struct Group<P> { pub panels: Vec<P>, pub active: usize, pub minimized: bool, pub height: Option<f32>, pub flyout_width: Option<f32>, pub flyout_offset: Option<f32> }. Tabs that move, minimize and size together in a column, docked or floating.
    • pub fn new(panels: Vec<P>, active: usize) -> Self. A group of panels with tab active selected, expanded and with no preferred height or flyout geometry.
    • pub fn active_panel(&self) -> Option<&P>. The selected panel, or None when active is out of range.
  • craft_behavior::dock::GroupLocation: pub struct GroupLocation { pub minimized: bool, pub height: Option<f32>, pub flyout_width: Option<f32>, pub flyout_offset: Option<f32>, pub column: Option<ColumnLocation> }. The group a closed panel was in, when that group was in a column, docked or floating.
    • pub const fn new(minimized: bool, height: Option<f32>, column: Option<ColumnLocation>) -> Self. A group location with the given state and column.
    • pub const fn with_flyout_width(mut self, width: Option<f32>) -> Self. The location with the group's flyout width points wide.
    • pub const fn with_flyout_offset(mut self, offset: Option<f32>) -> Self. The location with the group's flyout top offset points from its icons' top.
  • craft_behavior::dock::Layout: pub struct Layout<P> { pub root: Option<Node<P>>, pub floating: Vec<Floating<P>> }. The panels of a workspace: a docked tree plus floating windows.
    • pub fn new(root: Option<Node<P>>, floating: Vec<Floating<P>>) -> Self. A layout with the docked tree root and the floating windows floating.
    • pub fn fresh_window_id(&mut self) -> u64. An id for a new floating window: above every window id the layout held when it was built or loaded and every id it has drawn since, so an id, and the OS window it names, is never given to another window while the layout lives.
    • pub fn window_floor(&self) -> u64. The least id above every id the layout holds or has held.
    • pub fn validate(&self) -> Result<(), DockError>. Check depth, allocation bounds, geometry, selection, globally unique panel ownership and that no frame, group, column or window is empty.
    • pub fn panels(&self) -> Vec<&P>. Iterate identities without recursion.
    • pub fn contains(&self, panel: &P) -> bool. Whether the layout holds panel, docked or floating.
    • pub fn can_step_group(&self, panel: &P, up: bool, permissions: impl Fn(&P) -> Permissions) -> bool. Whether [Action::StepGroup] would move panel's group, for enabling a menu item.
    • pub fn location(&self, panel: &P) -> Result<Location<P>, DockError>. Capture a panel's nearest surviving group/split neighbor before hiding it.
    • pub fn panel_state(&self, panel: &P) -> PanelState. Hidden, open behind another tab or in a collapsed container, or showing.
    • pub fn restore(&mut self, panel: P, location: &Location<P>) -> Result<(), DockError>. Restore an absent panel at a captured location.
    • pub fn open_at_edge(&mut self, panel: P) -> Result<(), DockError>. Open an absent panel as a frame at the outer edge of the docked area, taking most of it:
  • craft_behavior::dock::Location: pub struct Location<P> { pub floating: Option<Rect>, pub anchor: Option<P>, pub placement: DockPlacement<P>, pub size: Option<SplitSize>, pub stack: Option<(bool, Option<f32>)>, pub sibling: Vec<P>, pub group: Option<GroupLocation>, pub closed_with: Vec<P> }. A closed panel's former placement.
    • pub fn new(anchor: Option<P>, placement: DockPlacement<P>) -> Self. A location relative to anchor by placement, with no recorded sizes or siblings.
  • craft_behavior::dock::MAX_DEPTH: pub const MAX_DEPTH: usize. Limits are checked before cloning or recursively modifying an application layout.
  • craft_behavior::dock::MAX_PANELS: pub const MAX_PANELS: usize. Most panels a layout may hold.
  • craft_behavior::dock::NamedWorkspace: pub struct NamedWorkspace<P> { pub id: String, pub name: String, pub layout: Workspace<P>, pub chrome: WorkspaceChrome, pub keeps: WorkspaceKeeps }. One named workspace.
    • pub fn new(id: impl Into<String>, name: impl Into<String>, layout: Workspace<P>) -> Self. A workspace named name with the stable id id, showing every bar and capturing nothing beside the layout.
  • craft_behavior::dock::Node: pub enum Node<P> { Split { axis: Axis, size: SplitSize, first: Box<Node<P>>, second: Box<Node<P>> }, Tabs { panels: Vec<P>, active: usize }, Stack { entries: Vec<StackEntry<P>> }, Dock { side: DockEdge, columns: Vec<Column<P>> } }. A node of a layout tree.
    • pub fn tabs(panels: Vec<P>, active: usize) -> Self. A group of tabs with tab active selected.
    • pub fn split(axis: Axis, size: SplitSize, first: Node<P>, second: Node<P>) -> Self. Two children along axis, sharing the room by size.
    • pub fn stack(entries: Vec<StackEntry<P>>) -> Self. Builds [Node::Stack].
    • pub fn dock(side: DockEdge, columns: Vec<Column<P>>) -> Self. Builds [Node::Dock].
  • craft_behavior::dock::PanelPlace: pub enum PanelPlace { Node(Vec<bool>), Dock { path: Vec<bool>, column: usize, group: usize }, Floating { window: usize, group: usize } }. Where a panel is.
    • pub fn tree_path(&self) -> Option<&[bool]>. The path of a Tabs or Stack node of the docked tree; None for a group of a column.
    • pub fn group_index(&self) -> Option<usize>. The group's index in its column; None for a Tabs or Stack node of the docked tree.
  • craft_behavior::dock::PanelState: pub enum PanelState { Hidden, Open, Front }. What the Window menu shows for a panel.
  • craft_behavior::dock::Permissions: pub struct Permissions { pub movable: bool, pub floatable: bool, pub closable: bool, pub accepts_tabs: bool, pub accepts_splits: bool, pub collapses: bool, pub shares_column: bool, pub docks_outside_columns: bool }. What may happen to a panel. Layout::apply_with_permissions enforces these for every action, whoever issues it.
    • pub const ALL: Self. Every right: the panel moves, floats, closes, takes tabs and splits, collapses, shares its column and docks outside dock columns.
    • pub const PROTECTED: Self. A document canvas: it stays docked and open, and takes neither tabs nor side splits.
    • pub const fn movable(mut self, movable: bool) -> Self. These permissions with [Self::movable] set to movable.
    • pub const fn floatable(mut self, floatable: bool) -> Self. These permissions with [Self::floatable] set to floatable.
    • pub const fn closable(mut self, closable: bool) -> Self. These permissions with [Self::closable] set to closable.
    • pub const fn accepts_tabs(mut self, accepts_tabs: bool) -> Self. These permissions with [Self::accepts_tabs] set to accepts_tabs.
    • pub const fn accepts_splits(mut self, accepts_splits: bool) -> Self. These permissions with [Self::accepts_splits] set to accepts_splits.
    • pub const fn collapses(mut self, collapses: bool) -> Self. These permissions with [Self::collapses] set to collapses.
    • pub const fn shares_column(mut self, shares_column: bool) -> Self. These permissions with [Self::shares_column] set to shares_column.
    • pub const fn docks_outside_columns(mut self, docks_outside_columns: bool) -> Self. These permissions with [Self::docks_outside_columns] set to docks_outside_columns.
    • pub fn is_protected(self) -> bool. A canvas: it can neither move, close nor take tabs. accepts_splits and floatable do not matter, so a canvas that opens panels beside it still counts.
    • pub fn locked(self) -> Self. Lock Workspace: nothing moves, floats or closes; tab and split drops and the column rights keep their policy.
  • craft_behavior::dock::SIDE_ZONE_DEPTH_SHARE: pub const SIDE_ZONE_DEPTH_SHARE: f32. The most of a body's smaller side that a [ZoneSize::Depth] zone reaches, so a body always keeps a middle.
  • craft_behavior::dock::SIDE_ZONE_FRACTION: pub const SIDE_ZONE_FRACTION: f32. Share of a body, from each edge, that means "beside" under [ZoneSize::Fraction]: of its width from the start and end edges, of its height from the top and bottom edges.
  • craft_behavior::dock::SplitSize: pub enum SplitSize { Ratio(f32), FixedFirst(f32), FixedSecond(f32) }. A transient sizing request.
  • craft_behavior::dock::StackEntry: pub struct StackEntry<P> { pub panel: P, pub open: bool, pub height: Option<f32> }. One panel of a [Node::Stack] accordion.
    • pub fn new(panel: P) -> Self. An open accordion section for panel with no preferred height.
  • craft_behavior::dock::Target: pub enum Target<P> { At { anchor: P, placement: DockPlacement<P> }, NewDock { side: DockEdge }, Float { rect: Rect, edge: Option<DockEdge> } }. Where a group, column or floating window goes.
    • pub fn at(anchor: P, placement: DockPlacement<P>) -> Self. Builds [Target::At].
    • pub fn new_dock(side: DockEdge) -> Self. Builds [Target::NewDock].
    • pub fn float(rect: Rect) -> Self. Builds [Target::Float] with no edge: the area takes the edge nearer rect.
    • pub fn float_with_edge(rect: Rect, edge: Option<DockEdge>) -> Self. Builds [Target::Float] with the edge a collapsed window keeps to.
  • craft_behavior::dock::Workspace: pub struct Workspace<P>. A saved arrangement of panels: the [Layout] and the closed panels' former places.
    • pub const VERSION: u32. The format version written to files.
    • pub fn version(&self) -> u32. The format version the workspace was read with.
    • pub fn layout(&self) -> &Layout<P>. The current arrangement.
    • pub fn hidden(&self) -> &[(P, Location<P>)]. The closed panels, and panels the application does not register now, with where each one goes back.
    • pub fn floated(&self) -> &[(P, Location<P>)]. The floating panels, and the closed panels that were floating, with the docked location each one left.
    • pub fn revision(&self) -> Revision. The revision of this workspace value: it moves with every write, and no other value has it.
    • pub fn generation(&self) -> u64. The generation of this live workspace: it moves with every [replace] and nothing else.
    • pub fn raise_window_floor(&mut self, floor: u64). Keeps the ids of new floating windows at or above floor.
    • pub fn forget_hidden(&mut self, forget: impl Fn(&P) -> bool). Drops the closed-panel records of the panels forget names, so reopening them does not restore their place.
    • pub fn replace(&mut self, with: Workspace<P>). Replaces the arrangement with with and moves to the next generation.
    • pub fn apply(&mut self, action: Action<P>, locked: bool, permissions: impl Fn(&P) -> Permissions) -> Result<Vec<P>, DockError>. Apply one action.
    • pub fn apply_all(&mut self, actions: impl IntoIterator<Item = Action<P>>, locked: bool, permissions: impl Fn(&P) -> Permissions,) -> Result<Vec<P>, DockError>. Apply every action in order, or none, as [Self::apply] does.
  • craft_behavior::dock::WorkspaceChrome: pub struct WorkspaceChrome { pub menu_bar: bool, pub tool_rail: bool, pub options_bar: bool, pub status_bar: bool }. Chrome a workspace remembers beside the dock layout: which bars show.
  • craft_behavior::dock::WorkspaceError: pub enum WorkspaceError { UnknownId, NameTaken, EmptyName, CurrentCannotBeDeleted }. Why a [WorkspaceSet] edit was refused.
  • craft_behavior::dock::WorkspaceKeeps: pub struct WorkspaceKeeps { pub shortcuts: bool, pub menus: bool, pub toolbar: bool }. What a saved workspace captures beside the panel layout (the Capture boxes of New Workspace).
    • pub const NONE: WorkspaceKeeps. Captures nothing beside the layout.
    • pub const ALL: WorkspaceKeeps. Captures shortcuts, menus and toolbar.
    • pub const fn new(shortcuts: bool, menus: bool, toolbar: bool) -> Self. The keeps with shortcuts, menus and toolbar as given.
  • craft_behavior::dock::WorkspaceSet: pub struct WorkspaceSet<P> { pub builtin: Vec<NamedWorkspace<P>>, pub saved: Vec<NamedWorkspace<P>>, pub current: String, pub locked: bool, pub edited: BTreeMap<String, Workspace<P>> }. The app's workspaces: built-ins first, saved ones after, one current.
    • pub fn new(builtin: Vec<NamedWorkspace<P>>) -> Self. A set of builtin workspaces with the first one current.
    • pub fn current(&self) -> Option<&NamedWorkspace<P>>. The current workspace, or None when current names none.
    • pub fn find(&self, id: &str) -> Option<&NamedWorkspace<P>>. The workspace with this id.
    • pub fn layout(&self) -> Option<&Workspace<P>>. The layout the current workspace shows: what it was left with, else its stored one.
    • pub fn select(&mut self, id: &str, live: &mut Workspace<P>) -> Result<(), WorkspaceError>. Switch to id and replace live with the layout it shows; the current workspace's live layout is kept under its id first (Photoshop remembers the state of each workspace until Reset).
    • pub fn check_name<'n>(&self, name: &'n str) -> Result<(&'n str, Option<&str>), WorkspaceError>. Whether name can be saved: the trimmed name, and the id of the saved workspace it would replace (any case), if any.
    • pub fn save(&mut self, name: &str, live: Workspace<P>, chrome: WorkspaceChrome, keeps: WorkspaceKeeps) -> Result<String, WorkspaceError>. Save live under name, capturing keeps, and make it current; [check_name] refuses the name or names the saved workspace it replaces.
    • pub fn delete(&mut self, id: &str) -> Result<(), WorkspaceError>. Delete a saved workspace; the current one can't be deleted (Photoshop greys it).
    • pub fn reset(&mut self, live: &mut Workspace<P>) -> Result<(), WorkspaceError>. Reset the current workspace: drop what it was left with and replace live with its stored layout (a built-in's code layout, or the layout it was saved with).
  • craft_behavior::dock::ZoneSize: pub enum ZoneSize { Depth(f32), Fraction }. How deep the side zones of a body are.
  • craft_behavior::dock::arrange_rects: pub fn arrange_rects(arrangement: Arrangement, area: Rect, n: usize) -> Option<Vec<Rect>>. The cells of an n-up or Tile All arrangement inside area, in reading order. Tile All Vertically gives n columns, Horizontally n rows, 3-up Stacked one left cell and two stacked on the right, 4-up and 6-up grids of 2×2 and 3×2.
  • craft_behavior::dock::first_active: pub fn first_active<P>(root: &Node<P>) -> Option<&P>. The shown panel of a tree's first group.
  • craft_behavior::dock::node_at: pub fn node_at<'a, P>(mut node: &'a Node<P>, path: &[bool]) -> Option<&'a Node<P>>. The node at path from root: false is a split's first child, true its second.
  • craft_behavior::dock::tree_panels: pub fn tree_panels<P>(root: &Node<P>) -> Vec<&P>. The panels of a tree in order, without recursion; at most [MAX_PANELS].
  • craft_behavior::dock::zones: pub fn zones(body: Rect, size: ZoneSize, rtl: bool) -> [(DockSide, Rect); 5]. The zones of body, the part of a group below its tab strip: the start and end zones along its full height, the top and bottom zones between them, and the middle. Start is the physical left rect, or the right rect when rtl.

craft_behavior::edit_history

EditHistory<T>: the undo and redo of a dialog, a tool session or the keymap editor, fed by edit events.

  • craft_behavior::edit_history::EditHistory: pub struct EditHistory<T>. Undo and redo stacks of a value T, at most 100 steps.
    • pub fn new(now: &T) -> Self. A history that starts at now.
    • pub fn with_budget(mut self, max: usize, weight: fn(&T) -> usize) -> Self. The undo steps' summed weight stays at or under max: after each push the oldest go first, the newest always stays; each weight is measured once at push.
    • pub fn record(&mut self, event: &EditEvent<T>). Takes in one event.
    • pub fn is_open(&self) -> bool. A gesture is open: a caller that restores a draft waits for it to end.
    • pub fn step(&mut self, now: &mut T, step: Step) -> bool. Steps now back or forward.
    • pub fn take_back(&mut self) -> Option<T>. Takes back the newest undo step without a redo entry, for an edit that was refused: settled returns to the value before the step, which is returned for the caller to apply, and the redo steps stay as they were. None when there is no step.
    • pub fn can_undo(&self) -> bool. An undo would change something.
    • pub fn can_redo(&self) -> bool. A redo would change something.
    • pub fn redo_len(&self) -> usize. How many steps a redo can go forward.
  • craft_behavior::edit_history::Step: pub enum Step { Undo, Redo }. Which way [EditHistory::step] goes.

craft_behavior::editor

EditorInput: the one ordered input stream the IME engine produces and an editor part reads (18.4).

  • craft_behavior::editor::EditorInput: pub enum EditorInput { Text(Arc<str>), Move(NavMove, MoveMods), Delete { forward: bool, by: Granularity, shift: bool }, DeleteSurrounding { before: usize, after: usize, unit: SurroundingUnit }, Select { anchor: TextPos, focus: TextPos }, Preedit { text: Arc<str>, cursor: Option<Range<usize>> }, ImeCommit, Edit(EditCommand), Newline { shift: bool }, Tab, BackTab, Cancel }. One input of an editor part.
    • pub const fn delete(forward: bool, by: Granularity) -> Self. A Delete of by, without Shift.
    • pub const fn delete_with_shift(forward: bool, by: Granularity, shift: bool) -> Self. A Delete of by with Shift held when shift.
    • pub const fn newline(shift: bool) -> Self. A Newline, with Shift held when shift.
    • pub const fn delete_surrounding(before: usize, after: usize) -> Self. A DeleteSurrounding of before and after characters.
    • pub const fn delete_surrounding_bytes(before: usize, after: usize) -> Self. A DeleteSurrounding of before and after bytes of UTF-8 text, as winit reports it.
    • pub fn preedit(text: impl Into<Arc<str>>, cursor: Option<Range<usize>>) -> Self. A Preedit of text with the IME's cursor.
    • pub const fn select(anchor: TextPos, focus: TextPos) -> Self. A Select of anchor to focus.
    • pub const fn is_read_only_safe(&self) -> bool. Whether the input changes no text: a read-only editor receives only these (18.4).
  • craft_behavior::editor::SurroundingUnit: pub enum SurroundingUnit { Chars, Bytes }. What an input method counts the text around the caret in.
    • pub fn chars_before(self, n: usize, text: &str) -> usize. The characters n of this unit cover at the end of text, the editor's text before the deletion.
    • pub fn chars_after(self, n: usize, text: &str) -> usize. The characters n of this unit cover at the start of text, the editor's text after the deletion.

craft_behavior::eviction

When a component's remembered state is due for eviction.

  • craft_behavior::eviction::owner_due: pub fn owner_due(last_pass: u64, last_at: f64, pass_now: u64, now: f64, viewport_live: bool) -> bool. Whether the owner last registered at pass last_pass and time last_at is due: both the pass count and the time limit have run out.

craft_behavior::fit

The fit rules: which tabs, bar items or titles stay in a strip and which go to an overflow menu. [fit] and [fit_whole] assign tab widths (tabs shrink before they overflow, or keep their width); [fit_items] shortens items that have a short form, in the order their host ranks, and drops command items and titles from the end.

  • craft_behavior::fit::Fit: pub struct Fit { pub shown: Vec<usize>, pub overflow: Vec<usize>, pub short: Vec<usize> }. Which items the strip shows and which go to the overflow menu, as indexes into the input, in input order.
  • craft_behavior::fit::FitItem: pub struct FitItem { pub extent: f32, pub section: u16, pub keep: FitKeep, pub short: Option<f32>, pub short_order: u16, pub short_late: bool }. One item as the fit rule sees it: its extent along the strip, its section and whether it may overflow.
    • pub const fn new(extent: f32, section: u16, keep: FitKeep) -> Self. An item extent long in section.
    • pub const fn short(mut self, extent: f32) -> Self. The item with a shorter form extent long, which it takes before any free item leaves unless it is late.
    • pub const fn short_order(mut self, order: u16) -> Self. The item with its short form ranked order: lower ranks shorten first, and the last item of a rank first.
    • pub const fn short_late(mut self) -> Self. The item takes its short form only after every free item that can leave has left.
  • craft_behavior::fit::FitKeep: pub enum FitKeep { Free, Pinned, Menu }. Whether an item may move into the overflow menu, or lives there.
  • craft_behavior::fit::TabFit: pub struct TabFit { pub shown: Vec<(usize, f32)>, pub overflow: Vec<usize>, pub overflow_width: f32 }. Tabs visible on a strip and tabs that need an overflow menu, all in original order.
  • craft_behavior::fit::fit: pub fn fit(natural: &[f32], selected: usize, available: f32, minimum_width: f32, overflow_width: f32, keep_selected: bool) -> TabFit. Fit tab widths into available points, shrinking the widest tabs first to a common cap.
  • craft_behavior::fit::fit_items: pub fn fit_items(items: &[FitItem], available: f32, gap: f32, section_gap: f32, overflow_extent: f32) -> Fit. Decides which items stay in a strip available long.
  • craft_behavior::fit::fit_whole: pub fn fit_whole(natural: &[f32], selected: usize, kept: &[bool], available: f32, overflow_width: f32) -> TabFit. Fit tabs at their natural widths; the tabs that do not fit go to an overflow menu.
  • craft_behavior::fit::run_extent: pub fn run_extent(items: &[FitItem], shown: &[bool], gap: f64, section_gap: f64) -> f64. The length of the items marked in shown, with gap between neighbours of a section and section_gap between neighbours of different sections.

craft_behavior::flow

Insets, Flow and Axis: start and end geometry resolved once for the layout direction.

  • craft_behavior::flow::Axis: pub enum Axis { X, Y }. An axis of the screen or of a document.
  • craft_behavior::flow::Flow: pub struct Flow. The geometry of one rect in one direction.
    • pub const fn new(rect: Rect, rtl: bool) -> Self. The flow of rect, right to left when rtl.
    • pub const fn rect(&self) -> Rect. The rect the flow places in.
    • pub const fn is_rtl(&self) -> bool. Whether start is the right edge.
    • pub fn start_x(&self) -> f32. The x of the start edge: the left edge, or the right edge under RTL.
    • pub fn end_x(&self) -> f32. The x of the end edge.
    • pub fn span(&self, start: f32, width: f32) -> Rect. The full-height rect width wide that begins start from the start edge.
    • pub fn take_start(&self, width: f32) -> (Rect, Flow). Takes width from the start edge: the taken rect, and the flow of the rest.
    • pub fn take_end(&self, width: f32) -> (Rect, Flow). Takes width from the end edge: the taken rect, and the flow of the rest.
    • pub fn inset(&self, insets: Insets) -> Rect. The rect shrunk by insets.
    • pub fn align(&self, size: Vec2, h: Align, v: Align) -> Rect. A rect of size in the flow's rect: h along the reading direction (Min is the start edge), v from the top.
    • pub fn to_physical(&self, logical: Rect) -> Rect. A rect given in logical x (from the start edge of this flow's rect) as a physical rect.
    • pub const fn unmirrored(rect: Rect, reason: &'static str) -> Flow. The same rect placed left to right, for a site that places by explicit rects and must not mirror (a free-position board, a waveform). reason names why; every call site is a counted exception.
  • craft_behavior::flow::Insets: pub struct Insets { pub start: f32, pub end: f32, pub top: f32, pub bottom: f32 }. Distances from the four edges of a rect; start and end follow the reading direction.
    • pub const fn new(start: f32, end: f32, top: f32, bottom: f32) -> Self. Insets of start, end, top and bottom.
    • pub const fn horizontal(h: f32) -> Self. h at the start and the end.
    • pub const fn vertical(v: f32) -> Self. v at the top and the bottom.
    • pub const fn uniform(all: f32) -> Self. all on every side.

craft_behavior::focus

Pure focus rules (spec 9.3, 9.4, 8.3): key ownership, the Escape order and the focus-on-press kinds.

  • craft_behavior::focus::CancelRule: pub enum CancelRule { Close, ClearThenClose, Ignore }. What Escape does in a scope that has no more specific taker.
  • craft_behavior::focus::EscapeFacts: pub struct EscapeFacts { pub press_captured: bool, pub component_undoable: bool, pub in_row_child: bool, pub scope_clearable: bool }. The facts the Escape order reads.
    • pub const fn new() -> Self. No fact set.
    • pub const fn press_captured(mut self, on: bool) -> Self. A press is captured.
    • pub const fn in_row_child(mut self, on: bool) -> Self. Focus is on a row's child.
    • pub const fn scope_clearable(mut self, on: bool) -> Self. The scope has content to clear.
  • craft_behavior::focus::EscapeRouting: pub struct EscapeRouting { pub cancels_press: bool, pub to_components: usize }. How the Escapes that arrived in one pass split between the captured press and the components.
  • craft_behavior::focus::EscapeStep: pub enum EscapeStep { CancelPress, Component, BackToRow, ClearScope, CloseScope, Ignore }. What the Escape of one pass reaches first.
  • craft_behavior::focus::KeyOwner: pub enum KeyOwner { Blocked, Class(OwnerClass) }. Who owns the keys of one pass.
  • craft_behavior::focus::OwnerClass: pub enum OwnerClass { Widget, Text, Recorder, App, Popup, PassivePopup, Menu, Dialog }. A key class: the input of key ownership.
  • craft_behavior::focus::PressFocus: pub enum PressFocus { Take, Keep, Release, Unclaimed }. How a primary press moves key focus (8.3).
    • pub const fn commits_draft(self) -> bool. Whether a focused text part with a draft commits it in the press pass.
  • craft_behavior::focus::ScopeKind: pub enum ScopeKind { Window, Pane, Dialog, Popup, Menu, Group }. What a focus scope is.
  • craft_behavior::focus::classify_press: pub fn classify_press(winner: Option<Sense>) -> PressFocus. The kind of a press from the sense of the shape that wins it, None when no shape senses it.
  • craft_behavior::focus::escape_step: pub fn escape_step(facts: EscapeFacts, rule: CancelRule) -> EscapeStep. The order of Escape for the top egui layer that is not exiting: a captured press, the focused component, a row's child, then the scope's rule.
  • craft_behavior::focus::key_owner: pub fn key_owner(blocked: bool, present: &[OwnerClass]) -> KeyOwner. Key ownership, in the order blocked, Menu, Recorder, Dialog, Text, Popup and PassivePopup, Widget, App. present lists the classes that have a claim this pass, in any order.
  • craft_behavior::focus::route_escapes: pub fn route_escapes(escapes: usize, press_captured: bool) -> EscapeRouting. Routes escapes Escapes of one pass: with a press captured, the first one is the press's (escape_step's first case) and the rest go to the components, in the order they arrived.

craft_behavior::frame_step

The step of one pass of motion: a Hand glide, a held Zoom press and an autoscroll integrate over it.

  • craft_behavior::frame_step::FRAME_STEP_MAX: pub const FRAME_STEP_MAX: f64. The longest step motion integrates, in seconds, so a stalled pass never jumps the view.
  • craft_behavior::frame_step::frame_step: pub fn frame_step(dt: f64) -> f64. The step of a pass that came dt seconds after the previous one, kept within 0..=FRAME_STEP_MAX.

craft_behavior::geometry

Pure canvas geometry in document units: the transform box ([quad]), snapping ([snap]), the outline being drawn by a lasso ([draft]), how a selection combines with the current one ([selection_op]), the marquee drag rules ([marquee]), direction locking ([lock]), the move gesture and stroke lock ([move_gesture]), the crop frame ([crop]), the area outside a crop frame as convex pieces ([outside]) and plane helpers ([geom]).

  • craft_behavior::geometry::AXIS_BAND_DEGREES: re-export of craft_behavior::geometry::lock::AXIS_BAND_DEGREES.
  • craft_behavior::geometry::AspectHold: re-export of craft_behavior::geometry::crop::AspectHold.
  • craft_behavior::geometry::BoxAllow: re-export of craft_behavior::geometry::quad::BoxAllow.
  • craft_behavior::geometry::BoxDrag: re-export of craft_behavior::geometry::quad::BoxDrag.
  • craft_behavior::geometry::BoxHandles: re-export of craft_behavior::geometry::quad::BoxHandles.
  • craft_behavior::geometry::BoxPart: re-export of craft_behavior::geometry::quad::BoxPart.
  • craft_behavior::geometry::BoxRules: re-export of craft_behavior::geometry::quad::BoxRules.
  • craft_behavior::geometry::BoxState: re-export of craft_behavior::geometry::quad::BoxState.
  • craft_behavior::geometry::ConstrainStyle: re-export of craft_behavior::geometry::move_gesture::ConstrainStyle.
  • craft_behavior::geometry::Constraint: re-export of craft_behavior::geometry::marquee::Constraint.
  • craft_behavior::geometry::CropBox: re-export of craft_behavior::geometry::crop::CropBox.
  • craft_behavior::geometry::CropGuide: re-export of craft_behavior::geometry::crop::CropGuide.
  • craft_behavior::geometry::Directions: re-export of craft_behavior::geometry::lock::Directions.
  • craft_behavior::geometry::DraftEvent: re-export of craft_behavior::geometry::draft::DraftEvent.
  • craft_behavior::geometry::DraftKind: re-export of craft_behavior::geometry::draft::DraftKind.
  • craft_behavior::geometry::DraftPoint: re-export of craft_behavior::geometry::draft::DraftPoint.
  • craft_behavior::geometry::DraftReach: re-export of craft_behavior::geometry::draft::DraftReach.
  • craft_behavior::geometry::GuideShow: re-export of craft_behavior::geometry::crop::GuideShow.
  • craft_behavior::geometry::Homography: re-export of craft_behavior::geometry::quad::Homography.
  • craft_behavior::geometry::LOCK_HYSTERESIS_DEGREES: re-export of craft_behavior::geometry::lock::LOCK_HYSTERESIS_DEGREES.
  • craft_behavior::geometry::MarqueeGesture: re-export of craft_behavior::geometry::marquee::MarqueeGesture.
  • craft_behavior::geometry::MarqueeRect: re-export of craft_behavior::geometry::marquee::MarqueeRect.
  • craft_behavior::geometry::MoveGesture: re-export of craft_behavior::geometry::move_gesture::MoveGesture.
  • craft_behavior::geometry::MoveValue: re-export of craft_behavior::geometry::move_gesture::MoveValue.
  • craft_behavior::geometry::OutlineDraft: re-export of craft_behavior::geometry::draft::OutlineDraft.
  • craft_behavior::geometry::Parts: re-export of craft_behavior::geometry::quad::Parts.
  • craft_behavior::geometry::SKEW_LIMIT: re-export of craft_behavior::geometry::quad::SKEW_LIMIT.
  • craft_behavior::geometry::SNAP_PX: re-export of craft_behavior::geometry::snap::SNAP_PX.
  • craft_behavior::geometry::ScaleRule: re-export of craft_behavior::geometry::quad::ScaleRule.
  • craft_behavior::geometry::SelectionOperation: re-export of craft_behavior::geometry::selection_op::SelectionOperation.
  • craft_behavior::geometry::SnapGesture: re-export of craft_behavior::geometry::snap::SnapGesture.
  • craft_behavior::geometry::SnapKind: re-export of craft_behavior::geometry::snap::SnapKind.
  • craft_behavior::geometry::SnapKinds: re-export of craft_behavior::geometry::snap::SnapKinds.
  • craft_behavior::geometry::SnapLine: re-export of craft_behavior::geometry::snap::SnapLine.
  • craft_behavior::geometry::SnapOptions: re-export of craft_behavior::geometry::snap::SnapOptions.
  • craft_behavior::geometry::SnapSuspend: re-export of craft_behavior::geometry::snap::SnapSuspend.
  • craft_behavior::geometry::SnapTarget: re-export of craft_behavior::geometry::snap::SnapTarget.
  • craft_behavior::geometry::SnapTargets: re-export of craft_behavior::geometry::snap::SnapTargets.
  • craft_behavior::geometry::StrokeLock: re-export of craft_behavior::geometry::move_gesture::StrokeLock.
  • craft_behavior::geometry::TransformMode: re-export of craft_behavior::geometry::quad::TransformMode.
  • craft_behavior::geometry::across_axis: re-export of craft_behavior::geometry::snap::across_axis.
  • craft_behavior::geometry::axis_or_diagonal: re-export of craft_behavior::geometry::lock::axis_or_diagonal.
  • craft_behavior::geometry::coordinate_across: re-export of craft_behavior::geometry::snap::coordinate_across.
  • craft_behavior::geometry::crop_view: re-export of craft_behavior::geometry::crop::crop_view.
  • craft_behavior::geometry::crop_view_about: re-export of craft_behavior::geometry::crop::crop_view_about.
  • craft_behavior::geometry::drag: re-export of craft_behavior::geometry::quad::drag.
  • craft_behavior::geometry::fixed_size_pixels: re-export of craft_behavior::geometry::marquee::fixed_size_pixels.
  • craft_behavior::geometry::hit_rect: re-export of craft_behavior::geometry::crop::hit_rect.
  • craft_behavior::geometry::lock_direction: re-export of craft_behavior::geometry::lock::lock_direction.
  • craft_behavior::geometry::marquee_pixels: re-export of craft_behavior::geometry::marquee::marquee_pixels.
  • craft_behavior::geometry::motion_across: re-export of craft_behavior::geometry::snap::motion_across.
  • craft_behavior::geometry::outside_pieces: re-export of craft_behavior::geometry::outside::outside_pieces.
  • craft_behavior::geometry::polygon_step: re-export of craft_behavior::geometry::lock::polygon_step.
  • craft_behavior::geometry::round_to_direction: re-export of craft_behavior::geometry::lock::round_to_direction.
  • craft_behavior::geometry::screen_step: re-export of craft_behavior::geometry::crop::screen_step.
  • craft_behavior::geometry::square_pixels: re-export of craft_behavior::geometry::marquee::square_pixels.
  • craft_behavior::geometry::turn_grid: re-export of craft_behavior::geometry::crop::turn_grid.
  • craft_behavior::geometry::turn_to_45: re-export of craft_behavior::geometry::lock::turn_to_45.

craft_behavior::geometry::crop

The crop frame's pure geometry: the box, where a press lands on it, what each gesture makes of it, the straighten and image-mode maths, and the composition guides.

  • craft_behavior::geometry::crop::AspectHold: pub enum AspectHold { Free, Ratio(f64), Diagonal }. What a resize holds about the frame's proportions.
  • craft_behavior::geometry::crop::CropBox: pub struct CropBox { pub rect: Rect, pub angle: f64 }. The crop frame: a document rect and the angle it is turned by about its centre.
    • pub const fn new(rect: Rect, angle: f64) -> Self. The frame rect turned angle degrees about its centre.
    • pub const fn upright(rect: Rect) -> Self. An unturned frame.
    • pub fn part_at(&self, point: Point, reach: f64) -> BoxPart. The part a press at point (document units) lands on, with reach document units of reach: a corner or an edge, [BoxPart::Inside] or [BoxPart::Outside] (the turn zone).
    • pub fn is_finite(&self) -> bool. Whether the rect and the angle are finite numbers.
    • pub fn center(&self) -> Point. The centre the frame turns about.
    • pub fn corners(&self) -> [Point; 4]. The corners on the page, turned: top left, top right, bottom right, bottom left of the upright frame.
    • pub fn part_point(&self, part: BoxPart) -> Option<Point>. The document point of part on the turned frame: a corner or an edge handle, or the centre for [BoxPart::Inside]; none for the other parts.
    • pub fn part_direction(&self, part: BoxPart) -> Option<Vec2>. The direction part points out of the frame, as a document vector turned with the frame; none for the parts that are neither a corner nor an edge.
    • pub fn quadrant_diagonal(&self, point: Point) -> Vec2. The diagonal, as a document vector, from the frame's corner nearest point towards the frame's centre reversed: it points out of the centre through the corner of the quadrant point lies in, along the frame's own axes.
    • pub fn turned_bounds(&self) -> Rect. The axis-aligned bounds of the turned frame.
    • pub fn moved(&self, by: Vec2) -> Self. The frame moved by by on the page, its angle kept.
    • pub fn swapped(&self) -> Self. Width and height swapped about the centre, the angle kept (X).
    • pub fn nudged(&self, part: BoxPart, by: Vec2, ratio: Option<f64>) -> Self. The frame after an arrow key moves part by by, as a plain drag of the part would, with ratio held.
    • pub fn crop_size(&self) -> Option<(f64, f64)>. The size Enter would crop to: the frame's own width and height in whole document units, at least 1; None when they are not finite.
    • pub fn size_ok(&self, min: f64) -> bool. Whether both sides are at least min, and never under one document unit whatever min says.
    • pub fn resized(&self, part: BoxPart, by: Vec2, hold: AspectHold, alt: bool) -> Self. The frame with part dragged by the page vector by: along the frame's own axes, the opposite edges kept on the page (or the centre with alt), the proportions held as hold says.
    • pub fn resized_centred(&self, part: BoxPart, by: Vec2, hold: AspectHold, alt: bool) -> Option<Self>. [resized] for Auto Center Preview in image mode: part dragged by by grows or shrinks the frame about its centre, so the handle stays under the pointer while the frame stays centred on screen.
    • pub fn turned_to(&self, grab: f64, to: Point, step: Option<f64>, image: bool) -> Self. The frame turned from this one's angle by the pointer's sweep about the centre, from direction grab (radians, see [direction]) to to; step snaps the angle (⇧).
    • pub fn within(self, bounds: Rect, resizing: bool, held: bool) -> Option<Self>. The frame kept inside bounds: an unturned frame is cut to it; a turned one is moved by the least that brings its bounds in, and left as it is when it cannot fit. None when a frame that changes size (resizing) cannot be kept inside (the caller keeps its last frame).
    • pub fn kept_inside(&self, bounds: Rect) -> Option<Self>. The frame at its angle kept inside bounds (#10869, an image-mode turn): self, bit for bit, when its turned corners are inside (also when a rounding error puts them a hair past an edge); else moved the shortest way in on each axis, its size kept; else shrunk about its centre to the largest size with its proportions that fits, then moved in. None when a size or the angle is not finite or a size is not positive.
    • pub fn level_angle(a: Point, b: Point) -> Option<f64>. The frame angle (degrees, clockwise on the page, in -45..=45) that makes the line from a to b level, or plumb when it is nearer vertical; None for a point or a line that is not finite.
    • pub fn fitted(&self, canvas: Size, angle: f64) -> Option<CropBox>. The largest frame with this one's proportions that fits a canvas of canvas at angle degrees, centred on the canvas. None when a size or the angle is not a positive finite number.
  • craft_behavior::geometry::crop::CropGuide: pub enum CropGuide { Thirds, Grid, Diagonal, Triangle, GoldenRatio, GoldenSpiral }. The composition guide drawn inside a crop frame, in Photoshop's menu order.
    • pub const ALL: [CropGuide; 6]. Every guide, in the order next cycles through.
    • pub fn orientations(self) -> u8. How many distinct orientations next_orientation steps through: the Triangle's diagonal runs either way, the Golden Spiral winds into any of the four corners; the others are symmetric.
    • pub fn next(self) -> Self. The next guide (O); the orientation starts over at 0.
    • pub fn next_orientation(self, orientation: u8) -> u8. The guide's next orientation (Shift+O) after orientation; a symmetric guide stays at 0 and a stray value comes back in range.
    • pub fn guides(self, orientation: u8, w: f64, h: f64, grid_step: f64, grid_max: usize) -> Vec<Vec<Point>>. The guide's polylines for a frame w x h screen points, in its unit square (0..1 along its top edge, 0..1 down its left edge), so one geometry maps onto an upright or a turned frame.
  • craft_behavior::geometry::crop::GuideShow: pub enum GuideShow { Auto, Always, Never }. When the guide shows.
    • pub const ALL: [GuideShow; 3]. Every rule, in menu order.
    • pub fn shows(self, gesture: bool) -> bool. Whether the guide shows, gesture being a crop drag in progress.
  • craft_behavior::geometry::crop::crop_view: pub fn crop_view(b: &CropBox, view: &CanvasView) -> CanvasView. view turned so the frame b shows upright (rotation -b.angle), the frame's centre kept where it is on screen.
  • craft_behavior::geometry::crop::crop_view_about: pub fn crop_view_about(b: &CropBox, view: &CanvasView, pivot: Point) -> CanvasView. [crop_view] keeping document point pivot where it is on screen. view itself when anything is not finite.
  • craft_behavior::geometry::crop::direction: pub fn direction(c: Point, p: Point) -> f64. The direction of p from c, in radians.
  • craft_behavior::geometry::crop::drawn: pub fn drawn(anchor: Point, cur: Point, ratio: Option<f64>, mods: Mods) -> Rect. A new frame drawn from anchor to cur: ⇧ square, ⌥ from the centre, ratio held.
  • craft_behavior::geometry::crop::hit_rect: pub fn hit_rect(rect: Rect, point: Point, reach: f64) -> BoxPart. [CropBox::part_at] for a plain upright rect, with no frame or view.
  • craft_behavior::geometry::crop::image_turn: pub fn image_turn(frame_angle: f64) -> f64. The turn the image-mode readout shows: clockwise positive, the frame's angle undone, never -0.
  • craft_behavior::geometry::crop::normalized_angle: pub fn normalized_angle(deg: f64) -> f64. An angle in degrees brought into (-180, 180]; 0 for anything not finite.
  • craft_behavior::geometry::crop::screen_step: pub fn screen_step(view: &CanvasView, by: Vec2) -> Vec2. An arrow step by (screen points) as the document vector it is in view, at one document unit per point.
  • craft_behavior::geometry::crop::snap_angle: pub fn snap_angle(deg: f64, step: f64) -> f64. deg on the nearest multiple of step degrees, brought into (-180, 180]; a step that is not finite and positive is ignored.
  • craft_behavior::geometry::crop::turn: pub fn turn(p: Point, c: Point, deg: f64) -> Point. p turned deg degrees clockwise on screen (y down) about c.
  • craft_behavior::geometry::crop::turn_grid: pub fn turn_grid(w: f64, h: f64, step: f64, visible: Rect) -> Vec<Vec<Point>>. The lines of the grid a default-mode turn shows over a w by h frame (screen points), in the frame's unit square as [CropGuide::guides] gives them: step apart counted from the frame's centre, none on the outline, and only those whose position lies inside visible (the part of the frame on screen, in the frame's own axes), so a frame zoomed far past the screen gives only the lines that show.

craft_behavior::geometry::draft

An outline being drawn by a selection or freeform tool, and how it closes: [OutlineDraft].

  • craft_behavior::geometry::draft::DraftEvent: pub enum DraftEvent { Started { intent: Mods }, Changed, Closed { points: Vec<Point>, straight: Vec<usize> }, Cancelled }. What a call on an [OutlineDraft] did.
  • craft_behavior::geometry::draft::DraftKind: pub enum DraftKind { Freehand, Mixed, Polygonal }. Which tool's rules an [OutlineDraft] follows.
  • craft_behavior::geometry::draft::DraftPoint: pub struct DraftPoint { pub at: Point, pub mods: Mods, pub zoom: f64 }. One pointer sample for an [OutlineDraft].
    • pub fn new(at: Point, mods: Mods, zoom: f64) -> Self. A sample at at (document units) with mods held, at zoom screen points per unit.
  • craft_behavior::geometry::draft::DraftReach: pub struct DraftReach { pub close: f64, pub same_point: f64 }. How near a press must be to close an outline, in screen points.
    • pub const fn new(close: f64, same_point: f64) -> Self. A reach closing within close screen points of the first vertex and treating a press within same_point of the last vertex as the same click.
  • craft_behavior::geometry::draft::OutlineDraft: pub struct OutlineDraft. The pointer state machine of an outline being drawn, shared by every lasso.
    • pub fn new(kind: DraftKind, reach: DraftReach) -> Self. An empty draft following kind's rules, closing within reach.
    • pub fn locking_shift_drags(mut self) -> Self. This draft with ⇧ holding a freehand drag to one of eight directions (see [DraftKind::Mixed]).
    • pub fn kind(&self) -> DraftKind. The rules this draft follows.
    • pub fn set_reach(&mut self, reach: DraftReach). Changes the close radii; an open outline keeps its points.
    • pub fn for_document(&mut self, key: u64) -> Option<DraftEvent>. Records key as the active document's.
    • pub fn press(&mut self, at: DraftPoint, has_selection: bool) -> Option<DraftEvent>. The primary button went down at at; has_selection is whether the document has a selection (a path tool passes false: it has nothing to subtract from).
    • pub fn drag(&mut self, at: DraftPoint) -> Option<DraftEvent>. The pointer moved to at with the button down.
    • pub fn move_to(&mut self, at: DraftPoint) -> Option<DraftEvent>. The pointer moved to at with the button down while the reposition key is held: the whole outline moves by the pointer's step since its last sample instead of growing, and the rubber band's free end follows.
    • pub fn hover(&mut self, at: DraftPoint) -> Option<DraftEvent>. The pointer moved to at with the button up: only the rubber band follows, to where a click would place the point (shift_step); hover moves never become vertices. [DraftEvent::Changed] while an outline is open.
    • pub fn release(&mut self, at: DraftPoint) -> Option<DraftEvent>. The primary button went up at at.
    • pub fn mods_changed(&mut self, mods: Mods) -> Option<DraftEvent>. The held modifiers changed.
    • pub fn retract(&mut self) -> Option<DraftEvent>. Removes the last vertex while [takes_retract]; removing the only one cancels the outline.
    • pub fn close(&mut self) -> Option<DraftEvent>. Closes an open outline (Enter, a double-click): [DraftEvent::Closed] with 3 or more points, else [DraftEvent::Cancelled]. None with no outline.
    • pub fn cancel(&mut self) -> Option<DraftEvent>. Drops an open outline: [DraftEvent::Cancelled]; None with no outline.
    • pub fn points(&self) -> &[Point]. The outline's points so far, in document units; empty with no outline.
    • pub fn straight(&self) -> &[usize]. Indices into [points] whose incoming segment is straight.
    • pub fn rubber_band(&self) -> Option<[Point; 2]>. The rubber band from the last vertex to the pointer while straight segments are on and the button is up, for the tool to paint; None otherwise.
    • pub fn is_open(&self) -> bool. Whether an outline is open.
    • pub fn is_down(&self) -> bool. Whether the primary button is down on an open outline.
    • pub fn takes_retract(&self) -> bool. Whether [retract] acts: an outline is open and the button is up (between clicks).

craft_behavior::geometry::geom

Plane geometry the canvas overlays share, in document or screen units: segment clipping.

  • craft_behavior::geometry::geom::clip_segment: pub fn clip_segment(a: Point, b: Point, rect: Rect) -> Option<(Point, Point)>. The part of segment a–b inside rect (Liang–Barsky), or None when none is.

craft_behavior::geometry::lock

Direction locking for ⇧ drags: [Directions], [lock_direction], [round_to_direction], [turn_to_45], [polygon_step] and [axis_or_diagonal].

  • craft_behavior::geometry::lock::AXIS_BAND_DEGREES: pub const AXIS_BAND_DEGREES: f64. How near an axis, in degrees, a ⇧ line or anchor drag must point to snap onto the axis rather than the diagonal ([axis_or_diagonal]).
  • craft_behavior::geometry::lock::Directions: pub enum Directions { Four, Eight }. The directions ⇧ locks a move to.
    • pub const fn count(self) -> u32. How many evenly spaced directions: 4 or 8.
  • craft_behavior::geometry::lock::LOCK_HYSTERESIS_DEGREES: pub const LOCK_HYSTERESIS_DEGREES: f64. Extra angle in degrees the pointer must pass the half-way line between two directions by before a locked direction switches, so it doesn't flicker near the diagonal.
  • craft_behavior::geometry::lock::axis_or_diagonal: pub fn axis_or_diagonal(from: Point, point: Point) -> Point. Shift's rule for the Line tool and anchor drags: within [AXIS_BAND_DEGREES] of an axis, point moves onto the axis through from and keeps its offset along it; otherwise onto the 45° diagonal, at the shorter of its two offsets on both axes. point itself for a zero or non-finite offset.
  • craft_behavior::geometry::lock::lock_direction: pub fn lock_direction(d: Vec2, previous: Option<Vec2>, directions: Directions) -> Vec2. d locked to the nearest of directions evenly spaced directions (0° = right, document y down). previous is the offset this returned last in the same drag: its direction is kept until d is more than half a step plus [LOCK_HYSTERESIS_DEGREES] away from it.
  • craft_behavior::geometry::lock::polygon_step: pub fn polygon_step(from: Point, point: Point) -> Point. Shift's polygon vertex: point moved to the nearest of eight directions from from; an axis keeps the segment's length, a diagonal keeps the shorter offset on both axes. point itself for a zero-length or non-finite offset.
  • craft_behavior::geometry::lock::round_to_direction: pub fn round_to_direction(angle: f64, directions: Directions) -> f64. angle (radians, 0 = right, document y down) rounded to the nearest of directions evenly spaced directions: the one angle-rounding rule behind [lock_direction] (projection) and [turn_to_45] (rotation).
  • craft_behavior::geometry::lock::turn_to_45: pub fn turn_to_45(from: Point, point: Point) -> Point. point turned about from to the nearest multiple of 45°, keeping its distance: the ⇧ rule for a line, a handle or a segment drawn from a fixed point.

craft_behavior::geometry::marquee

The Ui-free rules of a marquee drag: [MarqueeGesture], the options bar's [Constraint], and the pixel rectangles a marquee selects.

  • craft_behavior::geometry::marquee::Constraint: pub enum Constraint { Free, Ratio(f64, f64), Size(f64, f64) }. The options bar's marquee style.
    • pub fn corners(self, start: Point, end: Point, square: bool, centre: bool) -> (Point, Point). The corners of the marquee dragged from start to end: the style applied, ⇧ (square) making it square when free, ⌥ (centre) drawing it from the centre.
  • craft_behavior::geometry::marquee::MarqueeGesture: pub struct MarqueeGesture. The rules of a marquee drag: ⇧ and ⌥ counted only when pressed after the press (or released and pressed again), Space moving the whole marquee, and the options bar's [Constraint].
    • pub fn press(screen: Pos2, at: Point, mods: Mods) -> Self. A press at screen (screen points) and at (document units, snapped by the host) with mods held: they choose the selection mode, not square or centre.
    • pub fn pointer(&self) -> Pos2. The pointer on screen as last followed.
    • pub fn has_begun(&self) -> bool. The tool began the gesture with its first drag call.
    • pub fn follow(&mut self, screen: Option<Pos2>, mods: Mods). The pass's mods and pointer (None keeps the last one): records ⇧ and ⌥ being released since the press.
    • pub fn begin(&mut self) -> bool. Begins the gesture: the tool calls it on its first drag, the press arena having separated the drag from a click.
    • pub fn square_and_centre(&self) -> (bool, bool). ⇧ (square) and ⌥ (from the centre) for the marquee: held now, and either not held at the press or released since.
    • pub fn size_to(&mut self, at: Point, space: bool, constraint: Constraint) -> MarqueeRect. Sizes the marquee to the pointer's document point at (the host's snap applied): with space held the whole marquee moves by the pointer's step instead.
  • craft_behavior::geometry::marquee::MarqueeRect: pub struct MarqueeRect { pub a: Point, pub b: Point }. The two corners of a marquee in document space, as dragged: not ordered, not rounded.
    • pub const fn new(a: Point, b: Point) -> Self. The marquee from the corner a to the corner b.
    • pub fn rect(&self) -> Rect. The rectangle between the corners, with x0 <= x1 and y0 <= y1.
  • craft_behavior::geometry::marquee::fixed_size_pixels: pub fn fixed_size_pixels(a: Point, b: Point, size:(f64, f64)) -> Rect. The pixel rectangle of a fixed-size marquee between the corners a and b: exactly size (w, h) in whole pixels (at least 1 × 1).
  • craft_behavior::geometry::marquee::marquee_pixels: pub fn marquee_pixels(a: Point, b: Point) -> Rect. The pixel rectangle a marquee between two corners selects: both edges snapped outwards to whole pixels, so every pixel the marquee touches is in.
  • craft_behavior::geometry::marquee::square_pixels: pub fn square_pixels(r: Rect, start: Point, end: Point) -> Rect. A square marquee's pixel rectangle r, as [marquee_pixels] returns it, with equal sides.

craft_behavior::geometry::move_gesture

A move by drag: direction lock, stroke lock and snapping along a ray.

  • craft_behavior::geometry::move_gesture::ConstrainStyle: pub struct ConstrainStyle { pub copy_reach: f64, pub stroke_lock: f64 }. The distances of the move and stroke rules, in screen points.
    • pub const fn new(copy_reach: f64, stroke_lock: f64) -> Self. A style with the two distances; a tool passes ToolContext::slop for both.
  • craft_behavior::geometry::move_gesture::MoveGesture: pub struct MoveGesture. A Move-tool drag in progress: the press, whether ⌥ was held at it, and the last locked offset.
    • pub fn press(style: &ConstrainStyle, start: Point, mods: Mods, directions: Directions) -> MoveGesture. Starts a drag at start (document units) with the keys held at the press.
    • pub fn follow(&mut self, at: Point, mods: Mods, zoom: f64) -> Option<MoveValue>. The pointer moved to at (document units) with mods at zoom screen points per document unit. ⇧ locks the offset to the gesture's directions with hysteresis from the last locked offset; without ⇧ the offset is free and the lock is forgotten. copy turns on when ⌥ was held at the press and |delta| × zoom ≥ copy_reach.
    • pub fn release(mut self, at: Point, mods: Mods, zoom: f64) -> MoveValue. The release at at: the same lock as [follow] applies, so a release where the last value was ends there.
    • pub fn value(&self) -> MoveValue. The value of the last [follow]: the offset and whether it copies.
    • pub fn left_press(&self) -> bool. Whether the pointer, at a [follow], has been half a document unit or more from the press on either axis (before the ⇧ lock), so a move of whole units has moved off its press.
    • pub fn locked(&self) -> Option<Vec2>. The direction ⇧ holds the offset to, as the last locked offset; None while the move is free.
  • craft_behavior::geometry::move_gesture::MoveValue: pub struct MoveValue { pub delta: Vec2, pub copy: bool }. The value of a move drag.
    • pub fn changed(&self) -> bool. Whether the drag changes anything: an offset or a copy.
  • craft_behavior::geometry::move_gesture::StrokeLock: pub struct StrokeLock. ⇧ during a painting stroke (every painting tool, the Freeform Pen; which tools is the app's list): the stroke stays on a line at 0°, 45° or 90° from where the lock began.
    • pub fn new(style: &ConstrainStyle) -> Self. No lock yet; style gives the screen distance before the direction locks.
    • pub fn constrain(&mut self, last: Point, p: Point, shift: bool, zoom: f64) -> Point. The stroke point for the pointer at p (document units), last the stroke's last point, zoom screen points per document unit.
    • pub fn locked(&self) -> bool. Whether a direction is locked.
    • pub fn reset(&mut self). Forget the lock (the stroke ended).

craft_behavior::geometry::outside

The canvas outside a convex hole, as convex pieces.

  • craft_behavior::geometry::outside::outside_pieces: pub fn outside_pieces(canvas: [Point; 4], hole: &[Point]) -> Vec<Vec<Point>>. Convex pieces that cover the canvas quad outside the convex hole exactly once: the canvas clipped by each hole edge's outer half-plane in turn.

craft_behavior::geometry::quad

Box geometry of transform boxes: where the box goes when a part of it is dragged, and the options bar's reading of it.

  • craft_behavior::geometry::quad::BoxAllow: pub struct BoxAllow { pub rotate: bool, pub skew: bool, pub distort: bool, pub warp: bool }. What the box's content allows.
    • pub const fn new(rotate: bool, skew: bool, distort: bool) -> Self. What the content allows: turning, skewing and distorting.
    • pub const fn with_warp(mut self, warp: bool) -> Self. Whether the content allows warping.
  • craft_behavior::geometry::quad::BoxDrag: pub enum BoxDrag { Move, Pivot, Rotate, Scale, Distort, Perspective, Skew, SlideCorner }. What a drag of a box part does ([BoxRules::drag_kind]).
  • craft_behavior::geometry::quad::BoxHandles: pub enum BoxHandles { All, Corners, Sides }. Which handles of a box are shown.
  • craft_behavior::geometry::quad::BoxPart: pub enum BoxPart { Corner(u8), Edge(u8), Pivot, Inside, Outside }. A part of a box under the pointer or picked from the keyboard.
    • pub const fn index(self) -> u64. The number a part is keyed by in a canvas control's part keys: 0 inside or outside, 1 to 4 the corners, 5 to 8 the edges, 9 the pivot.
    • pub const fn from_index(index: u64) -> Option<BoxPart>. The part keyed by index: the inverse of [index], with 0 the inside.
  • craft_behavior::geometry::quad::BoxRules: pub struct BoxRules { pub mode: TransformMode, pub scale: ScaleRule, pub aspect_linked: bool, pub allow: BoxAllow, pub rotate_step: f64, pub min_side: f64, pub handles: BoxHandles, pub edge_band: f32 }. How drags change a box.
    • pub fn in_mode(mode: TransformMode) -> BoxRules. The rules of mode with the default scale rule, a linked aspect, everything allowed and a 15 degree rotation step.
    • pub fn with_scale(mut self, scale: ScaleRule) -> BoxRules. The rules with scale as the plain corner and edge drag rule.
    • pub fn with_aspect_linked(mut self, linked: bool) -> BoxRules. The rules with the options bar's aspect link on or off.
    • pub fn with_allow(mut self, allow: BoxAllow) -> BoxRules. The rules with allow as what the content permits.
    • pub fn with_min_side(mut self, side: f64) -> BoxRules. The rules with side as the minimum side of a scaled box, in document units.
    • pub fn with_handles(mut self, handles: BoxHandles) -> BoxRules. The rules with handles as the handles the box shows.
    • pub fn with_edge_band(mut self, points: f32) -> BoxRules. The rules with each side grabbed within points of its line ([edge_band]).
    • pub fn shows(&self, part: BoxPart) -> bool. Whether the box shows part: Corners shows the four corners and no side, Sides the right and left sides and no corner.
    • pub fn effective_mode(&self) -> TransformMode. The mode drags follow: a mode the content refuses scales as Free Transform does.
    • pub fn allows(&self, part: BoxPart) -> bool. Whether a drag of part changes the box: in Distort only the corners, the inside and the reference point; in Skew everything but the outside; the outside only where rotating is allowed; and never a handle the box does not [show].
    • pub fn drag_kind(&self, part: BoxPart, mods: Mods) -> Option<BoxDrag>. What a drag of part with mods held (as the host has them, before drag_modifiers) does to the box, or None where the rules refuse the part ([allows]). [drag] acts on this kind.
  • craft_behavior::geometry::quad::BoxState: pub struct BoxState { pub quad: [Point; 4], pub pivot: Point }. A transform box: its four corners clockwise from the top left (as the box was before any transform) and its reference point, in document space.
    • pub fn origin_of_pivot(&self, rect: Rect) -> Point. The reference point's place within the box, carried to rect: the pivot through the inverse homography onto the unit square, then onto rect (the relative X and Y fields' origin).
    • pub const fn new(quad: [Point; 4], pivot: Point) -> Self. A box with the corners quad, clockwise from the top left, and the reference point pivot.
    • pub fn from_rect(r: Rect) -> Self. The box of r, the reference point at its centre.
    • pub fn moved(&self, by: Vec2) -> Self. The box and its reference point moved by by.
    • pub fn is_parallelogram(&self) -> bool. Whether the box is still an affine image of its rect (opposite sides parallel), so W and H describe it; a distorted or perspective box is not.
    • pub fn parts(&self, rect: Rect, skew_v: f64) -> Parts. The box read as the options bar shows it, rect being the box before the transform and skew_v the V skew the host keeps (degrees).
    • pub fn with_parts(&self, rect: Rect, skew_v: f64, mut to: Parts) -> Self. The box with the options bar's fields set to to: W and H scale it along its own axes, the angle turns it and the skews lean it, each about the reference point, which stays put.
    • pub fn linked_scale(now:(f64, f64), axis: usize, typed: f64) -> (f64, f64). The signed factors (w, h) after the side on axis (0: W, 1: H) is set to typed with W and H linked, from the factors now.
    • pub fn point_at(&self, at: Anchor9) -> Point. One of the box's nine points, through the box's own frame (a distorted box's centre is where its diagonals' frame puts it).
    • pub fn anchor_of_pivot(&self) -> Option<Anchor9>. The point of the nine the reference point is on, within 0.05 document units; None for a reference point placed elsewhere.
    • pub fn part_at(&self, p: Point, tol: f64) -> BoxPart. The part at p: the nearest of the corners, edge midpoints and reference point within tol (on a small box their reaches overlap), else inside or outside the box.
    • pub fn contains(&self, p: Point) -> bool. Whether p is inside the box (even-odd, so a folded box has holes).
    • pub fn angle(&self) -> f64. The direction of the top edge in degrees, clockwise in document space (y down): the rotate readout. 0 for a collapsed top edge.
    • pub fn scaled_about_pivot(&self, kx: f64, ky: f64) -> Self. Scaled by kx and ky along the box's own axes about the reference point.
    • pub fn turned_about_pivot(&self, radians: f64) -> Self. Turned by radians about the reference point.
  • craft_behavior::geometry::quad::Homography: pub struct Homography. A projective map of the plane: the unit square onto a box, so a box scales along its own axes whatever its shape.
    • pub fn apply_in_front(&self, p: Point, within: Rect) -> Option<Point>. [Homography::apply] for a point on the front side of the horizon, the side most of within's corners lie on (its centre's side on a two–two split); None for a point on the horizon or behind it.
    • pub fn from_rows(rows: [[f64; 3]; 3]) -> Homography. The map with these rows of (x, y, w) coefficients, applied to (x, y, 1).
    • pub fn row(&self, i: usize) -> [f64; 3]. Row i (0 to 2) of the matrix: the coefficients of x, y and the constant.
    • pub fn unit_to_quad(q: [Point; 4]) -> Option<Homography>. The map taking (0, 0), (1, 0), (1, 1), (0, 1) to q's corners; None for a degenerate box.
    • pub fn apply(&self, p: Point) -> Point. p of the unit square, carried to the box.
    • pub fn inverse(&self) -> Option<Homography>. The map back from the box to the unit square; None when the map is singular.
  • craft_behavior::geometry::quad::Parts: pub struct Parts { pub w: f64, pub h: f64, pub angle: f64, pub skew_h: f64, pub skew_v: f64 }. A box read as the options bar shows it: the starting rect scaled by w and h, skewed by skew_h and skew_v and turned by angle, about the reference point.
    • pub const fn new(w: f64, h: f64, angle: f64, skew_h: f64, skew_v: f64) -> Self. The readings: scale factors w and h, the angle in degrees and the two skews in degrees.
  • craft_behavior::geometry::quad::SKEW_LIMIT: pub const SKEW_LIMIT: f64. The skew fields' reach in degrees: a skew of ±90° would flatten the box (PhotoCraft's).
  • craft_behavior::geometry::quad::ScaleRule: pub enum ScaleRule { Proportional, Free, LargerAxis, Shape, Corners }. What a plain corner or edge drag does.
  • craft_behavior::geometry::quad::TransformMode: pub enum TransformMode { Free, Rotate, Skew, Distort, Perspective }. Edit › Transform's modes.
  • craft_behavior::geometry::quad::bisector: pub fn bisector(screen: &BoxState, i: usize) -> emath::Vec2. Corner i of screen's unit bisector, pointing into the box; zero for a collapsed corner.
  • craft_behavior::geometry::quad::drag: pub fn drag(start: &BoxState, last: &BoxState, part: BoxPart, from: Point, to: Point, mods: Mods, rules: &BoxRules) -> BoxState. The box after dragging part from from to to (document points) with mods held, from the box at the press, start. last is the box this drag gave last (start on its first move):
  • craft_behavior::geometry::quad::outset: pub fn outset(corners: &[emath::Pos2; 4], by: f32) -> [emath::Pos2; 4]. The closed polygon corners moved by points outward, each corner along its mitre (kept within four times by at a sharp corner).

craft_behavior::geometry::selection_op

[SelectionOperation]: how a new selection combines with the current one.

  • craft_behavior::geometry::selection_op::SelectionOperation: pub enum SelectionOperation { New, Add, Subtract, Intersect }. How a selection made by a click or a drag combines with the current one: the rule the Channels panel's ⌘-click, a mask thumbnail's ⌘-click and the selection tools share (Photoshop's).
    • pub const ALL: [SelectionOperation; 4]. Every operation, in Photoshop's options-bar order.
    • pub fn from_mods(mods: Mods) -> SelectionOperation. The operation mods ask for: Shift and Alt Intersect, Shift Add, Alt Subtract, else New.
    • pub fn resolve(bar: SelectionOperation, mods: Mods, has_selection: bool) -> SelectionOperation. The operation a selection tool's gesture uses (Photoshop's): the options bar's bar, overridden by mods as [from_mods] reads them (⇧ add, ⌥ subtract, ⇧⌥ intersect).
    • pub fn badge(self) -> Option<CursorBadge>. The badge beside the selection pointer: Add a plus, Subtract a minus, Intersect a cross, New none.
    • pub const fn name(self) -> &'static str. The operation's stable name for commands and settings: "new", "add", "subtract", "intersect" (PhotoCraft's select.loadSelection operation values).

craft_behavior::geometry::snap

[SnapTargets]: snapping (View › Snap / Snap To) and smart-guide geometry.

  • craft_behavior::geometry::snap::SNAP_PX: pub const SNAP_PX: f64. Screen points within which a position snaps (Photoshop).
  • craft_behavior::geometry::snap::SnapGesture: pub enum SnapGesture { Point, Rect { at_press: Rect }, Axis { along: Axis } }. How the host snaps a tool's pointer.
    • pub const fn rect(at_press: Rect) -> Self. A moving rectangle that was at_press when the gesture began.
    • pub const fn axis(along: Axis) -> Self. Only the coordinate across the lines that run along snaps: x for Axis::Y.
  • craft_behavior::geometry::snap::SnapKind: pub enum SnapKind { Guide, Grid, Bounds, Center, LayerEdge, LayerCenter, Selection }. What a target is, so an app can filter (Snap To › Guides only) and the lines can be drawn in the smart-guide colour or the plain one.
    • pub const fn is_smart(self) -> bool. Whether the target's lines draw in the smart-guide colour: LayerEdge, LayerCenter and Center.
  • craft_behavior::geometry::snap::SnapKinds: pub struct SnapKinds. A set of [SnapKind]s, a bit per kind: the kind filter a gesture passes to its snapping.
    • pub const ALL: SnapKinds. Every kind.
    • pub const fn only(kind: SnapKind) -> Self. The set of kind alone.
    • pub fn without(self, kind: SnapKind) -> Self. This set without kind.
    • pub fn contains(self, kind: SnapKind) -> bool. Whether kind is in this set.
  • craft_behavior::geometry::snap::SnapLine: pub struct SnapLine { pub along: Axis, pub position: f64, pub kind: SnapKind, pub span: Option<(f64, f64)> }. The line the UI draws for a snap that happened.
  • craft_behavior::geometry::snap::SnapOptions: pub struct SnapOptions { pub on: bool, pub guides: bool, pub grid: bool, pub layers: bool, pub document_bounds: bool, pub selection: bool, pub smart_guides: bool, pub suspend: SnapSuspend }. View › Snap To and View › Show › Smart Guides, as the app stores them.
  • craft_behavior::geometry::snap::SnapSuspend: pub enum SnapSuspend { Control, Alt }. The key that suspends snapping.
    • pub fn is_held(self, mods: Mods, os: Platform) -> bool. Whether this key is held in mods on os: Control is the Control key without ⌘ on macOS and Ctrl elsewhere (where it is Mods::cmd); Alt is Alt (⌥).
  • craft_behavior::geometry::snap::SnapTarget: pub struct SnapTarget { pub along: Axis, pub position: f64, pub kind: SnapKind, pub span: Option<(f64, f64)> }. One snap position on one axis.
    • pub const fn new(along: Axis, position: f64, kind: SnapKind) -> Self. A full-height line of kind running along an axis, at position across it: a line along Axis::Y snaps x, a line along Axis::X snaps y.
  • craft_behavior::geometry::snap::SnapTargets: pub struct SnapTargets. The snap targets of one gesture.
    • pub fn new() -> Self. No targets.
    • pub fn reach_past_spans(mut self) -> Self. These targets with every span reaching past its extent: a target catches a point or box anywhere along its line, and its span only shapes the drawn smart guide between the two objects.
    • pub fn add(&mut self, target: SnapTarget). Add one target.
    • pub fn add_rect(&mut self, rect: Rect, edge: SnapKind, center: SnapKind). Add a rectangle's four edges as edge targets and its two centre lines as center targets, each spanning the rectangle: how the app adds each layer (LayerEdge, LayerCenter) and the selection (Selection for both) to the targets [with_document] built.
    • pub fn with_document(self, options: &SnapOptions, bounds: Rect, guides: impl IntoIterator<Item =(Axis, f64)>, grid: Option<(Point, Vec2)>,) -> Self. Guides as full-height targets, grid lines of spacing from origin over bounds, the document bounds and centre: what every app has.
    • pub fn filtered(&self, keep: impl Fn(SnapKind) -> bool) -> SnapTargets. Only the targets keep accepts (Snap To with one kind off).
    • pub fn is_empty(&self) -> bool. Whether there is no target.
    • pub fn nearest_of(&self, along: Axis, value: f64, tolerance: f64, kinds: SnapKinds) -> Option<SnapTarget>. The nearest target of a kind in kinds among the lines that run along an axis, within tolerance of value across them; [SnapTargets::nearest] is this with [SnapKinds::ALL].
    • pub fn nearest_within(&self, along: Axis, value: f64, across: Option<(f64, f64)>, tolerance: f64, kinds: SnapKinds) -> Option<SnapTarget>. [nearest_of] that also takes the query's extent across the other axis: a target with a span catches only a point or box overlapping that span there; without across, or for a target without a span, it is nearest_of.
    • pub fn nearest(&self, along: Axis, value: f64, tolerance: f64) -> Option<SnapTarget>. The nearest target among the lines that run along an axis, within tolerance of value across them.
    • pub fn snap_point(&self, point: Point, tolerance: f64) -> (Point, Vec<SnapLine>). point snapped on each axis independently, with the lines to draw.
    • pub fn snap_point_of(&self, point: Point, tolerance: f64, kinds: SnapKinds) -> (Point, Vec<SnapLine>). [snap_point] to the targets of a kind in kinds only (a Distort corner snaps to guides only).
    • pub fn snap_rect(&self, rect: Rect, tolerance: f64) -> (Vec2, Vec<SnapLine>). The offset that moves rect so its nearest edge or centre meets a target on each axis, with the lines to draw.
    • pub fn snap_rect_of(&self, rect: Rect, tolerance: f64, kinds: SnapKinds) -> (Vec2, Vec<SnapLine>). [snap_rect] to the targets of a kind in kinds only (moving a selection skips the selection's own edges).
  • craft_behavior::geometry::snap::across_axis: pub const fn across_axis(along: Axis) -> Axis. The axis across along: a line running along Axis::Y (vertical) is placed on Axis::X.
  • craft_behavior::geometry::snap::coordinate_across: pub const fn coordinate_across(along: Axis, p: Point) -> f64. The coordinate of p a line running along an axis is placed by: x for a line along Axis::Y.
  • craft_behavior::geometry::snap::motion_across: pub fn motion_across(along: Axis) -> Vec2. The document direction a line running along an axis moves in: x for a line along Axis::Y.
  • craft_behavior::geometry::snap::union: pub fn union(rects: impl IntoIterator<Item = Rect>) -> Option<Rect>. The bounding rectangle of rects, or None for none.

craft_behavior::grid

The Grid cursor: columns resolved from last pass's measurements, and the cell each child takes.

  • craft_behavior::grid::GridCursor: pub struct GridCursor. Hands out the cells of one Grid pass, row-major.
    • pub fn new(flow: Flow, columns: &[ColumnWidth], gap: Vec2, last: &GridMeasure) -> Self. A cursor over columns in flow's rect, with gap between columns (x) and rows (y), placed by last.
    • pub fn sized_by_content(flow: Flow, columns: &[ColumnWidth], gap: Vec2, last: &GridMeasure) -> Self. A cursor for a measuring run under a body sized from its content: each Fill column of columns is placed as a Content column, taking the width its cells take, while the room of the cells after it stays what the fill column leaves them. last gives the rows and the columns' least.
    • pub fn unbounded(flow: Flow, columns: &[ColumnWidth], gap: Vec2) -> Self. A cursor for the sweep that asks each column for its least: the cells of every Content and Fill column measure in no bound along x, so each column measures its widest cell.
    • pub fn each_alone(mut self) -> Self. The cursor with each Content column measuring in the room the other columns leave at their least, whatever the columns before it took: each column asks for what it would take alone, so short tells whether the columns fit beside each other.
    • pub fn short(&self) -> bool. Whether the columns, as this sweep measured them, do not fit beside each other: the columns that do not share the room left take more than the room, or a cell of a Fill column took more than its share.
    • pub fn cell(&mut self, size: Vec2) -> Rect. The cell of the next child, whose measured size is size.
    • pub fn room(&self) -> Vec2. The room the next child measures in: as wide as its column, or for a Content column as wide as the columns that do not fill leave, and as tall as the grid below its row's top.
    • pub fn region(&self) -> Rect. The rect the next child measures and is placed in: from its column's start edge and its row's top, as large as room().
    • pub fn fill_room(&self) -> Vec2. The room the next child fills when it fills its width: its column's width, which for a Content column is the width its cells have measured, not the room the cell measures in.
    • pub fn in_content_column(&self) -> bool. Whether the next child goes in a Content column.
    • pub fn column(&self) -> usize. The column the next child goes in.
    • pub fn widen(&mut self, size: Vec2). The cell last placed measured size after all: its column and row record that, and a Content column offers the cells after it in this pass the wider width.
    • pub fn measured(&self) -> &GridMeasure. What this pass measured.
  • craft_behavior::grid::GridMeasure: pub struct GridMeasure { pub columns: Vec<f32>, pub rows: Vec<f32>, pub least: Vec<f32> }. What a Grid pass measured: the widest child per column and the tallest per row, and the least each column takes when the grid asked its columns for it.
    • pub const fn new(columns: Vec<f32>, rows: Vec<f32>) -> Self. A measurement of columns and rows.
    • pub fn with_least(mut self, least: Vec<f32>) -> Self. The measurement with the least width of each column.
  • craft_behavior::grid::resolve_columns: pub fn resolve_columns(columns: &[ColumnWidth], content: &[f32], room: f32, gap: f32) -> Vec<f32>. The width of each column in room: Fixed is the app's width, Content the widest child of last pass (content[i], zero when unknown), and Fill columns share what is left by weight. Controls and Toggle widths take no room until their owner resolves them.

craft_behavior::hit

Hit shapes, their priority and the arena's resolve rule (8.3).

  • craft_behavior::hit::HitLevel: pub enum HitLevel { Background, Body, Edge, Handle }. The tier of a shape inside one stack position; a higher level wins.
  • craft_behavior::hit::HitPriority: pub struct HitPriority { pub level: HitLevel, pub sub: u8 }. A part's rank among the shapes of its stack position: a node editor ranks port above wire above node body.
    • pub const fn new(level: HitLevel, sub: u8) -> Self. A priority at level and sub.
    • pub const BODY: HitPriority. The priority of a component body.
  • craft_behavior::hit::HitShape: pub enum HitShape { Rect(Rect), Circle { center: Pos2, radius: f32 }, Segment { a: Pos2, b: Pos2 }, Polyline { points: Vec<Pos2>, closed: bool, reach: f32 }, Polygon(Vec<Pos2>), OutsidePolygon { within: Rect, polygon: Vec<Pos2> }, Excluding { shape: Box<HitShape>, holes: Vec<(Pos2, f32)> } }. The geometry a part registers: the shape painted is the shape hit.
    • pub const fn circle(center: Pos2, radius: f32) -> Self. A disc.
    • pub const fn segment(a: Pos2, b: Pos2) -> Self. A line segment.
    • pub fn polyline(points: Vec<Pos2>, closed: bool) -> Self. A chain of segments, closed when closed, hit within [LINE_REACH].
    • pub fn polyline_within(points: Vec<Pos2>, closed: bool, reach: f32) -> Self. A chain of segments, closed when closed, hit within reach points: a tool whose measured reach differs from a line's.
    • pub fn outside_polygon(within: Rect, polygon: Vec<Pos2>) -> Self. The part of within outside polygon.
    • pub fn excluding(shape: HitShape, holes: Vec<(Pos2, f32)>) -> HitShape. shape without the discs holes (a centre and a radius each).
    • pub fn bounds(&self) -> Rect. The smallest rectangle around the shape.
    • pub fn translated(&self, by: Vec2) -> Self. The shape moved by by.
    • pub fn snapped(&self, to: &HitShape, within: f32) -> Self. The shape with each coordinate taken from to's where the two lie within within points, when both are the same kind of shape with as many points: two shapes == finds equal after it differ by no more than within.
    • pub fn hit(&self, point: Pos2) -> bool. Whether point hits the shape.
  • craft_behavior::hit::LINE_REACH: pub const LINE_REACH: f32. How far from a line a point still hits it, in points.
  • craft_behavior::hit::ResolveFor: pub enum ResolveFor { Press, Hover }. What a resolution is for.
  • craft_behavior::hit::Shape: pub struct Shape<O> { pub shape: HitShape, pub sense: Sense, pub owner: O, pub part: Option<PartRef>, pub priority: HitPriority, pub position: u32, pub local: bool, pub min_across: f32, pub stacking: u32, pub drag_to_root: bool }. One registered shape of the shape record: a root's, a member's or a part's.
    • pub fn translated(&self, by: Vec2) -> Self. The shape moved by by.
    • pub fn snapped(&self, to: &Shape<O>, within: f32) -> Self. The shape with its geometry and least size across taken from to's where they lie within within points ([HitShape::snapped]).
    • pub const fn new(shape: HitShape, sense: Sense, owner: O, part: Option<PartRef>, priority: HitPriority, position: u32) -> Self. A shape of owner at stack position.
    • pub const fn min_across(mut self, across: f32) -> Self. The hit area is at least across points wide and high.
    • pub const fn stacking(mut self, order: u32) -> Self. The shape's stacking order among shapes of its priority: the higher order wins before the nearest centre.
    • pub const fn local(mut self, local: bool) -> Self. The shape lies in the body layer's space.
    • pub fn hits(&self, point: Pos2) -> bool. Whether point lies in the hit area: the shape grown to be at least its min_across wide and high.
  • craft_behavior::hit::Winner: pub struct Winner<O> { pub index: usize, pub owner: O, pub part: Option<PartRef>, pub sense: Sense, pub local: bool, pub drag_to_root: bool }. The shape that won a resolution.
  • craft_behavior::hit::resolve: pub fn resolve<O: Copy>(shapes: &[Shape<O>], point: Pos2, what: ResolveFor) -> Option<Winner<O>>. The winner among shapes at point: stack position first, then level, sub-level, stacking order, the nearest centre, the last registered.
  • craft_behavior::hit::resolve_mapped: pub fn resolve_mapped<O: Copy>(shapes: &[Shape<O>], point: Pos2, what: ResolveFor, to_local: impl Fn(Pos2) -> Pos2) -> Option<Winner<O>>. [resolve] where shapes with local set are tested at to_local(point).

craft_behavior::hold_repeat

Steps due while a press is held, as a spinner button repeats.

  • craft_behavior::hold_repeat::HoldRepeat: pub struct HoldRepeat. A press held on a spinner button, known by the pass time it began.
    • pub const DELAY: f64. Seconds a press is held before the steps repeat.
    • pub const INTERVAL: f64. Seconds between repeated steps.
    • pub const fn new(start: f64) -> Self. A press that began at pass time start, in seconds.
    • pub fn due(&self, now: f64, elapsed: f64) -> u32. The repeats due in the pass at now that follows another elapsed seconds after: the repeat instants in (now - elapsed, now].
    • pub fn next_repeat(&self, now: f64) -> f64. The first repeat instant after now, the time to ask the next pass for while the press is held.

craft_behavior::input

What a component takes from the user, which decides its default key use.

  • craft_behavior::input::Input: pub enum Input { Pointer, Text, Display, Editor }. The input a component takes.

craft_behavior::intent

Intents: a key, an AccessKit action or typed text turned into meaning (spec 9.2).

  • craft_behavior::intent::AccessRequest: pub struct AccessRequest { pub action: accesskit::Action, pub target: Option<PartRef>, pub data: Option<accesskit::ActionData> }. An AccessKit action with no intent of its own, or any action on a non-focusable sub-node.
    • pub const fn new(action: accesskit::Action, target: Option<PartRef>, data: Option<accesskit::ActionData>) -> Self. A request for action on target.
  • craft_behavior::intent::EditCommand: pub enum EditCommand { Cut, Copy, Paste, SelectAll, Undo, Redo, Delete }. An edit command a component lists in its KeyUse to receive it as Intent::Edit.
  • craft_behavior::intent::Granularity: pub enum Granularity { Unit, Word, Line, Paragraph, Document }. How far a move reaches.
  • craft_behavior::intent::Intent: pub enum Intent { Activate, Submit, SubmitForce, Cancel, Move(NavMove, MoveMods), Delete { forward: bool, by: Granularity, shift: bool }, Space, TogglePick, Digit(u8), Rename, ContextMenu, Reset, Text(Arc<str>), Tab, BackTab, Edit(EditCommand), SwitchPage { forward: bool }, MoveItem { front: bool, all_the_way: bool }, Open, Close, Access(AccessRequest) }. What the runtime routes to a focused component.
    • pub const fn delete(forward: bool, by: Granularity) -> Intent. Delete of by, forward or back.
    • pub const fn switch_page(forward: bool) -> Intent. SwitchPage to the next page when forward.
    • pub const fn move_item(front: bool, all_the_way: bool) -> Intent. MoveItem toward the front when front, all the way when all_the_way.
    • pub fn same_kind(&self, other: &Intent) -> bool. Whether self and other are the same kind of intent, whatever their data.
  • craft_behavior::intent::MoveMods: pub struct MoveMods { pub extend: bool, pub lead: bool, pub by: Granularity, pub fine: bool }. The modifiers of a move, read from the key table.
    • pub const PLAIN: MoveMods. A move by one unit with no modifier.
    • pub const fn new(extend: bool, lead: bool, by: Granularity) -> MoveMods. Modifiers with the given parts and no fine flag.
    • pub const fn fine(mut self, on: bool) -> MoveMods. The same modifiers with the fine flag set to on.
  • craft_behavior::intent::NavMove: pub enum NavMove { Back, Forward, Up, Down, PageUp, PageDown, Start, End }. A logical move. Back and Forward follow the reading direction; the runtime flips physical arrows under right-to-left text when it delivers them.
  • craft_behavior::intent::TextPos: pub struct TextPos { pub line: usize, pub byte: usize }. A position in a text document.
    • pub const fn new(line: usize, byte: usize) -> TextPos. The position byte bytes into line.

craft_behavior::item_layout

Item geometry: where each item of a collection sits for a scroll offset and viewport.

  • craft_behavior::item_layout::FreeLayout: pub struct FreeLayout { pub rects: Vec<Rect> }. Items at positions the document stores: a freeform bin or a node graph.
    • pub fn new(rects: Vec<Rect>) -> Self. Items at rects, in content coordinates.
  • craft_behavior::item_layout::ItemLayout: pub trait ItemLayout. Item geometry in content units.
    • fn mirrors(&self) -> bool. False for a layout whose positions are document data (FreeLayout); the item step then leaves them as given.
    • fn content_size(&self) -> ScrollPos. Finite and non-negative.
    • fn visible(&self, offset: ScrollPos, view: Vec2, out: &mut Vec<usize>). The indices of the items that intersect a viewport of size view scrolled to offset, ascending.
    • fn rect(&self, at: usize, offset: ScrollPos) -> Rect. The rect of item at.
    • fn hit(&self, point: Pos2, offset: ScrollPos) -> Option<usize>. The item under point.
    • fn drop_hit(&self, point: Pos2, offset: ScrollPos) -> Option<usize>. The item whose drop area contains point.
    • fn nav(&self) -> NavShape. How arrow keys move through the items.
    • fn row_len(&self, _row: usize) -> Option<usize>. NavShape::RaggedGrid: the number of items in row, rows holding consecutive items and a run of hidden items counting as a row of its own; None past the last row.
    • fn column_shift(&self, _from: usize, _to: usize) -> isize. NavShape::RaggedGrid: the columns a vertical move from row from to row to shifts the column by, when the rows are offset against each other; 0 when they line up.
    • fn shown(&self, _at: usize) -> bool. Whether item at takes a place in the layout; a hidden item (in a closed group) cannot take the lead.
    • fn cells(&self, _at: usize, _offset: ScrollPos, _out: &mut Vec<(ColumnKey, Rect)>). The cells of item at, with their rects.
    • fn grid(&self) -> Option<&GridView>. Column virtualisation and sections of a sheet.
    • fn frozen_band(&self, _at: usize) -> f32. The height at the top of the view that item at must not paint into: the zoomed frozen-row band for a scrolled row, zero for a frozen row and for a layout without frozen rows.
    • fn first_navigable(&self) -> usize. The first item that is not frozen: where Ctrl or Cmd with Home goes.
    • fn set_columns(&mut self, _columns: &[(ColumnKey, f32)]). The column widths the collection resolved, from the start edge; layouts without columns ignore them.
    • fn column_count(&self) -> usize. The number of columns of a table or sheet; 0 for a layout with none.
    • fn column_shown(&self, _index: usize) -> bool. Whether the column at position index is shown; a hidden column has no cell and the arrows skip it.
    • fn column_key(&self, _index: usize) -> Option<ColumnKey>. The key of the column at position index.
    • fn column_at(&self, _point: Pos2, _offset: ScrollPos) -> Option<usize>. The position of the column under point.
    • fn is_auto(&self, _at: usize) -> bool. Whether item at is as tall as it measures itself.
    • fn measured(&mut self, _heights: &dyn Fn(usize) -> Option<f32>). Takes the measured heights of the auto items: heights(at) is None before the item's first measure.
    • fn set_height(&mut self, _at: usize, _height: f32). An auto item measured height in this pass; the items after it move.
    • fn auto_widths(&self) -> bool. Whether the items are as wide as they measure themselves.
    • fn set_width(&mut self, _at: usize, _ideal: f32, _min: f32). An auto-width item measured ideal and min width.
    • fn set_view(&mut self, _viewport: Vec2, _offset: ScrollPos). The viewport and scroll offset the grid view describes.
    • fn set_fit(&mut self, _at: usize, _width: Option<f32>). Item at is as wide as it measured, width from the start edge, in a layout that gives every item one width; None gives it that width again.
  • craft_behavior::item_layout::LineIndex: pub struct LineIndex. Lines (rows or columns) with a default size, the lines whose size differs and their prefix sums, so the start of a line and the line at a position are a binary search over the differing lines only: a sheet of 1,048,576 rows or 16,384 columns of which a few differ stores a few entries.
    • pub fn uniform(size: f32, count: u32) -> Self. count lines of size each (negative or NaN sizes count as 0.0).
    • pub fn set(&mut self, line: u32, size: f32). Gives line the size size; the lines after it move.
    • pub fn start(&self, line: u32) -> f64. The start of line: the sum of the sizes before it.
    • pub fn end(&self, line: u32) -> f64. The end of line: its start plus its size.
    • pub fn shown(&self, line: u32) -> bool. Whether line exists and has a size above zero.
    • pub fn count(&self) -> u32. The number of lines.
    • pub fn total(&self) -> f64. The sum of all sizes: where the line after the last would start.
  • craft_behavior::item_layout::SHEET_ZOOM: pub const SHEET_ZOOM: RangeInclusive<f32>. The least and greatest zoom of a sheet (10 %…400 %).
  • craft_behavior::item_layout::SheetLayout: pub struct SheetLayout. Rows of a sheet: one position per row, each split into the sheet's columns, over one [LineIndex] for the rows and one for the columns.
    • pub fn new<K>(source: &dyn DisplayOrder<K>, row_h: f32, columns: Vec<(ColumnKey, f32)>) -> Self. A row of row_h per entry of source, split into columns, each with its key and width.
    • pub fn lines(rows: LineIndex, columns: LineIndex) -> Self. A sheet with the size of every row and column in rows and columns, at 100 % zoom.
    • pub fn frozen(mut self, count: usize) -> Self. The first count columns stay in view while the others scroll.
    • pub fn frozen_rows(mut self, count: u32) -> Self. The first count rows stay in view while the others scroll.
    • pub fn zoom(mut self, zoom: f32) -> Self. Every row height and column width is multiplied by zoom, clamped to [SHEET_ZOOM].
    • pub fn rows(&self) -> &LineIndex. The row extents at 100 %.
    • pub fn columns(&self) -> &LineIndex. The column extents at 100 %.
  • craft_behavior::item_layout::SpanLayout: pub struct SpanLayout { pub row_h: f32, pub count: usize, pub width: f32, pub columns: Vec<(ColumnKey, f32)>, pub tree: bool }. Rows of equal height, optionally split into columns: lists, popup lists, tab strips and timeline tracks.
    • pub fn new<K>(source: &dyn DisplayOrder<K>, width: f32, row_h: f32) -> Self. One row of row_h per entry of source, width wide, with no columns.
    • pub fn sized<K>(source: &dyn ItemSource<K>, width: f32, row_h: f32) -> Self. Rows as tall as source says: Height and Rect are the app's, Aspect follows the width, and Auto rows take row_h until the item step feeds their measured height.
    • pub fn columns(mut self, columns: Vec<(ColumnKey, f32)>) -> Self. The columns with their widths, from the start edge.
    • pub fn tree(mut self) -> Self. Rows that expand and collapse.
  • craft_behavior::item_layout::TileLayout: pub struct TileLayout { pub tile: Vec2, pub gap: f32, pub count: usize, pub width: f32, pub fixed_columns: Option<usize> }. Equal tiles that wrap at the width: tile grids, preset grids, font cards and swatch grids.
    • pub fn new<K>(source: &dyn DisplayOrder<K>, width: f32, tile: Vec2, gap: f32) -> Self. One tile of tile per entry of source, gap apart, wrapping at width.
    • pub fn in_columns(mut self, columns: usize) -> Self. Exactly columns tiles per row, whatever the width (a user setting; at least one).
    • pub fn columns(&self) -> usize. Tiles per row: the user's count, else what the width allows; at least one.

craft_behavior::item_marquee

MarqueeSelect: the rectangle a drag over list items sweeps and the selection it makes (8.7).

  • craft_behavior::item_marquee::MarqueeMode: pub enum MarqueeMode { Replace, Add, Toggle, Subtract }. How the swept items combine with the selection the drag started from.
    • pub const fn of(mods: Mods) -> MarqueeMode. The mode a press with mods starts: Shift adds, Cmd or Ctrl toggles, Alt subtracts, none replaces.
  • craft_behavior::item_marquee::MarqueeSelect: pub struct MarqueeSelect<K>. A marquee drag in progress.
    • pub fn begin(origin: Pos2, mods: Mods, base: Vec<K>) -> Self. A marquee that began at origin over base, in the mode mods pick.
    • pub fn mode(&self) -> MarqueeMode. The mode the drag runs in.
    • pub fn update(&mut self, pos: Pos2). Moves the free corner to pos.
    • pub fn rect(&self) -> Rect. The swept rectangle.
    • pub fn selection(&self, items: impl IntoIterator<Item =(K, Rect)>) -> Vec<K>. The selection while the marquee is live, from the items items (key and rect) it sweeps.
    • pub fn cancel(self) -> Vec<K>. Ends the drag with Escape: the selection it started from.

craft_behavior::item_source

Where a collection's items come from: the data traits and the one way to show a slice.

  • craft_behavior::item_source::DisplayOrder: pub trait DisplayOrder<K>. The order a collection shows its entries in.
    • fn len(&self) -> usize. The number of entries.
    • fn key(&self, at: usize) -> K. The key of entry at.
    • fn index_of(&self, key: &K) -> Option<usize> where K: PartialEq,. The position of key, None when the source no longer holds it.
    • fn depth(&self, _at: usize) -> usize. The nesting depth of entry at, 0 for a root.
    • fn has_children(&self, _at: usize) -> bool. Whether entry at has children.
    • fn open(&self, _at: usize) -> bool. Whether the children of entry at show.
    • fn is_section(&self, _at: usize) -> bool. Whether entry at is a section header, which navigation skips.
    • fn section_stop(&self, _at: usize) -> bool. Whether section at is a stop of navigation: it holds the lead, takes Enter, the context-menu key and a press, and opens or closes with Forward and Back when it has children.
    • fn selectable_section(&self, _at: usize) -> bool. Whether a section stop also represents an item that keyboard selection can pick or extend over.
    • fn section_stops_before(&self, _at: usize) -> usize. How many section stops (section_stop) come before entry at.
    • fn enabled(&self, _at: usize) -> bool. Whether entry at can take the lead.
    • fn text(&self, _at: usize) -> Option<Cow<'_, str>>. The text type-ahead matches entry at against.
    • fn revision(&self) -> Option<u64>. A number that changes whenever the entries or their order change; None when the source does not report.
    • fn is_empty(&self) -> bool. Whether there are no entries.
  • craft_behavior::item_source::ItemSource: pub trait ItemSource<K>: DisplayOrder<K>. A display order that also says how tall its entries want to be.
    • fn size_hint(&self, _at: usize) -> SizeHint. The size entry at wants.
    • fn toggled(&self, _at: usize, _column: &ColumnKey) -> bool. Whether the cell of entry at in the toggle column column is on.
    • fn toggle_enabled(&self, _at: usize, _column: &ColumnKey) -> bool. Whether the cell of entry at in the toggle column column can be flipped: a locked field's cell shows its value and takes neither a press, a sweep nor the Space key.
    • fn sub_row(&self, _at: usize) -> Option<usize>. Some(steps) when entry at is a sub-row of an entry above it (a layer's effects): a compact row whose toggle cells sit in its content, steps indent steps from its start, instead of in their columns (sub_row_cells).
  • craft_behavior::item_source::Keyed: pub struct Keyed<'a, T, K>. A slice as an item source, each entry keyed by key.
    • pub fn with_text(mut self, text: impl for<'t> Fn(&'t T) -> Cow<'t, str> + 'a) -> Self. The text type-ahead matches each entry against.
    • pub fn with_toggled(mut self, toggled: impl Fn(&T, &ColumnKey) -> bool + 'a) -> Self. Whether an entry's cell in a toggle column is on.
  • craft_behavior::item_source::Outline: pub struct Outline<'a, K>. DisplayOrder as the key-free outline the navigation core steps over.
    • pub fn new(order: &'a dyn DisplayOrder<K>) -> Self. The outline of order.
    • pub fn columns(mut self, columns: usize) -> Self. The cells of every position, for a sheet's cell navigation.
  • craft_behavior::item_source::SizeHint: pub enum SizeHint { Auto, Height(f32), Aspect(f32), Rect(Vec2) }. How tall (or what shape) an item wants to be.
  • craft_behavior::item_source::keyed: pub fn keyed<'a, T, K>(items: &'a [T], key: impl Fn(&T) -> K + 'a) -> Keyed<'a, T, K>. Shows items keyed by key: the one way to show a slice (7.1 rule 4).

craft_behavior::keys

The key table (spec 9.2): the one place that maps a key press to an intent and modifiers to MoveMods.

  • craft_behavior::keys::ALT_ARROW_KEYS: pub const ALT_ARROW_KEYS: [Chord; 4]. The four Alt+arrow chords of ReorderKeys::AltArrows.
  • craft_behavior::keys::CopyKeys: pub enum CopyKeys { Alt, Platform }. Which held key turns a drag into a copy over a target.
  • craft_behavior::keys::DropOperation: pub enum DropOperation { Move, Copy, Link }. What a drop of a dragged payload does with it.
  • craft_behavior::keys::KeyRole: pub struct KeyRole { pub resettable: bool, pub space: bool, pub multi_select: bool, pub reorderable: Option<ReorderKeys>, pub reorder_axis: Axis, pub rename: bool, pub pages: bool, pub nudge: bool, pub document: bool, pub type_ahead: bool, pub digits: bool, pub value: bool, pub text: bool, pub moves: bool, pub deletes: bool, pub stacked: bool, pub owner_arrows: bool, pub home_row: usize }. What the focused stop is, as far as the table's rows differ.
    • pub const fn new() -> KeyRole. A role with no special rows.
    • pub const fn resettable(mut self, on: bool) -> Self. Delete resets the control.
    • pub const fn space(mut self, on: bool) -> Self. Space is the component's own intent.
    • pub const fn multi_select(mut self, on: bool) -> Self. Ctrl+Space toggles the lead's pick.
    • pub const fn reorderable(mut self, keys: Option<ReorderKeys>) -> Self. The scheme's keys move the selected items; None when the stop does not reorder.
    • pub const fn reorder_axis(mut self, axis: Axis) -> Self. The axis the order is laid out along.
    • pub const fn rename(mut self, on: bool) -> Self. Rename has its key.
    • pub const fn pages(mut self, on: bool) -> Self. Ctrl+Tab switches pages.
    • pub const fn nudge(mut self, on: bool) -> Self. Arrows are nudges, not moves.
    • pub const fn document(mut self, on: bool) -> Self. Cmd (Ctrl off macOS) turns the page moves sideways: a document canvas.
    • pub const fn type_ahead(mut self, on: bool) -> Self. Typed letters are delivered as text.
    • pub const fn digits(mut self, on: bool) -> Self. Typed digits are delivered as digits.
    • pub const fn value(mut self, on: bool) -> Self. Alt with an arrow is a fine move.
    • pub const fn moves(mut self, on: bool) -> Self. The component acts on the moves routed to it.
    • pub const fn deletes(mut self, on: bool) -> Self. Delete and Backspace are the component's own.
    • pub const fn stacked(mut self, on: bool) -> Self. Shift with Left or Right is no move.
    • pub const fn owner_arrows(mut self, on: bool) -> Self. The arrow keys are the enclosing component's, not this role's moves.
    • pub const fn home_row(mut self, row: usize) -> Self. Ctrl or Cmd with Home goes to item row.
    • pub const fn text(mut self, on: bool) -> Self. The stop is a text part.
  • craft_behavior::keys::REORDER_KEYS: pub const REORDER_KEYS: [Chord; 6]. The stacking keys (Photoshop's Bring Forward and Send Backward): Cmd+] moves the selected items one place toward the front, Cmd+[ one place toward the back, and with Shift all the way.
  • craft_behavior::keys::ReorderKeys: pub enum ReorderKeys { Stacking, AltArrows }. The named key scheme of a reorderable collection.
  • craft_behavior::keys::drop_operation: pub fn drop_operation(os: Os, mods: Mods, copy: CopyKeys) -> DropOperation. The drop operation the held modifiers pick over a target that copies with copy.
  • craft_behavior::keys::intent: pub fn intent(os: Os, key: Key, mods: Mods, role: KeyRole) -> Option<Intent>. The intent a key press has for a stop of role, if any. Enter and Space as activation are not rows:
  • craft_behavior::keys::reorder_intent: pub fn reorder_intent(key: Key, mods: Mods, keys: ReorderKeys, axis: Axis) -> Option<Intent>. The Intent::MoveItem a key of the scheme keys asks for in an order laid out along axis, None for any other press.
  • craft_behavior::keys::split_digits: pub fn split_digits(text: &str) -> (Vec<u8>, String). Typed text split for a role that takes digits: the ASCII digits it holds, in order, and the text without them.
  • craft_behavior::keys::toward_end: pub fn toward_end(front: bool, axis: Axis) -> bool. Whether a move toward the front goes toward the end of an order laid out along axis.

craft_behavior::label_column

LabelColumn: label-then-control geometry for one row.

  • craft_behavior::label_column::LabelColumn: pub struct LabelColumn { pub width: f32, pub stack_below: f32, pub gap: f32 }. The label column of a row: a width token, and the row width under which the label moves above the control.
    • pub const fn new(width: f32, stack_below: f32, gap: f32) -> Self. A column width wide that stacks below stack_below, with gap between label and control.
    • pub fn place(&self, flow: Flow, label: Vec2, label_baseline: f32, control_baseline: Option<f32>) -> LabelPlacement. Places a label of label size whose baseline is label_baseline below its top, and the control in the rest of flow's rect. control_baseline is the distance from the control's top to its first baseline as measured last pass; with it the label's baseline lines up with the control's. None (the first appearance) aligns the tops.
  • craft_behavior::label_column::LabelPlacement: pub struct LabelPlacement { pub label: Rect, pub control: Rect, pub stacked: bool }. What LabelColumn::place decided for one row.

craft_behavior::layout_memory

The tolerance rule of layout memory: when a measured size asks for a discard pass.

  • craft_behavior::layout_memory::SizeTween: pub struct SizeTween { pub from: Vec2, pub to: Vec2, pub start: f64, pub duration: f64 }. A size that moves from one value to another over a duration, evaluated at the reader's clock.
    • pub const fn new(from: Vec2, to: Vec2, start: f64, duration: f64) -> Self. A tween from from to to that begins at start and runs for duration.
    • pub fn at(&self, now: f64) -> Vec2. The size at clock reading now, eased in and out.
    • pub fn is_done(&self, now: f64) -> bool. Whether the tween has reached its end at now.
  • craft_behavior::layout_memory::measure_tolerance: pub fn measure_tolerance(pixels_per_point: f32) -> f32. The tolerance in points under which a measured size equals the one placement used: half a physical pixel.
  • craft_behavior::layout_memory::measured_change_asks_for_discard: pub fn measured_change_asks_for_discard(recorded: Option<Vec2>, real: Vec2, changed_last_frame: bool, tolerance: f32) -> bool. Whether a measured size asks for a discard pass. recorded is the size placement used this frame (None on a block's first appearance), real the size the block measured, changed_last_frame whether the block's size also changed in the previous frame, tolerance the size under which two sizes are equal ([measure_tolerance]).

craft_behavior::middle_scroll

The middle button's auto-scroll latch: the gesture state of one middle press.

  • craft_behavior::middle_scroll::MiddleButton: pub enum MiddleButton { Pan, AutoScroll }. What the middle button does over a scroll area.
  • craft_behavior::middle_scroll::MiddleScroll: pub struct MiddleScroll. The auto-scroll latch of one middle press.
    • pub fn press(&mut self, at: Pos2, inside: bool). A middle press: inside the scroll area it latches at at; a second press ends the latch.
    • pub fn release(&mut self). The button went up: after two held passes with the pointer past the dead zone the latch ends; an earlier release keeps it.
    • pub fn swallows(&mut self, phase: PressPhase) -> bool. Whether a press's phase belongs to the press that ended a latch and so reaches nothing else: true for the Down that cancels an active latch and for each later phase of that press through its release or cancel.
    • pub fn cancel(&mut self). Ends the latch.
    • pub fn step(&mut self, pointer: Pos2, held: bool, dt: f64, invert: bool) -> Vec2. One pass: with this pass's pointer and held state it counts the held passes past the 15 pt dead zone and returns the vertical scroll for the step frame_step(dt), at |d|^2.2 × 0.04 points per second, reversed by invert.
    • pub fn anchor(&self) -> Option<Pos2>. Where the latch is anchored, None when there is none.
    • pub fn active(&self) -> bool. Whether a latch is active.

craft_behavior::monitor

The connected monitors, as every window placement reads them.

  • craft_behavior::monitor::Monitor: pub struct Monitor { pub key: MonitorKey, pub pos_px: [i32; 2], pub size_px: [u32; 2], pub scale: f32, pub work_px: Option<([i32; 2], [u32; 2])> }. A connected monitor, in physical pixels of the desktop's coordinate space (negative for a monitor left of or above the primary).
    • pub fn new(key: MonitorKey, pos_px: [i32; 2], size_px: [u32; 2], scale: f32) -> Self. A monitor at pos_px of size_px pixels with scale, usable in full.
    • pub fn with_work_px(mut self, pos_px: [i32; 2], size_px: [u32; 2]) -> Self. Sets the usable area (see [work_px]).
    • pub fn rect_px(&self) -> Rect. The monitor's area in pixels.
    • pub fn points_at(&self, window_scale: f32) -> Rect. The monitor's area in points of a window whose scale is window_scale.
  • craft_behavior::monitor::MonitorKey: pub struct MonitorKey { pub name: String, pub size_px: [u32; 2] }. Identifies a monitor across launches: the name the platform reports and its size in pixels.
    • pub fn new(name: impl Into<String>, size_px: [u32; 2]) -> Self. A key for the monitor called name with size size_px.

craft_behavior::motion

The motion level an animation runs at.

  • craft_behavior::motion::MotionKind: pub enum MotionKind { Fade, Travel, Loop, Blink }. What an animation is: the kind picks its row of the motion table.
  • craft_behavior::motion::MotionMode: pub enum MotionMode { Full, Reduced, Off }. How much motion the interface shows.
    • pub const fn playback(self, kind: MotionKind) -> Playback. What an animation of kind does at this mode (the motion table, 13.2).
    • pub const fn lowered_by(self, scope: MotionMode) -> MotionMode. The lower of two modes: a scope can lower the motion mode, never raise it.
  • craft_behavior::motion::Playback: pub enum Playback { Run, Snap, Still, Solid }. What an animation does under a mode.

craft_behavior::nav

The navigation core (spec 9.5): shapes, the key-free outline, stepping, roving groups, type-ahead and single-value keys.

  • craft_behavior::nav::Arrows: pub enum Arrows { All, Horizontal, Vertical, None }. Which arrow keys a roving group moves its lead with.
  • craft_behavior::nav::LARGE_STEPS: pub const LARGE_STEPS: f64. How many small steps one large step is, when a control sets no large step of its own.
  • craft_behavior::nav::Letters: pub enum Letters { None, TypeAhead }. Whether a roving group matches typed letters to entries.
  • craft_behavior::nav::NavOutline: pub trait NavOutline. Positions, not keys: the key-free part of DisplayOrder.
    • fn len(&self) -> usize. The number of positions.
    • fn depth(&self, at: usize) -> usize. The nesting depth of the position, 0 for a root.
    • fn has_children(&self, at: usize) -> bool. Whether the position has children.
    • fn open(&self, at: usize) -> bool. Whether the position's children show.
    • fn is_section(&self, at: usize) -> bool. Whether the position is a section header, which a move skips.
    • fn enabled(&self, at: usize) -> bool. Whether the position can take the lead.
    • fn row_len(&self, _row: usize) -> Option<usize>. RaggedGrid: the number of positions in row; rows hold consecutive positions. None past the last row.
    • fn column_shift(&self, _from: usize, _to: usize) -> isize. RaggedGrid: how many columns a vertical move from row from to row to shifts the column by, for rows that are offset against each other (a honeycomb's). 0 for rows that line up.
    • fn columns(&self) -> usize. Cell: the cells of every position (a row of a sheet).
    • fn first_column(&self) -> Option<usize>. WrappedGrid: the column of position 0 when the grid has blank cells before it (the leading days of a calendar month), None for a grid that fills from its first column.
    • fn rect(&self, _at: usize) -> Option<Rect>. Spatial: where the position sits, in any one coordinate space.
    • fn is_empty(&self) -> bool. Whether there are no positions.
  • craft_behavior::nav::NavShape: pub enum NavShape { Flat, Tree, WrappedGrid { columns: usize }, BoundedGrid { columns: usize }, RaggedGrid, Cell, Spatial }. The geometry a collection's keyboard navigation follows.
    • pub const fn wrapped_grid(columns: usize) -> Self. Equal-width cells that wrap at columns.
    • pub const fn bounded_grid(columns: usize) -> Self. Equal-width cells in columns columns whose Left and Right stop at the row ends.
  • craft_behavior::nav::NavState: pub struct NavState { pub lead: Option<usize>, pub anchor: Option<usize>, pub page: usize, pub wrap: bool, pub column: usize }. Where a navigation stands between moves.
    • pub const fn new() -> Self. A state with no lead, a page of ten and no wrap.
    • pub const fn at(lead: usize) -> Self. A state at lead.
    • pub const fn page(mut self, rows: usize) -> Self. Sets the page size.
    • pub const fn wrap(mut self, on: bool) -> Self. Sets whether moves wrap.
    • pub const fn column(mut self, column: usize) -> Self. Sets the lead cell's column.
  • craft_behavior::nav::NavStep: pub enum NavStep { Stay, Moved(usize), Expand(usize), Collapse(usize), Column(usize), Unhandled }. What one move did.
  • craft_behavior::nav::Roving: pub struct Roving { pub shape: NavShape, pub wrap: bool, pub home_end: bool, pub page: Option<usize>, pub letters: Letters, pub arrows: Arrows, pub first_column: Option<usize>, pub hands_back: bool, pub no_lead: bool, pub keeps_lead_moves: bool }. A roving group's rules: one Tab stop whose members take moves.
    • pub const fn new(shape: NavShape) -> Roving. A group of shape with Home and End, no wrap, no paging and no letters.
    • pub const fn wrap(mut self, on: bool) -> Self. Whether moves wrap.
    • pub const fn home_end(mut self, on: bool) -> Self. Whether Home and End move to the ends.
    • pub const fn page(mut self, rows: Option<usize>) -> Self. Rows a Page key covers.
    • pub const fn letters(mut self, letters: Letters) -> Self. Whether letters pick entries.
    • pub const fn arrows(mut self, arrows: Arrows) -> Self. The arrows the group takes.
    • pub const fn first_column(mut self, column: usize) -> Self. The column of the first member of a wrapped grid with column blank cells before it: Up and Down keep the column, Home and End go to the ends of the row.
    • pub const fn hands_back(mut self) -> Self. A move the group cannot make reaches the owning component, which may page or change what the group shows.
    • pub const fn keeps_lead_moves(mut self) -> Self. Left and Right with the lead modifier reach the focused member.
    • pub const fn no_lead(mut self, on: bool) -> Self. Whether the focused member is no lead: the next move starts at an end, as from a group with no lead.
    • pub const fn state(&self, lead: Option<usize>) -> NavState. The state a step over this group starts from, at lead, or from no lead when the group has none.
    • pub const fn takes(&self, mv: NavMove, mods: MoveMods) -> bool. Whether the group handles mv with mods: Page moves only with a page size and without lead (on a document canvas that scrolls sideways), Start and End only with Home and End, and no lead_step in a group that keeps_lead_moves.
  • craft_behavior::nav::STEP_SHARE: pub const STEP_SHARE: f64. The share of a value's span that one small step is, when a control sets no step.
  • craft_behavior::nav::StepResult: pub enum StepResult { Set(f64), Ignored }. What a single-value move does.
  • craft_behavior::nav::TypeAhead: pub struct TypeAhead. Typed letters of the last second as one prefix.
    • pub const fn new() -> Self. An empty buffer.
    • pub fn push(&mut self, letter: char, now: f64) -> &str. Adds letter typed at now seconds and returns the prefix, its letters as typed: case is the caller's fold, applied in pick, so it follows the interface language.
    • pub fn pick<'a>(prefix: &str, from: Option<usize>, len: usize, label: impl Fn(usize) -> std::borrow::Cow<'a, str>, fold: impl Fn(&str) -> String,) -> Option<usize>. The entry a prefix picks: the first match from the position after from when the prefix is one letter or one repeated letter (so repeating a letter cycles), from from itself for a longer prefix, wrapping at the end.
  • craft_behavior::nav::ValueAxes: pub enum ValueAxes { Horizontal, Vertical, Both }. The axes a single-value control reads moves on.
  • craft_behavior::nav::ValueSteps: pub struct ValueSteps { pub value: f64, pub min: f64, pub max: f64, pub small: f64, pub large: f64, pub fine: f64, pub notch: f64 }. The value and steps of a single-value control.
    • pub const fn new(value: f64, min: f64, max: f64, small: f64, large: f64) -> Self. Steps over min..=max from value.
    • pub const fn fine(mut self, fine: f64) -> Self. The same steps with an Alt arrow of fine.
    • pub const fn notch(mut self, notch: f64) -> Self. The same steps with a wheel notch of notch.
  • craft_behavior::nav::lead_step: pub const fn lead_step(mv: NavMove, mods: MoveMods) -> Option<NavMove>. The step Left or Right with the lead modifier makes, physical as the arrows are: Ctrl+Left and Ctrl+Right (Back and Forward with the lead), and Cmd+Left and Cmd+Right on macOS, which the key table makes a move to the start or end of the line.
  • craft_behavior::nav::snap_to_step: pub fn snap_to_step(value: f64, step: f64, origin: f64, range: RangeInclusive<f64>) -> f64. value clamped to range, then on the nearest of the stops origin + k * step and the ends of range; a tie goes to the larger stop.
  • craft_behavior::nav::step: pub fn step(shape: NavShape, outline: &dyn NavOutline, state: &mut NavState, mv: NavMove, mods: MoveMods) -> NavStep. Steps the lead of a navigation of shape over outline by mv. mods.extend keeps the anchor at the old lead; any other move clears it. RaggedGrid reads row_len, Cell reads columns and Spatial reads rect from the outline.
  • craft_behavior::nav::step_until_changed: pub fn step_until_changed<T: PartialEq + Copy>(from: T, step: impl Fn(T) -> T, same: impl Fn(T) -> bool) -> T. The value step reaches from from, stepped again while a step still moves it and same says the value is the same one as from to the control: a control that reports quantised values (a web-safe colour) steps on to the next value that differs, or as far as it can go.
  • craft_behavior::nav::step_value: pub fn step_value(steps: &ValueSteps, axes: ValueAxes, mv: NavMove, mods: MoveMods) -> StepResult. Maps a move to the new value of a slider, dial, rating, resize handle or colour pad. Forward, Up and PageUp increase; Start and End go to the ends.
  • craft_behavior::nav::wheel_step: pub fn wheel_step(steps: &ValueSteps, axes: ValueAxes, wheel: &Wheel, rtl: bool) -> StepResult. Maps a wheel share to the new value of a single-value control: one notch per whole wheel line the share carries ([Wheel::lines]), and one for a share of points or pages, up for positive scroll.

craft_behavior::one_press

The one-press-per-pass rule: a pass carries at most one press, as its last pointer event.

  • craft_behavior::one_press::split_after_first_press: pub fn split_after_first_press<E>(mut events: Vec<E>, is_press: impl Fn(&E) -> bool) -> (Vec<E>, Vec<E>). Splits events after the first press.

craft_behavior::overlay

place: where an overlay of a given content size goes around its anchor.

  • craft_behavior::overlay::Align: pub enum Align { Start, Center, End }. How the overlay lines up with the anchor along the edge it hangs from.
  • craft_behavior::overlay::MinWidth: pub enum MinWidth { None, Anchor, Points(f32) }. The narrowest an overlay may be.
    • pub fn points(self, anchor_width: f32, side: Side) -> f32. The width in points, given the anchor's width and the side the overlay takes: beside its anchor (Start, End) an overlay shares no horizontal edge with it, so Anchor asks for nothing there.
  • craft_behavior::overlay::PlaceRequest: pub struct PlaceRequest { pub anchor: Rect, pub size: Vec2, pub side: Side, pub align: Align, pub rtl: bool, pub gap: f32, pub min_width: MinWidth, pub bounds: Rect, pub kept: Option<Side>, pub flips_across: bool, pub covers_anchor: bool, pub offset: Vec2, pub clear: Option<Rect> }. What place reads.
    • pub const fn new(anchor: Rect, size: Vec2, bounds: Rect) -> Self. A request for size around anchor inside bounds: below, aligned to the start, no gap, free width.
    • pub const fn size(mut self, size: Vec2) -> Self. Sets the content size.
    • pub const fn side(mut self, side: Side) -> Self. Sets the preferred side.
    • pub const fn align(mut self, align: Align) -> Self. Sets the alignment.
    • pub const fn rtl(mut self, rtl: bool) -> Self. Sets the reading direction.
    • pub const fn gap(mut self, gap: f32) -> Self. Sets the gap.
    • pub const fn min_width(mut self, min_width: MinWidth) -> Self. Sets the narrowest width.
    • pub const fn kept(mut self, side: Option<Side>) -> Self. Keeps side instead of flipping.
    • pub const fn offset(mut self, by: Vec2) -> Self. Shifts the overlay by by after it is placed and clamped.
    • pub const fn clear(mut self, rect: Option<Rect>) -> Self. Keeps the unshifted place when the shifted overlay would cover rect.
    • pub const fn flips_across(mut self, on: bool) -> Self. Lines up with the anchor's other end, beside it, when that fits and the aligned end does not.
    • pub const fn covers_anchor(mut self, on: bool) -> Self. Below or above the anchor, slides over the anchor when the overlay fits neither side but fits the bounds.
  • craft_behavior::overlay::Placement: pub struct Placement { pub rect: Rect, pub side: Side }. Where place put the overlay.
  • craft_behavior::overlay::Side: pub enum Side { Below, Above, Start, End }. The side of the anchor an overlay prefers. Start and End follow the reading direction.
  • craft_behavior::overlay::place: pub fn place(request: &PlaceRequest) -> Placement. Places an overlay: the preferred side unless the other has more room and the content does not fit, shifted to stay inside the bounds, its height (or width, beside the anchor) capped to the room.

craft_behavior::part

Part keys and part references: the one name for a part in focus, style, results, sub-nodes and decision records.

  • craft_behavior::part::PartKey: pub struct PartKey. The key of a part, declared as a const by the component that owns it.
    • pub const fn new(name: &'static str) -> PartKey. A key named name; the name is unique within one component.
    • pub const CELL: PartKey. A cell of a sheet row: CELL.at(column).
    • pub const fn name(self) -> &'static str. The name the key was declared with.
    • pub const fn at(self, i: u64) -> PartRef. One of a repeated part: POINT.at(id). i is a stable sub-key, an entity id where the repeats are data and the position only for fixed repeats.
  • craft_behavior::part::PartRef: pub struct PartRef { pub key: PartKey, pub index: Option<u64> }. A part's key with an optional index.

craft_behavior::pixel_size

A size in whole pixels.

  • craft_behavior::pixel_size::PixelSize: pub struct PixelSize { pub width: u32, pub height: u32 }. The size of an image or document in whole pixels; PixelSize::new builds one.
    • pub const fn new(width: u32, height: u32) -> Self. A size of width by height pixels.

craft_behavior::placement

Where windows go on the desktop: where a saved window opens ([place]), which monitor a window is on, and where the next window of a cascade opens.

  • craft_behavior::placement::Defaults: pub struct Defaults { pub size: [f32; 2], pub min: [f32; 2], pub screen_room: [f32; 2], pub restore_fullscreen: bool, pub no_position: bool }. What the app wants when nothing (usable) is saved, and how the platform behaves.
    • pub fn new(size: [f32; 2], min: [f32; 2]) -> Self. Defaults for a first window of size points and a minimum of min points.
    • pub fn with_screen_room(mut self, room: [f32; 2]) -> Self. Set the room a monitor loses to the taskbar, Dock or menu bar.
    • pub fn with_restore_fullscreen(mut self, on: bool) -> Self. Set whether full screen is restored.
    • pub fn with_no_position(mut self, on: bool) -> Self. Set whether the platform hides window positions.
  • craft_behavior::placement::NormalRect: pub struct NormalRect { pub pos: [f32; 2], pub size: [f32; 2] }. A rectangle in logical points at zoom 1: top-left corner and size.
  • craft_behavior::placement::Placement: pub struct Placement { pub normal: NormalRect, pub position_px: Option<[i32; 2]>, pub scale: f32, pub zoom: f32, pub maximized: bool, pub fullscreen: bool, pub monitor: Option<MonitorKey> }. What to remember about a window, and what [place] returns for the app to open it with.
    • pub fn new(size: [f32; 2], scale: f32) -> Self. A window of size points, position unknown, on a monitor of scale, not maximized.
    • pub fn repaired(&self) -> Option<Placement>. The record with out-of-range numbers repaired, or None when its size is no size.
    • pub fn position(&self) -> Option<[f32; 2]>. The outer top-left corner in desktop points at the saved scale, where the position is known.
  • craft_behavior::placement::capped: pub fn capped(size: Vec2, monitor: &Monitor, frame: Vec2, min: Vec2) -> Vec2. size at least min and at most the monitor's usable area less frame; the cap wins over the minimum.
  • craft_behavior::placement::cascade: pub fn cascade(previous: Rect, size: Vec2, bounds: Rect, step: f32) -> Rect. Where a window of size opens after the one at previous: one step right and down.
  • craft_behavior::placement::cascade_rects: pub fn cascade_rects(area: Rect, size: Vec2, n: usize, step: f32) -> Vec<Rect>. n windows of size in a cascade inside area: the first at its top left, each next one [cascade]d from the one before.
  • craft_behavior::placement::monitor_of: pub fn monitor_of(monitors: &[Monitor], window_px: Rect) -> Option<&Monitor>. The monitor the window at window_px (desktop pixels) is on: the one showing most of it or, when none shows it, the nearest.
  • craft_behavior::placement::place: pub fn place(saved: Option<&Placement>, monitors: &[Monitor], home: Option<usize>, d: &Defaults) -> Placement. Where a window opens: saved kept on a connected monitor, else the default size on home (index into monitors of the monitor the system opens it on; the one at the origin, else the first, when None).

craft_behavior::press

Pointer values and the press lifecycle (8.1, 8.2), egui-free: the runtime converts egui's events once per pass and feeds them to a [PressMachine].

  • craft_behavior::press::Buttons: pub struct Buttons: u8 (flag set). The pointer buttons held.
    • pub const fn of(button: PointerButton) -> Buttons. The flag of one button.
  • craft_behavior::press::MULTI_CLICK_TIME: pub const MULTI_CLICK_TIME: f64. The longest gap between presses that still count as one multi-click, in seconds.
  • craft_behavior::press::MULTI_TAP_SLOP: pub const MULTI_TAP_SLOP: f32. How far a finger of a multi-finger tap may move from where it landed, in points: fingers drift more than a pointer does while the others land.
  • craft_behavior::press::MULTI_TAP_TIME: pub const MULTI_TAP_TIME: f64. The longest the fingers of a multi-finger tap may stay down, in seconds.
  • craft_behavior::press::MultiTap: pub struct MultiTap { pub fingers: u8, pub at: Pos2 }. Two or more fingers came down and all lifted within [MULTI_TAP_TIME] without moving past [MULTI_TAP_SLOP].
    • pub const fn new(fingers: u8, at: Pos2) -> Self. A tap of fingers around at.
  • craft_behavior::press::MultiTouch: pub struct MultiTouch { pub translation: Vec2, pub zoom: f32, pub rotation: f32, pub center: Pos2 }. A two-finger gesture.
    • pub const fn new(translation: Vec2, zoom: f32, rotation: f32, center: Pos2) -> Self. A gesture around center.
  • craft_behavior::press::PassInput: pub struct PassInput<'a> { pub events: &'a [PointerEvent], pub slop: f32, pub pos: Pos2, pub delta: Vec2, pub held: bool, pub cancel: Option<PressCancel> }. What the machine reads of one pass.
    • pub const fn new(events: &'a [PointerEvent], slop: f32, pos: Pos2, held: bool) -> Self. A pass with these events, no movement and no cancel.
    • pub const fn delta(mut self, delta: Vec2) -> Self. The pointer movement of the pass.
    • pub const fn cancel(mut self, cancel: Option<PressCancel>) -> Self. A reason the captured press ends now.
  • craft_behavior::press::PointerButton: pub enum PointerButton { Primary, Secondary, Middle, Extra1, Extra2 }. A pointer button.
  • craft_behavior::press::PointerEvent: pub enum PointerEvent { Moved { at: Pos2, sample: Option<PointerSample> }, Pressed { button: PointerButton, pos: Pos2, time: f64, clicks: u32 }, Released { button: PointerButton, pos: Pos2 }, Gone }. A button event of one pass, in the order it arrived.
    • pub const fn moved(at: Pos2, sample: Option<PointerSample>) -> Self. The pointer moved to at, with the pen's reading for the move when the runtime has one.
    • pub const fn pressed(pos: Pos2, time: f64, clicks: u32) -> Self. The primary button going down at pos, time, as the clicksth press in a row.
    • pub const fn released(pos: Pos2) -> Self. The primary button going up at pos.
    • pub const fn pressed_by(button: PointerButton, pos: Pos2, time: f64, clicks: u32) -> Self. button going down at pos, time, as the clicksth press in a row.
    • pub const fn released_by(button: PointerButton, pos: Pos2) -> Self. button going up at pos.
  • craft_behavior::press::PointerKind: pub enum PointerKind { Mouse, Pen, Touch }. What kind of device the pointer is.
  • craft_behavior::press::PointerSample: pub struct PointerSample { pub pressure: f32, pub tilt: [f32; 2], pub rotation: f32, pub eraser: bool, pub wheel: Option<f32> }. Pressure and tilt of the current contact.
    • pub const fn new(pressure: f32) -> Self. A sample with no tilt or rotation.
    • pub fn sanitized(self) -> Self. The sample with every field in range: pressure within 0 to 1, tilt and rotation finite radians, a stray value replaced by its neutral one.
  • craft_behavior::press::PressAside: pub struct PressAside<T> { pub target: T, pub start: PressStart, pub pos: Pos2 }. A secondary press made and released while a primary press was open ([PressStep::aside]).
  • craft_behavior::press::PressCancel: pub enum PressCancel { Escape, FocusLost, Disabled, Removed, Host, Gesture }. Why a captured press ended without a release.
  • craft_behavior::press::PressMachine: pub struct PressMachine<T>. The press lifecycle of one root: the press winner it picked, kept until release or cancel.
    • pub const fn new() -> Self. A machine with no press.
    • pub fn target(&self) -> Option<T>. The target of the open press.
    • pub fn button(&self) -> Option<PointerButton>. The button of the open press.
    • pub fn dragging(&self) -> bool. Whether a drag holds the pointer.
    • pub fn start(&self) -> Option<PressStart>. The press the open press began as.
    • pub fn take_over(&mut self, target: T, sense: Sense, start: PressStart). Takes over a press whose button is down and went down elsewhere, as a drag of target from start: the next pass reports DragStart, and later ones the press's own Drag, Release or Cancel from their input, each with a start that says it was handed over ([PressStart::handed]).
    • pub fn release_held(&self) -> bool. Whether the button went up and the release waits for a later pass, which the caller must ask for: no input may come to start it.
    • pub fn step(&mut self, input: PassInput<'_>, mut pick: impl FnMut(Pos2, PointerButton) -> Option<PressPick<T>>) -> PressStep<T>. Runs one pass. pick chooses the press winner and what it senses at a press position, for the button pressed there; it returns None when no shape of this root takes the press.
    • pub fn hand_over(&mut self, target: T, sense: Sense) -> Option<PressStep<T>>. Makes target the open press's target in the pass that reported passes, dragging from the same PressStart.
  • craft_behavior::press::PressPhase: pub enum PressPhase { Idle, Hover, Down { start: PressStart }, Held { start: PressStart, pos: Pos2 }, DragStart { start: PressStart, pos: Pos2 }, Drag { start: PressStart, pos: Pos2, delta: Vec2 }, Release { start: PressStart, pos: Pos2, click: bool }, Cancel { start: PressStart, reason: PressCancel } }. One part's press state in one pass.
    • pub const fn is_press(&self) -> bool. A press is in progress or just ended: not Idle or Hover.
    • pub const fn start(&self) -> Option<PressStart>. The press the phase belongs to.
    • pub const fn button_down(&self) -> bool. Whether the button is down: Down, Held, DragStart or Drag.
    • pub const fn is_drag(&self) -> bool. Whether the phase is a drag in progress.
    • pub const fn is_click(&self) -> bool. Whether the phase is a click: a release within slop.
    • pub fn mapped(self, point: impl Fn(Pos2) -> Pos2, delta: impl Fn(Vec2) -> Vec2) -> PressPhase. The phase with its positions mapped by point and its drag delta by delta, for a part whose space differs from the screen's.
  • craft_behavior::press::PressPick: pub struct PressPick<T> { pub target: T, pub sense: Sense, pub passed: bool }. The press winner a root picks at a press position, as [PressMachine::step]'s pick returns it.
    • pub fn new(target: T, sense: Sense) -> Self. target, sensing sense, takes the press.
    • pub fn passed(mut self) -> Self. The press's click went to a shape above that passes its drag to this target.
  • craft_behavior::press::PressStart: pub struct PressStart { pub origin: Pos2, pub button: PointerButton, pub time: f64, pub clicks: u32, pub handed: bool }. Where and when a press began.
    • pub const fn new(origin: Pos2, button: PointerButton, time: f64, clicks: u32) -> Self. A press of button at origin.
  • craft_behavior::press::PressState: pub struct PressState { pub phase: PressPhase, pub mods: Mods, pub sample: Option<PointerSample>, pub captured: bool, pub context: Option<Pos2> }. A part's phase, the modifiers held, the pen sample and whether it holds the pointer.
    • pub const IDLE: PressState. A part with no press history.
    • pub const fn new(phase: PressPhase) -> Self. A state in phase with no modifiers, sample, capture or aside context request.
    • pub const fn context(mut self, at: Option<Pos2>) -> Self. The aside secondary press that came up on the part at at in this pass.
    • pub const fn mods(mut self, mods: Mods) -> Self. The modifiers held.
    • pub const fn sample(mut self, sample: Option<PointerSample>) -> Self. The pen sample of the contact.
    • pub const fn captured(mut self, captured: bool) -> Self. Whether a drag holds the pointer.
    • pub const fn double_pressed(&self) -> bool. Whether the phase is the Down of the second press of a double click: true once, false while the button is held and for a first press.
  • craft_behavior::press::PressStep: pub struct PressStep<T> { pub target: Option<T>, pub phase: Option<PressPhase>, pub dragging: bool, pub activated: Option<T>, pub passes: Option<PressStart>, pub aside: Option<PressAside<T>> }. What one pass did to the press.
  • craft_behavior::press::count_clicks: pub fn count_clicks(previous: Option<(Pos2, f64, u32, Mods)>, pos: Pos2, time: f64, mods: Mods, slop: f32) -> u32. The click count of a press at pos and time with mods held, given the previous press (pos, time, clicks, mods): one more when it follows within [MULTI_CLICK_TIME] and slop of the previous one with the same modifiers, else 1.

craft_behavior::quantity

quantity::Reader: the one number and unit parser (18.3): locale digits, unit spellings, expressions and relative input.

  • craft_behavior::quantity::Reader: pub struct Reader. Reads numbers, expressions and unit quantities written in one locale.
    • pub fn new() -> Self. A reader for plain numbers written with . as the decimal separator.
    • pub fn bare(mut self, factor: f64) -> Self. A number with no unit counts as factor of the reader's base unit (a picas field reads bare numbers as points: 1.0 / 12.0).
    • pub fn decimal(mut self, decimal: char) -> Self. The decimal separator.
    • pub fn group(mut self, group: char) -> Self. The digit-group separator, which the reader skips between digits.
    • pub fn unit(mut self, spelling: &str, factor: f64) -> Self. A unit spelling (case-insensitive; letters or the symbols %, °) and its factor to the base unit.
    • pub fn unit_tagged(mut self, spelling: &str, factor: f64, tag: u32) -> Self. Like [Reader::unit], with a tag that [Reader::read_tagged] returns when the text names this spelling.
    • pub fn split_unit(mut self, spelling: &str, factor: f64, rest: f64, tag: u32) -> Self. Like [Reader::unit_tagged], where a number written right after the spelling adds that many of rest: picas and points read as 2p6, two picas and six points.
    • pub fn decimal_separator(&self) -> char. The decimal separator the reader reads and writes.
    • pub fn read(&self, text: &str, start: Option<f64>) -> Result<f64, NotAValue>. The value of text. start is the value relative input applies to.
    • pub fn read_tagged(&self, text: &str, start: Option<f64>) -> Result<(f64, Option<u32>), NotAValue>. The value of text and the tag of the unit its last quantity named (None for a bare number or an untagged unit).
    • pub fn share(&self, text: &str) -> Option<f64>. The fraction a lone percentage writes (50% is 0.5): a number and %, with no sign, unit or operator; None for any other text.
  • craft_behavior::quantity::is_unit_spelling: pub fn is_unit_spelling(spelling: &str) -> bool. Whether spelling can be registered with [Reader::unit]: letters and unit symbols only, so the reader can tell it from a number or an operator, or one / followed by them (/in, a count per inch).

craft_behavior::role_rule

RoleRule: the fields each AccessKit role requires (spec 12.3).

  • craft_behavior::role_rule::GridFacts: pub struct GridFacts { pub row_index: bool, pub row_count: bool, pub column_index: bool, pub column_count: bool }. Which of a grid node's indexes and counts it carries.
    • pub const fn new() -> Self. A node that carries none of them.
    • pub const fn row_index(mut self, known: bool) -> Self. The node knows its row index.
    • pub const fn row_count(mut self, known: bool) -> Self. The node knows the number of rows.
    • pub const fn column_index(mut self, known: bool) -> Self. The node knows its column index.
    • pub const fn column_count(mut self, known: bool) -> Self. The node knows the number of columns.
  • craft_behavior::role_rule::RoleRule: pub struct RoleRule<'a> { pub role: Role, pub named: bool, pub range: Option<&'a RangeInclusive<f64>>, pub positioned: bool, pub leveled: bool, pub expanded: Option<bool>, pub controls: bool, pub grid: GridFacts }. What a node carries, as far as the rules read it.
    • pub const fn new(role: Role) -> Self. A node of role that carries nothing yet.
    • pub const fn range(mut self, range: Option<&'a RangeInclusive<f64>>) -> Self. The node's numeric range.
    • pub const fn positioned(mut self, positioned: bool) -> Self. The node knows its place in a set.
    • pub const fn leveled(mut self, leveled: bool) -> Self. The node has a heading level or tree depth.
    • pub const fn expanded(mut self, expanded: Option<bool>) -> Self. The node's expanded state.
    • pub const fn controls(mut self, controls: bool) -> Self. The node controls another node.
    • pub const fn grid(mut self, grid: GridFacts) -> Self. The indexes and counts the node carries.
  • craft_behavior::role_rule::is_checkable: pub fn is_checkable(role: Role) -> bool. Roles that are checked or unchecked: a node of one always carries a toggled state.
  • craft_behavior::role_rule::is_selectable: pub fn is_selectable(role: Role) -> bool. Roles that are selected or not: a node of one always carries a selected state.
  • craft_behavior::role_rule::role_violations: pub fn role_violations(rule: &RoleRule<'_>) -> Vec<&'static str>. The rules rule breaks, each as a short phrase.

craft_behavior::scroll

Scroll positions and the range a scroll part shows.

  • craft_behavior::scroll::ScrollPos: pub struct ScrollPos { pub x: f64, pub y: f64 }. Offsets and extents in content units.
  • craft_behavior::scroll::ScrollSpan: pub struct ScrollSpan { pub content: Range<f64>, pub visible: Range<f64>, pub resize_ends: bool }. The range a scroll part shows. content is what the part's track stands for (it may start below zero for overscroll), visible is the thumb.
    • pub const fn new(content: Range<f64>, visible: Range<f64>) -> ScrollSpan. A span whose thumb ends do not resize.
    • pub const fn resize_ends(mut self, on: bool) -> ScrollSpan. Lets the thumb ends change the visible length.
  • craft_behavior::scroll::drag: pub fn drag(span: &ScrollSpan, track: f32, min_thumb: f32, delta: f32) -> Range<f64>. The visible range after the thumb moved delta points along the track, kept inside the content range.
  • craft_behavior::scroll::jump: pub fn jump(span: &ScrollSpan, mv: NavMove) -> Option<Range<f64>>. The visible range after a navigation move that scrolls: a page up or down, or to the start or the end of the content. None for any other move.
  • craft_behavior::scroll::page: pub fn page(span: &ScrollSpan, toward_end: bool) -> Range<f64>. The visible range one visible length further toward the end (or the start), kept inside the content range.
  • craft_behavior::scroll::shifted: pub fn shifted(span: &ScrollSpan, shift: f64) -> Range<f64>. Moves the visible range by shift content units, keeping it within the scrollable range.
  • craft_behavior::scroll::thumb: pub fn thumb(span: &ScrollSpan, track: f32, min_thumb: f32) -> (f32, f32). The thumb of span on a track track points long: its start along the track and its length, at least min_thumb.

craft_behavior::selection

Selection models: what a collection's selection holds and how a change applies to it.

  • craft_behavior::selection::CellAt: pub struct CellAt<K> { pub row: K, pub column: u32 }. A cell: its row key and its column position. CellAt<u32> is a cell by position.
    • pub fn new(row: K, column: u32) -> Self. The cell of row at column position column.
  • craft_behavior::selection::CellRange: pub struct CellRange<K> { pub first: K, pub last: K, pub columns: Range<u32>, pub lead_column: u32 }. A rectangle of cells: the rows from first to last in the display order (either may come first), the column positions columns and the column of the lead cell.
    • pub fn new(first: K, last: K, columns: Range<u32>, lead_column: u32) -> Self. The cells of the rows from first to last in columns, with the lead cell in lead_column.
    • pub fn cells(from: CellAt<K>, to: CellAt<K>) -> Self. The rectangle from the anchor cell from to the lead cell to, whichever way round they lie.
    • pub fn cell(c: CellAt<u32>) -> Self. One cell.
    • pub fn contains(&self, c: CellAt<u32>) -> bool. Whether c lies in the range.
    • pub fn rows(&self) -> RangeInclusive<u32>. The rows the range spans.
    • pub fn column_span(&self) -> RangeInclusive<u32>. The columns the range spans.
    • pub fn intersects(&self, other: &Self) -> bool. Whether the two ranges share a cell.
    • pub fn union(&self, other: &Self) -> Self. The smallest range holding both.
    • pub fn covering_merges(self, merges: &[CellRange<u32>]) -> Self. The range grown until no merged cell (merges: each merge's range) crosses its edge, as Excel, InDesign and Word grow a selection over a merged cell.
  • craft_behavior::selection::CellSelection: pub struct CellSelection<K>. The cell selection of a sheet or table: ranges of cells, the active cell, the anchor and the cells toggled against the ranges.
    • pub fn ranges(&self) -> &[CellRange<K>]. The selected ranges, in the order they were added.
    • pub fn current(&self) -> Option<&CellRange<K>>. The range Shift extends: the last one added, until Enter or Tab moves into another.
    • pub fn active(&self) -> Option<&CellAt<K>>. The active cell: the one an entry goes into.
    • pub fn anchor_cell(&self) -> Option<&CellAt<K>>. The cell of the current range that Shift extends from.
    • pub fn toggled(&self) -> &[CellAt<K>]. The cells taken out of the ranges.
    • pub fn cell(c: CellAt<K>) -> Self. One cell, active and the anchor.
    • pub fn range(r: CellRange<K>) -> Self. One range with its first row and first column active and the anchor.
    • pub fn from_ranges(ranges: Vec<CellRange<K>>, active: CellAt<K>) -> Option<Self>. Several ranges with active in the last one, which is the current range, and the anchor at active. None when ranges is empty or the last range's columns do not hold the column of active.
    • pub fn bounds(&self, space: &CellSpace<'_, K>) -> Option<CellRange<u32>>. The smallest range holding every selected range, by position; None for the empty selection.
    • pub fn head(&self, space: &CellSpace<'_, K>) -> Option<CellAt<u32>>. The corner of the current range opposite the anchor: the end Shift+arrows move; None for the empty selection.
    • pub fn select(&mut self, c: CellAt<K>, space: &CellSpace<'_, K>) -> bool. A click, or an arrow's landing cell: c alone (its merged cell whole, the active cell at the merge's top-left), active and the anchor.
    • pub fn select_range(&mut self, range: CellRange<K>, space: &CellSpace<'_, K>) -> bool. A header click, a header drag or Select All: range alone, covered over merges unless it is whole lines ([CellSpace::cover]); the active cell and the anchor at its top-left.
    • pub fn extend_to(&mut self, c: CellAt<K>, space: &CellSpace<'_, K>) -> bool. Shift+click and a drag: the current range runs from the anchor to c, covered over merges; the active cell stays (Excel keeps it at the anchor).
    • pub fn add(&mut self, c: CellAt<K>, space: &CellSpace<'_, K>) -> bool. Cmd+click (Ctrl+click) on a cell no range holds: a new range at c (its merged cell whole) after the others; c becomes active and the anchor.
    • pub fn add_range(&mut self, range: CellRange<K>, space: &CellSpace<'_, K>) -> bool. Cmd+click (Ctrl+click) on a row or column header: range joins as a new range after the others, covered over merges unless it is whole lines ([CellSpace::cover]); the active cell and the anchor at its top-left.
    • pub fn extend_current(&mut self, range: CellRange<K>, space: &CellSpace<'_, K>) -> bool. Shift+click on a header and a drag over the headers: the current range becomes range, covered as [select_range] covers it; the other ranges, the active cell and the anchor stay.
    • pub fn toggle(&mut self, c: CellAt<K>, space: &CellSpace<'_, K>) -> bool. Cmd+click (Ctrl+click) on any cell: a cell a range holds is taken out of the selection (and joins it again when it was taken out); any other cell joins as a new range ([add]).
    • pub fn step(&mut self, direction: CellDirection, space: &CellSpace<'_, K>) -> bool. An arrow: the selection collapses to the active cell's neighbour toward direction ([CellSpace::neighbour]), as [select] does.
    • pub fn change(&self) -> SelectionChange<K>. The change that reports this selection: [SelectionChange::Cells] when one range says it (the anchor cell and the active cell at its opposite corners), [SelectionChange::Clear] for the empty selection, else [SelectionChange::CellSet].
  • craft_behavior::selection::RowAt: pub struct RowAt<'a, K> { pub key: &'a K, pub at: usize, pub order: &'a dyn DisplayOrder<K> }. A row as the item step reads it: its key, its position and the order that places other keys.
    • pub fn new(key: &'a K, at: usize, order: &'a dyn DisplayOrder<K>) -> Self. The row key at position at of order.
  • craft_behavior::selection::Selection: pub struct Selection<K> { pub items: Vec<K>, pub lead: Option<K>, pub anchor: Option<K> }. A set of keys with a lead and an anchor.
    • pub fn new(items: Vec<K>, lead: Option<K>, anchor: Option<K>) -> Self. A selection of items with lead and anchor.
    • pub fn contains(&self, key: &K) -> bool. Whether key is selected.
    • pub fn single(key: K) -> Self. A selection of key alone, which is also its lead and its anchor.
  • craft_behavior::selection::SelectionChange: pub enum SelectionChange<K> { Set(Vec<K>), Toggle(K), Clear, Cells(CellRange<K>), CellSet(Box<CellSelection<K>>) }. A change to a selection, as a collection reports it.
  • craft_behavior::selection::SelectionModel: pub trait SelectionModel<K>: Value + Default. The selection a collection reads and the app owns.
    • fn contains(&self, row: RowAt<'_, K>) -> bool. Whether the row row is selected.
    • fn lead(&self) -> Option<&K>. The item keyboard navigation moves.
    • fn anchor(&self) -> Option<&K>. The fixed end of a range extended with Shift.
    • fn apply(&mut self, change: SelectionChange<K>). Applies a change.
    • fn lead_column(&self) -> Option<u32>. The column position of the lead cell; None for a model of rows.
    • fn contains_cell(&self, row: RowAt<'_, K>, _column: u32) -> bool. Whether the cell of row row in column position column is selected.
    • fn cells(&self) -> Option<&CellSelection<K>>. The cell rules of a model of cells, which the item step runs on a copy over the collection's CellSpace; the result goes back through [apply]. None for a model of rows.
    • fn placed(&self, order: &dyn DisplayOrder<K>) -> PlacedSelection. The selection by position in order, placed once so that the reads of a pass scan no keys.
  • craft_behavior::selection::CellAdvance: pub enum CellAdvance { Enter, Tab }. Which key moves the active cell after an entry: Enter goes down the rows, Tab along a row.
  • craft_behavior::selection::CellDirection: pub enum CellDirection { Up, Down, Left, Right }. A move of one cell.
  • craft_behavior::selection::PlacedSelection: pub struct PlacedSelection. The selected cells by position in one display order: the rows and columns of each range, and the cells taken out of them.
    • pub fn of_rows(spans: impl IntoIterator<Item = Range<usize>>) -> Self. The selected rows spans, every column of each.
    • pub fn of_cells(ranges: Vec<(Range<usize>, Range<u32>)>, mut removed: Vec<(usize, u32)>) -> Self. The ranges ranges (row positions, column positions) without the cells removed.
    • pub fn holds_row(&self, at: usize) -> bool. Whether the row at position at has a selected cell.
    • pub fn holds_cell(&self, at: usize, column: u32) -> bool. Whether the cell at row position at and column position column is selected.
    • pub fn rows(&self) -> Vec<usize>. The positions of the rows that have a selected cell, ascending.
  • craft_behavior::selection::Positions: pub struct Positions. The display order of a grid whose row keys are their positions (a sheet, a document table): key(at) == at, and index_of answers without a scan.
    • pub const fn new(rows: u32) -> Self. The order of rows rows.

craft_behavior::sense

The library's sense set, for a root or a part.

  • craft_behavior::sense::Sense: pub struct Sense: u32 (flag set). What a root or a part senses. The egui adapter maps the root's sense to egui's.
    • pub const PRESS: Sense. The bits that make a shape a press candidate.
    • pub const WHEELS: Sense. The bits that make a shape register a wheel taker.
    • pub const fn takes_press(self) -> bool. Whether a press can start on a shape with this sense.

craft_behavior::sizing

Proposal, Metrics and ControlMetrics: what a measure call is asked and what a style gives it to add.

  • craft_behavior::sizing::ControlMetrics: pub struct ControlMetrics { pub height: f32, pub icon: f32, pub pad_x: f32, pub gap: f32, pub field: f32, pub number: f32 }. The sizes a control takes from its ControlSize: height, icon side, horizontal padding, gap and the widths of a field and a number field.
    • pub fn at(size: ControlSize, height: &BySize<f32>, icon: &BySize<f32>, pad_x: &BySize<f32>, gap: &BySize<f32>, field: &BySize<f32>, number: &BySize<f32>,) -> Self. The entries of the six tables at size.
    • pub const fn metrics(&self) -> Metrics. The Metrics of a control of this height: horizontal padding, the height as the least height, the gap.
  • craft_behavior::sizing::Metrics: pub struct Metrics { pub padding: Insets, pub min_size: Vec2, pub max_width: Option<f32>, pub gap: f32, pub min_text: f32, pub ideal_width: f32, pub least_width: Option<f32> }. What the pipeline adds around a component's measured content.
    • pub const fn new() -> Self. No padding, no minimum, no wrap width.
    • pub const fn padding(mut self, padding: Insets) -> Self. Sets the padding.
    • pub const fn min_size(mut self, min_size: Vec2) -> Self. Sets the least size.
    • pub const fn max_width(mut self, width: f32) -> Self. Sets the wrap width.
    • pub const fn gap(mut self, gap: f32) -> Self. Sets the gap between content parts.
    • pub const fn min_text(mut self, width: f32) -> Self. Sets the least text width.
    • pub const fn ideal_width(mut self, width: f32) -> Self. Sets the width the component takes where its room allows.
    • pub const fn least_width(mut self, width: f32) -> Self. Sets the least width, padding included, that the least measure floors at in place of min_size's width.
  • craft_behavior::sizing::Proposal: pub enum Proposal { Ideal, Min, Width(f32), Size(Vec2) }. The question one measure call answers.

craft_behavior::typing

TypingRun<C>: the draft, rejected text, commit, cancel, escape rule and limits of a text part (18.2).

  • craft_behavior::typing::EditRun: pub struct EditRun<V> { pub start: V, pub draft: Option<String>, pub error: Option<NotAValue>, pub rejected: Option<(String, V)>, pub composing: bool, pub gesture: GestureId }. The state a [TypingRun] keeps per text part.
    • pub fn new(start: V) -> Self. No run is open; start is the value shown.
    • pub fn is_open(&self) -> bool. A run is open.
  • craft_behavior::typing::Ended: pub enum Ended<V> { Commit(V), Rejected, Idle }. How a commit ended.
  • craft_behavior::typing::EscapeRule: pub enum EscapeRule { Restore, Clear }. What Escape does to a draft.
  • craft_behavior::typing::Escaped: pub enum Escaped<V> { Cleared(V), Restore(V), Idle }. What Escape did.
  • craft_behavior::typing::Typed: pub enum Typed<V> { Draft, Apply(V) }. What typing did to the run.
  • craft_behavior::typing::TypingRun: pub struct TypingRun<C: Codec>. The behaviour of a text part over a codec.
    • pub fn new(codec: C) -> Self. A run that applies a draft as typed when the codec says so, with no length limit.
    • pub fn live(mut self, live: bool) -> Self. Whether every parsable draft applies as typed, whatever the codec says.
    • pub fn limit(mut self, limit: usize) -> Self. The most characters a draft holds.
    • pub fn escape_rule(mut self, rule: EscapeRule) -> Self. What Escape does.
    • pub fn codec(&self) -> &C. The codec.
    • pub fn shown(&self, run: &EditRun<C::Value>, value: &C::Value) -> String. The text to show: the draft, else the value's text.
    • pub fn open(&self, run: &mut EditRun<C::Value>, start: &C::Value). Opens the run on start when none is open.
    • pub fn edit(&self, run: &mut EditRun<C::Value>, start: &C::Value, text: &str) -> (Typed<C::Value>, bool). The draft is now text: characters the codec refuses and characters past the limit drop out.
    • pub fn rewrite(&self, run: &mut EditRun<C::Value>) -> bool. Replaces the draft with the codec's normal form of the value it reads (Codec::normalise, as a commit shows it); whether it read one.
    • pub fn commit(&self, run: &mut EditRun<C::Value>) -> Ended<C::Value>. Commits the draft: a value closes the run, a draft that is no value keeps it open.
    • pub fn commit_tagged(&self, run: &mut EditRun<C::Value>) -> (Ended<C::Value>, ParseNote). [commit], with the note of the committed text (Codec::parse_tagged); the default note for a rejected or idle run.
    • pub fn cancel(&self, run: &mut EditRun<C::Value>) -> Option<C::Value>. Closes the run without a commit and returns the value from before it; None when no run was open.
    • pub fn escape(&self, run: &mut EditRun<C::Value>) -> Escaped<C::Value>. Applies the escape rule.

craft_behavior::value

The value core of chapter 10: the bound every value type meets, Mixed, edit events and the list a pass's events fold into.

  • craft_behavior::value::Applied: pub enum Applied { Changed, Unchanged, Restored }. What applying an event did to a value.
  • craft_behavior::value::CancelReason: pub enum CancelReason { Refused, Dismissed, Escape, Blur, Removed, HostChanged, UndoDuringGesture, Unchanged }. Why a gesture ended without a commit.
    • pub const fn document_moved(self) -> bool. The document changed under the gesture, so the gesture's own edits stay and a revert would also take back the change.
  • craft_behavior::value::EditEvent: pub enum EditEvent<T> { Begin { id: GestureId, before: Mixed<T>, label: Arc<str>, doc_key: Option<DocKey> }, Update { id: GestureId, value: T }, Commit { id: GestureId, before: Mixed<T>, after: T }, Cancel { id: GestureId, reason: CancelReason, before: Option<Mixed<T>> }, Set { before: Mixed<T>, after: T, label: Arc<str>, doc_key: Option<DocKey> } }. One step of an edit.
    • pub fn begin(id: GestureId, before: Mixed<T>, label: Arc<str>, doc_key: Option<DocKey>) -> Self. A gesture began.
    • pub fn update(id: GestureId, value: T) -> Self. A proposed value of the running gesture.
    • pub fn commit(id: GestureId, before: Mixed<T>, after: T) -> Self. The gesture committed after.
    • pub fn cancel(id: GestureId, reason: CancelReason, before: Option<Mixed<T>>) -> Self. The gesture ended without a commit.
    • pub fn set(before: Mixed<T>, after: T, label: Arc<str>, doc_key: Option<DocKey>) -> Self. A one-step change, named the way a Begin names its gesture.
    • pub fn id(&self) -> Option<GestureId>. The gesture the event belongs to; a Set belongs to none.
    • pub fn map<U>(self, f: impl Fn(T) -> U) -> EditEvent<U>. Maps the carried values and keeps the gesture.
    • pub fn filter_map<U>(self, f: impl Fn(T) -> Option<U>) -> Option<EditEvent<U>>. Maps the carried values and keeps the gesture; None when f has no value for one of them.
    • pub fn value(&self) -> Option<&T>. The value the event carries: a proposal, a commit or a set.
    • pub fn landed(&self) -> Option<&T>. The value the binding holds after the event: the carried value, or the value a cancel restores.
    • pub fn phase(&self) -> Option<GesturePhase>. Where the gesture stands after this event; a Set is not a gesture.
    • pub fn apply(&self, v: &mut T) -> Applied. Applies the event to v: a proposal, commit or set writes its value, a cancel restores the value from before the gesture.
    • pub fn apply_mixed(&self, v: &mut Mixed<T>) -> Applied. Applies the event to a value that may be mixed: the written value is a concrete one.
  • craft_behavior::value::EditEvents: pub struct EditEvents<T>. The edit events of one pass, in order. push folds what loses nothing, within one gesture: a later Update, Commit or Cancel replaces the Update before it (it carries the value on), Begin then Commit is one Set, and Begin then Cancel is nothing.
    • pub fn committed(&self) -> Option<&T>. The value of the last Commit or Set in the events; None if there is none.
    • pub fn new() -> Self. No events.
    • pub fn push(&mut self, event: EditEvent<T>). Adds the next event of the pass, folding it with the one before when that loses nothing.
    • pub fn is_empty(&self) -> bool. No event happened.
    • pub fn len(&self) -> usize. The number of events.
    • pub fn iter(&self) -> std::slice::Iter<'_, EditEvent<T>>. The events in order.
    • pub fn last(&self) -> Option<&EditEvent<T>>. The latest event.
    • pub fn value(&self) -> Option<&T>. The latest value the events carry: a proposal, a commit or a set.
    • pub fn landed(&self) -> Option<&T>. The value the binding holds after the events: the latest carried value, or the value a cancel restores.
    • pub fn began(&self) -> bool. A gesture began.
    • pub fn ended(&self) -> Option<&EditEvent<T>>. The Commit, Cancel or Set that ended an edit in this pass; the latest one.
    • pub fn cancel_reason(&self) -> Option<CancelReason>. Why a gesture was cancelled in this pass; the latest cancel.
    • pub fn map<U>(self, f: impl Fn(T) -> U) -> EditEvents<U>. Maps the carried values of every event.
    • pub fn filter_map<U>(self, f: impl Fn(T) -> Option<U>) -> EditEvents<U>. Maps the carried values of every event, dropping the events f has no value for.
  • craft_behavior::value::EditPolicy: pub enum EditPolicy { WriteThrough, OnCommit }. When a write-through source is written: on every proposal of a gesture or only on its commit.
  • craft_behavior::value::Gesture: pub struct Gesture<V> { pub id: GestureId, pub before: Option<Mixed<V>>, pub proposal: Option<V>, pub last_given: Option<V>, pub emitted: Option<V>, pub reported: Option<V>, pub dead: bool, pub cancel_seen: u64, pub watched: bool, pub wheel: bool, pub note: Option<GestureNote> }. The running gesture of a value component, kept in shown memory under the component.
    • pub fn ended(&self, dead: bool) -> Gesture<V>. The gesture after it ended: no value, the id kept, and dead while the press that carried it is held.
    • pub fn is_running(&self) -> bool. A gesture is running.
  • craft_behavior::value::GestureId: pub struct GestureId(pub u64). Names a gesture; ids grow in the order the gestures begin.
    • pub const fn new(n: u64) -> GestureId. The id numbered n.
    • pub const fn next(self) -> GestureId. The id of the gesture after this one.
  • craft_behavior::value::GestureNote: pub struct GestureNote. A typed note a component sets on its running gesture for readers outside its pass, such as the guide a guides drag moves.
    • pub fn new<N: Send + Sync + 'static>(note: N) -> Self. A note holding note.
    • pub fn get<N: 'static>(&self) -> Option<&N>. The note, when it is an N.
  • craft_behavior::value::GesturePhase: pub enum GesturePhase { Begin, Update, Commit, Cancel }. Where a gesture stands in one pass.
  • craft_behavior::value::Mixed: pub enum Mixed<T> { Same(T), Mixed }. A value that may differ across a multi-selection.
    • pub const fn same(&self) -> Option<&T>. The shared value, None while the items differ.
    • pub const fn or<'a>(&'a self, start: &'a T) -> &'a T. The shared value, or start while the items differ.
    • pub fn each<const N: usize>(values: [T; N]) -> [Mixed<T>; N]. Every part of values as a shared value: the per-part form of a composite value no part of which differs.
    • pub fn parts(self) -> [Mixed<T>; N]. The per-part form of a composite value: a whole Mixed binding means every part differs.
  • craft_behavior::value::Preview: pub enum Preview<V> { Unchanged, Shows(V), Ended }. What one pass did to a live preview a component shows beside its value (the family under the pointer in a font list): only the pass that starts, moves or ends the preview reports it, so a second control that previews nothing never ends the preview of another.
    • pub fn map<W>(self, f: impl FnOnce(V) -> W) -> Preview<W>. The same change over the value f makes of the shown one.
  • craft_behavior::value::Validity: pub enum Validity<T, M> { Ok, Fix(T), Warn(M), Refuse(M), Error(M) }. What a check says about a value. M is the message type: craft-ui exports the alias with its own Message.
  • craft_behavior::value::Value: pub trait Value: Clone + PartialEq + Send + Sync + 'static. What a bound value must be: cloneable, comparable and shareable across threads.
  • craft_behavior::value::same_in_f32: pub fn same_in_f32(proposed: f64, host: f64) -> bool. Whether host, a number an app wrote back, is the proposal proposed as a host that keeps it in f32 stores it:
  • craft_behavior::value::same_in_f32_at: pub fn same_in_f32_at(proposed: f64, host: f64, magnitude: f64) -> bool. [same_in_f32] for a number the host computes in f32 from terms as large as magnitude: a corner of a box it transforms lies near zero while the terms it sums do not, and holds their precision, not its own.

craft_behavior::value_drag

ValueDrag: the drag maths of sliders, dials, scrubbing number fields and rulers, written once (8.7).

  • craft_behavior::value_drag::DragModifier: pub enum DragModifier { Alt, Shift, Control, Command }. A modifier that changes continuous pointer-drag sensitivity.
  • craft_behavior::value_drag::DragModifiers: pub struct DragModifiers. The pointer-only fine/coarse bindings of a continuous drag.
    • pub const fn new(fine: Option<DragModifier>, coarse: Option<DragModifier>) -> Self. Selects the fine and coarse bindings; None disables that binding.
  • craft_behavior::value_drag::DragWarp: pub struct DragWarp. The pointer warps of one drag.
    • pub fn shift(&mut self, pos: Pos2) -> Vec2. The total warp so far, given the pointer pos of this pass.
    • pub const fn pending(&self) -> bool. Whether a warp waits for the pointer to show up at its new place: no second warp starts before it does.
    • pub fn sent(&mut self, from: Pos2, by: Vec2). Records that the pointer at from was warped by by.
  • craft_behavior::value_drag::ValueDrag: pub struct ValueDrag. Turns a press into a value.
    • pub fn absolute(track: Range<f32>, range: RangeInclusive<f64>) -> Self. The value follows the pointer on track: range.start() at track.start, range.end() at track.end.
    • pub fn relative(rate: f64, range: RangeInclusive<f64>) -> Self. The value changes by rate units per point of travel from the press.
    • pub const fn axis(mut self, axis: Axis) -> Self. The axis the pointer travels on; the default is horizontal.
    • pub const fn fine(mut self, factor: f64) -> Self. The factor Alt (Option) applies to travel.
    • pub const fn coarse(mut self, factor: f64) -> Self. The factor Shift applies to travel.
    • pub const fn modifiers(mut self, modifiers: DragModifiers) -> Self. Selects pointer fine/coarse bindings without changing keyboard or wheel behavior.
    • pub const fn warp(mut self, on: bool) -> Self. Warps the pointer to the other side of the window when the drag reaches an edge, so the drag has no end ([ValueDrag::warp_by], [DragWarp]).
    • pub const fn hide_cursor(mut self, on: bool) -> Self. Hides the pointer while the drag runs, as a scrub does that warps the pointer.
    • pub const fn warps(&self) -> bool. Whether the pointer warps at a window edge.
    • pub fn warp_by(&self, pos: Pos2, bounds: Rect) -> Option<Vec2>. How far to move the pointer when the drag at pos has reached an edge of bounds on the drag's axis: to the far side, inside the zone that warps. None away from the edges and for a drag that does not warp.
    • pub fn value(&self, start: f64, press: &PressState, rtl: bool) -> Option<f64>. The value the press gives, None while it gives none: before a drag starts, and after a cancel. start is the value when the drag began.
    • pub fn value_shifted(&self, start: f64, press: &PressState, rtl: bool, shift: Vec2) -> Option<f64>. [ValueDrag::value] for a pointer that warped by shift in total ([DragWarp::shift]): the pointer counts as where it would be without the warps, so the value stays continuous across them.
    • pub fn at(&self, pos: Pos2, rtl: bool) -> Option<f64>. The value at pos on an absolute drag's track, in the range: what a press there sets. None for a relative drag, whose value comes from travel, not from a place.
  • craft_behavior::value_drag::wrap_value: pub fn wrap_value(value: f64, low: f64, period: f64) -> f64. value moved by whole periods into low..low + period, as a wrapping slider or dial holds it.

craft_behavior::wheel

Wheel gesture values, as craft-behavior's copy of egui's types so the wheel split is egui-free.

  • craft_behavior::wheel::GESTURE_GAP: pub const GESTURE_GAP: f64. The seconds between wheel events that still belong to one gesture.
  • craft_behavior::wheel::Wheel: pub struct Wheel { pub scroll: Vec2, pub lines: Vec2, pub zoom: f32, pub zoom_lines: Vec2, pub zoom_gathered: Vec2, pub mods: Mods, pub unit: WheelUnit, pub phase: WheelPhase, pub source: WheelSource, pub at: Option<Pos2>, pub zooms: bool, pub touch_zoom: f32, pub rotation: f32, pub touch_rotation: f32, pub touch_pan: Vec2, pub gathered: Vec2, pub moved: bool, pub held: Mods, pub modal: bool, pub claimed: bool, pub claimed_gathered: Vec2, pub claimed_zoom_gathered: Vec2, pub claimed_spent: Vec2 }. One wheel event, or the sum of one pass's, as a taker reads it with take_wheel.
    • pub const fn new(scroll: Vec2, mods: Mods, unit: WheelUnit, phase: WheelPhase) -> Self. A scroll of scroll points with no zoom.
    • pub const fn zoom(mut self, zoom: f32) -> Self. The same gesture with zoom factor zoom.
    • pub const fn zoom_lines(mut self, lines: Vec2) -> Self. The same gesture with lines wheel lines of motion that zoom (Wheel::zoom_lines).
    • pub const fn touch_zoom(mut self, zoom: f32) -> Self. The same gesture with the two-finger touch zoom factor zoom.
    • pub const fn rotation(mut self, radians: f32) -> Self. The same gesture with rotation radians, clockwise on screen.
    • pub const fn touch_rotation(mut self, radians: f32) -> Self. The same gesture with the two-finger touch rotation radians.
    • pub const fn touch_pan(mut self, pan: Vec2) -> Self. The same gesture with the two-finger touch movement pan, in points.
    • pub const fn source(mut self, source: WheelSource) -> Self. The same gesture from source.
    • pub const fn at(mut self, at: Pos2) -> Self. The same gesture with the pointer at at.
  • craft_behavior::wheel::WheelEase: pub struct WheelEase. The eased motion of a canvas's line wheel: notches gather into owed motion that later passes pay out.
    • pub fn feed(&mut self, pan: Vec2, now: f64). Adds the line pan pan of this pass, at time now, to the owed motion; a burst of notches under 0.08 s apart accelerates it, a reversal or 0.3 s idle resets the burst.
    • pub fn cancel_axis(&mut self, x: bool, y: bool). Drops the owed motion on the axes marked.
    • pub fn step(&mut self, now: f64) -> Vec2. The step this pass pays at time now: 1 − 0.1^(dt/0.1) of the owed motion, with dt since the last paid pass.
    • pub fn owes(&self) -> bool. Whether motion is still owed.
  • craft_behavior::wheel::WheelFocus: pub struct WheelFocus<O> { pub taker: Option<O>, pub app_field: bool, pub by_position: bool }. Who holds key focus, as the split reads it.
    • pub const fn new(taker: Option<O>) -> Self. Focus on taker, or on nothing that takes the wheel.
    • pub const fn app_field(mut self, on: bool) -> Self. The same focus, in a text field the app drew itself when on.
    • pub const fn by_position(mut self, on: bool) -> Self. The same focus, with the pointer over a layer that takes the wheel by position when on ([by_position]).
  • craft_behavior::wheel::WheelGesture: pub struct WheelGesture<O> { pub owner: Option<O>, pub last: f64 }. A wheel gesture: events closer than [GESTURE_GAP] seconds, or inside one device phase. owner is None while no taker took it. [split] keeps it across events; its caller calls [WheelGesture::end] before each split.
    • pub fn runs(&self, now: f64) -> bool. Whether an event at now continues the gesture: one is open, the device has not ended it and the gap since its last event is shorter than [GESTURE_GAP].
    • pub fn end(&mut self, now: f64) -> Option<O>. Closes the gesture once now - last reaches [GESTURE_GAP], or at once after a device end, and returns the owner it had.
  • craft_behavior::wheel::WheelNotch: pub enum WheelNotch { Points(f32), ViewShare(f32) }. The distance one wheel line scrolls a taker.
    • pub const DEFAULT: WheelNotch. The distance of a taker that states none.
    • pub fn points(self, extent: f32) -> f32. The notch in points, for a taker whose view is extent points along the axis.
  • craft_behavior::wheel::WheelPhase: pub enum WheelPhase { Start, Move, End, Cancel }. A wheel gesture's phase.
  • craft_behavior::wheel::WheelRoom: pub struct WheelRoom { pub positive: Vec2, pub negative: Vec2 }. The scroll left in a region, in points of wheel scroll: positive is what a wheel with positive scroll can still move, negative the same for negative scroll.
    • pub const fn new(positive: Vec2, negative: Vec2) -> Self. A room of positive and negative points.
  • craft_behavior::wheel::WheelSource: pub enum WheelSource { Unknown, Wheel, Trackpad, Momentum }. The device a wheel event came from, where the system says (egui reports it on macOS only).
    • pub const fn fingers(self) -> bool. Whether fingers drive the scroll: a trackpad or its momentum.
  • craft_behavior::wheel::WheelTaker: pub struct WheelTaker<O> { pub owner: O, pub rect: Rect, pub horizontal: bool, pub vertical: bool, pub zoom: bool, pub gated: bool, pub directional: bool, pub scrolls: bool, pub notch: WheelNotch, pub room: Option<WheelRoom>, pub zooms_view: bool, pub field: bool, pub value: bool }. A component that takes wheel input, as registered last pass.
    • pub const fn new(owner: O, rect: Rect) -> Self. A taker over rect that takes no axis yet.
    • pub fn for_sense(owner: O, rect: Rect, sense: Sense) -> Option<Self>. The taker a shape with sense registers, None when sense has no wheel bit: WHEEL takes both scroll axes and zoom; WHEEL_X, WHEEL_Y and WHEEL_ZOOM take one share each and combine; WHEEL_ZOOMS_VIEW makes a zoom zone; WHEEL_Y_FOCUSED takes the vertical share and makes the taker gated, so every axis it takes waits for focus or arming.
    • pub const fn zooms_view(mut self, on: bool) -> Self. Whether it is a zoom zone (WheelTaker::zooms_view).
    • pub const fn field(mut self, on: bool) -> Self. Whether it is a value field (WheelTaker::field).
    • pub const fn value(mut self, on: bool) -> Self. Whether it is a value control (WheelTaker::value).
    • pub const fn horizontal(mut self, on: bool) -> Self. Whether it takes horizontal scroll.
    • pub const fn vertical(mut self, on: bool) -> Self. Whether it takes vertical scroll.
    • pub const fn zoom(mut self, on: bool) -> Self. Whether it takes zoom.
    • pub const fn gated(mut self, on: bool) -> Self. Whether every axis needs focus or arming.
    • pub const fn directional(mut self, on: bool) -> Self. Opts a value control into directional editing, without changing the default focus gate.
    • pub const fn notch(mut self, notch: WheelNotch) -> Self. The distance of one wheel line.
    • pub const fn scrolls(mut self, on: bool) -> Self. The taker is a scroll region (WheelTaker::scrolls).
    • pub const fn room(mut self, room: WheelRoom) -> Self. The taker's scroll room: it passes a wheel on an axis it has no room left for to the next enclosing taker.
    • pub fn points(&self, scroll: Vec2, unit: WheelUnit) -> Vec2. scroll, given in units of the device, as points of this taker's view: a line is one notch, a page is the view.
  • craft_behavior::wheel::WheelUnit: pub enum WheelUnit { Point, Line, Page }. How far one wheel event reaches.
  • craft_behavior::wheel::split: pub fn split<O: Copy + PartialEq>(takers: &[WheelTaker<O>], at: Pos2, wheel: Wheel, focus: WheelFocus<O>, armed: Option<O>, gesture: &mut WheelGesture<O>, now: f64,) -> Vec<(O, Wheel)>. The split rule.

craft_ui

The base of the craft UI library: runtime, style, fonts, primitives, the component contract, layout and the test kit (layers 2 to 4).

  • craft_ui::bind_tracked!: macro_rules! bind_tracked. Write-through bindings to fields of a Tracked value: bind_tracked!(doc => size) gives one [Bind], bind_tracked!(doc => title, style.size) a tuple with one per field path (field names and tuple indices only), and bind_tracked!(name) one binding to the whole value.
  • craft_ui::stays!: macro_rules! stays. Types with no place: they stay as they are at any place.
  • craft_ui::InstallError: re-export of craft_ui::runtime::install::InstallError.
  • craft_ui::InstallSpec: re-export of craft_ui::runtime::install::InstallSpec.
  • craft_ui::install: re-export of craft_ui::contract::install.
  • craft_ui::registry: re-export of craft_ui_macros::registry (outside these crates).
  • craft_ui::words: re-export of craft_ui_macros::words (outside these crates).

craft_ui::contract

The component traits, context types, PaintUi, Looks, the pipeline and its step functions, the label, body and item steps, the mount and overlay hosts and contract::tooltip.

  • craft_ui::contract::Collection: pub trait Collection: Component + HasProps + Meta<Shape = shape::Items>. A component that shows an item per visible entry of a source.
    • type Key. The item key.
    • type ItemLayout. Kept in session memory so step 8 can hit-test against last frame's layout.
    • type Selection. The selection model.
    • type Item. The item component.
    • type ItemEvent. Events an item reports.
    • const MEMBERS: bool. Whether the items are members of the collection's run instead of runs of their own.
    • fn items(&self) -> &CollectionProps. Plain data: selection mode, reorder, rename, columns.
    • fn shows_row_focus(&self) -> bool. Whether keyboard focus shows a ring on the lead row, or on a populated rows viewport with no visible lead.
    • fn selection(&mut self) -> Option<BindMut<'_, Self::Selection>>. The selection binding; None keeps it in session memory.
    • fn column_layout(&mut self) -> Option<BindMut<'_, ColumnLayout>>. The column arrangement binding; None keeps it in the header's own memory.
    • fn cell_space<'s>(&'s self, space: CellSpace<'s, Self::Key>) -> CellSpace<'s, Self::Key>. The grid a model of cells selects in (17.7).
    • fn reveal(&self) -> Option<&Self::Key>. A one-shot request to scroll an item into view.
    • fn item_layout(&self, source: &dyn ItemSource<Self::Key>, width: f32, cx: &StyleCx<'_>) -> Self::ItemLayout. The layout of source at width.
    • fn item_layout_from(&self, _previous: Option<Self::ItemLayout>, source: &dyn ItemSource<Self::Key>, width: f32, _item: Option<Vec2>, cx: &StyleCx<'_>,) -> Self::ItemLayout. The layout of source at width, given the layout of the last pass.
    • fn measures_items(&self) -> bool. Whether the layout sizes its items from their own measure: the items step measures every item at its ideal size and hands the largest to item_layout_from and ideal_width.
    • fn dress_inputs(&self) -> u64. What dress reads of the collection, hashed: a kept measure of the items serves only while it is the same.
    • fn ideal_width(&self, _item: Option<Vec2>, _rows: usize, _cx: &StyleCx<'_>) -> f32. The width the collection asks for when it takes its width from its content, over its widest row: a grid of cards asks for its declared number of columns. 0 asks for nothing. item is as item_layout_from gets it; rows is the number of rows the source holds, for a collection whose rows stand side by side.
    • fn filtered<'s>(&self, _source: &'s dyn ItemSource<Self::Key>, _env: &crate::runtime::env::Env, _kept: Option<&Self::Key>,) -> Option<Box<dyn ItemSource<Self::Key> + 's>>. A view of source for this pass, such as the rows a filter keeps; None shows source as it is. kept is the item whose rename runs: the view keeps it whether or not it matches, so it is named in place.
    • fn rings_lead(&self) -> bool. Whether the focus ring goes around the lead item while the collection has keyboard-visible focus: the item step gives the ring the lead's rect (Cx::focus_shape), or the collection's own rect while it has no lead or its lead is not shown.
    • fn dress<'r>(&self, item: Self::Item<'r>, _row: &RowState) -> Self::Item<'r>. Adjusts the item the closure built for a row, from the row's state.
    • fn rename_editor(&mut self, _ui: &mut Ui, _draft: Bind<'_, String>, _label: Rect, _name: &str) -> Option<EditResponse<String>>. The rename editor at label: the label rect the renaming item reports (ItemOutput::label_rect), else its row.
    • fn hosts_header(&self, _column: &ColumnKey) -> bool. Whether the collection hosts a component in the header cell of column: the header then calls header_cell for it and paints no label.
    • fn header_cell(&mut self, _ui: &mut PaintUi<'_>, _column: &ColumnKey, _key: HostedKey, _rect: Rect). Hosts a component in the header cell of column, in rect, measured and shown under key (the column's index among the declared columns, so a move or a hide keeps it).
    • fn rename_draft(&self, _key: &Self::Key) -> Option<String>. The text the rename field of the item key opens with; None for the item's own text.
    • fn can_rename(&self, _key: &Self::Key) -> bool. Whether the item key may be renamed; a rename request on another item does nothing.
    • fn can_drag(&self, _key: &Self::Key) -> bool. Whether the item key may be dragged (reordered, moved in a free layout, or dragged to another collection).
    • fn accepts(&self, _drag: &ListDrag<Self::Key>, _over: Option<&Self::Key>, _insert: usize) -> bool. Whether the collection's own dragged items may land before insert (a position of the display order, over is the item the pointer is on, none over an empty collection).
    • fn drops(&self) -> &[DropKind<'_, Self::Key>]. What the collection takes from drags that did not start in it, in order: the first kind that takes the drag's payload at the place under the pointer gets the drop, reported as CollectionEvent::Dropped.
    • fn edge_press(&self) -> Option<&EdgePress<'_, Self::Key>>. The press on the line between two adjacent rows the collection takes, reported as CollectionEvent::EdgePressed; none by default, and without one the rows take every press as they do.
    • fn zooms(&self) -> bool. Whether the collection takes the zoom share of the wheel (Ctrl or Cmd with the wheel): the items step reports it as CollectionEvent::Zoom.
    • fn zoom_anchor(&self, _wheel: Option<Pos2>) -> Option<Pos2>. The point whose row stays in place across a zoom step this collection takes in the current pass, in screen points. wheel is the point of the CollectionEvent::Zoom the items step reported in this pass, None when it reported none; a collection that also takes zoom keys answers the pointer it read with them.
    • fn empty_height(&self, width: f32, ui: &Ui, cx: &StyleCx<'_>) -> f32. The height of the empty state at width: a Sizing::Content collection with no rows is this tall.
    • fn empty(&mut self, ui: &mut Ui, cx: &mut BodyCx<'_>). The empty state at the rect the item step placed.
  • craft_ui::contract::Component: pub trait Component: Meta + Sized. The core trait: every UI type is a Component.
    • const ROLE: Role. The AccessKit role.
    • const ALT_ROLES: &'static [Role]. Roles access may pick per instance.
    • const INPUT: Input. How input reaches the component.
    • const ESCAPE: EscapeEdit. What Escape does to the running gesture.
    • const OVERLAYS: bool. Whether the component hosts popups: false skips the overlay bookkeeping of steps 9, 10, 12, 15 and 16.
    • const PARTS: bool. Whether the component declares parts, a text part or an editor part: false skips the parts step (the parts hook, the measure view it reads and the memory of the last state) and leaves the sense step with no part regions.
    • const STOPS: bool. Whether the component or its parts can take key focus: false skips the stop registration of step 7, except for the roving group of a body the shape declares.
    • const FOCUS_SCOPE: crate::runtime::focus::FocusPolicy. The focus scope a leaf runs in, as ContainerProps::focus gives a container's: the leaf's own stop and its parts lie inside it, and FocusPolicy::NONE (the default) opens none.
    • fn focus_scope(&self) -> crate::runtime::focus::FocusPolicy. The focus scope this instance runs in.
    • const KEYS: crate::runtime::focus::KeyUse. Keys the focused component keeps from egui and the shortcut dispatcher.
    • fn keys(&self) -> crate::runtime::focus::KeyUse. The keys this instance keeps in its current state.
    • const SHOWS_LABEL: bool. Whether the component paints its label as visible text. false for a face that shows only an icon or a glyph: with no tooltip set, its label is then its tooltip, since the label is the only visible name the pointer can reach.
    • const LABELLED_AFTER: bool. Whether the control draws only its mark and its text is the label step's, placed after it: a check box, a radio button or a switch. Show::show then runs the label step for an instance that carries a label and sits in no label scope.
    • const SINGLE_VALUE: bool. Whether the component edits one value that several selected things cannot disagree on (a colour picker's area, strip or ramp: it edits the colour it is given).
    • const BINDS_VIEW: bool. Whether the binding is the component's view of what it shows (a time area's scroll and zoom, a navigator's canvas view), not a value the user edits.
    • const DISABLED: DisabledLook. How a disabled instance looks: token states (the default), or its enabled look faded.
    • const RULE: bool. Whether the component is a rule between groups of members (a divider).
    • type Style. The style type.
    • type Output. Response, EditResponse<T> or a richer type.
    • fn shows_label(&self) -> bool. Whether this instance paints its label as visible text; SHOWS_LABEL unless an instance prop decides, as icon_only does.
    • fn label_detail(&self) -> Option<crate::runtime::env::Label>. The muted line a LABELLED_AFTER control's label shows after its text (SideLabel::detail), as a radio's detail; none by default.
    • fn paint_outset(_tokens: &crate::style::UiTokens) -> f32. How far the component paints outside its rect by design, in points (a graph node's ports sit on its edge).
    • fn default_variant(_env: &crate::runtime::env::Env) -> Option<craft_theme::Variant>. The variant an instance that asks for none takes in env; None takes the style's first.
    • fn style(cx: &StyleCx<'_>, key: Self::StyleKey) -> Self::Style. Pure function of the resolved context and the key.
    • fn padding(&self, _rect: Rect, style: &Self::Style) -> craft_behavior::Insets. The insets from rect to the content rect where the component is shown: the style's padding.
    • fn measure(&mut self, _cx: &MeasureCx<'_, Self>) -> Vec2. Content size only; the pipeline adds padding and minimum size.
    • fn fills(&self) -> Option<craft_behavior::Axis>. The axis along which the component takes all the room the flow offers when that is more than it measured, as a container with Sizing::Fill does: the width when its caller set Sizing::FillWidth (a search field before a count) or Sizing::Fill (which takes the height as well).
    • fn cut_first(&self) -> bool. Whether the content is made to be cut where it does not fit: an elided line or a path.
    • fn sense(&self) -> Sense. The root's sense; the shape's default unless a canvas control.
    • fn wheel_notch(&self) -> craft_behavior::WheelNotch. The distance one wheel line scrolls the component when it senses the wheel itself: the service converts the device's lines to points with it.
    • fn parts(&mut self, _rect: Rect, _cx: &mut PartsCx<'_, Self>). Named sub-rects: thumbs, chevrons, handles, segments and the roving groups over them.
    • fn bind(&mut self) -> Option<BindMut<'_, ValueOf<Self>>>. Value components return their binding; the same binding on every call, with no side effects.
    • fn same_value(&self, proposed: &ValueOf<Self>, host: &ValueOf<Self>) -> bool. Whether host, a value the app wrote back, is the value proposed as the component holds values: a host that stores a proposal rounded to the component's precision has not changed the document under a gesture.
    • fn scrub(&self) -> Option<Scrub<ValueOf<Self>>>. Lets a drag on the scrub's sources (the side label, the body, a part) change the value; the pipeline runs the gesture (16.3, B2).
    • fn scroll(&mut self) -> Option<BindMut<'_, ScrollPos>>. The scroll offset's owner when the app drives scrolling; None keeps it in session memory.
    • fn content_env(&self, _cx: &Cx<'_, Self>, _values: &mut crate::runtime::env::AppValues). App values for content the component does not build: its body or its items.
    • fn update(&mut self, _cx: &mut Cx<'_, Self>). After sensing, before paint: value maths, memory, popup triggers.
    • fn overlay(&mut self, _ui: &mut OverlayUi<'_>, _cx: &mut Cx<'_, Self>). Anchored popups.
    • fn flags(&self) -> Flags. Value-driven flags (checked, open, invalid, busy).
    • fn activated(&self, cx: &Cx<'_, Self>) -> bool. When a bound command fires; the default is a primary click or Intent::Activate.
    • fn paint(&mut self, _ui: &mut PaintUi<'_>, _cx: &Cx<'_, Self>). Content only; surface, state fill and focus ring are painted by the pipeline.
    • fn paint_over(&mut self, _ui: &mut PaintUi<'_>, _cx: &Cx<'_, Self>). Content above the body or items.
    • fn access(&self, _access: &mut Access, _cx: &Cx<'_, Self>). Value, range, relations, sub-nodes and custom actions beyond role, label and flags.
    • fn value_text(&self, _cx: &Cx<'_, Self>) -> Option<String>. The shown value as the component words it ("40.0", "20 to 60"), which assistive technology reads and a viewer shows beside the component (Outcome::value_text); None for a component that words no value.
    • fn word_value(&self, _value: &ValueOf<Self>, _cx: &Cx<'_, Self>) -> Option<String>. Words value as the control shows it ("40.0", "20 to 60"); None for a component that words no value.
    • fn finish(self, cx: Cx<'_, Self>) -> Self::Output. Builds the output from the finished context.
  • craft_ui::contract::Container: pub trait Container: Component + HasProps + Meta<Shape = shape::Body>. A component whose caller supplies a body.
    • fn open(&mut self) -> Option<BindMut<'_, bool>>. The open state's owner: the caller's binding. None: a session slot under the id.
    • fn header(&mut self, _ui: &mut Ui, _cx: &mut BodyCx<'_>). Fills the header region the body step laid out.
    • fn header_parts(&self, _cx: &MeasureCx<'_, Self>) -> HeaderParts. The room the container's own parts take at the edges of its header's line (a menu button, a drag band).
    • fn controls(&mut self, _ui: &mut Ui, _cx: &mut BodyCx<'_>). Fills the header's trailing region.
    • fn footer(&mut self, _ui: &mut Ui, _cx: &mut BodyCx<'_>). Fills the footer region.
    • fn body_end(&mut self, _ui: &mut Ui, _cx: &mut BodyCx<'_>). Fills the region under the body and above the footer, whatever the footer's place.
    • fn end(&mut self, _ui: &mut Ui, _cx: &mut BodyCx<'_>). Fills the end region, after the body.
    • fn closed(&mut self, _why: CloseReason). The container closed, and why: a layer's dismissal rule, a close the body or footer asked for with BodyCx::request_close_as, overlay::request_close, or the OS closing its window.
    • fn placement_changed(&mut self, _change: &overlay::PlacementChange). The user moved or resized the container's layer: by the move band, a grip or the keyboard Move and Size modes.
  • craft_ui::contract::ContentPainter: pub trait ContentPainter: Component. Implemented by the allowlisted components that paint content with a raw painter (a preview, a waveform).
  • craft_ui::contract::DisabledLook: pub enum DisabledLook { States, Faded }. How a component that is not enabled looks (Component::DISABLED).
  • craft_ui::contract::EscapeEdit: pub enum EscapeEdit { Cancel, Commit }. What Escape does to a value component's running gesture (step 9).
  • craft_ui::contract::HasProps: pub trait HasProps. Written by the derive from a #[container] field, for containers and collections.
    • fn props(&self, _: Internal) -> &ContainerProps.
  • craft_ui::contract::IdSource: pub enum IdSource { Auto, Salt(IdSalt), Id(Id) }. Where an element's id comes from.
  • craft_ui::contract::Inner: pub struct Inner<O, R> { pub output: O, pub inner: Option<R>, pub settle: Option<settle::SettleAt> }. The container show output: the component's own output and the body's result.
    • pub fn settle<T>(&mut self, f: impl FnOnce(&mut SettleCx<'_>, &mut R) -> T) -> Option<T>. Runs f once, after the pass's real run, with the body's memory (keep, memory, saved, pending, take, as the body has it) and the real run's result.
    • pub fn map_output<O2>(self, f: impl FnOnce(O) -> O2) -> Inner<O2, R>. Maps the component's own output and keeps the body's result and its settle handle.
  • craft_ui::contract::Internal: pub struct Internal. A token only craft-ui can build: the private field and pub(crate) constructor let derive output in any crate implement the accessors below, while only craft-ui can call them.
  • craft_ui::contract::ItemFn: pub type ItemFn<'r, C> = dyn FnMut(&<C as Collection>::Key, &mut ItemCx<'_, 'r,<C as Collection>::Key>) -><C as Collection>::Item<'r> + 'r. The item closure of ShowCollection::show_items: one call per visible key.
  • craft_ui::contract::MAX_EXTENT: pub const MAX_EXTENT: f32. The most a component may measure on either side, in points.
  • craft_ui::contract::Meta: pub trait Meta. Written by #[derive(Component)]; never by hand.
    • type Shape. The shape: leaf, body or items.
    • type StyleKey. The instance inputs the style depends on.
    • const CANVAS_CONTROL: bool. A leaf the Canvas body shows (#[component(canvas_control)]): its default sense is empty, so a press away from its parts reaches the tool, and its type is a canvas control.
    • fn style_key(&self) -> Self::StyleKey. The style key of this instance.
    • fn common(&self, _: Internal) -> &Common.
    • fn common_mut(&mut self, _: Internal) -> &mut Common.
    • fn set_sizing(&mut self, sizing: Sizing, _: Internal). Takes the caller's Props::sizing: a leaf keeps it in its Common; the derive writes a container's or a collection's into its ContainerProps, over the default its constructor set.
  • craft_ui::contract::Pattern: pub trait Pattern. A type that only assembles components: a composition with no contract shape of its own (24.4).
  • craft_ui::contract::ShapeKind: pub enum ShapeKind { Leaf, Body, Items }. The shape of a component, as a value: what a registration records.
  • craft_ui::contract::Show: pub trait Show: Component + Meta<Shape = shape::Leaf> + sealed::Show. Shows a leaf.
    • fn show(self, ui: &mut Ui) -> Self::Output. Shows the component in the flow of ui.
    • fn show_at(self, ui: &mut Ui, rect: Rect) -> Self::Output. Shows the component at rect, with no allocation.
    • fn show_with_tip(self, ui: &mut Ui, tip: impl FnOnce(&mut Ui)) -> Self::Output. Shows the component with rich tooltip content from the same call.
    • fn show_at_with_tip(self, ui: &mut Ui, rect: Rect, tip: impl FnOnce(&mut Ui)) -> Self::Output. Shows the component at rect with rich tooltip content.
    • fn measure_in(&mut self, ui: &Ui, proposal: Proposal) -> Vec2. Measures without allocating: steps 1 to 5 under the id show would use next.
  • craft_ui::contract::ShowCollection: pub trait ShowCollection: Collection + sealed::ShowCollection. Shows a collection's items.
    • fn show_items<'r>(self, ui: &mut Ui, source: &dyn ItemSource<Self::Key>, item: &mut ItemFn<'r, Self>) -> Self::Output. Shows the visible items of source, one item call each.
  • craft_ui::contract::ShowContainer: pub trait ShowContainer: Container + sealed::ShowContainer. Shows a container with its body.
    • fn show<R>(self, ui: &mut Ui, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Inner<Self::Output, R>. Shows the container in the flow of ui.
    • fn show_at<R>(self, ui: &mut Ui, rect: Rect, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Inner<Self::Output, R>. Shows the container at rect, with no allocation: a frame over a split or a layer the parent places.
    • fn show_at_taking_room<R>(self, ui: &mut Ui, rect: Rect, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Inner<Self::Output, R>. Shows the container at rect and takes that rect's room in the flow of ui: what is shown after it lies past it, as after [show].
    • fn measure_in<R>(&mut self, ui: &Ui, proposal: Proposal, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Vec2. Measures the container with body without allocating: steps 1 to 5 under the id show would use next, with the body, header, footer and end regions run once in an invisible sizing pass, laid out as show lays them out.
    • fn show_with_tip<R>(self, ui: &mut Ui, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R, tip: impl FnOnce(&mut Ui)) -> Inner<Self::Output, R>. Shows the container with rich tooltip content.
    • fn show_at_with_tip<R>(self, ui: &mut Ui, rect: Rect, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R, tip: impl FnOnce(&mut Ui),) -> Inner<Self::Output, R>. Shows the container at rect with rich tooltip content.
  • craft_ui::contract::ShowShape: pub trait ShowShape: sealed::ShowShape. Which show trait applies, and the shape's default sense.
    • const KIND: ShapeKind. The shape as a value.
    • const DEFAULT_SENSE: Sense. Leaf CLICK | FOCUS; body empty; items CLICK | DRAG | FOCUS | WHEEL | TAKE_FOCUS.
  • craft_ui::contract::install: pub fn install(ctx: &egui::Context, spec: crate::runtime::InstallSpec) -> Result<(), crate::runtime::InstallError>. Adds the runtime to ctx: runtime::install with the overlay host's ghost-layer painter in the end hook.
  • craft_ui::contract::Access: re-export of craft_ui::runtime::access::Access.
  • craft_ui::contract::Accessible: pub trait Accessible. Live announcements and the enclosing field label (chapter 12).
    • fn announce(&mut self, text: impl Into<String>, politeness: Politeness). Announces transient text; it is flushed at frame end as one status node and returned in FrameOutput.
    • fn field_label(&self) -> Option<FieldLabel>. The label of the enclosing field container, when the component sits in one.
  • craft_ui::contract::ActivateOn: pub enum ActivateOn { DoubleClick, Click }. The pointer gesture that activates an item.
  • craft_ui::contract::Activation: pub struct Activation { pub by_key: bool, pub mods: craft_keymap::Mods }. How a component was activated this pass.
  • craft_ui::contract::Animate: re-export of craft_ui::runtime::motion::Animate.
  • craft_ui::contract::BandFill: pub enum BandFill { Surface(SurfaceKind), Tone(Tone) }. What the band behind a header paints.
  • craft_ui::contract::Bind: pub struct Bind<'a, T>. The binding of a value component: a value the app owns, the check on it and the value a reset restores.
    • pub fn given(v: impl Into<Mixed<T>>) -> Self. A value in; every edit comes out as an event.
    • pub fn bound(v: &'a mut T) -> Self. Edits write through to v.
    • pub fn bound_mixed(v: &'a mut Mixed<T>) -> Self. Edits write through to a field that may be mixed; an edit makes it concrete.
    • pub fn kept() -> Self. No caller value: the component keeps it in session memory under its id.
    • pub fn saved(mut self, key: SaveKey) -> Self where T: Savable,. A kept value that is also saved across runs under key.
    • pub fn policy(mut self, policy: EditPolicy) -> Self. When a write-through source is written.
    • pub fn check(self, check: fn(&T) -> Validity<T>) -> Self where T: 'a,. The check on a value: Fix replaces it; Warn, Refuse and Error set the component's state, and Refuse also refuses a commit. check is a fn, which captures nothing; a check that reads other values takes them as inputs ([check_with]).
    • pub fn check_with<I: MemoProps + 'a>(mut self, inputs: I, check: fn(&I, &T) -> Validity<T>) -> Self where T: 'a,. The check check on a value, reading inputs beside it (a limit, the names already taken).
    • pub fn reset(mut self, default: T) -> Self. The value a reset gesture restores, and the value a kept binding reads while nothing is stored.
    • pub fn reborrowed(&mut self) -> Bind<'_, T>. A binding with the same source, check, policy and reset that borrows this one, so a composite can hand its own binding to a child component for the length of one pass.
    • pub fn value(&self) -> Option<&T>. The one value the binding holds before this pass's edits; None for a mixed or kept binding.
    • pub fn reborrow(&mut self) -> BindMut<'_, T>. The binding as the pipeline reads and writes it.
  • craft_ui::contract::BindCheck: pub struct BindCheck<'c, T>. A binding's check as props (BindMut::check_of): by the key of its inputs and its fn.
    • pub fn validity(&self, value: &T) -> Validity<T>. The check's verdict on value.
  • craft_ui::contract::BindMut: pub struct BindMut<'a, T>. A reborrow of a [Bind] the pipeline reads at steps 4, 11, 15 and 17. Component::bind returns it, and returns the same binding on every call.
    • pub fn check_of(&self) -> BindCheck<'_, T>. The binding's check, as the inputs of a child's check (Bind::check_with): a composite hands its own check to the children that edit its value.
    • pub fn read(&self, cx: &mut impl StageAccess) -> Option<Mixed<T>>. The binding's value for code that runs no pipeline step: a given or write-through value, or the kept value under the base id of cx (the saved tier when the binding has a SaveKey). None for a kept binding that holds nothing yet.
    • pub fn write(&mut self, cx: &mut impl StageAccess, event: &EditEvent<T>) -> bool. Writes event as the pipeline's apply step does: the check may replace the value (Fix) or refuse it (nothing is written).
  • craft_ui::contract::BodyCx: pub struct BodyCx<'a> { pub id: Id, pub env: EnvView<'a>, pub resolved: &'a Resolved<'a>, pub rect: Rect, pub memory: &'a mut MemoryStage }. What a body closure and the header, footer and empty hooks read: a view over the pipeline's memory stage keyed by the body's base id.
    • pub fn open_url(&mut self, url: &str, new_tab: bool). Asks the platform to open url, in a new tab where the platform has tabs and new_tab is set: the opener Link uses.
    • pub fn take_pick_answer(&self, ticket: craft_host::PickId) -> Option<craft_host::Picked>. The host file service's answer to the picker ticket, taken once.
    • pub fn is_exiting(&self) -> bool. Whether the container has closed and its body only stays on screen while it fades out. is_open reads true then; a region that belongs to the open container (a companion layer) is not shown.
    • pub fn field_message(&self) -> Option<(Message, craft_theme::variant::Tone)>. The validity message of the first control in the container's label scope, recorded last frame, with the tone it shows in: a container whose footer declares FooterRegion::status shows it as its status text. None when the container has no label or no control reported one.
    • pub fn moving(&self) -> bool. Whether a drag of the container's move band (DragBand::Move) moves its layer in this pass, from the pass the drag starts to the one before its release: a grip in the body shows the move.
    • pub fn is_open(&self) -> bool. Whether the body is open.
    • pub fn open(&mut self) -> &mut bool. The open state: a title row's disclosure binds to it, and step 15 writes a change to its owner.
    • pub fn gate(&mut self) -> Option<&mut bool>. The gate's shown copy, for a container whose value is a bool: a title row's check box binds to it, and step 15 applies a change.
    • pub fn gate_is_mixed(&self) -> bool. Whether the gate's value is mixed: gate then reads off, and a title row's check box shows the mixed face.
    • pub fn request_close(&mut self). Asks the container to close, as CloseReason::Requested: step 15 closes it.
    • pub fn request_close_as(&mut self, why: CloseReason). Asks the container to close and tells it why (an OK button is Activated, Enter is Enter): step 15 closes it and Container::closed gets why.
    • pub fn labelled<C: Show>(&mut self, ui: &mut Ui, key: impl Hash + Debug, label: Label, side: SideLabel, child: C) -> C::Output. Runs the label step (B2, 16.3) for one leaf child in the body's flow: label sits beside the child or above it, with the icon and detail of side, and the child takes the width the label leaves.
    • pub fn labelled_with<C: Show, D: Show>(&mut self, ui: &mut Ui, key: impl Hash + Debug, label: Label, side: SideLabel, child: C, content: D,) -> C::Output. labelled, with content shown inside the label after its text (a sample of what the option picks).
    • pub fn style<C: Container>(&self) -> Option<&'a C::Style>. The style of the container C whose body this is, as step 2 resolved it for this pass: the one way a body reads what its container's style holds (a dock root's docking sizes). None when the body's container has another style type, and for a body with no container: a popup's body or a collection's empty state.
    • pub fn gap(&self) -> Option<f32>. The gap the body's layout puts between its children (ContainerProps::body_gap), for a body that places content of its own beside them. None for a body with no container: a popup's body or a collection's empty state.
    • pub fn derived<K: crate::contract::MemoProps, V: Send + Sync + 'static>(&self, key: &K, build: impl FnOnce() -> V) -> std::sync::Arc<V>. The value this body derives from key: kept while key is unchanged, else built by build (runtime::derived, under the body's id).
    • pub fn take_cancel(&mut self) -> bool. Takes the Escape of this pass that no component took: a field that clears on Escape passes it on once it is empty. true once per Escape; the enclosing scope (a dialog, a popover) then does not act on it.
  • craft_ui::contract::BodyLayout: pub enum BodyLayout { Stack, Row { wrap: bool, align: RowAlign }, Grid { columns: Cow<'static, [ColumnWidth]>, fit: GridFit, cells: CellAlign } }. How a body lays out its children, in reading order: mirrored under a right-to-left direction.
    • pub const fn stack() -> Self. Children one under another.
    • pub const fn row() -> Self. Children side by side from the start edge, with no wrap.
    • pub fn grid(columns: impl Into<Cow<'static, [ColumnWidth]>>) -> Self. Children row-major over columns: a 'static slice, or columns built in the pass.
    • pub fn fit(self, fit: GridFit) -> Self. A Grid with fit; any other layout is unchanged.
    • pub fn cells(self, cells: CellAlign) -> Self. A Grid with cells; any other layout is unchanged.
    • pub fn wrap(self, on: bool) -> Self. A Row that wraps; any other layout is unchanged.
    • pub fn align(self, align: RowAlign) -> Self. A Row with align; any other layout is unchanged.
  • craft_ui::contract::Bracket: pub enum Bracket { Linked, Unlinked }. The bracket a Row draws from the labelled rows of its first child to the child after them (Image Size's width and height to their chain): a tick from each of the first and the last row's controls to the middle child's centre line, joined along that line.
  • craft_ui::contract::CanvasGesture: re-export of craft_ui::runtime::sampler::CanvasGesture.
  • craft_ui::contract::CaptionColumn: pub struct CaptionColumn. Whether the beside captions of a [LabelScheme::Inline] form share one column.
    • pub const SHARED: CaptionColumn. The captions share one column.
    • pub const OWN: CaptionColumn. Each caption is as wide as its own text (the default).
    • pub const fn shared(self) -> bool. Whether the captions share one column.
  • craft_ui::contract::CaptionInk: pub enum CaptionInk { Muted, Normal }. The ink of a side label's name, other than a link's ([LinkLabelInk]) and the text after a check box or a radio, which reads at full ink.
  • craft_ui::contract::CellWidth: pub type CellWidth = ColumnWidth. The width of a caption's cell.
  • craft_ui::contract::Collapse: pub struct Collapse { pub initially_open: bool, pub animated: bool }. Collapse configuration.
    • pub const fn new() -> Self. A collapsible body that starts open, animated.
    • pub const fn initially_open(mut self, on: bool) -> Self. Whether the body starts open.
    • pub const fn animated(mut self, on: bool) -> Self. Whether opening and closing animate.
  • craft_ui::contract::CollectionEvent: pub enum CollectionEvent<K, E> { Selection { change: SelectionChange<K>, by: LeadSource, mods: craft_keymap::Mods }, Picked { key: K, mods: craft_keymap::Mods }, LeadMoved { key: K, by: LeadSource }, Activate(K), Refused(K), Rested(K), EmptyActivated, EmptyContextMenu { at: Pos2 }, Preview(K), ContextMenu(ContextMenuRequest<K>), EdgePressed { above: K, below: K, mods: craft_keymap::Mods }, CommandClick { key: K, mods: craft_keymap::Mods }, MiddleClick(K), Delete(Vec<K>), Open(OpenChange<K>), Reorder(EditEvent<ReorderMove<K>>), Move(EditEvent<Vec2>), Dropped { at: DropAt<K>, op: DropOperation, payload: DropPayload }, Zoom { factor: f32, about: Pos2 }, Rename(EditEvent<Rename<K>>), Toggle(EditEvent<ToggleEdit<K>>), Column(ColumnEvent), Item(K, E) }. What a collection reports, in drawing order.
  • craft_ui::contract::CollectionProps: pub struct CollectionProps { pub select: SelectMode, pub reorder: Option<ReorderRule>, pub rename: bool, pub rename_column: Option<ColumnKey>, pub slow_click_rename: bool, pub columns: Vec<ColumnSpec>, pub sort: Option<ColumnSort>, pub empty: Option<Label>, pub activate: ActivateOn, pub striped: bool, pub allow_empty: bool, pub lead_on_open: LeadOnOpen, pub hover_lead: HoverLead, pub arrows_select: bool, pub focus_on_press: bool, pub rows_stamp: Option<u64>, pub space: SpaceAction, pub type_ahead: bool, pub arrows_wrap: bool, pub header: bool, pub digit_keys: bool, pub menu_on_click: bool, pub item_keys: ItemKeys, pub marquee: bool, pub deletable: bool, pub delete_target: DeleteTarget, pub drag_payloads: Vec<DragPayload>, pub drag_count: Option<Counted>, pub drag_preview: RowPreview, pub natural_height: bool, pub min_rows: u16, pub max_rows: Option<u16>, pub row_height: RowHeight, pub command_click: bool, pub notch: Option<Notch>, pub middle_button: MiddleButton, pub primary_picks: bool, pub invert_middle: bool, pub overflow: Axis, pub pages: bool, pub current: Option<Arc<dyn Any + Send + Sync>>, pub picks_beside_current: bool, pub select_under_drag: bool, pub scroll_anchor: ScrollAnchor }. What a collection reads from the app: plain data.
    • pub const fn new() -> Self. Collection props with every setting at its default.
    • pub const fn select_under_drag(mut self, on: bool) -> Self. Whether a foreign drag resting over an unselected item selects it (select_under_drag).
    • pub fn select(mut self, mode: SelectMode) -> Self. What can be selected.
    • pub fn reorder(mut self, rule: ReorderRule) -> Self. Items reorder by rule.
    • pub fn drag_payload<K: 'static, P: Send + Sync + 'static>(self, map: impl Fn(&ListDrag<K>) -> Option<P> + Send + Sync + 'static) -> Self. A row drag carries map of it, for the drop targets of type P; a row the map gives None for does not drag unless a reorder rule is set.
    • pub fn carry(mut self, payload: DragPayload) -> Self. A row drag carries payload of it too, beside the payloads given before: a host adds its own payload type to a drag the component already maps.
    • pub const fn drag_preview(mut self, preview: RowPreview) -> Self. What a row drag shows while it runs (a badge by the pointer by default).
    • pub const fn drag_count(mut self, count: Counted) -> Self. A row drag's preview reads count for the number of dragged items.
    • pub const fn pages(mut self, on: bool) -> Self. The items are pages (CollectionProps::pages).
    • pub fn rename(mut self, on: bool) -> Self. Rename runs through the collection's editor.
    • pub fn rename_column(mut self, column: ColumnKey) -> Self. A double click on column of a renamable item (rename, Collection::can_rename) opens its rename editor; the double click elsewhere on the row activates it.
    • pub const fn slow_click_rename(mut self, on: bool) -> Self. A slow second click on the label of the only selected item opens its rename editor.
    • pub fn columns(mut self, columns: Vec<ColumnSpec>) -> Self. The columns.
    • pub fn sort(mut self, sort: impl Into<Option<ColumnSort>>) -> Self. The column the rows are sorted by.
    • pub const fn activate(mut self, on: ActivateOn) -> Self. What activates an item with the pointer.
    • pub const fn striped(mut self, on: bool) -> Self. Odd rows carry RowState.striped.
    • pub const fn allow_empty(mut self, on: bool) -> Self. A press on the empty space below the rows empties the selection.
    • pub const fn lead_on_open(mut self, at: LeadOnOpen) -> Self. Where the lead starts.
    • pub const fn hover_lead(mut self, hover: HoverLead) -> Self. What the pointer moving over the rows changes.
    • pub const fn arrows_select(mut self, on: bool) -> Self. Whether the arrow keys select the row they move the lead to.
    • pub const fn type_ahead(mut self, on: bool) -> Self. Typed letters move the lead (CollectionProps::type_ahead).
    • pub const fn arrows_wrap(mut self, on: bool) -> Self. The arrow keys wrap at the ends (CollectionProps::arrows_wrap).
    • pub const fn rows_stamp(mut self, stamp: u64) -> Self. The rows are the set stamp names; the lead starts over when the stamp changes.
    • pub const fn focus_on_press(mut self, on: bool) -> Self. A primary press moves key focus to the collection; off, it leaves focus where it is.
    • pub const fn space(mut self, action: SpaceAction) -> Self. What Space does.
    • pub const fn header(mut self, on: bool) -> Self. Whether the header row shows.
    • pub const fn digit_keys(mut self, on: bool) -> Self. Typed digits go to the collection's update as Intent::Digit.
    • pub const fn menu_on_click(mut self, on: bool) -> Self. A plain click on a row asks for its menu, as a secondary click does.
    • pub const fn item_keys(mut self, keys: ItemKeys) -> Self. Who takes the arrow keys while the collection has the key focus.
    • pub const fn marquee(mut self, on: bool) -> Self. A drag from empty space selects with a marquee.
    • pub const fn deletable(mut self, on: bool) -> Self. Delete and Backspace at the lead report the items to delete (CollectionEvent::Delete).
    • pub const fn delete_target(mut self, target: DeleteTarget) -> Self. Sets where a deletable collection takes Delete and Backspace.
    • pub const fn natural_height(mut self, on: bool) -> Self. The collection takes its full content height and owns no scroll (see [CollectionProps::natural_height]).
    • pub const fn min_rows(mut self, rows: u16) -> Self. The collection is at least rows rows tall (see [CollectionProps::min_rows]).
    • pub const fn max_rows(mut self, rows: u16) -> Self. The collection shows at most rows rows and scrolls the rest (see [CollectionProps::max_rows]).
    • pub const fn row_height(mut self, height: RowHeight) -> Self. The rows are height tall (see [RowHeight]).
    • pub const fn command_click(mut self, on: bool) -> Self. A Cmd/Ctrl click on an item is a command, not a pick (see [CollectionProps::command_click]).
    • pub const fn notch(mut self, notch: Notch) -> Self. The distance one wheel notch scrolls the rows (see [CollectionProps::notch]).
    • pub const fn middle_button(mut self, button: MiddleButton) -> Self. What a middle press does: pan, or latched auto-scroll (see [CollectionProps::middle_button]).
    • pub const fn primary_picks(mut self, on: bool) -> Self. Whether only a primary press picks an item (see [CollectionProps::primary_picks]).
    • pub const fn invert_middle(mut self, on: bool) -> Self. Flips the direction of middle-button pan and auto-scroll (see [CollectionProps::invert_middle]).
    • pub fn wheel_notch(&self, line: f32) -> craft_behavior::WheelNotch. The wheel distance of one notch, with a text line line points high: the set notch, else the default.
    • pub const fn overflow(mut self, axis: Axis) -> Self. The axis the rows overflow along (see [CollectionProps::overflow]).
    • pub fn current<K: Send + Sync + 'static>(mut self, key: Option<K>) -> Self. The current item: Some(key) marks the item with that key, None marks none. K is the collection's key type; a key of another type marks nothing.
    • pub const fn picks_beside_current(mut self, on: bool) -> Self. Keeps the selection a pick beside the current item (see [CollectionProps::picks_beside_current]).
    • pub fn empty(mut self, text: impl Into<Label>) -> Self. The empty-state text.
  • craft_ui::contract::CollectionResponse: pub struct CollectionResponse<K, E> { pub response: Response, pub events: Vec<CollectionEvent<K, E>>, pub visible: Range<usize>, pub shown: Vec<ShownRow<K>>, pub select: SelectMode, pub rename: bool, pub reorder: bool, pub activation_clicks: u8, pub pending_drop: Option<PendingDrop<K>>, pub hovered: Option<K>, pub menu: Option<ContextMenuRequest<K>>, pub auto_scrolling: bool }. The output of a collection.
    • pub fn opener(&self, opener: crate::contract::ItemOpener) -> Option<&Response>. The response of the item part opener names: its click this pass and its rect.
  • craft_ui::contract::ColumnAlign: pub enum ColumnAlign { Start, End }. Where a column's content sits.
  • craft_ui::contract::ColumnCommands: pub enum ColumnCommands { Resize, MoveLeft, MoveRight }. The commands of a column header (17.1): resize works from the keyboard through them, and the header menu lists them for the column it was opened from. commands::fire routes them to the collection.
    • pub const ALL: [ColumnCommands; 3]. Every header command, in menu order.
  • craft_ui::contract::ColumnEvent: pub enum ColumnEvent { Sort { key: ColumnKey, descending: bool }, Resized { key: ColumnKey, width: f32 }, Moved { key: ColumnKey, to: usize }, Shown { key: ColumnKey, shown: bool }, Unsorted, Reset, Removed { key: ColumnKey } }. A change to the columns.
  • craft_ui::contract::ColumnKey: re-export of craft_behavior::columns::ColumnKey.
  • craft_ui::contract::ColumnKind: pub enum ColumnKind { Content, Toggle(ToggleColumn) }. What a column's cells are.
  • craft_ui::contract::ColumnRemove: pub struct ColumnRemove { pub name: Label, pub enabled: bool }. The remove control of a column's header.
  • craft_ui::contract::ColumnRequest: pub enum ColumnRequest { Shown(ColumnKey, bool), Reset, Command(crate::contract::ColumnCommands) }. What a pick in the header menu asks of the header, given back with Cx::column_request.
  • craft_ui::contract::ColumnSort: pub struct ColumnSort { pub key: ColumnKey, pub descending: bool }. The column the rows are sorted by and the direction: the app's value, which it changes on ColumnEvent::Sort.
    • pub const fn new(key: ColumnKey, descending: bool) -> Self. Rows sorted by key, descending when descending.
    • pub const fn ascending(key: ColumnKey) -> Self. Rows sorted by key, ascending.
    • pub const fn descending(key: ColumnKey) -> Self. Rows sorted by key, descending.
  • craft_ui::contract::ColumnSpec: pub struct ColumnSpec { pub key: ColumnKey, pub header: Label, pub width: ColumnWidth, pub resizable: bool, pub sortable: bool, pub movable: bool, pub frozen: bool, pub kind: ColumnKind, pub align: ColumnAlign, pub tabular: bool, pub first_descending: bool, pub icon: Option<craft_behavior::IconId>, pub tip: Option<Label>, pub max_share: Option<f32>, pub min_width: f32, pub hideable: bool, pub remove: Option<ColumnRemove> }. One column of a collection.
    • pub fn removable(mut self, name: impl Into<Label>, enabled: bool) -> Self. The column gets a remove control named name at its header's end, disabled unless enabled.
    • pub fn new(key: ColumnKey, header: impl Into<Label>, width: ColumnWidth) -> Self. A content column with a header and a width; the other settings off.
    • pub fn toggle(key: ColumnKey, header: impl Into<Label>, toggle: ToggleColumn) -> Self. A toggle column as wide as a toggle cell, with a header; the other settings off.
    • pub fn sortable(mut self) -> Self. Activating the header sorts.
    • pub fn resizable(mut self) -> Self. The user can resize the column.
    • pub fn movable(mut self) -> Self. The user can move the column.
    • pub fn frozen(mut self) -> Self. The column stays in view.
    • pub fn kind(mut self, kind: ColumnKind) -> Self. The column's cell kind.
    • pub fn align(mut self, align: ColumnAlign) -> Self. The cells' content sits at align.
    • pub fn numeric(mut self) -> Self. A column of numbers: content at the end edge, tabular figures.
    • pub fn hideable(mut self) -> Self. The user can hide the column from the header menu.
    • pub fn at_most(mut self, share: f32) -> Self. A Content column takes at most share of the collection's width.
    • pub fn at_least(mut self, width: f32) -> Self. A Content column is at least width wide.
    • pub fn tip(mut self, tip: impl Into<Label>) -> Self. The header's tooltip.
    • pub fn icon(mut self, icon: craft_behavior::IconId) -> Self. The icon the column's cells show.
    • pub fn first_descending(mut self) -> Self. The first press on the header sorts descending.
  • craft_ui::contract::CommandSet: re-export of craft_ui::runtime::commands::CommandSet.
  • craft_ui::contract::Commands: re-export of craft_ui::runtime::commands::Commands.
  • craft_ui::contract::Common: pub struct Common { pub label: Label, pub tooltip: Option<Tooltip>, pub description: Option<String>, pub selected: Option<bool> }. What every component carries: the props the pipeline reads at step 1.
    • pub const fn new() -> Common. A Common with every prop unset, which the derive's constructors start from.
  • craft_ui::contract::Component: re-export of craft_ui_macros::Component (outside these crates).
  • craft_ui::contract::ContainerProps: pub struct ContainerProps { pub mount: Mount, pub surface: Option<SurfaceKind>, pub pad: Pad, pub pad_edges: PadEdges, pub sizing: Sizing, pub content_in_bar: bool, pub room_height: Option<f32>, pub layout: BodyLayout, pub header: Option<HeaderRegion>, pub scroll: Option<Scroll>, pub footer: Option<FooterRegion>, pub end: Option<EndRegion>, pub help: Option<Label>, pub resize_name: Option<Label>, pub position: Option<SetPosition>, pub focus: FocusPolicy, pub collapse: Option<Collapse>, pub body_gap: Gap, pub least_width: Option<LeastWidth>, pub least_height: Option<f32>, pub wrap_width: Option<WrapWidth>, pub edge_rule: bool, pub child_size: Option<ControlSize>, pub child_glyphs: Option<GlyphRole>, pub arena: bool, pub scroll_owner: bool, pub fallback_collection: Option<egui::Id>, pub gates: bool, pub transform: Option<CanvasTransform>, pub theme: Option<ThemeScope>, pub command_scope: Option<CommandScope>, pub live: Option<Politeness>, pub label: Option<SideLabel>, pub roving: Option<Roving>, pub save: Option<SaveKey>, pub outer_edit: bool, pub collection_body: bool, pub label_column: bool, pub fit_rank: Option<u8>, pub labels: Option<LabelScheme>, pub bracket: Option<Bracket> }. What a container or collection adds to Common.
    • pub const fn new() -> Self. Props with every field at its default.
    • pub fn mount(mut self, mount: Mount) -> Self. Where the container lives.
    • pub const fn surface(mut self, surface: SurfaceKind) -> Self. The surface the container paints.
    • pub const fn pad(mut self, pad: Pad) -> Self. The padding tier.
    • pub const fn pad_edges(mut self, edges: PadEdges) -> Self. The edges the padding tier applies to.
    • pub const fn sizing(mut self, sizing: Sizing) -> Self. How the size follows the content.
    • pub const fn content_in_bar(mut self) -> Self. Takes the content width among the members of a bar ([content_in_bar]).
    • pub const fn room_height(mut self, height: f32) -> Self. The height the body offers its children in flow ([room_height]).
    • pub fn layout(mut self, layout: BodyLayout) -> Self. How the body lays out its children.
    • pub const fn header(mut self, header: HeaderRegion) -> Self. A header region.
    • pub const fn scroll(mut self, scroll: Scroll) -> Self. A scroll region.
    • pub const fn collection_body(mut self) -> Self. The body holds one collection that owns the scroll (a popup list): a layer's own body scroll is off, and the collection scrolls inside the layer's capped room.
    • pub const fn footer(mut self, footer: FooterRegion) -> Self. A footer region.
    • pub const fn end(mut self, end: EndRegion) -> Self. An end region at the line's end edge, outside the body's scroll region.
    • pub fn help(mut self, help: impl Into<Label>) -> Self. The help line the footer shows under the control column.
    • pub fn resize_name(mut self, name: impl Into<Label>) -> Self. The accessible name of every resize grip of the container's window or layer.
    • pub const fn position(mut self, position: SetPosition) -> Self. The container's place in its set (n of m), reported on its node.
    • pub const fn focus(mut self, policy: FocusPolicy) -> Self. The focus scope.
    • pub const fn collapse(mut self, collapse: Collapse) -> Self. Collapse configuration.
    • pub const fn body_gap(mut self, gap: Gap) -> Self. The spacing between the children of the body.
    • pub const fn least_width(mut self, least: LeastWidth) -> Self. The least width of the content, from a size role.
    • pub const fn least_height(mut self, points: f32) -> Self. The least height of an unwrapped Row body's line ([least_height]).
    • pub const fn wrap_width(mut self, wrap: WrapWidth) -> Self. The line length of the body's paragraphs while the container takes its width from its content, from a size role.
    • pub const fn edge_rule(mut self, on: bool) -> Self. Draws a divider along the inner edge of a container mounted as an edge pane.
    • pub const fn child_size(mut self, size: ControlSize) -> Self. A scope size for the regions: header, body, end region and footer.
    • pub const fn child_glyphs(mut self, role: GlyphRole) -> Self. A scope glyph role for the regions: a rail's buttons show its icons at the rail's side and ink.
    • pub const fn fit_rank(mut self, rank: u8) -> Self. Sets the rank by which the container leaves a shrinking row whole.
    • pub const fn arena(mut self, on: bool) -> Self. Makes the container an arena root.
    • pub const fn scroll_owner(mut self, on: bool) -> Self. Makes the container its body's scroll owner with a view of its own (ContainerProps::scroll_owner).
    • pub fn fallback_collection(mut self, collection: egui::Id) -> Self. Sends unused moves from this region's focused control to the named collection.
    • pub const fn transform(mut self, transform: CanvasTransform) -> Self. Shows the body through transform on its own egui layer.
    • pub fn theme(mut self, theme: ThemeScope) -> Self. Resolves the container, everything it shows and every layer opened from inside it through theme.
    • pub const fn command_scope(mut self, scope: CommandScope) -> Self. Makes the container an instance of scope.
    • pub const fn live(mut self, politeness: Politeness) -> Self. A live region.
    • pub fn label(mut self, label: SideLabel) -> Self. A field label.
    • pub const fn roving(mut self, roving: Roving) -> Self. Makes the body's members one roving stop.
    • pub fn save(mut self, key: SaveKey) -> Self. Saves placement, size and open state under key.
    • pub const fn outer_edit(mut self, on: bool) -> Self. One outer gesture over the body's fields, from open to close.
    • pub const fn label_column(mut self, on: bool) -> Self. The labelled rows of the body share the widest label as one column.
    • pub const fn bracket(mut self, bracket: Bracket) -> Self. The bracket of a Row from its first child's labelled rows to the child after them ([bracket]).
    • pub const fn labels(mut self, scheme: LabelScheme) -> Self. The labelled rows under the container show their labels in scheme: its regions, its body and every container inside, until one sets a scheme of its own.
  • craft_ui::contract::ContextMenuRequest: pub struct ContextMenuRequest<K> { pub key: K, pub at: Pos2, pub column: Option<ColumnKey>, pub part: Option<PartRef> }. A request for the context menu of an item.
    • pub fn new(key: K, at: Pos2) -> Self. A request for the menu of key that opens at at, from the item itself: no column and no part.
  • craft_ui::contract::Cx: pub struct Cx<'a, C: Component> { pub core: &'a mut CxCore<'a>, pub style: &'a C::Style, pub mixed: bool }. What component code reads and calls.
    • pub fn reset_part(&self) -> Option<PartRef>. The part a reset aimed at, when it declared own_reset; update proposes the value with that part at its default.
    • pub fn layout_doc(&self, text: &crate::primitives::DocText<'_>) -> TextLayout. Lays document text out text.wrap wide: the call ContentPainterCx::layout and MeasureCx::layout_doc make, so update finds a character at a point in the galley that paint draws.
    • pub fn link_activated(&self) -> bool. Whether the control's link label was clicked in this pass.
    • pub fn open_url(&mut self, url: &str, new_tab: bool). Asks the platform to open url, in a new tab where the platform has tabs and new_tab is set.
    • pub fn join_roving(&mut self). Makes this component a member of the roving group of the body it is shown in: its stop and its focusable parts join the group, and Tab visits the group once.
    • pub fn focus_shape(&mut self, shape: focus::FocusShape). The shape the component's own focus ring takes this pass, as a part's focus_shape shapes the part's: the circle inside its rect, or a polygon of points on screen.
    • pub fn fire(&mut self, command: impl Into<CommandRef>, source: FireSource) -> bool. Runs command as this component's own activation would, for a command that is not the component's bound one: resolved against the instances above the component, and not fired when disabled. source is where the activation came from (part_activated gives it).
    • pub fn part_activated(&self, part: impl Into<PartRef>) -> Option<FireSource>. Where an activation of part came from this pass: Key for a keyboard activation while part is the active part, Pointer for a click on it, Access for an AccessKit click on its sub-node; None when part was not activated.
    • pub fn context_part(&self) -> Option<PartRef>. The part this pass's context request was made at: the part under the pointer for a secondary click, the active part for the Menu key or Shift+F10; None without a request or when it was made at the component itself.
    • pub fn context_requested(&self) -> bool. Whether the component was asked for its context menu in this pass: a secondary click on it, the Menu key or Shift+F10 it did not take, or AccessKit's ShowContextMenu.
    • pub fn context_requests(&self) -> Vec<(Id, Rect)>. The context requests made in this pass so far, in order: each component asked and the rect its menu opens at (its part's, when it was made at one).
    • pub fn roving_arrival(&mut self, member: Id). Names the member of this container's roving group (ContainerProps.roving) that Tab arrives at; the first member when none is named.
    • pub fn focus_part(&mut self, part: impl Into<PartRef>). Moves focus to one of this component's focusable parts, in this pass: the rest of the pass reads the new focus.
    • pub fn focus_own(&mut self). Moves focus to the component's own stop (not a part), under the rule of focus_part.
  • craft_ui::contract::CxCore: pub struct CxCore<'a> { pub env: EnvView<'a>, pub resolved: &'a Resolved<'a>, pub id: Id, pub rect: Rect, pub content_rect: Rect, pub visible: Rect, pub flow: Flow, pub response: Response, pub command: Option<Arc<ResolvedCommand>>, pub intents: Intents, pub memory: &'a mut MemoryStage, pub ctx: Context, pub focus: crate::runtime::focus::Facts, pub toggles: Vec<Toggle> }. The non-generic part of every Cx; the step functions take this.
  • craft_ui::contract::DeleteTarget: pub enum DeleteTarget { Focus, FocusOrHover }. Where Delete and Backspace can target a deletable collection.
  • craft_ui::contract::DragBand: pub enum DragBand { None, Move, Reorder }. What dragging the header does.
  • craft_ui::contract::DragPayload: pub struct DragPayload. A mapping from a row drag to the payload of type P that other drop targets take; the drag session carries it beside the ListDrag, so one drag and one ghost serve the collection's own reorder and the targets of P.
    • pub fn new<K: 'static, P: Send + Sync + 'static>(map: impl Fn(&ListDrag<K>) -> Option<P> + Send + Sync + 'static) -> Self. The payload map makes of a drag of the collection whose keys are K; None for a row that carries none.
  • craft_ui::contract::DragPreview: re-export of craft_ui::runtime::drag::DragPreview.
  • craft_ui::contract::DropAt: pub enum DropAt<K> { Gap { key: Option<K>, insert: usize }, Onto(K) }. The place of one drop.
    • pub const fn gap(key: Option<K>, insert: usize) -> Self. Between items, over key, before insert.
    • pub fn key(&self) -> Option<&K>. The item under the pointer.
  • craft_ui::contract::DropKind: pub struct DropKind<'a, K>. A payload type a collection takes from a drag that did not start in it, at one place, where accepts passes.
    • pub fn new<P: Send + Sync + 'static>(place: DropPlace, accepts: impl Fn(&P, &DropAt<K>) -> bool + 'a) -> Self. Drops of payload type P at place where accepts passes for the payload and the place under the pointer.
  • craft_ui::contract::DropMark: re-export of craft_ui::runtime::drag::DropMark.
  • craft_ui::contract::DropOperation: re-export of craft_behavior::keys::DropOperation.
  • craft_ui::contract::DropPayload: pub struct DropPayload. The payload of a drop a collection took, read by its type.
    • pub fn get<P: 'static>(&self) -> Option<&P>. The payload, when it is a P.
  • craft_ui::contract::DropPlace: pub enum DropPlace { Between, Onto }. Where a drop kind takes its drops.
  • craft_ui::contract::DropTarget: re-export of craft_ui::runtime::drag::DropTarget.
  • craft_ui::contract::DropZone: re-export of craft_ui::runtime::drag::DropZone.
  • craft_ui::contract::EDIT_MENU: pub const EDIT_MENU: &str. The popup name of a text part's edit menu: step 8b registers it for every text part, and the text control opens and shows it from its overlay hook.
  • craft_ui::contract::EdgePress: pub struct EdgePress<'a, K>. The line between two adjacent rows as a target of its own while mods are held (Photoshop's Alt-click between two layers clips the upper one).
    • pub fn new(mods: Mods, test: impl Fn(&K, &K) -> Option<Cursor> + 'a) -> Self. The edge press while exactly mods are held, on the lines test takes.
  • craft_ui::contract::Edit: pub trait Edit. Values and edits (chapter 10). value, validity, gesture, gesture_before, adopt and edit_response take &self, so paint can call them.
    • type Value. The component's value type.
    • fn value(&self) -> Option<&Self::Value>. The shown value: the running gesture's proposal, else the binding's. None for a mixed binding, a kept binding with nothing in it, and a component with no value.
    • fn validity(&self) -> Validity<Self::Value>. What the binding's check says about the shown value.
    • fn gesture(&self) -> Option<GesturePhase>. Where this pass's gesture stands.
    • fn gesture_before(&self) -> Option<Mixed<Self::Value>>. The value the running gesture began with, as its Begin reported it: the same in every pass of the gesture, while [value] follows each proposal.
    • fn adopt<V: Value>(&self, child: &EditResponse<V>, start: &Self::Value, map: impl Fn(&V, &mut Self::Value)). Maps each of the child's events onto a clone of this component's shown value and queues the resulting events, in the child's order, for step 15.
    • fn edit_response(&self) -> EditResponse<Self::Value>. The EditResponse a value component returns from finish.
    • fn propose(&mut self, v: Self::Value). Sets the running gesture's value, beginning a gesture if none runs and the press that carries it has had no gesture cancelled.
    • fn set(&mut self, v: Self::Value). A one-shot change outside a gesture.
    • fn begin(&mut self). Opens a gesture.
    • fn commit(&mut self). Commits the proposed value.
    • fn cancel(&mut self, reason: CancelReason). Cancels the running gesture.
  • craft_ui::contract::EditResponse: pub struct EditResponse<T> { pub response: Response, pub events: EditEvents<T>, pub submitted: bool, pub submit_mods: craft_keymap::Mods, pub activation_mods: craft_keymap::Mods, pub left_by_tab: Option<bool>, pub text_lost_focus: bool, pub escaped: bool, pub unparsed: bool, pub validity: Validity<T>, pub shown: Option<Mixed<Arc<T>>>, pub value_text: Option<String>, pub tab: Option<bool>, pub caret: Option<usize>, pub hover: Hover }. The output of a component that edits a value.
    • pub fn lifted(response: Response, events: EditEvents<T>, shown: Option<Mixed<Arc<T>>>) -> Self. The response of a composite that edits one value through several child components: events are the edits of the whole value the composite lifted from its children's events, shown the value it showed after the pass, and response its own.
    • pub fn value(&self) -> Option<&T>. The latest value the pass's events carry: a proposal, a commit or a set; None when nothing was edited or no event carries one (a gesture's begin or cancel).
    • pub fn map<U>(self, f: impl Fn(T) -> U) -> EditResponse<U>. The response of a child component's edit as the response of the edit of a value built from it: the events, the shown value and a fix are mapped by f; the response and flags are the child's own.
  • craft_ui::contract::EditorHandle: pub struct EditorHandle. The editor part's widget, rect, purpose, focus, read-only and disabled state of this pass, which a body that runs inside a component reports through for the component's editor part.
    • pub fn focused(&self) -> bool. Whether the editor part holds the key focus this pass, whether or not its window has the system's.
    • pub fn report(&self, ctx: &egui::Context, state: EditorState<'_>). Reports the caret and composition to the input-method engine and puts the text facts in the running pass's editor record, which the owning component's report step reads in the same pass.
    • pub fn ime_receipt(&self, ctx: &egui::Context, before: ImeStamp, after: ImeStamp) -> bool. Notes the input-method receipt between the stamps before and after for this editor part; true when the stamps prove the engine applied it.
    • pub fn ime_application_change(&self, ctx: &egui::Context). Notes an application change of this editor part's committed text.
    • pub fn ime_interrupt(&self, ctx: &egui::Context). Asks for the OS composition to be interrupted this pass, because this editor part refused an input method's edit and the input method's view of the text is stale.
  • craft_ui::contract::EditorStep: pub enum EditorStep<S> { Input(EditorInput), Command(S, Fired) }. One step of an editor's pass, in the order of the events it came from ([Cx::editor_steps]).
  • craft_ui::contract::EndRegion: pub struct EndRegion { pub full_height: bool, pub gap: Gap, pub rule: bool, pub fit: bool }. An end region, filled by Container::end: content in reading order at the line's end edge, beside the body and outside its scroll region, as wide as it measured.
    • pub const fn new() -> Self. An end region as high as the line, space.gap.tight from the body, with no rule.
    • pub const fn fit(mut self, on: bool) -> Self. Whether the region joins the body's fit.
    • pub const fn rule(mut self, on: bool) -> Self. Whether a rule separates the end region from the body.
    • pub const fn full_height(mut self, on: bool) -> Self. Whether the region takes the full height under the header.
    • pub const fn gap(mut self, gap: Gap) -> Self. Sets the gap between the body and the region.
  • craft_ui::contract::Entry: pub struct Entry<T>. A row of entries: an item that reports its value when picked, a heading over a group of items, or a separator between groups of items.
    • pub fn new(value: T, label: impl Into<Label>) -> Self. An entry reporting value when picked, shown as label: enabled and unchecked, without an icon.
    • pub fn separator() -> Self. A rule between groups of entries.
    • pub fn heading(label: impl Into<Label>) -> Self. A caption over the entries after it, up to the next heading or separator, that names their group for assistive technology too.
    • pub fn icon(mut self, icon: impl Into<IconSpec<'static>>) -> Self. An icon before the label.
    • pub fn swatch(self, color: Srgba) -> Self. A swatch of color before the label, in the icon's place (a guide colour, a matte colour).
    • pub fn empty_swatch(self) -> Self. The empty swatch of a colour the theme decides, in the icon's place, so the label lines up with the labels of entries that have swatches.
    • pub fn closed_label(mut self, text: impl Into<Label>) -> Self. The text a closed control shows for the entry in place of its label (a tab leader's fill without its number).
    • pub fn enabled(mut self, on: bool) -> Self. Whether the entry can be picked; a disabled entry shows dimmed and never takes the lead.
    • pub fn disabled_reason(mut self, reason: impl Into<Label>) -> Self. Disables the entry and says why: the row shows reason as its tooltip and its accessible description while the entry is disabled.
    • pub fn stepped(mut self, on: bool) -> Self. Whether a step over the closed control (an arrow, Home, End, the wheel, an AccessKit step) stops on the entry.
    • pub fn checked(mut self, on: bool) -> Self. Whether the entry shows as the current choice.
    • pub fn value(&self) -> Option<&T>. The value a pick reports; None for a heading or a separator.
    • pub fn label(&self) -> &Label. The label: a heading's caption; empty for a separator.
    • pub fn face_label(&self) -> &Label. The text a closed control shows for the entry: its closed label, else its label.
    • pub fn icon_spec(&self) -> Option<&IconSpec<'static>>. The icon before the label.
    • pub fn is_enabled(&self) -> bool. Whether the entry can be picked; false for a separator.
    • pub fn is_stepped(&self) -> bool. Whether a step over the closed control stops on the entry: an enabled, stepped item.
    • pub fn description(mut self, text: impl Into<Label>) -> Self. An enabled entry's hover text and accessible description, beside the reason a disabled entry shows.
    • pub fn description_text(&self) -> Option<&Label>. The entry's description, when it has one, whether the entry is enabled or not: a disabled entry shows [Entry::why_disabled] first.
    • pub fn why_disabled(&self) -> Option<&Label>. Why the entry is disabled, while it is.
    • pub fn is_checked(&self) -> bool. Whether the entry shows as the current choice.
    • pub fn is_separator(&self) -> bool. Whether the entry is a separator.
    • pub fn is_heading(&self) -> bool. Whether the entry is a heading.
    • pub fn is_item(&self) -> bool. Whether the entry is an item, which reports a value: neither a heading nor a separator.
  • craft_ui::contract::FacesCx: pub trait FacesCx. Where a document face is asked for: a component's context, its measure or a content painter.
    • fn document_face<L>(&self, key: &str, job: impl FnOnce() -> L) -> FaceState where L: FnOnce() -> Option<FaceBytes> + Send + 'static. The face registered under key as a family of its own, read from a font catalog. job is called only for a key the registry does not know (a ready face costs nothing) and makes the load, which runs as a background job, once while the face is kept; the face is ready from the pass after it ends.
    • fn document_face_bytes(&self, key: &str) -> Option<FaceBytes>. The bytes of the face document_face registered under key, once it is ready: for reading its tables without loading the file again.
  • craft_ui::contract::FieldLabel: pub struct FieldLabel { pub id: Id, pub rect: Rect, pub press: PressState, pub hovered: bool, pub text: String, pub role: FieldLabelRole, pub detail: Option<String>, pub activated: bool, pub link: bool, pub status: bool, pub shown: bool }. The label a container shows beside its body.
    • pub fn new(id: Id, rect: Rect, text: impl Into<String>) -> Self. A label of text at rect, the node id.
    • pub fn shown(mut self, shown: bool) -> Self. Whether the label shows as a node of its own.
    • pub fn role(mut self, role: FieldLabelRole) -> Self. Whether the label names or describes the controls.
    • pub fn detail(mut self, detail: impl Into<String>) -> Self. Adds a detail line to the description of the controls the label covers.
    • pub fn status(mut self, status: bool) -> Self. Whether the container shows its control's validity message as its status line.
    • pub fn activated(mut self, activated: bool) -> Self. Whether the label was clicked or activated this pass.
    • pub fn linked(mut self, link: bool) -> Self. Whether the label is a link that was clicked this pass.
    • pub fn with_press(mut self, press: PressState) -> Self. The label's press this pass.
    • pub fn with_hover(mut self, hovered: bool) -> Self. Whether the pointer is over the label this pass.
    • pub fn pressed(&self) -> bool. The label is held down or being dragged.
  • craft_ui::contract::FieldLabelRole: pub enum FieldLabelRole { Names, Describes }. Whether a field label names its control or describes it.
  • craft_ui::contract::FieldLayout: pub enum FieldLayout { Beside, Above, Caption(CellWidth), After, Line, Inside }. Where a side label sits relative to its control.
  • craft_ui::contract::Focus: pub trait Focus. Focus and keys (chapter 9).
    • fn intents(&mut self) -> &mut Intents. The intents routed to this component this pass: cx.intents().take(Intent::Activate).
    • fn claim(&mut self, chord: Chord). Claims chord for the next frames while this component is focused.
    • fn take_claimed(&mut self, chord: Chord) -> bool. Whether chord arrived this pass for this component, consuming it.
    • fn active_part(&self) -> Option<PartRef>. The focused part while the component holds focus.
    • fn focus_arrived(&self) -> Option<PartRef>. The part focus moved onto in this frame (Tab or an arrow into a roving group, a focus request, a click), for every pass of the frame; None when focus stayed on its part, left the component, or sits on the component itself.
    • fn focus_arrived_by_key(&self) -> Option<PartRef>. focus_arrived when the focus record says the keyboard or a focus request moved it (Photoshop: Tab into a field selects its text, a click does not).
    • fn is_focused(&self) -> bool. The component holds key focus.
    • fn focus_visible(&self) -> bool. The component holds focus and shows it.
    • fn reveal(&mut self, rect: Rect). Asks the scroll owner around the component to bring rect into view.
    • fn take_scroll_moves(&mut self) -> Vec<(NavMove, MoveMods)>. For a container that is its body's scroll owner with a view of its own (ContainerProps::scroll_owner): the page and end moves its focused children left untaken, with their modifiers, in the order they arrived.
    • fn take_reveal(&mut self, view: Rect) -> Option<Vec2>. For a container that is its body's scroll owner with a view of its own: the reveal a child asked of it, as the smallest move of view (screen points, positive toward larger coordinates) that shows the child.
    • fn register_menu_bar(&mut self). Registers that this component is a menu bar that takes the menu-bar keys of the next input hook (9.7).
    • fn take_menu_keys(&mut self) -> Vec<MenuKey>. The menu-bar keys of the pass: F10 or a lone Alt press focus the bar, Alt and a letter open a menu.
    • fn register_menu_bar_by_claim(&mut self). Registers this component as a menu bar like register_menu_bar that has no mnemonic letters of its own (keytips): an Alt+letter reaches it only as a chord it claims, and any other stays the app's shortcut.
    • fn take_first_claimed(&mut self, chords: &[Chord]) -> Option<Chord>. The earliest of chords that arrived this pass for this component, consuming it, so a caller applies the claimed keys of a frame in the order they were pressed.
  • craft_ui::contract::FooterPlace: pub enum FooterPlace { Across, EndBottom, EndTop, Body }. Where a footer region sits.
    • pub const fn in_end(self) -> bool. Whether the footer sits in the end region.
  • craft_ui::contract::FooterRegion: pub struct FooterRegion { pub rule: bool, pub place: FooterPlace, pub gap: Option<Gap>, pub inset: Pad, pub status: bool }. A footer region, filled by Container::footer.
    • pub const fn new() -> Self. A footer across the container under the line, with no rule and no inset.
    • pub const fn inset(mut self, pad: Pad) -> Self. The padding tier between the container's edges and the footer's content, at its sides and under it.
    • pub const fn rule(mut self, on: bool) -> Self. Whether a rule separates the footer from the content beside it.
    • pub const fn place(mut self, place: FooterPlace) -> Self. Where the footer sits.
    • pub const fn gap(mut self, gap: Gap) -> Self. The space above the footer's content, inside the region.
    • pub const fn status(mut self) -> Self. The footer shows the validity message of the control the container labels as its status line.
  • craft_ui::contract::Gap: pub enum Gap { None, Row, Tight, Stack, Item, Section, CardColumn, CardRow, Inline, PageTitle, PageLead, PageActions, PageSection, PageHeading, PageLink }. The spacing between the children of a body.
  • craft_ui::contract::GlyphColon: pub enum GlyphColon { Bar, Form }. Which glyph labels take the colon of a scheme whose word labels take one.
  • craft_ui::contract::GlyphLabel: pub struct GlyphLabel. The visible form of a glyph label: an icon, or a short text such as "W" or "H".
    • pub fn icon(icon: impl Into<IconSpec<'static>>) -> Self. Shows icon, as large as the control's icons.
    • pub fn text(text: impl Into<Label>) -> Self. Shows text, resolved in the scope's language.
    • pub fn caption(text: impl Into<Label>) -> Self. Shows text that stands for a word caption: X for the horizontal position, W for the width.
  • craft_ui::contract::GridPlace: re-export of craft_ui::runtime::access::GridPlace.
  • craft_ui::contract::GroupHandle: pub struct GroupHandle<G: GroupKind>. A group form's handle, put into its body's env with content_env.
    • pub fn register(&self, member: G::Member, id: Id, enabled: bool). Registers a member's value, id and enabled state for the group's pick next pass.
    • pub fn selected(&self) -> Option<G::Member>. The group's pick this frame.
    • pub fn is(&self, value: &G::Member) -> bool. Whether value is the group's pick.
  • craft_ui::contract::GroupKind: pub trait GroupKind: 'static. The kind of a group form (radio, chip): it names the type of the members' values.
    • type Member. The value a member stands for.
  • craft_ui::contract::GroupState: pub struct GroupState<M> { pub selected: Option<M>, pub members: Vec<(M, Id, bool)> }. A group's registrations: the members shown in the last pass and the member the group picked.
  • craft_ui::contract::HeaderEdge: pub enum HeaderEdge { Start, End }. An edge of a header's line, where a container's own header parts sit.
  • craft_ui::contract::HeaderMenuRequest: pub struct HeaderMenuRequest { pub column: Option<ColumnKey>, pub at: Pos2 }. A request for the header menu: a secondary click on a header cell or on the empty header after the last one, or the Menu key on a focused header.
  • craft_ui::contract::HeaderParts: pub struct HeaderParts { pub start: f32, pub end: f32, pub end_least: Option<f32>, pub keep: f32 }. The room a container's own parts take on its header's line (Container::header_parts): a width at the start edge and one at the end edge.
    • pub const NONE: HeaderParts. No room for parts.
    • pub const fn start(mut self, width: f32) -> Self. width at the start edge.
    • pub const fn end(mut self, width: f32) -> Self. width at the end edge.
    • pub const fn end_narrows(mut self, least: f32, keep: f32) -> Self. The end edge narrows, down to least, so the header's children keep keep of the line: on a line too narrow for both, the children's least room comes before the end parts' whole width.
  • craft_ui::contract::HeaderRegion: pub struct HeaderRegion { pub band: DragBand, pub rule: bool, pub heads: bool, pub rule_above: bool, pub inline: bool, pub trailing: bool, pub fill: Option<BandFill>, pub inset: Pad, pub gap: Option<Gap> }. A header region, filled by Container::header.
    • pub const fn new() -> Self. A header with no drag band, no rule, on its own line, with no trailing region, no fill and no inset.
    • pub const fn fill(mut self, kind: SurfaceKind) -> Self. The surface of a band behind the header.
    • pub const fn tint(mut self, tone: Tone) -> Self. A band behind the header in tone's tinted fill (a slicer's caption band); the header's title row takes the tone's ink for that fill (TitleRow::tone).
    • pub const fn gap(mut self, gap: Gap) -> Self. The space between a stacked header and the body.
    • pub const fn inset(mut self, pad: Pad) -> Self. The padding tier between the container's edge and the header's content.
    • pub const fn band(mut self, band: DragBand) -> Self. What dragging the header does.
    • pub const fn rule(mut self, on: bool) -> Self. Whether a rule separates the header from the body.
    • pub const fn heads(mut self, on: bool) -> Self. Whether the header is a title that heads the body as a rule would where the app asks for it ([QuietHeader::Heads]), though it draws none.
    • pub const fn rule_above(mut self, on: bool) -> Self. Whether a rule runs above the header.
    • pub const fn inline(mut self, on: bool) -> Self. Whether the header shares a line with the body.
    • pub const fn trailing(mut self, on: bool) -> Self. Whether the header has a trailing region for the container's controls.
  • craft_ui::contract::Held: pub struct Held<'a, T>. The caller's binding of a value a pattern edits: the body reads the value at the start of its pass and returns the edited one in its result, and the caller writes it as a single set edit from Inner::settle, once per pass after the real run.
    • pub fn new(bind: Bind<'a, T>) -> Self. Holds bind.
    • pub fn read(&mut self, cx: &mut impl StageAccess) -> Option<T>. The bound value; None while a mixed or kept binding holds none.
    • pub fn write(&mut self, cx: &mut impl StageAccess, before: &T, after: T, name: &str). Replaces before with after, the edit named name.
  • craft_ui::contract::Hosted: pub trait Hosted<H: Component>. A hosted leaf of a host H, erased.
    • fn measure(&mut self, cx: &MeasureCx<'_, H>, key: HostedKey, proposal: Proposal) -> Vec2. The leaf's size at proposal, as show will show it under key.
    • fn show(self: Box<Self>, ui: &mut PaintUi<'_>, key: HostedKey, rect: Rect). Shows the leaf at rect under key and hands its output on.
    • fn role(&self) -> Role. The leaf's kind of component, for a host that places some kinds apart (a link only as wide as its text).
  • craft_ui::contract::HostedKey: pub type HostedKey = (&'static str, usize). The key a hosted leaf is measured and shown under: the slot's name and its index among the host's slots.
  • craft_ui::contract::Hover: pub struct Hover { pub over: bool, pub entered: bool, pub left: bool, pub clicked: bool }. A command-bound control's report of the pointer's stay over it.
  • craft_ui::contract::HoverLead: pub enum HoverLead { Off, Lead, LeadAndSelection }. What the pointer moving over the rows changes.
  • craft_ui::contract::Input: re-export of craft_behavior::input::Input.
  • craft_ui::contract::InsideLabel: pub struct InsideLabel. What a control shows in its slot for a side label with FieldLayout::Inside (EnvView::inside_label): the glyph, the label's tooltip and whether a drag on the slot scrubs.
    • pub const PART: PartKey. The part a control declares its slot as (PartsCx::label_part).
    • pub fn icon(&self) -> Option<&IconSpec<'static>>. The glyph's icon, for an icon glyph.
    • pub fn text(&self) -> Option<&Label>. The glyph's text, resolved in the scope's language, for a text glyph.
    • pub fn tooltip(&self) -> Option<&Tooltip>. The label's tooltip, shown over the slot.
    • pub fn scrubs(&self) -> bool. A drag on the slot scrubs the control's value.
  • craft_ui::contract::Interpolate: re-export of craft_ui::runtime::motion::Interpolate.
  • craft_ui::contract::ItemCx: pub struct ItemCx<'a, 'r, K> { pub key: &'a K, pub at: usize, pub rect: Rect, pub row: crate::contract::RowState, pub depth: usize, pub set: crate::runtime::access::SetPosition, pub row_index: usize, pub row_count: usize, pub column_count: usize, pub env: EnvView<'a> }. What the item closure reads for one item: a view over the pipeline's memory stage keyed by the item.
    • pub fn cells(&self) -> &[(craft_behavior::ColumnKey, Rect)]. The visible columns of the row with their rects.
    • pub fn column_index(&self, key: &craft_behavior::ColumnKey) -> Option<usize>. The zero-based position of column key among the columns the row shows.
    • pub fn cell(&self, key: &craft_behavior::ColumnKey) -> Option<Rect>. The rect of column key in this row.
    • pub fn grid(&self) -> Option<&craft_behavior::GridView>. The sections of a sheet layout.
    • pub fn tip(&mut self, tip: impl FnOnce(&mut Ui) + 'r). Rich tooltip content for the item; it may borrow app data.
    • pub fn detail(&mut self, body: impl FnOnce(&mut Ui) + 'r). Shows body under the item, across the content width, in a child Ui with id sub(item_id, "detail").
    • pub fn part_opener(&mut self, part: impl Into<craft_behavior::PartRef>) -> ItemOpener. The opener for the item's part part: after the collection is shown, CollectionResponse::opener gives the part's response (its click this pass and its rect), and a layer-5 menu opens from it with opened_by.
  • craft_ui::contract::ItemKeys: pub enum ItemKeys { Own, Owner }. Who takes a collection's arrow keys while it has the key focus.
  • craft_ui::contract::ItemOpener: pub struct ItemOpener. The part of one item that opens a menu or popover: ItemCx::part_opener names it and CollectionResponse::opener gives its response after the collection has been shown.
  • craft_ui::contract::ItemOutput: pub trait ItemOutput<E>: Outcome. What an item's output may report beyond its response.
    • fn into_event(self) -> Option<E>. The event the collection reports for this item, None when the item reports nothing.
    • fn open_request(&self) -> Option<super::OpenChange<()>>. The item asks to open or close its children, as a click on its disclosure does.
    • fn menu_request(&self) -> Option<egui::Rect>. The item asks for its menu from one of its parts (a row's "More" button): the part's rect, in the item's layer.
    • fn label_rect(&self) -> Option<egui::Rect>. The rect of the item's label, where a rename editor goes; None puts it over the whole row.
    • fn lead_fill(&self) -> Option<craft_theme::Rgba>. The lead item's resolved fill, which the collection uses as the background of its focus ring.
    • fn lead_focus_bounds(&self) -> Option<egui::Rect>. The lead item's focus ring bounds, in the item's layer.
  • craft_ui::contract::Job: re-export of craft_ui::runtime::pending::Job.
  • craft_ui::contract::LabelKind: pub enum LabelKind { Text, Hidden, Glyph(GlyphLabel), Short(Label) }. How a side label is shown.
  • craft_ui::contract::LabelPress: pub enum LabelPress { Focus, Link }. What a click on a control's side label does.
  • craft_ui::contract::LabelScheme: pub enum LabelScheme { Form, Inspector, Inline }. How the labelled rows under a container show their labels: set once on the container (ContainerProps::labels), read by every label step under it until another container sets its own.
  • craft_ui::contract::Lazy: pub struct Lazy. A child of a scroll area that runs only while it is in view.
    • pub fn new(key: impl Hash, estimate: f32) -> Lazy. The child keyed key in its scroll area. estimate is how long it is along the axes the area scrolls, an app's guess from what it knows without running the child; the child's real extent replaces it once it ran.
    • pub fn reveal(mut self, reveal: bool) -> Lazy. When reveal holds, the scroll area glides until the child starts at the view's start (as far as the content lets it), whether or not the child ran yet: a request of the pass that sets it, as an app's jump to an item is.
    • pub fn show<R>(self, ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> Option<R>. Runs add in a child Ui placed in flow in ui, or takes the remembered extent there; None when it did not run.
  • craft_ui::contract::LeadOnOpen: pub enum LeadOnOpen { Selected, First }. Where the lead starts when the collection first shows rows.
  • craft_ui::contract::LeadSource: pub enum LeadSource { Keys, Pointer }. What moved the lead.
  • craft_ui::contract::LeastWidth: pub enum LeastWidth { Popup, Dialog, DialogButton, DialogSideButton, Rail(std::num::NonZeroU8), WideDialog, SideMenu, DockColumn, Palette }. A size role that sets the least width of a container's content or of a button.
    • pub fn points(self, tokens: &craft_theme::Tokens) -> f32. The width the role names in tokens.
  • craft_ui::contract::LinkLabelInk: pub enum LinkLabelInk { Accent, Neutral }. The ink of a field's label shown as a link ([SideLabel::link]), which opens its control's options.
  • craft_ui::contract::LinkLabelUnderline: pub enum LinkLabelUnderline { Edge, Inside }. Where a one-line link label ([SideLabel::link]) draws its underline.
  • craft_ui::contract::ListDrag: pub struct ListDrag<K> { pub list: Id, pub keys: Vec<K>, pub grabbed: K }. What a row drag carries through the drag session (8.4).
    • pub fn new(list: Id, keys: Vec<K>, grabbed: K) -> Self. A drag of keys from list, grabbed at grabbed.
  • craft_ui::contract::Looks: pub struct Looks. Only apps write Looks: a replacement for one component type's style function, keyed by its StyleKey.
    • pub const fn new() -> Self. No replacements.
    • pub fn style<C: Component>(&mut self, f: for<'a> fn(&StyleCx<'a>, C::StyleKey) -> C::Style) -> &mut Self. Replaces the style function of C app-wide.
  • craft_ui::contract::MeasureCx: pub struct MeasureCx<'a, C: Component> { pub env: EnvView<'a>, pub style: &'a C::Style, pub resolved: &'a Resolved<'a>, pub proposal: Proposal, pub room: Option<f32>, pub ui: &'a Ui, pub tokens: &'a UiTokens, pub id: Id }. What measure reads: step 5's view of the environment, the style, the resolved props and the shown value.
    • pub fn value(&self) -> Option<&'a ValueOf<C>>. The shown value; it has the stage's lifetime, so a borrow of cx is not held.
    • pub fn wrap_limit(&self) -> Option<f32>. The enclosing container's reading-width cap, if it sets one.
    • pub fn command(&self) -> Option<&ResolvedCommand>. The bound command as step 1 resolved it, with the scoped bindings of the scopes above the component.
    • pub fn resolve_command(&self, command: impl Into<CommandRef>) -> Option<std::sync::Arc<ResolvedCommand>>. command as this component shows it: the label, icon and chord with the scoped bindings of the scopes above the component, and the enabled state of its instance. None when the command is scoped and no instance of its scope is above the component.
    • pub fn column_room(&self) -> Option<f32>. The width a component whose height follows its width (wrapped text, a square plot) sizes at: the room the parent offers, else the width the column has, or in a row the width the row has.
    • pub fn in_row(&self) -> bool. Whether the component is a direct child of a Row body, a bar's included.
    • pub fn picture_width(&self, least: f32, most: f32) -> f32. The width a band picture sizes at (a plot, a strip), one whose height is its own whatever its width: it takes the room it is offered, up to most.
    • pub fn picture_size(&self, least: f32, most: f32, height: impl FnOnce(f32) -> f32) -> Vec2. The size of a picture whose height follows from its width (a square graph, a wheel, an image at its aspect):
    • pub fn label(&self) -> Label. The label as given.
    • pub fn cell_width(&self, column: &craft_behavior::ColumnKey, width: f32). Reports, from the Ideal measure of a collection's item, the width its content in column takes unclipped, its padding included.
    • pub fn layout(&self, run: &TextRun<'_>) -> TextLayout. Lays run out in the content's room, as Draw::text will paint it.
    • pub fn layout_at(&self, run: &TextRun<'_>, width: f32) -> TextLayout. Lays run out width wide, for a text that paints in a band narrower than the room.
    • pub fn least(&self, run: &TextRun<'_>) -> LeastLayout. run, a run that elides, laid out whole and its width at its readable least ([TextRun::READABLE_CHARACTERS]): what an elidable text reports at Proposal::Min.
    • pub fn field_text(&self, run: &TextRun<'_>) -> Vec2. The room an editable text in a control sized by its text needs for run: the laid-out text and the caret the editor draws past its last letter, so the caret stays inside the control and the text never scrolls.
    • pub fn layout_doc(&self, text: &crate::primitives::DocText<'_>) -> TextLayout. Lays document text out text.wrap wide, as ContentPainterCx::layout will paint it: the galley a content painter's measure sizes its band by is the one its paint draws.
    • pub fn child<D: Show>(&self, key: impl Hash + Debug, child: &mut D, proposal: Proposal) -> Vec2. Measures a child under the composite's resolved enabled and size, as PaintUi::child will show it.
    • pub fn labelled<D: Show>(&self, key: impl Hash + Debug, side: &crate::contract::SideLabel, child: &mut D, proposal: Proposal) -> Vec2. Measures a child as PaintUi::labelled will show it with side: under the inside label side gives it (FieldLayout::Inside), and otherwise as child does.
    • pub fn face<S: Show>(&self, mut face: S) -> Vec2. The size face has when PaintUi::face shows it as the look of a part: steps 1, 2 and 4 of the face run under the composite's resolved enabled, size and sizing.
    • pub fn icon(&self) -> f32. The icon side of the component's size.
    • pub fn gap(&self) -> f32. The gap between the component's items.
  • craft_ui::contract::MemoKey: pub struct MemoKey. A 128-bit hash of a memoized view's props (SipHash-1-3 with a 128-bit output, a fixed key).
    • pub fn new() -> MemoKey. An empty key.
    • pub fn of<P: MemoProps + ?Sized>(props: &P) -> u128. The key of props.
    • pub fn changes_every_pass(&mut self). Feeds an input whose value a key cannot follow (a handle to state shared and written elsewhere, a context a container rebuilds each pass): a view whose key holds it runs in every pass.
    • pub fn write(&mut self, bytes: &[u8]). Feeds bytes.
    • pub fn write_u32(&mut self, value: u32). Feeds a length or an enum variant's index.
    • pub fn bytes(&self) -> usize. How many bytes fed the key: the view that takes the key adds them to the pass's key-byte count.
    • pub fn finish(&self) -> u128. The key of everything fed so far.
  • craft_ui::contract::MemoProps: pub trait MemoProps. Every input a memoized view reads, fed into a [MemoKey].
    • fn key(&self, key: &mut MemoKey). Feeds every input the view reads into key.
    • fn identity() -> TypeId where Self: Sized,. The props type with its lifetimes erased (Props<'a> and Props<'b> are one type): a memoized view seeds its key with it, so two views at one id whose props feed the same bytes, such as two empty props types, key apart.
  • craft_ui::contract::MemoView: pub struct MemoView<P, R>. A memoized view: its content is a fn, which captures nothing, and its props ([MemoProps]) are its only input besides the Ui, so the framework sees every input it reads.
    • pub fn new(id: impl Hash, props: P, show: fn(&mut P, &mut Ui) -> R) -> MemoView<P, R>. The view id showing props through show.
    • pub fn show(self, ui: &mut Ui) -> Option<R>. Runs the view in a child Ui placed in flow in ui, or adds its last run again.
  • craft_ui::contract::MenuKey: re-export of craft_ui::runtime::keys::MenuKey.
  • craft_ui::contract::MiddleButton: re-export of craft_behavior::middle_scroll::MiddleButton.
  • craft_ui::contract::MotionSpec: re-export of craft_ui::runtime::motion::MotionSpec.
  • craft_ui::contract::Mount: pub enum Mount { Inline, Pane(ShellPane), Layer(Overlay), FullWindow, Window { resize: Resize }, Viewport { fallback: Overlay, spec: Option<WindowSpec> } }. Where a container lives.
    • pub const fn window(resize: Resize) -> Mount. The whole content of the window: its edges resize it where resize has grips and the app draws the frame.
    • pub const fn viewport(fallback: Overlay) -> Mount. An OS viewport that falls back to fallback, and opens as a dialog or tool window by the fallback's rank.
    • pub fn viewport_with(fallback: Overlay, spec: WindowSpec) -> Mount. An OS viewport that falls back to fallback and opens as spec says.
  • craft_ui::contract::MoveBandCursor: pub enum MoveBandCursor { Hand, Arrow }. The cursor over a header's move band ([DragBand::Move]).
  • craft_ui::contract::Name: re-export of craft_ui::runtime::access::Name.
  • craft_ui::contract::NoValue: pub struct NoValue. The value type of a component with no value.
  • craft_ui::contract::Notch: pub enum Notch { Lines(f32), ViewShare(f32) }. The distance of one wheel notch.
    • pub fn wheel(self, line: f32) -> craft_behavior::WheelNotch. The wheel distance of the notch, with a text line line points high.
  • craft_ui::contract::Numeric: re-export of craft_ui::runtime::access::Numeric.
  • craft_ui::contract::OpenChange: pub struct OpenChange<K> { pub key: K, pub open: bool, pub all: bool }. A tree row opened or closed.
    • pub const fn new(key: K, open: bool) -> Self. key opens or closes.
    • pub const fn all(mut self) -> Self. The change reaches every descendant.
  • craft_ui::contract::OsFile: re-export of craft_ui::runtime::drag::OsFile.
  • craft_ui::contract::OsFiles: re-export of craft_ui::runtime::drag::OsFiles.
  • craft_ui::contract::Outbox: pub struct Outbox<'a, E>. The events a memoized view's run sends to the code around it, in the pass it runs: what its components reported (a pick, a close, a drag that started).
    • pub fn new(sent: &'a mut Vec<E>) -> Outbox<'a, E>. An outbox whose events go into sent, after what it holds.
    • pub fn send(&mut self, event: E). Sends event.
  • craft_ui::contract::Outcome: pub trait Outcome. What show returns: the component's response and the type of value it edits.
    • type Value. The value type; NoValue for a component with none.
    • fn response(&self) -> &Response. The component's response.
    • fn unshown(response: Response) -> Option<Self> where Self: Sized,. The output of a layer-like container that shows nothing this pass (closed, past its exit fade): response is its id's inert response.
    • fn value_text(&self) -> Option<&str>. The shown value as the component words it to assistive technology; None for a component that gives none.
    • fn story_facts(&self) -> crate::testing::StoryOutput. The facts a story reports about this output: its id, click, edit kinds, collection kinds and visible range.
  • craft_ui::contract::Overlay: pub struct Overlay { pub place: Place, pub fit: OverlayFit, pub min_width: MinWidth, pub movable: bool, pub drag_bounds: DragBounds, pub resize: Resize, pub rank: Rank, pub keys: OwnerClass, pub focus: FocusPolicy, pub dismiss: Dismiss, pub motion: MotionSpec, pub opener: Option<Opener>, pub popup: PopupKind, pub size: Option<Vec2>, pub size_limits: SizeLimits, pub placed: Option<Rect>, pub placed_at: Option<Pos2>, pub bounds: Option<Rect>, pub opacity: f32, pub body_scroll: bool, pub pad: Pad, pub moves_window: bool, pub moved_by_app: bool, pub continue_move: Option<Vec2>, pub role: LayerRole, pub among_windows: bool, pub off_edge: bool }. Data describing an egui layer.
    • pub fn popover() -> Overlay. A popover: a popup anchored below, from its content, at least as wide as its anchor and capped by the window, taking focus in.
    • pub fn dropdown() -> Overlay. A dropdown list: from its content, at least as wide as its anchor and capped, focus stays on the anchor, and space.pad.regular off the window's edges ([Overlay::off_edge]).
    • pub fn menu() -> Overlay. A menu: a popup the arrow keys move through.
    • pub fn submenu() -> Overlay. A submenu: beside its parent entry, opening upward from a low entry when it fits there and not below.
    • pub fn tooltip() -> Overlay. A tooltip: below the control, no focus, never takes input.
    • pub fn dialog() -> Overlay. A dialog: modal with a dimmed backdrop, floating, movable and resizable.
    • pub fn full_window(focus: FocusPolicy) -> Overlay. A modal over the whole window: a modal rank with no backdrop, from its content, with focus as its scope.
    • pub fn is_full_window(&self) -> bool. Whether the layer was made by [Overlay::full_window]; the rank and backdrop are not read.
    • pub fn modal() -> Overlay. A modal: centred, content capped.
    • pub fn modal_chrome(rect: Rect) -> Overlay. The chrome of a modal over a part of the window the modal covers, placed at rect: above the modal, with no focus policy and no dismissal of its own.
    • pub fn toast(body: Rect, corner: Align2) -> Overlay. A toast stack at corner of body, a rect in the opener's layer space: the end-bottom corner of a window's body.
    • pub fn floating() -> Overlay. A floating panel or document window: a window-rank layer that is a pane of the app.
    • pub fn resizable(mut self, on: bool) -> Overlay. Whether edge grips resize the layer.
    • pub fn resize_edges(mut self, edges: ResizeEdges) -> Overlay. Grips on the given edges only; a placement that holds an edge keeps its grip away.
    • pub fn sized_by_caller(mut self) -> Overlay. The caller sizes the layer or OS window from the resizes its grips report ([Resize::by_caller]).
    • pub fn modeless(mut self) -> Overlay. Rank Window and no backdrop.
    • pub fn place(mut self, place: Place) -> Overlay. Sets where it sits.
    • pub fn fit(mut self, fit: OverlayFit) -> Overlay. Sets how it sizes.
    • pub fn anchor(mut self, anchor: Anchor) -> Overlay. Hangs the layer from anchor on the side and alignment its preset gave.
    • pub fn size(mut self, size: Vec2) -> Overlay. Sets the size a resizable layer has before the user resizes it.
    • pub fn min_size(mut self, min_size: Vec2) -> Overlay. Sets the least a resizable layer may be resized to.
    • pub fn size_limits(mut self, limits: SizeLimits) -> Overlay. Sets the least and the most a resizable layer may be resized to.
    • pub fn placed(mut self, rect: Rect) -> Overlay. Places the layer at rect in its parent's space.
    • pub fn placed_at(mut self, pos: Pos2) -> Overlay. Places the layer's top left at pos in its parent's space and sizes it from its content and size limits, so a layer whose content grows grows with it.
    • pub fn bounds(mut self, bounds: Rect) -> Overlay. Sets the rect the layer is kept inside: where it is placed, hung or floated, and through the user's moves and resizes.
    • pub fn body_scroll(mut self, on: bool) -> Overlay. Whether a container mounted as this layer scrolls its body vertically (default on).
    • pub fn pad(mut self, pad: Pad) -> Overlay. Sets the padding OverlayUi::show puts around a popup's body closure.
    • pub fn opacity(mut self, opacity: f32) -> Overlay. Sets the layer's opacity, from 0 (invisible) to 1.
    • pub fn min_width(mut self, min_width: MinWidth) -> Overlay. Sets the narrowest width.
    • pub fn movable(mut self, on: bool) -> Overlay. Sets whether the user may move it.
    • pub fn drag_bounds(mut self, bounds: DragBounds) -> Overlay. Sets how much of the layer stays inside the window when the user moves it ([DragBounds]):
    • pub fn role(mut self, role: LayerRole) -> Overlay. Sets what the layer is for ([Overlay::role]).
    • pub fn among_windows(mut self, on: bool) -> Overlay. Sets whether the layer stands among the floating windows ([Overlay::among_windows]).
    • pub fn moves_window(mut self, on: bool) -> Overlay. Sets whether the move band moves the OS window the layer is shown in, in place of the layer.
    • pub fn moved_by_app(mut self) -> Overlay. The app moves the OS window from the move band ([Overlay::moved_by_app]).
    • pub fn continue_move(mut self, grab: Vec2) -> Overlay. The move band takes over the held primary press in this pass, with the pointer at grab inside the layer ([Overlay::continue_move]).
    • pub fn focus(mut self, focus: FocusPolicy) -> Overlay. Sets the focus scope.
    • pub fn list(mut self, list: Id) -> Overlay. The collection in a dropdown that takes its opener's list keys (FocusPolicy::list).
    • pub fn dismiss(mut self, dismiss: Dismiss) -> Overlay. Sets the dismissal rules.
    • pub fn motion(mut self, motion: MotionSpec) -> Overlay. Sets the open and close motion.
    • pub fn opened_by(mut self, anchor: &Response, trigger: Trigger) -> Overlay. Records an opener.
    • pub fn opener_anchor(mut self, anchor: Anchor) -> Overlay. Sets where the layer hangs when the opener named last opened it.
  • craft_ui::contract::OverlayUi: pub struct OverlayUi<'a> { pub closed: Vec<(Id, CloseReason)> }. What the overlay hook gets: one call per anchored popup of this component, built at step 10 with the open state of every popup cx.popup registered this pass.
    • pub fn closing(&self, popup: PopupHandle) -> Option<CloseReason>. Why popup closes at the end of this pass, as its show decided (its dismissal, or a close its body asked for); None while it stays open.
    • pub fn is_rtl(&self) -> bool. Whether a layer the owner opens lays out right to left (Scoped::layer_direction): a layer its caller places by position mirrors its own geometry by it, as an anchored placement mirrors the side.
    • pub fn anchor_part(&self, part: impl Into<PartRef>) -> Anchor. The anchor at the rect of the toggling part part of the owner.
    • pub fn contain_popups_below(&mut self). Keeps the popups this component shows from here on, and every popup opened from them, below the component:
    • pub fn show<R>(&mut self, popup: PopupHandle, overlay: Overlay, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Option<R>. Shows the popup while its handle is open, on a popup surface, inside the overlay's pad (POPUP_PAD for a menu or a list, POPOVER_PAD for a popover); the content is a body closure. None while closed.
    • pub fn show_container<C: ShowContainer, R>(&mut self, popup: PopupHandle, container: C, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R,) -> Option<Inner<C::Output, R>>. Shows container as the layer of popup, through the container pipeline: its body step with the move band and grips, its placement_changed and its close.
  • craft_ui::contract::Overlays: pub trait Overlays. The Cx trait that registers popups.
    • fn popup(&mut self, name: &'static str) -> PopupHandle. Registers the popup name of this component for this pass and returns its handle.
  • craft_ui::contract::POPOVER_PAD: pub const POPOVER_PAD: Pad. The padding of a popover's surface around its content: space.pad.regular, as a panel's, so controls stand clear of its edge.
  • craft_ui::contract::POPUP_PAD: pub const POPUP_PAD: Pad. The padding of a menu's or a list's popup surface around its rows, which carry their own inset.
  • craft_ui::contract::Pad: pub enum Pad { None, Tight, Control, Regular, Dialog, Roomy, Page }. The padding tier of a body.
  • craft_ui::contract::PadEdges: pub enum PadEdges { All, Block, Inline }. The edges a container's padding tier applies to.
  • craft_ui::contract::PaintUi: pub struct PaintUi<'a> { pub env: &'a Env }. What paint and paint_over get instead of a Ui.
    • pub fn draw(&self) -> Draw<'_>. The content-paint API: text, rules, surfaces and shapes, recorded for the later steps.
    • pub fn selectable_text(&mut self, part: impl Into<PartRef>, rect: Rect, run: &TextRun<'_>). Shows the selection part part (PartsCx::selectable_text): run in rect, painted as Draw::text paints it, with the selection behind its characters; a line wider than rect is cut at its edge.
    • pub fn draw_part(&self, part: impl Into<PartRef>) -> Draw<'_>. The content-paint API for painting part: as [draw], and when the part was declared inactive its data colours use the theme's disabled fill.
    • pub fn clipped<R>(&mut self, rect: Rect, paint: impl FnOnce(&mut Self) -> R) -> R. Runs paint with this PaintUi cut to rect (inside the clip already in force), as Draw::clipped does for a Draw: content painted whole over one pane of the component, such as a sheet's merged cell under a frozen row.
    • pub fn with_style<R>(&self, variant: Variant, f: impl FnOnce(&StyleCx<'_>) -> R) -> R. Runs f with the style context of this component's env, so app hooks called from paint pick colours and sizes through tokens as style does.
    • pub fn child<C: Show>(&mut self, key: impl Hash + Debug, rect: Rect, child: C) -> C::Output. Shows a child component at a physical rect, with id cx.key(key).
    • pub fn inner<C: Show>(&mut self, key: impl Hash + Debug, rect: Rect, child: C) -> C::Output. Shows child as the owner's own control, such as a picker the owner draws its field with.
    • pub fn label_target(&mut self, key: impl Hash + Debug). Makes the child shown with key the one a click on the composite's label focuses, in place of the composite's first stop, such as the number field of a row whose slider comes first in Tab order.
    • pub fn child_with_tip<C: Show>(&mut self, key: impl Hash + Debug, rect: Rect, child: C, tip: impl FnOnce(&mut Ui)) -> C::Output. Shows a child with rich tooltip content.
    • pub fn labelled<C: Show>(&mut self, key: impl Hash + Debug, rect: Rect, label: Label, side: SideLabel, child: C) -> C::Output. Runs the label step (B2) for one leaf child at rect: the label's placement beside or above the child, the label scope, scrub and the reset dot.
    • pub fn face<C: Show>(&mut self, part: impl Into<PartRef>, face: C). Paints face as the look of part: its style, surface and state fill from the part's state merged with the instance's flags() and the host's validity flags, then its own paint.
    • pub fn face_in<C: Show>(&mut self, part: impl Into<PartRef>, face: C, ink: &Stateful<StyleColor>). face, for a face on a fill the composite draws for that part alone (a plate over a picture): the face reads ink through StyleCx::host_ink instead of the composite's text colour.
    • pub fn face_faded<C: Show>(&mut self, part: impl Into<PartRef>, face: C, share: f32). [face] painted share as opaque as it would be (1 paints as face does, 0 paints nothing): a component fading in or out as the one component that draws it.
    • pub fn reserve_slot(&self, clip: Rect) -> PaintSlot. Reserves an empty shape at the end of the component's layer, clipped to clip, for shapes added later by code that holds no painter (PaintSlot::extend).
    • pub fn content_painter<C: ContentPainter>(&self, cx: &Cx<'_, C>) -> ContentPainterCx<'_>. The raw painter for an allowlisted content painter, clipped to the component's own rect.
  • craft_ui::contract::PaneEdge: pub enum PaneEdge { Center, Start, End, Top, Bottom }. Where a shell pane sits.
  • craft_ui::contract::PartBuilder: pub struct PartBuilder<'a>. A part as PartsCx::part declares it; the builder sets its flags.
    • pub fn drag_to_root(self) -> Self. Send a passed drag to the enclosing arena root or one of its draggable parts, retaining clicks on this part.
    • pub fn sense(self, sense: Sense) -> Self. What the part senses; hover only by default.
    • pub fn priority(self, priority: HitPriority) -> Self. The part's level and sub-level in the resolve order.
    • pub fn stacking(self, order: u32) -> Self. The part's stacking order: stacked parts of one priority rank by it before the nearest centre, the higher winning.
    • pub fn cursor(self, cursor: impl Into<Cursor>) -> Self. The cursor while the pointer is over the part.
    • pub fn drag_cursor(self, cursor: CursorIcon) -> Self. The cursor while the part is dragged.
    • pub fn focusable(self) -> Self. The part is a focus stop.
    • pub fn inactive(self, inactive: bool) -> Self. The part is inactive (a switched-off clip): it paints with the Disabled state, and a Draw from PaintUi::draw_part fills data colours with the theme's disabled fill.
    • pub fn held(self, held: bool) -> Self. The component holds a press on the part that the part does not sense itself (a collection's press on a row's toggle cell): the part paints pressed.
    • pub fn selected(self) -> Self. The part is the arrival of the component's part roving group: Tab and Shift+Tab into the group land here, not on the first member.
    • pub fn nudges(self) -> Self. The focused part takes the arrow keys, with any modifier, as nudges of its content (Intents::take_nudge), wherever it sits: in a collection item too.
    • pub fn default_stop(self) -> Self. The part's stop is its scope's default (Initial::Default); the scope focuses the first default stop in tab order.
    • pub fn exclusive(self, hit: crate::runtime::windows::WindowHit) -> Self. The part is what hit says for the OS window: its move area, one of its edge zones or a caption button.
    • pub fn focus_shape(self, shape: FocusShape) -> Self. The shape the focus ring takes around the part.
    • pub fn flags(self, flags: Flags) -> Self. Value flags of the part, merged into its state at step 12 and its sub-node at step 16.
    • pub fn over(self) -> Self. The part sits above the body or items in the stacking order and is painted by paint_over.
    • pub fn exact_hit(self) -> Self. The part's hit area is its shape as declared, never grown to the pointer's target size (size.hit.target): a frame's resize grip, whose band is sized as its reach and whose neighbours (a title row, the content) own every point beside it.
    • pub fn state_layer(self) -> Self. The part's look is the plain state layer: the paint step fills its rect with StyleCx::state_layer in the part's state, under the component's paint, with control corners.
    • pub fn tooltip(self, tooltip: impl Into<Tooltip>) -> Self. The part's tooltip.
    • pub fn value_part(self) -> Self. The part shows the component's value: a double click on it resets the value, as one on the root does.
    • pub fn own_reset(self) -> Self. A reset aimed at the part (Reset while it is the focused part, a double click on it) does not reset the binding: Cx::reset_part names the part and update proposes the value with that part at its own default.
    • pub fn node(self, role: crate::runtime::access::Role, name: impl Into<String>) -> Self. The part reports an access node of role, named name, for a part the component paints no face for.
    • pub fn pointer_only(self, reason: &'static str) -> Self. A part with no focus stop names its keyboard path: the intent or command that does the same.
    • pub fn holds_drafts(self) -> Self. The part's area keeps a focused text draft unapplied on a press.
    • pub fn toggles(self, popup: &'static str) -> Self. The part opens and closes the component's popup popup (the name given to cx.popup): a press on it toggles the popup, so press, drag and release over a row picks it, and a click leaves it open (on_click acts on the release instead), AccessKit Expand and Collapse on its sub-node open and close it, Alt+Down from the part (or from the component when no toggling part is focused) opens the first toggled popup that is closed and Alt+Up closes the open ones, and the sub-node reports expanded.
    • pub fn keyboard_via(self, part: PartKey) -> Self. A part with no focus stop of its own does the same as the focusable part part of this component, which carries the keyboard path.
  • craft_ui::contract::PartsCx: pub struct PartsCx<'a, C: Component> { pub content_rect: Rect, pub flow: Flow }. Step 7's context: the step-5 read view plus the rect geometry and the part builders.
    • pub fn header_slot(&self, edge: crate::contract::HeaderEdge) -> Option<Rect>. The slot at edge of the header's line that Container::header_parts keeps for the container's own parts; None when it keeps none there.
    • pub fn header_part(&mut self, edge: crate::contract::HeaderEdge, part: impl Into<PartRef>, shape: impl Into<HitShape>) -> PartBuilder<'_>. Declares a part in the header slot at edge.
    • pub fn rect_of(&self, key: &C::Key) -> Option<Rect>. The rect of the item key this pass, in the coordinates the item step lays rows out in (a transformed collection's, before the transform). None for an item the step does not build: neither in view nor kept.
    • pub fn offset(&self) -> craft_behavior::ScrollPos. How far the rows are scrolled this pass.
    • pub fn rows_view(&self) -> Option<Rect>. Where the rows show this pass, less the scroll bar while it shows.
    • pub fn hovered(&self) -> bool. Last pass's pointer-over state of this component, so parts can register hover-revealed parts.
    • pub fn focus_visible(&self) -> bool. Last pass's focus-visible state of this component.
    • pub fn gesture_running(&self) -> bool. The component's value gesture runs: begun in an earlier pass and not yet committed or cancelled.
    • pub fn press_slot<T: Slot>(&self) -> Option<T>. A copy of the component's press slot as update left it (Remember::press_slot), so the parts can follow the open press as its handling does. None with nothing held, and for a collection's member.
    • pub fn part(&mut self, part: impl Into<PartRef>, shape: impl Into<HitShape>) -> PartBuilder<'_>. Declares a part; a repeated part is named with its index: cx.part(POINT.at(id), shape).
    • pub fn label_part(&mut self, rect: Rect). Declares rect, the slot where the component shows its inside label (EnvView::inside_label), as the label's part (InsideLabel::PART): it shows the label's tooltip and, for a scrubbing label, takes the press a Scrub::by_label scrubs with, in edit too.
    • pub fn roving(&mut self, roving: Roving). Declares a roving group over part and child keys.
    • pub fn scroll(&mut self, key: PartKey, rect: Rect, axis: Axis, span: ScrollSpan). Declares one axis's scroll bar: the track as part key and the thumb as part key.at(THUMB), inside rect.
  • craft_ui::contract::Pattern: re-export of craft_ui_macros::Pattern (outside these crates).
  • craft_ui::contract::Pending: re-export of craft_ui::runtime::pending::Pending.
  • craft_ui::contract::PendingDrop: pub enum PendingDrop<K> { Reorder(ReorderMove<K>), Drop(DropAt<K>) }. The drop a release would make on a collection now.
  • craft_ui::contract::PlainData: re-export of craft_tracked::PlainData (outside these crates).
  • craft_ui::contract::Pointer: pub trait Pointer. Pointer state and requests (chapter 8).
    • fn part(&self, part: impl Into<PartRef>) -> &PartResult. The result of part this pass: idle for a part first registered this frame.
    • fn part_if_declared(&self, part: impl Into<PartRef>) -> Option<&PartResult>. The result of part this pass, None when parts did not declare it: for parts that exist only under a condition.
    • fn hover_pos(&self, part: impl Into<PartRef>) -> Option<Pos2>. Where the pointer is over part this pass, in the component's layer space; None when part is not hovered.
    • fn press(&self) -> &PressState. The component's own press.
    • fn hit(&self) -> bool. The pointer is over the component's own shapes.
    • fn hover(&self) -> Hover. The pointer's stay over the component: over it, entered, left, and clicked while it has stayed over.
    • fn activation(&self) -> Option<Activation>. Set only when the component's own shapes won the press and it was released as a click, or Intent::Activate was routed to it.
    • fn activated_member(&self) -> Option<Id>. For an arena root, the member activated this pass.
    • fn take_wheel(&mut self) -> Option<Wheel>. This pass's wheel share, once, with the pointer it came at (Wheel::at) in this component's egui layer space (8.3).
    • fn take_multi_tap(&mut self) -> Option<MultiTap>. This pass's tap, once, when it lies in this component's rect and this component (an arena root with its members) wins a press there.
    • fn mark_wheel_moved(&mut self). Marks the wheel gesture this component owns, while it runs, as moved (its view changed): later shares of the gesture report Wheel::moved.
    • fn ease_wheel(&mut self, pan: Vec2) -> Vec2. Feeds pan, the line pan this pass gave, to this component's wheel ease and returns the eased step for this pass. Vec2::ZERO on a pass with no line pan lets owed motion keep paying.
    • fn stop_wheel_ease(&mut self). Drops this component's wheel ease and the motion it owes.
    • fn cursor(&mut self, cursor: impl Into<Cursor>, priority: CursorPriority). Requests cursor at priority; the highest priority of the pass wins.
    • fn cancel_press(&mut self, reason: PressCancel). Ends every captured press of this viewport.
    • fn start_drag<P: Clone + Send + Sync + 'static>(&mut self, payload: P, preview: DragPreview). Starts the drag session with payload; the context holds one session at a time, and a running one stays.
    • fn start_drag_also<P: Clone + Send + Sync + 'static>(&mut self, payload: P, also: Vec<Arc<dyn std::any::Any + Send + Sync>>, preview: DragPreview,). Starts the drag session with payload, which also carries the payloads also, one per type: targets of any of these types see the one drag.
    • fn dragging<P: Send + Sync + 'static>(&self) -> Option<(Arc<P>, Pos2)>. The active drag payload of type P and the pointer position in this component's egui layer space (8.3), from any viewport.
    • fn drop_target<P: Send + Sync + 'static, T: DropTarget<P>>(&mut self, target: &T) -> Option<T::Drop>. Registers target over this component's rect for this pass, in update.
    • fn window_drop_target<P: Send + Sync + 'static, T: WindowDropTarget<P>>(&mut self, target: &T) -> Option<T::Drop>. Registers target over the whole window of the running viewport for this pass, in update; a target over a component beats it wherever that accepts.
    • fn drag_ended<P: Send + Sync + 'static>(&self) -> Option<DropOperation>. The operation of a drop of this component's payload, in the pass after the drop; None while dragging, when the drag was cancelled and when no target took it.
    • fn scroll_moved(&self, key: PartKey) -> Option<Range<f64>>. The visible range the scroll part key moved to this pass (thumb or end drag, page press, or an AccessKit click on the track, which pages toward the track's centre).
  • craft_ui::contract::Politeness: re-export of craft_ui::runtime::access::Politeness.
  • craft_ui::contract::Popup: pub struct Popup. The open state of a container's layer that has an opener and no binding, driven from the opener's side.
    • pub fn open<C: Component>(opener: impl Into<Id>, cx: &mut Cx<'_, C>). Opens the container hung from opener (a [PopupHandle] or the id of the opener's response).
    • pub fn close<C: Component>(opener: impl Into<Id>, cx: &mut Cx<'_, C>). Closes the container hung from opener.
    • pub fn toggle<C: Component>(opener: impl Into<Id>, cx: &mut Cx<'_, C>). Opens the container hung from opener when it is closed, else closes it.
    • pub fn opening<C: Component>(popup: PopupHandle, cx: &Cx<'_, C>) -> bool. Whether the layer popup shows first in this pass: true in the passes of the frame it first shows, false in the frames after, so what a body resets on opening resets once.
  • craft_ui::contract::PopupHandle: pub struct PopupHandle. An id and a name; Copy, never a snapshot of the open state.
    • pub fn at(self, index: usize) -> PopupHandle. The popup of the repeat index of this name: a component with one popup per part or per entry gives each its own.
    • pub fn id(self) -> Id. The popup's id: its open state's and its entry in the layer stack.
    • pub fn name(self) -> &'static str. The name given to cx.popup.
    • pub fn trigger<C: Component>(self, trigger: Trigger, cx: &mut Cx<'_, C>). Toggles or opens the popup from trigger at step 9, as the pass's pending open change.
    • pub fn open<C: Component>(self, cx: &mut Cx<'_, C>). Queues an open that step 15 writes.
    • pub fn close<C: Component>(self, cx: &mut Cx<'_, C>). Queues a close; step 15 writes the slot, so this pass still shows the popup open.
    • pub fn changed<C: Component>(self, cx: &mut Cx<'_, C>) -> bool. Whether a toggle, open or close queued in this pass leaves the popup's open state different from the state the pass began with.
    • pub fn bind_open<C: Component>(self, cx: &mut Cx<'_, C>, mut open: BindMut<'_, bool>) -> bool. Binds the popup's open state to open: call it in update, after the toggles and closes the component queues.
    • pub fn is_open<C: Component>(self, cx: &mut Cx<'_, C>) -> bool. Whether the popup is open in this pass: valid from step 8, with the changes queued so far applied.
  • craft_ui::contract::PopupKind: re-export of craft_ui::runtime::access::PopupKind.
  • craft_ui::contract::Presence: re-export of craft_ui::runtime::motion::Presence.
  • craft_ui::contract::Progress: re-export of craft_ui::runtime::pending::Progress.
  • craft_ui::contract::Props: re-export of craft_ui_macros::Props (outside these crates).
  • craft_ui::contract::QuietHeader: pub enum QuietHeader { Ruled, Heads }. Whether a titled header that draws no rule under it (a quiet title, [HeaderRegion::heads]) still heads its body as a rule would.
  • craft_ui::contract::Remember: re-export of craft_ui::runtime::memory::Remember.
  • craft_ui::contract::Rename: pub struct Rename<K> { pub key: K, pub name: String }. A committed rename.
    • pub fn new(key: K, name: impl Into<String>) -> Self. The rename of key to name.
  • craft_ui::contract::ReorderKeys: re-export of craft_behavior::keys::ReorderKeys.
  • craft_ui::contract::ReorderMove: pub struct ReorderMove<K> { pub key: K, pub keys: Vec<K>, pub to: usize, pub copy: bool, pub parent: Option<K> }. A reorder: the items keys move together, and the first of them lands at position to.
    • pub fn new(key: K, keys: Vec<K>, to: usize, copy: bool) -> Self. A move of keys (key among them) to position to at the top level.
    • pub fn in_group(mut self, parent: Option<K>) -> Self. The items land in the group parent, None for the top level.
  • craft_ui::contract::ReorderRule: pub struct ReorderRule { pub copy: Option<CopyKeys>, pub into_groups: bool, pub keys: ReorderKeys }. How the user may reorder items.
    • pub const fn new() -> Self. A rule that only moves.
    • pub const fn keys(mut self, keys: ReorderKeys) -> Self. The key scheme that reorders the items.
    • pub const fn into_groups(mut self) -> Self. Items may land inside the groups of a tree.
    • pub const fn copy_with(mut self, keys: CopyKeys) -> Self. A drag with keys held copies: [CopyKeys::Alt] in a design app's layers, [CopyKeys::Platform] (Ctrl off macOS) in a file or page grid.
  • craft_ui::contract::Resolved: pub struct Resolved<'p> { pub id: Id, pub label: &'p str, pub enabled: bool, pub read_only: bool, pub size: ControlSize, pub variant: Variant, pub selected: Option<bool>, pub description: Option<&'p str>, pub tooltip: Option<&'p Tooltip>, pub doc_key: Option<DocKey> }. Common after step 1; it borrows locals of the pipeline frame, never the component.
    • pub fn sizing(&self) -> Option<Sizing>. The sizing the host set on this component, if any: a leaf with Sizing::Content sizes to its content.
    • pub fn tooltip_text(&self, env: &crate::runtime::env::EnvView<'_>) -> Option<String>. The text of the component's own tooltip as the tooltip shows it: its disabled text while the component is disabled. None when the component has no tooltip.
  • craft_ui::contract::Revision: re-export of craft_tracked::Revision (outside these crates).
  • craft_ui::contract::Role: re-export of craft_ui::runtime::access::Role.
  • craft_ui::contract::RowAlign: pub enum RowAlign { Start, Center, End, SpaceBetween }. Where a Row places its block of children along the row.
  • craft_ui::contract::RowHeight: pub enum RowHeight { Control, Text }. How tall a collection's rows are.
    • pub fn of(self, cx: &StyleCx<'_>) -> f32. The height of one row under cx.
  • craft_ui::contract::RowPressed: pub enum RowPressed { Row, Cell(ColumnKey), Part { was_lead: bool } }. Where the collection holds a primary press on a row, within slop, or the press a part of the row holds.
  • craft_ui::contract::RowPreview: pub enum RowPreview { Badge, Named, None }. What a row drag shows while it runs.
  • craft_ui::contract::RowState: pub struct RowState { pub selected: bool, pub lead: bool, pub drop_target: bool, pub dragging: bool, pub renaming: bool, pub emphasized: bool, pub current: bool, pub striped: bool, pub open: bool, pub hovered: bool, pub pointer_over: bool, pub pressed: Option<RowPressed>, pub menu_open: bool, pub sub_row: Option<usize>, pub continued: bool, pub last: bool, pub first: bool, pub activated_by_key: bool }. What an item reads of its place in the collection; the item step joins it to the item's flags at step 12.
  • craft_ui::contract::Sampler: pub trait Sampler: sealed::Host. The canvas reach under a modal layer (15.5, 8.3): a control of a dialog keeps the canvas below it usable.
    • fn pass_canvas_gesture(&mut self, canvas: Id, gesture: CanvasGesture). Lets gesture on canvas (the canvas component's id) through the modal layer, and the view navigation with it (keep_view_open): an armed eyedropper's press ([CanvasGesture::PRIMARY]), a dialog's drag on the image, a ⌘-click (CanvasGesture::PRIMARY.with(Mods::CMD)).
    • fn keep_view_open(&mut self, canvas: Id). Keeps the view of canvas (the canvas component's id) usable under the modal layer: the wheel scrolls and zooms it, and a middle press pans it, as in Photoshop's Color Picker and Levels dialogs; Space held over the canvas adds the primary press for the pan.
  • craft_ui::contract::Savable: re-export of craft_ui::runtime::memory::Savable.
  • craft_ui::contract::SaveKey: re-export of craft_ui::runtime::memory::SaveKey.
  • craft_ui::contract::Scroll: pub struct Scroll { pub axes: ScrollAxes, pub anchor: ScrollAnchor, pub notch: Notch, pub indicator: ScrollIndicator, pub at_rest: bool }. A scrolling body.
    • pub const fn strips(mut self) -> Scroll. Shows the overflow along y as scroll strips instead of a bar.
    • pub const fn has_strips(&self) -> bool. Whether the overflow along y shows as scroll strips.
    • pub const fn overlay(mut self) -> Scroll. Shows the overflow as a bar in the container's padding that takes no room from the content and shows only under the pointer ([ScrollIndicator::Overlay]).
    • pub const fn has_overlay(&self) -> bool. Whether the overflow shows as an overlay bar.
    • pub const fn at_rest(mut self) -> Scroll. Shows an overlay bar whenever the content overflows, also while the pointer is away from the container.
    • pub const fn overlay_hides_at_rest(&self) -> bool. Whether the overlay bar shows only while the pointer is over the container or presses the bar.
    • pub const fn vertical() -> Scroll. Scrolls along y.
    • pub const fn horizontal() -> Scroll. Scrolls along x.
    • pub const fn both() -> Scroll. Scrolls along both axes.
    • pub const fn anchored_end(mut self) -> Scroll. Stays at the end when the content grows.
    • pub const fn notch(mut self, notch: Notch) -> Scroll. The distance of one wheel notch.
    • pub const fn horizontal_on(&self) -> bool. Whether the x axis scrolls.
    • pub const fn vertical_on(&self) -> bool. Whether the y axis scrolls.
  • craft_ui::contract::ScrollAnchor: pub enum ScrollAnchor { Start, End }. Which end of the content a scroll region stays at when the content grows.
  • craft_ui::contract::ScrollAxes: pub enum ScrollAxes { Vertical, Horizontal, Both }. The axes a body scrolls on.
  • craft_ui::contract::ScrollIndicator: pub enum ScrollIndicator { Bar, Strips, Overlay }. How a scrolling body shows that its content overflows.
  • craft_ui::contract::Scrub: pub struct Scrub<V>. How a drag changes a control's value: the drag maths over the control's number, and the sources a drag starts on (by_label, on_field, part).
    • pub fn new(drag: ValueDrag, read: impl Fn(&V) -> f64 + Send + Sync + 'static, write: impl Fn(f64) -> V + Send + Sync + 'static) -> Self. A scrub by drag, reading the number a value holds with read and making a value of a number with write.
    • pub fn by_label(mut self) -> Self. A drag on the control's side label scrubs, with or without the focus in the control; the label senses the drag from the pass after the control first declared it.
    • pub fn part(mut self, part: impl Into<PartRef>, drag: ValueDrag) -> Self. A drag on the part part scrubs by drag, with or without the focus in the control: a scrub handle, or an opener whose drag moves the value as far as its popup's control would.
    • pub fn on_field(mut self) -> Self. A drag on the control's body scrubs while its text part does not take the pointer: a field that is not in edit.
  • craft_ui::contract::SectionRhythm: pub enum SectionRhythm { Tight, Spaced }. The room around the rule above a header ([HeaderRegion::rule_above]), as a Section has.
  • craft_ui::contract::SelectMode: pub enum SelectMode { None, Single, Multi, Cells }. What a collection lets the user select.
  • craft_ui::contract::SetPosition: re-export of craft_ui::runtime::access::SetPosition.
  • craft_ui::contract::SettleCx: pub struct SettleCx<'a>. The body's memory after the real run: the same Remember access the body's context has, and the Held and Bind reads and writes that take it.
  • craft_ui::contract::ShellPane: pub struct ShellPane { pub name: &'static str, pub edge: PaneEdge, pub extent: Option<f32>, pub at: Option<Rect> }. One of AppShell's panes.
    • pub const fn new(name: &'static str) -> Self. The central pane named name.
    • pub const fn edge(mut self, edge: PaneEdge) -> Self. The pane at edge.
    • pub const fn extent(mut self, extent: f32) -> Self. The pane's size along its edge, exactly: the pane host shows it at this extent in every pass.
    • pub const fn at(mut self, rect: Rect) -> Self. The pane in rect, which the caller laid out for this pass.
  • craft_ui::contract::ShownRow: pub struct ShownRow<K> { pub key: K, pub id: egui::Id, pub rect: egui::Rect, pub cells: Vec<(ColumnKey, egui::Rect)>, pub openers: Vec<(crate::contract::ItemOpener, Response)>, pub hovered: bool }. The geometry of one row the collection showed this pass.
  • craft_ui::contract::SideLabel: pub struct SideLabel { pub kind: LabelKind, pub layout: FieldLayout, pub role: FieldLabelRole, pub scrub: bool, pub reset_dot: bool, pub icon: Option<IconSpec<'static>>, pub detail: Option<Label>, pub tooltip: Option<Tooltip>, pub press: LabelPress }. What ContainerProps.label holds: how the label is shown and what it does.
    • pub const fn new() -> Self. A text label beside its control that names it.
    • pub fn kind(mut self, kind: LabelKind) -> Self. How the label is shown.
    • pub const fn layout(mut self, layout: FieldLayout) -> Self. Where the label sits.
    • pub const fn role(mut self, role: FieldLabelRole) -> Self. Whether the label names or describes its control.
    • pub const fn link(mut self) -> Self. Shows the label as a link: a click reports to the control's host (Cx::link_activated) and leaves focus alone.
    • pub const fn scrub(mut self, on: bool) -> Self. Lets a drag on the label scrub the control's value.
    • pub const fn reset_dot(mut self, on: bool) -> Self. Shows a dot after the text while the control's value differs from its reset value; a click on it resets the value.
    • pub fn icon(mut self, icon: impl Into<IconSpec<'static>>) -> Self. Shows icon before the text.
    • pub fn detail(mut self, detail: impl Into<Label>) -> Self. Shows detail after the text, in the muted text colour, and adds it to the control's description.
    • pub fn tooltip(mut self, tooltip: impl Into<Tooltip>) -> Self. Shows tooltip over the label in place of its text, and adds it to the label's description.
  • craft_ui::contract::SizeLimits: pub struct SizeLimits { pub min: Vec2, pub max: Option<Vec2> }. Size limits, in points: the smallest size and, where there is one, the largest.
    • pub const BOUND: f32. The largest value a limit or a height may have: a value above it is invalid.
    • pub const fn new(min: Vec2, max: Vec2) -> Self. Limits between min and max.
    • pub const fn at_least(min: Vec2) -> Self. No smaller than min, with no maximum.
    • pub const fn at_most(max: Vec2) -> Self. No larger than max, with no minimum.
    • pub fn around(self, extra: Vec2) -> Self. The limits of a frame that holds a size with these limits and extra around it: both ends grow by extra.
    • pub fn clamp(self, size: Vec2) -> Vec2. size within these limits; the minimum wins over a smaller maximum.
    • pub fn valid(self) -> bool. Whether every value is finite and non-negative, the maximum is no less than the minimum and no value is above [Self::BOUND].
  • craft_ui::contract::Sizing: pub enum Sizing { Fill, FillWidth, Content, FillHeight }. How a container's size follows its content.
    • pub const fn content_width(self) -> bool. Whether the width follows the content: Content and FillHeight.
    • pub const fn fills_height(self) -> bool. Whether the height is the available height: Fill and FillHeight.
  • craft_ui::contract::Slot: re-export of craft_ui::runtime::memory::Slot.
  • craft_ui::contract::SpaceAction: pub enum SpaceAction { Activate, ActivateLead, ToggleCell, Preview, None }. What Space does in a collection (Enter always activates the lead).
  • craft_ui::contract::Stateless: pub struct Stateless<F>. A callback in props: a fn item or a capture-free closure, which is zero-sized, so its type alone says what it does, and its TypeId keys it.
    • pub const fn new(f: F) -> Stateless<F>. f as a prop; f must capture nothing.
    • pub fn get(&self) -> F. The callback.
  • craft_ui::contract::Styled: pub trait Styled. The resolved look (chapter 4); every method reads step 12's output.
    • fn state(&self) -> &StateSet. The state set.
    • fn root_state(&self) -> StateSet. The root's own state: the hover and press of the root without those of its parts, for a control whose parts each paint their own state (a split button's main part).
    • fn ink(&self) -> Ink. The ink the surface reads in.
    • fn resolve<T: Mix>(&self, look: &Stateful<T>) -> T. The value of look for the component's state set.
    • fn resolve_part<T: Mix>(&self, part: impl Into<PartRef>, look: &Stateful<T>) -> T. The value of look for the state set of part.
  • craft_ui::contract::SubNode: re-export of craft_ui::runtime::access::SubNode.
  • craft_ui::contract::SweepApply: pub struct SweepApply. The one consumer of a toggle column's events (CollectionEvent::Toggle), for a host that applies a sweep live.
    • pub fn new() -> Self. A plain column: Alt is ignored.
    • pub fn show_only() -> Self. A column where Alt plus the first press shows only that cell.
    • pub fn claims(mut self, mods: craft_keymap::Mods) -> Self. A first press with exactly mods held belongs to the host: it flips nothing, and the cells its drag crosses give nothing (SweepStep::Claimed).
    • pub fn shows_only(&self) -> bool. Whether this is a [SweepApply::show_only] column, where Alt plus the first press shows only that cell.
    • pub fn gesture(&self) -> Option<GestureId>. The first gesture of the running sweep, which a host that groups a sweep's edits as one undo step uses as the id of all of them. None between sweeps.
    • pub fn feed<K: Clone>(&mut self, edit: &EditEvent<ToggleEdit<K>>) -> Option<SweepStep<K>>. The step for edit, if it asks the host for one. Commit repeats what its Update already applied.
  • craft_ui::contract::SweepStep: pub enum SweepStep<K> { Flip(ToggleEdit<K>), ShowOnly(ToggleEdit<K>), Restore(ToggleEdit<K>), UndoShowOnly(ToggleEdit<K>), Claimed(ToggleEdit<K>) }. What a host does for one toggle event, from [SweepApply::feed].
  • craft_ui::contract::ThemeScope: pub struct ThemeScope. Token-changing values for a container: the container itself (its surface, header, rules, scroll bars, pads and focus ring), its regions and body, and every layer opened from them resolve their tokens from another theme definition, mode, contrast or density.
    • pub fn new() -> Self. A scope that changes nothing: every value is inherited.
    • pub fn theme(mut self, def: Arc<ThemeDef>) -> Self. Resolves from def: a draft in a theme editor, a theme in a preview card.
    • pub fn mode(mut self, mode: Mode) -> Self. Resolves in mode: a plot that is dark in every theme, a preview of the other mode.
    • pub fn contrast(mut self, contrast: Contrast) -> Self. Resolves under contrast.
    • pub fn density(mut self, density: Size) -> Self. Resolves at the density preset density.
  • craft_ui::contract::ToggleColumn: pub struct ToggleColumn { pub sweepable: bool, pub exclusive: bool, pub key: Option<Chord> }. A toggle column: its cells flip by click, and a drag across them sweeps one value over all of them.
    • pub const fn sweepable() -> Self. A sweepable toggle column (eye, lock, mute).
    • pub const fn exclusive() -> Self. An exclusive toggle column: one cell is on at a time, and a drag does not sweep.
    • pub const fn key(mut self, chord: Chord) -> Self. The column with chord as its key.
  • craft_ui::contract::ToggleEdit: pub struct ToggleEdit<K> { pub key: K, pub column: ColumnKey, pub on: bool, pub mods: craft_keymap::Mods }. A toggle column's cell flipped.
  • craft_ui::contract::Tooltip: pub struct Tooltip. A tooltip: one type for components and parts.
    • pub fn spec(&self) -> &TooltipSpec. What the tooltip shows and when.
  • craft_ui::contract::TooltipAt: pub enum TooltipAt { Control, Pointer }. Where a tooltip appears.
  • craft_ui::contract::TooltipSpec: pub struct TooltipSpec { pub text: Label, pub disabled_text: Option<Label>, pub at: TooltipAt, pub when: TooltipWhen }. What a tooltip shows and when.
    • pub fn new(text: impl Into<Label>) -> Self. A tooltip of text under the control, after the hover delay.
    • pub fn disabled_text(mut self, text: impl Into<Label>) -> Self. The text shown while the control is disabled.
    • pub const fn at(mut self, at: TooltipAt) -> Self. Where it appears.
    • pub const fn when(mut self, when: TooltipWhen) -> Self. When it appears.
  • craft_ui::contract::TooltipWhen: pub enum TooltipWhen { Hover, Now }. When a tooltip appears.
  • craft_ui::contract::Tracked: re-export of craft_tracked::Tracked (outside these crates).
  • craft_ui::contract::Trigger: pub enum Trigger { Click, Press, Context, Hover, Hold, Manual }. How a free-standing popup's trigger fires.
  • craft_ui::contract::Tween: re-export of craft_ui::runtime::motion::Tween.
  • craft_ui::contract::Validity: pub type Validity<T> = craft_behavior::Validity<T, Message>. What a check says about a value, with the message type of craft-ui.
  • craft_ui::contract::ValueOf: pub type ValueOf<C> = <<C as super::Component>::Output as Outcome>::Value. The value type of C's output.
  • craft_ui::contract::WindowDropTarget: re-export of craft_ui::runtime::drag::WindowDropTarget.
  • craft_ui::contract::WordSetCx: pub trait WordSetCx. The label a component shows and the built-in text it reads (chapter 19).
    • fn label(&self) -> Label. The label as given, a cheap clone.
    • fn words<L: WordSet + Send + Sync + 'static>(&self) -> Arc<L>. The word set L in the language of the scope; built once per installed Words.
    • fn format(&self) -> &Format. How the scope writes numbers: locale digits, separators and grouping.
  • craft_ui::contract::WrapWidth: pub enum WrapWidth { Dialog, Column }. A size role that sets the line length of the paragraphs in a container whose width comes from its content: a wrapping text breaks its lines there when its room is wider, and content wider than it still widens the container.
    • pub fn points(self, tokens: &craft_theme::Tokens) -> f32. The width the role names in tokens.
  • craft_ui::contract::announce: pub fn announce(ctx: &Context, text: impl Into<String>, politeness: Politeness). Announces text; for code without a context.
  • craft_ui::contract::bind_tracked: re-export of craft_ui::bind_tracked (defined outside these crates).
  • craft_ui::contract::clicked: pub fn clicked(response: &Response) -> bool. Whether response reports a click, by pointer or by keyboard activation.
  • craft_ui::contract::item_node: pub fn item_node<K: std::hash::Hash>(id: Id, key: &K) -> Id. The access node of the item key of the members collection id (a tab strip, a swatch table): the sub-node of its item part, which focused_node reports while the item is the lead of the focused collection.
  • craft_ui::contract::item_part_open: pub fn item_part_open(ctx: &Context, item: Id, part: impl Into<craft_behavior::PartRef>) -> bool. Whether a menu or popover hung from the part part of the item item (ItemCx::part_opener) is open: an item keeps such a part shown while its menu is.
  • craft_ui::contract::keep_inside: pub fn keep_inside(rect: Rect, bounds: Rect) -> Rect. rect moved, at its size, the least distance that puts it inside bounds: the one keep rule for a layer's bounds, whether the user moves the layer or the host places it, and the window's under the default DragBounds::Inside.
  • craft_ui::contract::measure_item: pub fn measure_item<C>(ui: &mut Ui, item: &mut C, at: crate::runtime::access::SetPosition, proposal: craft_behavior::Proposal) -> Vec2 where C: super::Component + super::Props + super::Show,. Measures item as the item at at of a set, under the id and the item facts [show_item] shows it with.
  • craft_ui::contract::pressed: pub fn pressed(response: &Response) -> bool. Whether a pointer press went down on response's component and is still held.
  • craft_ui::contract::register_contract: re-export of craft_ui_macros::register_contract (outside these crates).
  • craft_ui::contract::request_rename: pub fn request_rename<K: Clone + Send + Sync + 'static>(ctx: &Context, collection: Id, key: &K). Asks the collection collection (the id it is built with, Props::id) to start renaming the item key.
  • craft_ui::contract::response_of: pub fn response_of(ui: &Ui, id: Id) -> Option<Response>. The Response of the component id in the running pass: its root's egui widget, or the response its arena gives a member of one (a component in a collection's rows or in an arena body, which registers no egui widget).
  • craft_ui::contract::scroll_step: pub fn scroll_step(ctx: &Context, owner: Id, view: Rect, units: &[Rect], right: bool) -> bool. Steps the scrolling body owner by one of its units: toward the right of the screen (right) or the left. view is the rect the body shows this pass and units the rects of the units its content is made of (a ribbon's groups), in any order.
  • craft_ui::contract::section_part: pub fn section_part<K: std::hash::Hash>(key: &K) -> craft_behavior::PartRef. The part of a collection that stands for the section row key (ItemSource::section_stop): the item step builds no row for it, so the access node that AccessKit focus goes to while the section holds the lead, and the pointer part over it, are this part of the collection.
  • craft_ui::contract::show_item: pub fn show_item<C>(ui: &mut Ui, rect: Rect, item: C, at: crate::runtime::access::SetPosition) -> C::Output where C: super::Component + super::Props + super::Show,. Shows item in rect as the item at at of a set, with the item facts a collection installs.
  • craft_ui::contract::show_item_in_flow: pub fn show_item_in_flow<C>(ui: &mut Ui, item: C, at: crate::runtime::access::SetPosition) -> C::Output where C: super::Component + super::Props + super::Show,. Shows item in the flow of ui as the item at at of a set, taking the room the flow gives it.
  • craft_ui::contract::spec: re-export of the module craft_ui::runtime::motion::spec.
  • craft_ui::contract::step_stop: pub fn step_stop(stops: &[usize], from: Option<usize>, forward: bool) -> Option<usize>. The stop one step from the entry at from (a position in the entries), toward the end when forward.
  • craft_ui::contract::step_stops: pub fn step_stops<T>(entries: &[Entry<T>]) -> Vec<usize>. The positions of the entries a step over a closed control stops on ([Entry::is_stepped]), in order.

craft_ui::contract::ghost

The ghost layer's content (8.4, 8.5): the running drag's preview beside the pointer, the mark of the drop target that would take the payload (with the payload's name inside a region mark, for a drag that names it), and the painted pointer the cursor service settled on, which goes to the window as its cursor image instead where the window takes one.

  • craft_ui::contract::ghost::paint: pub fn paint(ctx: &Context). The end hook's painter of the ghost layer: pass it to InstallSpec::frame_layers.
  • craft_ui::contract::ghost::readout: pub fn readout(ctx: &Context, env: &EnvView<'_>, at: Pos2, rows: &[(Label, String)]). Paints rows of a label and a value beside the pointer at at, on the ghost layer, in env's tokens, words and direction: the env of the region that asks, for this pass only.

craft_ui::contract::overlay

Chapter 15: the Overlay data, its presets, popup handles, OverlayUi and the overlay host.

  • craft_ui::contract::overlay::Anchor: pub enum Anchor { Rect(Rect), Response, Point(Pos2), Pointer, Corner(Rect, Align2), Parent }. Where an overlay hangs from.
  • craft_ui::contract::overlay::Dismiss: pub struct Dismiss { pub outside: Outside, pub enter: bool, pub focus_left: bool, pub on_activate: bool, pub anchor_gone: bool, pub commands: bool, pub timeout: Option<f32> }. When a layer closes by itself.
    • pub const fn new() -> Self. An outside press or a command closes; nothing else does.
    • pub const fn outside(mut self, outside: Outside) -> Self. Sets what an outside press does.
    • pub const fn enter(mut self, on: bool) -> Self. Closes on an untaken Enter.
    • pub const fn focus_left(mut self, on: bool) -> Self. Closes when focus leaves the scope.
    • pub const fn on_activate(mut self, on: bool) -> Self. Closes when a component inside is activated, except an opener toggling its popup.
    • pub const fn commands(mut self, on: bool) -> Self. Closes when a key, a native menu pick or the palette runs a command from outside it; off for a layer its host opens and closes, as a dock panel's flyout.
    • pub const fn timeout(mut self, seconds: Option<f32>) -> Self. Closes after seconds.
  • craft_ui::contract::overlay::DragBounds: pub enum DragBounds { Inside, TitleVisible }. How much of a floating layer stays inside the window: the whole layer (Inside, the default) or a strip of its title.
  • craft_ui::contract::overlay::FloatPlace: pub struct FloatPlace { pub pos: Option<Pos2>, pub corner: Align2, pub top: Option<f32> }. Where a floating layer sits.
    • pub const fn centred() -> Self. Centred in the viewport.
    • pub const fn top_centered(share: f32) -> Self. Centered across the viewport, with its top share of the viewport's height down from the viewport's top, so a layer whose content grows or shrinks keeps its top edge where it is.
    • pub const fn at(pos: Pos2) -> Self. With its left-top at pos.
    • pub const fn corner_at(pos: Pos2, corner: Align2) -> Self. With its corner at pos.
  • craft_ui::contract::overlay::HOLD: pub const HOLD: f64. The seconds a press must be held for Trigger::Hold.
  • craft_ui::contract::overlay::LayerRole: re-export of craft_ui::runtime::overlay::LayerRole.
  • craft_ui::contract::overlay::OpenFilter: re-export of craft_ui::runtime::overlay::OpenFilter.
  • craft_ui::contract::overlay::Opener: pub struct Opener { pub id: Id, pub rect: Rect, pub layer: areas::Layer, pub trigger: Trigger, pub enabled: bool, pub anchor: Option<Anchor>, pub others: Vec<Opener> }. A component that opens a free-standing popup, and how.
  • craft_ui::contract::overlay::Outside: pub enum Outside { Close, Keep, Absorb }. What a press outside the layer and its anchor does.
  • craft_ui::contract::overlay::Overlay: pub struct Overlay { pub place: Place, pub fit: OverlayFit, pub min_width: MinWidth, pub movable: bool, pub drag_bounds: DragBounds, pub resize: Resize, pub rank: Rank, pub keys: OwnerClass, pub focus: FocusPolicy, pub dismiss: Dismiss, pub motion: MotionSpec, pub opener: Option<Opener>, pub popup: PopupKind, pub size: Option<Vec2>, pub size_limits: SizeLimits, pub placed: Option<Rect>, pub placed_at: Option<Pos2>, pub bounds: Option<Rect>, pub opacity: f32, pub body_scroll: bool, pub pad: Pad, pub moves_window: bool, pub moved_by_app: bool, pub continue_move: Option<Vec2>, pub role: LayerRole, pub among_windows: bool, pub off_edge: bool }. Data describing an egui layer.
    • pub fn popover() -> Overlay. A popover: a popup anchored below, from its content, at least as wide as its anchor and capped by the window, taking focus in.
    • pub fn dropdown() -> Overlay. A dropdown list: from its content, at least as wide as its anchor and capped, focus stays on the anchor, and space.pad.regular off the window's edges ([Overlay::off_edge]).
    • pub fn menu() -> Overlay. A menu: a popup the arrow keys move through.
    • pub fn submenu() -> Overlay. A submenu: beside its parent entry, opening upward from a low entry when it fits there and not below.
    • pub fn tooltip() -> Overlay. A tooltip: below the control, no focus, never takes input.
    • pub fn dialog() -> Overlay. A dialog: modal with a dimmed backdrop, floating, movable and resizable.
    • pub fn full_window(focus: FocusPolicy) -> Overlay. A modal over the whole window: a modal rank with no backdrop, from its content, with focus as its scope.
    • pub fn is_full_window(&self) -> bool. Whether the layer was made by [Overlay::full_window]; the rank and backdrop are not read.
    • pub fn modal() -> Overlay. A modal: centred, content capped.
    • pub fn modal_chrome(rect: Rect) -> Overlay. The chrome of a modal over a part of the window the modal covers, placed at rect: above the modal, with no focus policy and no dismissal of its own.
    • pub fn toast(body: Rect, corner: Align2) -> Overlay. A toast stack at corner of body, a rect in the opener's layer space: the end-bottom corner of a window's body.
    • pub fn floating() -> Overlay. A floating panel or document window: a window-rank layer that is a pane of the app.
    • pub fn resizable(mut self, on: bool) -> Overlay. Whether edge grips resize the layer.
    • pub fn resize_edges(mut self, edges: ResizeEdges) -> Overlay. Grips on the given edges only; a placement that holds an edge keeps its grip away.
    • pub fn sized_by_caller(mut self) -> Overlay. The caller sizes the layer or OS window from the resizes its grips report ([Resize::by_caller]).
    • pub fn modeless(mut self) -> Overlay. Rank Window and no backdrop.
    • pub fn place(mut self, place: Place) -> Overlay. Sets where it sits.
    • pub fn fit(mut self, fit: OverlayFit) -> Overlay. Sets how it sizes.
    • pub fn anchor(mut self, anchor: Anchor) -> Overlay. Hangs the layer from anchor on the side and alignment its preset gave.
    • pub fn size(mut self, size: Vec2) -> Overlay. Sets the size a resizable layer has before the user resizes it.
    • pub fn min_size(mut self, min_size: Vec2) -> Overlay. Sets the least a resizable layer may be resized to.
    • pub fn size_limits(mut self, limits: SizeLimits) -> Overlay. Sets the least and the most a resizable layer may be resized to.
    • pub fn placed(mut self, rect: Rect) -> Overlay. Places the layer at rect in its parent's space.
    • pub fn placed_at(mut self, pos: Pos2) -> Overlay. Places the layer's top left at pos in its parent's space and sizes it from its content and size limits, so a layer whose content grows grows with it.
    • pub fn bounds(mut self, bounds: Rect) -> Overlay. Sets the rect the layer is kept inside: where it is placed, hung or floated, and through the user's moves and resizes.
    • pub fn body_scroll(mut self, on: bool) -> Overlay. Whether a container mounted as this layer scrolls its body vertically (default on).
    • pub fn pad(mut self, pad: Pad) -> Overlay. Sets the padding OverlayUi::show puts around a popup's body closure.
    • pub fn opacity(mut self, opacity: f32) -> Overlay. Sets the layer's opacity, from 0 (invisible) to 1.
    • pub fn min_width(mut self, min_width: MinWidth) -> Overlay. Sets the narrowest width.
    • pub fn movable(mut self, on: bool) -> Overlay. Sets whether the user may move it.
    • pub fn drag_bounds(mut self, bounds: DragBounds) -> Overlay. Sets how much of the layer stays inside the window when the user moves it ([DragBounds]):
    • pub fn role(mut self, role: LayerRole) -> Overlay. Sets what the layer is for ([Overlay::role]).
    • pub fn among_windows(mut self, on: bool) -> Overlay. Sets whether the layer stands among the floating windows ([Overlay::among_windows]).
    • pub fn moves_window(mut self, on: bool) -> Overlay. Sets whether the move band moves the OS window the layer is shown in, in place of the layer.
    • pub fn moved_by_app(mut self) -> Overlay. The app moves the OS window from the move band ([Overlay::moved_by_app]).
    • pub fn continue_move(mut self, grab: Vec2) -> Overlay. The move band takes over the held primary press in this pass, with the pointer at grab inside the layer ([Overlay::continue_move]).
    • pub fn focus(mut self, focus: FocusPolicy) -> Overlay. Sets the focus scope.
    • pub fn list(mut self, list: Id) -> Overlay. The collection in a dropdown that takes its opener's list keys (FocusPolicy::list).
    • pub fn dismiss(mut self, dismiss: Dismiss) -> Overlay. Sets the dismissal rules.
    • pub fn motion(mut self, motion: MotionSpec) -> Overlay. Sets the open and close motion.
    • pub fn opened_by(mut self, anchor: &Response, trigger: Trigger) -> Overlay. Records an opener.
    • pub fn opener_anchor(mut self, anchor: Anchor) -> Overlay. Sets where the layer hangs when the opener named last opened it.
  • craft_ui::contract::overlay::OverlayFit: pub enum OverlayFit { Content, Resizable, ContentCapped(ViewportShare) }. How an egui layer sizes.
  • craft_ui::contract::overlay::OverlayUi: pub struct OverlayUi<'a> { pub closed: Vec<(Id, CloseReason)> }. What the overlay hook gets: one call per anchored popup of this component, built at step 10 with the open state of every popup cx.popup registered this pass.
    • pub fn closing(&self, popup: PopupHandle) -> Option<CloseReason>. Why popup closes at the end of this pass, as its show decided (its dismissal, or a close its body asked for); None while it stays open.
    • pub fn is_rtl(&self) -> bool. Whether a layer the owner opens lays out right to left (Scoped::layer_direction): a layer its caller places by position mirrors its own geometry by it, as an anchored placement mirrors the side.
    • pub fn anchor_part(&self, part: impl Into<PartRef>) -> Anchor. The anchor at the rect of the toggling part part of the owner.
    • pub fn contain_popups_below(&mut self). Keeps the popups this component shows from here on, and every popup opened from them, below the component:
    • pub fn show<R>(&mut self, popup: PopupHandle, overlay: Overlay, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Option<R>. Shows the popup while its handle is open, on a popup surface, inside the overlay's pad (POPUP_PAD for a menu or a list, POPOVER_PAD for a popover); the content is a body closure. None while closed.
    • pub fn show_container<C: ShowContainer, R>(&mut self, popup: PopupHandle, container: C, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R,) -> Option<Inner<C::Output, R>>. Shows container as the layer of popup, through the container pipeline: its body step with the move band and grips, its placement_changed and its close.
  • craft_ui::contract::overlay::Overlays: pub trait Overlays. The Cx trait that registers popups.
    • fn popup(&mut self, name: &'static str) -> PopupHandle. Registers the popup name of this component for this pass and returns its handle.
  • craft_ui::contract::overlay::Place: pub enum Place { Anchored { anchor: Anchor, side: Side, align: Align, flips_across: bool, offset: egui::Vec2, clear: Option<egui::Rect>, covers: bool }, Float(FloatPlace) }. Where an egui layer sits.
    • pub const fn anchored(anchor: Anchor, side: Side, align: Align) -> Self. An anchored place.
    • pub const fn flipping_across(self) -> Self. The place, beside its anchor, lining up with the anchor's other end when that fits and the aligned end does not.
    • pub fn offset(mut self, by: egui::Vec2) -> Self. The place shifted by by from where it would sit; no change off Anchored.
    • pub fn covering_anchor(mut self) -> Self. The place, below or above its anchor, sliding over the anchor when it fits on neither side; no change off Anchored.
    • pub fn clear_of(mut self, rect: egui::Rect) -> Self. The place keeping clear of rect; no change off Anchored.
  • craft_ui::contract::overlay::PlacementChange: pub struct PlacementChange { pub rect: Rect, pub phase: GesturePhase, pub pointer: Option<Pos2>, pub kind: PlacementKind, pub continued: bool }. A move or resize of a layer the user made, or of the OS window a viewport mount shows in, reported to Container::placement_changed.
  • craft_ui::contract::overlay::PlacementKind: pub enum PlacementKind { Move, Size(ResizeEdge), Keyboard }. What kind of gesture a PlacementChange reports.
  • craft_ui::contract::overlay::Popup: pub struct Popup. The open state of a container's layer that has an opener and no binding, driven from the opener's side.
    • pub fn open<C: Component>(opener: impl Into<Id>, cx: &mut Cx<'_, C>). Opens the container hung from opener (a [PopupHandle] or the id of the opener's response).
    • pub fn close<C: Component>(opener: impl Into<Id>, cx: &mut Cx<'_, C>). Closes the container hung from opener.
    • pub fn toggle<C: Component>(opener: impl Into<Id>, cx: &mut Cx<'_, C>). Opens the container hung from opener when it is closed, else closes it.
    • pub fn opening<C: Component>(popup: PopupHandle, cx: &Cx<'_, C>) -> bool. Whether the layer popup shows first in this pass: true in the passes of the frame it first shows, false in the frames after, so what a body resets on opening resets once.
  • craft_ui::contract::overlay::PopupHandle: pub struct PopupHandle. An id and a name; Copy, never a snapshot of the open state.
    • pub fn at(self, index: usize) -> PopupHandle. The popup of the repeat index of this name: a component with one popup per part or per entry gives each its own.
    • pub fn id(self) -> Id. The popup's id: its open state's and its entry in the layer stack.
    • pub fn name(self) -> &'static str. The name given to cx.popup.
    • pub fn trigger<C: Component>(self, trigger: Trigger, cx: &mut Cx<'_, C>). Toggles or opens the popup from trigger at step 9, as the pass's pending open change.
    • pub fn open<C: Component>(self, cx: &mut Cx<'_, C>). Queues an open that step 15 writes.
    • pub fn close<C: Component>(self, cx: &mut Cx<'_, C>). Queues a close; step 15 writes the slot, so this pass still shows the popup open.
    • pub fn changed<C: Component>(self, cx: &mut Cx<'_, C>) -> bool. Whether a toggle, open or close queued in this pass leaves the popup's open state different from the state the pass began with.
    • pub fn bind_open<C: Component>(self, cx: &mut Cx<'_, C>, mut open: BindMut<'_, bool>) -> bool. Binds the popup's open state to open: call it in update, after the toggles and closes the component queues.
    • pub fn is_open<C: Component>(self, cx: &mut Cx<'_, C>) -> bool. Whether the popup is open in this pass: valid from step 8, with the changes queued so far applied.
  • craft_ui::contract::overlay::PopupRegion: pub struct PopupRegion(pub Option<Rect>). The screen rect the popups opened in an env are contained in, and the popups opened from those: the menus of a menu bar stay below the bar (OverlayUi::contain_popups_below). None, the root's, lets popups take the whole safe rect.
    • pub fn new(region: Option<Rect>) -> Self. Popups contained in region; None lets them take the whole safe rect.
  • craft_ui::contract::overlay::Resize: pub struct Resize { pub edges: ResizeEdges, pub by_caller: bool }. How the user may resize a layer.
    • pub const NONE: Resize. The layer keeps its size.
    • pub const GRIPS: Resize. Grips on every free edge and corner.
    • pub fn edges(edges: ResizeEdges) -> Resize. Grips on the given edges only.
  • craft_ui::contract::overlay::ResizeEdges: pub struct ResizeEdges. A set of layer edges.
    • pub const LEFT: ResizeEdges. The left edge.
    • pub const RIGHT: ResizeEdges. The right edge.
    • pub const TOP: ResizeEdges. The top edge.
    • pub const BOTTOM: ResizeEdges. The bottom edge.
    • pub const ALL: ResizeEdges. Every edge.
    • pub const NONE: ResizeEdges. No edge.
    • pub const fn contains(self, other: ResizeEdges) -> bool. Whether every edge of other is in this set.
    • pub const fn union(self, other: ResizeEdges) -> ResizeEdges. The edges of both sets.
  • craft_ui::contract::overlay::SizeLimits: pub struct SizeLimits { pub min: Vec2, pub max: Option<Vec2> }. Size limits, in points: the smallest size and, where there is one, the largest.
    • pub const BOUND: f32. The largest value a limit or a height may have: a value above it is invalid.
    • pub const fn new(min: Vec2, max: Vec2) -> Self. Limits between min and max.
    • pub const fn at_least(min: Vec2) -> Self. No smaller than min, with no maximum.
    • pub const fn at_most(max: Vec2) -> Self. No larger than max, with no minimum.
    • pub fn around(self, extra: Vec2) -> Self. The limits of a frame that holds a size with these limits and extra around it: both ends grow by extra.
    • pub fn clamp(self, size: Vec2) -> Vec2. size within these limits; the minimum wins over a smaller maximum.
    • pub fn valid(self) -> bool. Whether every value is finite and non-negative, the maximum is no less than the minimum and no value is above [Self::BOUND].
  • craft_ui::contract::overlay::Trigger: pub enum Trigger { Click, Press, Context, Hover, Hold, Manual }. How a free-standing popup's trigger fires.
  • craft_ui::contract::overlay::ViewportShare: pub struct ViewportShare { pub x: f32, pub y: f32 }. A fraction of the viewport per axis.
    • pub const fn new(x: f32, y: f32) -> Self. A share of x of the width and y of the height.
  • craft_ui::contract::overlay::any_open: re-export of craft_ui::runtime::overlay::any_open.
  • craft_ui::contract::overlay::close_popups: re-export of craft_ui::runtime::overlay::close_popups.
  • craft_ui::contract::overlay::family: re-export of craft_ui::runtime::overlay::family.
  • craft_ui::contract::overlay::is_open: re-export of craft_ui::runtime::overlay::is_open.
  • craft_ui::contract::overlay::layer_room: pub fn layer_room(ctx: &Context) -> Rect. The room a layer opened in the running viewport may take, in its points: the work area around a palette window, whose layers show in popup windows of their own (windows::popup_room), else the window's safe rect.
  • craft_ui::contract::overlay::opened_from: pub fn opened_from(ctx: &egui::Context, opener: Id) -> bool. Whether the container hung from the opener opener (the id of its response, [Overlay::opened_by]) is open, as its slot holds it: an opener reports its expanded state by it.
  • craft_ui::contract::overlay::paint_frame_layers: pub fn paint_frame_layers(ctx: &Context). Paints the ghost egui layer from runtime data: the drag preview and drop mark, and the painted cursor the cursor service settled on.
  • craft_ui::contract::overlay::request_close: re-export of craft_ui::runtime::overlay::request_close.
  • craft_ui::contract::overlay::top: re-export of craft_ui::runtime::overlay::top.

craft_ui::contract::shape

The shapes of component: which show trait applies.

  • craft_ui::contract::shape::Body: pub struct Body. A component whose caller supplies a body closure.
  • craft_ui::contract::shape::Items: pub struct Items. A component that shows an item per visible entry of a source.
  • craft_ui::contract::shape::Leaf: pub struct Leaf. A component with no body and no items.

craft_ui::contract::toast

The toast host (15.5): one layer per window root (its id derives from the scope of the root's body) that lays out the window's queued toasts at the end-bottom corner of its body and tracks their holds and ends.

  • craft_ui::contract::toast::CardOutcome: pub struct CardOutcome { pub hovered: bool, pub end: Option<ToastEnd> }. What a drawn card reports back to the host.
    • pub fn new(hovered: bool, end: Option<ToastEnd>) -> Self. A card the pointer rests on when hovered, which the user ended as end.
  • craft_ui::contract::toast::ToastHost: pub struct ToastHost. The layer that shows the toast queue of a window.
    • pub fn show(ui: &Ui, window: &WindowKey, body: Rect, card: &mut dyn FnMut(&mut Ui, &Toast, IdSalt) -> CardOutcome). Lays out every queued toast of window, oldest at the top, at the end-bottom corner of body (a rect of ui's layer), and draws each with card(ui, toast, salt), where salt is stable for the card.
    • pub fn show_at(ui: &Ui, window: &WindowKey, body: Rect, alignment: Option<Align2>, card: &mut dyn FnMut(&mut Ui, &Toast, IdSalt) -> CardOutcome). Shows the queue at a bottom alignment of its body, or at the locale's trailing bottom corner when None.

craft_ui::contract::tooltip

contract::tooltip: the one step-16 function that shows every tooltip (3.4, 15.5).

  • craft_ui::contract::tooltip::DELAY: pub const DELAY: f64. Seconds the pointer rests on a component before its tooltip shows.
  • craft_ui::contract::tooltip::GRACE: pub const GRACE: f64. Seconds after a tooltip hides during which the next one shows at once.
  • craft_ui::contract::tooltip::TipStyle: pub struct TipStyle. The look of a tooltip card.
  • craft_ui::contract::tooltip::at_pointer: pub fn at_pointer(ui: &Ui, owner: egui::Id, tip: Option<&Tooltip>, at: Option<egui::Pos2>, pressed: bool). Shows tip at the pointer for a surface whose tips have no part of their own (a canvas tool's hover tip): the same delay, grace, look and hiding as a component's tooltip, placed at the pointer whatever the tip's at says.
  • craft_ui::contract::tooltip::attach: pub fn attach(response: &egui::Response, tooltip: &Tooltip). Shows tooltip for a raw egui response during the app migration: the same delay, grace and placement as a component's tooltip, none of its pipeline.
  • craft_ui::contract::tooltip::with_chord: pub fn with_chord(base: &str, chord: &craft_keymap::Chord, os: craft_keymap::Platform) -> String. A tooltip's text followed by the chord that does the same, as every tooltip shows a key: "Hide Layers (⌘,)".

craft_ui::layout

The layout services: LabelColumn, ColumnGroup, the Grid cursor, measure_slot and arrange.

  • craft_ui::layout::BodyLayout: pub enum BodyLayout { Stack, Row { wrap: bool, align: RowAlign }, Grid { columns: Cow<'static, [ColumnWidth]>, fit: GridFit, cells: CellAlign } }. How a body lays out its children, in reading order: mirrored under a right-to-left direction.
    • pub const fn stack() -> Self. Children one under another.
    • pub const fn row() -> Self. Children side by side from the start edge, with no wrap.
    • pub fn grid(columns: impl Into<Cow<'static, [ColumnWidth]>>) -> Self. Children row-major over columns: a 'static slice, or columns built in the pass.
    • pub fn fit(self, fit: GridFit) -> Self. A Grid with fit; any other layout is unchanged.
    • pub fn cells(self, cells: CellAlign) -> Self. A Grid with cells; any other layout is unchanged.
    • pub fn wrap(self, on: bool) -> Self. A Row that wraps; any other layout is unchanged.
    • pub fn align(self, align: RowAlign) -> Self. A Row with align; any other layout is unchanged.
  • craft_ui::layout::CellAlign: pub enum CellAlign { Center, Top }. Where a Grid sets a cell that is shorter than its row.
  • craft_ui::layout::ColumnGroup: pub struct ColumnGroup. The widest content per column key of one scope, measured through the same LayoutMemory rule as a Grid Content column.
    • pub fn scope<R>(ui: &mut Ui, key: impl Hash + Debug, rows: impl FnOnce(&mut Ui, &mut ColumnGroup) -> R) -> R. Runs rows with a group named key under ui.
    • pub fn barrier<R>(ui: &mut Ui, rows: impl FnOnce(&mut Ui) -> R) -> R. Runs rows with no group open: a labelled row inside reads no column, whatever group is open outside.
    • pub fn width(&mut self, ui: &Ui, column: &ColumnKey, content: f32) -> f32. The width every row gives column column: the widest content this pass's measuring run found, or in that run the widest so far. content is this row's own width.
  • craft_ui::layout::GridFit: pub enum GridFit { Stack, Fixed }. What a Grid does when the least widths of its columns do not fit beside each other in its room.
  • craft_ui::layout::Placed: pub struct Placed<'c>. A keyed child for arrange; shown once, under the id derived from the key.
    • pub fn new<C: Show + 'c>(key: impl Hash + Debug + 'c, child: C) -> Self. A child shown under the id key derives from the arranging Ui.
    • pub fn response(&self) -> Option<&Response>. The child's response after arrange showed it.
  • craft_ui::layout::RowAlign: pub enum RowAlign { Start, Center, End, SpaceBetween }. Where a Row places its block of children along the row.
  • craft_ui::layout::ShrinkOrder: pub enum ShrinkOrder { Even, FromEnd }. Which units of a row too long for its room give way first.
  • craft_ui::layout::ShrinkUnit: pub struct ShrinkUnit { pub ideal: f32, pub least: f32 }. The widths of a unit of a row that shrinks to fit: the width it asks for and the least it narrows to.
    • pub const fn new(ideal: f32, least: f32) -> Self. A unit that asks for ideal and narrows to least.
  • craft_ui::layout::arrange: pub fn arrange(ui: &mut Ui, layout: &dyn Arrangement, children: &mut [Placed<'_>]) -> Rect. Places children by layout in the rest of ui and shows each once.
  • craft_ui::layout::control_baseline: pub fn control_baseline(ctx: &egui::Context, id: Id, label: Vec2, label_baseline: f32) -> Option<f32>. The control's first baseline from its top, as record_control_baseline stored it last pass.
  • craft_ui::layout::empty_cell: pub fn empty_cell(ui: &mut Ui). Leaves the next cell of the Grid body that encloses ui directly empty: the next child takes the cell after it.
  • craft_ui::layout::levelled_unit: pub fn levelled_unit(ui: &mut Ui, key: Id, levels: usize, mut show: impl FnMut(&mut Ui, usize)). Shows show, one unit of the unwrapped Row body around it that fits in discrete levels (a ribbon group: full, compact, collapsed), at the level the row's shrink step gave it. levels is how many levels the unit has; show shows it at a level from 0 (the widest) to levels - 1, and must be free of side effects in a measuring run, as every row body is: the row's counting sweep runs it once per level to measure each, in an invisible sizing pass.
  • craft_ui::layout::measure_slot: pub fn measure_slot(ui: &mut Ui, width: f32, body: impl FnOnce(&mut Ui)) -> Vec2. Runs body in an invisible sizing pass width wide and returns the size it took.
  • craft_ui::layout::place_label: pub fn place_label(ui: &Ui, id: Id, column: &LabelColumn, flow: Flow, label: Vec2, label_baseline: f32) -> LabelPlacement. Places a label of label size with baseline label_baseline and the control of the row id in flow's rect.
  • craft_ui::layout::plan_levels: pub fn plan_levels(units: &[Vec<f32>], room: f32) -> Vec<usize>. The level of each unit of a row whose units show in discrete levels, for room. units holds each unit's width at each of its levels, widest (level 0) first.
  • craft_ui::layout::record_control_baseline: pub fn record_control_baseline(ui: &Ui, id: Id, baseline: f32). Stores the distance from the top of the control of the row id to its first baseline, for the next pass's place_label.
  • craft_ui::layout::shrink_widths: pub fn shrink_widths(units: &[ShrinkUnit], fixed: f32, room: f32, order: ShrinkOrder) -> Vec<f32>. The widths of the units of a row whose units, with fixed (its other children and gaps), ask for more than room:

craft_ui::layout_components

The layout components Stack, Row and Grid: containers with no surface, header or footer whose body lays its children out (6.3).

  • craft_ui::layout_components::LayoutStyle: pub struct LayoutStyle. The style of the layout components: no minimum size, and padding only at the start edge, one space.pad.regular per level of indent.

craft_ui::primitives

Painters, Draw, the sensing core, the text adapter and ImeSurface.

  • craft_ui::primitives::AppIcons: pub struct AppIcons { pub name: &'static str, pub stroke_width: Option<f32>, pub icons: &'static [(&'static str, &'static [u8])], pub fills: &'static [(&'static str, &'static [u8], [u8; 4])] }. An app's own icon set: SVG documents drawn beside the built-in catalog in every IconSet.
    • pub const fn new(name: &'static str, stroke_width: Option<f32>, icons: &'static [(&'static str, &'static [u8])]) -> Self. The set name of icons, each an icon name and its SVG document, drawn with stroke_width when it is Some.
    • pub const fn with_fills(mut self, fills: &'static [(&'static str, &'static [u8], [u8; 4])]) -> Self. The set with fills: for each icon name, an SVG drawn under the icon in a fixed sRGBA colour.
  • craft_ui::primitives::AutoScrollMark: pub struct AutoScrollMark. The auto-scroll mark painter.
    • pub fn shapes(look: &AutoScrollMarkLook, anchor: Pos2) -> Vec<Shape>. The mark centred on anchor: the ring, the dot, and an arrowhead above and below, all sized from the look's diameter.
  • craft_ui::primitives::COLORED_TEXT_LIMIT: pub const COLORED_TEXT_LIMIT: usize. The longest text, in bytes, a part colours: a longer one is laid out in its plain ink, and its [ColorRanges] is not called.
  • craft_ui::primitives::CachedTexture: pub struct CachedTexture { pub id: TextureId, pub size: PixelSize, pub origin: [u32; 2], pub page: PixelSize }. A stored picture as a painter draws it: painter.image(texture.id, rect, uv, tint).
    • pub fn uv(&self) -> Rect. The picture's part of its page texture, in uv coordinates, to paint with id: the full rect for an unpacked texture.
    • pub fn size_vec2(&self) -> Vec2. size as a vector, for fitting: only the aspect matters to a cell.
    • pub fn sized(&self) -> SizedTexture. The texture with its size, the form PreviewPane and egui's image widgets take.
  • craft_ui::primitives::Checker: pub struct Checker { pub size: Option<f32>, pub light: Option<DataColor>, pub dark: Option<DataColor> }. The cells of the transparency checkerboard: their side and the two colours.
    • pub const fn new() -> Self. The theme's checker.
    • pub const fn size(mut self, size: f32) -> Self. Cells of size points.
    • pub const fn colors(mut self, light: DataColor, dark: DataColor) -> Self. The light and dark colours.
    • pub fn polygon_shape(&self, ctx: &Context, tokens: &UiTokens, corners: &[Pos2], origin: Pos2) -> Shape. The checkerboard over the convex polygon corners as one textured mesh, a light cell with its top-left corner at origin: the cells follow the polygon's edge, which a rect's clip cannot.
    • pub fn shape(&self, ctx: &Context, tokens: &UiTokens, area: CheckerArea, origin: Pos2) -> Shape. The checkerboard over area as one textured shape: square cells of the light and dark colours, a light cell with its top-left corner at origin.
  • craft_ui::primitives::CheckerArea: pub enum CheckerArea { Rect(Rect, CornerRadius), Quad([Pos2; 4]) }. Where a [Checker] paints.
  • craft_ui::primitives::ChordText: pub struct ChordText. A chord formatted for the OS, as one text run laid out as its own left-to-right run.
    • pub fn new(formatted: impl Into<String>) -> Self. A chord already formatted by craft-keymap's pure function over craft_keymap::layout.
    • pub fn run(&self) -> TextRun<'_>. The chord as a run laid out left to right in any direction.
    • pub fn isolated(&self) -> String. The chord isolated as a left-to-right run (LRI ... PDI) for use inside a longer label.
  • craft_ui::primitives::ColorRange: pub struct ColorRange { pub range: Range<usize>, pub ink: RangeInk }. One stretch of a text in an ink of its own: range is in bytes of the text the [ColorRanges] was given.
    • pub fn new(range: Range<usize>, ink: RangeInk) -> Self. The bytes range in ink.
  • craft_ui::primitives::ColorRanges: pub type ColorRanges = dyn Fn(&str) -> Vec<ColorRange>. The colour ranges of a text (TextOptions::color_ranges): called with the text each time the part lays it out, which is every frame the part shows.
  • craft_ui::primitives::Completer: pub trait Completer: Send + Sync. Completion candidates for a text part.
    • fn complete(&self, text: &str, caret: usize, out: &mut Vec<Completion>) -> Option<Range<usize>>. The candidates for the text before the caret, and the byte range they replace.
  • craft_ui::primitives::Completion: pub struct Completion { pub label: Label, pub insert: String, pub mark: Option<Label>, pub description: Option<Label> }. One completion candidate.
    • pub fn new(label: impl Into<Label>, insert: impl Into<String>) -> Self. A candidate shown as label that inserts insert.
    • pub fn mark(mut self, mark: impl Into<Label>) -> Self. Sets the mark before the label.
    • pub fn description(mut self, description: impl Into<Label>) -> Self. Sets the description shown while the candidate is highlighted.
  • craft_ui::primitives::ContentPainterCx: pub struct ContentPainterCx<'a> { pub painter: Painter }. The raw painter of an allowlisted content painter, clipped to its rect.
    • pub fn ink(&self) -> Color32. The colour of text and glyphs on the surface being painted: the resolved content-text colour Draw paints text with.
    • pub fn stroke_width(&self, width: StrokeWidth) -> f32. The width in points of a named stroke width on this display, as Draw::stroke strokes it: a content painter that strokes with the raw painter takes its widths here, so a hairline stays one physical pixel.
    • pub fn faded(&self, share: f32, paint: impl FnOnce(&ContentPainterCx<'_>)). Runs paint with a ContentPainterCx whose painting is share as opaque as it would be: the fade Draw::faded applies (fades multiply; a value outside 0 to 1 is clamped and a non-finite one leaves the opacity as it was).
    • pub fn clipped(&self, rect: egui::Rect, paint: impl FnOnce(&ContentPainterCx<'_>)). Runs paint with a ContentPainterCx whose painting is clipped to rect (inside the clip it already has).
    • pub fn layout(&self, text: &DocText<'_>) -> TextLayout. The one sanctioned text layout for content painters: document runs with their own font, size and colour, laid out by the call TextRun::layout uses.
    • pub fn words<L: WordSet + Send + Sync + 'static>(&self) -> Arc<L>. The word set L in the language of the scope the painter paints for.
    • pub fn format(&self) -> &Format. How the scope the painter paints for writes numbers.
  • craft_ui::primitives::Dashes: pub struct Dashes { pub dash: f32, pub gap: f32, pub phase: f32 }. The lengths of a dashed stroke, in points along the path.
    • pub fn new(dash: f32, gap: f32) -> Self. Dashes of dash with gaps of gap, starting at the pattern's beginning.
    • pub fn even(length: f32) -> Self. Dashes of length with gaps of the same length, starting at the pattern's beginning.
    • pub fn phase(mut self, phase: f32) -> Self. The pattern advanced by phase points.
  • craft_ui::primitives::DataStrokeWidth: pub enum DataStrokeWidth { Named(StrokeWidth), Data(DataWidth) }. The width of a stroke: a named theme width or one from the document.
    • pub fn scaled(self, scale: f32) -> Self. The width with a document width multiplied by scale (a view's zoom); a theme width stays as the theme names it.
  • craft_ui::primitives::DataWidth: pub struct DataWidth. A line width the data gives (a path's thickness, a pen size), in screen points: the caller maps a document width through its view first. Draw::stroke and Draw::dashed take one beside the named [StrokeWidth].
    • pub const fn points(points: f32) -> Self. A width of points.
  • craft_ui::primitives::DocRun: pub struct DocRun<'a> { pub text: Cow<'a, str>, pub font: FontRef, pub size: f32, pub weight: u16, pub italic: bool, pub color: DataColor, pub underline: bool, pub strikethrough: bool, pub indent: f32, pub coords: Cow<'a, [([u8; 4], f32)]> }. One run of document text.
    • pub fn new(text: impl Into<Cow<'a, str>>, font: FontRef, size: f32, color: DataColor) -> Self. A regular-weight upright run without lines or indent.
    • pub fn italic(mut self) -> Self. Italic.
    • pub fn bold(mut self) -> Self. Bold weight.
    • pub fn underline(mut self) -> Self. Underlined.
    • pub fn strikethrough(mut self) -> Self. Struck through.
    • pub fn indent(mut self, points: f32) -> Self. points of space before the run.
    • pub fn coords(mut self, coords: impl Into<Cow<'a, [([u8; 4], f32)]>>) -> Self. The run drawn at the variation coordinates coords (axis tag, value) of its face.
    • pub fn into_owned(self) -> DocRun<'static>. The run owning its text and coordinates.
  • craft_ui::primitives::DocText: pub struct DocText<'a> { pub runs: &'a [DocRun<'a>], pub wrap: Option<f32>, pub align: HAlign, pub elide: bool }. Document text: runs with their own font, size and colour.
    • pub const fn new(runs: &'a [DocRun<'a>]) -> Self. Unwrapped document text of runs.
    • pub const fn elide(mut self) -> Self. Cuts the text to one row with an ellipsis at the end.
    • pub fn full_text(&self) -> String. The text of every run, joined.
  • craft_ui::primitives::Draw: pub struct Draw<'a>. The content-paint API PaintUi::draw gives.
    • pub fn role(&self, pick: impl FnOnce(&craft_theme::ColorTokens) -> craft_theme::Rgba) -> StyleColor. A colour role of the scope's theme, for content that paints a state with no style of its own: a selected row in draw.role(|c| c.state.selected), its text in |c| c.text.on_selected.
    • pub fn text(&self, rect: Rect, run: &TextRun<'_>) -> TextLayout. Lays run out in rect's width and paints it placed in rect's width by the run's alignment (Start at the reading start).
    • pub fn text_x(&self, rect: Rect, run: &TextRun<'_>, layout: &TextLayout) -> f32. Where layout of run starts in rect's width: the free room shared out by the run's alignment, the reading start being the right edge in a right-to-left paragraph.
    • pub fn text_on_centre_line(&self, rect: Rect, run: &TextRun<'_>) -> TextLayout. Paints a one-line run as text does, with the middle of its lowercase letters (the x-height) on the middle of rect's height.
    • pub fn text_on_line(&self, rect: Rect, run: &TextRun<'_>, line: TypeRole) -> TextLayout. Paints a one-line run as text does, on the baseline of a line of line centred on the middle of rect's height ([line_baseline]): a field's unit, in a smaller role than the field's text, sits on the text's baseline.
    • pub fn line_baseline(&self, centre: f32, role: TypeRole) -> f32. The baseline of a control's line of role whose centre line lies at centre: every text in the line sits on it, whatever its face or size (text::line_baseline).
    • pub fn doc(&self, rect: Rect, text: &DocText<'_>) -> TextLayout. Lays text out in rect's width and paints it top aligned, its block placed in rect by text.align (Start and End swap sides under right-to-left).
    • pub fn face_run(&self, start: Pos2, run: &FaceRun<'_>, load: impl FnOnce() -> Option<FaceBytes>) -> TextLayout. Paints run in its document face with the start of its first baseline at start, and returns its layout, whose top lies at start.y - layout.first_baseline ([FaceRun] says how the face, its fallback and the size are chosen). load gives the face's bytes and index, which the caller holds, the first time run.key is drawn while the face is kept; a None leaves the run in the interface face.
    • pub fn layout(&self, run: &TextRun<'_>, max_width: f32) -> TextLayout. Lays run out in max_width without painting it: the one text layout path for painters that measure before they paint (the same layout text paints with).
    • pub fn drop_label(&self). Records that the face dropped its label, so the component's tooltip text does not count it.
    • pub fn galley(&self, pos: Pos2, layout: &TextLayout). Paints a laid-out run at pos.
    • pub fn icon(&self, rect: Rect, icon: &super::IconSpec<'_>). Paints icon centred in rect, in the colour or ink the spec names, mirrored under right-to-left when it is directional, with its badge at the bottom-trailing corner.
    • pub fn data_icon(&self, rect: Rect, icon: &super::IconSpec<'_>, color: DataColor). Paints icon as icon does, in the data colour color in place of the icon's own colour or ink: an icon drawn in document content.
    • pub fn auto_scroll_mark(&self, look: &crate::style::AutoScrollMarkLook, anchor: Pos2). Paints the auto-scroll mark of look at anchor.
    • pub fn reset_mark(&self, look: &crate::style::ResetMarkLook, center: Pos2, differs: bool). Paints the reset mark of look centred on center: the dot while the value differs, else the ring.
    • pub fn marker(&self, look: &crate::style::MarkerLook, marker: &super::Marker). Paints marker in look.
    • pub fn rule(&self, kind: RuleKind, from: Pos2, to: Pos2). Paints the line of kind from from to to.
    • pub fn edge_rule(&self, kind: RuleKind, rect: Rect, side: RectSide). Paints the line of kind along the side edge of rect, on the physical pixels just inside it (Rule::edge): a row's bottom rule, a cell's gridline, a strip's edge toward its neighbour.
    • pub fn scroll_bar(&self, look: &crate::style::ScrollBarLook, track: Rect, axis: craft_behavior::Axis, rtl: bool, span: &craft_behavior::ScrollSpan, state: &crate::style::StateSet,). Paints the scroll bar in track along axis for span, in the bar's state (ScrollBar::shapes; CxCore::scroll_bar_state gives it).
    • pub fn rule_width(&self, kind: RuleKind) -> f32. The width in points of the line rule paints for kind.
    • pub fn rule_with(&self, look: &crate::style::RuleLook, from: Pos2, to: Pos2). Paints the line look from from to to, snapped to physical pixels as rule is: a rule in a component's own colour or width.
    • pub fn dotted_rule_with(&self, look: &crate::style::RuleLook, from: Pos2, to: Pos2, gap: f32). Paints the line look from from to to as dots gap points apart (Rule::dotted): a dotted line.
    • pub fn ticked_rule_with(&self, look: &crate::style::RuleLook, from: Pos2, to: Pos2, gap: f32, across: f32). Paints the line look from from to to as ticks across points long, gap points apart (Rule::ticks):
    • pub fn grip_ticks(&self, look: &crate::style::RuleLook, centre: Pos2, count: u16, gap: f32, across: f32). Paints count upright ticks of look centred on centre, side by side on a level line, gap points apart and across points tall (Rule::ticks): a grip's row of marks, count of them at every display scale.
    • pub fn surface(&self, rect: Rect, kind: SurfaceKind, corners: Corners). Paints a surface of kind (tracks, plot wells).
    • pub fn surface_edge(&self, rect: Rect, kind: SurfaceKind). Paints the edge alone of a surface of kind over rect, with no shadow or fill: a floating window draws its edge again over its content, which covers it where it reaches the window's sides.
    • pub fn surface_styled(&self, rect: Rect, style: &SurfaceStyle). Paints a surface of an already resolved style (a kind's look with one field changed, as a knob's round radius).
    • pub fn surface_look(&self, rect: Rect, look: &crate::style::SurfaceLook, state: &crate::style::StateSet). Paints look over rect in state, as the paint step paints a component's surface: a part's own surface (an indicator's well) keeps the kind's edge and bevel.
    • pub fn fill(&self, shape: &PaintShape, color: StyleColor). Fills shape.
    • pub fn stroke(&self, shape: &PaintShape, width: impl Into<DataStrokeWidth>, color: impl Into<StrokeColor>). Strokes shape at a theme width or a width from the document, in a theme colour or a colour from data (a chart series, a curve).
    • pub fn stroke_placed(&self, shape: &PaintShape, place: StrokePlace, width: impl Into<DataStrokeWidth>, color: impl Into<StrokeColor>). Strokes shape as [stroke] does, with the stroke placed against the shape's edge: an outline around a selected item that must not cover it strokes Outside.
    • pub fn data_fill(&self, shape: &PaintShape, color: DataColor). Fills shape with a colour from data (a swatch well, a layer label dot, an avatar).
    • pub fn data_fill_tiled(&self, pieces: &[Vec<Pos2>], color: DataColor). Fills the polygons pieces, which tile one area edge to edge, as one mesh with no feathered edges, in a colour from data as data_fill paints it.
    • pub fn texture(&self, rect: Rect, texture: TextureId, uv: Rect). Paints the part uv of texture (from TextureCache or a TextureStore) into rect, untinted.
    • pub fn texture_quad(&self, corners: [Pos2; 4], texture: TextureId, uv: Rect). Paints uv of texture onto the clockwise quad corners (from uv's top left), untinted, as data: a disabled component paints it at Opacity::DISABLED, and for an inactive part the quad is filled with the theme's disabled fill.
    • pub fn cached_texture<K: std::hash::Hash + 'static>(&self, key: K, image: impl FnOnce() -> egui::ColorImage) -> TextureId. The texture for key from the TextureCache of the context this painter paints in, for [texture]:
    • pub fn checker(&self, checker: &super::Checker, rect: Rect, radius: CornerRadius). Paints checker over rect with corners radius, a light cell at the rect's top left.
    • pub fn swatch_well(&self, well: Rect, radius: CornerRadius, fill: impl Into<WellFill>). Paints the well of a colour swatch over well with corners radius: the colour, over a checkerboard where it is translucent; else the empty well in surface.sunken, with a text.muted dash for Mixed, a status.bad diagonal from the bottom start to the top end for None, and nothing for Empty.
    • pub fn swatch_polygon_well(&self, corners: &[Pos2], fill: impl Into<WellFill>). [Self::swatch_well] over the convex polygon corners (a honeycomb cell): the same parts, the checkerboard and the marks cut to the polygon.
    • pub fn dashed(&self, path: &[Pos2], pattern: Dashes, width: impl Into<DataStrokeWidth>, color: impl Into<StrokeColor>). Strokes the open path path as dashes (copy marks, drag previews, reference lines), with the width and colour [Self::stroke] takes. kit::dashed is the one implementation; the kit painter's dashed calls it too.
    • pub fn dashes(&self) -> Dashes. The theme's dash pattern: stroke.dash dashes with stroke.dash_gap gaps.
    • pub fn clipped(&self, rect: Rect, paint: impl FnOnce(&Draw<'_>)). Runs paint with a Draw whose painting is cut to rect (inside the clip already in force): scrolled content under a frozen band, a bracket cut at a lane's edge.
    • pub fn faded(&self, share: f32, paint: impl FnOnce(&Draw<'_>)). Runs paint with a Draw whose fills, strokes, text runs, icons and pictures are all share as opaque as they would be (1 paints as self does, 0 paints nothing).
  • craft_ui::primitives::EditorLine: pub struct EditorLine<'a> { pub text: &'a str, pub rect: Rect, pub baseline: f32, pub runs: &'a [EditorRun<'a>] }. One visible line of an own-caret editor.
    • pub const fn new(text: &'a str, rect: Rect, baseline: f32, runs: &'a [EditorRun<'a>]) -> Self. A line of text at rect.
  • craft_ui::primitives::EditorPurpose: pub enum EditorPurpose { Text, Code, Number, Password }. What an editor part edits.
  • craft_ui::primitives::EditorRun: pub struct EditorRun<'a> { pub bytes: Range<usize>, pub rtl: bool, pub positions: &'a [f32], pub widths: &'a [f32] }. One bidi run of a line: its bytes, direction, each character's start offset and advance.
    • pub const fn new(bytes: Range<usize>, rtl: bool, positions: &'a [f32], widths: &'a [f32]) -> Self. A run over bytes.
  • craft_ui::primitives::EditorState: pub struct EditorState<'a> { pub caret: Rect, pub lines: &'a [EditorLine<'a>], pub caret_at: TextPos, pub selection: Option<(TextPos, TextPos)>, pub composing: bool, pub shows_marked: bool, pub can_undo: bool, pub can_redo: bool, pub surrounding: Option<(u64, EditorSurrounding<'a>)> }. What an own-caret editor reports once per frame for the IME and AccessKit.
    • pub fn surrounding(mut self, epoch: u64, s: EditorSurrounding<'a>) -> Self. Reports s as the committed text around the caret, for the input-method target at epoch.
    • pub const fn new(caret: Rect, lines: &'a [EditorLine<'a>], caret_at: TextPos) -> Self. A state with no selection, no marked text and nothing to undo.
    • pub const fn marked(mut self, composing: bool) -> Self. Reports an editor that draws the input method's marked text, composing while it shows some ([EditorState::shows_marked]).
  • craft_ui::primitives::EditorSurrounding: re-export of craft_ui::runtime::ime::EditorSurrounding.
  • craft_ui::primitives::FacePaint: pub struct FacePaint. The one host painter a value carries: two faces with one key are the same value.
    • pub fn new(key: u64, paint: impl Fn(&ContentPainterCx<'_>, Rect) + Send + Sync + 'static) -> Self. A face identified by key that paints with paint.
    • pub fn key(&self) -> u64. The key that identifies the face.
    • pub fn paint(&self, cx: &ContentPainterCx<'_>, rect: Rect). Paints the face into rect.
  • craft_ui::primitives::FaceRun: pub struct FaceRun<'a> { pub text: &'a str, pub key: &'a str, pub size: f32, pub color: DataColor }. A run of text in one face of a document's fonts, which Draw::face_run draws on a baseline: an input method's composition in the face and size of the text it goes into, as Word draws it.
    • pub const fn new(text: &'a str, key: &'a str, size: f32, color: DataColor) -> Self. text in the face key at size points in color.
    • pub fn largest_size(ctx: &Context) -> f32. The largest size, in points, a face run is drawn at on ctx's display: a glyph stays within a quarter of the font atlas's side and at most 1,024 pixels.
    • pub fn drawn_size(&self, ctx: &Context) -> f32. The size the run is drawn at on ctx's display: its own, within 1 point and [largest_size].
  • craft_ui::primitives::FacesCx: pub trait FacesCx. Where a document face is asked for: a component's context, its measure or a content painter.
    • fn document_face<L>(&self, key: &str, job: impl FnOnce() -> L) -> FaceState where L: FnOnce() -> Option<FaceBytes> + Send + 'static. The face registered under key as a family of its own, read from a font catalog. job is called only for a key the registry does not know (a ready face costs nothing) and makes the load, which runs as a background job, once while the face is kept; the face is ready from the pass after it ends.
    • fn document_face_bytes(&self, key: &str) -> Option<FaceBytes>. The bytes of the face document_face registered under key, once it is ready: for reading its tables without loading the file again.
  • craft_ui::primitives::FakeThumbSource: pub struct FakeThumbSource<K>. A [ThumbSource] for stories and tests in every crate: pictures made from the key and a revision the test sets, so every state shows without a document.
    • pub fn new() -> Self. Synchronous square pictures at revision 0.
    • pub fn later(mut self, later: bool) -> Self. Renders as Later jobs.
    • pub fn opaque(mut self, opaque: bool) -> Self. The picture has no transparent quarter.
    • pub fn aspect(mut self, width: u32, height: u32) -> Self. The frame's width to height (4:3 landscape, 3:4 portrait).
    • pub fn failing(mut self, keys: impl IntoIterator<Item = K>) -> Self. These keys fail.
    • pub fn blank(mut self, keys: impl IntoIterator<Item = K>) -> Self. These keys have no picture.
    • pub fn set_revision(&mut self, revision: u64). Every key's revision.
    • pub fn bump(&mut self). Moves every key's revision on by one.
  • craft_ui::primitives::FocusKind: pub enum FocusKind { Ring, Halo }. How a focus indication is drawn.
  • craft_ui::primitives::FocusRing: pub struct FocusRing. The focus ring painter.
    • pub fn visible(flags: Flags) -> bool. Whether a part with flags shows its ring: only when it is the focused component or its active part, with focus visible.
    • pub fn shapes(look: &FocusLook, kind: FocusKind, shape: &PaintShape, pixels_per_point: f32) -> Vec<Shape>. The shapes of the ring around shape, grown by look.offset.
  • craft_ui::primitives::Glyph: pub trait Glyph: Any + MemoProps + Sync. A value glyph: an icon drawn from a value.
    • fn directional(&self) -> bool. Whether the glyph has a reading direction (an arrow) and so flips under right-to-left.
    • fn paint(&self, painter: &Painter, tokens: &UiTokens, rect: Rect, color: Color32, mirrored: bool). Paints the glyph into rect in color, with the strokes of tokens. mirrored is set when a directional glyph is painted under right-to-left: the glyph draws itself flipped.
    • fn paint_draw(&self, draw: &Draw<'_>, rect: Rect, color: Color32, mirrored: bool). Paints the glyph into rect in color with draw, the content painter of the component that shows the icon (Draw::icon).
  • craft_ui::primitives::GridAxis: pub struct GridAxis { pub minor: Vec<f64>, pub major: Vec<f64> }. The lines of one axis: positions along it, in the grid's space.
  • craft_ui::primitives::GridCrowding: pub enum GridCrowding { Hide, Thin }. What a grid does when its lines come closer than the minimum step.
  • craft_ui::primitives::GridInk: pub struct GridInk { pub major: Option<DataColor>, pub minor: Option<DataColor>, pub stroke: GridStroke }. The colours a grid's lines take; an unset one is the theme's.
    • pub const fn new() -> Self. The theme's colours and solid lines.
    • pub const fn major(mut self, color: DataColor) -> Self. The major lines in color.
    • pub const fn minor(mut self, color: DataColor) -> Self. The minor lines in color.
    • pub const fn stroke(mut self, stroke: GridStroke) -> Self. The lines drawn as stroke.
  • craft_ui::primitives::GridLines: pub struct GridLines { pub x: GridAxis, pub y: GridAxis, pub extent: Option<kurbo::Rect>, pub crossings: bool, pub view: Option<CanvasView> }. The lines of a grid, as [grid_lines] draws them: vertical lines (by x) and horizontal lines (by y), each running across extent.
    • pub fn document(view: &CanvasView, extent: kurbo::Rect, spacing: kurbo::Vec2, origin: kurbo::Point, subdivisions: u32, crowding: GridCrowding,) -> Self. The lines of a grid in document units: majors every spacing from origin, subdivisions steps to a major (1 or 0 is no minor lines), across extent as view shows it.
    • pub fn screen(rect: Rect, spacing: Vec2, clip: Rect, pixels_per_point: f32) -> Self. The lines over rect that clip shows, every spacing points from the rect's top-left corner, all major.
  • craft_ui::primitives::GridLook: pub struct GridLook. What the lines of a grid read from the tokens: the line colour and width, and the dash and gap lengths.
    • pub fn of(tokens: &UiTokens) -> Self. The grid look of tokens.
  • craft_ui::primitives::GridStroke: pub enum GridStroke { Solid, Dashed, Dots }. How the lines of a grid are drawn.
  • craft_ui::primitives::HAlign: pub enum HAlign { Start, Center, End }. Where the lines of a multi-line run sit within the run's width.
  • craft_ui::primitives::Handle: pub struct Handle. The handle painter.
    • pub fn plus(draw: &Draw<'_>, look: &HandleLook, center: Pos2, side: f32). The overflow mark: two strokes through center, each half 0.27 * side long, look.stroke_width wide in look.stroke.
    • pub fn shapes(look: &HandleLook, shape: HandleShape, center: Pos2, state: &StateSet) -> Vec<Shape>. The shapes of a handle of shape centred on center, filled for state.
  • craft_ui::primitives::HandleShape: pub enum HandleShape { Square, Circle, Diamond }. The outline of a handle.
  • craft_ui::primitives::HiddenContent: pub struct HiddenContent { pub left: f32, pub right: f32, pub top: f32, pub bottom: f32 }. How far a scroll view's content runs past each of its edges, in points.
    • pub fn new(content: Vec2, view: Vec2, offset: Vec2, rtl: bool) -> Self. The content of content points past a view of view points scrolled by offset, with x counted from the reading start (the right edge when rtl).
  • craft_ui::primitives::HostStyle: pub struct HostStyle. The egui style of an app's own Ui, kept where a framework part takes the app's egui code into a Ui of its own:
    • pub fn of(ui: &Ui) -> Self. The style ui has now.
    • pub fn run<R>(&self, ui: &mut Ui, run: impl FnOnce(&mut Ui) -> R) -> R. Runs run on ui with the kept style, and gives ui its own style back after it.
    • pub fn show<R: Clone + Default + Send + Sync + 'static>(&self, ui: &mut Ui, id: Id, run: impl FnOnce(&mut Ui) -> R) -> R. Shows the app's code run in ui as [HostStyle::run] runs it, in the real run of a pass only: in a child of ui with its layout and the rest of its room, scoped by id, which ui then takes.
    • pub fn paint_panel(&self, ui: &Ui, rect: Rect). Fills rect on ui with the kept style's panel fill (Visuals::panel_fill), as an egui panel of the app paints its background.
  • craft_ui::primitives::IconMark: pub enum IconMark { Dot(DataColor), Bar { color: DataColor, weight: Option<f32> } }. A data-colour mark on an icon.
    • pub const fn bar(color: DataColor) -> Self. A bar of color with the default thickness.
    • pub const fn weighted_bar(color: DataColor, weight: f32) -> Self. A bar of color weight points thick.
  • craft_ui::primitives::IconSet: re-export of craft_ui::primitives::icon::IconSet (defined outside these crates).
  • craft_ui::primitives::IconSource: pub enum IconSource<'a> { Svg(IconId), Glyph(&'a(dyn Glyph + 'static)), Swatch(Option<Srgba>), Disc, Initial(char), Mark(craft_behavior::CursorBadge) }. Where an icon's drawing comes from.
  • craft_ui::primitives::IconSpec: pub struct IconSpec<'a> { pub source: IconSource<'a>, pub ink: Ink, pub color: Option<StyleColor>, pub mirror: Mirror, pub badge: Option<IconMark> }. An icon to paint.
    • pub fn svg(id: IconId) -> Self. An icon of the SVG set or a tool icon, in the panel ink.
    • pub fn mark(badge: craft_behavior::CursorBadge) -> IconSpec<'a>. An icon whose glyph is the mark of the cursor badge (the plus or minus drawn at the cursor), painted by the one cursor-badge painter.
    • pub fn glyph(glyph: &'a(dyn Glyph + 'static)) -> Self. An icon of glyph in the panel ink.
    • pub fn swatch(color: Srgba) -> Self. A swatch of color, painted as Draw::swatch_well paints a well.
    • pub fn empty_swatch() -> Self. The empty swatch of a colour the theme decides (a "Default" pasteboard colour): it keeps a swatch's place, so the labels after a column of swatches line up.
    • pub fn initial(name: &str) -> Self. The first letter of name in capitals, in an outlined box, in the panel ink: the icon of something that has none.
    • pub fn disc() -> Self. A filled circle in the panel ink, or in the colour [color] or [data_color] sets (a status dot, a person's dot).
    • pub fn ink(mut self, ink: Ink) -> Self. Sets the ink.
    • pub fn color(mut self, color: StyleColor) -> Self. Sets the colour, in place of the ink's.
    • pub fn data_color(mut self, color: DataColor) -> Self. Sets the colour from data, in place of the ink's: an icon drawn in document content (an annotation pictogram), whose colour belongs to the document and not to a state.
    • pub fn mirror(mut self, mirror: Mirror) -> Self. Sets the mirroring.
    • pub fn badge(mut self, color: DataColor) -> Self. Adds a dot of color at the bottom-trailing corner of an SVG or glyph icon, ringed in the icon's colour: the tone a point picker sets.
    • pub fn with_mark(mut self, mark: IconMark) -> Self. Puts mark on the icon in place of any mark it has.
  • craft_ui::primitives::ImeStamp: re-export of craft_ui::primitives::text_input::ImeStamp (defined outside these crates).
  • craft_ui::primitives::ImeSurface: pub struct ImeSurface. The handle of an editor part's focus widget.
  • craft_ui::primitives::LayoutRun: pub struct LayoutRun { pub bytes: Range<usize>, pub rtl: bool, pub positions: Vec<f32>, pub widths: Vec<f32> }. One direction run of a single-row layout, owned.
  • craft_ui::primitives::LeastLayout: pub struct LeastLayout { pub whole: TextLayout, pub width: f32 }. A run laid out whole on its line, and its width at its readable least: what a text that elides measures at Proposal::Min.
    • pub fn size(&self) -> egui::Vec2. The size the run takes at its least: its least width and its whole line's height.
  • craft_ui::primitives::LoadFailure: pub enum LoadFailure { Missing, Unreadable, Panicked, Message(String) }. Why a job made no picture.
    • pub fn text<'a>(&'a self, words: &'a TextureWords) -> &'a str. The failure tooltip in the words of the scope (cx.words::<TextureWords>()).
  • craft_ui::primitives::LoadResult: pub type LoadResult = Result<LoadedPicture, LoadFailure>. What a loader job returns: a LoadedPicture, or why there is none.
  • craft_ui::primitives::LoadedPicture: pub enum LoadedPicture { Image(ColorImage), Blank }. What a background job makes when it succeeds: a picture, or the answer that the key has none.
  • craft_ui::primitives::LoaderOptions: pub struct LoaderOptions { pub store: TextureStoreOptions, pub lanes: usize, pub jobs: Option<Arc<dyn Jobs>> }. A loader's settings, read when it is created (TextureLoader::in_context).
    • pub fn new() -> Self. Thumbnail budgets, the machine's lanes, the host's jobs.
    • pub fn store(mut self, store: TextureStoreOptions) -> Self. Settings of the loader's store.
    • pub fn lanes(mut self, lanes: usize) -> Self. Jobs running at once.
    • pub fn jobs(mut self, jobs: Arc<dyn Jobs>) -> Self. Where the lanes run.
  • craft_ui::primitives::MAX_LINES: pub const MAX_LINES: usize. Most lines a grid draws along one axis.
  • craft_ui::primitives::MAX_TEXTURE: pub const MAX_TEXTURE: u32. The largest texture side the library uploads.
  • craft_ui::primitives::Marker: pub struct Marker. A colour marker centred on at: the colour it marks (when filled), a ring and a halo ring just outside it.
    • pub const fn hollow(at: Pos2) -> Self. A ring that shows the field under it.
    • pub const fn filled(at: Pos2, color: Color32) -> Self. A disc of color; a translucent colour sits on the look's backing.
    • pub const fn size(mut self, size: MarkerSize) -> Self. Drawn at size.
    • pub const fn radius(mut self, radius: f32) -> Self. Drawn at radius in place of its size's: a ring round a picked mark, such as a selected blur pin's ring.
    • pub const fn selected(mut self, selected: bool) -> Self. The ring in the look's selected colour while selected.
    • pub fn size_radius(look: &MarkerLook, size: MarkerSize) -> f32. The radius of a marker of size, out to the inner edge of its ring.
    • pub fn reach(look: &MarkerLook, size: MarkerSize) -> f32. How far a marker of size reaches from its centre, halo included.
    • pub fn shapes(&self, look: &MarkerLook) -> Vec<Shape>. The shapes, bottom first.
  • craft_ui::primitives::MarkerSize: pub enum MarkerSize { Regular, Large }. How large a marker is drawn.
  • craft_ui::primitives::Mirror: pub enum Mirror { Auto, Never }. Whether a directional icon flips under right-to-left.
  • craft_ui::primitives::PaintShape: pub enum PaintShape { Rect(Rect, CornerRadius), Circle(Pos2, f32), Polygon(Vec<Pos2>), Path(Vec<Pos2>) }. A shape Draw::fill and Draw::stroke paint.
  • craft_ui::primitives::PaintSlot: pub struct PaintSlot. An empty shape reserved in a layer's paint list.
    • pub fn reserve(painter: &Painter) -> Self. Reserves an empty shape at the end of painter's layer, clipped like the painter.
    • pub fn extend(self, ctx: &Context, shapes: Vec<Shape>). Adds shapes to the slot, after the shapes it holds, keeping the slot's clip.
    • pub fn take_after(self, ctx: &Context) -> Vec<Shape>. Takes the shapes painted on the slot's layer after it, in paint order, leaving empty shapes in their places.
  • craft_ui::primitives::PartResult: pub struct PartResult { pub rect: Rect, pub press: PressState, pub hovered: bool, pub flags: Flags, pub sense: Sense, pub inactive: bool, pub held: bool }. A part's results this pass.
    • pub const IDLE: PartResult. What a read returns for a part with no press history: face mode, or a part first registered this pass.
    • pub fn pressed(&self) -> bool. The part paints pressed: its own press, or one its component holds on it.
  • craft_ui::primitives::Priority: re-export of craft_ui::primitives::textures::Priority (defined outside these crates).
  • craft_ui::primitives::RangeInk: pub enum RangeInk { Muted, Accent, Good, Warn, Bad, Info }. A theme colour for a stretch of a field's text.
  • craft_ui::primitives::ReadingMeasure: pub struct ReadingMeasure { pub target: f32, pub least: f32 }. The width of a reading column, from the text it holds: a count of characters of the role's average character width, as a print measure is counted, so the column follows the text size.
    • pub const TARGET_CHARACTERS: f32. The characters in the measure a reading column aims for.
    • pub const LEAST_CHARACTERS: f32. The characters in the shortest measure a reading column allows.
    • pub fn of(role: TypeRole, layout: impl FnOnce(&TextRun<'static>) -> TextLayout) -> Self. The widths for text of role. layout lays a run out the way the component lays out its text (|run| cx.layout(run) in a measure, |run| draw.layout(run, f32::INFINITY) in a painter).
  • craft_ui::primitives::RectSide: pub enum RectSide { Top, Bottom, Left, Right }. A side of a rect, on screen: left and right stay put under right-to-left.
    • pub const fn start(rtl: bool) -> RectSide. The start side in reading order: left, or right under right-to-left.
    • pub const fn end(rtl: bool) -> RectSide. The end side in reading order: right, or left under right-to-left.
    • pub const fn toward_centre(edge: crate::contract::PaneEdge, rtl: bool) -> Option<RectSide>. The side of a pane at edge that faces the window's centre, mirrored for a start or end pane under right-to-left; none for the centre.
  • craft_ui::primitives::ResetMark: pub struct ResetMark. The reset mark painter.
    • pub fn shapes(look: &ResetMarkLook, center: Pos2, differs: bool) -> Vec<Shape>. The mark centred on center: the dot while the value differs, else the ring.
  • craft_ui::primitives::Revision: pub struct Revision. The version of a key's picture, computed by the app: a stored fingerprint, an Arc address with a Weak guard, a frame key.
    • pub const fn new(value: u64) -> Revision. The revision value (a document's own change counter).
    • pub const fn get(self) -> u64. The number.
    • pub fn of(value: &impl Hash) -> Revision. The revision of anything hashable: Revision::of(&(fingerprint, doc_width)).
  • craft_ui::primitives::Rule: pub struct Rule. The rule painter.
    • pub fn shapes(look: &RuleLook, from: Pos2, to: Pos2, pixels_per_point: f32) -> Vec<Shape>. The line from from to to, snapped across its direction: a line whose physical width is odd sits on a pixel centre, an even one on a pixel edge, and no line is thinner than one physical pixel.
    • pub fn dotted(look: &RuleLook, from: Pos2, to: Pos2, gap: f32, pixels_per_point: f32) -> Vec<Shape>. The dotted form of the line from from to to: square dots as wide as the line, gap points apart, the run of whole dots centred between the ends (a dotted guide or grid line).
    • pub fn ticks(look: &RuleLook, from: Pos2, to: Pos2, gap: f32, across: f32, pixels_per_point: f32) -> Vec<Shape>. The line from from to to as a run of ticks: marks as wide as the line along it and across points long across it, gap points apart, the run of whole marks centred between the ends (a grip's row of upright ticks).
    • pub fn edge(look: &RuleLook, rect: Rect, side: RectSide, pixels_per_point: f32) -> Vec<Shape>. The line along the side edge of rect, on the physical pixels just inside it: a row's bottom rule or a cell's gridline, which a line centred on the edge would put on the first pixel outside, under the next row's clip or the next cell's fill.
  • craft_ui::primitives::RuleKind: pub enum RuleKind { Divider, Edge, Grid, DropMark }. Which rule a look is for.
  • craft_ui::primitives::RulerFace: pub enum RulerFace { Edge, Centred }. How a ruler lays out its marks and numbers.
    • pub const fn of(set: craft_theme::ComponentSet) -> Self. The face the component set set shows: the creative set the edge face, the productivity set the centred one.
    • pub fn bar(self, strip: Rect, edge: TickEdge) -> Rect. Where the marks of a strip along edge sit: the whole strip for the edge face, the strip inset across its depth by BAR_INSET on each side for the centred face.
    • pub fn beside_numbers(self, edge: TickEdge, origin: f32, marks: Vec<Tick>, numbers: &[Rect], pad: f32) -> Vec<Tick>. The marks of marks this face shows beside the numbers in numbers (screen boxes): the edge face shows every mark, the centred face leaves out each one whose position lies inside a number widened by pad along edge's axis, so a number stands in place of its own mark and no mark runs through one. origin is the screen position the marks' at counts from.
    • pub fn centred_number(bar: Rect, edge: TickEdge, at: f32, size: Vec2) -> Rect. The box a centred number of size takes for the mark at at (a screen position along edge's axis): centred on the mark and on the bar.
  • craft_ui::primitives::ScrollBar: pub struct ScrollBar. The scroll bar painter.
    • pub fn strip_arrow(strip: Rect, back: bool, color: Color32) -> Shape. The filled arrow of a scroll strip, centred in strip: pointing up for the strip before the view (back), down for the one after it.
    • pub fn thumb(min_thumb: f32, track: Rect, axis: Axis, rtl: bool, span: &ScrollSpan) -> Rect. The thumb inside track, a bar along axis, for span: its length is the shown share of the track, at least min_thumb, and it sits at the visible range's share of the travel, from the right under right-to-left on the x axis.
    • pub fn shapes(look: &ScrollBarLook, track: Rect, axis: Axis, rtl: bool, span: &ScrollSpan, state: &StateSet) -> Vec<Shape>. The shapes of the bar in track along axis for span, in state (the bar's: hovered while the pointer is anywhere on it): the track and the fully round thumb, look.thumb_width thick along the track's outer edge (its bottom, or its end side in the reading direction).
  • craft_ui::primitives::Serials: pub struct Serials. The numbers that keep apart the textures one owner makes: a mask or preview made anew gets a number no earlier one of the same Serials had, so an entry kept under its key is never taken for the new one's.
    • pub fn mint(&mut self) -> u64. A new number: never one this Serials gave before.
  • craft_ui::primitives::Span: pub struct Span<'a> { pub text: Cow<'a, str>, pub italic: bool, pub tabular: bool, pub mono: bool, pub muted: bool, pub shortcut: bool, pub highlight: bool, pub underline: bool, pub strikethrough: bool, pub strong: bool, pub link: bool, pub flag: Option<Tone> }. One styled stretch of a run.
    • pub fn new(text: impl Into<Cow<'a, str>>) -> Self. A plain span.
    • pub fn link(mut self) -> Self. Makes the span a link: it takes the run's link colour and the pointer.
    • pub fn flag(mut self, tone: Tone) -> Self. Underlines the span in the ink of tone (spelling Bad, grammar Info).
    • pub fn italic(mut self) -> Self. Italic.
    • pub fn tabular(mut self) -> Self. Tabular figures.
    • pub fn mono(mut self) -> Self. The monospace face.
    • pub fn muted(mut self) -> Self. The muted colour.
    • pub fn shortcut(mut self) -> Self. A shortcut hint.
    • pub fn highlight(mut self) -> Self. A match highlight.
    • pub fn underline(mut self) -> Self. Underlined: a link, or the mnemonic letter of a menu title.
    • pub fn strikethrough(mut self) -> Self. Struck through: text that stands for something removed or done.
    • pub fn strong(mut self) -> Self. The role's semibold face: a short mark that stands out among the row's other text, such as a layer's fx.
  • craft_ui::primitives::StateLayer: pub struct StateLayer. The state layer painter.
    • pub fn shapes(kind: StateLayerKind, color: StyleColor, rect: Rect, radius: CornerRadius, width: f32) -> Vec<Shape>. The shape of color over rect; an outline is width wide.
  • craft_ui::primitives::StateLayerKind: pub enum StateLayerKind { Fill, Outline }. How a state layer paints its colour.
  • craft_ui::primitives::StateLook: pub enum StateLook { Glyph, Captioned }. What a thumbnail that is not ready, or failed, shows.
  • craft_ui::primitives::StrokeColor: pub enum StrokeColor { Theme(StyleColor), Data(DataColor) }. The colour of a stroke: a theme colour or one from the data.
  • craft_ui::primitives::StrokePlace: pub enum StrokePlace { Inside, Centre, Outside }. Where a stroke lies against the edge of a closed shape (Rect, Circle, Polygon); an open Path always strokes on its centre line.
  • craft_ui::primitives::StrokeWidth: pub enum StrokeWidth { Hairline, Thin, Medium, Thick, Heavy }. A line width from the theme, so content never picks a literal one.
  • craft_ui::primitives::SubmitKey: pub enum SubmitKey { CommandEnter, Enter }. Which Enter chord submits a multi-line text.
  • craft_ui::primitives::Surface: pub struct Surface. The surface painter: shadow, fill, then edge.
    • pub fn shapes(style: &SurfaceStyle, fill: Option<Color32>, rect: Rect, corners: Corners, direction: Direction, pixels_per_point: f32,) -> Vec<Shape>. The shapes of style over rect, snapped to the pixel grid: shadow, fill, edge. fill replaces the kind's fill (the state fill), so washes never stack.
  • craft_ui::primitives::TabKey: pub enum TabKey { Moves, Inserts, Rewrites, Reports }. What Tab does in a text field.
  • craft_ui::primitives::TextKey: pub struct TextKey<V>. A text part's key, typed by the value its codec gives.
    • pub const fn new(key: PartKey) -> Self. The key of the text part key.
    • pub const fn key(self) -> PartKey. The part key.
  • craft_ui::primitives::TextLayout: pub struct TextLayout { pub galley: Arc<Galley>, pub elided: bool, pub first_baseline: f32, pub rotation: f32 }. A laid-out run.
    • pub fn full(&self) -> &str. The full text, as the tooltip and accessible name of an elided run.
    • pub fn runs(&self) -> &[LayoutRun]. The bidi runs of a single-row layout; empty for a wrapped one.
    • pub fn row_lines(&self) -> Vec<(String, egui::Rect, Vec<LayoutRun>)>. Every row as its text, its rect from the galley's origin and its bidi runs: the one per-row geometry, read by the AccessKit run nodes and by a component that hits parts of a wrapped run, such as a link in a sentence.
    • pub fn size(&self) -> egui::Vec2. The galley size.
    • pub fn char_x(&self, chars: usize) -> f32. Where a caret before character chars (counted from the start of the text) stands, from the layout's left edge:
  • craft_ui::primitives::TextOptions: pub struct TextOptions { pub placeholder: Option<Label>, pub look: crate::style::FieldLook, pub lines: Option<usize>, pub limit: Option<usize>, pub mask: bool, pub live: bool, pub edit_target: Option<egui::IdSalt>, pub clear_on_escape: bool, pub keep_on_escape: bool, pub mono: bool, pub role: TypeRole, pub size: Option<f32>, pub top: bool, pub ink: Option<Ink>, pub tab: TabKey, pub caret: Option<usize>, pub complete: Option<Arc<dyn Completer>>, pub complete_on_enter: bool, pub replace_selection: Option<String>, pub commit_on: &'static [char], pub enabled: bool, pub steps_value: bool, pub select_on_focus: bool, pub keep_caret_on_open: bool, pub select_all: bool, pub submits: bool, pub mixed: bool, pub centred: bool, pub end_aligned: bool, pub arrows_from_end: bool, pub unparsed: Option<Message>, pub own_menu: bool, pub holds_drafts: bool, pub whole_paste: Option<Arc<WholePaste>>, pub submit_key: SubmitKey, pub resting: Option<String>, pub color_ranges: Option<Arc<ColorRanges>> }. How a text part behaves beyond its codec.
    • pub fn new() -> Self. Options with every default.
  • craft_ui::primitives::TextOutcome: pub struct TextOutcome<V> { pub rect: Rect, pub draft: Option<String>, pub value: Option<V>, pub layout: Option<super::TextLayout>, pub origin: egui::Pos2, pub caret_visible: bool, pub invalid: bool, pub committed: Option<craft_behavior::ParseNote>, pub composing: bool, pub completions: Vec<super::Completion>, pub clicked: bool }. A text part's result this pass.
    • pub const fn new(rect: Rect) -> Self. An outcome over rect with no draft or value.
  • craft_ui::primitives::TextRun: pub struct TextRun<'a> { pub spans: Vec<Span<'a>>, pub role: TypeRole, pub color: Option<StyleColor>, pub wrap: Wrap, pub ltr: bool, pub align: HAlign, pub rotation: f32, pub link_color: Option<Color32> }. The one description of UI text.
    • pub const READABLE_CHARACTERS: usize. The characters a run that elides keeps before its ellipsis at its least, its readable least: a row narrows such a run no further, and scrolls or drops it instead.
    • pub fn new(text: impl Into<Cow<'a, str>>) -> Self. A one-span run in the label role.
    • pub fn spans(spans: Vec<Span<'a>>) -> Self. A run of spans.
    • pub fn mnemonic(text: &'a str, at: Option<usize>) -> Self. text with its character at underlined, as a mnemonic shows while it is in use; all of text plain when at is None or past its end.
    • pub fn role(mut self, role: TypeRole) -> Self. Sets the type role.
    • pub fn link_color(mut self, color: Color32) -> Self. Sets the colour of the run's link spans.
    • pub fn color(mut self, color: StyleColor) -> Self. Sets the colour.
    • pub fn data_color(mut self, color: DataColor) -> Self. Sets the colour from data, painted as given: text drawn over document content (a smart guide's label in the guide's colour), whose colour belongs to the document and not to a state.
    • pub fn wrap(mut self, wrap: Wrap) -> Self. Sets how the run fits its room.
    • pub fn align(mut self, align: HAlign) -> Self. Sets where the lines sit within the run's width, and where Draw::text places the run in its rect.
    • pub fn rotated(mut self, radians: f32) -> Self. Sets the angle the run is painted at, in radians clockwise about the top-left corner of its layout.
    • pub fn elide(self) -> Self. Cuts the run with an ellipsis at the end.
    • pub fn full_text(&self) -> String. The text of every span, joined.
  • craft_ui::primitives::TextureBudget: pub struct TextureBudget { pub max_bytes: usize, pub max_entries: usize, pub uploads_per_pass: usize, pub upload_bytes_per_pass: usize }. How much a store may hold and upload.
    • pub const fn new(max_bytes: usize, max_entries: usize) -> Self. Holds max_bytes and max_entries; a loader uploads 16 pictures and 16 MiB per frame.
    • pub const fn uploads(mut self, count: usize, bytes: usize) -> Self. Other upload limits per frame.
  • craft_ui::primitives::TextureCache: re-export of craft_ui::primitives::textures::TextureCache.
  • craft_ui::primitives::TextureKey: pub trait TextureKey: Clone + Eq + Hash + Send + Sync + 'static. What can key a stored texture: a layer id, a path, a (document, page) pair.
  • craft_ui::primitives::TextureLoader: pub struct TextureLoader<K: TextureKey>. A TextureStore whose pictures are made by background jobs: FilmCraft's frames, PdfCraft's pages and the thumbnails of a list.
    • pub fn waited(&self, ctx: &Context, key: &K) -> Option<f64>. Seconds key has waited for its picture since its job was queued, by the pass clock; None when no job of the key is queued or running.
    • pub fn in_context(ctx: &Context, salt: impl Hash + Debug, options: LoaderOptions) -> Self. The loader of ctx under salt, made with options the first time; its store is TextureStore::in_context under the same salt.
    • pub fn cache(&self) -> &TextureStore<K>. The loader's store: state, forget, retain and statistics work on it as on any store.
    • pub fn request<J>(&self, ctx: &Context, key: &K, revision: Revision, priority: Priority, job: impl FnOnce() -> J) -> TextureState where J: FnOnce(&Cancel) -> LoadResult + Send + 'static,. What key shows for revision, queueing the job job() makes when the store has nothing for this revision and no job for it is queued or running: ask, then submit. job is called only when a job is queued.
    • pub fn ask(&self, ctx: &Context, key: &K, revision: Revision, priority: Priority) -> Option<TextureState>. What key shows for revision when that is known without a new job: Some of the store's Ready, Empty or Failed, or Some(Loading { stand_in }) while a job for this revision is queued or running; None when a job is needed.
    • pub fn submit(&self, ctx: &Context, key: K, revision: Revision, priority: Priority, job: impl FnOnce(&Cancel) -> LoadResult + Send + 'static,) -> TextureState. Queues job making key's picture at revision, replacing a queued job of the key, and returns Loading with the key's old picture as the stand-in.
    • pub fn shutdown(&self, timeout: std::time::Duration) -> bool. Stops the loader's queue: waiting jobs are dropped, running ones are cancelled, and the call waits up to timeout for them to end.
  • craft_ui::primitives::TextureState: pub enum TextureState { Missing, Loading { stand_in: Option<CachedTexture>, waited: Option<f64> }, Ready(CachedTexture), Empty, Failed { failure: LoadFailure } }. What a key shows for a revision, from TextureStore::state.
    • pub fn shown(&self) -> Option<CachedTexture>. The picture to draw now: the ready one, or the stand-in while loading.
  • craft_ui::primitives::TextureStatistics: pub struct TextureStatistics { pub entries: usize, pub bytes: usize, pub uploads: usize, pub upload_bytes: usize, pub evicted: usize }. What a store holds and did, for automation, stories and tests.
  • craft_ui::primitives::TextureStore: pub struct TextureStore<K: TextureKey>. Textures by key and revision, with byte and entry budgets: the one place an app's pictures become egui textures.
    • pub fn in_context(ctx: &Context, salt: impl Hash + Debug, options: TextureStoreOptions) -> Self. The store of ctx under salt, made with options the first time.
    • pub fn state(&self, ctx: &Context, key: &K, revision: Revision) -> TextureState. What key shows for revision (see TextureState), and marks the entry seen this frame.
    • pub fn put(&self, ctx: &Context, key: K, revision: Revision, image: ColorImage) -> CachedTexture. Stores image as key's picture at revision and returns it: in place when the key has a texture (same id), else a new texture with the store's filter.
    • pub fn put_region(&self, ctx: &Context, key: &K, revision: Revision, origin: [u32; 2], image: ColorImage) -> Option<CachedTexture>. Updates part of key's picture in place and moves the entry to revision: image goes at origin, both in the pixels of the image last put (the navigator's damage updates).
    • pub fn get_or_put(&self, ctx: &Context, key: K, revision: Revision, make: impl FnOnce() -> ColorImage) -> CachedTexture. key's picture at revision, calling make and putting its image only when the entry has another revision or none.
    • pub fn put_empty(&self, ctx: &Context, key: K, revision: Revision). Records that key has no picture at revision (state Empty); frees its texture.
    • pub fn put_failure(&self, ctx: &Context, key: K, revision: Revision, failure: LoadFailure). Records that making key's picture at revision failed (state Failed), so nothing asks for it again until the revision changes; frees its texture.
    • pub fn forget(&self, ctx: &Context, key: &K). Drops key's entry and frees its texture.
    • pub fn retain(&self, ctx: &Context, mut keep: impl FnMut(&K) -> bool). Keeps only the entries whose key keep accepts (PhotoCraft's prune_thumbs when the open documents change). keep runs outside the store's lock.
    • pub fn clear(&self, ctx: &Context). Drops every entry (another library opened); a packed store's pages start over and keep their textures.
    • pub fn allow_upload(&self, ctx: &Context, bytes: usize) -> bool. Whether this frame's upload allowance has room for one more upload of bytes: fewer than uploads_per_pass uploads and at most upload_bytes_per_pass bytes so far, counting bytes.
    • pub fn statistics(&self, ctx: &Context) -> TextureStatistics. What the store holds and uploaded this frame.
    • pub fn options(&self) -> TextureStoreOptions. The options the store was made with.
  • craft_ui::primitives::TextureStoreOptions: pub struct TextureStoreOptions { pub budget: TextureBudget, pub filter: TextureOptions, pub packed: Option<u32> }. A store's settings, read when the store is created (TextureStore::in_context).
    • pub const fn thumbnails() -> Self. Row and grid thumbnails: 32 MiB and 512 entries.
    • pub const fn pages() -> Self. Document pages: 128 MiB and 64 entries.
    • pub const fn frames() -> Self. Video frames and other named images: 64 MiB and 512 entries.
    • pub const fn packed(mut self, max_side: u32) -> Self. Puts pictures up to max_side texels per side on a few shared page textures written in place, so browsing many small pictures creates and frees no textures.
    • pub const fn packed_small(self) -> Self. [packed] for the small pictures of an interface (a style tile, a font sample row): those up to a quarter of a page side share pages, so a few large ones never fill a page alone; a larger picture takes a texture of its own.
    • pub const fn filter(mut self, filter: TextureOptions) -> Self. The sampling of every texture.
    • pub const fn budget(mut self, budget: TextureBudget) -> Self. Other limits.
  • craft_ui::primitives::TextureWords: re-export of craft_ui::primitives::textures::TextureWords (defined outside these crates).
  • craft_ui::primitives::ThumbFit: pub enum ThumbFit { Contain, Cover }. How [Thumbnails::paint] fits a picture into its cell.
  • craft_ui::primitives::ThumbJob: pub type ThumbJob = Box<dyn FnOnce(&Cancel) -> Result<LoadedPicture, LoadFailure> + Send>. A background render: runs on a queue lane, checks the [Cancel] between steps, and returns the picture, the answer that the key has none (LoadedPicture::Blank, state Empty), or the LoadFailure the tooltip words.
  • craft_ui::primitives::ThumbPaint: pub struct ThumbPaint { pub fit: ThumbFit, pub checker: bool, pub paper: Option<DataColor>, pub tint: DataColor, pub states: StateLook }. How to paint one thumbnail.
    • pub fn fit(mut self, fit: ThumbFit) -> Self. Sets how the picture fits its box.
    • pub fn checker(mut self, checker: bool) -> Self. Sets whether the transparency grid shows behind the picture.
    • pub fn paper(mut self, paper: DataColor) -> Self. Sets the paper under the picture: a fill in place of the transparency grid, whatever checker says (a page thumbnail's paper is document data).
    • pub fn tint(mut self, tint: DataColor) -> Self. Sets the tint that multiplies the picture.
    • pub fn states(mut self, states: StateLook) -> Self. Sets what a picture that is not ready, or failed, shows.
  • craft_ui::primitives::ThumbRender: pub enum ThumbRender { Ready(ColorImage), Later(ThumbJob), Blank }. What a [ThumbSource] renders for a key.
  • craft_ui::primitives::ThumbRequest: pub struct ThumbRequest { pub side: u32, pub pixels_per_point: f32, pub region: Option<Rect> }. What a thumbnail is asked at: the side in pixels, the screen's density and the part of the frame wanted.
    • pub fn for_cell(points: f32, pixels_per_point: f32) -> ThumbRequest. The request for a cell points wide on a screen of pixels_per_point: the side in pixels rounded up to a multiple of 16, at least 16 and at most MAX_TEXTURE. 28 points at 2x is 64 pixels.
    • pub fn region(self, region: Rect) -> ThumbRequest. The request for the part region of the frame (fractions of the frame, 0 to 1).
  • craft_ui::primitives::ThumbSource: pub trait ThumbSource<K>. The app's side of the contract: how a key's picture is versioned and made.
    • fn revision(&self, key: &K, request: &ThumbRequest) -> Revision. The version of key's picture.
    • fn render(&self, key: &K, request: &ThumbRequest) -> ThumbRender. Makes key's picture, now or as a job.
  • craft_ui::primitives::ThumbnailOptions: pub struct ThumbnailOptions { pub max_side: u32, pub store: TextureStoreOptions, pub lanes: usize, pub jobs: Option<Arc<dyn Jobs>>, pub renders_per_pass: usize }. A [Thumbnails]' settings, read when it is created.
    • pub fn new() -> Self. Sides up to 512, thumbnail budgets, the machine's lanes, the host's jobs, 16 renders per pass.
    • pub fn max_side(mut self, max_side: u32) -> Self. The longest side any request is lowered to.
    • pub fn store(mut self, store: TextureStoreOptions) -> Self. Budgets of the texture store.
    • pub fn lanes(mut self, lanes: usize) -> Self. Lanes of the queue for Later renders.
    • pub fn jobs(mut self, jobs: Arc<dyn Jobs>) -> Self. Where the lanes run.
    • pub fn renders_per_pass(mut self, renders: usize) -> Self. Renders on the UI thread per pass.
  • craft_ui::primitives::Thumbnails: pub struct Thumbnails<K: TextureKey>. Thumbnails of one kind (layers, channels, snapshots, a grid's files) over one store: what every list and grid draws its pictures with.
    • pub fn waited(&self, ctx: &Context, key: &K) -> Option<f64>. Seconds key has waited for its picture since its job was queued, None when no job of it waits (TextureLoader::waited).
    • pub fn in_context(ctx: &Context, salt: impl std::hash::Hash + std::fmt::Debug, options: ThumbnailOptions) -> Self. The thumbnails stored in ctx under salt, made with options the first time; the loader and its store live under the same salt.
    • pub fn state(&self, ctx: &Context, source: &dyn ThumbSource<K>, key: &K, request: &ThumbRequest, priority: Priority) -> TextureState. What key shows now; renders or queues it when its revision has no picture yet.
    • pub fn paint(&self, cx: &ContentPainterCx<'_>, rect: Rect, state: &TextureState, paint: &ThumbPaint) -> bool. Paints state into rect and returns whether it drew anything:
    • pub fn shutdown(&self, timeout: Duration) -> bool. Stops the queue of Later renders and waits up to timeout for the running ones to end (TextureLoader::shutdown); returns whether they have.
    • pub fn hold(&self, hold: bool). Freezes the shown pictures while hold: no render starts and no job is queued; state returns the current picture of each key (as Loading when its revision moved on).
    • pub fn retain(&self, ctx: &Context, keep: impl FnMut(&K) -> bool). Keeps only the pictures whose key keep accepts (the open documents changed).
    • pub fn cache(&self) -> &super::TextureStore<K>. The store under the thumbnails, for forget, clear and statistics.
  • craft_ui::primitives::Tick: pub struct Tick { pub at: f32, pub rank: TickRank }. One tick: where it sits along its edge and how long it is.
    • pub const fn new(at: f32, rank: TickRank) -> Self. A tick at at of the length class rank.
  • craft_ui::primitives::TickEdge: pub enum TickEdge { Bottom, Top, Left, Right }. Which edge of a rect a tick row sits on, and so which way its marks point.
    • pub const fn horizontal(self) -> bool. Whether positions run along x (a top or bottom edge).
  • craft_ui::primitives::TickRank: pub enum TickRank { Minor, Mid, Major }. How long a tick is: the rank it has among its neighbours.
  • craft_ui::primitives::ToolIcon: pub enum ToolIcon { Custom(IconId), Move, Artboard, RectangularMarquee, EllipticalMarquee, SingleRowMarquee, SingleColumnMarquee, Brush, Pencil, MixerBrush, ColorReplacement, Eraser, BackgroundEraser, MagicEraser, Eyedropper, ColorSampler, Ruler, Note, Count, Lasso, PolygonalLasso, MagneticLasso, MagicWand, Crop, PerspectiveCrop, Slice, SliceSelect, Frame, Gradient, PaintBucket, HorizontalType, VerticalType, HorizontalTypeMask, VerticalTypeMask, Hand, RotateView, Zoom, SpotHealing, Healing, Remove, Patch, ContentAwareMove, RedEye, CloneStamp, PatternStamp, HistoryBrush, ArtHistoryBrush, Blur, Sharpen, Smudge, Dodge, Burn, Sponge, QuickSelection, ObjectSelection, Pen, FreeformPen, CurvaturePen, AddAnchorPoint, DeleteAnchorPoint, ConvertPoint, PathSelection, DirectSelection, Rectangle, Ellipse, Triangle, Polygon, Line, CustomShape }. A tool, for its icon: a raster editor's tool set, which other apps share variant for variant (a vector editor's Pen is [ToolIcon::Pen]).
    • pub const ALL: [ToolIcon; 68]. Every tool, in this enum's order.
    • pub fn icon(&self) -> IconId. The icon that draws the tool.
    • pub fn id(&self) -> &str. The tool's id as the apps' tool commands spell it (tool.rectangularMarquee without the tool. prefix), for automation and the keymap catalog; a custom tool's is its icon's name.
    • pub fn from_id(id: &str) -> Option<ToolIcon>. The built-in tool for an id, None for an unknown one and for a custom tool.
  • craft_ui::primitives::WellFill: pub enum WellFill { Color(Srgba), Mixed, None, Empty }. What a swatch well shows.
  • craft_ui::primitives::Wrap: pub enum Wrap { Line, Wrap, Clip, Elide, ElideStart, ElideMiddle, ElidePath, Clamp(u8) }. How a run fits its room.
    • pub const fn cuts(self) -> bool. Whether the run is one line cut to its room.
  • craft_ui::primitives::cancel_press_of: pub fn cancel_press_of(ctx: &Context, owner: Id). Ends the press owner holds open the way Escape ends a captured press: the next lifecycle run of the arena it is open in reports PressPhase::Cancel with PressCancel::Host, and step 9 cancels the gesture the press carries (CancelReason::HostChanged).
  • craft_ui::primitives::dashed: pub fn dashed(points: &[Pos2], pattern: Dashes, width: f32, color: Color32) -> Vec<Shape>. A dashed line along points in color, width thick, with the lengths and phase of pattern.
  • craft_ui::primitives::drop_mark: pub fn drop_mark(tokens: &UiTokens, from: Pos2, to: Pos2, pixels_per_point: f32) -> Vec<Shape>. The insertion mark of a drop from from to to.
  • craft_ui::primitives::ellipse: pub fn ellipse(center: Pos2, axes: [Vec2; 2]) -> Vec<Pos2>. The points of the ellipse with centre center and conjugate half-axes axes (a rotated or skewed circle is a pair of axes), counter-clockwise from the first axis, with a count that keeps the chord error under a fraction of a point at any size.
  • craft_ui::primitives::fill_polygon: pub fn fill_polygon(points: &[Pos2], color: Color32, feather: f32) -> Mesh. The closed polygon through points (convex or not; its edges must not cross) filled with color, as one mesh:
  • craft_ui::primitives::fit_image: pub fn fit_image(image: ColorImage, max_side: u32) -> ColorImage. image reduced to at most max_side texels per side, or unchanged when it fits.
  • craft_ui::primitives::fit_rect: pub fn fit_rect(cell: Rect, picture: Vec2) -> Rect. The rect inside cell that shows a picture of picture's aspect whole, as large as fits and centred; cell itself for a zero-sized picture.
  • craft_ui::primitives::frame_surfaces: pub fn frame_surfaces(ui: &Ui, rect: Rect, radius: CornerRadius). Rounds the surfaces painted from here on in ui's layer that meet a corner of rect: such a surface takes radius at that corner where its own is smaller.
  • craft_ui::primitives::grid_lines: pub fn grid_lines(tokens: &UiTokens, grid: &GridLines, ink: &GridInk, pixels_per_point: f32) -> Vec<Shape>. The lines of grid as ink draws them: minor lines first, then the major ones, each running across the grid's extent and mapped through its view.
  • craft_ui::primitives::grid_lines_with: pub fn grid_lines_with(look: &GridLook, grid: &GridLines, ink: &GridInk, pixels_per_point: f32) -> Vec<Shape>. [grid_lines] from a look read earlier.
  • craft_ui::primitives::has_icon: pub fn has_icon(id: &IconId) -> bool. Whether the built-in catalog or a registered app icon set has an icon named id.
  • craft_ui::primitives::icon_names: pub fn icon_names() -> &'static [&'static str]. The names of the built-in catalog's icons, sorted; app icon sets registered with register_app_icons are not listed.
  • craft_ui::primitives::marching_ants: pub fn marching_ants(tokens: &UiTokens, points: &[Pos2], closed: bool, phase: f32, clip: Rect, pixels_per_point: f32) -> Vec<Shape>. Marching ants along points (closed when closed) inside clip: bands of the marquee colour with dark dashes in the halo colour, shifted by phase points along the path.
  • craft_ui::primitives::member_gesture_running: pub fn member_gesture_running(ctx: &Context, viewport: ViewportId, arena: Id) -> bool. Whether a member of the arena root arena (a canvas control in a canvas, say) has a running gesture, in viewport: begun and not yet committed, cancelled or removed.
  • craft_ui::primitives::outline: pub fn outline(tokens: &UiTokens, shape: &PaintShape) -> Vec<Shape>. The line that marks a shape on any image: a thick halo under a medium line, in the overlay colours.
  • craft_ui::primitives::outline_with: pub fn outline_with(halo: Stroke, line: Stroke, shapes: &[PaintShape]) -> Vec<Shape>. The outline of shapes with the strokes given: the halo under the line.
  • craft_ui::primitives::paint_icon: pub fn paint_icon(painter: &Painter, tokens: &UiTokens, direction: Direction, rect: Rect, spec: &IconSpec<'_>). Paints spec centred in rect as components do, so a [Glyph] (which gets a raw Painter) can draw a set icon inside its own drawing: in its enabled inks, on the surface its own ink names. Draw::icon adds the badge.
  • craft_ui::primitives::paint_surround: pub fn paint_surround(painter: &egui::Painter, area: CheckerArea, look: &SurroundLook). Paints the surround look over area: the fill, and with a pattern one textured shape of the dot tile over it.
  • craft_ui::primitives::painted_image: pub fn painted_image(env: &Env, cursor: &PaintedCursor, scale: f32) -> Option<CursorBitmap>. The window image of the painted pointer cursor at scale device pixels per point, rasterised from the art the ghost paints; None when the art does not fit a cursor image.
  • craft_ui::primitives::ramp: pub fn ramp(rect: Rect, radius: CornerRadius, stops: &[(f32, DataColor)], axis: Axis) -> Vec<Shape>. A colour ramp over rect with corners of radius (CornerRadius::ZERO for square ones): the strip shades from stop to stop along axis (Axis::X runs left to right, Axis::Y top to bottom).
  • craft_ui::primitives::reduce_image: pub fn reduce_image(image: &ColorImage, factor: u32) -> ColorImage. image box-averaged by the whole factor, in premultiplied values.
  • craft_ui::primitives::register_app_icons: pub fn register_app_icons(set: &'static AppIcons). Registers set in the process-wide list beside the built-in catalog; runs before the first pass.
  • craft_ui::primitives::swath: pub fn swath(tokens: &UiTokens, points: &[Pos2], width: f32) -> Vec<Shape>. A line width points wide along points, with round dots at every point, in the theme's text-selection fill (translucent, so the content under it shows): the swath a rubbing tool leaves.
  • craft_ui::primitives::texture_factor: pub fn texture_factor(size: PixelSize, side: u32) -> u32. How many document pixels per side one texel of the base texture holds for a document of size with textures at most side per side: 1 when it fits.
  • craft_ui::primitives::texture_side: pub fn texture_side(ctx: &Context) -> u32. The texture side on this device: [MAX_TEXTURE], or the device's smaller limit (2048 on some older GPUs and WebGL); past it egui asserts and the backend fails.
  • craft_ui::primitives::thumb_image: pub fn thumb_image(frame: PixelSize, longest_side: u32, mut sample: impl FnMut(u32, u32) -> [u8; 4]) -> ColorImage. A picture of the document area frame (pixels) with that exact aspect, its longest side longest_side, each side at least 1: texel (tx, ty) is sample(x, y) at the document pixel under the texel's centre, x and y counted from the frame's top left (the caller adds the frame's origin). sample returns sRGBA, unmultiplied.
  • craft_ui::primitives::ticks: pub fn ticks(tokens: &UiTokens, rect: Rect, edge: TickEdge, face: RulerFace, ticks: &[Tick], clip: Rect, pixels_per_point: f32) -> Vec<Shape>. The tick marks of ticks along edge of rect that clip shows, stroke.thin lines of text.faint: minor ones TICK_MINOR long, mid ones TICK_MID, major ones across the whole depth of rect.

craft_ui::primitives::backdrop

Frosted backdrops: a bounded blurred composition of the layers under a surface, and its upload to the texture store.

  • craft_ui::primitives::backdrop::BackdropLayer: pub struct BackdropLayer<'a> { pub rect: Rect, pub thumbnail: Option<&'a Thumbnail>, pub fallback: Color32 }. One layer of a backdrop: where it lies, its reduced picture and the colour that stands in for a missing one.
    • pub const fn new(rect: Rect, thumbnail: Option<&'a Thumbnail>, fallback: Color32) -> Self. The layer over rect showing thumbnail, or fallback where it has none.
  • craft_ui::primitives::backdrop::MAX_SIDE: pub const MAX_SIDE: usize. The longest side a composed image may have.
  • craft_ui::primitives::backdrop::MAX_SOURCE_PIXELS: pub const MAX_SOURCE_PIXELS: usize. The most pixels a source image may have for [Thumbnail::from_image].
  • craft_ui::primitives::backdrop::MAX_TEXELS: pub const MAX_TEXELS: usize. The most texels a composed image may have.
  • craft_ui::primitives::backdrop::Thumbnail: pub struct Thumbnail. An averaged, opaque thumbnail of a captured surface.
    • pub fn from_image(image: &ColorImage, block: usize, paper: Color32) -> Option<Thumbnail>. Averages block-pixel squares of image, compositing its premultiplied pixels over paper (taken as opaque).
  • craft_ui::primitives::backdrop::compose: pub fn compose(area: Rect, layers: &[BackdropLayer<'_>], background: Color32) -> Option<ColorImage>. The blurred composition of layers over background for area: an opaque image of cells about four points wide, at most [MAX_SIDE] per side and [MAX_TEXELS] in all, softened by three box passes per axis.
  • craft_ui::primitives::backdrop::upload: pub fn upload<K: TextureKey>(store: &TextureStore<K>, ctx: &Context, key: K, image: ColorImage) -> Option<CachedTexture>. Puts image in store under key: an equal revision keeps the cached texture, a new one replaces it in place (the id stays), and the store's budget and eviction apply.

craft_ui::primitives::textures

TextureCache, the icon texture path, and beside it the keyed TextureStore with its background TextureLoader.

  • craft_ui::primitives::textures::TextureCache: pub struct TextureCache. The texture cache of a context: components keep a cache key and ask for the texture when they paint.
    • pub const CAPACITY: usize. The number of textures above which the cache drops those no frame asked for lately.
    • pub fn texture<K: Hash + 'static>(ctx: &Context, key: K, image: impl FnOnce() -> ColorImage) -> TextureId. The texture for key: loads image() on the first request and returns the same texture afterwards.
    • pub fn texture_with<K: Hash + 'static>(ctx: &Context, key: K, options: TextureOptions, image: impl FnOnce() -> ColorImage) -> TextureId. The texture for key sampled with options (a repeating pattern, nearest filtering); see [Self::texture].
    • pub fn texture_if<K: Hash + 'static>(ctx: &Context, key: K, image: impl FnOnce() -> Option<ColorImage>) -> Option<TextureId>. The texture for key, or None when image has nothing to draw; the answer is kept like a texture, so image runs once per key.
    • pub fn len(ctx: &Context) -> usize. The number of textures the context holds.
    • pub fn is_empty(ctx: &Context) -> bool. Whether the context holds no texture.
    • pub fn clear(ctx: &Context). Drops every texture of the context; the next request loads again.
  • craft_ui::primitives::textures::CachedTexture: pub struct CachedTexture { pub id: TextureId, pub size: PixelSize, pub origin: [u32; 2], pub page: PixelSize }. A stored picture as a painter draws it: painter.image(texture.id, rect, uv, tint).
    • pub fn uv(&self) -> Rect. The picture's part of its page texture, in uv coordinates, to paint with id: the full rect for an unpacked texture.
    • pub fn size_vec2(&self) -> Vec2. size as a vector, for fitting: only the aspect matters to a cell.
    • pub fn sized(&self) -> SizedTexture. The texture with its size, the form PreviewPane and egui's image widgets take.
  • craft_ui::primitives::textures::FakeThumbSource: pub struct FakeThumbSource<K>. A [ThumbSource] for stories and tests in every crate: pictures made from the key and a revision the test sets, so every state shows without a document.
    • pub fn new() -> Self. Synchronous square pictures at revision 0.
    • pub fn later(mut self, later: bool) -> Self. Renders as Later jobs.
    • pub fn opaque(mut self, opaque: bool) -> Self. The picture has no transparent quarter.
    • pub fn aspect(mut self, width: u32, height: u32) -> Self. The frame's width to height (4:3 landscape, 3:4 portrait).
    • pub fn failing(mut self, keys: impl IntoIterator<Item = K>) -> Self. These keys fail.
    • pub fn blank(mut self, keys: impl IntoIterator<Item = K>) -> Self. These keys have no picture.
    • pub fn set_revision(&mut self, revision: u64). Every key's revision.
    • pub fn bump(&mut self). Moves every key's revision on by one.
  • craft_ui::primitives::textures::LoadFailure: pub enum LoadFailure { Missing, Unreadable, Panicked, Message(String) }. Why a job made no picture.
    • pub fn text<'a>(&'a self, words: &'a TextureWords) -> &'a str. The failure tooltip in the words of the scope (cx.words::<TextureWords>()).
  • craft_ui::primitives::textures::LoadResult: pub type LoadResult = Result<LoadedPicture, LoadFailure>. What a loader job returns: a LoadedPicture, or why there is none.
  • craft_ui::primitives::textures::LoadedPicture: pub enum LoadedPicture { Image(ColorImage), Blank }. What a background job makes when it succeeds: a picture, or the answer that the key has none.
  • craft_ui::primitives::textures::LoaderOptions: pub struct LoaderOptions { pub store: TextureStoreOptions, pub lanes: usize, pub jobs: Option<Arc<dyn Jobs>> }. A loader's settings, read when it is created (TextureLoader::in_context).
    • pub fn new() -> Self. Thumbnail budgets, the machine's lanes, the host's jobs.
    • pub fn store(mut self, store: TextureStoreOptions) -> Self. Settings of the loader's store.
    • pub fn lanes(mut self, lanes: usize) -> Self. Jobs running at once.
    • pub fn jobs(mut self, jobs: Arc<dyn Jobs>) -> Self. Where the lanes run.
  • craft_ui::primitives::textures::MAX_TEXTURE: pub const MAX_TEXTURE: u32. The largest texture side the library uploads.
  • craft_ui::primitives::textures::Priority: re-export of craft_ui::primitives::textures::loader::Priority (defined outside these crates).
  • craft_ui::primitives::textures::Revision: pub struct Revision. The version of a key's picture, computed by the app: a stored fingerprint, an Arc address with a Weak guard, a frame key.
    • pub const fn new(value: u64) -> Revision. The revision value (a document's own change counter).
    • pub const fn get(self) -> u64. The number.
    • pub fn of(value: &impl Hash) -> Revision. The revision of anything hashable: Revision::of(&(fingerprint, doc_width)).
  • craft_ui::primitives::textures::Serials: pub struct Serials. The numbers that keep apart the textures one owner makes: a mask or preview made anew gets a number no earlier one of the same Serials had, so an entry kept under its key is never taken for the new one's.
    • pub fn mint(&mut self) -> u64. A new number: never one this Serials gave before.
  • craft_ui::primitives::textures::StateLook: pub enum StateLook { Glyph, Captioned }. What a thumbnail that is not ready, or failed, shows.
  • craft_ui::primitives::textures::TextureBudget: pub struct TextureBudget { pub max_bytes: usize, pub max_entries: usize, pub uploads_per_pass: usize, pub upload_bytes_per_pass: usize }. How much a store may hold and upload.
    • pub const fn new(max_bytes: usize, max_entries: usize) -> Self. Holds max_bytes and max_entries; a loader uploads 16 pictures and 16 MiB per frame.
    • pub const fn uploads(mut self, count: usize, bytes: usize) -> Self. Other upload limits per frame.
  • craft_ui::primitives::textures::TextureKey: pub trait TextureKey: Clone + Eq + Hash + Send + Sync + 'static. What can key a stored texture: a layer id, a path, a (document, page) pair.
  • craft_ui::primitives::textures::TextureLoader: pub struct TextureLoader<K: TextureKey>. A TextureStore whose pictures are made by background jobs: FilmCraft's frames, PdfCraft's pages and the thumbnails of a list.
    • pub fn waited(&self, ctx: &Context, key: &K) -> Option<f64>. Seconds key has waited for its picture since its job was queued, by the pass clock; None when no job of the key is queued or running.
    • pub fn in_context(ctx: &Context, salt: impl Hash + Debug, options: LoaderOptions) -> Self. The loader of ctx under salt, made with options the first time; its store is TextureStore::in_context under the same salt.
    • pub fn cache(&self) -> &TextureStore<K>. The loader's store: state, forget, retain and statistics work on it as on any store.
    • pub fn request<J>(&self, ctx: &Context, key: &K, revision: Revision, priority: Priority, job: impl FnOnce() -> J) -> TextureState where J: FnOnce(&Cancel) -> LoadResult + Send + 'static,. What key shows for revision, queueing the job job() makes when the store has nothing for this revision and no job for it is queued or running: ask, then submit. job is called only when a job is queued.
    • pub fn ask(&self, ctx: &Context, key: &K, revision: Revision, priority: Priority) -> Option<TextureState>. What key shows for revision when that is known without a new job: Some of the store's Ready, Empty or Failed, or Some(Loading { stand_in }) while a job for this revision is queued or running; None when a job is needed.
    • pub fn submit(&self, ctx: &Context, key: K, revision: Revision, priority: Priority, job: impl FnOnce(&Cancel) -> LoadResult + Send + 'static,) -> TextureState. Queues job making key's picture at revision, replacing a queued job of the key, and returns Loading with the key's old picture as the stand-in.
    • pub fn shutdown(&self, timeout: std::time::Duration) -> bool. Stops the loader's queue: waiting jobs are dropped, running ones are cancelled, and the call waits up to timeout for them to end.
  • craft_ui::primitives::textures::TextureState: pub enum TextureState { Missing, Loading { stand_in: Option<CachedTexture>, waited: Option<f64> }, Ready(CachedTexture), Empty, Failed { failure: LoadFailure } }. What a key shows for a revision, from TextureStore::state.
    • pub fn shown(&self) -> Option<CachedTexture>. The picture to draw now: the ready one, or the stand-in while loading.
  • craft_ui::primitives::textures::TextureStatistics: pub struct TextureStatistics { pub entries: usize, pub bytes: usize, pub uploads: usize, pub upload_bytes: usize, pub evicted: usize }. What a store holds and did, for automation, stories and tests.
  • craft_ui::primitives::textures::TextureStore: pub struct TextureStore<K: TextureKey>. Textures by key and revision, with byte and entry budgets: the one place an app's pictures become egui textures.
    • pub fn in_context(ctx: &Context, salt: impl Hash + Debug, options: TextureStoreOptions) -> Self. The store of ctx under salt, made with options the first time.
    • pub fn state(&self, ctx: &Context, key: &K, revision: Revision) -> TextureState. What key shows for revision (see TextureState), and marks the entry seen this frame.
    • pub fn put(&self, ctx: &Context, key: K, revision: Revision, image: ColorImage) -> CachedTexture. Stores image as key's picture at revision and returns it: in place when the key has a texture (same id), else a new texture with the store's filter.
    • pub fn put_region(&self, ctx: &Context, key: &K, revision: Revision, origin: [u32; 2], image: ColorImage) -> Option<CachedTexture>. Updates part of key's picture in place and moves the entry to revision: image goes at origin, both in the pixels of the image last put (the navigator's damage updates).
    • pub fn get_or_put(&self, ctx: &Context, key: K, revision: Revision, make: impl FnOnce() -> ColorImage) -> CachedTexture. key's picture at revision, calling make and putting its image only when the entry has another revision or none.
    • pub fn put_empty(&self, ctx: &Context, key: K, revision: Revision). Records that key has no picture at revision (state Empty); frees its texture.
    • pub fn put_failure(&self, ctx: &Context, key: K, revision: Revision, failure: LoadFailure). Records that making key's picture at revision failed (state Failed), so nothing asks for it again until the revision changes; frees its texture.
    • pub fn forget(&self, ctx: &Context, key: &K). Drops key's entry and frees its texture.
    • pub fn retain(&self, ctx: &Context, mut keep: impl FnMut(&K) -> bool). Keeps only the entries whose key keep accepts (PhotoCraft's prune_thumbs when the open documents change). keep runs outside the store's lock.
    • pub fn clear(&self, ctx: &Context). Drops every entry (another library opened); a packed store's pages start over and keep their textures.
    • pub fn allow_upload(&self, ctx: &Context, bytes: usize) -> bool. Whether this frame's upload allowance has room for one more upload of bytes: fewer than uploads_per_pass uploads and at most upload_bytes_per_pass bytes so far, counting bytes.
    • pub fn statistics(&self, ctx: &Context) -> TextureStatistics. What the store holds and uploaded this frame.
    • pub fn options(&self) -> TextureStoreOptions. The options the store was made with.
  • craft_ui::primitives::textures::TextureStoreOptions: pub struct TextureStoreOptions { pub budget: TextureBudget, pub filter: TextureOptions, pub packed: Option<u32> }. A store's settings, read when the store is created (TextureStore::in_context).
    • pub const fn thumbnails() -> Self. Row and grid thumbnails: 32 MiB and 512 entries.
    • pub const fn pages() -> Self. Document pages: 128 MiB and 64 entries.
    • pub const fn frames() -> Self. Video frames and other named images: 64 MiB and 512 entries.
    • pub const fn packed(mut self, max_side: u32) -> Self. Puts pictures up to max_side texels per side on a few shared page textures written in place, so browsing many small pictures creates and frees no textures.
    • pub const fn packed_small(self) -> Self. [packed] for the small pictures of an interface (a style tile, a font sample row): those up to a quarter of a page side share pages, so a few large ones never fill a page alone; a larger picture takes a texture of its own.
    • pub const fn filter(mut self, filter: TextureOptions) -> Self. The sampling of every texture.
    • pub const fn budget(mut self, budget: TextureBudget) -> Self. Other limits.
  • craft_ui::primitives::textures::TextureWords: re-export of craft_ui::primitives::textures::words::TextureWords (defined outside these crates).
  • craft_ui::primitives::textures::ThumbFit: pub enum ThumbFit { Contain, Cover }. How [Thumbnails::paint] fits a picture into its cell.
  • craft_ui::primitives::textures::ThumbJob: pub type ThumbJob = Box<dyn FnOnce(&Cancel) -> Result<LoadedPicture, LoadFailure> + Send>. A background render: runs on a queue lane, checks the [Cancel] between steps, and returns the picture, the answer that the key has none (LoadedPicture::Blank, state Empty), or the LoadFailure the tooltip words.
  • craft_ui::primitives::textures::ThumbPaint: pub struct ThumbPaint { pub fit: ThumbFit, pub checker: bool, pub paper: Option<DataColor>, pub tint: DataColor, pub states: StateLook }. How to paint one thumbnail.
    • pub fn fit(mut self, fit: ThumbFit) -> Self. Sets how the picture fits its box.
    • pub fn checker(mut self, checker: bool) -> Self. Sets whether the transparency grid shows behind the picture.
    • pub fn paper(mut self, paper: DataColor) -> Self. Sets the paper under the picture: a fill in place of the transparency grid, whatever checker says (a page thumbnail's paper is document data).
    • pub fn tint(mut self, tint: DataColor) -> Self. Sets the tint that multiplies the picture.
    • pub fn states(mut self, states: StateLook) -> Self. Sets what a picture that is not ready, or failed, shows.
  • craft_ui::primitives::textures::ThumbRender: pub enum ThumbRender { Ready(ColorImage), Later(ThumbJob), Blank }. What a [ThumbSource] renders for a key.
  • craft_ui::primitives::textures::ThumbRequest: pub struct ThumbRequest { pub side: u32, pub pixels_per_point: f32, pub region: Option<Rect> }. What a thumbnail is asked at: the side in pixels, the screen's density and the part of the frame wanted.
    • pub fn for_cell(points: f32, pixels_per_point: f32) -> ThumbRequest. The request for a cell points wide on a screen of pixels_per_point: the side in pixels rounded up to a multiple of 16, at least 16 and at most MAX_TEXTURE. 28 points at 2x is 64 pixels.
    • pub fn region(self, region: Rect) -> ThumbRequest. The request for the part region of the frame (fractions of the frame, 0 to 1).
  • craft_ui::primitives::textures::ThumbSource: pub trait ThumbSource<K>. The app's side of the contract: how a key's picture is versioned and made.
    • fn revision(&self, key: &K, request: &ThumbRequest) -> Revision. The version of key's picture.
    • fn render(&self, key: &K, request: &ThumbRequest) -> ThumbRender. Makes key's picture, now or as a job.
  • craft_ui::primitives::textures::ThumbnailOptions: pub struct ThumbnailOptions { pub max_side: u32, pub store: TextureStoreOptions, pub lanes: usize, pub jobs: Option<Arc<dyn Jobs>>, pub renders_per_pass: usize }. A [Thumbnails]' settings, read when it is created.
    • pub fn new() -> Self. Sides up to 512, thumbnail budgets, the machine's lanes, the host's jobs, 16 renders per pass.
    • pub fn max_side(mut self, max_side: u32) -> Self. The longest side any request is lowered to.
    • pub fn store(mut self, store: TextureStoreOptions) -> Self. Budgets of the texture store.
    • pub fn lanes(mut self, lanes: usize) -> Self. Lanes of the queue for Later renders.
    • pub fn jobs(mut self, jobs: Arc<dyn Jobs>) -> Self. Where the lanes run.
    • pub fn renders_per_pass(mut self, renders: usize) -> Self. Renders on the UI thread per pass.
  • craft_ui::primitives::textures::Thumbnails: pub struct Thumbnails<K: TextureKey>. Thumbnails of one kind (layers, channels, snapshots, a grid's files) over one store: what every list and grid draws its pictures with.
    • pub fn waited(&self, ctx: &Context, key: &K) -> Option<f64>. Seconds key has waited for its picture since its job was queued, None when no job of it waits (TextureLoader::waited).
    • pub fn in_context(ctx: &Context, salt: impl std::hash::Hash + std::fmt::Debug, options: ThumbnailOptions) -> Self. The thumbnails stored in ctx under salt, made with options the first time; the loader and its store live under the same salt.
    • pub fn state(&self, ctx: &Context, source: &dyn ThumbSource<K>, key: &K, request: &ThumbRequest, priority: Priority) -> TextureState. What key shows now; renders or queues it when its revision has no picture yet.
    • pub fn paint(&self, cx: &ContentPainterCx<'_>, rect: Rect, state: &TextureState, paint: &ThumbPaint) -> bool. Paints state into rect and returns whether it drew anything:
    • pub fn shutdown(&self, timeout: Duration) -> bool. Stops the queue of Later renders and waits up to timeout for the running ones to end (TextureLoader::shutdown); returns whether they have.
    • pub fn hold(&self, hold: bool). Freezes the shown pictures while hold: no render starts and no job is queued; state returns the current picture of each key (as Loading when its revision moved on).
    • pub fn retain(&self, ctx: &Context, keep: impl FnMut(&K) -> bool). Keeps only the pictures whose key keep accepts (the open documents changed).
    • pub fn cache(&self) -> &super::TextureStore<K>. The store under the thumbnails, for forget, clear and statistics.
  • craft_ui::primitives::textures::fit_image: pub fn fit_image(image: ColorImage, max_side: u32) -> ColorImage. image reduced to at most max_side texels per side, or unchanged when it fits.
  • craft_ui::primitives::textures::fit_rect: pub fn fit_rect(cell: Rect, picture: Vec2) -> Rect. The rect inside cell that shows a picture of picture's aspect whole, as large as fits and centred; cell itself for a zero-sized picture.
  • craft_ui::primitives::textures::reduce_image: pub fn reduce_image(image: &ColorImage, factor: u32) -> ColorImage. image box-averaged by the whole factor, in premultiplied values.
  • craft_ui::primitives::textures::texture_factor: pub fn texture_factor(size: PixelSize, side: u32) -> u32. How many document pixels per side one texel of the base texture holds for a document of size with textures at most side per side: 1 when it fits.
  • craft_ui::primitives::textures::texture_side: pub fn texture_side(ctx: &Context) -> u32. The texture side on this device: [MAX_TEXTURE], or the device's smaller limit (2048 on some older GPUs and WebGL); past it egui asserts and the backend fails.
  • craft_ui::primitives::textures::thumb_image: pub fn thumb_image(frame: PixelSize, longest_side: u32, mut sample: impl FnMut(u32, u32) -> [u8; 4]) -> ColorImage. A picture of the document area frame (pixels) with that exact aspect, its longest side longest_side, each side at least 1: texel (tx, ty) is sample(x, y) at the document pixel under the texel's centre, x and y counted from the frame's top left (the caller adds the frame's origin). sample returns sRGBA, unmultiplied.

craft_ui::runtime

Per-pass and per-frame services and the one egui adapter.

  • craft_ui::runtime::Clip: pub struct Clip. A clip rect a record holds: the clip of the code around the record becomes the replay's clip, a clip set inside it moves with it (RecordShift::clip).
    • pub fn new(clip: Rect) -> Self. The record's clip for the clip rect clip.
    • pub fn rect(self) -> Rect. The clip rect.
  • craft_ui::runtime::InstallError: re-export of craft_ui::runtime::install::InstallError.
  • craft_ui::runtime::InstallSpec: re-export of craft_ui::runtime::install::InstallSpec.
  • craft_ui::runtime::RecordShift: re-export of craft_ui::runtime::egui::RecordShift (defined outside these crates).
  • craft_ui::runtime::Shift: pub trait Shift. A value a record holds, at the place a replay adds the record (RecordShift): rects and points move with the record, clip rects (Clip) go through the replay's clip, and everything else stays.
    • fn shifted(&self, by: &RecordShift) -> Self. self at the place by names.
    • fn snapped(&self, to: &Self, within: f32) -> Self. self with each coordinate shifted moves, and each distance a hit shape holds (reach, min_across), taken from to where the two lie within within points; everything else, a bare float included, stays.
  • craft_ui::runtime::install: re-export of craft_ui::runtime::install::install.

craft_ui::runtime::access

Role, the access facts of a component and the AccessKit emitter (chapter 12).

  • craft_ui::runtime::access::Access: pub struct Access. The facts a component adds to its AccessKit node: what the pipeline cannot derive from the label, the flags and the parts.
    • pub fn role(&mut self, role: Role) -> &mut Self. The role of this instance, one of the component's ALT_ROLES.
    • pub fn name(&mut self, name: Name) -> &mut Self. How the node is named, when the label is not the name.
    • pub fn description(&mut self, text: impl Into<String>) -> &mut Self. A description, over the bound command's hint and the tooltip.
    • pub fn placeholder(&mut self, text: impl Into<String>) -> &mut Self. The hint text of an empty input.
    • pub fn value(&mut self, text: impl Into<String>) -> &mut Self. The text value of a text component.
    • pub fn unit(&mut self, unit: impl Into<String>) -> &mut Self. The unit a text component draws after its text: the node's value reads it after the text ("160 pt"), while the text runs stay the editable text.
    • pub fn color(&mut self, color: Srgba) -> &mut Self. The colour value of a colour well.
    • pub fn numeric(&mut self, numeric: Numeric) -> &mut Self. The numeric value of a value component; a step also declares increment and decrement.
    • pub fn variable_steps(&mut self, increment: bool, decrement: bool) -> &mut Self. Offers the available Increment and Decrement actions for a numeric value with no fixed step size.
    • pub fn expanded(&mut self, on: bool) -> &mut Self. Whether a disclosure is open, when no flag says it.
    • pub fn has_popup(&mut self, kind: PopupKind) -> &mut Self. What kind of popup the component opens.
    • pub fn level(&mut self, level: usize) -> &mut Self. The heading level or tree depth.
    • pub fn grid(&mut self, grid: GridPlace) -> &mut Self. The row and column counts of a grid or table node.
    • pub fn position(&mut self, position: SetPosition) -> &mut Self. The place in a closed set.
    • pub fn required(&mut self, on: bool) -> &mut Self. The input must be filled in.
    • pub fn url(&mut self, url: impl Into<String>) -> &mut Self. The target of a link.
    • pub fn shortcut(&mut self, text: impl Into<String>) -> &mut Self. The keyboard shortcut, over the bound command's.
    • pub fn no_shortcut(&mut self) -> &mut Self. The node lists no keyboard shortcut, though a command bound to the component has a chord.
    • pub fn access_key(&mut self, key: char) -> &mut Self. The mnemonic letter.
    • pub fn labelled_by(&mut self, id: Id) -> &mut Self. The node id names this one.
    • pub fn described_by(&mut self, id: Id) -> &mut Self. The node id describes this one.
    • pub fn controls(&mut self, id: Id) -> &mut Self. This node controls the node id (the popup of an open combo box).
    • pub fn flow_to(&mut self, id: Id) -> &mut Self. Reading continues at the node id.
    • pub fn live(&mut self, politeness: Politeness) -> &mut Self. Makes the node a live region.
    • pub fn pans(&mut self, vertical: bool, horizontal: bool) -> &mut Self. The leaf pans its content along the vertical and horizontal axes: the node serves the scroll actions on them, as a scrolling body does.
    • pub fn busy(&mut self, on: bool) -> &mut Self. The node is working.
    • pub fn node(&mut self, part: impl Into<PartRef>, role: Role) -> &mut SubNode. A node below this component's node, keyed by a PartRef (content painters key lines and runs as LINE.at(i)), with the id sub(id, ("node", part_ref)).
    • pub fn text_selection(&mut self, anchor:(PartRef, usize), focus:(PartRef, usize)) -> &mut Self. The text selection of the component's own text, from anchor to focus: each end is a text-run sub-node ([SubNode::text_run]) of this component and a character index in the run.
    • pub fn custom_action(&mut self, id: i32, label: Label) -> &mut Self. An action the component serves itself; it arrives through cx.intents().take_access().
  • craft_ui::runtime::access::GridPlace: pub struct GridPlace { pub row_index: Option<usize>, pub row_count: Option<usize>, pub column_index: Option<usize>, pub column_count: Option<usize> }. The indexes and counts of a grid, table, row or cell node (12.3).
    • pub const fn grid(rows: usize, columns: usize) -> Self. A grid of rows rows and columns columns.
    • pub const fn cell(row: usize, column: usize) -> Self. The cell at row and column.
  • craft_ui::runtime::access::Name: pub enum Name { FromLabel, Text(String), Joined(Vec<String>), LabelledBy(Id), Decorative }. How a node or sub-node is named.
  • craft_ui::runtime::access::Numeric: pub struct Numeric { pub value: Option<f64>, pub range: RangeInclusive<f64>, pub step: Option<f64>, pub wraps: bool, pub text: Option<String> }. A numeric value.
    • pub fn new(value: f64, range: RangeInclusive<f64>) -> Self. A value in a range.
    • pub fn empty(range: RangeInclusive<f64>) -> Self. A range with no value.
    • pub fn step(mut self, step: f64) -> Self. The step of an increment or decrement.
    • pub fn wraps(mut self, wraps: bool) -> Self. Whether a step past one end of the range continues from the other.
    • pub fn text(mut self, text: impl Into<String>) -> Self. The value as shown.
  • craft_ui::runtime::access::Politeness: pub enum Politeness { Polite, Assertive }. How urgently a live announcement is read.
  • craft_ui::runtime::access::PopupKind: pub enum PopupKind { Menu, Listbox, Tree, Grid, Dialog }. The kind of popup a component opens.
  • craft_ui::runtime::access::Role: pub enum Role { None, Merged, Node(NodeRole) }. What a component is to assistive technology.
    • pub const fn of_tone(tone: Tone) -> Role. The role of a message of tone: status for the neutral tones, alert for a warning or a failure.
    • pub const fn hover_cursor(self) -> Option<craft_behavior::CursorIcon>. The cursor over an enabled component of this role: the pointing hand over a link and over a control that picks or flips a value on a click (a check box, radio button, switch or colour well); none for the rest.
  • craft_ui::runtime::access::SetPosition: pub struct SetPosition { pub index: usize, pub size: Option<usize>, pub level: Option<usize>, pub columns: Option<usize> }. A node's place in its set, on the closed list of items it belongs to.
    • pub const fn new(index: usize) -> Self. Position index.
    • pub const fn columns(mut self, columns: usize) -> Self. In a grid of columns columns.
    • pub const fn of(mut self, size: usize) -> Self. In a set of size.
    • pub const fn level(mut self, level: usize) -> Self. At depth level.
  • craft_ui::runtime::access::SubNode: pub struct SubNode { pub name: Name, pub description: Option<String>, pub numeric: Option<Numeric>, pub expanded: Option<bool>, pub position: Option<SetPosition>, pub grid: GridPlace, pub level: Option<usize>, pub flags: Flags }. A node below a component's node, for a part, a cell or a line of a content painter.
    • pub fn bounds(&mut self, rect: egui::Rect) -> &mut Self. The node's rectangle on screen, for a node that has no part of its own to take it from (a block of text a content painter draws).
    • pub fn text_run(&mut self, text: impl Into<String>, positions: Vec<f32>, widths: Vec<f32>, rtl: bool) -> &mut Self. Makes the node a run of text: text laid out on one line, each character's start offset from the node's left edge in positions and its advance in widths (one per character), rtl for a right-to-left run.
    • pub fn level(&mut self, level: usize) -> &mut Self. The heading level or tree depth.
    • pub fn value(&mut self, text: impl Into<String>) -> &mut Self. A plain text value, for a sub-node that shows text as its value and has no number.
    • pub fn column(&mut self, key: craft_behavior::ColumnKey) -> &mut Self. The column of a cell of an item row; the item step reads the cell's column index from the collection's columns.
    • pub fn access_key(&mut self, key: char) -> &mut Self. The mnemonic letter.
    • pub fn shortcut(&mut self, text: impl Into<String>) -> &mut Self. The key that activates the sub-node, as the access tree lists it (Access::shortcut for the component's own node): a header cell that opens its menu with Alt+Down says "Alt+Down".
    • pub fn url(&mut self, url: impl Into<String>) -> &mut Self. The address a link sub-node goes to (Access::url for the component's own node): a hyperlink a content painter describes.
    • pub fn has_popup(&mut self, kind: PopupKind) -> &mut Self. What kind of popup the sub-node opens.
    • pub fn expanded(&mut self, on: bool) -> &mut Self. Whether the sub-node's popup or region is open.
    • pub fn current(&mut self, on: bool) -> &mut Self. The sub-node is the current one of its set: the current page of a trail.
    • pub fn under(&mut self, other: impl Into<PartRef>) -> &mut Self. Nests this sub-node below another sub-node of the same component.
    • pub fn custom_action(&mut self, id: i32, label: Label) -> &mut Self. An action the component serves itself, targeted at this sub-node.
  • craft_ui::runtime::access::FieldLabel: pub struct FieldLabel { pub id: Id, pub rect: Rect, pub press: PressState, pub hovered: bool, pub text: String, pub role: FieldLabelRole, pub detail: Option<String>, pub activated: bool, pub link: bool, pub status: bool, pub shown: bool }. The label a container shows beside its body.
    • pub fn new(id: Id, rect: Rect, text: impl Into<String>) -> Self. A label of text at rect, the node id.
    • pub fn shown(mut self, shown: bool) -> Self. Whether the label shows as a node of its own.
    • pub fn role(mut self, role: FieldLabelRole) -> Self. Whether the label names or describes the controls.
    • pub fn detail(mut self, detail: impl Into<String>) -> Self. Adds a detail line to the description of the controls the label covers.
    • pub fn status(mut self, status: bool) -> Self. Whether the container shows its control's validity message as its status line.
    • pub fn activated(mut self, activated: bool) -> Self. Whether the label was clicked or activated this pass.
    • pub fn linked(mut self, link: bool) -> Self. Whether the label is a link that was clicked this pass.
    • pub fn with_press(mut self, press: PressState) -> Self. The label's press this pass.
    • pub fn with_hover(mut self, hovered: bool) -> Self. Whether the pointer is over the label this pass.
    • pub fn pressed(&self) -> bool. The label is held down or being dragged.
  • craft_ui::runtime::access::FieldLabelRole: pub enum FieldLabelRole { Names, Describes }. Whether a field label names its control or describes it.
  • craft_ui::runtime::access::announce: pub fn announce(ctx: &Context, text: impl Into<String>, politeness: Politeness). Announces text; for code without a context.
  • craft_ui::runtime::access::bounds: re-export of craft_ui::runtime::egui::access::bounds.
  • craft_ui::runtime::access::focused_node: re-export of craft_ui::runtime::egui::access::focused_node.

craft_ui::runtime::commands

The command board: the registry and typed sets, per-frame state, the queue, firing and the gate (spec 11).

  • craft_ui::runtime::commands::AppCatalog: pub struct AppCatalog. Commands an app defines at run time (plug-ins, its tool list), all in the app scope ([Scope::app]).
    • pub fn new(defs: Vec<CommandDef>, generation: u64) -> Result<Self, CommandDefError>. A catalog of defs; generation changes when the app's rows do.
    • pub fn replace_defaults(mut self, id: impl Into<String>, bindings: Vec<Binding>) -> Self. Gives the linked set's command id the default chords bindings in place of the set's own; an empty list drops them.
    • pub fn typing_rule(mut self, rule: TypingRule) -> Self. Sets which chords fire while a text component has the keyboard.
    • pub fn generation(&self) -> u64. The app's version of the catalog.
    • pub fn defs(&self) -> &[CommandDef]. The catalog's rows in the order the app gave them, each with its scope (always [Scope::app]), kind and default bindings, as a shortcuts list reads them.
  • craft_ui::runtime::commands::CommandGate: pub struct CommandGate. The app's one gate over commands: a dialog is open, a workspace is not ready, a recorder has the keys or an operation is pending.
    • pub fn new<P: MemoProps + Send + Sync + 'static>(props: P, allows: fn(&P, &CommandRef) -> bool) -> Self. A gate that lets through the commands allows accepts under props.
  • craft_ui::runtime::commands::CommandInput: pub struct CommandInput. App-scope command state for this frame, set from app state before the pass.
    • pub fn new() -> Self. No state, no overrides and no gate.
    • pub fn states(mut self, states: &Tracked<CommandStates>) -> Self. The app-scope command states the app holds.
    • pub fn overrides(mut self, overrides: Arc<Overrides>) -> Self. The user's binding overrides; the keymap is rebuilt when the Arc changes.
    • pub fn holds(mut self, delay: Option<f64>) -> Self. Turns hold bindings on with the app's hold delay in seconds, Some(delay); None, the default, turns them off.
    • pub fn catalog(mut self, catalog: AppCatalog) -> Self. The frame's app catalog; the keymap is rebuilt when the platform, the overrides or the catalog's generation change.
    • pub fn gate(mut self, gate: CommandGate) -> Self. The one gate over commands.
    • pub fn paste_reads_clipboard(mut self, on: bool) -> Self. Whether the library's Paste ([EditCommands::Paste]), fired at the app by a menu row, a toolbar button or the palette, first asks the platform for the clipboard in the pass that fires it and reaches the app with the clipboard's content, as ⌘V does.
  • craft_ui::runtime::commands::CommandSet: pub trait CommandSet: Copy + Send + Sync + 'static. A typed set of commands, written by #[derive(CommandSet)].
    • const SCOPE: CommandScope. The scope the set's commands belong to.
    • const TYPING: bool. The set's keys are those of a text component, meant for typing (#[command(typing)]): its scope is a keymap context, active while an instance of it is around the focus, so its keys come before every other scope's and work while the component types, as a type tool's formatting keys do.
    • fn from_ref(command: &CommandRef) -> Option<Self>. The command of this set that command names.
    • fn id(self) -> &'static str.
    • fn defs() -> Result<Vec<CommandDef>, CommandDefError>.
    • fn no_default_on() -> Vec<(&'static str, Platform)>. The commands that have no default binding on a platform, as (id, platform).
    • fn edits() -> Vec<(&'static str, EditCommand)>. The commands a focused component takes as an Intent::Edit, as (id, edit): the edit option of the command's attribute.
    • fn holds() -> Vec<(&'static str, CommandScope)>. The momentary commands whose held key makes a scope's keys work, as (id, scope): the holds option of the command's attribute.
    • fn platform_defaults() -> Result<Vec<(&'static str, Platform, Binding)>, CommandDefError>. The defaults of one platform, as (id, platform, binding): on that platform they replace the command's other defaults.
  • craft_ui::runtime::commands::CommandState: pub struct CommandState. What the app or an instance says about a command this frame.
    • pub fn new() -> Self. An enabled, unchecked-less state with the command's own label.
    • pub fn enabled(mut self, enabled: bool) -> Self. Whether the command can fire.
    • pub fn checked(mut self, checked: bool) -> Self. The checked state of a toggle or radio command.
    • pub fn marked(mut self, marked: bool) -> Self. Whether the command's content has something to show, such as comments on a panel.
    • pub fn title(mut self, title: impl Into<Arc<str>>) -> Self. A label for this frame in place of the command's own, such as "Undo Move".
    • pub fn icon(mut self, icon: impl Into<Cow<'static, str>>) -> Self. An icon for this frame in place of the command's own, by catalogue name or registered app set name.
    • pub fn hint(mut self, hint: impl Into<Arc<str>>) -> Self. The accessible description and second tooltip line.
    • pub fn hint_alone(mut self, alone: bool) -> Self. Opt-in: on a control whose label shows whole and that has no tooltip of its own, the hint is the whole tooltip, with the chord after it, in place of the label and chord over the hint (the default).
    • pub fn is_enabled(&self) -> bool. Whether the command can fire, as [enabled] set it.
    • pub fn is_checked(&self) -> Option<bool>. The checked state [checked] set; None for a command that is not a toggle or radio.
  • craft_ui::runtime::commands::CommandStates: pub struct CommandStates. The app-scope command states an app holds, in a [Tracked] it hands to [CommandInput::states] every frame.
    • pub fn new() -> Self. No states.
    • pub fn set(&mut self, command: impl Into<CommandRef>, state: CommandState). Gives command state, in place of the state it had.
    • pub fn remove(&mut self, command: &CommandRef) -> Option<CommandState>. Removes the state of command, which then resolves with its own label, enabled.
    • pub fn get(&self, command: &CommandRef) -> Option<&CommandState>. The state of command.
  • craft_ui::runtime::commands::Commands: pub trait Commands: CommandAccess. The chapter-11 context trait that Cx, BodyCx and ItemCx implement. "This instance" is the innermost container at or above the context whose ContainerProps.command_scope is the command's scope.
    • fn clipboard(&self) -> ClipboardHandle. The one clipboard path.
    • fn publish(&mut self, command: impl Into<CommandRef>, state: CommandState). This frame's state of a scoped command, for this instance.
    • fn take_command<S: CommandSet>(&mut self) -> Option<(S, Fired)>. The next command of set S routed to this instance this pass; each is taken once, so a discard pass does not repeat it.
    • fn take_step(&mut self, can_undo: bool, can_redo: bool) -> Option<Step>. Declares Undo and Redo on the innermost instance around this context, enabled as can_undo and can_redo say, and takes the next of them fired at it this pass.
    • fn resolve_command(&self, command: impl Into<CommandRef>) -> Option<Arc<ResolvedCommand>>. command as this context shows it: the label, icon and chord with the scoped bindings of the scopes above the context, and the enabled state of its instance. None when the command is scoped and no instance of its scope is above the context.
  • craft_ui::runtime::commands::FirePhase: pub enum FirePhase { Press, Repeat, Release }. The phase of the key press that fired a command.
  • craft_ui::runtime::commands::FireSource: pub enum FireSource { Key, Menu, Palette, Pointer, Automation, Access, Keytip }. Where a fired command came from.
  • craft_ui::runtime::commands::Fired: pub struct Fired { pub command: CommandRef, pub target: Option<Id>, pub source: FireSource, pub phase: FirePhase, pub cycle: bool, pub alt_variant: bool, pub time: f64, pub mods: craft_keymap::Mods, pub place: Option<usize>, pub pasted: Option<ClipContent>, pub paste_at: Option<egui::Pos2> }. A command a surface or a key fired, as the instance or the app takes it.
    • pub fn new(command: CommandRef, source: FireSource, phase: FirePhase, time: f64) -> Fired. command fired from source in phase at the input time time, for the app scope (no target), without a group cycle, the Alt variant or paste content.
    • pub fn mods(self, mods: craft_keymap::Mods) -> Fired. The command with mods as the modifiers its firing input carried.
  • craft_ui::runtime::commands::ResolvedCommand: pub struct ResolvedCommand { pub label: Arc<str>, pub catalog_label: Option<Arc<str>>, pub icon: Option<Cow<'static, str>>, pub chord: Option<Chord>, pub chord_text: Option<Arc<str>>, pub enabled: bool, pub checked: Option<bool>, pub marked: bool, pub hint: Option<Arc<str>>, pub hint_alone: bool, pub kind: CommandKind, pub edit: bool, pub instance: Option<Id> }. A command as a surface shows and fires it.
  • craft_ui::runtime::commands::Shown: pub struct Shown { pub rect: egui::Rect, pub viewport: ViewportId, pub label: crate::runtime::env::Label, pub holder: bool }. Where a command was shown, from [shown].
  • craft_ui::runtime::commands::bindings: pub fn bindings(ctx: &Context, command: &CommandRef) -> Vec<Binding>. The keys command has in the runtime's keymap: its defaults under the user's overrides (CommandInput), on the window's platform, double presses included.
  • craft_ui::runtime::commands::chord: pub fn chord(ctx: &Context, command: &CommandRef) -> Option<Chord>. The chord a surface shows for command: its first single-press binding in the runtime's keymap that runs it where the binding applies, so a binding another command wins (a nearer scope, else catalog order) is never shown.
  • craft_ui::runtime::commands::fire: pub fn fire(ctx: &Context, command: impl Into<CommandRef>, source: FireSource) -> bool. Fires command from a surface that has no component of its own: a menu, the palette or automation.
  • craft_ui::runtime::commands::holder: pub fn holder(ctx: &Context, chord: &Chord) -> Option<CommandRef>. The command a key chord belongs to for a surface that takes it whatever has focus, such as a system menu item:
  • craft_ui::runtime::commands::holds: pub fn holds(ctx: &Context, layer: LayerKey, rect: egui::Rect, commands: &Arc<[CommandRef]>, label: Label). Records that a container at rect holds commands, for this pass and viewport.
  • craft_ui::runtime::commands::request_paste_at: pub fn request_paste_at(ctx: &Context, at: egui::Pos2). Requests a paste at a screen point; the delivered command carries the point with its content.
  • craft_ui::runtime::commands::resolve: pub fn resolve(ctx: &Context, command: impl Into<CommandRef>) -> Arc<ResolvedCommand>. command as a surface with no component of its own shows it: the label, icon, chord, enabled and checked state and hint, against the instance that [fire] would deliver it to.
  • craft_ui::runtime::commands::resolver_in: pub fn resolver_in(ui: &egui::Ui) -> impl Fn(CommandRef) -> Option<Arc<ResolvedCommand>> + 'static. A resolver for the commands as the context of ui shows them, as [Commands::resolve_command] does for a component's context: the label, icon, chord and state with the scoped bindings of the scopes above ui, None for a scoped command with no instance above.
  • craft_ui::runtime::commands::shown: pub fn shown(ctx: &Context, command: &CommandRef) -> Option<Shown>. Where command was shown in the last pass: a bound component's clipped rect or a holder's rect. None unless it was wholly in view and not under another window.
  • craft_ui::runtime::commands::Binding: re-export of craft_keymap::Binding (outside these crates).
  • craft_ui::runtime::commands::ChromeCommand: pub enum ChromeCommand { TogglePanels, TogglePanelsKeepTools }. The window commands that hide the panels of the window they run in.
    • pub const ALL: [ChromeCommand; 2]. Both commands.
    • pub const fn toggle(self) -> ChromeToggle. The toggle the command writes to the output.
  • craft_ui::runtime::commands::ClipContent: pub struct ClipContent { pub text: Option<Arc<str>>, pub image: Option<Arc<ColorImage>> }. What a paste delivers.
  • craft_ui::runtime::commands::ClipError: pub struct ClipError(pub String). Why a paste has no content.
  • craft_ui::runtime::commands::ClipItem: pub enum ClipItem { Text(Arc<str>), Html(Arc<str>), Image(Arc<ColorImage>), Rtf(Arc<str>), MathMl(Arc<str>), Custom { mime: Arc<str>, bytes: Arc<[u8]> } }. One clipboard item.
    • pub fn custom(mime: impl Into<Arc<str>>, bytes: impl Into<Arc<[u8]>>) -> ClipItem. An item of an app-defined type: bytes under the MIME type mime.
  • craft_ui::runtime::commands::ClipboardHandle: pub struct ClipboardHandle. The component's paste slot over the installed clipboard (the host's, else egui's).
    • pub fn of(ctx: &Context) -> ClipboardHandle. The clipboard handle of ctx, over the installed clipboard, for code outside a component; its paste slot stays loading, as no component takes the paste.
    • pub fn offer(&self, items: &[ClipItem]) -> Result<Written, ClipboardError>. Offers items in the caller's order, as one offer, and says which flavour the clipboard kept.
    • pub fn read(&self, mimes: &[&str]) -> Result<Option<Flavor>, ClipboardError>. The first of mimes the installed clipboard holds.
    • pub fn read_text(&self) -> Result<Option<String>, ClipboardError>. The clipboard's text.
    • pub fn read_image(&self) -> Result<Option<ClipboardImage>, ClipboardError>. The clipboard's image as straight-alpha RGBA8 pixels; ColorImage::from_rgba_unmultiplied turns them back.
    • pub fn read_files(&self) -> Result<Option<Vec<PathBuf>>, ClipboardError>. The files the clipboard holds.
    • pub fn has(&self, mimes: &[&str]) -> bool. Whether the clipboard holds one of mimes.
    • pub fn holds_ours(&self) -> bool. Whether the clipboard still holds what this app last offered.
    • pub fn formats(&self) -> Vec<String>. The MIME names of the formats on the clipboard.
    • pub fn arrived(&self) -> bool. Whether a late paste offer arrived this frame; true in every pass of that frame.
    • pub fn put(&self, items: &[ClipItem]). Offers items as one offer ([offer]), for a caller that does not ask what was kept.
    • pub fn paste(&self) -> &Pending<ClipContent, ClipError>. The pasted content: ready in the pass that delivers the paste to the focused component that lists Paste.
  • craft_ui::runtime::commands::CommandDef: re-export of craft_keymap::CommandDef (outside these crates).
  • craft_ui::runtime::commands::CommandDefError: pub enum CommandDefError { Binding { command: &'static str, error: BindingError }, Scope { command: &'static str }, Duplicate { command: String }, NotApp { command: String } }. Why a command definition is unusable.
  • craft_ui::runtime::commands::CommandKind: re-export of craft_keymap::CommandKind (outside these crates).
  • craft_ui::runtime::commands::CommandRef: re-export of craft_keymap::CommandRef (outside these crates).
  • craft_ui::runtime::commands::CommandScope: re-export of craft_keymap::CommandScope (outside these crates).
  • craft_ui::runtime::commands::Dispatch: re-export of craft_keymap::Dispatch (outside these crates).
  • craft_ui::runtime::commands::EditCommand: re-export of craft_behavior::intent::EditCommand.
  • craft_ui::runtime::commands::EditCommands: pub enum EditCommands { Cut, Copy, Paste, SelectAll, Undo, Redo, Delete }. The edit commands (11.3).
    • pub const ALL: [EditCommands; 7]. Every edit command that a focused component can take as an Intent::Edit.
    • pub const fn edit(self) -> Option<EditCommand>. The intent a component takes this command as.
    • pub const fn of(command: EditCommand) -> Option<Self>. The command an edit intent comes from.
  • craft_ui::runtime::commands::ModalRule: re-export of craft_keymap::ModalRule (outside these crates).
  • craft_ui::runtime::commands::NavCommand: pub enum NavCommand { NextPane, PreviousPane, FocusMenuBar }. The window commands that move focus between the window's panes and onto its menu bar (spec 9.4, 9.7).
  • craft_ui::runtime::commands::Platform: re-export of craft_keymap::Platform (outside these crates).
  • craft_ui::runtime::commands::QuitCommand: pub enum QuitCommand { Quit }. The window command that quits the app (egui's own quit shortcut, which the runtime clears at install, had the same default).
  • craft_ui::runtime::commands::Scope: re-export of craft_keymap::Scope (outside these crates).
  • craft_ui::runtime::commands::Trigger: re-export of craft_keymap::Trigger (outside these crates).
  • craft_ui::runtime::commands::TypingRule: re-export of craft_keymap::TypingRule (outside these crates).
  • craft_ui::runtime::commands::WindowCommand: pub enum WindowCommand { Move, Size }. The window commands (16.3): a floating container moves and resizes from the keyboard. macOS binds no chord to them (9.2): the title-row menu offers both.
  • craft_ui::runtime::commands::keymap: pub fn keymap(ctx: &Context) -> Option<Arc<Keymap>>. The window's own keymap: the registry scopes, the app catalog, the window shortcuts and the app's overrides, as the board resolves keys with it; none before the first frame builds one.

craft_ui::runtime::cursor

The cursor service (8.5): requests of a pass collect here, the end hook picks the winner and records it, and a painted winner reaches the window as its cursor image where the window shows one.

  • craft_ui::runtime::cursor::CursorBitmap: pub struct CursorBitmap { pub rgba: Arc<[u8]>, pub size: [u16; 2], pub hotspot: [u16; 2] }. A cursor image in straight (not premultiplied) RGBA, row by row, its hotspot on the centre pixel.
  • craft_ui::runtime::cursor::CursorRegion: pub struct CursorRegion { pub layer: LayerKey, pub clip: Rect }. Where a cursor's footprint may show: a layer and a clip in screen space.
    • pub fn new(layer: LayerKey, clip: Rect) -> Self. The region of clip on layer.
  • craft_ui::runtime::cursor::current: pub fn current(ctx: &Context) -> Option<Cursor>. The cursor the last pass of the running viewport settled on; None is the default arrow.
  • craft_ui::runtime::cursor::request: pub fn request(ctx: &Context, cursor: Cursor, priority: CursorPriority). Requests cursor for the running pass of this viewport.

craft_ui::runtime::derived

Derived values: data a component computes from its inputs and keeps across passes. [derived] keeps one value per component id and value type, and builds it again only when its key changes.

  • craft_ui::runtime::derived::derived: pub fn derived<K: MemoProps, V: Send + Sync + 'static>(ctx: &Context, id: Id, key: &K, build: impl FnOnce() -> V) -> Arc<V>. The value of the component id derived from key: the kept one while key is the one it was built from, else build's, which is kept in its place.

craft_ui::runtime::drag

The drag session (8.4): one per context.

  • craft_ui::runtime::drag::DragPreview: pub enum DragPreview { None, Badge(Label), Named(Label), Frame { size: Vec2, label: Option<Label> } }. What the ghost layer paints beside the pointer during a drag.
    • pub fn frame(size: Vec2, label: Option<Label>) -> Self. A frame of size with an optional label.
  • craft_ui::runtime::drag::DropMark: pub enum DropMark { Line { from: Pos2, to: Pos2 }, Into(Rect), Region { area: Rect, line: Option<[Pos2; 2]> } }. Where a drop would land, as geometry in the target's egui layer space.
    • pub const fn line(from: Pos2, to: Pos2) -> Self. An insertion line from from to to.
    • pub const fn region(area: Rect) -> Self. The payload will occupy area.
    • pub const fn region_at(area: Rect, from: Pos2, to: Pos2) -> Self. The payload will occupy area and goes in at the line from from to to.
  • craft_ui::runtime::drag::DropTarget: pub trait DropTarget<P: ?Sized>. What a component registers with Pointer::drop_target.
    • type Drop. What a drop on this target carries to the component's caller.
    • fn accept(&self, payload: &P, at: Pos2, op: DropOperation) -> Option<Self::Drop>. None rejects. at is the pointer in the component's egui layer space, so a target picks its sub-area (a port, a split side) from it; op is the operation the held modifiers pick, which a target may refuse.
    • fn mark(&self, drop: &Self::Drop) -> DropMark. Where drop would land, a value the ghost layer paints.
    • fn under_modal(&self) -> bool. Whether the target takes OS file drops (OsFiles) while a modal layer above it holds input, as an app whose alerts let files through (VectorCraft placed files dropped under its alert).
    • fn copy_keys(&self) -> CopyKeys. The held key that makes a drop on this target a copy: the op that [accept] gets, and the pointer over the target, follow it.
  • craft_ui::runtime::drag::DropZone: pub struct DropZone. Where a drop target lies: a rect on an egui layer, in that layer's space.
    • pub const fn new(layer: crate::runtime::egui::areas::Layer, rect: Rect) -> Self. The zone rect on layer (the layer_id of the Ui that draws the area), in that layer's space.
    • pub const fn rect(&self) -> Rect. The zone's rect, in its layer's space.
  • craft_ui::runtime::drag::OsFile: pub struct OsFile { pub name: String, pub path: Option<PathBuf>, pub mime: String, pub bytes: Option<Arc<[u8]>> }. A file the OS drags over the window or drops on it.
  • craft_ui::runtime::drag::OsFiles: pub struct OsFiles { pub files: Vec<OsFile> }. The payload of a drag that comes from the OS: files held over the window, then the files dropped.
  • craft_ui::runtime::drag::WindowDropTarget: pub trait WindowDropTarget<P>. What a component registers with Pointer::window_drop_target: a target over the whole window, optionally waiting for a pointer position before it accepts.
    • type Drop. What a drop on this target carries to the component's caller.
    • fn requires_pointer(&self) -> bool. Whether this target waits for a pointer position before taking a drop.
    • fn accept(&self, payload: &P, op: DropOperation) -> Option<Self::Drop>. None rejects. op is the operation the held modifiers pick, which a target may refuse.
    • fn mark(&self, drop: &Self::Drop) -> DropMark. Where drop would land, a value the ghost layer paints.
    • fn under_modal(&self) -> bool. Whether the target takes OS file drops (OsFiles) while a modal layer holds input, as [DropTarget::under_modal] says.
  • craft_ui::runtime::drag::active: pub fn active<P: Send + Sync + 'static>(ctx: &Context) -> Option<Arc<P>>. The active drag payload of type P, from any viewport.
  • craft_ui::runtime::drag::amend: pub fn amend<P: Clone + Send + Sync + 'static>(ctx: &Context, change: impl FnOnce(&mut P)) -> bool. Changes the running session's payload of type P (or its further payload of that type) with change, in the frame the session started only: a host completes what a drag its component started carries with what only the host knows (a dock measures the panel a tab drag floats).
  • craft_ui::runtime::drag::cancel: pub fn cancel(ctx: &Context, reason: CancelReason). Ends the session without a drop; the source's press ends with it, so nobody gets a drop.
  • craft_ui::runtime::drag::mark: pub fn mark(ctx: &Context) -> Option<DropMark>. The mark of the target that would take a drop now, in screen space: None while no target accepts the payload.
  • craft_ui::runtime::drag::zone_target: pub fn zone_target<P: Send + Sync + 'static, T: DropTarget<P>>(ui: &egui::Ui, owner: Id, zone: DropZone, target: &T) -> Option<T::Drop>. Pointer::drop_target over a zone the caller names instead of its own visible rect: the drop of a payload of type P released over zone, with the same layer order, operation and mark as a component's own target. owner is the caller's stable id; it registers in every pass a drag may reach the zone.

craft_ui::runtime::edit

The pass's edit events and edit-command routing: the context-free calls an app makes around edits.

  • craft_ui::runtime::edit::PreviewWatch: pub struct PreviewWatch. The preview watch of a component with a live preview, kept in its shown memory.
    • pub fn arm(&mut self, ctx: &Context, owner: Id). Arms the watch for the component owner.
    • pub fn disarm(&mut self). Disarms the watch: its drop notes nothing.
  • craft_ui::runtime::edit::cancel_all: pub fn cancel_all(ctx: &Context, reason: CancelReason). Cancels every running gesture at its next step 4, which then stays cancelled under its press.
  • craft_ui::runtime::edit::gesture_note: pub fn gesture_note<V: Value, N: Clone + 'static>(ctx: &Context, id: Id) -> Option<N>. The note the component id set on its running gesture with Cx::propose_with, when it is an N; None while no gesture of the component runs. V is the component's value type, under which its gesture is kept.
  • craft_ui::runtime::edit::next_gesture_id: pub fn next_gesture_id(ctx: &Context) -> GestureId. A gesture id no gesture of this context has had: ids grow in the order gestures begin, across components and across a component's eviction, as GestureHost assumes.
  • craft_ui::runtime::edit::watch_gestures: pub fn watch_gestures<R>(ctx: &Context, body: impl FnOnce() -> R) -> (R, bool). Runs body and says whether a gesture of a component shown inside it was running after the component's apply step: a drag or a typing run under way.

craft_ui::runtime::egui

The one egui adapter: the only importer of egui's behavioural APIs.

  • craft_ui::runtime::egui::LayerId: re-export of egui::LayerId (outside these crates).

craft_ui::runtime::egui::access

AccessKit node building, register_accesskit_parent and set_accesskit_focus: the one place that names AccessKit's node API. node writes a decided node, patch applies the label scope and the status node, tree reads a finished tree update, which automation keeps per viewport (keep_trees).

  • craft_ui::runtime::egui::access::NodeId: pub type NodeId = accesskit::NodeId. The AccessKit id of a node, as a host test holds it.
  • craft_ui::runtime::egui::access::bounds: pub fn bounds(ctx: &Context, id: Id) -> Option<egui::Rect>. The rect id's response had in the last finished pass, converted as the node's bounds are; None when absent, without area, or behind the open modal.
  • craft_ui::runtime::egui::access::focused_node: pub fn focused_node(ctx: &Context) -> Option<Id>. The node that held key focus at the end of the running viewport's last finished pass, the one reported to assistive technology: a focused part's node (sub_node_id), the shown item of a list that holds focus, else the focused component's own; None when nothing holds focus.
  • craft_ui::runtime::egui::access::prune_controls: pub fn prune_controls(update: &mut egui::accesskit::TreeUpdate). The step itself: every controls id of update that names no node of update is dropped.
  • craft_ui::runtime::egui::access::AccessTree: pub struct AccessTree. The AccessKit tree update of one frame.
    • pub fn has(&self, id: Id) -> bool. Whether the node of id exists.
    • pub fn role(&self, id: Id) -> Option<Role>. The role of the node of id.
    • pub fn name(&self, id: Id) -> Option<&str>. The name of the node of id.
    • pub fn description(&self, id: Id) -> Option<&str>. The description of the node of id.
    • pub fn description_of(&self, key: NodeKey) -> Option<&str>. The description of a node by key.
    • pub fn shortcut_of(&self, key: NodeKey) -> Option<&str>. The keyboard shortcut a node by key lists.
    • pub fn value_of(&self, key: NodeKey) -> Option<&str>. The text value of a node by key.
    • pub fn value(&self, id: Id) -> Option<&str>. The text value of the node of id.
    • pub fn numeric(&self, id: Id) -> Option<Numeric>. The numeric value and range of the node of id.
    • pub fn numeric_of(&self, key: NodeKey) -> Option<Numeric>. The numeric value and range of a node by key.
    • pub fn is_disabled(&self, id: Id) -> bool. Whether the node of id is reported as disabled.
    • pub fn declares(&self, id: Id, action: Declared) -> bool. Whether the node of id declares action.
    • pub fn labelled_by(&self, id: Id) -> Vec<NodeKey>. The nodes that name the node of id.
    • pub fn labelled_by_key(&self, key: NodeKey) -> Vec<NodeKey>. [AccessTree::labelled_by] for a node by key.
    • pub fn described_by(&self, id: Id) -> Vec<NodeKey>. The nodes that describe the node of id.
    • pub fn position(&self, id: Id) -> Option<(usize, usize)>. The place of the node of id in its set: its zero-based index and the size of the set.
    • pub fn grid_of(&self, key: NodeKey) -> GridPlace. The row and column indexes and counts of a node by key.
    • pub fn sort_of(&self, key: NodeKey) -> Option<bool>. The sort order a column header node by key shows: true descending.
    • pub fn declares_sort(&self, key: NodeKey) -> bool. Whether a column header node declares a sort direction: it sorts when activated, sorted now or not.
    • pub fn expanded(&self, id: Id) -> Option<bool>. The expanded state of the node of id.
    • pub fn has_popup(&self, id: Id) -> Option<PopupKind>. The kind of popup the node of id opens.
    • pub fn controls(&self, id: Id) -> Vec<NodeKey>. The nodes the node of id controls.
    • pub fn is_modal(&self, key: NodeKey) -> bool. Whether the node of key is modal.
    • pub fn live(&self, id: Id) -> Option<Politeness>. The live politeness of the node of id.
    • pub fn invalid(&self, id: Id) -> bool. Whether the node of id is marked invalid.
    • pub fn run_texts(&self, id: Id) -> Vec<String>. The text of each TextRun node below id, in order.
    • pub fn run_texts_of(&self, key: NodeKey) -> Vec<String>. The text of each TextRun node below the node key, in order: a text node's editable text, which its value may read with more (a number field's unit).
    • pub fn text_selection(&self, id: Id) -> Option<((NodeKey, usize),(NodeKey, usize))>. The selection of the text node id as the run node and character index of its anchor and focus.
    • pub fn name_of(&self, key: NodeKey) -> Option<&str>. The name of a node by key.
    • pub fn toggled_of(&self, key: NodeKey) -> Option<craft_behavior::Mixed<bool>>. The toggled state of a node by key.
    • pub fn expanded_of(&self, key: NodeKey) -> Option<bool>. The expanded state of a node by key.
    • pub fn has_popup_of(&self, key: NodeKey) -> Option<PopupKind>. The kind of popup the node of key opens.
    • pub fn access_key_of(&self, key: NodeKey) -> Option<char>. The access key of the node of key.
    • pub fn current_of(&self, key: NodeKey) -> bool. Whether the node of key is the current item of its set (the current page).
    • pub fn level_of(&self, key: NodeKey) -> Option<usize>. The level a node by key states: a heading's outline level, a list item's list level, a tree item's depth.
    • pub fn url_of(&self, key: NodeKey) -> Option<&str>. The address a link node by key goes to.
    • pub fn parent_of(&self, id: Id) -> Option<NodeKey>. The nearest ancestor of id that screen readers see: AccessKit's consumer drops generic containers.
    • pub fn parent_of_key(&self, key: NodeKey) -> Option<NodeKey>. [AccessTree::parent_of] for a node by key.
    • pub fn root_key(&self) -> Option<NodeKey>. The root node, when the frame made a tree: where reading order starts.
    • pub fn focused_key(&self) -> NodeKey. The node AccessKit reports as focused.
    • pub fn in_ltr_axis(&self, key: NodeKey) -> bool. Whether the node is, or lies inside, a component whose horizontal axis keeps its left-to-right order (Props::ltr_axis): it or an ancestor declares left-to-right text direction on a node that is not a text run, which only that declaration does.
    • pub fn keys(&self) -> Vec<NodeKey>. Every node that assistive technology reports.
    • pub fn node_count(&self) -> usize. The number of nodes that assistive technology reports.
    • pub fn role_of(&self, key: NodeKey) -> Option<Role>. The role of a node by key.
    • pub fn selected_of(&self, key: NodeKey) -> Option<bool>. Whether a node by key is reported as selected: None for a node that reports no selected state.
    • pub fn bounds_of(&self, key: NodeKey) -> Option<egui::Rect>. The bounds of a node by key, in points.
    • pub fn is_disabled_key(&self, key: NodeKey) -> bool. Whether a node by key is reported as disabled.
    • pub fn declares_key(&self, key: NodeKey, action: Declared) -> bool. Whether a node by key declares action.
    • pub fn children_of(&self, key: NodeKey) -> Vec<NodeKey>. The children of a node by key.
  • craft_ui::runtime::egui::access::Declared: pub enum Declared { Focus, Click, ContextMenu, Increment, Decrement, SetValue, SetTextSelection, Expand, Collapse, Custom, ScrollUp, ScrollDown, ScrollLeft, ScrollRight }. An action a node declares.
  • craft_ui::runtime::egui::access::NodeKey: pub struct NodeKey. A node's number in the tree.
    • pub fn raw(self) -> u64. The AccessKit node number.
    • pub fn from_raw(raw: u64) -> NodeKey. The key of the node with AccessKit number raw.
    • pub fn of(id: Id) -> NodeKey. The key of the node of id.
  • craft_ui::runtime::egui::access::TreeUpdate: re-export of accesskit::TreeUpdate (outside these crates).
  • craft_ui::runtime::egui::access::is_interactive: pub fn is_interactive(tree: &AccessTree, key: NodeKey) -> bool. Whether the node declares an action a user can take: focus, click or a value change.
  • craft_ui::runtime::egui::access::name: pub fn name(tree: &AccessTree, key: NodeKey) -> Option<&str>. The accessible name of the node, when it has a non-empty one: its own, else the first non-empty name of the nodes that label it (labelled_by).

craft_ui::runtime::egui::areas

Area with its left-top pivot, Order, sublayers, transform layers and set_layer_order.

  • craft_ui::runtime::egui::areas::LayerKey: pub type LayerKey = egui::LayerId. An egui layer, as the runtime's shape records name it.
  • craft_ui::runtime::egui::areas::LayerOrder: pub struct LayerOrder { pub listed_on_top: bool, pub unlisted_keep_order: bool, pub unknown_ignored: bool }. The layer order after Context::set_layer_order.
  • craft_ui::runtime::egui::areas::layer_order: pub fn layer_order() -> LayerOrder. Two frames over three areas; the second lists the first area and an unknown layer.

craft_ui::runtime::egui::injected

Injected input: pointer moves, clicks, keys and text an automation client asks for, and the event builders injected input and the trials' fixture share.

  • craft_ui::runtime::egui::injected::InjectedFiles: pub struct InjectedFiles { pub paths: Vec<std::path::PathBuf>, pub dropped: bool }. Files an injected step hovers over a window, and whether the step after it drops them.
  • craft_ui::runtime::egui::injected::InjectedPointer: pub enum InjectedPointer { Down { button: PointerButton, at: Pos2, mods: Mods, pen: Option<PointerSample> }, Move { at: Pos2, mods: Mods, pen: Option<PointerSample>, rest: f64 }, Up { at: Pos2, mods: Mods } }. One pointer step an automation client drives as a device would, with the modifiers held and, for a pen, its reading, which the step's pass reads in place of the tablet's.
    • pub const fn down(button: PointerButton, at: Pos2, mods: Mods, pen: Option<PointerSample>) -> Self. button goes down at at with mods held and the pen's reading pen.
    • pub const fn move_to(at: Pos2, mods: Mods, pen: Option<PointerSample>) -> Self. The pointer moves to at with mods held and the pen's reading pen.
    • pub const fn move_resting(at: Pos2, mods: Mods, pen: Option<PointerSample>, rest: f64) -> Self. The pointer moves to at with mods held and the pen's reading pen, and the step counts as processed once the pointer has rested there rest seconds.
    • pub const fn up(at: Pos2, mods: Mods) -> Self. Every injected button comes up at at with mods held.
  • craft_ui::runtime::egui::injected::Released: pub enum Released { Button(PointerButton), Key(Key), All }. What a button or key release names: one button, one key, or everything held (the modifiers too).
  • craft_ui::runtime::egui::injected::hook_without_pass: pub fn hook_without_pass(ctx: &Context, viewport: ViewportId) -> Vec<Event>. The input of one hook call for viewport with no pass behind it: the events the hook appends.
  • craft_ui::runtime::egui::injected::move_focus_without_pass: pub fn move_focus_without_pass(ctx: &Context, viewport: ViewportId, id: Id). Moves the focus the end hook recorded for viewport to the component id with no pass, as the application does between handing input over and its pass.

craft_ui::runtime::egui::input

Raw input in the input hook, key events converted to craft-keymap's key types, InputOptions.

  • craft_ui::runtime::egui::input::INPUT_TEXT_LIMIT: pub const INPUT_TEXT_LIMIT: usize. The most characters one text, paste or IME event carries into a component.
  • craft_ui::runtime::egui::input::alt_code_digits_taken: pub fn alt_code_digits_taken(ctx: &Context, viewport: ViewportId). For a host that composes Alt codes itself and takes the digits typed with Alt held out of viewport's input before egui reads it: tells the raw-input step that the Alt hold under way had digits typed in it.
  • craft_ui::runtime::egui::input::RawInput: re-export of egui::RawInput (outside these crates).

craft_ui::runtime::egui::screenshot

One-shot screenshot slots and the facts a screenshot is measured against.

  • craft_ui::runtime::egui::screenshot::ScreenshotError: pub enum ScreenshotError { DimensionsOverflow { width: usize, height: usize }, MalformedImage { width: usize, height: usize, pixels: usize }, ImageTooLarge { bytes: usize, max_bytes: usize } }. Why a completed screenshot was rejected and released.
  • craft_ui::runtime::egui::screenshot::ScreenshotFacts: pub struct ScreenshotFacts { pub size_points: Vec2, pub pixels_per_point: f32, pub zoom: f32, pub max_texture_side: usize, pub minimized: bool }. What a screenshot of one viewport measures this pass.
  • craft_ui::runtime::egui::screenshot::ScreenshotSlot: pub struct ScreenshotSlot. The live request side of a screenshot.
    • pub fn take(&self) -> Option<Result<Arc<ColorImage>, ScreenshotError>>. Takes the completed result, at most once.
    • pub fn cancel(&self). Cancels the request and releases any completed image.
    • pub fn detached(ctx: &Context, viewport: ViewportId, max_image_bytes: usize) -> (Self, ScreenshotCallback). A slot with its callback and no command sent, for trials that stand in for the renderer.
    • pub fn complete(&self, image: Arc<ColorImage>). Completes the slot with image as the renderer would, without the callback.
    • pub fn lock_is_free(&self) -> bool. Whether the slot mutex is free, proving the wakeup runs after the lock was released.

craft_ui::runtime::env

Env and scopes, app values and content_env.

  • craft_ui::runtime::env::Env: pub struct Env. The inherited context of a Ui: one Arc clone per read.
    • pub fn words<L: WordSet + Send + Sync + 'static>(&self) -> Arc<L>. The word set L in the scope's language.
    • pub fn format(&self) -> &Format. How the scope writes numbers: locale digits, separators and grouping.
    • pub fn dates(&self) -> Arc<DateFormat>. How the scope writes dates: the host's catalog format, else the system region's.
    • pub fn today(&self) -> Option<CalendarDate>. Today's date as the host supplied it with RootEnv::today; None when it gave none.
    • pub fn units(&self) -> Units. The scope's number format and unit words, to read and write numbers with their unit.
    • pub fn relative_age(&self, seconds: u64, style: AgeStyle) -> String. How long ago seconds was, in the scope's language and digits: "Just now", "3 minutes ago", "Yesterday".
    • pub fn of(ui: &Ui) -> Env. The env of ui: the nearest entry up the Ui stack, else the running viewport's root env, so the Ui of an egui Area or Window reads the app's root values.
    • pub fn root_hit_reach(ctx: &Context) -> f32. How far from a handle, point or edge a press still takes it, in screen points: the theme's size.hit.target as the running viewport's root env has it. ToolContext::reach reads the same value; code with no tool context (a menu capture hit-testing a canvas point) reads it here.
    • pub fn get<T: EnvValue>(&self) -> T. A clone of the innermost app value, else T::root().
    • pub fn capture(&self) -> EnvCapture. The inherited group only; layer-local fields start fresh where the capture is installed.
    • pub fn view(&self) -> EnvView<'_>. What component code sees of this env.
    • pub fn folder(&self) -> Folder. Folds text for search in the scope's language: case and accents ignored, dotted and dotless i by locale.
    • pub fn collator(&self) -> Arc<Collator>. Orders text in the scope's language, with runs of digits by value (Layer 2 before Layer 10).
  • craft_ui::runtime::env::EnvCapture: pub struct EnvCapture. The inherited group of an env, captured to open a popup or viewport: the layer-local fields are reset.
  • craft_ui::runtime::env::Inherited: pub struct Inherited { pub tokens: Arc<UiTokens>, pub os: Os, pub active: bool, pub words: Arc<Words>, pub canvas_pattern: bool, pub line_ratio: f32, pub motion: MotionPolicy, pub scale: Scale, pub values: AppValues }. The values of an env that a scope rarely changes: the resolved tokens, the platform, the language and the app's values. Scoped reads them through Deref.
  • craft_ui::runtime::env::Scoped: pub struct Scoped { pub ink: Ink, pub key: EnvKey, pub size: ControlSize, pub glyphs: GlyphRole, pub enabled: bool, pub read_only: bool, pub wheel: WheelScope, pub direction: Direction, pub text_direction: Direction, pub ids_stable: bool, pub arena: Option<ArenaId>, pub transform: Option<CanvasTransform> }. The values of an env.
    • pub fn hit_reach(&self) -> f32. How far from a handle, point or edge a press still takes it, in screen points: the theme's size.hit.target.
    • pub fn layer_direction(&self) -> Direction. The direction of a layer opened from this scope: the interface's (text_direction), which an axis that keeps its left-to-right order (Props::ltr_axis) leaves alone.
  • craft_ui::runtime::env::AgeStyle: re-export of craft_i18n::AgeStyle (outside these crates).
  • craft_ui::runtime::env::AltCodeKeys: pub enum AltCodeKeys { AllDigits, Keypad }. The digits that start an Alt code on Windows and Linux when typed with Alt held.
  • craft_ui::runtime::env::AltCodePages: pub struct AltCodePages { pub ansi: u16, pub oem: u16 }. Code pages that decode Alt+numpad codes; the app sets them from the system locale.
    • pub const fn new(ansi: u16, oem: u16) -> Self. The ANSI and OEM code pages.
  • craft_ui::runtime::env::AppValues: pub struct AppValues. The app values a root, a scope or a component's content_env carries: one entry per EnvValue type, the innermost wins.
    • pub fn set<T: EnvValue>(&mut self, value: T) -> &mut Self. Sets the value of type T.
  • craft_ui::runtime::env::ArenaId: pub struct ArenaId(pub Id). The id of an arena, carried in Env.arena.
    • pub const fn new(id: Id) -> Self. The arena whose id is id.
  • craft_ui::runtime::env::BodyMode: pub enum BodyMode { Normal, Only }. What the window shows besides its body.
  • craft_ui::runtime::env::ColumnAlign: pub enum ColumnAlign { Start, End }. Where a column's content sits.
  • craft_ui::runtime::env::ColumnSize: pub struct ColumnSize { pub width: f64, pub gutter: f64 }. The column size of a document: n columns are n·(width + gutter) − gutter points.
    • pub const fn new(width: f64, gutter: f64) -> Self. The column size with columns width points wide gutter points apart.
    • pub fn points(self, columns: f64, relative: bool) -> f64. columns columns as points; a relative change converts the span of |columns| with its sign, and 0 stays 0.
    • pub fn columns(self, points: f64, relative: bool) -> f64. points as columns; the inverse of [points].
  • craft_ui::runtime::env::Count: re-export of craft_i18n::Count (outside these crates).
  • craft_ui::runtime::env::Counted: re-export of craft_i18n::Counted (outside these crates).
  • craft_ui::runtime::env::Direction: re-export of craft_i18n::Direction (outside these crates).
  • craft_ui::runtime::env::EnvValue: re-export of craft_ui_macros::EnvValue (outside these crates).
  • craft_ui::runtime::env::EnvView: pub struct EnvView<'a>. What component code sees: everything in Env except tokens, size, enabled, read-only, arena, transform and ids_stable.
    • pub fn surface(&self) -> crate::style::SurfaceKind. The surface the component sits on: the innermost container or collection surface that paints a fill, else the window's background.
    • pub fn direction(&self) -> Direction. The flow direction: layout order, arrow keys and roving.
    • pub fn text_direction(&self) -> Direction. The paragraph direction of text, which only a scope that sets the interface's direction changes.
    • pub fn mode(&self) -> Mode. The light or dark mode the scope's tokens are resolved in: the app's, or the one a scope with its own tokens set.
    • pub fn motion(&self) -> MotionPolicy. The motion mode in effect.
    • pub fn canvas_pattern(&self) -> bool. Whether the canvas surround shows the theme's pattern (RootEnv::canvas_pattern).
    • pub fn scale(&self) -> Scale. The pixels per point.
    • pub fn shell(&self) -> &'a ShellInfo. The platform and the running viewport's window facts: the OS, the capabilities and the window's kind, chrome, state, insets and focus.
    • pub fn keyboard_layout(&self) -> &'a craft_keymap::Layout. The keyboard layout: which character each key position types, for text that names a key.
    • pub fn host(&self) -> Option<&'a Arc<Host>>. The app's Host, from FrameInput.host.
    • pub fn get<T: EnvValue>(&self) -> T. A clone of the innermost app value, else T::root().
    • pub fn words<L: WordSet + Send + Sync + 'static>(&self) -> Arc<L>. The word set L in the scope's language, built once per Words.
    • pub fn format(&self) -> &'a Format. How the scope writes numbers: locale digits, separators and grouping.
    • pub fn dates(&self) -> Arc<DateFormat>. How the scope writes dates: the host's catalog format, else the system region's.
    • pub fn today(&self) -> Option<CalendarDate>. Today's date as the host supplied it with RootEnv::today; None when it gave none.
    • pub fn units(&self) -> Units. The scope's number format and unit words, to read and write numbers with their unit.
    • pub fn relative_age(&self, seconds: u64, style: AgeStyle) -> String. How long ago seconds was, in the scope's language and digits: "Just now", "3 minutes ago", "Yesterday".
    • pub fn counted(&self, count: Counted, n: u64) -> String. n things by the count word count, in the scope's language and digits: "1 page", "3 pages".
    • pub fn resolve(&self, label: &Label) -> Label. label with a Word replaced by its text in the scope's language: what domain code that draws a Label itself shows.
  • craft_ui::runtime::env::Label: pub enum Label { Empty, Static(&'static str), Shared(Arc<str>), Word(Word) }. A label: a literal stays borrowed, a built string is shared.
    • pub fn as_str(&self) -> &str. The text of a label whose Word is not resolved yet reads as its English text.
    • pub fn from_cow(text: Cow<'static, str>) -> Self. The label of text: a borrowed text stays borrowed.
  • craft_ui::runtime::env::LengthUnits: pub struct LengthUnits { pub stored: UnitKind, pub shown: UnitKind, pub pixels_per_inch: f64, pub bare: Option<UnitKind> }. A length kept in one unit and shown in another: what a length field reads and writes (stored, the document's unit) and what it shows and, unless bare names another unit, parses bare numbers in (shown, the user's unit).
    • pub const fn new(stored: UnitKind, shown: UnitKind, pixels_per_inch: f64) -> Self. A length kept in stored and shown in shown, with pixels_per_inch sizing pixels.
    • pub const fn bare_in(mut self, unit: UnitKind) -> Self. A number typed without a unit is in unit rather than in the shown unit (a preference such as "numbers without units are points").
  • craft_ui::runtime::env::Message: pub struct Message { pub text: Label, pub tone: Option<Tone> }. The text of a Validity: a label and an optional tone override. Warn defaults to Tone::Warn, Refuse to Tone::Bad; effective_tone is the one place that default is decided.
    • pub fn new(text: impl Into<Label>) -> Self. A message with the default tone.
    • pub fn tone(mut self, tone: Tone) -> Self. The message in tone.
    • pub fn effective_tone(&self, warn: bool) -> Tone. The tone the message shows in: its own, else Warn when it belongs to a Validity::Warn (warn), else Bad.
  • craft_ui::runtime::env::MotionPolicy: pub struct MotionPolicy { pub mode: MotionMode, pub tokens: MotionTokens }. The motion mode in effect, carried in Env.motion.
    • pub const fn new(mode: MotionMode, tokens: MotionTokens) -> Self. The policy that runs animations at mode with tokens.
  • craft_ui::runtime::env::Overrides: pub struct Overrides { pub size: Option<ControlSize>, pub enabled: Option<bool>, pub read_only: Option<bool>, pub wheel: Option<WheelScope>, pub motion: Option<MotionMode>, pub direction: Option<Direction>, pub flow: Option<Direction>, pub words: Option<WordsOverride>, pub values: AppValues, pub id_salt: Option<egui::Id> }. Changes to the inherited values for a stretch of code.
  • craft_ui::runtime::env::PageBandRoom: pub struct PageBandRoom { pub rect: Rect, pub start: f32, pub end: f32 }. The room of the page band while a full-window page shows: the title-bar-high strip at the window's top and the room the window's ends take in it.
    • pub const fn new(rect: Rect, start: f32, end: f32) -> Self. The band at rect, the window's start end taking start of it and its end end end.
  • craft_ui::runtime::env::PaneEdge: pub enum PaneEdge { Center, Start, End, Top, Bottom }. Where a shell pane sits.
  • craft_ui::runtime::env::PointSize: pub enum PointSize { PostScript, Traditional }. The size of a point, the Point/Pica Size of the Units preference.
    • pub const fn points_per_inch(self) -> f64. How many points make an inch.
  • craft_ui::runtime::env::ResolvedRoot: pub struct ResolvedRoot { pub mode: Mode, pub contrast: Contrast, pub motion: MotionMode }. The mode, contrast and motion of a pass, with System resolved.
  • craft_ui::runtime::env::RevealEdge: pub enum RevealEdge { Top, Start, End }. An edge of the window whose slots a pointer at the edge reveals in body-only mode.
  • craft_ui::runtime::env::RootEnv: pub struct RootEnv { pub sizes: Arc<AppSizes>, pub text_size: TextSize, pub direction: Direction, pub motion: MotionChoice, pub mode: ModeChoice, pub contrast: ContrastChoice, pub density: Size, pub scale: Scale, pub tab_all_controls: bool, pub tab_toggles_chrome: bool, pub escape_leaves_fields: bool, pub shortcuts_repeat: bool, pub dialog_tab: TabReach, pub canvas_pattern: bool, pub cursor_follows_zoom: bool, pub tooltips: bool, pub values: AppValues, pub today: Option<CalendarDate>, pub wheel: WheelSpeed, pub pointer_scoped_field_wheel: bool, pub alt_codes: AltCodePages, pub alt_code_keys: AltCodeKeys, pub ctrl_wheel_pinch: bool }. The app's root values each frame.
    • pub fn new() -> Self. A root with every value at its default.
    • pub fn scale(mut self, scale: Scale) -> Self. Sets the interface scale.
    • pub fn direction(mut self, direction: Direction) -> Self. Sets the layout direction.
    • pub fn motion(mut self, motion: MotionMode) -> Self. Sets the motion choice from a motion mode.
    • pub fn mode(mut self, mode: impl Into<ModeChoice>) -> Self. Sets the mode choice.
    • pub fn theme(mut self, theme: ThemeId) -> Self. Sets the theme.
    • pub fn set_theme(&mut self, theme: ThemeId). Sets the theme in place.
    • pub fn theme_id(&self) -> &ThemeId. The theme the tokens resolve from.
    • pub fn library_theme(mut self, def: Arc<ThemeDef>) -> Self. Sets a library theme: def is the theme and its id the root's theme.
    • pub fn accent(mut self, seed: Option<craft_theme::Rgba>) -> Self. Overrides seeds.accent of whichever theme resolves, built-in or library, in both modes; the accent ramp derives from the seed, and the theme's fixed accent colours give way to it ([ThemeDef::with_accent]). None keeps the theme's own.
    • pub fn resolved(&self, ctx: &Context) -> ResolvedRoot. What the choices resolve to on ctx's pass: the one place System is replaced by the OS's answer, as system_appearance reads it.
    • pub fn resolved_for(&self, system: SystemAppearance) -> ResolvedRoot. What the choices resolve to when the OS reports system.
    • pub fn appearance(&self, ctx: &Context) -> Appearance. The appearance the root's tokens resolve under on ctx: the mode, contrast, density and text size.
    • pub fn contrast(mut self, contrast: impl Into<ContrastChoice>) -> Self. Sets the contrast choice.
    • pub fn cursor_follows_zoom(mut self, on: bool) -> Self. Sets whether painted pointers grow with the interface zoom (the Scale Cursor Proportional to UI preference).
    • pub fn tooltips(mut self, on: bool) -> Self. Sets whether tooltips show (the Show Tool Tips preference).
    • pub fn density(mut self, density: Size) -> Self. Sets the density preset.
    • pub fn set(mut self, set: ComponentSet) -> Self. Sets the component set (Selection::set): a root app value, so a container can set another for its subtree.
    • pub fn component_set(&self) -> ComponentSet. The component set the root's values carry.
    • pub fn today(mut self, date: CalendarDate) -> Self. Sets today's date, as the host's clock and time zone give it.
    • pub fn wheel_speed(mut self, speed: WheelSpeed) -> Self. Sets this frame's wheel speed.
    • pub fn pointer_scoped_field_wheel(mut self, enabled: bool) -> Self. Sends the wheel to a focused field only while the pointer is over it when enabled.
    • pub fn alt_code_pages(mut self, pages: AltCodePages) -> Self. Sets the code pages that decode Alt+numpad codes.
    • pub fn alt_code_keys(mut self, keys: AltCodeKeys) -> Self. Sets the digits that start an Alt code (alt_code_keys).
    • pub fn ctrl_wheel_pinch(mut self, pinch: bool) -> Self. Sets whether a fractional Ctrl+wheel arrives as a pinch (ctrl_wheel_pinch).
  • craft_ui::runtime::env::RowPressed: pub enum RowPressed { Row, Cell(ColumnKey), Part { was_lead: bool } }. Where the collection holds a primary press on a row, within slop, or the press a part of the row holds.
  • craft_ui::runtime::env::Scale: pub struct Scale(pub f32). The interface scale: pixels per point.
    • pub const fn new(pixels_per_point: f32) -> Self. pixels_per_point pixels per point.
  • craft_ui::runtime::env::ScrubDrags: pub enum ScrubDrags { FieldAndLabel, LabelOnly, Off }. Which drags scrub a value, an AppValues env value.
  • craft_ui::runtime::env::ShellCx: pub struct ShellCx. What the window skeleton shows on this pass, read only.
    • pub fn new(window: WindowKey, mode: BodyMode, regions: ShellRegions) -> Self. The skeleton of window in mode with the layout of this pass.
    • pub fn detached(window: WindowKey, mode: BodyMode, body: Rect) -> Self. A skeleton with no slots around body, for tests and the gallery without an AppShell.
    • pub fn with_tabs(mut self, tabs: bool) -> Self. Whether the host shows the document tabs; they show only in [BodyMode::Normal].
    • pub fn with_tab_reveal(mut self, on: bool) -> Self. The Tab reveal is on or off.
    • pub fn with_edge_reveal(mut self, edge: RevealEdge, on: bool) -> Self. The edge reveal of edge is on or off.
    • pub fn with_float_bounds(mut self, bounds: Rect) -> Self. Where floating frames may go: the body rect plus the area under bars that overlay the body.
    • pub fn with_region(mut self, region: Rect) -> Self. The screen rect of the region this shell fills inside another window (AppShell::embedded).
    • pub fn region(&self) -> Option<Rect>. The region an embedded shell fills; None for a window's own shell.
    • pub fn put(&self, values: &mut AppValues). Sets this value in values, where BodyCx::shell reads it.
    • pub fn window(&self) -> &WindowKey. The window's key; components in slots key their ids and memory by it.
    • pub fn body_mode(&self) -> BodyMode. The body mode of this pass.
    • pub fn slot_visible(&self, key: SlotKey) -> bool. Is the slot with this key shown on this pass?
    • pub fn chrome_hidden(&self) -> bool. Whether the user hid the editor's chrome with Tab in standard screen mode: the shell's bars are gone and the body's docks and floating panels hide with them, while the body and the document tabs stay.
    • pub fn with_reveals_key(mut self, id: egui::Id) -> Self. The same skeleton with its revealed rects registered under id, which stays the same across passes.
    • pub fn reveal_rect(&self, ctx: &egui::Context, edge: RevealEdge, rect: Rect). Registers rect, a revealed panel the body drew on this pass, as part of the revealed edge: the edge reveal lasts while the pointer is over it, as it does over a revealed slot.
    • pub fn revealed_rects(&self, ctx: &egui::Context) -> Vec<(RevealEdge, Rect)>. The rects registered with [reveal_rect] on this pass, in registration order.
    • pub fn dialogs_shown(&self) -> u32. How many times a container in this shell showed on this pass as a dialog (a layer with a dialog's focus scope, modal or not), a full-window layer or an OS window: open, or closed and still fading out.
    • pub fn tabs_visible(&self) -> bool. Whether the document tabs show: the host's flag in normal mode, never in body-only mode.
    • pub fn edge_revealed(&self, edge: RevealEdge) -> bool. Is the edge reveal on for edge?
    • pub fn regions(&self) -> &ShellRegions. The body rect and the shown slots of this pass.
    • pub fn float_bounds(&self) -> Rect. Where floating frames may go: the body rect plus the area under bars that overlay the body.
    • pub fn page_band(&self) -> Option<PageBandRoom>. The page band's room while a full-window page shows, else None.
    • pub fn with_page_band(mut self, room: Option<PageBandRoom>) -> Self. The page band's room while a full-window page shows; None when no page shows or the window is full screen.
  • craft_ui::runtime::env::ShellRegions: pub struct ShellRegions { pub body: Rect, pub slots: Vec<(SlotKey, Rect)> }. What one shell pass laid out.
    • pub fn new(body: Rect) -> Self. A layout with body and no slots.
    • pub fn with_slot(mut self, key: SlotKey, rect: Rect) -> Self. The layout with the shown slot key at rect, after the slots already listed.
  • craft_ui::runtime::env::SlotKey: pub type SlotKey = &'static str. The stable key of a slot.
  • craft_ui::runtime::env::StyleValue: pub trait StyleValue: EnvValue + Hash. Marker for values style may read. Hash, because the value is folded into the style key.
  • craft_ui::runtime::env::SystemReader: re-export of craft_platform::appearance::SystemReader (outside these crates).
  • craft_ui::runtime::env::SystemState: pub struct SystemState { pub appearance: SystemAppearance, pub generation: u64 }. The OS's appearance now, and the generation that rises each time it changes.
  • craft_ui::runtime::env::ThemeScope: pub struct ThemeScope. Token-changing values for a container: the container itself (its surface, header, rules, scroll bars, pads and focus ring), its regions and body, and every layer opened from them resolve their tokens from another theme definition, mode, contrast or density.
    • pub fn new() -> Self. A scope that changes nothing: every value is inherited.
    • pub fn theme(mut self, def: Arc<ThemeDef>) -> Self. Resolves from def: a draft in a theme editor, a theme in a preview card.
    • pub fn mode(mut self, mode: Mode) -> Self. Resolves in mode: a plot that is dark in every theme, a preview of the other mode.
    • pub fn contrast(mut self, contrast: Contrast) -> Self. Resolves under contrast.
    • pub fn density(mut self, density: Size) -> Self. Resolves at the density preset density.
  • craft_ui::runtime::env::UnitKind: pub enum UnitKind { Pixels, Percent, Degrees, Points, Times, Inches, Centimetres, Millimetres, Picas, PixelsPerInch, PixelsPerCentimetre, Minutes, Columns, LinesPerInch, LinesPerCentimetre, Feet, FeetInches, Yards, Metres, Q, Ha, Letters, Hyphens, PerInch, Milliseconds }. What a number counts.
    • pub const LENGTHS: [UnitKind; 5]. The lengths a unit choice offers. [per_inch] answers for more kinds (feet, yards, metres, Q, Ha), which a typed number still reads.
    • pub const fn decimals(self) -> RangeInclusive<usize>. The digits after the decimal mark a number of this kind shows by default, at most.
    • pub const fn step(self) -> f64. What one arrow press, wheel notch or scrub point changes a number of this kind by, where the control that shows the kind steps by the kind's rule.
    • pub const POINTS_PER_INCH: f64. The points in an inch of PostScript points, the default of Points and Picas.
    • pub fn per_inch(self, points_per_inch: f64) -> Option<f64>. How many units of this kind make an inch, for the kinds that measure length; points_per_inch sets the size of Points and Picas (72, or 72.27 for traditional points). None for a kind that is not a length.
    • pub fn from_pixels(self, pixels: f64, extent: f64, pixels_per_inch: f64, points_per_inch: f64) -> Option<f64>. pixels in this unit: Pixels as they are, Percent of extent pixels, a length through pixels_per_inch (extent and pixels_per_inch clamped to at least 1; points_per_inch as in [per_inch]).
    • pub fn to_pixels(self, value: f64, extent: f64, pixels_per_inch: f64, points_per_inch: f64) -> Option<f64>. A value in this unit as pixels; the inverse of [from_pixels].
  • craft_ui::runtime::env::UnitWords: re-export of craft_ui::runtime::env::units::UnitWords (defined outside these crates).
  • craft_ui::runtime::env::Units: pub struct Units. Reads and writes numbers with their unit in the user's language and digits.
    • pub fn zoom_codec(&self) -> NumberCodec. The codec of a zoom field in percent: the percent reader, up to two decimals (the zoom ladder has rungs such as 66.67 %), with zoom typing (a/b as a ratio, a second separator cutting the text), so every zoom field reads typed text by the same rules.
    • pub fn points_per_inch(&self) -> f64. How many points make an inch in the scope: the app's point-size preference.
    • pub fn name(&self, kind: UnitKind) -> Label. The unit's name in the user's language, as a list of units shows it: Pixels, Pixels/Inch.
    • pub fn symbol(&self, kind: UnitKind) -> String. The unit's spelling in the user's language without the number: mm, px.
    • pub fn affixes(&self, kind: UnitKind) -> (String, String). The text before and after the number in the user's language, spacing included: ("", " mm"), ("", "%").
    • pub fn text(&self, kind: UnitKind, n: f64, decimals: RangeInclusive<usize>) -> String. n of kind with between the least and most digits of decimals after the decimal mark, in the user's language and digits.
    • pub fn show(&self, kind: UnitKind, n: f64) -> String. n of kind with its default digits ([UnitKind::decimals]).
    • pub fn pixels(&self, n: f64) -> String. n pixels: 12 px.
    • pub fn percent(&self, n: f64) -> String. n percent: 12%.
    • pub fn zoom_percent(&self, n: f64) -> String. A zoom of n percent: 100%, 12.5%, 66.67%.
    • pub fn degrees(&self, n: f64) -> String. n degrees: 12°.
    • pub fn times(&self, n: f64) -> String. n times: 12×.
    • pub fn duration(&self, seconds: f64) -> String. seconds as a duration: 0.35 s, 12 s, with at most two digits after the decimal mark.
    • pub fn file_size(&self, bytes: u64) -> String. bytes as a file size in steps of 1024 with one decimal (1.5 KB, 12.0 MB, 512 bytes), the unit names and digits of the user's language.
    • pub fn file_size_as(&self, bytes: u64, style: FileSize) -> String. bytes as a file size written the way style says.
    • pub fn number(&self, n: f64, decimals: RangeInclusive<usize>) -> String. n with digit groups and between the least and most digits of decimals after the decimal mark, in the user's language and digits, with no unit.
    • pub fn number_ungrouped(&self, n: f64, decimals: RangeInclusive<usize>) -> String. n with between the least and most digits of decimals after the decimal mark, in the user's language and digits, with no digit groups and no unit.
    • pub fn reader(&self, kind: Option<UnitKind>) -> Reader. A reader for numbers of kind (plain numbers when None): the locale's decimal and group separators and the unit spellings that convert to kind, in the user's language and in English.
    • pub fn reader_with_points(&self, kind: Option<UnitKind>, points_per_inch: f64) -> Reader. Like reader, with Points and Picas of points_per_inch to the inch, so a typed 12pt is the length a dialog's own point size converts.
    • pub fn length_scale(&self, lengths: LengthUnits) -> Option<f64>. How many lengths.shown make one lengths.stored; None when either is not a pixel or length unit or the resolution is not a positive number.
    • pub fn length_reader(&self, lengths: LengthUnits) -> Reader. A reader for lengths shown in lengths.shown: the spellings of every length unit and of pixels convert to it, and a bare number is in it, or in lengths.bare when set.
    • pub fn document_reader(&self, ruler: UnitKind, extent: f64, pixels_per_inch: f64, points_per_inch: f64) -> Reader. A reader for the numbers of a document measured in ruler: the unit spellings of every pixel and length unit (px, %, in, cm, mm, pt, pica) convert to ruler through the document's numbers, percent of extent pixels and lengths at pixels_per_inch, with points of points_per_inch to the inch (UnitKind::to_pixels clamps them).
  • craft_ui::runtime::env::WheelScope: pub enum WheelScope { Plain, Free, Gated, Directional }. How the wheel takers of a scope take the wheel.
  • craft_ui::runtime::env::WheelSpeed: pub struct WheelSpeed { pub line: f32, pub point: f32 }. The user's wheel multipliers: line for notches, point for touchpad deltas.
    • pub const fn new(line: f32, point: f32) -> Self. The multipliers for line (notch) and point (touchpad) scrolling.
  • craft_ui::runtime::env::WindowKey: pub struct WindowKey. The key of a window.
    • pub fn main() -> Self. The first window, "main".
    • pub fn new(key: impl Into<String>) -> Self. A key from any string.
    • pub fn as_str(&self) -> &str. The key as a string.
  • craft_ui::runtime::env::Word: re-export of craft_ui::runtime::env::label::Word (defined outside these crates).
  • craft_ui::runtime::env::WordRows: re-export of craft_i18n::WordRows (outside these crates).
  • craft_ui::runtime::env::WordSet: re-export of craft_i18n::WordSet (outside these crates).
  • craft_ui::runtime::env::WordTemplate: re-export of craft_i18n::WordTemplate (outside these crates).
  • craft_ui::runtime::env::Words: re-export of craft_i18n::Words (outside these crates).
  • craft_ui::runtime::env::WordsOverride: pub enum WordsOverride { Replace(Arc<Words>), Overlay(WordRows) }. How a scope changes the built-in text: the only override path for words.
  • craft_ui::runtime::env::ZoomPrecision: pub enum ZoomPrecision { Fractional, Whole }. How many decimals a zoom shows.
  • craft_ui::runtime::env::in_room: pub fn in_room<R>(ui: &mut Ui, rect: Rect, body: impl FnOnce(&mut Ui) -> R) -> R. Runs body in a child Ui held to rect and clipped to it, as a layout room of its own: the flow grid, content column and fill sharing of the body around it do not reach in, so a child that fills takes rect, whatever else that body holds.
  • craft_ui::runtime::env::system_appearance: pub fn system_appearance(ctx: &Context) -> SystemState. What the OS reports on ctx now: the host's reader (InstallSpec::system), with the colour scheme egui's integration reports (Event::SystemTheme) where the reader's own watcher has none.
  • craft_ui::runtime::env::system_text_scale: pub fn system_text_scale(ctx: &Context) -> Option<f32>. The desktop text scale from the installed [SystemReader], None where the OS gives none.
  • craft_ui::runtime::env::with_env: pub fn with_env<R>(ui: &mut Ui, set: impl FnOnce(&mut Overrides), body: impl FnOnce(&mut Ui) -> R) -> R. Runs body in a child Ui with set's changes applied to the inherited values.

craft_ui::runtime::focus

The focus service: stops, scopes and roving groups registered per pass, the focused stop per arena root, focus on press, focus after removal and programmatic focus (spec 8.3, 9.4, 9.5).

  • craft_ui::runtime::focus::FocusMove: pub enum FocusMove { Keys, Other }. What moved the key focus.
  • craft_ui::runtime::focus::FocusShape: pub enum FocusShape { Rect, Circle, Polygon(Vec<egui::Pos2>) }. The shape the focus ring takes around a part.
  • craft_ui::runtime::focus::focus_came_with_open: pub fn focus_came_with_open(ctx: &Context) -> bool. Whether the focused stop took the focus when its scope opened (a menu's first row as the menu showed) and has kept it since: no key, press or request (an AccessKit Focus, the app's [request]) has moved it.
  • craft_ui::runtime::focus::has: pub fn has(ctx: &Context, id: Id) -> bool. Whether focus is on the component id or on one of its parts (a canvas's editor part), from the focus record of the stop focus is on.
  • craft_ui::runtime::focus::host_canvas: pub fn host_canvas(ctx: &Context, id: Id, keys: KeyUse). Registers the app's own egui widget id, drawn in the running pass, as its window's document canvas: its focus stop takes keys and is marked as the canvas (KeyUse::chrome_key), in place of the stop it has as one of the app's focusable egui widgets, at the same place in Tab order.
  • craft_ui::runtime::focus::is_focused: pub fn is_focused(ctx: &Context, id: Id) -> bool. Whether the focus stop is the component id: the focused member or item of its arena, or a root that holds focus while none of its members is the stop.
  • craft_ui::runtime::focus::request: pub fn request(ctx: &Context, target: FocusTarget) -> bool. Moves focus to target, leaves modality unchanged and asks the enclosing scroll owner to reveal it.
  • craft_ui::runtime::focus::takes_letters: pub fn takes_letters(keys: &KeyUse) -> bool. Whether a stop with these keys takes typed letters: a text field or a shortcut recorder.
  • craft_ui::runtime::focus::ActivateKeys: pub enum ActivateKeys { Neither, Enter, Space, Both }. The keys that activate a component.
    • pub const fn enter(self) -> bool. Whether Enter activates.
    • pub const fn space(self) -> bool. Whether Space activates.
  • craft_ui::runtime::focus::EditSet: pub struct EditSet. The edit commands a component takes as Intent::Edit.
    • pub const NONE: EditSet. No command.
    • pub const ALL: EditSet. Every command.
    • pub const fn with(self, command: EditCommand) -> EditSet. The set plus command.
    • pub const fn contains(self, command: EditCommand) -> bool. Whether the set has command.
  • craft_ui::runtime::focus::EndKey: pub enum EndKey { LastItem, EndMode }. What a bare End means for a focused component.
  • craft_ui::runtime::focus::EnterRule: pub enum EnterRule { Pass, Submit }. What Enter does in a scope after the focused component declined it.
  • craft_ui::runtime::focus::FocusPolicy: pub struct FocusPolicy { pub kind: ScopeKind, pub trap: bool, pub restore: bool, pub initial: Initial, pub enter: EnterRule, pub cancel: CancelRule, pub pages: bool, pub list_enter: bool, pub list: Option<Id>, pub escape_keeps_typing: bool }. A focus scope's rules.
    • pub const NONE: FocusPolicy. A scope that changes nothing.
    • pub const PANE: FocusPolicy. A pane: an F6 stop.
    • pub const DIALOG: FocusPolicy. A dialog: Tab stays inside, Enter submits, Escape closes.
    • pub const POPUP: FocusPolicy. A popup: focus moves in, Escape closes and focus returns to the opener.
    • pub const MENU: FocusPolicy. A menu: like a popup.
    • pub const TAB_LAYER: FocusPolicy. A layer that only Tab reaches, such as the toasts: it traps nothing and takes no focus on its own, and when it goes away with focus inside, focus returns to the stop it came from.
    • pub const fn trap(mut self, on: bool) -> Self. Whether Tab wraps inside the scope.
    • pub const fn restore(mut self, on: bool) -> Self. Whether focus returns to the opener.
    • pub const fn initial(mut self, initial: Initial) -> Self. Where focus goes first.
    • pub const fn cancel(mut self, cancel: CancelRule) -> Self. What Escape does.
    • pub const fn list_enter(mut self, on: bool) -> Self. Whether Enter on a text opener activates the layer's list.
    • pub const fn list(mut self, list: Id) -> Self. The collection in the layer that takes the opener's list keys.
    • pub const fn escape_keeps_typing(mut self, on: bool) -> Self. Whether Escape in this dialog keeps the focused field's typing ([FocusPolicy::escape_keeps_typing]).
    • pub const fn pages(mut self, on: bool) -> Self. Whether Ctrl+Tab cycles pages.
  • craft_ui::runtime::focus::FocusRequest: pub enum FocusRequest { Take, WhenNone }. A one-shot request for focus on a component's stop (Props::request_focus), for what opens without a layer of its own (an inline editor, a view's search field): a layer names its stop with Initial instead.
  • craft_ui::runtime::focus::FocusTarget: pub enum FocusTarget { Id(Id), Part(Id, PartRef), Doc(DocKey) }. What runtime::focus::request focuses.
  • craft_ui::runtime::focus::Initial: pub enum Initial { Keep, First, FirstField, Default, Key(&'static str), KeepAnchor }. Where focus goes the first time a scope is pushed.
  • craft_ui::runtime::focus::Intents: pub struct Intents. An owned copy of the intents routed to one id this pass; read through cx.intents().
    • pub fn take_digit(&mut self) -> Option<u8>. Takes the next typed digit.
    • pub fn take(&mut self, intent: Intent) -> bool. Takes an intent of the kind of intent, once per pass: the first taker gets it.
    • pub fn take_exact(&mut self, intent: &Intent) -> bool. Takes an intent equal to intent in every field, once per pass: Intent::delete(false, Granularity::Grapheme) takes Backspace and leaves Delete, which take would also take.
    • pub fn take_move(&mut self) -> Option<(NavMove, MoveMods)>. Takes the next move, whichever it is: for a component that acts on every move.
    • pub fn take_move_where(&mut self, wanted: impl Fn(NavMove, MoveMods) -> bool) -> Option<(NavMove, MoveMods)>. Takes the next move that wanted accepts; the others stay for a later taker, or for the scroll owner around a focused component when they scroll (9.2 rule 5).
    • pub fn take_scroll_access(&mut self, into_view: bool) -> Option<AccessRequest>. Takes the next AccessKit request that asks a scroll region to scroll, or with into_view to show its target.
    • pub fn take_edit(&mut self) -> Option<EditCommand>. Takes the next edit command.
    • pub fn take_text(&mut self) -> Option<Arc<str>>. Takes the next typed text.
    • pub fn take_nudge(&mut self) -> Option<(Vec2, Mods)>. Takes the physical arrow nudge for canvas content: a unit direction and the modifiers.
    • pub fn nudge_held(&self) -> &[Key]. The keys that were down when the arrow of the nudge not yet taken went down, the arrow not among them; empty without one.
    • pub fn take_chords(&mut self) -> Vec<Chord>. Takes the chords this pass's presses spell, for a component whose key use is KeyUse::RECORDER; empty for any other component.
    • pub fn take_set_value(&mut self) -> Option<f64>. Takes the AccessKit SetValue request aimed at the component's own node.
    • pub fn take_set_value_at(&mut self, part: impl Into<PartRef>) -> Option<f64>. Takes the AccessKit SetValue request aimed at the sub-node of part.
    • pub fn untaken(&self, intent: &Intent) -> bool. Whether an intent of the kind of intent is routed and not taken.
    • pub fn take_access(&mut self) -> Option<AccessRequest>. Takes the next Intent::Access request.
  • craft_ui::runtime::focus::KeepKeys: pub enum KeepKeys { None, Tab, InlineArrows, BlockArrows }. The keys a focused component keeps from the key stage.
  • craft_ui::runtime::focus::KeyUse: pub struct KeyUse { pub keep: KeepKeys, pub activate: ActivateKeys, pub claims: &'static [Chord], pub edits: EditSet, pub inactive: EditSet, pub owner: OwnerClass, pub value: bool, pub moves: bool, pub chrome_key: bool, pub nudge: bool, pub nudge_mods: NudgeMods, pub deletes: bool, pub submits: bool, pub end: EndKey, pub session: bool, pub type_ahead: bool, pub holds_drafts: bool, pub command_keys: bool }. A component's declared keys.
    • pub const TEXT_MULTILINE: KeyUse. A multi-line text field: Up and Down move the caret.
    • pub const CODE: KeyUse. A code editor: Tab inserts.
    • pub const CANVAS: KeyUse. A document canvas: all arrows, no activation, and the key that marks its window as showing a document.
    • pub const SPLITTER: KeyUse. A divider between panes: it takes the arrows as moves of its value, but it is no document and no canvas tool, so it marks no window as showing a document and takes no nudges.
    • pub const RECORDER: KeyUse. A shortcut recorder: it takes the arrows of a canvas, but it is no document, so it marks no window and a Tab in it never toggles panels.
    • pub const fn of(input: Input) -> KeyUse. The default key use of a component that takes input.
    • pub const fn with_holds_drafts(mut self) -> Self. The same use declaring that a press that would apply the focused draft leaves it unapplied (holds_drafts).
    • pub const fn with_command_keys(mut self) -> Self. The same use letting command chords and function keys run the app's commands while it types (command_keys).
    • pub const fn with_type_ahead(mut self) -> Self. The same use taking typed letters as Intent::Text.
    • pub const fn with_claims(mut self, claims: &'static [Chord]) -> Self. The same use claiming claims.
    • pub const fn with_edits(mut self, edits: EditSet) -> Self. The same use listing edits.
    • pub const fn with_inactive(mut self, inactive: EditSet) -> Self. The same use marking inactive of its edit commands as doing nothing now (KeyUse::inactive).
    • pub const fn with_activate(mut self, activate: ActivateKeys) -> Self. The same use with activate as the keys that activate: a value control that arrow and Page keys step takes none.
    • pub const fn with_value(mut self, value: bool) -> Self. The same use with value as whether its arrows step a value.
    • pub const fn with_moves(mut self) -> Self. The same use declaring that the component acts on the moves routed to it.
    • pub const fn with_deletes(mut self) -> Self. The same use declaring that the component acts on Delete and Backspace.
    • pub const fn with_session(mut self) -> Self. The same use declaring that the component holds its arena's edit session (session).
    • pub const fn with_submits(mut self) -> Self. The same use declaring that the component acts on Enter and takes Intent::Submit.
    • pub const fn with_end(mut self, end: EndKey) -> Self. The same use with end as the meaning of a bare End.
    • pub const fn with_keep(mut self, keep: KeepKeys) -> Self. The same use with keep as the keys it keeps from the key stage.
    • pub const fn with_chrome_key(mut self, chrome_key: bool) -> Self. The same use with chrome_key as whether the component marks its window as showing a document: a canvas control that is no document sets it to false.
    • pub const fn with_nudge_mods(mut self, nudge_mods: NudgeMods) -> Self. The same use with nudge_mods as the modifiers a document canvas acts on with the arrows.
    • pub const fn is_document_editor(&self) -> bool. Whether the component is a document canvas's editor part: the document (chrome_key) holding its editor's text keys.
    • pub fn claims_chord(&self, chord: &Chord) -> bool. Whether the component claims chord.
  • craft_ui::runtime::focus::Letters: pub enum Letters { None, TypeAhead }. Whether a roving group matches typed letters to entries.
  • craft_ui::runtime::focus::NudgeMods: pub struct NudgeMods. A set of modifier combinations held with the arrows (KeyUse::nudge_mods): each is matched exactly, so Shift alone does not admit Shift with Alt.
    • pub const NONE: NudgeMods. No arrow.
    • pub const STEPS: NudgeMods. The plain arrows and the arrows with Shift: the step and the large step every nudge reads.
    • pub const fn with(self, mods: Mods) -> Self. The same set with mods in it.
    • pub const fn union(self, other: NudgeMods) -> Self. Every combination of either set.
    • pub const fn contains(self, mods: Mods) -> bool. Whether mods is in the set.
  • craft_ui::runtime::focus::Roving: pub struct Roving { pub shape: NavShape, pub wrap: bool, pub home_end: bool, pub page: Option<usize>, pub letters: Letters, pub arrows: Arrows, pub first_column: Option<usize>, pub hands_back: bool, pub no_lead: bool, pub keeps_lead_moves: bool }. A roving group's rules: one Tab stop whose members take moves.
    • pub const fn new(shape: NavShape) -> Roving. A group of shape with Home and End, no wrap, no paging and no letters.
    • pub const fn wrap(mut self, on: bool) -> Self. Whether moves wrap.
    • pub const fn home_end(mut self, on: bool) -> Self. Whether Home and End move to the ends.
    • pub const fn page(mut self, rows: Option<usize>) -> Self. Rows a Page key covers.
    • pub const fn letters(mut self, letters: Letters) -> Self. Whether letters pick entries.
    • pub const fn arrows(mut self, arrows: Arrows) -> Self. The arrows the group takes.
    • pub const fn first_column(mut self, column: usize) -> Self. The column of the first member of a wrapped grid with column blank cells before it: Up and Down keep the column, Home and End go to the ends of the row.
    • pub const fn hands_back(mut self) -> Self. A move the group cannot make reaches the owning component, which may page or change what the group shows.
    • pub const fn keeps_lead_moves(mut self) -> Self. Left and Right with the lead modifier reach the focused member.
    • pub const fn no_lead(mut self, on: bool) -> Self. Whether the focused member is no lead: the next move starts at an end, as from a group with no lead.
    • pub const fn state(&self, lead: Option<usize>) -> NavState. The state a step over this group starts from, at lead, or from no lead when the group has none.
    • pub const fn takes(&self, mv: NavMove, mods: MoveMods) -> bool. Whether the group handles mv with mods: Page moves only with a page size and without lead (on a document canvas that scrolls sideways), Start and End only with Home and End, and no lead_step in a group that keeps_lead_moves.
  • craft_ui::runtime::focus::TabReach: pub enum TabReach { Root, Fields }. Which Tab stops a dialog's Tab order visits.

craft_ui::runtime::frame

The frame plugin: the per-pass and per-frame steps, with the inputs the app sets and the outputs it drains.

  • craft_ui::runtime::frame::ChromeToggle: pub enum ChromeToggle { Panels, PanelsKeepTools, ShowPanels, Reveal(Option<super::env::RevealEdge>) }. Which panels a window's chrome toggle hides (spec 1.8): the window.toggle_panels and window.toggle_panels_keep_tools commands.
  • craft_ui::runtime::frame::FrameInput: pub struct FrameInput { pub root: RootEnv, pub commands: CommandInput, pub host: Option<Arc<Host>>, pub latched: Mods, pub app_modal: Option<ViewportId>, pub window_input: WindowInput }. What the app sets before each frame.
    • pub fn new(root: RootEnv) -> Self. A frame with root and no host.
    • pub fn window_input(mut self, window_input: WindowInput) -> Self. Sets whether the window system's input reaches the hosted windows.
    • pub fn commands(mut self, commands: CommandInput) -> Self. Sets the command input.
    • pub fn latched(mut self, mods: Mods) -> Self. Sets the modifiers latched beyond the window's input.
    • pub fn app_modal(mut self, viewport: Option<ViewportId>) -> Self. Sets the window in which the app's own egui code shows a modal ([FrameInput::app_modal]).
    • pub fn host(mut self, host: Arc<Host>) -> Self. Sets the host: the same Arc<Host> every frame, a new one to switch (see [FrameInput::host]).
  • craft_ui::runtime::frame::FrameOutput: pub struct FrameOutput { pub fired: Vec<Fired>, pub delivered: Vec<Fired>, pub dimmed: Vec<Fired>, pub declined: Vec<Fired>, pub announcements: Vec<String>, pub chrome_toggles: Vec<(ViewportId, ChromeToggle)>, pub removed_gestures: Vec<GestureId>, pub outer_edits: Vec<OuterEdit>, pub refused: bool, pub ended_previews: Vec<egui::Id> }. What the runtime accumulated since the last take_output, across passes and discarded passes.
  • craft_ui::runtime::frame::OuterEdit: pub enum OuterEdit { Begin { id: GestureId, label: Arc<str>, doc_key: Option<DocKey> }, Commit { id: GestureId }, Cancel { id: GestureId } }. A step of the outer gesture of a container whose ContainerProps::outer_edit is on: one undo step over the edits of its body's fields, from open to close.
  • craft_ui::runtime::frame::WindowInput: pub enum WindowInput { Live, Dropped }. Whether the window system's input reaches the OS windows the runtime hosts beside the root (a panel floated into its own window). eframe gives the host only the root's raw input (App::raw_input_hook), so the host applies its policy to the root there and gives it here for the rest.
  • craft_ui::runtime::frame::clock: pub fn clock(ctx: &Context) -> f64. The running pass's time in seconds, the same on every pass of a frame: for app code that times a wait.
  • craft_ui::runtime::frame::discard_pass: pub fn discard_pass(ctx: &Context, reason: &'static str). Discards the running pass, so nothing of it paints, and runs it again, when [discardable]: for a host that learns only after a part ran that the part showed what it must not.
  • craft_ui::runtime::frame::discardable: pub fn discardable(ctx: &Context) -> bool. Whether the running pass can still be discarded: egui runs a bounded number of passes a frame, and a discard asked in the last one is ignored, so what that pass shows paints.
  • craft_ui::runtime::frame::refuse: pub fn refuse(ctx: &Context). Records that the running pass refused its input (the text part refusing a Tab); the next take_output reports it in FrameOutput::refused.
  • craft_ui::runtime::frame::request_chrome_toggle: pub fn request_chrome_toggle(ctx: &Context, viewport: ViewportId, toggle: ChromeToggle). Adds a chrome toggle of viewport to the next FrameOutput and aims it at the window of the viewport that holds focus, or at the first shell that asks when none does.
  • craft_ui::runtime::frame::request_repaint_after: pub fn request_repaint_after(ctx: &Context, seconds: f64). Asks for one more pass of the viewport the running pass belongs to after seconds (a playback clock, a poll); the earliest request of a frame wins.
  • craft_ui::runtime::frame::set_input: pub fn set_input(ctx: &Context, input: FrameInput). Before the pass: from eframe's App::raw_input_hook, or before run_ui in tests.
  • craft_ui::runtime::frame::shell_root: pub fn shell_root(ctx: &Context, viewport: ViewportId) -> Option<Id>. The root container of the shell the latest pass of viewport showed: where a key pressed with nothing focused matches, so the window's commands take it.
  • craft_ui::runtime::frame::stepped_clock: pub fn stepped_clock(ctx: &Context, step: f64) -> f64. The pass clock in seconds rounded down to a multiple of step, for content that changes with time (a rescan every few seconds, a "5 minutes ago"): the running view is shown again at the next multiple.
  • craft_ui::runtime::frame::take_output: pub fn take_output(ctx: &Context) -> FrameOutput. Everything accumulated since the last call, across passes and discarded passes.
  • craft_ui::runtime::frame::will_rerun: pub fn will_rerun(ctx: &Context) -> bool. Whether egui will run the running pass again, so nothing of it paints: egui's Context::will_discard, or a discard pass that layout memory asked for in this pass and requests from egui only at the pass's end.

craft_ui::runtime::ime

The IME engine (18.4): who owns the IME this frame, the composing flag, preedit and commit delivery, and the caret rect for the OS.

  • craft_ui::runtime::ime::EditorSurrounding: pub enum EditorSurrounding<'a> { Text { text: &'a str, cursor: usize, anchor: usize }, Unavailable { revision: Option<u64> } }. An owner's surrounding report as the engine keeps it for one pass: an owned copy of at most MAX_IME_SURROUNDING_TEXT_BYTES around the selection, never the whole document, and the epoch of the target.
    • pub const fn text(text: &'a str, cursor: usize, anchor: usize) -> Self. The text around the caret, with byte offsets of the cursor and the selection anchor into text.
    • pub const fn unavailable(revision: Option<u64>) -> Self. No text to report, at revision if the editor keeps one.

craft_ui::runtime::inspect

Decision records and findings.

  • craft_ui::runtime::inspect::Element: pub struct Element { pub id: Id, pub part: Option<PartRef>, pub component: &'static str, pub depth: usize, pub rect: Rect, pub content: Rect, pub facts: Option<Facts>, pub stop: Option<usize>, pub command: Option<CommandRef> }. One element an inspected region showed: a component, or a part of one with a node, a hit area or a focus stop.
    • pub fn node(&self) -> Id. The id of the access node the element stands for: the component's own id, or the sub-node of its part.
  • craft_ui::runtime::inspect::Facts: pub struct Facts { pub role: String, pub name: Option<String>, pub labelled_by: Vec<Id>, pub value: Option<String>, pub actions: Vec<&'static str>, pub disabled: bool, pub interactive: bool }. What a node says, as step 16 reported it.
  • craft_ui::runtime::inspect::HitArea: pub struct HitArea { pub owner: Id, pub part: Option<PartRef>, pub rect: Rect }. A hit area the sensing core registered for a component of the region.
  • craft_ui::runtime::inspect::Recorded: pub struct Recorded { pub layer: areas::LayerKey, pub elements: Vec<Element>, pub hits: Vec<HitArea> }. What an inspected region showed in a pass.
    • pub fn stop_rect(&self, index: usize) -> Option<Rect>. The rect of the element at index where Tab stops on it: its hit area when it has one, else its box.
    • pub fn rect_in(&self, ctx: &Context, index: usize, target: areas::LayerKey) -> Option<Rect>. The stop rect of the element at index (as [Recorded::stop_rect]) mapped into the layer target.
  • craft_ui::runtime::inspect::point_at: pub fn point_at(ctx: &Context, key: Id, index: Option<usize>). Points the list of the region key at the element at index, or at none.
  • craft_ui::runtime::inspect::pointed: pub fn pointed(ctx: &Context, key: Id) -> Option<usize>. The element of the region key its list points at (the row under the pointer), read as a value.
  • craft_ui::runtime::inspect::record: pub fn record<R>(ui: &mut Ui, key: Id, body: impl FnOnce(&mut Ui) -> R) -> (R, Option<Arc<Recorded>>). Shows body as the inspected region key: the components it shows in a real run are recorded, and the record is returned and kept for [recorded].
  • craft_ui::runtime::inspect::recorded: pub fn recorded(ctx: &Context, key: Id) -> Option<Arc<Recorded>>. The latest record of the region key, read as a value: when the region shows later in the pass with a different record, the pass runs again.

craft_ui::runtime::install

runtime::install: adds the runtime plugin once and sets the egui options the runtime owns.

  • craft_ui::runtime::install::InstallError: pub enum InstallError { AlreadyInstalled, DuplicateStyle(DuplicateStyle), Commands(commands::CommandDefError), DuringPass }. Why install refused a spec.
  • craft_ui::runtime::install::InstallSpec: pub struct InstallSpec { pub shell_info: ShellInfo, pub window_system: Arc<dyn WindowSystem>, pub placement: Option<Arc<Mutex<Store>>>, pub frame_layers: Option<fn(&Context)>, pub looks: StyleReplacements, pub frame: Option<Decision>, pub system: SystemReader, pub wheel: WheelModifiers, pub app_id: String, pub pen: Option<PenSource>, pub stories: bool, pub clipboard: Option<craft_platform::clipboard::Clipboard>, pub jobs: Option<Arc<dyn Jobs>> }. What install takes.
    • pub fn new(shell_info: ShellInfo, window_system: Arc<dyn WindowSystem>) -> Self. A spec for shell_info and window_system, with no ghost-layer painter.
    • pub fn jobs(mut self, jobs: Arc<dyn Jobs>) -> Self. Runs the context's background work on jobs while no host is installed.
    • pub fn clipboard(mut self, clipboard: craft_platform::clipboard::Clipboard) -> Self. Installs the host's clipboard (system, browser event, memory) in place of the runtime's own.
    • pub fn stories(mut self) -> Self. Loads the stories' command sets too, for an install that shows stories.
    • pub fn placement(mut self, store: Arc<Mutex<Store>>) -> Self. Sets the store viewport mounts save their window placement in.
    • pub fn looks(mut self, looks: impl Into<StyleReplacements>) -> Self. Sets the app's style replacements.
    • pub fn system(mut self, reader: SystemReader) -> Self. Sets the reader of the OS's appearance; the host starts it (SystemReader::start) with a wake that repaints.
    • pub fn wheel(mut self, modifiers: WheelModifiers) -> Self. Sets the modifiers the wheel zooms and scrolls sideways with.
    • pub fn frame(mut self, decision: Decision) -> Self. Sets the root window's decided frame (craft_window::policy::decide_for).
    • pub fn app_id(mut self, id: impl Into<String>) -> Self. Sets the app id every OS window carries (dock icon, Wayland compositor rules).
    • pub fn pen(mut self, source: PenSource) -> Self. Sets the tablet source the pointer feed reads.
    • pub fn frame_layers(mut self, painter: Option<fn(&Context)>) -> Self. Sets the end hook's ghost-layer painter.
  • craft_ui::runtime::install::WheelModifiers: pub struct WheelModifiers { pub zoom: egui::Modifiers, pub sideways: egui::Modifiers }. The modifiers the mouse wheel zooms and scrolls sideways with.
    • pub const fn new(zoom: egui::Modifiers, sideways: egui::Modifiers) -> Self. The wheel zooms with zoom held and scrolls sideways with sideways held.
  • craft_ui::runtime::install::install: pub fn install(ctx: &Context, spec: InstallSpec) -> Result<(), InstallError>. Adds the runtime plugin to ctx and sets the egui options the runtime owns: the interface scale is the app's (RootEnv::scale), quit is a command that goes through the close guard, and the wheel's modifiers are the spec's.

craft_ui::runtime::keys

The key stage (spec 9.1, 9.2, 9.3, 9.7): the input hook strips the keys the runtime owns and records every key event of the pass, the begin hook turns them into the Intents of the focused component, and claims, menu-bar keys and AccessKit action requests are routed from the same record.

  • craft_ui::runtime::keys::MenuKey: pub enum MenuKey { Focus, Letter(char) }. A menu-bar key of an in-window bar (spec 9.7).
  • craft_ui::runtime::keys::AccessRequest: re-export of craft_behavior::intent::AccessRequest.
  • craft_ui::runtime::keys::Intent: re-export of craft_behavior::intent::Intent.
  • craft_ui::runtime::keys::Intents: pub struct Intents. An owned copy of the intents routed to one id this pass; read through cx.intents().
    • pub fn take_digit(&mut self) -> Option<u8>. Takes the next typed digit.
    • pub fn take(&mut self, intent: Intent) -> bool. Takes an intent of the kind of intent, once per pass: the first taker gets it.
    • pub fn take_exact(&mut self, intent: &Intent) -> bool. Takes an intent equal to intent in every field, once per pass: Intent::delete(false, Granularity::Grapheme) takes Backspace and leaves Delete, which take would also take.
    • pub fn take_move(&mut self) -> Option<(NavMove, MoveMods)>. Takes the next move, whichever it is: for a component that acts on every move.
    • pub fn take_move_where(&mut self, wanted: impl Fn(NavMove, MoveMods) -> bool) -> Option<(NavMove, MoveMods)>. Takes the next move that wanted accepts; the others stay for a later taker, or for the scroll owner around a focused component when they scroll (9.2 rule 5).
    • pub fn take_scroll_access(&mut self, into_view: bool) -> Option<AccessRequest>. Takes the next AccessKit request that asks a scroll region to scroll, or with into_view to show its target.
    • pub fn take_edit(&mut self) -> Option<EditCommand>. Takes the next edit command.
    • pub fn take_text(&mut self) -> Option<Arc<str>>. Takes the next typed text.
    • pub fn take_nudge(&mut self) -> Option<(Vec2, Mods)>. Takes the physical arrow nudge for canvas content: a unit direction and the modifiers.
    • pub fn nudge_held(&self) -> &[Key]. The keys that were down when the arrow of the nudge not yet taken went down, the arrow not among them; empty without one.
    • pub fn take_chords(&mut self) -> Vec<Chord>. Takes the chords this pass's presses spell, for a component whose key use is KeyUse::RECORDER; empty for any other component.
    • pub fn take_set_value(&mut self) -> Option<f64>. Takes the AccessKit SetValue request aimed at the component's own node.
    • pub fn take_set_value_at(&mut self, part: impl Into<PartRef>) -> Option<f64>. Takes the AccessKit SetValue request aimed at the sub-node of part.
    • pub fn untaken(&self, intent: &Intent) -> bool. Whether an intent of the kind of intent is routed and not taken.
    • pub fn take_access(&mut self) -> Option<AccessRequest>. Takes the next Intent::Access request.
  • craft_ui::runtime::keys::MoveMods: re-export of craft_behavior::intent::MoveMods.
  • craft_ui::runtime::keys::NavMove: re-export of craft_behavior::intent::NavMove.
  • craft_ui::runtime::keys::PartRef: re-export of craft_behavior::part::PartRef.
  • craft_ui::runtime::keys::ScalarKeyPolicy: pub struct ScalarKeyPolicy. Opt-in additive model-unit vertical-key and accessibility nudges.
    • pub const fn new(nudge: f64) -> Self. A focused-row policy, with Shift multiplying the additive nudge by five.
    • pub const fn trigger(mut self, trigger: ScalarKeyTrigger) -> Self. Chooses whether whole-row hover also makes a row eligible.
    • pub const fn shift_factor(mut self, factor: f64) -> Self. Sets the multiplier used by Shift.
    • pub const fn model_step(mut self, step: f64) -> Self. Selects an explicit zero-origin model grid for scalar keys and accessibility actions only.
    • pub fn is_valid(self) -> bool. Whether the amounts and any selected model step describe usable, finite positive changes.
    • pub fn amount(self) -> Option<f64>. The unmodified model-unit accessibility increment.
    • pub fn offset(self, movement: NavMove, modifiers: MoveMods) -> Option<f64>. An additive offset for vertical keys or accessibility increment/decrement (Forward/Back).
  • craft_ui::runtime::keys::ScalarKeyTrigger: pub enum ScalarKeyTrigger { Focused, HoveredOrFocused }. Which real scalar row can take a vertical arrow, without moving keyboard focus.
  • craft_ui::runtime::keys::escape_mods: pub fn escape_mods(ctx: &Context) -> Option<Mods>. The Alt and Shift held at the press of the pass's last Escape that became a Cancel; None when the pass had none.
  • craft_ui::runtime::keys::focus_holds: pub fn focus_holds(ctx: &Context, chord: Chord) -> bool. Whether the focused component of the running viewport holds a press of chord, as routing decides for the press:
  • craft_ui::runtime::keys::held: pub fn held(ctx: &Context) -> Vec<Key>. The keys down in the running viewport this pass: the key stage's down (withheld presses included), plus each key automation holds there that is not already listed.
  • craft_ui::runtime::keys::leftover_events: pub fn leftover_events(ctx: &Context) -> Vec<Event>. The key, text and clipboard events of the running pass that nothing took, in the order they arrived.
  • craft_ui::runtime::keys::textless_paste: pub fn textless_paste(ctx: &Context) -> bool. Whether the running viewport's input hook read a paste with no text in this pass: the paste chord came while the clipboard held no text (a picture, a PDF), so the platform sent no text to paste.
  • craft_ui::runtime::keys::with_canvas_window_intents: pub fn with_canvas_window_intents(ctx: &Context, rtl: bool, take: impl FnOnce(&mut Intents) -> bool) -> bool. Offers window intents to a canvas while the canvas or one of its controls has focus, or nothing has focus.
  • craft_ui::runtime::keys::with_window_intents: pub fn with_window_intents(ctx: &Context, rtl: bool, take: impl FnOnce(&mut Intents) -> bool) -> bool. Offers the window's intents and the focused framework stop's unused Escape to take, and writes back what it left untaken. take returns whether it took any.

craft_ui::runtime::layout_memory

Layout memory: sizes one pass measures and the next pass places by, the one discard pass a change asks for, what this pass's measuring runs found, and the measurements bodies keep across passes.

  • craft_ui::runtime::layout_memory::emit_text: pub fn emit_text(ctx: &Context, id: Id, text: Option<&str>). Hands forward a text a run found under id that content outside the body it runs in shows, as emit_record hands forward a measure: it serves the rest of this pass, and a later pass that takes the kept measurement of a body it ran in gets it with that measurement, where the content that found it does not run.
  • craft_ui::runtime::layout_memory::emit_width: pub fn emit_width(ctx: &Context, id: Id, width: f32). Hands forward a width a run measured under id that a step outside the content that measured it sizes by, as [emit_text] hands forward a text (the room a container's header parts leave for items its host adds, for example): it serves the rest of this pass, and a later pass that takes the kept measurement of a body it ran in gets it with that measurement.
  • craft_ui::runtime::layout_memory::forget_kept: pub fn forget_kept(ctx: &Context). Drops every kept measurement, so the next pass measures each body as a first pass would.
  • craft_ui::runtime::layout_memory::kept_leaves: pub fn kept_leaves(ctx: &Context) -> usize. How many component entries the valid kept measurements hold, each body counting only the components directly in it.
  • craft_ui::runtime::layout_memory::text: pub fn text(ctx: &Context, id: Id) -> Option<Arc<str>>. The text a run of this pass handed forward under id ([emit_text]), or a kept transcript gave this pass.
  • craft_ui::runtime::layout_memory::width: pub fn width(ctx: &Context, id: Id) -> Option<f32>. The width a run of this pass handed forward under id ([emit_width]), or a kept transcript gave this pass.

craft_ui::runtime::memory

Ids and memory: Remember, the memory stage, Facts, eviction and saved state.

  • craft_ui::runtime::memory::ForkError: pub enum ForkError { DuringPass, SameContext }. Why [fork_into] refused.
  • craft_ui::runtime::memory::Lifetime: pub enum Lifetime { Saved, Run }. How long a remembered value lives.
  • craft_ui::runtime::memory::Remember: pub trait Remember. Implemented by Cx, BodyCx and ItemCx over the pipeline's memory stage, each keyed by its own base id.
    • fn key(&self, part: impl Hash + Debug) -> Id. base.with(part): child and relation ids.
    • fn memory<T: Slot>(&mut self) -> &mut T. The shown slot of this component.
    • fn memory_at<T: Slot>(&mut self, part: impl Hash + Debug) -> &mut T. A shown slot keyed sub(base, ("mem", part)).
    • fn take<T: Slot>(&mut self) -> Option<T>. The shown slot, read once: it moves out, so it follows the shown lifetime's eviction.
    • fn press_slot<T: Slot>(&mut self) -> &mut Option<T>. The press slot: it goes when its press ends.
    • fn keep<T: Slot>(&mut self) -> &mut T. The session slot: it goes only through forget.
    • fn saved<T: Savable>(&mut self, key: &SaveKey) -> &mut T. The saved slot of key: it goes only through forget_saved.
    • fn recall<T: Slot>(&self) -> T. A read-only copy of the shown slot, for paint.
    • fn pending<K: Hash, T: Slot, E: Slot>(&mut self, key: K, start: impl FnOnce() -> Job<T, E>) -> &Pending<T, E>. The result of the job start returns, one per key: it is submitted once, cancelled when the owner is evicted, and a landed result asks for a pass.
    • fn appeared(&self) -> bool. True on the first pass a shown stage exists for this id, and on the first pass after the id was left unshown for a frame of its viewport (a page left and opened again), through that frame's passes.
  • craft_ui::runtime::memory::Savable: pub trait Savable: Slot + Serialize + DeserializeOwned. A slot that also lives in saved state.
  • craft_ui::runtime::memory::SaveKey: pub struct SaveKey. The key of a saved slot, such as "craft_dialogs.export.place".
    • pub const fn new(key: &'static str) -> Self. A key crate_prefix.name; evaluated in a const context it rejects a malformed name at compile time.
    • pub fn named(key: impl Into<Arc<str>>) -> Self. A key crate_prefix.name built at run time, for slots kept per item, such as a window for each open document.
    • pub fn as_str(&self) -> &str. The key's text.
  • craft_ui::runtime::memory::Slot: pub trait Slot: Clone + Default + Send + Sync + 'static. A value kept in memory. Clone is required because egui's temp store clones on insert; large caches hold Arcs.
  • craft_ui::runtime::memory::fork_into: pub fn fork_into(from: &Context, to: &Context) -> Result<(), ForkError>. Gives to a copy of from's UI memory, for a second context that draws what from shows (a headless capture of a window): egui's memory (areas, scroll areas, collapsing states, options) and the components' remembered state (scroll offsets, open sections, the session and shown slots of every component), copied by value. to keeps its own runtime: its pass state, focus, overlays, commands, windows and the rest of the services its install made, so a pass of to neither reads nor moves from's, and to may run a pass inside one of from's.
  • craft_ui::runtime::memory::key_salt: pub fn key_salt(key: &impl Hash) -> u64. A salt for an id made from key, a value that is only Hash: the ids egui makes also ask for Debug, which an app's key type need not have.
  • craft_ui::runtime::memory::run_value: pub fn run_value<T: Slot>(ctx: &Context, key: &SaveKey) -> T. The run-only value under key, in the session tier.
  • craft_ui::runtime::memory::saved_value: pub fn saved_value<T: Savable>(ctx: &Context, key: &SaveKey) -> T. The saved value under key, outside a dialog: an app reads one SAVED value through the same store the dialogs' remembered fields use.
  • craft_ui::runtime::memory::set_run_value: pub fn set_run_value<T: Slot>(ctx: &Context, key: &SaveKey, value: T). Sets the run-only value under key; see [run_value].
  • craft_ui::runtime::memory::set_saved_value: pub fn set_saved_value<T: Savable>(ctx: &Context, key: &SaveKey, value: T). Writes value as the saved value under key, outside a dialog.

craft_ui::runtime::motion

The motion service (13): tweens over one clock, the motion table, and one repaint request per viewport.

  • craft_ui::runtime::motion::Animate: pub trait Animate: crate::runtime::memory::sealed::Sealed. Motion on Cx, BodyCx and ItemCx.
    • fn anim<T: Interpolate>(&self, name: &'static str, target: T, spec: MotionSpec) -> T. target approached over spec's duration; the first call returns target without animating.
    • fn anim_bool(&self, name: &'static str, on: bool, spec: MotionSpec) -> f32. A 0 to 1 value approaching 1 when on, else 0.
    • fn presence(&self, name: &'static str, open: bool, spec: MotionSpec) -> Presence. Open-close presence for something shown while it opens and fades out.
    • fn presence_keyed<P: Clone + Send + Sync + 'static>(&self, name: &'static str, key: impl Hash, open: bool, payload: P, spec: MotionSpec,) -> Presence. Open-close presence of one of a set of things under name, told apart by key, such as the items of a list that enter and leave. payload is kept with the key while it is visible, so a thing its owner no longer has can still be drawn while it fades out (exiting).
    • fn exiting<P: Clone + Send + Sync + 'static>(&self, name: &'static str, spec: MotionSpec) -> Vec<(Presence, P)>. The keys of name that no pass of this frame drove open through presence_keyed, fading out, each with the payload it was last given; a key is forgotten once it has faded out.
    • fn jump<T: Interpolate>(&self, name: &'static str, value: T). Sets name to value with no animation.
    • fn phase(&self, period: f64, tick: Option<f64>) -> Option<f32>. The 0 to 1 position of a loop of period seconds, stepped every tick seconds when given; None when the mode asks for the still frame.
    • fn blink(&self, restart: f64) -> bool. Whether a caret last moved at restart (a pass time) shows now: solid right after restart, then blinking; always solid where the motion table's Blink row is solid.
    • fn now(&self) -> f64. The pass's time in seconds, read once per frame.
    • fn wake_at(&self, at: f64). Asks for a pass at at (timers, holds, polls), whatever the motion mode.
  • craft_ui::runtime::motion::Interpolate: pub trait Interpolate: Copy + PartialEq + Send + Sync + 'static. A value a tween can run over.
    • fn lerp(a: Self, b: Self, t: f32) -> Self. The value t of the way from a to b; t is 0 to 1.
    • fn distance(a: Self, b: Self) -> f32. How far apart two values are, in the value's own unit.
  • craft_ui::runtime::motion::MotionSpec: pub struct MotionSpec. A motion constant: a component picks one from spec, never writes seconds.
    • pub const fn kind(self) -> MotionKind. The kind that picks this spec's row of the motion table.
  • craft_ui::runtime::motion::Presence: pub struct Presence { pub t: f32, pub visible: bool, pub exiting: bool }. An open-close presence: t is 0 closed and 1 open, and a closing one stays visible until t reaches 0.
  • craft_ui::runtime::motion::Tween: pub struct Tween<T: Interpolate>. A running animation of one value.
    • pub fn at(value: T) -> Self. A tween at rest at value.
    • pub fn shown(&self) -> T. The value to paint.
    • pub fn target(&self) -> T. The value it runs toward.
    • pub fn is_settled(&self) -> bool. True once the shown value is the target.
    • pub fn retarget(&mut self, to: T, now: f64). Runs toward to from the value shown now.
  • craft_ui::runtime::motion::now: pub fn now() -> Instant. The wall clock's reading, for a host that drives a store on real time (ShellApp::tick).
  • craft_ui::runtime::motion::Instant: re-export of web_time::Instant (outside these crates).

craft_ui::runtime::motion::spec

The motion constants.

  • craft_ui::runtime::motion::spec::BLINK: pub const BLINK: MotionSpec. A text caret's blink.
  • craft_ui::runtime::motion::spec::CARET: pub const CARET: MotionSpec. A text caret gliding to its new place.
  • craft_ui::runtime::motion::spec::CHECK: pub const CHECK: MotionSpec. A check, a toggle or a selection turning on or off.
  • craft_ui::runtime::motion::spec::FOLLOW: pub const FOLLOW: MotionSpec. A target that moves every frame: zoom ease, remote cursors, autoscroll.
  • craft_ui::runtime::motion::spec::HOVER: pub const HOVER: MotionSpec. Hover and press feedback.
  • craft_ui::runtime::motion::spec::LOOP: pub const LOOP: MotionSpec. A spinner, marching ants or a pulse.
  • craft_ui::runtime::motion::spec::MOVE: pub const MOVE: MotionSpec. An element moving within the screen.
  • craft_ui::runtime::motion::spec::OPEN_FADE: pub const OPEN_FADE: MotionSpec. A popup's opacity.
  • craft_ui::runtime::motion::spec::OPEN_RISE: pub const OPEN_RISE: MotionSpec. A popup's travel while it opens.
  • craft_ui::runtime::motion::spec::OUTLINE: pub const OUTLINE: MotionSpec. A selection outline gliding to its new cells.

craft_ui::runtime::overlay

The layer stack (15.2): the record of the egui layers shown, their order and the open-modal fact.

  • craft_ui::runtime::overlay::Backdrop: pub enum Backdrop { None, Scrim }. A modal's backdrop.
  • craft_ui::runtime::overlay::CloseReason: pub enum CloseReason { Requested, Escape, Outside, FocusLeft(crate::runtime::focus::FocusMove), Activated, Enter, Timeout, AnchorGone }. Why a layer closes.
  • craft_ui::runtime::overlay::LayerRole: pub enum LayerRole { Plain, Progress, InPlaceEditor }. What a layer is for, beyond its rank.
  • craft_ui::runtime::overlay::OpenFilter: pub enum OpenFilter { Any, Modal, Keys, Asks }. What any_open counts.
  • craft_ui::runtime::overlay::Rank: pub enum Rank { Window, Toast, Popup, Modal { backdrop: Backdrop }, ModalChrome, Tooltip }. An overlay's place in the order. Rank chooses a layer's egui order; a popup that stands among the floating windows (an iconic column's flyout) shares theirs.
    • pub const fn modal(backdrop: Backdrop) -> Rank. A modal rank with backdrop.
  • craft_ui::runtime::overlay::any_open: pub fn any_open(ctx: &Context, filter: OpenFilter) -> bool. Whether any layer of the running viewport that filter counts was shown last frame.
  • craft_ui::runtime::overlay::close_popups: pub fn close_popups(ctx: &Context). Queues a close of every popup layer of the running viewport shown last frame that a command closes (Dismiss::commands): its menus, dropdowns and lists, not a dock panel's flyout.
  • craft_ui::runtime::overlay::family: pub fn family(ctx: &Context, id: Id) -> SmallVec<[Id; 4]>. id and everything opened from inside it, shown last frame.
  • craft_ui::runtime::overlay::is_open: pub fn is_open(ctx: &Context, id: Id) -> bool. Whether the layer id was shown last frame.
  • craft_ui::runtime::overlay::pressed_outside: pub fn pressed_outside(ctx: &Context, id: Id) -> bool. Whether a primary press landed outside the layer id in this pass while its dismissal kept it open.
  • craft_ui::runtime::overlay::raise: pub fn raise(ctx: &Context, id: Id). Brings the family of the open layer id in front of the other families of its class at the end of this pass, as a press on it does: a floating window goes to the top of egui's area order, which it shares with the app's own egui windows.
  • craft_ui::runtime::overlay::request_close: pub fn request_close(ctx: &Context, id: Id, why: CloseReason). Queues a close of the layer id (a popup or a container).
  • craft_ui::runtime::overlay::top: pub fn top(ctx: &Context) -> Option<Id>. The layer that receives Cancel: the newest member of the topmost family that takes keys.

craft_ui::runtime::pen

PenSource: the tablet's readings, which the runtime's one pointer feed pairs with each pointer move.

  • craft_ui::runtime::pen::PenSource: pub struct PenSource. A shared handle the app's platform tablet hooks write into and the runtime drains in each pass that carries pointer events.
    • pub fn set(&self, sample: Option<PointerSample>). Queues one tablet reading in order; None says the pen left the tablet.
    • pub fn set_barrel(&self, down: bool). Sets whether the barrel button is down.
    • pub fn current(&self) -> Option<PointerSample>. The latest reading, if the pen is on the tablet.

craft_ui::runtime::pending

Background results (14): one result per key in runtime memory, produced by a job on a host::queue::JobQueue per context.

  • craft_ui::runtime::pending::Job: pub struct Job<T, E>. Background work for Remember::pending: runs on the context's job queue, stops early when its owner is evicted or stops asking for its key.
    • pub fn new(run: impl FnOnce(&Progress, &Cancel) -> Result<T, E> + Send + 'static) -> Self. A job at Priority::VISIBLE. run checks Cancel::is_cancelled where it can stop early.
    • pub fn priority(mut self, priority: Priority) -> Self. Runs before waiting jobs of lower priority.
  • craft_ui::runtime::pending::LOST_LIMIT: pub const LOST_LIMIT: u32. How many times in a row a job may end without delivering before its key shows [Pending::Lost].
  • craft_ui::runtime::pending::Pending: pub enum Pending<T, E> { Loading { progress: Option<f32> }, Ready(T), Failed(E), Lost }. A result that may not have arrived.
  • craft_ui::runtime::pending::Progress: pub struct Progress. A job's report of how far it has come.
    • pub fn report(&self, fraction: f32). Reports fraction (0 to 1) done.
  • craft_ui::runtime::pending::finish_jobs: pub fn finish_jobs(ctx: &Context, timeout: Duration) -> bool. Finishes the jobs of every pending result on ctx now: the waiting ones run on the calling thread, and the call waits up to timeout for the ones running on lanes.

craft_ui::runtime::pointer

The pointer snapshot, press targets, the shape record and press cancels (8.1, 8.3).

  • craft_ui::runtime::pointer::PointerFrame: pub struct PointerFrame { pub pos: Option<Pos2>, pub delta: Vec2, pub buttons: Buttons, pub press: Option<PressStart>, pub press_mods: Option<Mods>, pub release: Option<PointerButton>, pub mods: Mods, pub pick_mods: Mods, pub click_mods: Mods, pub pick_pos: Option<Pos2>, pub multi_tap: Option<craft_behavior::MultiTap>, pub time: f64, pub kind: PointerKind, pub sample: Option<PointerSample>, pub multi_touch: Option<MultiTouch>, pub scroll: Vec2, pub zoom: f32, pub rotation: f32, pub slop: f32, pub target: f32 }. The pointer input of one pass of one viewport, egui-converted.
  • craft_ui::runtime::pointer::PressState: pub struct PressState { pub buttons: Buttons, pub press: Option<PressStart>, pub release: Option<PointerButton> }. The press state of a pass: the buttons held, and the primary press and the release the pass brought.
  • craft_ui::runtime::pointer::active_part: pub fn active_part(ctx: &Context, owner: Id) -> Option<PartRef>. The part of owner holding the pointer's hover or an open press in this viewport.
  • craft_ui::runtime::pointer::follows_pointer: pub fn follows_pointer(ctx: &Context, rect: Rect). Records that what the running pass shows in rect (screen points) follows the pointer: a cursor drawn at the pointer, a readout of the point under it.
  • craft_ui::runtime::pointer::frame: pub fn frame(ctx: &Context) -> PointerFrame. The running pass's pointer input.
  • craft_ui::runtime::pointer::gate_pointer_moves: pub fn gate_pointer_moves(ctx: &Context). Lets a pointer move run no pass when nothing it would change differs: egui's gate ([egui::Context::set_pointer_move_gate]) answers [move_needs_pass].
  • craft_ui::runtime::pointer::hover_point_in: pub fn hover_point_in(ctx: &Context, rect: Rect) -> Option<Pos2>. The running pass's hover point (screen points) when it lies in rect (screen points), for code that shows what it reads there (a readout, a cursor drawn at the point, a band at the line nearest it): rect then follows the pointer ([follows_pointer]).
  • craft_ui::runtime::pointer::hovers: pub fn hovers(ctx: &Context, id: Id) -> bool. Whether a shape the component id registered shows hover in the running pass, by the pass's one resolution of what lies under the pointer: it takes the press there, or it is the topmost shape and takes none.
  • craft_ui::runtime::pointer::mods: pub fn mods(ctx: &Context) -> Mods. The modifiers held in the running pass, with the latched ones (PointerFrame::mods).
  • craft_ui::runtime::pointer::move_needs_pass: pub fn move_needs_pass(ctx: &Context, viewport: ViewportId, from: Option<Pos2>, to: Pos2) -> bool. Whether a pointer move from from to to in viewport, with no button held, needs a pass, judged on the last finished pass: when the pointer comes in, a drag runs, either point lies in a rect that follows the pointer, or the layer, egui's widgets or the component shapes under the two points differ.
  • craft_ui::runtime::pointer::press_state: pub fn press_state(ctx: &Context) -> PressState. The press state of the running pass.
  • craft_ui::runtime::pointer::pressed_part: pub fn pressed_part(ctx: &Context, owner: Id) -> Option<PartRef>. The part of owner holding a press in this viewport, in the pass that ends the press and in none after it.
  • craft_ui::runtime::pointer::shapes_at: pub fn shapes_at(ctx: &Context, at: Pos2) -> Vec<(Id, Option<PartRef>)>. Every shape of the last pass on the topmost layer at at (screen points) whose area contains it, as (owner, part), sensing or not, in no particular order; empty where no layer is.
  • craft_ui::runtime::pointer::withhold_members: pub fn withhold_members(ctx: &Context, root: Id, withheld: bool). Whether the arena of root resolves the presses and hover of the next pass without its members' shapes.

craft_ui::runtime::requests

What a control asks of its host and what the host answers: the colour picker, the file dialog and the eyedropper.

  • craft_ui::runtime::requests::ColorRequest: pub struct ColorRequest { pub key: String, pub title: Option<Label>, pub color: Option<Srgba>, pub on_swatches: bool }. A request for a colour: the host opens its colour picker with title and color and writes the answer into key as a FieldValue::Color.
    • pub fn new(key: impl Into<String>, color: impl Into<Option<Srgba>>) -> Self. A request for key, opening the picker at color, or with no colour for None.
    • pub fn on_swatches(mut self) -> Self. Opens the picker on its swatches view, in place of the view it showed last.
    • pub fn title(mut self, title: impl Into<Label>) -> Self. The picker's title.
  • craft_ui::runtime::requests::EyedropperRequest: pub struct EyedropperRequest { pub key: String }. An eyedropper toggle of a colour row after a press: the host answers it with the colour the sampler picked for the colour parameter key (HostRequests::answer_eyedropper), written into key as a FieldValue::Color.
    • pub fn new(key: impl Into<String>) -> Self. A request for the dropper of key.
  • craft_ui::runtime::requests::HostAnswer: pub enum HostAnswer { Color { key: String, color: Srgba }, Path { key: String, path: PathBuf }, Eyedropper { key: String, color: Srgba }, Listing { key: String, files: Vec<PathBuf> } }. What the host answered to a request, kept until the dialog applies it to its values in its next pass.
  • craft_ui::runtime::requests::IMAGE_EXTENSIONS: pub const IMAGE_EXTENSIONS: [&str; 6]. The image file extensions a file dialog offers for pictures, without the dot, in lower case.
  • craft_ui::runtime::requests::ListingRequest: pub struct ListingRequest { pub key: String, pub folder: PathBuf }. A request for the files of a folder, which the host lists and answers with HostAnswer::Listing.
    • pub fn new(key: impl Into<String>, folder: impl Into<PathBuf>) -> Self. A request for the files of folder, answered under key.
  • craft_ui::runtime::requests::PathFilter: pub struct PathFilter { pub name: String, pub extensions: Vec<String> }. One entry of a file dialog's type filter.
    • pub fn new(name: impl Into<String>, extensions: &[&str]) -> Self. A filter named name for extensions.
  • craft_ui::runtime::requests::PathKind: pub enum PathKind { Folder, OpenFile { extensions: Vec<String> }, SaveFile }. What a text row's Browse button picks.
    • pub fn open_file(extensions: &[&str]) -> Self. An existing file of one of extensions.
  • craft_ui::runtime::requests::PathRequest: pub struct PathRequest { pub key: String, pub kind: PathKind, pub file_name: Option<String>, pub filters: Vec<PathFilter> }. A pressed Browse button: the host opens its file dialog for kind and writes the answer into key as a FieldValue::Text.
    • pub fn new(key: impl Into<String>, kind: PathKind) -> Self. A request for the path of key.
    • pub fn save(key: impl Into<String>, file_name: impl Into<String>, filters: impl IntoIterator<Item = PathFilter>) -> Self. A request for a file to write under key, suggesting file_name and offering filters.

craft_ui::runtime::sampler

The canvas reach under a modal layer (15.5, 8.3): the one exception to "a modal blocks the input below it".

  • craft_ui::runtime::sampler::CanvasGesture: pub struct CanvasGesture { pub button: PointerButton, pub mods: Mods }. A gesture on the canvas that a dialog takes under its modal layer: a press of button with at least mods held, and the drag that follows it.
    • pub const PRIMARY: CanvasGesture. A press of the primary button, with any modifiers: an eyedropper, a shadow or pattern drag.
    • pub const fn press(button: PointerButton) -> CanvasGesture. A press of button, with any modifiers.
    • pub const fn with(mut self, mods: Mods) -> CanvasGesture. The same gesture, needing mods held at the press.
  • craft_ui::runtime::sampler::pass_tool_gesture: pub fn pass_tool_gesture(ctx: &Context, canvas: Id, gesture: CanvasGesture). The canvas host's entry (ToolHost): passes gesture on canvas, the canvas whose tool the host runs.

craft_ui::runtime::toast

The toast queues: one per window (WindowKey), filled from any code with a Context.

  • craft_ui::runtime::toast::Card: pub struct Card { pub id: ToastId, pub toast: Toast }. A toast in the queue, as the host reads it.
  • craft_ui::runtime::toast::MAX_CARDS: pub const MAX_CARDS: usize. Most cards queued at once per window.
  • craft_ui::runtime::toast::TIMEOUT: pub const TIMEOUT: f32. How long a toast stays when it names no timeout, in seconds: the source apps' notification duration.
  • craft_ui::runtime::toast::Toast: pub struct Toast { pub message: Label, pub timeout: Option<f32>, pub politeness: Politeness, pub tone: Tone, pub title: Option<Label>, pub lines: Vec<Label>, pub actions: Vec<ToastAction>, pub progress: Option<f32> }. A message the user sees for a while.
    • pub fn new(message: impl Into<Label>) -> Self. A neutral toast of message that stays [TIMEOUT] seconds and is announced politely.
    • pub fn tone(mut self, tone: Tone) -> Self. Sets the tone the card reads in.
    • pub fn title(mut self, title: impl Into<Label>) -> Self. Sets the title above the message.
    • pub fn lines<L: Into<Label>>(mut self, lines: impl IntoIterator<Item = L>) -> Self. Sets the bullet lines under the message.
    • pub fn action(mut self, action: ToastAction) -> Self. Adds an action after the message.
    • pub fn timeout(mut self, timeout: Option<f32>) -> Self. Sets how long the card stays.
    • pub fn politeness(mut self, politeness: Politeness) -> Self. Sets the announcement's politeness.
    • pub fn progress(mut self, fraction: f32) -> Self. Sets the fraction done, clamped to 0..=1; the card then has no timer.
  • craft_ui::runtime::toast::ToastAction: pub struct ToastAction { pub label: Label }. An action of a toast card: a button-like link that ends the toast and is reported by end.
    • pub fn new(label: impl Into<Label>) -> Self. An action named label.
  • craft_ui::runtime::toast::ToastEnd: pub enum ToastEnd { Action(usize), Dismissed, Expired, Dropped }. How a toast left the queue.
  • craft_ui::runtime::toast::ToastId: pub struct ToastId. A posted toast's handle.
    • pub fn value(self) -> u64. The handle as a number, unique among the toasts of one queue: what a host reports to automation.
  • craft_ui::runtime::toast::cards: pub fn cards(ctx: &Context, window: &WindowKey) -> Vec<Card>. The cards of the window window in the running viewport, oldest first.
  • craft_ui::runtime::toast::dismiss: pub fn dismiss(ctx: &Context, id: ToastId). Removes a toast before its timer ends, from whichever viewport holds it.
  • craft_ui::runtime::toast::end: pub fn end(ctx: &Context, id: ToastId) -> Option<ToastEnd>. How the toast id ended, once: Dropped for a card the cap removed; None while it is queued, after the report was read, and for a toast the app removed with dismiss.
  • craft_ui::runtime::toast::keep: pub fn keep(ctx: &Context, id: ToastId). Keeps the toast id until it is closed, whatever its timeout (an error the user must read).
  • craft_ui::runtime::toast::post: pub fn post(ctx: &Context, window: &WindowKey, toast: Toast) -> ToastId. Posts toast to the window window of the running viewport.
  • craft_ui::runtime::toast::post_to: pub fn post_to(ctx: &Context, viewport: ViewportId, window: &WindowKey, toast: Toast) -> ToastId. Posts toast to the window window of viewport.
  • craft_ui::runtime::toast::set_progress: pub fn set_progress(ctx: &Context, id: ToastId, fraction: f32, message: Option<Label>). Sets the fraction done of the toast id and, when given, its message, in whichever viewport holds it; the card keeps no timer from then on.
  • craft_ui::runtime::toast::shown: pub fn shown(ctx: &Context, id: ToastId, text: &str, held: bool). The host shows id in this pass; held says the pointer or focus is on it.
  • craft_ui::runtime::toast::snapshot: pub fn snapshot(ctx: &Context) -> Vec<(WindowKey, Card)>. Every live viewport's cards with their windows, oldest first, for ui.inspect; cards is the running viewport's.

craft_ui::runtime::wheel

The wheel service (8.6): takers register their view rects, the begin hook splits the pass's wheel input among them from last pass's registrations, and each taker reads its share once.

  • craft_ui::runtime::wheel::ClaimToken: pub struct ClaimToken(/* private fields */). A small Copy token that identifies a claimable wheel share and never repeats in the process.
  • craft_ui::runtime::wheel::claim_token: pub fn claim_token(ctx: &Context, id: Id) -> Option<ClaimToken>. Returns the token for the share id can claim in the running pass, including after it reads the share.
  • craft_ui::runtime::wheel::claim: pub fn claim(ctx: &Context, id: Id, token: ClaimToken, spent: Vec2) -> bool. Claims for id this pass's share of the wheel gesture it owns, and records spent, the part of the claimed motion it used up, in its own unit, returning whether the claim succeeded. The token must match the share being claimed, including when a viewport is recreated with the same ID and pass counter.
  • craft_ui::canvas::CanvasSpace::with_wheel: pub fn with_wheel(mut self, wheel: Option<craft_behavior::Wheel>) -> Self. Sets the wheel share without a claim token. CanvasSpace::claim_wheel refuses a snapshot from another share.
  • craft_ui::runtime::wheel::claimed: pub fn claimed(ctx: &Context, id: Id) -> bool. Returns whether id claimed the running gesture or has an unread cancellation from a claim, and consumes that cancellation.
  • craft_ui::runtime::wheel::mark_modal: pub fn mark_modal(ctx: &Context, id: Id). Marks the wheel gesture id owns or received a share of in this pass as begun or gone on under a modal: an app's own modal window that the wheel service does not see as a modal layer.

craft_ui::runtime::windows

WindowHost: the one multi-window driver.

  • craft_ui::runtime::windows::CaptionRegions: pub struct CaptionRegions { pub buttons: Vec<(Button, Rect)>, pub edges: Vec<(ResizeEdge, Rect)>, pub moves: Vec<Rect>, pub covers: Vec<Vec<Rect>> }. Where the exclusive parts of one window lie, in points of its viewport: the window procedure answers a Windows hit test from them.
    • pub fn hit(&self, point: Pos2) -> Option<WindowHit>. What lies at point: a button wins over an edge, and an edge over a drag area.
  • craft_ui::runtime::windows::HitSink: pub struct HitSink. The Windows hit test of one window: the window procedure asks [HitSink::answer] where the OS asks for a hit test, and the answer comes from the exclusive parts the window's last pass declared, so the caption buttons, edges and drag areas the app draws are the ones the OS acts on (snap layouts, native move and resize).
    • pub fn answer(&self, pixel: Pos2) -> Option<WindowHit>. What lies at pixel, in physical pixels from the top left of the window's client area: the hit test's screen point after ScreenToClient. None where no exclusive part lies there: the window procedure leaves the hit test to the window's content.
  • craft_ui::runtime::windows::InjectedPointer: re-export of craft_ui::runtime::egui::injected::InjectedPointer.
  • craft_ui::runtime::windows::KeyEquivalent: pub enum KeyEquivalent { Press(Chord), Tap(Chord), Copy, Cut }. A key equivalent the platform's menu took from the window.
  • craft_ui::runtime::windows::Released: re-export of craft_ui::runtime::egui::injected::Released.
  • craft_ui::runtime::windows::ResizeEdge: pub enum ResizeEdge { Top, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, BottomRight }. An edge or corner a window resize starts from.
  • craft_ui::runtime::windows::ScreenshotError: re-export of craft_ui::runtime::egui::screenshot::ScreenshotError.
  • craft_ui::runtime::windows::ScreenshotFacts: re-export of craft_ui::runtime::egui::screenshot::ScreenshotFacts.
  • craft_ui::runtime::windows::ScreenshotSlot: re-export of craft_ui::runtime::egui::screenshot::ScreenshotSlot.
  • craft_ui::runtime::windows::WindowAction: pub enum WindowAction { Close, Minimize, ToggleMaximize, ToggleFullscreen, SetFullscreen(bool), SetMaximized(bool), Focus, Raise, StartMove, StartResize(ResizeEdge), SetOuterPosition(Pos2), SetInnerSize(Vec2), Restore, SetMinInnerSize(Vec2), SetLevel(WindowLevel), SetTitle(String), SetOpacity(f32) }. A window command act sends.
  • craft_ui::runtime::windows::WindowFacts: pub struct WindowFacts { pub inner: Rect, pub outer: Option<Rect>, pub scale: Option<f32>, pub state: WindowState, pub focused: bool }. What the OS tells about a window, in desktop points.
  • craft_ui::runtime::windows::WindowHit: pub enum WindowHit { Move, Resize(ResizeEdge), Caption(Button) }. What a part of the window does for the operating system: a press on it moves the window, resizes it from an edge, or is a caption button.
  • craft_ui::runtime::windows::WindowHost: pub struct WindowHost. The multi-window driver of one context.
    • pub fn of(ctx: &Context) -> Self. The window host of ctx.
    • pub fn current(&self) -> ViewportId. The viewport the running pass is for.
    • pub fn shell(&self) -> ShellInfo. The shell as the running viewport sees it.
    • pub fn viewports_available(&self) -> bool. Whether OS viewports can open: the capability is on and the integration does not embed them.
    • pub fn opens_windows(&self) -> bool. Whether a viewport mount opened in the running viewport's pass shows in an OS window of its own, and not in its fallback layer: OS viewports are available and the running window is neither full screen nor, on Wayland, maximized.
    • pub fn positions_reported(&self) -> bool. Whether the platform reports where windows are on the desktop and moves them there; false on Wayland.
    • pub fn visible(&self) -> bool. Whether the running viewport's window is drawn; a minimized or covered window runs no UI pass, so this reads false only from the app's logic.
    • pub fn is_open(&self, viewport: ViewportId) -> bool. Whether viewport's window is open this pass, measured or not.
    • pub fn screenshot_facts(&self, viewport: ViewportId) -> Option<ScreenshotFacts>. What a screenshot of viewport measures this pass; None when the viewport is not running.
    • pub fn inject_move(&self, viewport: ViewportId, at: Pos2, mods: Mods, rest: f64). Queues a pointer move to at in viewport with mods held, delivered on a pass of its own; the modifiers stay held after it, and a button held by earlier injected input stays down, so the move drags.
    • pub fn inject_click(&self, viewport: ViewportId, at: Pos2, button: PointerButton, count: u32, mods: Mods, hold: bool). Queues a move to at, then count presses and releases of button with mods held, one pass each.
    • pub fn inject_key(&self, viewport: ViewportId, key: Key, mods: Mods, hold: bool). Queues key pressed with mods held, as the platform reports them, and released unless hold.
    • pub fn inject_wheel(&self, viewport: ViewportId, at: Pos2, delta: Vec2, unit: egui::MouseWheelUnit, mods: Mods). Queues a move to at, then a wheel turn of delta in unit with mods held.
    • pub fn keep_access_trees(&self). Turns AccessKit on, idempotent and off by default; from then the settled tree of every finished pass is kept per viewport (access_tree).
    • pub fn access_tree(&self, viewport: ViewportId) -> Option<std::sync::Arc<crate::runtime::egui::access::AccessTree>>. The access tree of viewport's latest settled pass, a host fact of the window as its screenshot facts are; None while AccessKit is off or before the viewport has run.
    • pub fn inject_release(&self, viewport: ViewportId, at: Option<Pos2>, released: Released). Queues the release of what released names, at at or where the injected pointer is.
    • pub fn inject_pointer(&self, viewport: ViewportId, step: InjectedPointer). Queues one pointer step in viewport as a device would send it, one pass per event, with the pen's reading for a pen: its pass reads the reading in place of the tablet's.
    • pub fn inject_hold(&self, viewport: ViewportId, key: Key). Queues key held down in viewport with no key event, on a pass of its own: no shortcut or key stage sees it, only [injected_holds], until [inject_let_go].
    • pub fn inject_let_go(&self, viewport: ViewportId, key: Key). Queues the release of a key [inject_hold] holds, on a pass of its own.
    • pub fn injected_holds(&self, viewport: ViewportId) -> Vec<Key>. The keys [inject_hold] holds in viewport, as of its running pass.
    • pub fn set_caps_lock(&self, on: Option<bool>). Holds Caps Lock on or off in place of the platform's state; None returns to the platform's.
    • pub fn injected_caps_lock(&self) -> Option<bool>. The Caps Lock state injected input holds, when it holds one.
    • pub fn injected_pass(&self) -> bool. Whether the running pass's input carries injected input: what it triggers acts for an automation client.
    • pub fn key_equivalent(&self, viewport: ViewportId, equivalent: KeyEquivalent). Adds equivalent to the next input of viewport: a key equivalent the platform's menu took from the window reaches the application as the key press the user made.
    • pub fn menu_open(&self, viewport: ViewportId, open: bool). Records whether the platform's menu of viewport is open.
    • pub fn take_menu_close(&self, viewport: ViewportId) -> bool. True once after a press or Escape reached viewport's input: the platform's menu is to close.
    • pub fn inject_text(&self, viewport: ViewportId, text: &str). Queues text as typed text.
    • pub fn inject_ime(&self, viewport: ViewportId, event: egui::ImeEvent). Queues event as the platform's input method would deliver it (a preedit or a commit), behind earlier injected input.
    • pub fn inject_files(&self, viewport: ViewportId, at: Option<Pos2>, paths: Vec<std::path::PathBuf>, drop: bool). Hovers the files over at and, with drop, drops them in the following injected step, through the same hovered and dropped file input a window's drag session fills.
    • pub fn inject_access(&self, viewport: ViewportId, node: NodeKey, action: Declared). Queues one AccessKit action request (click, focus or context menu) on node as one injected step behind earlier injected input.
    • pub fn keep_access_tree(&self). Turns AccessKit output on, so [access_tree] and [access_tree_view] have each viewport's settled tree from then on.
    • pub fn access_tree_view(&self, viewport: ViewportId) -> Option<AccessTree>. [access_tree] as a tree to walk: None before the viewport's first pass or while AccessKit is off ([keep_access_tree] turns it on).
    • pub fn set_root_frame(&self, decision: Decision) -> bool. Changes the open root window's frame to decision's and returns true: the window gets the commands policy::reframe gives, and [frame], [desktop] and the root shell's chrome follow at once.
    • pub fn withdraw_injected(&self, viewport: ViewportId). Withdraws the injected input of viewport (the document changed) at its next input hook: a step whose pass has not run and the queue behind it; what is dropped counts as withdrawn ([take_injected_withdrawn]).
    • pub fn cancel_injected(&self) -> bool. Drops every injected queue and step in flight, and the keys [inject_hold] holds; true when anything was pending.
    • pub fn end_injection(&self). Ends the injection session: the automation connection that fed it is gone.
    • pub fn injected_idle(&self) -> bool. Whether no injected step is queued or awaits its pass: the application may answer its waiters.
    • pub fn injected_idle_at_pass_end(&self) -> bool. [injected_idle] asked at the end of a pass, after its UI ran: the step the running pass carried counts as run, unless egui runs the pass again.
    • pub fn take_injected_withdrawn(&self) -> bool. Whether an injected step was withdrawn since the last call.
    • pub fn repaint_in(&self, viewport: ViewportId, seconds: f64). Asks for one pass of viewport after seconds; a negative time means now, a non-finite one asks for nothing.
    • pub fn act(&self, viewport: ViewportId, action: WindowAction) -> bool. Sends action to viewport; see [act].
    • pub fn desktop_pointer(&self) -> Option<Pos2>. The system pointer in desktop points, as the platform tells it or, failing that, as the window a drag started in saw it.
    • pub fn main_window_handle(&self) -> Option<std::num::NonZeroIsize>. The main window's native handle (the Win32 HWND value, read through the safe HasWindowHandle API), None on other platforms and where no window is open.
    • pub fn warp_pointer(&self, to: Pos2) -> bool. Moves the system pointer to to in desktop points; false where the platform cannot.
    • pub fn facts(&self, viewport: ViewportId) -> Option<WindowFacts>. viewport's window facts, once it has reported its inner rect.
    • pub fn key_window(&self) -> ViewportId. The window that has the keys: the one the platform reports focused, else the main window.
    • pub fn typing(&self) -> bool. Whether a text field has the keys in [key_window], as its last pass ended: the focused stop types text, or egui focus is on a text edit the app drew itself.
    • pub fn monitors(&self) -> Vec<Monitor>. The connected monitors, in desktop pixels; none where the platform does not list them.
    • pub fn monitor_of(&self, viewport: ViewportId) -> Option<Monitor>. The monitor viewport's window lies on: the one its top-left corner is on, the rule its scale ([WindowFacts::scale]) falls back to. None before the window has reported its rect, or where the platform lists no monitor under the corner.
    • pub fn set_outer(&self, viewport: ViewportId, outer: Rect) -> bool. Places viewport's outer rect at outer: its position, and the inner size that leaves the window's decoration as it is.
    • pub fn viewport_of(&self, id: Id) -> Option<ViewportId>. The viewport of the container id while its window is open.
    • pub fn viewport_at(&self, at: Pos2) -> Option<ViewportId>. The window under the desktop point at: where windows overlap, the focused one, else the one focused last, else the smallest.
    • pub fn viewports_at(&self, at: Pos2) -> Vec<ViewportId>. The windows under the desktop point at, the topmost first (the order of [Self::viewport_at]).
    • pub fn frame(&self) -> Frame. Who draws the running viewport's frame, and the caption buttons it shows.
    • pub fn lights_room(&self) -> Option<Rect>. The room the macOS traffic lights take over the running viewport's content: leading wide at the end they sit at, twice their centre's distance from the top high. None for any other frame and in full screen, where the lights are not over the content.
    • pub fn desktop(&self) -> Option<Desktop>. The desktop the app's windows open on, as the installed frame decision detected it; None when the app installed no decision (an embedded shell, a trial).
    • pub fn caption_regions(&self, viewport: ViewportId) -> Option<CaptionRegions>. Where the exclusive parts of viewport's window lay in its last complete pass: the caption buttons, the edge zones and the drag areas. None while the window declared none.
    • pub fn install_hit_sink(&self, viewport: ViewportId) -> HitSink. The hit-test sink of viewport's window, made on the first call.
    • pub fn pointer_in(&self, viewport: ViewportId) -> Option<Pos2>. The desktop pointer in the coordinates of viewport, when it lies inside that window.
  • craft_ui::runtime::windows::WindowLevel: pub enum WindowLevel { Normal, Palette, AlwaysOnTop }. Where a window stands in the stack of windows.
  • craft_ui::runtime::windows::WindowSpec: pub struct WindowSpec { pub kind: WindowKind, pub chrome: Option<WindowChrome>, pub captions: Option<Captions>, pub level: WindowLevel, pub taskbar: bool, pub shown_after_first_paint: bool, pub takes_focus: bool, pub passes_pointer: bool, pub hands_on_cancel: bool }. How an OS window opens (21.2): what it is for, who draws its frame, where it stands and whether it has a taskbar entry.
    • pub fn tool() -> Self. A tool window (a native dock window): its own title row in place of the OS title bar (craft_window::policy::tool_frame), no caption buttons, a palette level, no taskbar entry.
    • pub fn popup() -> Self. A popup window: a layer opened from a palette window (a flyout, menu or tooltip) in an OS window of its own.
    • pub fn document() -> Self. A document window with the installed decision's frame.
    • pub fn dialog() -> Self. A dialog window with the installed decision's frame.
    • pub fn kind(mut self, kind: WindowKind) -> Self. Sets what the window is for.
    • pub fn chrome(mut self, chrome: WindowChrome) -> Self. Sets who draws the frame, whatever the installed decision says.
    • pub fn captions(mut self, captions: Option<Captions>) -> Self. Sets the caption buttons.
    • pub fn frame(mut self, frame: &Frame) -> Self. Takes the chrome and the captions from a decided frame; a frame without buttons has no captions.
    • pub fn level(mut self, level: WindowLevel) -> Self. Sets the level.
    • pub fn taskbar(mut self, taskbar: bool) -> Self. Sets whether the window has a taskbar or Dock entry.
    • pub fn takes_focus(mut self, takes_focus: bool) -> Self. Sets whether the window takes OS focus when it opens.
    • pub fn passes_pointer(mut self, passes_pointer: bool) -> Self. Sets whether pointer input passes through the window to the window below it (a tooltip's).
    • pub fn hands_on_cancel(mut self, hands_on_cancel: bool) -> Self. Sets whether an Escape nothing in the window takes is the Cancel of the window it was opened from.
  • craft_ui::runtime::windows::act: pub fn act(ctx: &Context, viewport: ViewportId, action: WindowAction) -> bool. Sends action to viewport.
  • craft_ui::runtime::windows::double_click_action: pub fn double_click_action(frame: &Frame, setting: DoubleClick, maximized: bool) -> Option<WindowAction>. What a double click on a window's free move band (its title bar, or the strip a modal leaves over it) asks of the window in frame: an integrated or macOS inset frame follows the system setting setting (zoom, the default, maximizes or restores; GNOME's setting comes from craft_window::desktop::double_click); a native frame is the OS's.

craft_ui::runtime::words

Word sets that more than one family reads.

  • craft_ui::runtime::words::CommonWords: re-export of craft_ui::runtime::words::common::CommonWords (defined outside these crates).
  • craft_ui::runtime::words::HeaderWords: re-export of craft_ui::runtime::words::header::HeaderWords (defined outside these crates).

craft_ui::style

The style layer: the state set and its resolver, style parts and ComponentStyle, tokens (UiTokens, StyleCx), the token-group cache and the style cache.

  • craft_ui::style::Accepted: pub struct Accepted { pub variant: Variant, pub fell_back: bool }. The variant a component takes for a requested one.
  • craft_ui::style::AutoScrollMarkLook: pub struct AutoScrollMarkLook { pub ring: StyleColor, pub fill: StyleColor, pub ink: StyleColor, pub ring_width: f32, pub diameter: f32 }. The auto-scroll mark's colours and sizes: a ring on the panel fill, a dot and two arrowheads in text ink.
  • craft_ui::style::BandFill: pub enum BandFill { Surface(SurfaceKind), Tone(Tone) }. What the band behind a header paints.
  • craft_ui::style::ComponentStyle: re-export of craft_ui_macros::ComponentStyle (outside these crates).
  • craft_ui::style::ControlMetrics: re-export of craft_behavior::sizing::ControlMetrics.
  • craft_ui::style::Corners: pub enum Corners { All, Top, Start, End, None }. Which corners of a surface are rounded. Start and End mirror under right-to-left.
    • pub fn apply(self, radius: CornerRadius, direction: Direction) -> CornerRadius. radius with the corners this value leaves square zeroed.
  • craft_ui::style::DataColor: pub struct DataColor(pub Color32). A colour from data (a swatch, a layer label dot).
    • pub const fn new(color: Color32) -> Self. A data colour.
  • craft_ui::style::DuplicateStyle: pub struct DuplicateStyle(pub &'static str). Two replacements named one style key.
  • craft_ui::style::EnvKey: pub struct EnvKey. The key of everything a style depends on besides its own key: tokens, direction, scale, the OS, the window's active state, the style-affecting app values and the language of the built-in words.
    • pub fn new(tokens: u64, direction: Direction, scale: Scale, os: Os, active: bool, values: u64) -> Self. The key of these inputs. tokens is UiTokens::key and values the hash of the style-affecting app values.
  • craft_ui::style::FieldLook: pub enum FieldLook { Normal, Quiet }. How a text field looks where it sits: one value picks its fill, its edge and its placeholder together, so they cannot come apart.
  • craft_ui::style::FlagMask: re-export of craft_theme::FlagMask (outside these crates).
  • craft_ui::style::Flags: re-export of craft_theme::Flags (outside these crates).
  • craft_ui::style::FocusLook: pub struct FocusLook { pub stroke: Stroke, pub offset: f32 }. A component's focus ring.
    • pub const fn new(stroke: Stroke, offset: f32) -> Self. A focus look.
  • craft_ui::style::GlyphRole: pub enum GlyphRole { Control, Tool, ToolRail, PanelRail, Compact }. How the icon-only buttons of a scope show their glyph, set by the container that holds them (ContainerProps::child_glyphs) or on one component (Props::glyphs).
  • craft_ui::style::HandleLook: pub struct HandleLook { pub side: f32, pub fill: Stateful<StyleColor>, pub stroke: StyleColor, pub stroke_width: f32 }. A canvas handle's fills and stroke.
  • craft_ui::style::IconLook: pub struct IconLook { pub side: f32, pub color: Stateful<StyleColor>, pub ground: Option<Stateful<StyleColor>> }. A component's icon.
    • pub fn new(side: f32, color: Stateful<StyleColor>) -> Self. An icon look.
    • pub fn on(mut self, ground: Stateful<StyleColor>) -> Self. Declares the fill the icon is painted on, for an icon that sits on a part's own fill.
  • craft_ui::style::Ink: pub enum Ink { OnPanel, OnDark, Accent }. The text and icon colour that reads on a surface, resolved at step 12.
  • craft_ui::style::Insets: re-export of craft_behavior::flow::Insets.
  • craft_ui::style::LetterCase: re-export of craft_theme::LetterCase (outside these crates).
  • craft_ui::style::MarkerLook: pub struct MarkerLook { pub radius: f32, pub large: f32, pub ring: StyleColor, pub selected: StyleColor, pub ring_width: f32, pub halo: StyleColor, pub halo_width: f32, pub backing: StyleColor }. A colour marker: the mark on a colour field, wheel, disc or gradient line that shows where a colour sits.
  • craft_ui::style::Metrics: re-export of craft_behavior::sizing::Metrics.
  • craft_ui::style::Mix: re-export of craft_theme::Mix (outside these crates).
  • craft_ui::style::ResetMarkLook: pub struct ResetMarkLook { pub color: StyleColor, pub ring: StyleColor, pub ring_width: f32, pub diameter: f32 }. The reset dot's colours and diameter.
  • craft_ui::style::ResizeLineLook: pub struct ResizeLineLook { pub line: Stateful<StyleColor>, pub edge: Stateful<StyleColor>, pub width: Stateful<f32>, pub focus: StyleColor, pub focus_width: f32 }. The line of a resize divider: a split handle between panes, a table column's edge.
  • craft_ui::style::Resolve: re-export of craft_theme::Resolve (outside these crates).
  • craft_ui::style::RuleKind: pub enum RuleKind { Divider, Edge, Grid, DropMark }. Which rule a look is for.
  • craft_ui::style::RuleLook: pub struct RuleLook { pub color: Color32, pub width: RuleWidth }. The line a rule draws.
  • craft_ui::style::RuleWidth: pub enum RuleWidth { Hairline, Points(f32) }. The width of a rule.
    • pub fn pixels(self, pixels_per_point: f32) -> f32. The width in whole physical pixels on a display of pixels_per_point.
    • pub fn points(self, pixels_per_point: f32) -> f32. The width in points on a display of pixels_per_point.
  • craft_ui::style::ScrollBarKind: pub enum ScrollBarKind { Floating, Docked }. Which of the two scroll bar looks a bar has.
  • craft_ui::style::ScrollBarLook: pub struct ScrollBarLook { pub track: Stateful<StyleColor>, pub thumb: Stateful<StyleColor>, pub thickness: f32, pub thumb_width: Stateful<f32>, pub min_thumb: f32 }. A scroll bar's track and thumb, of a [ScrollBarKind].
  • craft_ui::style::Span: pub struct Span<'a> { pub text: Cow<'a, str>, pub italic: bool, pub tabular: bool, pub mono: bool, pub muted: bool, pub shortcut: bool, pub highlight: bool, pub underline: bool, pub strikethrough: bool, pub strong: bool, pub link: bool, pub flag: Option<Tone> }. One styled stretch of a run.
    • pub fn new(text: impl Into<Cow<'a, str>>) -> Self. A plain span.
    • pub fn link(mut self) -> Self. Makes the span a link: it takes the run's link colour and the pointer.
    • pub fn flag(mut self, tone: Tone) -> Self. Underlines the span in the ink of tone (spelling Bad, grammar Info).
    • pub fn italic(mut self) -> Self. Italic.
    • pub fn tabular(mut self) -> Self. Tabular figures.
    • pub fn mono(mut self) -> Self. The monospace face.
    • pub fn muted(mut self) -> Self. The muted colour.
    • pub fn shortcut(mut self) -> Self. A shortcut hint.
    • pub fn highlight(mut self) -> Self. A match highlight.
    • pub fn underline(mut self) -> Self. Underlined: a link, or the mnemonic letter of a menu title.
    • pub fn strikethrough(mut self) -> Self. Struck through: text that stands for something removed or done.
    • pub fn strong(mut self) -> Self. The role's semibold face: a short mark that stands out among the row's other text, such as a layer's fx.
  • craft_ui::style::State: re-export of craft_theme::State (outside these crates).
  • craft_ui::style::StateMix: re-export of craft_theme::StateMix (outside these crates).
  • craft_ui::style::StateSet: pub struct StateSet { pub state: State, pub flags: Flags, pub t: StateMix }. The state of a component or one of its parts at step 12: the interaction state, the value flags and the animated blend. StateSet.flags is the only source of AccessKit states.
    • pub const fn new(state: State, flags: Flags, t: StateMix) -> Self. A state set.
    • pub fn is_disabled(&self) -> bool. The component is disabled.
    • pub fn resolve<T: Mix>(&self, look: &Stateful<T>) -> T. The value of look in this state.
  • craft_ui::style::Stateful: re-export of craft_theme::Stateful (outside these crates).
  • craft_ui::style::States: re-export of craft_theme::States (outside these crates).
  • craft_ui::style::StyleColor: pub struct StyleColor(pub Color32). A colour a style builder picked from tokens. Draw accepts only this or DataColor.
    • pub fn egui(self) -> Color32. The colour as egui paints it: a domain painter wraps it in DataColor::new for a document run, so it never holds a raw channel array.
  • craft_ui::style::StyleCx: pub struct StyleCx<'a> { pub tokens: &'a UiTokens, pub size: ControlSize, pub variant: Variant, pub direction: Direction, pub scale: Scale, pub os: Os, pub active: bool, pub key: EnvKey }. What fn style gets.
    • pub fn contrast(&self) -> Contrast. The contrast setting of the scope, for a style that adds a cue at high contrast.
    • pub fn density(&self) -> Size. The density preset of the scope, for a style whose shape differs between presets.
    • pub fn set(&self) -> craft_theme::ComponentSet. The component set of the scope, for a component that maps it to one of its named variants.
    • pub fn of_env(ctx: &'a Context, env: &'a crate::runtime::env::Env) -> Self. The style context of the scope env describes, in the secondary variant: for code outside a style function that works out a layout from a component's style or the scope's tokens.
    • pub fn with_root<R>(ctx: &Context, f: impl FnOnce(&StyleCx<'_>) -> R) -> R. Runs f with the style context of the root scope (Env::of_root(ctx)), for code with no Ui that reads a component's style, such as the dock's sizes outside a style pass.
    • pub fn with_root_scoped<R>(ctx: &Context, scope: &crate::runtime::env::ThemeScope, f: impl FnOnce(&StyleCx<'_>) -> R) -> R. Runs f with the root style at the tokens scope resolves, for code that has a context and no Ui.
    • pub fn link_look(&self, enabled: bool) -> super::look::TextLook. The one link look: body role, underlined, accent.text, text.disabled when not enabled.
    • pub fn exiting<P: Clone + Send + Sync + 'static>(&self, name: &'static str, spec: MotionSpec, listed: &[impl Hash]) -> Vec<(Presence, P)>. The keyed presences of name in the motion memory of the component this context is scoped to, for the keys not among listed (the keys its source lists now): each is still fading out, with the payload it was last given and the presence it has at this pass's clock, as Animate::exiting computes it.
    • pub fn env<T: StyleValue>(&self) -> T. An app value set by a scope.
    • pub fn color(&self, color: Rgba) -> StyleColor. The constructor of StyleColor for styles: a semantic token read or a token-group field becomes a style colour here.
    • pub fn ink_on(&self, fill: DataColor) -> StyleColor. The ink for text on a user colour: the higher-contrast of text.normal and text.on_strong on the fill, pushed to the contrast the text needs.
    • pub fn icon_ink_on(&self, fill: DataColor) -> StyleColor. The ink for icons and non-text on a user colour, pushed to the non-text contrast it needs.
    • pub fn ink_of(&self, color: DataColor, on: Rgba) -> StyleColor. The ink of a glyph or label in the data colour color on the surface on, pushed to the contrast the text needs: the inverse of [ink_on].
    • pub fn focus_look(&self) -> FocusLook. The one builder of the focus ring: the line's focus colour at the medium stroke, on the shape's edge.
    • pub fn tone(&self, tone: Tone) -> StyleColor. The colour text and icons of tone read in.
    • pub fn tone_fill(&self, tone: Tone) -> StyleColor. The tinted background text and icons of tone sit on: the status or accent background, and the sunken surface for no status.
    • pub fn tone_on_fill(&self, tone: Tone) -> StyleColor. The colour text and icons read in on [tone_fill]: accent.on_soft, the status foreground, and the normal text for no status.
    • pub fn host_ink(&self, base: Stateful<StyleColor>) -> Stateful<StyleColor>. A text or icon colour that is base when the component stands alone and the text colour of the host part when it is shown as that part's face, so a face reads on whatever fill the host draws under it.
    • pub fn host_muted_ink(&self, base: Stateful<StyleColor>) -> Stateful<StyleColor>. A muted text colour that is base when the component stands alone and the muted text colour of the host part when it is shown as that part's face and the host has one.
    • pub fn quiet_ink(&self) -> Stateful<StyleColor>. The ink of a glyph that acts on a click without a face of its own (a disclosure, a list row's toggle cell):
    • pub fn accent_fill(&self) -> Stateful<StyleColor>. The fill of an accent control that is on or filled: the strong accent at rest, with its hover and pressed shades, and the disabled fill when disabled.
    • pub fn track(&self) -> TrackLook. The look of a value track: a groove of size.groove with the part a value fills over it, in the scope's [TrackFill], and its marks.
    • pub fn ink(&self, ink: Ink) -> StyleColor. The colour text and icons on a surface read in.
    • pub fn control(&self) -> ControlMetrics. The height, icon side, padding, gap and field widths of a control at the ambient size.
    • pub fn glyph(&self) -> f32. The side of a mark inside a control at the ambient size (size.icon.glyph_sm, glyph_md): an icon-only button's glyph, a slider's thumb.
    • pub fn button_height(&self) -> f32. The height of a push button at the ambient size: size.button at the medium size, grown as a control's height is; a small button stands a small control high.
    • pub fn dialog_button_height(&self) -> f32. The height of a dialog's footer button at the ambient size: size.dialog.button_height at the medium size, grown as a control's height is; a small button stands a small control high.
    • pub fn menu_row_height(&self) -> f32. The height of a menu row at the ambient size: size.row.menu at the medium size, grown as a control's height is; a small row stands a small control high.
    • pub fn glyph_role(&self) -> GlyphRole. How the icon-only buttons of the scope show their glyph.
    • pub fn control_of(&self, size: ControlSize) -> ControlMetrics. control at size, whatever the ambient size: the part of a control that keeps its own size (a field's adornment button) reads its height here.
    • pub fn segment_control(&self) -> ControlMetrics. control, with the side padding of a segment of a segmented control: space.pad.control at the small size and space.pad.segment at the medium one.
    • pub fn text_width(&self, role: craft_theme::TypeRole, text: &str) -> f32. The width of text set in the face of role: the sizes that follow the text (a row header's digit) read it here instead of borrowing an icon or control size.
    • pub fn surface(&self, kind: SurfaceKind) -> SurfaceStyle. What a surface of kind draws.
    • pub fn text_well(&self) -> SurfaceLook. The look of a text well: the well surface with an edge that takes the focus colour while the well holds focus, in any modality, and the quieter divider colour while it is disabled.
    • pub fn field(&self) -> SurfaceLook. The look of a text or value field: the text well with the failure colour on its edge while its value is invalid.
    • pub fn quiet_field(&self) -> SurfaceLook. The look of a field that sits in a bar (a title bar's search box, FieldLook::Quiet): [field] filled with the window background (surface.background) at rest and with the field fill under the pointer and while it holds focus, and with the quieter line.border edge at rest.
    • pub fn dropdown(&self) -> SurfaceLook. The look of the closed box of a dropdown picker: the field, filled with the hover fill under the pointer and while its list is open.
    • pub fn rule(&self, kind: RuleKind) -> RuleLook. The line a rule of kind draws.
    • pub fn handle(&self) -> HandleLook. The look of a canvas handle.
    • pub fn marker(&self) -> MarkerLook. The look of a colour marker.
    • pub fn scroll_bar(&self) -> ScrollBarLook. The look of a scroll bar.
    • pub fn scroll_bar_of(&self, kind: ScrollBarKind) -> ScrollBarLook. The look of a scroll bar of kind.
    • pub fn state_layer(&self) -> Stateful<StyleColor>. The state layer: the theme's hover and press fills, clear at rest and while disabled.
    • pub fn auto_scroll_mark(&self) -> AutoScrollMarkLook. The look of the auto-scroll mark.
    • pub fn reset_mark(&self) -> ResetMarkLook. The look of the reset mark.
    • pub fn variant_look(&self) -> VariantParts. The look of the instance's variant as style parts.
    • pub fn token_group<G: TokenGroup>(&self) -> G. The token group G for this token set: derived from the tokens with the theme's values under G::PATH laid over it, built on the first read and cached by (TypeId::of::<G>(), UiTokens::key).
  • craft_ui::style::StyleKey: pub trait StyleKey: Copy + Eq + Hash + Send + Sync + 'static. A 'static key of the instance inputs a style depends on: unique per component type, so two components that share a Style type have separate cache entries.
  • craft_ui::style::StyleReplacements: pub struct StyleReplacements. The replacements an app asks for, collected before runtime::install freezes them.
    • pub const fn new() -> Self. No replacements.
    • pub fn push<K: StyleKey, S: ComponentStyle>(&mut self, f: Replacement<K, S>) -> &mut Self. Replaces the style function of the component whose style key is K.
  • craft_ui::style::SurfaceEdge: pub enum SurfaceEdge { None, Border(Stroke), Bevel { top_left: Color32, bottom_right: Color32, width: f32 } }. A surface's edge, resolved from the theme's edge style.
  • craft_ui::style::SurfaceKind: pub enum SurfaceKind { Background, Canvas, Chrome, Panel, Raised, Pressed, Sunken, Well, Knob, Popup, Dialog, Floating, Scrim, Frame, Brand }. The surface a container or part sits on, which picks fill, edge, shadow and ink.
    • pub const ALL: [SurfaceKind; 15]. Every kind, in the order the gallery shows them.
    • pub const fn ink(self) -> super::Ink. The ink text and icons read on this surface.
  • craft_ui::style::SurfaceLook: pub struct SurfaceLook { pub kind: Option<SurfaceKind>, pub kind_down: Option<SurfaceKind>, pub kind_on: Option<SurfaceKind>, pub fill: Stateful<StyleColor>, pub border: Option<Stateful<StyleColor>>, pub border_width: f32, pub inner: Option<Stateful<StyleColor>>, pub radius: CornerRadius, pub corners: Corners, pub border_replaces_edge: bool }. A component's or part's surface.
    • pub fn new(fill: Stateful<StyleColor>) -> Self. A look with fill and no kind, border or radius.
    • pub fn kind_in(&self, state: &super::StateSet) -> Option<SurfaceKind>. The surface kind in state: kind_down while pressed, kind_on while on, else kind.
    • pub fn kind(mut self, kind: SurfaceKind) -> Self. Sets the surface kind.
    • pub fn kind_down(mut self, kind: SurfaceKind) -> Self. Sets the kind used while pressed.
    • pub fn kind_on(mut self, kind: SurfaceKind) -> Self. Sets the kind used while on.
    • pub fn radius(mut self, radius: CornerRadius) -> Self. Sets the corner radius.
    • pub fn corners(mut self, corners: Corners) -> Self. Sets which corners are rounded.
    • pub fn border_replaces_edge(mut self) -> Self. The border replaces the kind's flat edge.
    • pub fn border(mut self, border: Stateful<StyleColor>, width: f32) -> Self. Sets the border colours and width.
  • craft_ui::style::SurfaceStyle: pub struct SurfaceStyle { pub fill: Color32, pub radius: CornerRadius, pub edge: SurfaceEdge, pub shadow: Option<Shadow> }. Everything a surface of one kind draws.
    • pub fn disabled(&self, panel: Color32, edge: Color32) -> SurfaceStyle. This look while disabled: opaque, the fill moved toward panel (the disabled fill) by Opacity::DISABLED, the edge edge, and no shadow.
  • craft_ui::style::SurroundLook: pub struct SurroundLook { pub fill: Color32, pub pattern: Option<Color32> }. How the surround around a canvas looks: its fill and the pattern drawn over it.
    • pub fn of(tokens: &UiTokens) -> Self. The surround of the theme tokens resolve from: the surface.canvas fill, and surface.canvas_pattern as the pattern where the theme sets one.
    • pub fn shown(self, pattern_on: bool) -> Self. The same look with the pattern kept when pattern_on, else dropped.
  • craft_ui::style::TextLook: pub struct TextLook { pub role: TypeRole, pub color: Stateful<StyleColor>, pub ground: Option<Stateful<StyleColor>> }. A component's text.
    • pub fn new(role: TypeRole, color: Stateful<StyleColor>) -> Self. A text look.
    • pub fn on(mut self, ground: Stateful<StyleColor>) -> Self. Declares the fill the text is painted on, for a text that sits on a part's own fill.
  • craft_ui::style::TokenGroup: re-export of craft_theme::TokenGroup (outside these crates).
  • craft_ui::style::Tokens: re-export of craft_theme::Tokens (outside these crates).
  • craft_ui::style::TrackFill: pub enum TrackFill { Muted, Accent }. How a value track (StyleCx::track) colours its groove and the part a value fills: a slider's and a range slider's.
  • craft_ui::style::TrackLook: pub struct TrackLook { pub unfilled: Stateful<StyleColor>, pub filled: Stateful<StyleColor>, pub edge: Stateful<StyleColor>, pub edge_width: f32, pub thickness: f32, pub ramp: f32, pub radius: CornerRadius, pub mark_length: f32, pub mark_width: f32, pub mark_color: Stateful<StyleColor>, pub snap: f32 }. A value track: a groove with the part a value fills over it, and the marks and ticks along it.
    • pub fn groove(&self, rect: egui::Rect) -> egui::Rect. The groove across the middle of rect.
  • craft_ui::style::TypeRole: re-export of craft_theme::TypeRole (outside these crates).
  • craft_ui::style::UiTokens: pub struct UiTokens. One resolved token set with the theme's token-group values and a key of their content.
    • pub fn new(tokens: Arc<Tokens>, contrast: Contrast, density: Size) -> Self. A token set resolved under contrast and density, with no theme values for token groups, drawing the default icon set.
    • pub fn of_theme(theme: &ThemeDef, appearance: Appearance, app: Option<&AppId>, sizes: &AppSizes) -> Self. The tokens theme resolves to under appearance and sizes, with the pins of app (None: no app's), drawing the icon pack the theme names.
    • pub fn tokens(&self) -> &Arc<Tokens>. The source tokens.
    • pub fn groups(&self) -> &GroupValues. The theme's token-group values.
    • pub fn key(&self) -> u64. Equal for equal sets and distinct for different ones; the token-group and style caches key on it.
  • craft_ui::style::Variant: re-export of craft_theme::Variant (outside these crates).
  • craft_ui::style::VariantParts: pub struct VariantParts { pub fill: Stateful<StyleColor>, pub text: Stateful<StyleColor>, pub muted: Stateful<StyleColor>, pub edge: Option<Stateful<StyleColor>>, pub radius: CornerRadius }. A variant's look as style parts.
  • craft_ui::style::accepted_variant: pub fn accepted_variant<K: StyleKey, S: ComponentStyle>(requested: Variant) -> Accepted. A component accepts its VARIANTS plus every custom variant built for its style key.
  • craft_ui::style::resize_line_look: pub fn resize_line_look(tokens: &UiTokens) -> ResizeLineLook. The resize divider's line, read from tokens.

craft_ui::testing

The fixture, the suite runner and the story helpers.

  • craft_ui::testing::Trial: pub struct Trial { pub module: &'static str, pub name: &'static str, pub run: fn(), pub ignored: bool }. One registered trial.
    • pub const fn new(module: &'static str, name: &'static str, run: fn()) -> Trial. A registration, as #[trial] writes it.
    • pub const fn ignored(module: &'static str, name: &'static str, run: fn()) -> Trial. The registration of an #[ignore]d trial, as #[trial] writes it.
    • pub fn full_name(&self) -> String. The name filters match: the module path below the crate, then the function.
  • craft_ui::testing::run: pub fn run(crate_root: &str, package: &'static str, registry: &Registry) ->!. Runs a test executable and exits: the #[trial]s declared in the crate whose root module is crate_root or in package's library crate, and the suite's trials over registered.
  • craft_ui::testing::Fixture: re-export of craft_ui::testing::fixture::Fixture.
  • craft_ui::testing::Frames: re-export of craft_ui::testing::frames::Frames.
  • craft_ui::testing::Impure: re-export of craft_ui::testing::fixture::Impure.
  • craft_ui::testing::MemoRun: re-export of craft_ui::runtime::measure::MemoRun (defined outside these crates).
  • craft_ui::testing::Registered: pub trait Registered. A component or pattern whose derive supplies its suite registration.
    • fn registration() -> Registration. The registration for this concrete type.
  • craft_ui::testing::Registry: pub struct Registry. The suite items selected by a caller.
    • pub fn of(crates: &[fn(&mut Registry)]) -> Self. Collects the items contributed by each selected crate.
    • pub fn add_registration(&mut self, registration: Registration). Adds a component or pattern registration.
    • pub fn add_story(&mut self, story: StoryRegistration). Adds a story.
    • pub fn add_trial(&mut self, trial: Trial). Adds a trial.
    • pub fn add_story_set(&mut self, set: SetEntry). Adds a command set used by stories.
    • pub fn registrations(&self) -> &[Registration]. The selected components and patterns.
    • pub fn stories(&self) -> &[StoryRegistration]. The selected stories.
    • pub fn trials(&self) -> &[Trial]. The selected trials.
    • pub fn install_story_sets(&self) -> bool. Selects story command sets for contexts created on the current thread.
    • pub fn story_sets(&self) -> &[SetEntry]. The selected story command sets.
  • craft_ui::testing::Room: re-export of craft_ui::testing::fixture::Room.
  • craft_ui::testing::Target: re-export of craft_ui::testing::fixture::Target.
  • craft_ui::testing::audit_replays: pub fn set(ctx: &Context, on: bool). Turns the audit on or off in ctx, in place of CRAFT_UI_AUDIT_REPLAY.
  • craft_ui::testing::document_face_budget: pub fn set_budget(ctx: &Context, bytes: usize). Sets the budget of ctx's document faces to bytes in place of [MAX_DOCUMENT_FACE_BYTES], so a trial reaches it with a few faces.
  • craft_ui::testing::forget_measurements: re-export of craft_ui::runtime::layout_memory::forget_kept.
  • craft_ui::testing::in_audit_run: pub fn in_run(ctx: &Context) -> bool. Whether the code running in ctx is a run of the audit: a test that counts its own runs of a view counts none in it, as the framework's counters do.
  • craft_ui::testing::install_spec: re-export of craft_ui::testing::windows::install_spec.
  • craft_ui::testing::is_measuring: re-export of craft_ui::runtime::measure::active (defined outside these crates).
  • craft_ui::testing::kept_measurement_leaves: re-export of craft_ui::runtime::layout_memory::kept_leaves.
  • craft_ui::testing::last_frame_derived_builds: re-export of craft_ui::runtime::measure::last_frame_derived_builds (defined outside these crates).
  • craft_ui::testing::last_frame_memo_runs: re-export of craft_ui::runtime::measure::last_frame_memo_runs (defined outside these crates).
  • craft_ui::testing::last_pass_access_builds: re-export of craft_ui::runtime::measure::last_pass_access_builds (defined outside these crates).
  • craft_ui::testing::last_pass_command_reads: re-export of craft_ui::runtime::measure::last_pass_command_reads (defined outside these crates).
  • craft_ui::testing::last_pass_derived_builds: re-export of craft_ui::runtime::measure::last_pass_derived_builds (defined outside these crates).
  • craft_ui::testing::last_pass_measure_asks: re-export of craft_ui::runtime::measure::last_pass_measure_asks (defined outside these crates).
  • craft_ui::testing::last_pass_measuring_runs: re-export of craft_ui::runtime::measure::last_pass_body_runs (defined outside these crates).
  • craft_ui::testing::last_pass_memo_key_bytes: re-export of craft_ui::runtime::measure::last_pass_memo_key_bytes (defined outside these crates).
  • craft_ui::testing::last_pass_memo_runs: re-export of craft_ui::runtime::measure::last_pass_memo_runs (defined outside these crates).
  • craft_ui::testing::last_pass_runs: re-export of craft_ui::runtime::measure::last_pass_runs (defined outside these crates).
  • craft_ui::testing::last_pass_text_layouts: re-export of craft_ui::runtime::measure::last_pass_text_layouts (defined outside these crates).
  • craft_ui::testing::last_pass_tip_texts: re-export of craft_ui::runtime::measure::last_pass_tip_texts (defined outside these crates).
  • craft_ui::testing::least_stage_width: pub fn least_stage_width(tokens: &Tokens) -> f32. The least width of a story's stage, which is also the least width of a column of a story grid.
  • craft_ui::testing::measured_contributions: re-export of craft_ui::runtime::measure::contributions (defined outside these crates).
  • craft_ui::testing::measuring_run: re-export of craft_ui::runtime::measure::run (defined outside these crates).
  • craft_ui::testing::measuring_runs: re-export of craft_ui::runtime::measure::body_runs (defined outside these crates).
  • craft_ui::testing::room_height: pub fn room_height(ui: &Ui) -> f32. The height of the room ui offers a story whose root has no content height and fills it (a window, a full-window canvas): the room its card's view gives, or the stage height where the room is unbounded.
  • craft_ui::testing::row_builds: re-export of craft_ui::runtime::measure::row_builds (defined outside these crates).
  • craft_ui::testing::row_measures: re-export of craft_ui::runtime::measure::row_measures (defined outside these crates).
  • craft_ui::testing::shrink_least_runs: re-export of craft_ui::runtime::measure::least_runs (defined outside these crates).
  • craft_ui::testing::stage: pub fn stage(ui: &mut Ui) -> Rect. Allocates the stage of a story of a canvas control or a root that fills both axes, and returns its rect: the width left in ui between the least and greatest stage width, and the stage height, all in control heights.
  • craft_ui::testing::stage_fitting: pub fn stage_fitting(ui: &mut Ui, height: impl FnOnce(f32) -> f32) -> Rect. Allocates a stage as wide as [stage]'s and as tall as the story's content at that width, which height gives, and returns its rect: the stage of a canvas whose document is only as tall as its content (a text being edited).
  • craft_ui::testing::stage_width: pub fn stage_width(ui: &Ui) -> f32. The width of the stage [stage_fitting] allocates: the width left in ui between the least and greatest stage width.
  • craft_ui::testing::story: re-export of craft_ui_macros::story (outside these crates).
  • craft_ui::testing::take_effects: re-export of craft_ui::runtime::measure::take_effects (defined outside these crates).
  • craft_ui::testing::trial: re-export of craft_ui_macros::trial (outside these crates).
  • craft_ui::testing::widest_runs: re-export of craft_ui::runtime::measure::widest_runs (defined outside these crates).

craft_ui::testing::access

What the accessibility trials read: the AccessKit tree a frame produced, and the label scope a container opens.

  • craft_ui::testing::access::begin_label_scope: pub fn begin_label_scope(ctx: &Context, container: Id, label: FieldLabel). Opens the label scope of container with label, as a field container's body step does; the container's report step closes it.
  • craft_ui::testing::access::focused_key: pub fn focused_key(tree: &AccessTree) -> NodeKey. The node AccessKit reports as focused.
  • craft_ui::testing::access::tree_of: pub fn tree_of(output: &mut crate::runtime::egui::fixture::FullOutput) -> AccessTree. The AccessKit tree a finished pass of a viewport produced, taken out of its output; empty when it made none.
  • craft_ui::testing::access::violations: pub fn violations(ctx: &Context, tree: &AccessTree) -> Vec<String>. The rule violations of a frame: interactive nodes with no name, and every finding the runtime's role rules reported on ctx.
  • craft_ui::testing::access::AccessTree: pub struct AccessTree. The AccessKit tree update of one frame.
    • pub fn has(&self, id: Id) -> bool. Whether the node of id exists.
    • pub fn role(&self, id: Id) -> Option<Role>. The role of the node of id.
    • pub fn name(&self, id: Id) -> Option<&str>. The name of the node of id.
    • pub fn description(&self, id: Id) -> Option<&str>. The description of the node of id.
    • pub fn description_of(&self, key: NodeKey) -> Option<&str>. The description of a node by key.
    • pub fn shortcut_of(&self, key: NodeKey) -> Option<&str>. The keyboard shortcut a node by key lists.
    • pub fn value_of(&self, key: NodeKey) -> Option<&str>. The text value of a node by key.
    • pub fn value(&self, id: Id) -> Option<&str>. The text value of the node of id.
    • pub fn numeric(&self, id: Id) -> Option<Numeric>. The numeric value and range of the node of id.
    • pub fn numeric_of(&self, key: NodeKey) -> Option<Numeric>. The numeric value and range of a node by key.
    • pub fn is_disabled(&self, id: Id) -> bool. Whether the node of id is reported as disabled.
    • pub fn declares(&self, id: Id, action: Declared) -> bool. Whether the node of id declares action.
    • pub fn labelled_by(&self, id: Id) -> Vec<NodeKey>. The nodes that name the node of id.
    • pub fn labelled_by_key(&self, key: NodeKey) -> Vec<NodeKey>. [AccessTree::labelled_by] for a node by key.
    • pub fn described_by(&self, id: Id) -> Vec<NodeKey>. The nodes that describe the node of id.
    • pub fn position(&self, id: Id) -> Option<(usize, usize)>. The place of the node of id in its set: its zero-based index and the size of the set.
    • pub fn grid_of(&self, key: NodeKey) -> GridPlace. The row and column indexes and counts of a node by key.
    • pub fn sort_of(&self, key: NodeKey) -> Option<bool>. The sort order a column header node by key shows: true descending.
    • pub fn declares_sort(&self, key: NodeKey) -> bool. Whether a column header node declares a sort direction: it sorts when activated, sorted now or not.
    • pub fn expanded(&self, id: Id) -> Option<bool>. The expanded state of the node of id.
    • pub fn has_popup(&self, id: Id) -> Option<PopupKind>. The kind of popup the node of id opens.
    • pub fn controls(&self, id: Id) -> Vec<NodeKey>. The nodes the node of id controls.
    • pub fn is_modal(&self, key: NodeKey) -> bool. Whether the node of key is modal.
    • pub fn live(&self, id: Id) -> Option<Politeness>. The live politeness of the node of id.
    • pub fn invalid(&self, id: Id) -> bool. Whether the node of id is marked invalid.
    • pub fn run_texts(&self, id: Id) -> Vec<String>. The text of each TextRun node below id, in order.
    • pub fn run_texts_of(&self, key: NodeKey) -> Vec<String>. The text of each TextRun node below the node key, in order: a text node's editable text, which its value may read with more (a number field's unit).
    • pub fn text_selection(&self, id: Id) -> Option<((NodeKey, usize),(NodeKey, usize))>. The selection of the text node id as the run node and character index of its anchor and focus.
    • pub fn name_of(&self, key: NodeKey) -> Option<&str>. The name of a node by key.
    • pub fn toggled_of(&self, key: NodeKey) -> Option<craft_behavior::Mixed<bool>>. The toggled state of a node by key.
    • pub fn expanded_of(&self, key: NodeKey) -> Option<bool>. The expanded state of a node by key.
    • pub fn has_popup_of(&self, key: NodeKey) -> Option<PopupKind>. The kind of popup the node of key opens.
    • pub fn access_key_of(&self, key: NodeKey) -> Option<char>. The access key of the node of key.
    • pub fn current_of(&self, key: NodeKey) -> bool. Whether the node of key is the current item of its set (the current page).
    • pub fn level_of(&self, key: NodeKey) -> Option<usize>. The level a node by key states: a heading's outline level, a list item's list level, a tree item's depth.
    • pub fn url_of(&self, key: NodeKey) -> Option<&str>. The address a link node by key goes to.
    • pub fn parent_of(&self, id: Id) -> Option<NodeKey>. The nearest ancestor of id that screen readers see: AccessKit's consumer drops generic containers.
    • pub fn parent_of_key(&self, key: NodeKey) -> Option<NodeKey>. [AccessTree::parent_of] for a node by key.
    • pub fn root_key(&self) -> Option<NodeKey>. The root node, when the frame made a tree: where reading order starts.
    • pub fn focused_key(&self) -> NodeKey. The node AccessKit reports as focused.
    • pub fn in_ltr_axis(&self, key: NodeKey) -> bool. Whether the node is, or lies inside, a component whose horizontal axis keeps its left-to-right order (Props::ltr_axis): it or an ancestor declares left-to-right text direction on a node that is not a text run, which only that declaration does.
    • pub fn keys(&self) -> Vec<NodeKey>. Every node that assistive technology reports.
    • pub fn node_count(&self) -> usize. The number of nodes that assistive technology reports.
    • pub fn role_of(&self, key: NodeKey) -> Option<Role>. The role of a node by key.
    • pub fn selected_of(&self, key: NodeKey) -> Option<bool>. Whether a node by key is reported as selected: None for a node that reports no selected state.
    • pub fn bounds_of(&self, key: NodeKey) -> Option<egui::Rect>. The bounds of a node by key, in points.
    • pub fn is_disabled_key(&self, key: NodeKey) -> bool. Whether a node by key is reported as disabled.
    • pub fn declares_key(&self, key: NodeKey, action: Declared) -> bool. Whether a node by key declares action.
    • pub fn children_of(&self, key: NodeKey) -> Vec<NodeKey>. The children of a node by key.
  • craft_ui::testing::access::Declared: pub enum Declared { Focus, Click, ContextMenu, Increment, Decrement, SetValue, SetTextSelection, Expand, Collapse, Custom, ScrollUp, ScrollDown, ScrollLeft, ScrollRight }. An action a node declares.
  • craft_ui::testing::access::NodeKey: pub struct NodeKey. A node's number in the tree.
    • pub fn raw(self) -> u64. The AccessKit node number.
    • pub fn from_raw(raw: u64) -> NodeKey. The key of the node with AccessKit number raw.
    • pub fn of(id: Id) -> NodeKey. The key of the node of id.
  • craft_ui::testing::access::is_interactive: pub fn is_interactive(tree: &AccessTree, key: NodeKey) -> bool. Whether the node declares an action a user can take: focus, click or a value change.
  • craft_ui::testing::access::layer_root: pub fn layer_root(id: Id) -> Id. The id of the root node of the overlay layer id.
  • craft_ui::testing::access::name: pub fn name(tree: &AccessTree, key: NodeKey) -> Option<&str>. The accessible name of the node, when it has a non-empty one: its own, else the first non-empty name of the nodes that label it (labelled_by).
  • craft_ui::testing::access::prune_controls: re-export of craft_ui::runtime::egui::access::prune_controls.

craft_ui::testing::bypass

Bypass detection (24.2): the pass-end walk that finds what a component made without the runtime.

  • craft_ui::testing::bypass::findings: pub fn findings(fixture: &Fixture) -> Vec<String>. What the latest frame's widgets and nodes show of code that bypassed the runtime; empty when nothing did.

craft_ui::testing::contract

What the contract trials read: the decision records and findings of the pipeline.

  • craft_ui::testing::contract::allocate: pub fn allocate(ui: &mut egui::Ui, size: egui::Vec2). Allocates a widget of size in ui.
  • craft_ui::testing::contract::canvas_controls: pub fn canvas_controls(ctx: &Context) -> Vec<&'static str>. The canvas-control types that have shown on ctx.
  • craft_ui::testing::contract::check_parts_declarations: pub fn check_parts_declarations(run: impl FnOnce()) -> Vec<&'static str>. Run a story with the parts declaration check enabled, and return any offending component types.
  • craft_ui::testing::contract::clicked: pub fn clicked(response: &egui::Response) -> bool. Whether response reports a click, by pointer or by keyboard activation.
  • craft_ui::testing::contract::edit_response: pub fn edit_response<T>(response: egui::Response) -> crate::contract::EditResponse<T>. An edit response with no events, for a trial component that has no cx.edit_response() to call.
  • craft_ui::testing::contract::findings: pub fn findings(ctx: &Context) -> Vec<Finding>. Every finding reported on ctx.
  • craft_ui::testing::contract::queue_reveal: pub fn queue_reveal(ctx: &Context, owner: Id, rect: egui::Rect). Queues a reveal of rect for the scroll owner owner, as a component that asked for it leaves it for the owner's next pass.
  • craft_ui::testing::contract::raw_widget: pub fn raw_widget(ui: &mut egui::Ui, rect: egui::Rect). Places a clickable egui widget in rect by hand, the way a bypass of the components does.
  • craft_ui::testing::contract::steps: pub fn steps(ctx: &Context, id: Id) -> Vec<&'static str>. The steps the latest inspected show of id ran, in order.
  • craft_ui::testing::contract::take_reveal: pub fn take_reveal(ctx: &Context, owner: Id) -> Option<egui::Rect>. The reveal request addressed to the scroll owner owner, once.

craft_ui::testing::dump

Text dumps for tests: ordered key = value lines compared exactly with a file, so a change in generated styles or tokens shows up as a reviewable diff.

  • craft_ui::testing::dump::BUDGET: pub const BUDGET: usize. The most lines the committed style dumps may hold in total.
  • craft_ui::testing::dump::Dump: pub struct Dump. Ordered key = value lines.
    • pub fn new() -> Self. An empty dump.
    • pub fn comment(&mut self, text: &str) -> &mut Self. A # text line, e.g. naming the test that writes the file.
    • pub fn line(&mut self, key: &str, value: impl DumpValue) -> &mut Self. Appends key = value, with key under the current [group] prefix.
    • pub fn group(&mut self, prefix: &str, f: impl FnOnce(&mut Dump)) -> &mut Self. Runs f with prefix. put before every key it writes.
    • pub fn text(&self) -> &str. The lines written so far.
    • pub fn entries(&self) -> impl Iterator<Item =(String, &str)>. The (key, value) pairs written so far, keys with their group prefixes; comments are skipped.
    • pub fn compare(&self, path: impl AsRef<Path>) -> Result<(), String>. Compares with the file at path, or rewrites it when [update_requested].
    • pub fn check(&self, path: impl AsRef<Path>). [compare], failing the test on a mismatch.
  • craft_ui::testing::dump::DumpValue: pub trait DumpValue. A value's text in a dump.
    • fn dump_value(&self) -> String. The value as dump text.
  • craft_ui::testing::dump::Entries: pub type Entries = Vec<(String, String)>. The (key, value) lines of one theme, collected to be written with the other themes' (see [Themed]).
  • craft_ui::testing::dump::Themed: pub struct Themed. Dump lines of one group in several themes, written as one line per key plus one per differing theme.
    • pub fn new() -> Self. No themes yet.
    • pub fn theme(&mut self, name: &str, entries: Entries) -> &mut Self. Adds the lines entries of theme name.
    • pub fn write(&self, dump: &mut Dump). Writes each key once, in first-seen order, with its most frequent value (the first of equals), then key@theme = value for each theme whose value differs or that lacks the key.
  • craft_ui::testing::dump::check_budget: pub fn check_budget(skip: &[&str]). Fails when the dumps outside skip hold more than [BUDGET] lines.
  • craft_ui::testing::dump::check_dir: pub fn check_dir(dir: impl AsRef<Path>, dumps: &[(String, Dump)]). Checks a directory one test owns: every (file name, dump) pair, and no other .txt files (with UPDATE_DUMPS=1 they are removed).
  • craft_ui::testing::dump::diff: pub fn diff(old: &str, new: &str) -> String. The lines only in old (- ) and only in new (+ ), at most 20.
  • craft_ui::testing::dump::dump_lines: pub fn dump_lines(skip: &[&str]) -> usize. The lines of every dump file under crates/*/tests/dumps except those of the crates in skip, comments left out.
  • craft_ui::testing::dump::dump_resolved: pub fn dump_resolved<T: std::fmt::Debug>(dump: &mut Dump, name: &str, resolve: impl Fn(&UiTokens) -> T). What resolve reads from the tokens of every theme of [themes], written into dump under name: each key once with its common value, plus the themes that differ.
  • craft_ui::testing::dump::dump_style: pub fn dump_style<K: StyleKey, S: ComponentStyle + std::fmt::Debug>(dump: &mut Dump, ctx: &egui::Context, name: &str, variants: &[Variant], size: ControlSize, key: K, default: for<'a> fn(&StyleCx<'a>, K) -> S,). The resolved style of the component whose style function is default, for each of variants and in every theme of [themes], written into dump under <name>.<variant>: each key once with its common value, plus the themes that differ.
  • craft_ui::testing::dump::flatten_debug: pub fn flatten_debug(value: &dyn std::fmt::Debug) -> Entries. The fields of a value as (path, text) pairs, read from its pretty Debug form: a struct field is its name, a tuple field or list item its index, joined by dots.
  • craft_ui::testing::dump::themes: pub fn themes() -> Vec<(String, UiTokens)>. Every built-in theme in each mode it has, at standard contrast, as (<theme>.<mode>, tokens).
  • craft_ui::testing::dump::update_requested: pub fn update_requested() -> bool. Whether UPDATE_DUMPS is set (to anything but 0).

craft_ui::testing::face_runs

FaceRuns: the story card of Draw::face_run, text drawn in a document's own face, each run on a baseline rule drawn under it.

  • craft_ui::testing::face_runs::FaceRuns: pub struct FaceRuns. Three runs in a document face, as an input method's composition is drawn in the text's own font: at its own size, with kana the face lacks drawn by the interface fonts, and a run asked at 4,000 points drawn at the atlas's cap.
    • pub fn new() -> Self. The card.
  • craft_ui::testing::face_runs::FaceRunsStyle: pub struct FaceRunsStyle. The look of the card: its ink and the baseline rule.

craft_ui::testing::fixture

Fixture: one story or closure shown over [Frames], with the env a test varies and input by AccessKit query or part.

  • craft_ui::testing::fixture::Fixture: pub struct Fixture. A closure or story shown frame by frame.
    • pub fn new(show: impl FnMut(&mut Ui) + 'static) -> Self. A fixture that shows show in a room of 400 by 300 points.
    • pub fn story(story: &Story) -> Self. A fixture that shows story; its data and outputs are read with [Fixture::data] and [Fixture::take_outputs].
    • pub fn story_scoped(story: &Story, scope: fn(&mut Overrides)) -> Self. A fixture that shows story inside an env scope scope changes: disabled, read-only, or both.
    • pub fn hosted(mut show: impl FnMut(&mut Ui) -> Option<StoryOutput> + 'static) -> Self. A fixture that shows a story through show, which hosts it and keeps its values: a viewer's story body in its shell. show returns the story's output in a pass that ran the story, which [Fixture::take_outputs] and [Fixture::root_id] then give as for [Fixture::story], and None in a pass that did not.
    • pub fn probe_purity(&mut self) -> &mut Self. Runs every following pass of the story under the purity probe: a measuring run of the story before each real pass, and a comparison of the story's values around each rerun pass. [Fixture::impure] reports what it sees.
    • pub fn impure(&self) -> Vec<Impure>. The impure passes the fixture has seen so far under [Fixture::probe_purity]; see [Impure].
    • pub fn root(&mut self, root: RootEnv) -> &mut Self. The root values of every following frame, whole: the env an app's settings restore.
    • pub fn commands(&mut self, commands: CommandInput) -> &mut Self. The command input of every following pass, whole, as an app's FrameInput.commands gives it: the states and gate a runner folds from the stories it shows ([Story::command_states]).
    • pub fn pixels_per_point(&mut self, pixels_per_point: f32) -> &mut Self. The pixels per point of every following frame.
    • pub fn record_paint(&mut self) -> &mut Self. Keeps what every following frame paints, for [Fixture::take_paint].
    • pub fn take_paint(&mut self) -> Option<fixture::FullOutput>. What the frames painted since the last call, as a renderer takes it: the latest frame's shapes and every texture change since. None unless [Fixture::record_paint] was called.
    • pub fn command_state(&mut self, command: impl Into<CommandRef>, state: CommandState) -> &mut Self. Gives app-scope command this state in every following pass, as an app's FrameInput.commands does; a later call for the same command replaces the earlier one.
    • pub fn gate(&mut self, gate: CommandGate) -> &mut Self. Sets the app's one gate over commands for every following pass, as an app's FrameInput.commands does.
    • pub fn overrides(&mut self, overrides: std::sync::Arc<craft_keymap::Overrides>) -> &mut Self. Sets the user's binding overrides for every following pass, as an app's FrameInput.commands does: the keymap is rebuilt when the Arc is another one.
    • pub fn room(&mut self, room: Vec2) -> &mut Self. The room the story is shown in.
    • pub fn in_room(&mut self, room: Room) -> &mut Self. The room of a host kind: the same as [Fixture::room] with that kind's size.
    • pub fn direction(&mut self, direction: Direction) -> &mut Self. The layout direction.
    • pub fn theme(&mut self, mode: Mode, contrast: Contrast) -> &mut Self. Light or dark, and standard or high contrast.
    • pub fn theme_id(&mut self, theme: ThemeId) -> &mut Self. The theme: one of the built-ins (craft.adwaita) or one a test registered.
    • pub fn motion(&mut self, motion: MotionMode) -> &mut Self. The motion mode.
    • pub fn text_size(&mut self, text_size: TextSize) -> &mut Self. The text-size step.
    • pub fn density(&mut self, density: Size) -> &mut Self. The density preset.
    • pub fn set(&mut self, set: craft_theme::ComponentSet) -> &mut Self. The component set.
    • pub fn scale(&mut self, scale: Scale) -> &mut Self. The interface scale.
    • pub fn root_value<T: crate::runtime::env::EnvValue>(&mut self, value: T) -> &mut Self. Sets the root app value of type T for every following frame, as an app's FrameInput.root.values does.
    • pub fn host(&mut self, host: std::sync::Arc<craft_host::Host>) -> &mut Self. The host every following frame is given: its language, catalogs and services.
    • pub fn os(&mut self, os: Os) -> &mut Self. The operating system the keys and chrome follow: the shell's OS and capabilities, and egui's own OS for its text editing.
    • pub fn chrome(&mut self, chrome: craft_host::target::WindowChrome) -> &mut Self. Who draws the root window's frame.
    • pub fn advance(&mut self, seconds: f64) -> &mut Self. The manual clock, moved on by seconds before the next frame.
    • pub fn ctx(&self) -> &egui::Context. The frames' context.
    • pub fn data(&self) -> std::cell::RefMut<'_, StoryData>. The story's data.
    • pub fn take_outputs(&mut self) -> Vec<StoryOutput>. The outputs the story gave since the last call, one per pass.
    • pub fn root_id(&self) -> Option<Id>. The component id of the latest shown output, kept when the outputs are taken.
    • pub fn drag_part(&self) -> Option<PartRef>. The first part of the shown component that senses a drag.
    • pub fn click_part(&self) -> Option<PartRef>. The first part of the shown component that senses a click: what a click activates when the component has parts of its own.
    • pub fn styles_of(&self, type_name: &str) -> Vec<std::sync::Arc<super::style::StyleSeen>>. The styles the pipeline resolved for the component type type_name in this fixture.
    • pub fn texts(&self) -> &[fixture::PaintedText]. The text runs the latest frame painted.
    • pub fn copied(&self) -> &[String]. The texts the latest frame put on the clipboard.
    • pub fn opened(&self) -> &[(String, bool)]. Every URL the fixture's frames asked to open, in order, each with whether it asked for a new tab.
    • pub fn shape_bounds(&self) -> &[Rect]. The visual bounds of the shapes the latest frame painted.
    • pub fn shape_overshoot(&self) -> &[f32]. Half the stroke width of the shape behind each of shape_bounds.
    • pub fn repaint_requested(&self) -> bool. Whether anything asked for another pass since the latest frame ended.
    • pub fn repaint_delay(&self) -> Option<std::time::Duration>. The wait the latest frame asked for before the next pass: Duration::ZERO for an immediate repaint, None when it asked for none.
    • pub fn cursor_icon(&self) -> egui::CursorIcon. The system cursor the latest frame's output asked for.
    • pub fn ime(&self) -> Option<&fixture::ImeSeen>. The IME output of the latest frame.
    • pub fn shown(&self) -> Rect. The area the latest pass allocated.
    • pub fn passes(&self) -> usize. The passes the latest frame ran.
    • pub fn frame(&mut self, events: Vec<Event>) -> &mut Self. One frame with events.
    • pub fn frame_held(&mut self, mut events: Vec<Event>) -> &mut Self. One frame whose pointer button events carry the modifiers held by the fixture.
    • pub fn frame_shapes(&mut self) -> Vec<egui::Shape>. One frame with no events; returns the shapes it painted, nested shapes flattened.
    • pub fn frame_clipped_shapes(&mut self) -> Vec<(Rect, egui::Shape)>. One frame with no events; returns the shapes it painted, nested shapes flattened, each with the clip it paints under.
    • pub fn frame_shapes_with(&mut self, events: Vec<Event>) -> Vec<egui::Shape>. One frame with events; returns the shapes it painted, nested shapes flattened.
    • pub fn idle(&mut self, n: usize) -> &mut Self. n frames with no events.
    • pub fn run_injected(&mut self) -> &mut Self. Frames with no events until every injected step has run its pass (WindowHost::injected_idle); injected input runs one step per pass.
    • pub fn settle(&mut self) -> &mut Self. Frames with no events until the latest one is stable, where an app stops painting: it ran one pass, asked for no repaint, and has the shown rect, root id and access node count of the frame before it.
    • pub fn tree(&self) -> &AccessTree. The AccessKit tree of the latest frame.
    • pub fn target(&self, node: NodeKey) -> Option<Target>. The node by key, with its bounds, when the latest tree has it.
    • pub fn by_label(&self, label: &str) -> Option<Target>. The node named label: the interactive node whose name resolves to it (its own, or the node that labels it through labelled_by) and that labels no other node, so a field's control comes before its caption link; else such a node that is disabled; else the first node that carries the text.
    • pub fn by_role(&self, role: Role) -> Vec<Target>. The nodes of role in tree order.
    • pub fn part(&self, component: Id, part: impl Into<PartRef>) -> Option<Target>. The sub-node of part below the component component.
    • pub fn part_rect(&self, owner: Id, part: impl Into<PartRef>) -> Option<Rect>. The rect of the part part of the component owner as the sensing step recorded it, for parts that have no access node (pointer-only ones).
    • pub fn visible(&self, target: &Target) -> Option<Target>. The piece of target that can be seen (target ∩ the clip of the arena the shown component is in), where a press on it lands; None when none of it is visible.
    • pub fn click(&mut self, target: &Target) -> &mut Self. Hover, press and release on target, in separate frames, then one idle frame.
    • pub fn click_at(&mut self, pos: Pos2) -> &mut Self. Hover, press and release at pos, in separate frames, then one idle frame.
    • pub fn hold(&mut self, modifiers: Modifiers) -> &mut Self. The modifiers held in every following frame, until the next call.
    • pub fn press(&mut self, target: &Target) -> &mut Self. Press on target.
    • pub fn release(&mut self, target: &Target) -> &mut Self. Release at the middle of target.
    • pub fn drag(&mut self, target: &Target, by: Vec2) -> &mut Self. Press on target, move by by in four steps, release.
    • pub fn drag_at(&mut self, from: Pos2, by: Vec2) -> &mut Self. A drag from the point from by by: the same frames as [Fixture::drag], for a point that is no target.
    • pub fn drag_hold_at(&mut self, from: Pos2, by: Vec2) -> &mut Self. The first half of a drag that pauses: press at from, move by by in four steps, and one frame with the pointer still, button held.
    • pub fn release_at(&mut self, at: Pos2) -> &mut Self. Releases the button at at, then a frame with no input.
    • pub fn drag_at_pausing(&mut self, from: Pos2, by: Vec2, halt: impl FnOnce(&mut Fixture)) -> &mut Self. A drag from from by by that pauses before the release: [Fixture::drag_hold_at], halt with the gesture running, then [Fixture::release_at].
    • pub fn key(&mut self, key: Key, modifiers: Modifiers) -> &mut Self. A key press and release with modifiers and the ones [Fixture::hold] keeps, as a keyboard reports them:
    • pub fn type_key(&mut self, key: Key, text: &str) -> &mut Self. A press of key that types text, as a keyboard sends it: the key and its text in one frame, then the release.
    • pub fn type_text(&mut self, text: &str) -> &mut Self. Typed text.
    • pub fn access(&mut self, kind: AccessActionKind, target: &Target) -> &mut Self. An AccessKit action on target.
    • pub fn focused_stop(&self) -> Option<(Id, Option<PartRef>)>. The stop that holds focus: the id of its component and the part when focus is on a part.
    • pub fn press_only_stops(&self) -> Vec<Rect>. Where the stops that only a press reaches sit (read-only text, selection parts), in stop order: the bounds of the egui widget that holds each one's focus.
    • pub fn focused_role(&self) -> Option<craft_behavior::KeyRole>. The key role of the stop that holds focus: which key rows it takes (type-ahead, rename, reorder).
    • pub fn focused(&self) -> Option<Id>. The id of the widget egui has focused.
    • pub fn frame_through(&mut self, events: Vec<Event>) -> &mut Self. events as one OS frame, followed by the frames an app runs for it: one for each step of input the one-press rule held back, then the frame egui repaints for after the last frame that carried input (a release the press machine reports a pass after its drag started lands there).
  • craft_ui::testing::fixture::Impure: pub struct Impure { pub pass: usize, pub measuring: bool, pub changed: Vec<&'static str>, pub effects: Vec<&'static str> }. A pass in which a story's drawing code changed state it must leave alone, as a fixture under [Fixture::probe_purity] sees it: in the measuring run the probe adds before each real pass, or in a rerun pass (the second and later pass of a frame), where nothing may change.
  • craft_ui::testing::fixture::Room: pub enum Room { Panel, Dialog, Window }. The room of a trial, named by the kind of host the component sits in.
    • pub fn size(self) -> Vec2. The room's size in points.
  • craft_ui::testing::fixture::Target: pub struct Target { pub node: NodeKey, pub rect: Rect }. A node of the AccessKit tree, as input addresses it.
    • pub fn center(&self) -> Pos2. The middle of the node's bounds.

craft_ui::testing::focus

The focus service's fixture: egui widgets for stops, the egui focus, and the events the key and press stages read.

  • craft_ui::testing::focus::access_request: pub fn access_request(kind: AccessActionKind, target: Id) -> Event. An AccessKit action request for the node numbered by target.
  • craft_ui::testing::focus::activated_member: pub fn activated_member(ctx: &Context, root: Id) -> Option<Id>. The member whose Activate the group root reads this pass.
  • craft_ui::testing::focus::active_part: pub fn active_part(ctx: &Context, id: Id) -> Option<PartRef>. The part of id that is the focus stop, when one is.
  • craft_ui::testing::focus::begin_body: pub fn begin_body(ctx: &Context). Marks the stops registered from here on in the innermost open scope as its body's.
  • craft_ui::testing::focus::claim: pub fn claim(ctx: &Context, owner: Id, chord: Chord). A state-dependent claim of owner.
  • craft_ui::testing::focus::commit_now: pub fn commit_now(ctx: &Context) -> Option<Id>. The text part that commits its draft in this pass because a press moved focus away from it.
  • craft_ui::testing::focus::context_request: pub fn context_request(ctx: &Context, id: Id) -> Option<Rect>. The rect id's context request of this pass opens at, when it made one.
  • craft_ui::testing::focus::egui_focused: pub fn egui_focused(ctx: &Context) -> Option<Id>. The widget egui holds key focus on.
  • craft_ui::testing::focus::end_body: pub fn end_body(ctx: &Context). Ends the body [begin_body] marked: the stops registered from here on in the innermost open scope are its end region's and footer's.
  • craft_ui::testing::focus::focus_visible: pub fn focus_visible(ctx: &Context, id: Id) -> bool. is_focused with focus visible.
  • craft_ui::testing::focus::intents_of: pub fn intents_of(ctx: &Context, id: Option<Id>, rtl: bool) -> Intents. The intents routed to id this pass, with horizontal moves read in the component's direction.
  • craft_ui::testing::focus::is_focused: pub fn is_focused(ctx: &Context, id: Id) -> bool. Whether the focus stop is the component id.
  • craft_ui::testing::focus::key_release: pub fn key_release(key: Key, modifiers: Modifiers) -> Event. A key release.
  • craft_ui::testing::focus::named_id: pub fn named_id(name: &str) -> Id. A globally unique id named by name.
  • craft_ui::testing::focus::pass_stop_groups: pub fn pass_stop_groups(ctx: &Context) -> Vec<(Id, Option<Id>)>. The stops the running pass registered so far, in order: each stop's component and the roving group it is in.
  • craft_ui::testing::focus::pop_scope: pub fn pop_scope(ctx: &Context). Closes the innermost open scope.
  • craft_ui::testing::focus::press_shape: pub fn press_shape(ui: &Ui, rect: Rect, sense: Sense, owner: Id). Registers a shape of owner at rect on the layer of ui that senses a press as sense says, as a component's sensing core does; the next pass's presses resolve over it.
  • craft_ui::testing::focus::primary_button: pub fn primary_button(pos: Pos2, pressed: bool) -> Event. A primary button press or release at pos.
  • craft_ui::testing::focus::push_scope: pub fn push_scope(ctx: &Context, id: Id, policy: FocusPolicy, label: Option<Arc<str>>). Opens the scope id for the stops registered until the matching [pop_scope].
  • craft_ui::testing::focus::register_doc: pub fn register_doc(ctx: &Context, key: DocKey, id: Id). Registers the component that FocusTarget::Doc(key) focuses.
  • craft_ui::testing::focus::register_group: pub fn register_group(ctx: &Context, group: Group). Registers a roving group of the running pass.
  • craft_ui::testing::focus::register_node: pub fn register_node(ctx: &Context, node: Id, owner: Id, part: Option<PartRef>, focusable: bool). Registers an AccessKit node so a request that targets it reaches owner.
  • craft_ui::testing::focus::register_stop: pub fn register_stop(ctx: &Context, stop: Stop). Registers stop in the innermost open scope of the running pass.
  • craft_ui::testing::focus::scope_escape: pub fn scope_escape(ctx: &Context, rule: CancelRule, press_captured: bool, scope_clearable: bool) -> Option<EscapeStep>. What an untaken Escape does in a scope.
  • craft_ui::testing::focus::set_value: pub fn set_value(target: Id, value: f64) -> Event. An AccessKit SetValue request of value for the node of target.
  • craft_ui::testing::focus::settle: pub fn settle(ctx: &Context, id: Option<Id>, intents: &Intents). Writes back what a component left untaken.
  • craft_ui::testing::focus::take_claimed: pub fn take_claimed(ctx: &Context, id: Id, chord: Chord) -> bool. Whether the claimed chord arrived this pass for id, consuming it.
  • craft_ui::testing::focus::take_reveal: pub fn take_reveal(ctx: &Context) -> Option<(Id, Option<PartRef>)>. The component the last focus request or Tab move asked the enclosing scroll owner to reveal.
  • craft_ui::testing::focus::take_submit: pub fn take_submit(ctx: &Context) -> bool. Takes an untaken Submit for the innermost scope with a default action.
  • craft_ui::testing::focus::widget: pub fn widget(ui: &mut Ui, id: Id) -> Rect. Shows a focusable egui widget of id, as a component root's sensing core does, and returns its rect.
  • craft_ui::testing::focus::AccessActionKind: pub enum AccessActionKind { Focus, Click, Increment, Decrement, SetValue(f64), Expand, Collapse, ScrollUp, ScrollDown, ScrollLeft, ScrollRight, ScrollIntoView }. The actions the focus trials request.
    • pub fn is(self, action: &craft_behavior::AccessRequest) -> bool. Whether action is this one.
  • craft_ui::testing::focus::Group: re-export of craft_ui::runtime::focus::registration::Group (defined outside these crates).
  • craft_ui::testing::focus::Intents: pub struct Intents. An owned copy of the intents routed to one id this pass; read through cx.intents().
    • pub fn take_digit(&mut self) -> Option<u8>. Takes the next typed digit.
    • pub fn take(&mut self, intent: Intent) -> bool. Takes an intent of the kind of intent, once per pass: the first taker gets it.
    • pub fn take_exact(&mut self, intent: &Intent) -> bool. Takes an intent equal to intent in every field, once per pass: Intent::delete(false, Granularity::Grapheme) takes Backspace and leaves Delete, which take would also take.
    • pub fn take_move(&mut self) -> Option<(NavMove, MoveMods)>. Takes the next move, whichever it is: for a component that acts on every move.
    • pub fn take_move_where(&mut self, wanted: impl Fn(NavMove, MoveMods) -> bool) -> Option<(NavMove, MoveMods)>. Takes the next move that wanted accepts; the others stay for a later taker, or for the scroll owner around a focused component when they scroll (9.2 rule 5).
    • pub fn take_scroll_access(&mut self, into_view: bool) -> Option<AccessRequest>. Takes the next AccessKit request that asks a scroll region to scroll, or with into_view to show its target.
    • pub fn take_edit(&mut self) -> Option<EditCommand>. Takes the next edit command.
    • pub fn take_text(&mut self) -> Option<Arc<str>>. Takes the next typed text.
    • pub fn take_nudge(&mut self) -> Option<(Vec2, Mods)>. Takes the physical arrow nudge for canvas content: a unit direction and the modifiers.
    • pub fn nudge_held(&self) -> &[Key]. The keys that were down when the arrow of the nudge not yet taken went down, the arrow not among them; empty without one.
    • pub fn take_chords(&mut self) -> Vec<Chord>. Takes the chords this pass's presses spell, for a component whose key use is KeyUse::RECORDER; empty for any other component.
    • pub fn take_set_value(&mut self) -> Option<f64>. Takes the AccessKit SetValue request aimed at the component's own node.
    • pub fn take_set_value_at(&mut self, part: impl Into<PartRef>) -> Option<f64>. Takes the AccessKit SetValue request aimed at the sub-node of part.
    • pub fn untaken(&self, intent: &Intent) -> bool. Whether an intent of the kind of intent is routed and not taken.
    • pub fn take_access(&mut self) -> Option<AccessRequest>. Takes the next Intent::Access request.
  • craft_ui::testing::focus::Stop: re-export of craft_ui::runtime::focus::registration::Stop (defined outside these crates).

craft_ui::testing::frames

A fixed-rate frame driver over a context.

  • craft_ui::testing::frames::Frames: pub struct Frames { pub ctx: Context }. One context, advanced frame by frame at 60 Hz.
    • pub fn screen(&mut self, room: Vec2). The size of the egui screen rect in every following frame: room where it is larger than the default 800 by 600, so a press anywhere in the room lands inside the window.
    • pub fn new() -> Self. A fresh context with the runtime installed.
    • pub fn pixels_per_point(&mut self, pixels_per_point: f32). The window's pixels per point in every following frame.
    • pub fn record_paint(&mut self). Keeps what every following frame paints, for [Frames::take_paint].
    • pub fn take_paint(&mut self) -> Option<fixture::FullOutput>. What the frames painted since the last call, as a renderer takes it: the last frame's shapes and every texture change since. None unless [Frames::record_paint] was called.
    • pub fn over(ctx: Context) -> Self. Frames on ctx, a context the caller made (an app's own, which its code reads outside the frames), with the runtime installed on it unless it already is, as an app installs it: without the stories' command sets.
    • pub fn uninstalled() -> Self. A fresh context without the runtime, for frames that ran before install.
    • pub fn install(&mut self). Installs the runtime on the context.
    • pub fn host(&mut self, host: Arc<Host>). The host every following frame is given.
    • pub fn root(&mut self, root: RootEnv). The root values every following frame is given.
    • pub fn latched(&mut self, mods: craft_keymap::Mods). The modifiers the app holds down for the user in every following frame.
    • pub fn commands(&mut self, commands: CommandInput). The command input every following frame is given.
    • pub fn frame(&mut self, events: Vec<Event>, ui: impl FnMut(&mut Ui)) -> usize. One frame with events; ui runs once per pass.
    • pub fn frame_in_viewport(&mut self, viewport: egui::ViewportId, events: Vec<Event>, mut ui: impl FnMut(&mut Ui)) -> usize. One frame of viewport, a child window of the root while the root stays live, with events; ui runs once per pass.
    • pub fn frame_closing(&mut self, events: Vec<Event>, ui: impl FnMut(&mut Ui)) -> bool. One frame with events, as [frame]; returns whether the frame sent a window a close command.
    • pub fn frame_without_input(&mut self, events: Vec<Event>, ui: impl FnMut(&mut Ui)) -> bool. One frame with no set_input, as an app that never calls it would drive it: the root values and the interface scale stay as they were.
    • pub fn frame_shapes(&mut self, mut ui: impl FnMut(&mut Ui)) -> Vec<egui::Shape>. One frame with no events; returns the shapes it painted, nested shapes flattened.
    • pub fn hold(&mut self, modifiers: egui::Modifiers). The modifiers held in every following frame.
    • pub fn hover_files(&mut self, names: &[&str]). Files named names are dragged over the window from the OS, in this frame and every following one until they drop or leave.
    • pub fn hover_typed_files(&mut self, files: &[(&str, &str)]). Like hover_files, with the media type the OS reports for each file while it hovers.
    • pub fn leave_files(&mut self). The hovering files leave the window without a drop.
    • pub fn drop_files(&mut self, names: &[&str]). The hovering files drop on the window in the next frame; names are what the OS reports as dropped.
    • pub fn read_dropped(&mut self, name: &str, bytes: &[u8]). The hovering files drop on the window in the next frame as a web page drops them, with neither path nor bytes:
    • pub fn drop_with_bytes(&mut self, name: &str, bytes: &[u8]). The hovering files drop on the window in the next frame as a browser on the desktop hands a file over: by the relative name name, which locates no file, with its bytes at hand.
    • pub fn still_clock(&mut self). Keeps the clock still: a frame no longer moves it on, so time passes only where a test calls [advance].
    • pub fn advance(&mut self, seconds: f64). Moves the clock on by seconds before the next frame.
    • pub fn close_viewport(&mut self, viewport: egui::ViewportId). Closes the child window viewport, as its user would: later frames no longer list it.
    • pub fn idle(&mut self, n: usize, mut ui: impl FnMut(&mut Ui)). n frames with no events.
    • pub fn ime(&self) -> Option<&fixture::ImeSeen>. The IME output of the last frame: None when it wrote none.
    • pub fn copied(&self) -> &[String]. The texts the last frame put on the clipboard.
    • pub fn opened(&self) -> &[(String, bool)]. Every URL the frames so far asked to open, in order, each with whether it asked for a new tab.
    • pub fn texts(&self) -> &[fixture::PaintedText]. The text runs the last frame painted.
    • pub fn shape_bounds(&self) -> &[egui::Rect]. The visual bounds of the shapes the last frame painted.
    • pub fn shape_overshoot(&self) -> &[f32]. Half the stroke width of the shape behind each of shape_bounds.
    • pub fn tree(&mut self) -> AccessTree. The AccessKit tree the last frame produced.
    • pub fn repaint_delay(&self) -> Option<Duration>. The wait the last frame asked for before the next pass: Duration::ZERO for an immediate repaint, None when it asked for none.
    • pub fn repaint_requested(&self) -> bool. Whether anything asked for a pass since the last frame ended.
    • pub fn cursor_icon(&self) -> egui::CursorIcon. The system cursor the last frame's output asked for.
    • pub fn cursor_image(&self) -> Option<&egui::CustomCursorImage>. The cursor image the last frame's output asked for, which the integration shows instead of the system cursor.
  • craft_ui::testing::frames::announce_text: pub fn announce_text(ctx: &Context, text: &str). Adds text to the next frame output's announcements, as the runtime's access service does.
  • craft_ui::testing::frames::show_area: pub fn show_area<R>(ctx: &Context, name: &'static str, body: impl FnOnce(&mut Ui) -> R) -> R. Shows an egui Area and runs body on its Ui.
  • craft_ui::testing::frames::widest_layer: pub fn widest_layer(ctx: &Context) -> f32. The width of the widest layer above the background, 0 when there is none.

craft_ui::testing::index

The components index: every registered component type, grouped by gallery level, with its module and the purpose its derive recorded from the doc comment, and every craft-behavior module with the first sentence of its module docs.

  • craft_ui::testing::index::components_index: pub fn components_index(root: &Path, registered: &[&Registration]) -> String. The text of docs/components-index.md for the workspace at root and the types of registered.
  • craft_ui::testing::index::types_without_purpose: pub fn types_without_purpose(registered: &[&Registration]) -> Vec<String>. The types of registered that have no purpose: their types lack a doc comment.

craft_ui::testing::input

Key events and the egui input options, for trials that drive frames themselves.

  • craft_ui::testing::input::allow_zoom_keys: pub fn allow_zoom_keys(ctx: &Context). Gives egui back the option the runtime turns off at install: Cmd with = or - zooms the interface.
  • craft_ui::testing::input::key_press: pub fn key_press(key: Key, modifiers: Modifiers) -> Event. A key press event with modifiers.
  • craft_ui::testing::input::key_reached: pub fn key_reached(ctx: &Context, key: Key) -> bool. Whether a press of key is still in this pass's input: no component claimed it.
  • craft_ui::testing::input::key_repeat: pub fn key_repeat(key: Key, modifiers: Modifiers) -> Event. The auto-repeat event of a held key.
  • craft_ui::testing::input::slop: pub fn slop(ctx: &Context) -> f32. How far a press may move and still be a click, in points: the framework's slop.
  • craft_ui::testing::input::text: pub fn text(text: &str) -> Event. An event of typed text.

craft_ui::testing::layout

The layout services the trials check: bodies, measured blocks, the label column, measure_slot and arrange, with placeholder children that take a given size.

  • craft_ui::testing::layout::Block: pub struct Block. A placeholder child of a fixed size: a leaf that measures size, senses nothing and paints nothing.
    • pub const fn new(size: Vec2) -> Self. A child that takes size.
    • pub fn counted(mut self, measures: &Arc<AtomicUsize>) -> Self. Counts each call of its measure in measures.
  • craft_ui::testing::layout::BlockStyle: pub struct BlockStyle. The style of a Block: no padding.
  • craft_ui::testing::layout::allocate: pub fn allocate(ui: &mut Ui, size: Vec2) -> egui::Rect. Takes size in the layout of ui and returns its rect.
  • craft_ui::testing::layout::body: pub fn body(ui: &mut Ui, key: &'static str, layout: &BodyLayout, sizes: &[Vec2]) -> Vec<Rect>. Runs a body laid out by layout under key and places one child per entry of sizes in flow, as step 6 does.
  • craft_ui::testing::layout::entry_id: pub fn entry_id(ui: &Ui, key: &'static str) -> Id. The id a keyed entry of this Ui lives under.
  • craft_ui::testing::layout::in_region: pub fn in_region<R>(ui: &mut Ui, rect: egui::Rect, body: impl FnOnce(&mut Ui) -> R) -> R. Runs body in a child Ui whose region is rect.
  • craft_ui::testing::layout::in_row_region: pub fn in_row_region<R>(ui: &mut Ui, rect: egui::Rect, body: impl FnOnce(&mut Ui) -> R) -> R. Runs body in a child Ui whose region is rect, laid out as a row with its items centred across.
  • craft_ui::testing::layout::is_animating: pub fn is_animating(ui: &Ui, key: &'static str) -> bool. Whether the tween under key is still running.
  • craft_ui::testing::layout::measured_block: pub fn measured_block(ui: &Ui, key: &'static str, real: Vec2) -> Option<Vec2>. A block that placed itself from key's entry of last pass and measured real this pass.
  • craft_ui::testing::layout::peek_size: pub fn peek_size(ui: &Ui, key: &'static str) -> Option<Vec2>. The size under key without a placement using it.
  • craft_ui::testing::layout::read_size: pub fn read_size(ui: &Ui, key: &'static str) -> Option<Vec2>. The size under key as a placement reads it.
  • craft_ui::testing::layout::reordered_fonts: pub fn reordered_fonts() -> egui::FontDefinitions. The test font definitions in another order.
  • craft_ui::testing::layout::scroll_anchor: pub fn scroll_anchor(ctx: &egui::Context, area: Id) -> Option<Id>. The child the scroll position of the scroll area area ([scroll_area]) is named by: the first child at or after the view's start in the last real run that laid the content out, which keeps what is in view in place while extents before it change.
  • craft_ui::testing::layout::scroll_area: pub fn scroll_area(ui: &Ui) -> Option<Id>. The innermost scroll area ui lays content out for, as the area keys its scroll state.
  • craft_ui::testing::layout::start_tween: pub fn start_tween(ui: &Ui, key: &'static str, from: Vec2, to: Vec2, duration: f64). Starts a size tween under key.
  • craft_ui::testing::layout::wrapped_text: pub fn wrapped_text(ui: &mut Ui, text: &str). Shows text wrapped to the available width of a sizing slot, for measure_slot trials.

craft_ui::testing::memory

The memory services the trials check: a stage fixture that implements Remember, eviction, forget and the id derivations.

  • craft_ui::testing::memory::Stage: pub struct Stage. A memory stage opened the way the pipeline opens one at step 3: the owner is registered, then the stage opens for base. finish is the write-back of step 17.
    • pub fn open(ctx: &Context, base: Id) -> Self. A stage whose entries belong to base, which is registered as its own owner.
    • pub fn open_owned(ctx: &Context, base: Id, owner: Id) -> Self. A stage keyed by base whose entries belong to owner, registered here.
    • pub fn open_peek(ctx: &Context, base: Id) -> Self. The stage of a sizing pass: it reads kept values and writes nothing.
    • pub fn finish(self). Writes every slot back to context data.
  • craft_ui::testing::memory::dispose_evicted: pub fn dispose_evicted(ctx: &Context). Drops the slots the end hook evicted.
  • craft_ui::testing::memory::facts_of_last_pass: pub fn facts_of_last_pass<T: Clone + Send + Sync + 'static>(ctx: &Context) -> Vec<T>. The facts the running viewport's previous pass registered.
  • craft_ui::testing::memory::forget: pub fn forget(ctx: &Context, id: Id). Removes the session slots under id.
  • craft_ui::testing::memory::forget_saved: pub fn forget_saved(ctx: &Context, key: &SaveKey). Removes the saved slots of key.
  • craft_ui::testing::memory::global: pub fn global(name: &'static str, scope: impl Hash + Debug) -> Id. The id of a runtime singleton named name under scope.
  • craft_ui::testing::memory::put: pub fn put<T: std::any::Any + Clone + Send + Sync>(ctx: &Context, id: Id, value: T). Stores value in context data under id, as a slot's Drop may.
  • craft_ui::testing::memory::records_written: pub fn records_written(ctx: &Context) -> usize. How many slot records the stages' write-backs have written in ctx so far.
  • craft_ui::testing::memory::register_fact: pub fn register_fact<T: Clone + PartialEq + Debug + crate::runtime::Shift + Send + Sync + 'static>(ctx: &Context, fact: T). Registers fact for the next pass of the running viewport.
  • craft_ui::testing::memory::scoped: pub fn scoped<R>(ui: &mut Ui, f: impl FnOnce(&mut Ui) -> R) -> R. Runs f on a child Ui of ui.
  • craft_ui::testing::memory::scoped_by: pub fn scoped_by<R>(ui: &mut Ui, salt: impl std::hash::Hash + std::fmt::Debug, f: impl FnOnce(&mut Ui) -> R) -> R. Runs f on a child Ui of ui with its own id scope named by salt.
  • craft_ui::testing::memory::slot_records: pub fn slot_records(ctx: &Context) -> usize. How many slot records the registry of ctx holds: a fork copies its source's, so the destination can evict and forget what it was given.
  • craft_ui::testing::memory::sub: pub fn sub(base: Id, tag: impl Hash + Debug) -> Id. The runtime sub-id of base for tag.

craft_ui::testing::pictures

Sample content for stories in every crate: photos for tiles and previews, and the brush tips and strokes a brush preview shows, so a story shows what its component shows in an app without a document or an engine.

  • craft_ui::testing::pictures::SampleTip: pub enum SampleTip { Hard, Soft, Star, Sampled }. The shape of a sample brush tip.
  • craft_ui::testing::pictures::StoryPictures: pub struct StoryPictures. The photos of the stories in one context, keyed by a number: the same key shows the same picture everywhere.
    • pub fn of(ctx: &Context) -> Self. The pictures stored in ctx.
    • pub fn thumb(&self, key: u64) -> impl FnOnce(&ContentPainterCx, Rect) + 'static. A thumbnail painter that fills its rect with the photo of key, cropped to the rect's shape.
  • craft_ui::testing::pictures::TEST_CARD_SIZE: pub const TEST_CARD_SIZE: [usize; 2]. The size of [test_card] in pixels: 4:3.
  • craft_ui::testing::pictures::paint_contour: pub fn paint_contour(cx: &ContentPainterCx, rect: Rect, n: u32). Contour n across rect in the ink of the surface: a power curve for even n, a cosine wave for odd.
  • craft_ui::testing::pictures::paint_tip: pub fn paint_tip(cx: &ContentPainterCx, rect: Rect, tip: SampleTip, color: Color32). The tip of tip centred in rect, in color.
  • craft_ui::testing::pictures::paint_wave: pub fn paint_wave(cx: &ContentPainterCx, rect: Rect, width: f32, color: Color32). A stroke as one wave across rect, width as a share of the rect's height, in color.
  • craft_ui::testing::pictures::sample_picture: pub fn sample_picture(key: u64, [width, height]: [u32; 2]) -> ColorImage. The photo of key as an image size pixels wide and high: the picture [StoryPictures::thumb] paints.
  • craft_ui::testing::pictures::stamped_stroke: pub fn stamped_stroke(size: [usize; 2], samples: &[[f64; 3]], diameter: f64, color: Color32) -> ColorImage. A stroke size pixels wide and high: round dabs of diameter pixels times the pressure stamped along samples (x and y in pixels, pressure 0 to 1), with six dabs between neighbouring samples, in color on transparent.
  • craft_ui::testing::pictures::test_card: pub fn test_card() -> ColorImage. A 4:3 video test card: eight colour bars over the top two thirds, a black to white ramp under them.

craft_ui::testing::pointer

Pointer events and gestures for trials that drive frames themselves.

  • craft_ui::testing::pointer::cancel_captured_presses: pub fn cancel_captured_presses(ctx: &egui::Context). Asks the pointer service to end every captured press in the running pass, as Escape does.
  • craft_ui::testing::pointer::click: pub fn click(frames: &mut Frames, at: Pos2, show: &mut impl FnMut(&mut Ui)). Hover in one frame, press in the next, release in the next, then one idle frame.
  • craft_ui::testing::pointer::drag: pub fn drag(frames: &mut Frames, from: Pos2, by: Vec2, show: &mut impl FnMut(&mut Ui)). Press at from, move to from + by in four steps over four frames, release.
  • craft_ui::testing::pointer::gone: pub fn gone() -> Event. The pointer leaving the window.
  • craft_ui::testing::pointer::middle: pub fn middle(pos: Pos2, pressed: bool) -> Event. The middle button going down or up at pos.
  • craft_ui::testing::pointer::moved: pub fn moved(pos: Pos2) -> Event. The pointer moving to pos.
  • craft_ui::testing::pointer::part_rect_of_node: pub fn part_rect_of_node(ctx: &egui::Context, node: crate::runtime::egui::access::NodeId, part: impl Into<craft_behavior::PartRef>,) -> Option<egui::Rect>. The rect of the part part of the component whose AccessKit node is node, as the sensing step recorded it last pass: how a host test that found a component by its node (a list row by its name) finds a pointer-only part of it (a thumbnail, a drag handle), which has no node of its own. Fixture::part_rect is the same lookup by the component's id.
  • craft_ui::testing::pointer::press: pub fn press(pos: Pos2) -> Event. The primary button going down at pos.
  • craft_ui::testing::pointer::press_captured: pub fn press_captured(ctx: &egui::Context) -> bool. Whether an open press holds the pointer in the running viewport, as Escape reads it.
  • craft_ui::testing::pointer::release: pub fn release(pos: Pos2) -> Event. The primary button going up at pos.
  • craft_ui::testing::pointer::resolutions: pub fn resolutions(ctx: &egui::Context) -> u32. How many times the running viewport's latest pass resolved what lies under a point: once for the hover, and again only for a press at another point or with other egui targets.
  • craft_ui::testing::pointer::secondary: pub fn secondary(pos: Pos2, pressed: bool) -> Event. The secondary button going down or up at pos.
  • craft_ui::testing::pointer::tap: pub fn tap(frames: &mut Frames, at: Pos2, gone_after: bool, show: &mut impl FnMut(&mut Ui)). A touchpad tap: hover in one frame, then press and release inside the next. gone adds the pointer leaving, as a touch screen reports a lift.
  • craft_ui::testing::pointer::trackpad: pub fn trackpad(dy: f32) -> Event. A trackpad scroll of dy points at the pointer: fingers on the pad, as macOS reports them.
  • craft_ui::testing::pointer::wheel: pub fn wheel(dy: f32) -> Event. A vertical wheel event of dy points.
  • craft_ui::testing::pointer::wheel_lines: pub fn wheel_lines(dy: f32) -> Event. A mouse wheel turning dy lines at the pointer.
  • craft_ui::testing::pointer::window_blurred: pub fn window_blurred() -> Event. The window losing focus.
  • craft_ui::testing::pointer::zoom_wheel: pub fn zoom_wheel(dy: f32) -> Event. A vertical wheel event of dy points with Ctrl or Cmd held, which zooms.

craft_ui::testing::relations

Relation assertions between rects and lengths: the tests compare layouts to each other and to tokens, never to literal sizes.

  • craft_ui::testing::relations::above: pub fn above(a: Rect, b: Rect) -> bool. a ends above where b begins or earlier.
  • craft_ui::testing::relations::aligned_left: pub fn aligned_left(a: Rect, b: Rect) -> bool. a and b start at the same left edge.
  • craft_ui::testing::relations::apart_above: pub fn apart_above(upper: Rect, lower: Rect) -> bool. lower starts below where upper ends, with a gap between them.
  • craft_ui::testing::relations::centred_across: pub fn centred_across(a: Rect, b: Rect) -> bool. a and b share a horizontal centre.
  • craft_ui::testing::relations::equals_token: pub fn equals_token(measured: f32, token: f32) -> bool. measured equals the token value token.
  • craft_ui::testing::relations::grows_with: pub fn grows_with(base: f32, grown: f32) -> bool. grown is at least base along one axis: a measure under a larger text size grows or stays.
  • craft_ui::testing::relations::inside: pub fn inside(inner: Rect, outer: Rect) -> bool. inner lies within outer.
  • craft_ui::testing::relations::left_of: pub fn left_of(a: Rect, b: Rect) -> bool. a ends where b begins or earlier.
  • craft_ui::testing::relations::mirrored: pub fn mirrored(left_to_right: Rect, right_to_left: Rect, within: Rect) -> bool. right_to_left is left_to_right reflected across the vertical middle of within, with the same size and height.
  • craft_ui::testing::relations::off_foot: pub fn off_foot(inner: Rect, outer: Rect) -> bool. inner ends above the foot of outer, not on it.
  • craft_ui::testing::relations::on_one_line: pub fn on_one_line(a: Rect, b: Rect) -> bool. a and b share a vertical centre: they stand on one line.
  • craft_ui::testing::relations::same_column: pub fn same_column(a: Rect, b: Rect) -> bool. a and b stand in one column: the same left edge and the same width.
  • craft_ui::testing::relations::same_height: pub fn same_height(a: Rect, b: Rect) -> bool. a and b are equally tall.

craft_ui::testing::sensing

Probe components for the sensing core: roots, members and parts described as data, shown through the same registration, lifecycle and response paths a component's pipeline uses.

  • craft_ui::testing::sensing::PartReport: pub struct PartReport { pub key: PartKey, pub index: Option<u64>, pub press: PressState, pub hovered: bool }. What one part read this pass.
  • craft_ui::testing::sensing::ProbeMember: pub struct ProbeMember. A member of a probe arena, or a body child that is a root of its own: in a probe that is no arena, or nested.
    • pub fn new(name: &'static str, rect: Rect, sense: Sense) -> Self. A member named name over rect sensing sense.
    • pub fn nested(mut self) -> Self. Shows the child in an arena's body as a root of its own, not a member: a text editor over a canvas.
    • pub fn part(mut self, part: ProbePart) -> Self. Adds a part.
  • craft_ui::testing::sensing::ProbePart: pub struct ProbePart. A part of a probe.
    • pub fn new(key: PartKey, rect: Rect, sense: Sense) -> Self. A part key over rect sensing sense.
    • pub fn level(mut self, level: HitLevel, sub: u8) -> Self. The part's tier among the shapes of its stack position.
    • pub fn drag_to_root(mut self) -> Self. Send a passed drag to the arena root.
    • pub fn over(mut self) -> Self. The part sits above the body members.
    • pub fn cursor(mut self, icon: CursorIcon) -> Self. The cursor the part asks for while hovered.
    • pub fn at(mut self, index: u64) -> Self. One of a repeated part.
  • craft_ui::testing::sensing::ProbeRoot: pub struct ProbeRoot. A root: a leaf component, or with arena an arena root whose members join it.
    • pub fn new(name: &'static str, rect: Rect, sense: Sense) -> Self. A root named name over rect sensing sense.
    • pub fn part(mut self, part: ProbePart) -> Self. Adds an own part.
    • pub fn member(mut self, member: ProbeMember) -> Self. Adds a body member.
    • pub fn arena(mut self) -> Self. Makes the root an arena: its members join it and have no egui widget.
    • pub fn transformed(mut self, transform: CanvasTransform) -> Self. Shows the body through transform on its own egui layer (an arena only).
    • pub fn blocker(mut self, size: Vec2) -> Self. Adds an allocating egui widget of size over the body, as app code may.
    • pub fn requests(mut self, cursor: impl Into<Cursor>, priority: CursorPriority) -> Self. A cursor the root requests while the pointer is over it, as a tool does.
    • pub fn disabled(mut self) -> Self. Turns the root disabled.
    • pub fn id(name: &'static str) -> Id. The id of the root named name.
    • pub fn transform_widget(name: &'static str) -> Id. The id of a transformed root's forwarding widget.
  • craft_ui::testing::sensing::RootReport: pub struct RootReport { pub root: SenseReport, pub activated_member: Option<Id>, pub members: Vec<SenseReport>, pub body: Option<TSTransform> }. What a root and its members read this pass.
    • pub fn to_screen(&self, local: Pos2) -> Pos2. Where a point of the body appears on screen.
    • pub fn member(&self, name: &'static str) -> Option<&SenseReport>. The report of the member named name.
  • craft_ui::testing::sensing::SenseReport: pub struct SenseReport { pub id: Id, pub press: PressState, pub parts: Vec<PartReport>, pub activated: bool, pub clicked: bool, pub hovered: bool, pub contains_pointer: bool }. What a member, or a root's own shape and parts, read this pass.
    • pub fn phase(&self, key: PartKey) -> PressPhase. The press phase of the part key, Idle when the part is unknown.
    • pub fn part_hovered(&self, key: PartKey) -> bool. Whether the part key reads the pointer over it.
  • craft_ui::testing::sensing::cover: pub fn cover(ctx: &Context, size: Vec2). Shows an egui area of size over everything else, as a popup does.
  • craft_ui::testing::sensing::egui_click_target: pub fn egui_click_target(ctx: &Context) -> Option<Id>. The widget id egui's hit test chose as the click target at the latest pointer position.
  • craft_ui::testing::sensing::press_focus: pub fn press_focus(ctx: &Context, at: Pos2) -> Option<PressFocus>. How the focus service classifies a press at at, from last pass's shape record and egui's hit test at the latest pointer position, so the pointer must have moved to at in a frame before; None when no shape under it takes it.
  • craft_ui::testing::sensing::show: pub fn show(ui: &mut Ui, roots: &[ProbeRoot]) -> Vec<RootReport>. Shows roots in order on ui, each through the sensing core, and reads back what each saw.

craft_ui::testing::snapshot

Stories rendered to images offscreen: egui's wgpu test renderer over what Frames recorded with record_paint.

  • craft_ui::testing::snapshot::Renderer: pub struct Renderer. A wgpu device and egui renderer that renders one context's frames after another's.
    • pub fn new() -> Self. A renderer on the preferred adapter.
    • pub fn render(&mut self, ctx: &Context, mut paint: FullOutput) -> Result<RgbaImage, String>. The image of paint (from Frames::take_paint) at the context's pixels per point, over a transparent ground.
    • pub fn finish(&mut self). Frees the textures of the context rendered last, before the renderer takes another context's frames.
  • craft_ui::testing::snapshot::layer_rects: pub fn layer_rects(ctx: &Context) -> Vec<Rect>. The screen rects the layers shown last frame and not fading out paint in: popups, dialogs, windows shown as layers, each within the region it is contained in.
  • craft_ui::testing::snapshot::modal_open: pub fn modal_open(ctx: &Context) -> bool. Whether a layer shown last frame and not fading out is modal (a dialog over the window).
  • craft_ui::testing::snapshot::RgbaImage: re-export of image::RgbaImage (outside these crates).

craft_ui::testing::story

Stories: named ways to show one registered type, and the data and output the runner reads from them.

  • craft_ui::testing::story::CollectionKind: pub enum CollectionKind { Selection, Picked, LeadMoved, Rested, Activate, Refused, EmptyActivated, EmptyContextMenu, EdgePressed, Preview, ContextMenu, CommandClick, MiddleClick, Delete, Open, Reorder(EditKind), Move(EditKind), Dropped, Zoom, Rename(EditKind), Toggle(EditKind), Column, Item }. The kind of a collection event, with the edit kind of the events that carry one.
    • pub fn of<K, E>(event: &CollectionEvent<K, E>) -> Option<CollectionKind>. The kind of event, None for an edit event of a kind the runner does not know.
  • craft_ui::testing::story::Drive: pub enum Drive { Auto, Activate, Step, Drag(Grip), DragChild(Grip), Type(&'static str), Pick { row: usize }, Custom(fn(&mut Fixture)), Never }. How the runner changes the value a story shows.
  • craft_ui::testing::story::EditKind: pub enum EditKind { Begin, Update, Commit, Cancel, Set }. The kind of an edit event.
    • pub fn of<T>(event: &EditEvent<T>) -> Option<EditKind>. The kind of event.
  • craft_ui::testing::story::Grip: pub struct Grip { pub part: PartRef, pub toward: Vec2 }. The part a [Drive::Drag] or [Drive::DragChild] presses and the way the drag moves it.
    • pub const fn new(key: PartKey) -> Self. The part key, a part that occurs once, dragged along x.
    • pub const fn part(part: PartRef) -> Self. The part part, one of a repeated part (HANDLE.at(i)), dragged along x.
    • pub const fn toward(mut self, toward: Vec2) -> Self. The grip dragged along toward.
  • craft_ui::testing::story::Required: pub enum Required { Default, Mixed, Invalid, LongText, Open, Empty, One, Many }. A state a registered type must show in some story.
  • craft_ui::testing::story::Story: pub struct Story { pub name: &'static str, pub covers: &'static [Required], pub show: fn(&mut Ui, &mut StoryData) -> StoryOutput, pub drive: Drive, pub disabled_text: Option<&'static str>, pub commands: Option<fn(&mut CommandStates)>, pub title: Option<&'static str>, pub group: Option<&'static str> }. A named way to show one registered type.
    • pub const fn new(name: &'static str, show: fn(&mut Ui, &mut StoryData) -> StoryOutput) -> Self. A story that shows with show.
    • pub const fn commands(mut self, add: fn(&mut CommandStates)) -> Self. Sets the function that sets the story's app-scope command states.
    • pub fn command_states<'a>(stories: impl IntoIterator<Item = &'a Story>) -> CommandStates. The command states of stories shown together: each story's command function applied in order to empty states, so a later story's state for a command replaces an earlier one's.
    • pub const fn title(mut self, title: &'static str) -> Self. The caption a viewer shows over the story.
    • pub const fn group(mut self, group: &'static str) -> Self. The group a viewer shows the story in.
    • pub fn group_name(&self, type_name: &str) -> String. The name of the story's group as a story of the type whose display name is type_name: its group, else its caption.
    • pub fn caption(&self, type_name: &str) -> String. The story's caption as a story of the type whose display name is type_name: its title, else the one its name makes ([crate::contract::story_title]).
    • pub const fn covers(mut self, covers: &'static [Required]) -> Self. The states the story shows.
    • pub const fn disabled_text(mut self, text: &'static str) -> Self. The reason the story's control shows while disabled.
    • pub const fn drive(mut self, drive: Drive) -> Self. The drive the story names.
  • craft_ui::testing::story::StoryData: pub struct StoryData { pub values: HashMap<(&'static str, TypeId), Box<dyn Shown>>, pub how: HashMap<(&'static str, TypeId), Edit> }. The values a story shows, by name.
    • pub fn tooltip(&self, text: &'static str) -> TooltipSpec. A tooltip of text, with the story's disabled_text as the text it shows while disabled.
    • pub fn value<T: Value>(&mut self, name: &'static str, init: T) -> &mut T. The value named name of type T, created from init on first use.
    • pub fn present<T: Value>(&mut self, name: &'static str) -> Option<&mut T>. The value named name of type T when a run has created it; never creates one, so asking does not make a value the story did not have.
    • pub fn note<T: Any>(&mut self, name: &'static str, init: T) -> &mut T. The note named name of type T, created from init on first use: what the story keeps about what happened in it for its readout ([StoryOutput::readout]), such as the last event or a click count.
    • pub fn bind<T: Value>(&mut self, name: &'static str, init: T) -> crate::contract::Bind<'_, T>. A binding of the value named name of type T, created from init on first use.
    • pub fn bind_mixed<T: Value>(&mut self, name: &'static str, init: Mixed<T>) -> crate::contract::Bind<'_, T>. Like [StoryData::bind] for a value that may be mixed, as a multi-selection field shows it; an edit makes it concrete.
    • pub fn bind_ranged<T: Value>(&mut self, name: &'static str, init: T, range: RangeInclusive<f64>) -> crate::contract::Bind<'_, T>. Like [StoryData::bind] for a number the Properties editor keeps inside range.
    • pub fn value_at<T: Value>(&mut self, name: &'static str, init: T) -> (&mut T, ValueAt<'_>). The value named name of type T, created from init on first use, with where it lies ([ValueAt]): a binding of the value or of a part of it (at.bind(&mut value.0)) names that part by this data's source, as [StoryData::bind] does, while the story keeps the value to read and pass on.
    • pub fn pair_at<A: Value, B: Value>(&mut self, a:(&'static str, A), b:(&'static str, B)) -> ((&mut A, ValueAt<'_>),(&mut B, ValueAt<'_>)). Two values by name, each created from its init on first use and returned with where it lies, as [StoryData::value_at] returns one: for a story that binds a value it must keep by its own name beside another, such as a dialog's open, which the gallery closes and opens by that name, beside the value the dialog edits.
    • pub fn ranged_at<T: Value>(&mut self, name: &'static str, init: T, range: RangeInclusive<f64>) -> (&mut T, ValueAt<'_>). Like [StoryData::value_at] for a number the Properties editor keeps inside range.
    • pub fn choice_at<T: Value>(&mut self, name: &'static str, init: T, options: &[(&'static str, T)]) -> (&mut T, ValueAt<'_>). Like [StoryData::value_at] for a value that is one of options, which the Properties editor offers by label.
    • pub fn ranged<T: Value>(&mut self, name: &'static str, init: T, range: RangeInclusive<f64>) -> &mut T. Like [StoryData::value] for a number the Properties editor keeps inside range.
    • pub fn choice<T: Value>(&mut self, name: &'static str, init: T, options: &[(&'static str, T)]) -> &mut T. Like [StoryData::value] for a value that is one of options, which the Properties editor offers by label.
    • pub fn restore(&mut self, before: &StorySnapshot). Puts every value that was there in before back to what it was then.
    • pub fn settle(&mut self). Moves the [revision] when a value was added or changed since the last call.
    • pub fn revision(&self) -> Revision. The revision of the values: unique to this data, and moved by every [settle] that finds a change, so equal revisions mean the values a memoized view showed.
    • pub fn changed_since(&self, before: &StorySnapshot) -> Vec<&'static str>. The names of the values that differ from before; a value added since counts as changed.
    • pub fn snapshot(&self) -> StorySnapshot. A copy of every value.
  • craft_ui::testing::story::StoryOutput: pub struct StoryOutput { pub id: Option<Id>, pub edits: Vec<EditKind>, pub clicked: bool, pub fired: Vec<CommandRef>, pub collection: Vec<CollectionKind>, pub visible: Option<Range<usize>>, pub value_text: Option<String>, pub readout: Option<String> }. What a story showed, type-erased: the response id, the kinds of its edit events and of its collection events.
    • pub fn readout(mut self, text: impl Into<String>) -> Self. The same output with text as its readout.
    • pub fn activated(&self) -> bool. Whether the pass activated what the story shows: it reported a click, or it fired a command, as a component bound to one does in place of the click.
  • craft_ui::testing::story::StorySnapshot: pub struct StorySnapshot. The values of a [StoryData] at one moment.
  • craft_ui::testing::story::ValueAt: pub struct ValueAt<'a>. Where a story value lies ([StoryData::value_at]): its data's source, its name and its place in memory, so a binding of the value or of a field of it names that field by source and the field's offset in the value, as bind_tracked! names a field of a Tracked.
    • pub fn bind<'b, F: Value>(self, part: &'b mut F) -> crate::contract::Bind<'b, F> where Self: 'b,. A binding of part, the value itself or a field inside it.
    • pub fn bind_mixed<'b, F: Value>(self, part: &'b mut Mixed<F>) -> crate::contract::Bind<'b, F> where Self: 'b,. Like [ValueAt::bind] for a field that may be mixed: an edit makes it concrete.
  • craft_ui::testing::story::show_as_only_item: pub fn show_as_only_item<C>(ui: &mut Ui, row: C) -> C::Output where C: crate::contract::Component + crate::contract::Props + crate::contract::Show,. Shows row as the only item of a collection: the item step gives an item its id and its place in the set, which a stand-alone story of an item type would otherwise lack.
  • craft_ui::testing::story::show_as_only_item_across: pub fn show_as_only_item_across<C>(ui: &mut Ui, mut row: C, span: egui::Rangef) -> C::Output where C: crate::contract::Component + crate::contract::Props + crate::contract::Show,. Shows row as the only item of a collection across span, as a collection shows its rows across its columns: a row with column cells spans the cells it is given, where in the flow it would take its own width.

craft_ui::testing::style

Style and paint helpers: token sets, a StyleCx, the style cache and a Draw over a frame.

  • craft_ui::testing::style::Recorded: pub struct Recorded { pub elided: Option<String>, pub baseline: Option<f32> }. What Draw recorded in one frame.
  • craft_ui::testing::style::StyleLooks: pub struct StyleLooks { pub variants: &'static [craft_theme::Variant], pub surface: Option<crate::style::SurfaceLook>, pub focus: Option<crate::style::FocusLook>, pub texts: Vec<crate::style::TextLook>, pub icons: Vec<crate::style::IconLook> }. A resolved style as the style cases read it: the variants its type lists and the looks that state colours reach, with the whole style kept to tell two styles apart.
    • pub fn same_as(&self, other: &StyleLooks) -> bool. Whether other is the same style, in every field.
  • craft_ui::testing::style::StyleSeen: pub struct StyleSeen { pub type_name: &'static str, pub variant: craft_theme::Variant, pub size: ControlSize, pub looks: StyleLooks }. A style the pipeline resolved for a component run: what it looked like in the env it was resolved in, and how to resolve the same component's style in another env.
    • pub fn resolve_in(&self, cx: &crate::style::StyleCx<'_>) -> StyleLooks. The style of the same component, from the same style key, under another style context.
  • craft_ui::testing::style::env_key: pub fn env_key(tokens: &UiTokens) -> EnvKey. The EnvKey of tokens in a left-to-right Linux window at scale 1 with no style-affecting app values.
  • craft_ui::testing::style::face_id: pub fn face_id(composite: &str, part: craft_behavior::PartRef) -> egui::Id. The base id of the face painted for part of the composite id.
  • craft_ui::testing::style::paint_frame: pub fn paint_frame(frames: &mut Frames, tokens: &UiTokens, direction: Direction, ink: Ink, mut paint: impl FnMut(&Draw<'_>),) -> (Vec<Shape>, Recorded). Runs one frame in which paint draws through a Draw over the root Ui's painter, in direction and on ink.
  • craft_ui::testing::style::report_os_contrast: pub fn report_os_contrast(ctx: &Context, contrast: craft_theme::Contrast). Reports contrast as the OS's contrast preference on ctx, as a desktop source would.
  • craft_ui::testing::style::report_os_text_scale: pub fn report_os_text_scale(ctx: &Context, scale: Option<f32>). Reports scale as the OS's text scale on ctx (None: no scaling), as a desktop source would; [crate::runtime::env::system_text_scale] answers it.
  • craft_ui::testing::style::report_os_theme: pub fn report_os_theme(ctx: &Context, dark: bool). Reports dark as the OS's colour scheme on ctx through the host's reader, as a desktop source would; the integration sends no Event::SystemTheme (Linux without the settings portal).
  • craft_ui::testing::style::root_token_resolves: pub fn root_token_resolves(ctx: &Context) -> usize. How many times ctx resolved root tokens its cache had no entry for.
  • craft_ui::testing::style::style_of: pub fn style_of<K: StyleKey, S: ComponentStyle>(ctx: &Context, cx: &StyleCx<'_>, key: K, default: for<'a> fn(&StyleCx<'a>, K) -> S) -> Arc<S>. The cached style for key in cx, built by default on a miss.
  • craft_ui::testing::style::themes_at: pub fn themes_at(contrast: Contrast) -> Vec<(String, UiTokens)>. Every built-in theme in each mode it has, at contrast, as (<theme>.<mode>, tokens).
  • craft_ui::testing::style::tokens: pub fn tokens(mode: Mode, contrast: Contrast) -> UiTokens. The suite's default built-in theme resolved for mode and contrast.
  • craft_ui::testing::style::tokens_named: pub fn tokens_named(name: &str, mode: Mode, contrast: Contrast) -> UiTokens. The built-in theme craft.<name> resolved for mode and contrast.
  • craft_ui::testing::style::with_cx: pub fn with_cx<R>(ctx: &Context, tokens: &UiTokens, variant: Variant, size: ControlSize, f: impl FnOnce(&StyleCx<'_>) -> R) -> R. Runs f with a StyleCx over tokens in a left-to-right Linux window at scale 1.

craft_ui::testing::suite

The suite runner: one trial per registered type and group of cases, running the group's shared cases over the stories the crate registered for the type (22.4).

  • craft_ui::testing::suite::trials: pub fn trials(package: &'static str, registry: &Registry) -> Vec<Trial>. The trials of one package: a trial per registered type and group of cases, suite::<type>::<group>; the same for each type another linked package registers and this package has stories of, over those stories and without the cases about the type as a whole (Subject::home); and one per story naming a type that is not linked.
  • craft_ui::testing::suite::measure_pure_case: pub fn measure_pure_case(probe: &Probe, story: &Story) -> Result<(), String>. The measure-pure case over one story of the type probe describes: settled and then driven by each way of its drive, the story shows no impure pass.
  • craft_ui::testing::suite::reflowed: pub fn reflowed(base: &[(&str, Rect)], grown: &[(&str, Rect)]) -> bool. Whether the layout reflowed from base to grown: two texts lie beside each other in base and one above the other in grown, as a label that moves above its control.
  • craft_ui::testing::suite::required_states: pub fn required_states(probe: &Probe) -> Vec<Required>. The states a registered type must show, from the facts of its probe, less the states it is exempt from.
  • craft_ui::testing::suite::rtl_case: pub fn rtl_case(story: &Story) -> Result<(), String>. The suite's right-to-left case for one story.
  • craft_ui::testing::suite::text_size_case: pub fn text_size_case(story: &Story) -> Result<(), String>. The suite's text-size case for one story: under a larger text size, either density and scale 2 the story grows and no text run that lay in its part leaves it.
  • craft_ui::testing::suite::title_case: pub fn title_case(story: &Story) -> Result<(), String>. The title case for one story.
  • craft_ui::testing::suite::values_case: pub fn values_case(probe: &Probe, story: &Story) -> Result<Vec<&'static str>, String>. The values case over one story of the type probe describes: each way of the story's drive runs in its own fixture. Ok names the runs in order (a drag is followed by "drag with Escape"); Err gives the failures, or says that no run changed the value.

craft_ui::testing::surface

The egui behaviours the runtime relies on, as scenarios on a bare egui context: the egui_surface trials assert on what they return.

  • craft_ui::testing::surface::HookFacts: pub struct HookFacts { pub child_input_hooks: usize, pub input_hooks_see_parent: bool, pub child_begin_hooks: usize }. What the plugin hooks of one context saw around a nested immediate viewport.
  • craft_ui::testing::surface::LayerOrder: re-export of craft_ui::runtime::egui::areas::LayerOrder.
  • craft_ui::testing::surface::PassFacts: pub struct PassFacts { pub events: usize, pub frame: u64, pub pass: u64 }. What a pass saw of one frame that discarded its first pass.
  • craft_ui::testing::surface::PressHits: pub struct PressHits { pub press_last_is_press_target: bool, pub move_last_is_move_target: bool }. The widget ViewportState::hits names for a press, by the order of the frame's pointer events.
  • craft_ui::testing::surface::child_viewport_hooks: pub fn child_viewport_hooks() -> HookFacts. Two frames of a root viewport that shows an immediate child viewport, with a recording plugin on the context.
  • craft_ui::testing::surface::discard_passes: pub fn discard_passes() -> Vec<PassFacts>. One frame with a key event whose first pass asks for a discard.
  • craft_ui::testing::surface::focus_survives_escape: pub fn focus_survives_escape(keep: bool) -> bool. Whether a widget that took focus with request_focus_with_filter still holds it after a bare Escape: keep says whether the filter lists Escape.
  • craft_ui::testing::surface::layer_order: re-export of craft_ui::runtime::egui::areas::layer_order.
  • craft_ui::testing::surface::preset_style_direction: pub fn preset_style_direction(ctx: &Context, right_to_left: bool). Writes the direction into the context's styles before any pass, as an egui backend that derives it from the system locale would.
  • craft_ui::testing::surface::press_hits: pub fn press_hits() -> PressHits. Three frames over two click widgets: one to register them, then the two event orders.
  • craft_ui::testing::surface::registered_parent_owns_member_node: pub fn registered_parent_owns_member_node() -> bool. Whether a member that registered no egui widget, given register_accesskit_parent, has its node among the children of its parent's node.

craft_ui::testing::text

Reading text parts in trials: the widget id, the caret and the text a frame painted.

  • craft_ui::testing::text::caret: pub fn caret(ctx: &Context, widget: Id) -> Option<usize>. The caret of a text widget as a character index.
  • craft_ui::testing::text::editor_widget_id: pub fn editor_widget_id(id: Id, key: PartKey) -> Id. The egui widget id of the editor part key of component id.
  • craft_ui::testing::text::painted: pub fn painted(shapes: &[Shape]) -> Vec<String>. The texts of the text shapes among shapes.
  • craft_ui::testing::text::run_end: pub fn run_end(owner: Id, runs: &[(usize, std::ops::Range<usize>, &str)], pos: craft_behavior::TextPos) -> Option<(Id, usize)>. The run node and character index a position maps to among runs given as (line, bytes, text).
  • craft_ui::testing::text::run_node: pub fn run_node(owner: Id, line: usize, run: usize) -> Id. The id of the run node run of line line below the text component owner.
  • craft_ui::testing::text::widget_id: pub fn widget_id(id: Id, key: PartKey) -> Id. The egui widget id of the text part key of component id.
  • craft_ui::testing::text::ImeSeen: pub struct ImeSeen { pub owner: egui::Id, pub interrupt: bool, pub reset: Option<egui::ImeResetId>, pub caret: Rect, pub generation: u64, pub surrounding: egui::output::IMESurroundingText, pub cause: egui::output::ImeChangeCause }. The IME output of a frame: the owner widget, whether it asks the OS to interrupt a composition, the caret rect.
  • craft_ui::testing::text::ime_preedit: pub fn ime_preedit(text: &str) -> Event. An IME preedit event of text with no cursor range.
  • craft_ui::testing::text::set_value_request: pub fn set_value_request(target: egui::Id, text: &str) -> Event. An AccessKit SetValue request carrying text for the node of target.
  • craft_ui::testing::text::text_selection_request: pub fn text_selection_request(target: egui::Id, anchor:(egui::Id, usize), focus:(egui::Id, usize)) -> Event. An AccessKit SetTextSelection request for the node of target, from character anchor.1 of the run node anchor.0 to character focus.1 of focus.0.

craft_ui::testing::wheel

The wheel service from a trial's side: registering takers and reading their shares.

  • craft_ui::testing::wheel::focus: pub fn focus(ctx: &Context, id: Id). Gives key focus to the widget id.
  • craft_ui::testing::wheel::register: pub fn register(ctx: &Context, taker: WheelTaker<Id>). Registers taker for the next pass's split.
  • craft_ui::testing::wheel::take: pub fn take(ctx: &Context, id: Id) -> Option<Vec2>. The scroll id takes this pass, if it has a share.
  • craft_ui::testing::wheel::take_share: pub fn take_share(ctx: &Context, id: Id) -> Option<craft_behavior::Wheel>. The whole share id takes this pass: scroll, zoom and the pointer a zoom is about.

craft_ui::testing::windows

The window host's fixtures: install inputs that open no OS windows, and the scripted system.

  • craft_ui::testing::windows::applied_actions: pub fn applied_actions(ctx: &egui::Context) -> Vec<(egui::ViewportId, crate::runtime::windows::WindowAction)>. The window actions the platform applies out of reach of egui's commands (SetOpacity) since the last call.
  • craft_ui::testing::windows::begin_window_drag: pub fn begin_window_drag(ctx: &egui::Context, source: egui::Id). Starts the drag of the window container source (what the title row of a dock window does), with the pointer released by the caller's events as in a real drag.
  • craft_ui::testing::windows::install_spec: pub fn install_spec() -> InstallSpec. An install spec for the running build's shell and a system with no OS services, with the stories' command sets.
  • craft_ui::testing::windows::moved_by_app: pub fn moved_by_app(ctx: &egui::Context, viewport: egui::ViewportId) -> bool. Whether the app runs the move of viewport's window from its move band (Overlay::moved_by_app), as the window host knows it in the running pass.
  • craft_ui::testing::windows::set_os: pub fn set_os(ctx: &egui::Context, os: craft_host::target::Os). Makes the shell of ctx run on os, for a test of the OS matrix: the key table, the chords shown, the chrome, the capabilities of a native build and egui's own OS all follow it.
  • craft_ui::testing::windows::show_drop_mark: pub fn show_drop_mark(ctx: &egui::Context, over: Option<egui::Rect>). Shows (or removes) the mark of a drop target in another window over the running drag.
  • craft_ui::testing::windows::FakeSystem: re-export of craft_window::system::FakeSystem (outside these crates).
  • craft_ui::testing::windows::FullOutput: re-export of craft_ui::runtime::egui::fixture::FullOutput (defined outside these crates).
  • craft_ui::testing::windows::HeldButtons: re-export of craft_window::system::HeldButtons (outside these crates).
  • craft_ui::testing::windows::NoWindows: re-export of craft_window::system::NoWindows (outside these crates).
  • craft_ui::testing::windows::RawInput: re-export of craft_ui::runtime::egui::fixture::RawInput (defined outside these crates).
  • craft_ui::testing::windows::dragged_id: pub fn dragged_id(ctx: &Context) -> Option<egui::Id>. The id of the widget egui is dragging.
  • craft_ui::testing::windows::record_input_hooks: pub fn record_input_hooks(ctx: &Context, log: std::sync::Arc<std::sync::Mutex<Vec<(egui::ViewportId, egui::ViewportId)>>>). Adds a plugin to ctx that records, for each input hook call, the viewport of the raw input and the viewport that is current on the context.