pub struct Dialog { /* private fields */ }Expand description
A named Material modal with optional structured slots or caller-defined content.
Implementations§
Source§impl Dialog
impl Dialog
pub fn new( id: impl Into<ElementId>, state: &Entity<DialogState>, title: impl Into<SharedString>, ) -> Dialog
Sourcepub fn alert(
id: impl Into<ElementId>,
state: &Entity<DialogState>,
title: impl Into<SharedString>,
description: impl Into<SharedString>,
) -> Dialog
pub fn alert( id: impl Into<ElementId>, state: &Entity<DialogState>, title: impl Into<SharedString>, description: impl Into<SharedString>, ) -> Dialog
Creates a basic alert dialog with a description and no default cancel button.
Sourcepub fn unstructured(
id: impl Into<ElementId>,
state: &Entity<DialogState>,
accessibility_label: impl Into<SharedString>,
) -> Dialog
pub fn unstructured( id: impl Into<ElementId>, state: &Entity<DialogState>, accessibility_label: impl Into<SharedString>, ) -> Dialog
Creates a modal shell whose body owns the structure and scrolling.
Sourcepub fn open_window(
state: &Entity<DialogState>,
parent: &mut Window,
options: WindowOptions,
cx: &mut App,
build: impl Fn(&Entity<DialogState>, &mut Window, &mut App) -> Dialog + 'static,
) -> Result<Option<AnyWindowHandle>, Error>
pub fn open_window( state: &Entity<DialogState>, parent: &mut Window, options: WindowOptions, cx: &mut App, build: impl Fn(&Entity<DialogState>, &mut Window, &mut App) -> Dialog + 'static, ) -> Result<Option<AnyWindowHandle>, Error>
Opens a separate GPUI modal window, with the active window as its native parent. Supply the invoking window and build a fresh dialog on each render. An already open state returns its native window handle, or None for an in-window dialog.
pub fn variant(self, variant: DialogVariant) -> Dialog
pub fn icon(self, icon: impl IntoElement) -> Dialog
Sourcepub fn title_content(self, title: impl IntoElement) -> Dialog
pub fn title_content(self, title: impl IntoElement) -> Dialog
Replaces the visual heading, keeping the constructor’s accessible name.
pub fn show_title(self, show: bool) -> Dialog
pub fn description(self, description: impl Into<SharedString>) -> Dialog
pub fn body(self, body: impl IntoElement) -> Dialog
Sourcepub fn body_content<E>(
self,
body: impl FnOnce(DialogAction, DialogAction) -> E + 'static,
) -> Dialogwhere
E: IntoElement,
pub fn body_content<E>(
self,
body: impl FnOnce(DialogAction, DialogAction) -> E + 'static,
) -> Dialogwhere
E: IntoElement,
Builds the body with the confirmation and cancellation activation handles.
Sourcepub fn confirm(
self,
label: impl Into<SharedString>,
action: impl Fn(&mut Window, &mut App) -> bool + 'static,
) -> Dialog
pub fn confirm( self, label: impl Into<SharedString>, action: impl Fn(&mut Window, &mut App) -> bool + 'static, ) -> Dialog
Sets the default action and validation. Returning false keeps the dialog open.
Sourcepub fn on_confirm(
self,
label: impl Into<SharedString>,
action: impl Fn(&mut Window, &mut App) + 'static,
) -> Dialog
pub fn on_confirm( self, label: impl Into<SharedString>, action: impl Fn(&mut Window, &mut App) + 'static, ) -> Dialog
Sets a non-validating confirmation action that always closes the dialog after running.
Sourcepub fn confirm_tone(self, tone: SemanticTone) -> Dialog
pub fn confirm_tone(self, tone: SemanticTone) -> Dialog
Applies a Material 3 semantic tone to the default confirmation button.
Sourcepub fn confirm_content<E>(
self,
content: impl FnOnce(DialogAction) -> E + 'static,
) -> Dialogwhere
E: IntoElement,
pub fn confirm_content<E>(
self,
content: impl FnOnce(DialogAction) -> E + 'static,
) -> Dialogwhere
E: IntoElement,
Builds a custom confirmation control. Wire its activation to the supplied action.
Sourcepub fn dismiss_content<E>(
self,
content: impl FnOnce(DialogAction) -> E + 'static,
) -> Dialogwhere
E: IntoElement,
pub fn dismiss_content<E>(
self,
content: impl FnOnce(DialogAction) -> E + 'static,
) -> Dialogwhere
E: IntoElement,
Builds a custom cancellation control. Wire its activation to the supplied action.
pub fn cancel_label(self, label: impl Into<SharedString>) -> Dialog
Sourcepub fn show_cancel(self, show: bool) -> Dialog
pub fn show_cancel(self, show: bool) -> Dialog
Sets whether to include a default cancellation control when there is no custom one.
Sourcepub fn layer(self, layer: usize) -> Dialog
pub fn layer(self, layer: usize) -> Dialog
Set a higher layer for a nested modal. Only the top modal can receive input.
pub fn properties(self, properties: DialogProperties) -> Dialog
Sourcepub fn on_dismiss_request(
self,
request: impl Fn(DialogCloseReason, &mut Window, &mut App) -> bool + 'static,
) -> Dialog
pub fn on_dismiss_request( self, request: impl Fn(DialogCloseReason, &mut Window, &mut App) -> bool + 'static, ) -> Dialog
Handles Escape, outside-click, and system window-close requests. Return false to veto.
Sourcepub fn on_close(
self,
close: impl Fn(DialogCloseReason, &mut Window, &mut App) + 'static,
) -> Dialog
pub fn on_close( self, close: impl Fn(DialogCloseReason, &mut Window, &mut App) + 'static, ) -> Dialog
Reports one accepted user close after the visibility state has changed.
pub fn shape(self, shape: CornerShape) -> Dialog
pub fn colors(self, colors: DialogColors) -> Dialog
Sourcepub fn tonal_elevation(self, elevation: Elevation) -> Dialog
pub fn tonal_elevation(self, elevation: Elevation) -> Dialog
Selects a tonal Material surface when the container color uses the theme.
pub fn shadow_elevation(self, elevation: Elevation) -> Dialog
pub fn scrim_color(self, color: Hsla) -> Dialog
Sourcepub fn scrim_opacity(self, opacity: f32) -> Dialog
pub fn scrim_opacity(self, opacity: f32) -> Dialog
Sets in-window backdrop opacity, clamped to 0–1. NaN uses the default.
Trait Implementations§
Source§impl IntoElement for Dialog
impl IntoElement for Dialog
Source§type Element = ViewElement<Dialog>
type Element = ViewElement<Dialog>
Source§fn into_element(self) -> <Dialog as IntoElement>::Element
fn into_element(self) -> <Dialog as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for Dialog
impl RenderOnce for Dialog
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for Dialog
impl !Send for Dialog
impl !Sync for Dialog
impl !UnwindSafe for Dialog
impl Forget for Dialog
impl Freeze for Dialog
impl Move for Dialog
impl Unpin for Dialog
impl UnsafeUnpin for Dialog
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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
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> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
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> ⓘ
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> ⓘ
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 moreSource§impl<T> MaterialElementExt for Twhere
T: IntoElement,
impl<T> MaterialElementExt for Twhere
T: IntoElement,
Source§fn badge_label(self, text: impl Into<SharedString>) -> Badge
fn badge_label(self, text: impl Into<SharedString>) -> Badge
Badge to this element’s upper trailing edge.Source§fn badge_count(self, count: usize, maximum: usize) -> Badge
fn badge_count(self, count: usize, maximum: usize) -> Badge
Badge to this element’s upper trailing edge.Source§fn tooltip(
self,
id: impl Into<ElementId>,
text: impl Into<SharedString>,
) -> Tooltip
fn tooltip( self, id: impl Into<ElementId>, text: impl Into<SharedString>, ) -> Tooltip
Tooltip.Menu.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text for an image’s alternative text, which
stands in for what the element draws.