Enum widgetry::Transition [−][src]
pub enum Transition<A> { Keep, KeepWithMouseover, Pop, ModifyState(Box<dyn FnOnce(&mut Box<dyn State<A>>, &mut EventCtx<'_>, &mut A)>), ReplaceWithData(Box<dyn FnOnce(Box<dyn State<A>>, &mut EventCtx<'_>, &mut A) -> Vec<Box<dyn State<A>>>>), Push(Box<dyn State<A>>), Replace(Box<dyn State<A>>), Clear(Vec<Box<dyn State<A>>>), Multi(Vec<Transition<A>>), }
When a state responds to an event, it can specify some way to manipulate the stack of states.
Variants
Don’t do anything, keep the current state as the active one
Keep the current state as the active one, but immediately call event
again with a mouse
moved event
Destroy the current state, and resume from the previous one
If a state needs to pass data back to its parent, use this. In the callback, you have to downcast the previous state to populate it with data.
ReplaceWithData(Box<dyn FnOnce(Box<dyn State<A>>, &mut EventCtx<'_>, &mut A) -> Vec<Box<dyn State<A>>>>)
Push a new active state on the top of the stack.
Replace the current state with a new one. Equivalent to Pop, then Push.
Replace the entire stack of states with this stack.
Multi(Vec<Transition<A>>)
Execute a sequence of transitions in order.