Trait PartPainter
pub trait PartPainter: Send + Sync {
// Required method
fn paint(
&self,
part: Part,
size: Size,
state: PartState,
progress: f32,
tokens: &PartTokens,
) -> Option<PaintedPart>;
// Provided methods
fn params(&self) -> Vec<ParamSpec> { ... }
fn transition(&self, part: Part, from: States, to: States) -> Transition { ... }
}Expand description
A painter set: how a theme draws every part.
Every method is a pure function of its arguments: no clock, no I/O, no state kept between calls. The toolkit caches what it returns and calls it again only when an argument changes.
Required Methods§
fn paint(
&self,
part: Part,
size: Size,
state: PartState,
progress: f32,
tokens: &PartTokens,
) -> Option<PaintedPart>
fn paint( &self, part: Part, size: Size, state: PartState, progress: f32, tokens: &PartTokens, ) -> Option<PaintedPart>
Draw part at size (logical pixels, origin at its top left), in
state, progress of the way through the transition from
state.was to state.now (1 when settled), with tokens.
None leaves the part to the built-in Default set, so a theme draws
only the parts it changes.
Provided Methods§
fn params(&self) -> Vec<ParamSpec>
fn params(&self) -> Vec<ParamSpec>
The parameters this set takes from a theme document. A document
naming the set may state these and no others; the toolkit hands the
stated values to every call in PartTokens::params.
fn transition(&self, part: Part, from: States, to: States) -> Transition
fn transition(&self, part: Part, from: States, to: States) -> Transition
How part moves from from to to. The toolkit runs it on its
clock; Transition::Inherit takes the toolkit’s own motion.