pub struct DialogState { /* private fields */ }Expand description
Retains a dialog’s visibility and focus scope across renders.
Implementations§
Source§impl DialogState
impl DialogState
Sourcepub fn new(cx: &mut Context<'_, DialogState>) -> DialogState
pub fn new(cx: &mut Context<'_, DialogState>) -> DialogState
Creates a closed dialog state with freshly allocated focus and scroll handles.
Sourcepub fn last_close_reason(&self) -> Option<DialogCloseReason>
pub fn last_close_reason(&self) -> Option<DialogCloseReason>
Returns the most recent accepted close, including programmatic closes.
Sourcepub fn focus_handle(&self) -> &FocusHandle
pub fn focus_handle(&self) -> &FocusHandle
Returns the modal container’s retained focus handle.
Sourcepub fn scroll_handle(&self) -> &ScrollHandle
pub fn scroll_handle(&self) -> &ScrollHandle
Returns the retained scroll handle bound to the dialog or sheet body.
Sourcepub fn open(&mut self, window: &mut Window, cx: &mut Context<'_, DialogState>)
pub fn open(&mut self, window: &mut Window, cx: &mut Context<'_, DialogState>)
Focuses the modal container. A caller can then focus a child editor.
Sourcepub fn close(&mut self, window: &mut Window, cx: &mut Context<'_, DialogState>)
pub fn close(&mut self, window: &mut Window, cx: &mut Context<'_, DialogState>)
Closes the dialog and restores its previous focus if it still owns focus. A programmatic close updates the reason without firing the user close callback.
Auto Trait Implementations§
impl !RefUnwindSafe for DialogState
impl !Send for DialogState
impl !Sync for DialogState
impl !UnwindSafe for DialogState
impl Forget for DialogState
impl Freeze for DialogState
impl Move for DialogState
impl Unpin for DialogState
impl UnsafeUnpin for DialogState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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