pub struct FacetDeck { /* private fields */ }Expand description
A tabbed set of Facets — the reusable multi-component shell. Draws a tab
bar + the active facet, and composes every facet’s state_json under its
title, so the whole-app introspection contract is free. korp/nornir can build
their window from a FacetDeck instead of hand-rolling tabs + the state dump.
Implementations§
Source§impl FacetDeck
impl FacetDeck
pub fn new(facets: Vec<Box<dyn Facet>>) -> Self
pub fn active(&self) -> usize
Sourcepub fn facet_mut<T: Any>(&mut self, title: &str) -> Option<&mut T>
pub fn facet_mut<T: Any>(&mut self, title: &str) -> Option<&mut T>
Typed mutable access to the facet with title, downcast to T — None if
no such facet, or it doesn’t opt into Facet::as_any_mut, or the type
mismatches. Lets a host drive a concrete component’s own API (e.g. a
robot-UI control forwarding a node selection to a SystemChart).
Sourcepub fn with_fx(self, fx: DeckFx) -> Self
pub fn with_fx(self, fx: DeckFx) -> Self
Enable deck effects up front (builder form of fx_mut).
Sourcepub fn fx_mut(&mut self) -> &mut DeckFx
pub fn fx_mut(&mut self) -> &mut DeckFx
Mutate the deck-effects config (toggle glow, pin a palette, …).
Sourcepub fn set_palette(&mut self, i: usize)
pub fn set_palette(&mut self, i: usize)
Override the deck theme with palette index i (wraps); enables the
override. Convenience over fx_mut().set_palette(i).
Sourcepub fn cycle_palette(&mut self) -> usize
pub fn cycle_palette(&mut self) -> usize
Advance to the next palette in Theme::ALL (wrapping); returns the new
index. Convenience over fx_mut().cycle_palette().
Sourcepub fn send_raven(&mut self, target: Rect)
pub fn send_raven(&mut self, target: Rect)
Summon the raven to perch on target — any rect a facet/host hands us
(a table row, a node, a header). Replaces any raven already in flight. The
body is tinted from the deck’s current palette (or the host theme). Logs an
activity trail entry. Drive/paint happens automatically inside
ui.
Sourcepub fn raven_perched(&self) -> bool
pub fn raven_perched(&self) -> bool
True once the summoned raven has landed (false if none).
Sourcepub fn clear_raven(&mut self)
pub fn clear_raven(&mut self)
Dismiss any raven.
Sourcepub fn palette_picker(&mut self, ui: &mut Ui) -> Option<usize>
pub fn palette_picker(&mut self, ui: &mut Ui) -> Option<usize>
Draw a one-line palette picker — a switcher over Theme::ALL the
host can place anywhere (toolbar, menu). Selecting a palette pins the fx
override; ui() then applies it each frame. Returns the chosen index if it
changed this frame.
Sourcepub fn active_caps(&self) -> FacetCaps
pub fn active_caps(&self) -> FacetCaps
The capabilities of the currently-active facet (or NONE if empty).
Sourcepub fn ui(&mut self, ui: &mut Ui)
pub fn ui(&mut self, ui: &mut Ui)
Draw the tab bar + capability toolbar + the active facet, and route capability-gated shortcuts (Ctrl-+/-/0 for scale; Ctrl-C/X/V for clipboard).
Sourcepub fn state_json(&self) -> Value
pub fn state_json(&self) -> Value
The whole-app observable state: the active facet + each facet’s
state_json, plus an additive sibling caps map (title → caps JSON)
so the existing flat facets[title] shape is unchanged for consumers.