Trait DialogState

Source
pub trait DialogState<Global, Event, Error>: Any
where Global: 'static, Event: Send + 'static, Error: Send + 'static,
{ // Required methods fn active(&self) -> bool; fn event( &mut self, event: &Event, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<Control<Event>, Error>; }
Expand description

Trait for a dialogs state.

A separate trait is necessary because this needs Any in the vtable. It mimics AppState without a few lifecycle functions.

Required Methods§

Source

fn active(&self) -> bool

Is the dialog still active.

Whenever this goes to false during event handling the dialog will be popped from the stack.

Source

fn event( &mut self, event: &Event, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<Control<Event>, Error>

Handle an event.

Implementations§

Source§

impl<Global, Event, Error> dyn DialogState<Global, Event, Error>
where Global: 'static, Event: Send + 'static, Error: Send + 'static,

Source

pub fn downcast_ref<R: DialogState<Global, Event, Error>>(&self) -> Option<&R>

down cast Any style.

Source

pub fn downcast_mut<R: DialogState<Global, Event, Error>>( &mut self, ) -> Option<&mut R>

down cast Any style.

Implementors§

Source§

impl<Global, Event, Error> DialogState<Global, Event, Error> for FileDialogState<Global, Event, Error>
where for<'a> &'a Event: TryFrom<&'a Event>, Global: 'static, Event: Send + 'static, Error: Send + 'static + From<Error>,

Source§

impl<Global, Event, Error> DialogState<Global, Event, Error> for MsgDialogState
where Global: 'static, Event: Send + 'static, Error: Send + 'static, for<'a> &'a Event: TryFrom<&'a Event>,