pub struct Dialog { /* private fields */ }Expand description
A composed modal: scrim, focus trap, title, body, and up to two actions.
Implementations§
Source§impl Dialog
impl Dialog
pub fn new( ident: impl Into<Ident>, _window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
pub fn title(self, title: impl Into<SharedString>) -> Self
pub fn description(self, description: impl Into<SharedString>) -> Self
Sourcepub fn content(
self,
body: impl Fn(&mut Window, &mut App) -> AnyElement + 'static,
) -> Self
pub fn content( self, body: impl Fn(&mut Window, &mut App) -> AnyElement + 'static, ) -> Self
Supplies the body, rebuilt on every frame the dialog is open.
Sourcepub fn dismissable(self, dismissable: bool) -> Self
pub fn dismissable(self, dismissable: bool) -> Self
Whether escape and the scrim close the dialog. A dialog that is not dismissable installs neither handler.
Sourcepub fn destructive(self, destructive: bool) -> Self
pub fn destructive(self, destructive: bool) -> Self
Marks the primary action as one that destroys something.
pub fn confirm_label(self, label: impl Into<SharedString>) -> Self
pub fn cancel_label(self, label: impl Into<SharedString>) -> Self
pub fn is_open(&self) -> bool
pub fn is_dismissable(&self) -> bool
pub fn set_title( &mut self, title: impl Into<SharedString>, cx: &mut Context<'_, Self>, )
pub fn set_description( &mut self, description: Option<SharedString>, cx: &mut Context<'_, Self>, )
pub fn open(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
Sourcepub fn close(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
pub fn close(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
Closes without an outcome. The window is required because closing gives the keyboard back to whatever held it before the dialog opened.
pub fn confirm(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
pub fn cancel(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
Trait Implementations§
impl EventEmitter<DialogEvent> for Dialog
Source§impl Focusable for Dialog
impl Focusable for Dialog
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Returns the focus handle associated with this view.
Auto Trait Implementations§
impl !RefUnwindSafe for Dialog
impl !Send for Dialog
impl !Sync for Dialog
impl !UnwindSafe for Dialog
impl Freeze for Dialog
impl Unpin for Dialog
impl UnsafeUnpin for Dialog
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
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