pub struct DialogStackState<Global, Event, Error> { /* private fields */ }
Expand description
State of the dialog stack.
Add this to your global state.
** unstable **
Implementations§
Source§impl<Global, Event, Error> DialogStackState<Global, Event, Error>
impl<Global, Event, Error> DialogStackState<Global, Event, Error>
Sourcepub fn push_dialog<Render, State>(&mut self, render: Render, state: State)where
Render: Fn(Rect, &mut Buffer, &mut dyn DialogState<Global, Event, Error>, &mut RenderContext<'_, Global>) -> Result<(), Error> + 'static,
State: DialogState<Global, Event, Error> + 'static,
pub fn push_dialog<Render, State>(&mut self, render: Render, state: State)where
Render: Fn(Rect, &mut Buffer, &mut dyn DialogState<Global, Event, Error>, &mut RenderContext<'_, Global>) -> Result<(), Error> + 'static,
State: DialogState<Global, Event, Error> + 'static,
Push a new dialog window on the stack.
This takes
- a constructor for the AppWidget. This is called for every render and can adjust construction to the environment.
- the dialogs state.
Note
This can be called during event handling of a dialog.
Sourcepub fn pop_dialog(&mut self)
pub fn pop_dialog(&mut self)
Pop the top dialog from the stack.
This can be called repeatedly if necessary.
Note
This can be called during event handling of a dialog.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Is the dialog stack empty?
Note
This can be called during event handling of a dialog.
Sourcepub fn top_state_is<S: 'static>(&self) -> Result<bool, DialogStackError>
pub fn top_state_is<S: 'static>(&self) -> Result<bool, DialogStackError>
Test the type of the top dialog state.
Note
This will not work during event-handling of a dialog.
Sourcepub fn map_top_state_if<S, MAP, R>(
&self,
map: MAP,
) -> Result<R, DialogStackError>
pub fn map_top_state_if<S, MAP, R>( &self, map: MAP, ) -> Result<R, DialogStackError>
Calls the closure with the top state of the stack if the type matches.
Note
This will not work during event-handling of a dialog.
Trait Implementations§
Source§impl<Global, Event, Error> AppState<Global, Event, Error> for DialogStackState<Global, Event, Error>
impl<Global, Event, Error> AppState<Global, Event, Error> for DialogStackState<Global, Event, Error>
Source§fn init(
&mut self,
_ctx: &mut AppContext<'_, Global, Event, Error>,
) -> Result<(), Error>
fn init( &mut self, _ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<(), Error>
Initialize the application. Runs before the first repaint.
Source§fn event(
&mut self,
event: &Event,
ctx: &mut AppContext<'_, Global, Event, Error>,
) -> Result<Control<Event>, Error>
fn event( &mut self, event: &Event, ctx: &mut AppContext<'_, Global, Event, Error>, ) -> Result<Control<Event>, Error>
Handle an event.
Source§impl<Global, Event, Error> Clone for DialogStackState<Global, Event, Error>
impl<Global, Event, Error> Clone for DialogStackState<Global, Event, Error>
Source§impl<Global, Event, Error> Debug for DialogStackState<Global, Event, Error>
impl<Global, Event, Error> Debug for DialogStackState<Global, Event, Error>
Auto Trait Implementations§
impl<Global, Event, Error> Freeze for DialogStackState<Global, Event, Error>
impl<Global, Event, Error> !RefUnwindSafe for DialogStackState<Global, Event, Error>
impl<Global, Event, Error> !Send for DialogStackState<Global, Event, Error>
impl<Global, Event, Error> !Sync for DialogStackState<Global, Event, Error>
impl<Global, Event, Error> Unpin for DialogStackState<Global, Event, Error>
impl<Global, Event, Error> !UnwindSafe for DialogStackState<Global, Event, Error>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more